From ecb233520182a9568883eba16f6ce968d69da465 Mon Sep 17 00:00:00 2001 From: Daniel Kennedy Date: Wed, 28 Jan 2026 13:25:11 -0500 Subject: [PATCH] `@actions/io`: convert to ESM module --- __tests__/io.test.ts | 4 ++-- package-lock.json | 4 ++-- package.json | 9 ++++++++- src/io.ts | 2 +- tsconfig.json | 4 +++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/__tests__/io.test.ts b/__tests__/io.test.ts index 0fcab0d..39d3a58 100644 --- a/__tests__/io.test.ts +++ b/__tests__/io.test.ts @@ -2,8 +2,8 @@ import * as child from 'child_process' import {promises as fs} from 'fs' import * as os from 'os' import * as path from 'path' -import * as io from '../src/io' -import * as ioUtil from '../src/io-util' +import * as io from '../src/io.js' +import * as ioUtil from '../src/io-util.js' describe('cp', () => { beforeAll(async () => { diff --git a/package-lock.json b/package-lock.json index ddd87ac..09b881c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/io", - "version": "2.0.0", + "version": "3.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@actions/io", - "version": "2.0.0", + "version": "3.0.0", "license": "MIT" } } diff --git a/package.json b/package.json index f0be120..b928070 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/io", - "version": "2.0.0", + "version": "3.0.0", "description": "Actions io lib", "keywords": [ "github", @@ -9,8 +9,15 @@ ], "homepage": "https://github.com/actions/toolkit/tree/main/packages/io", "license": "MIT", + "type": "module", "main": "lib/io.js", "types": "lib/io.d.ts", + "exports": { + ".": { + "types": "./lib/io.d.ts", + "import": "./lib/io.js" + } + }, "directories": { "lib": "lib", "test": "__tests__" diff --git a/src/io.ts b/src/io.ts index bbd8efd..3c3bb9f 100644 --- a/src/io.ts +++ b/src/io.ts @@ -1,6 +1,6 @@ import {ok} from 'assert' import * as path from 'path' -import * as ioUtil from './io-util' +import * as ioUtil from './io-util.js' /** * Interface for cp/mv options diff --git a/tsconfig.json b/tsconfig.json index a8b812a..c440cd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,9 @@ "compilerOptions": { "baseUrl": "./", "outDir": "./lib", - "rootDir": "./src" + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16" }, "include": [ "./src"