From 1045eaeb7b2712595a00410d1548c42def249d18 Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Wed, 28 Jan 2026 09:30:08 -0500 Subject: [PATCH] http-client: convert to ESM --- package-lock.json | 4 ++-- package.json | 13 ++++++++++++- src/auth.ts | 4 ++-- src/index.ts | 4 ++-- src/interfaces.ts | 2 +- tsconfig.json | 3 ++- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index d109c49..2a62516 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/http-client", - "version": "3.0.2", + "version": "4.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@actions/http-client", - "version": "3.0.2", + "version": "4.0.0", "license": "MIT", "dependencies": { "tunnel": "^0.0.6", diff --git a/package.json b/package.json index ab4c38c..4f07296 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/http-client", - "version": "3.0.2", + "version": "4.0.0", "description": "Actions Http Client", "keywords": [ "github", @@ -9,8 +9,19 @@ ], "homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client", "license": "MIT", + "type": "module", "main": "lib/index.js", "types": "lib/index.d.ts", + "exports": { + ".": { + "types": "./lib/index.d.ts", + "import": "./lib/index.js" + }, + "./lib/auth": { + "types": "./lib/auth.d.ts", + "import": "./lib/auth.js" + } + }, "directories": { "lib": "lib", "test": "__tests__" diff --git a/src/auth.ts b/src/auth.ts index 58938ac..b856a31 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,6 +1,6 @@ import * as http from 'http' -import * as ifm from './interfaces' -import {HttpClientResponse} from './index' +import * as ifm from './interfaces.js' +import {HttpClientResponse} from './index.js' export class BasicCredentialHandler implements ifm.RequestHandler { username: string diff --git a/src/index.ts b/src/index.ts index 2aee17d..2f94094 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,9 +2,9 @@ import * as http from 'http' import * as https from 'https' -import * as ifm from './interfaces' +import * as ifm from './interfaces.js' import * as net from 'net' -import * as pm from './proxy' +import * as pm from './proxy.js' import * as tunnel from 'tunnel' import {ProxyAgent} from 'undici' diff --git a/src/interfaces.ts b/src/interfaces.ts index 96b0fec..e1ffcd3 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,6 +1,6 @@ import * as http from 'http' import * as https from 'https' -import {HttpClientResponse} from './index' +import {HttpClientResponse} from './index.js' export interface HttpClient { options( diff --git a/tsconfig.json b/tsconfig.json index 222ca41..181e17d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "outDir": "./lib", "rootDir": "./src", - "moduleResolution": "node", + "module": "node16", + "moduleResolution": "node16", "declaration": true, }, "include": [