@actions/glob: convert to an ESM module (#2273)

* `@actions/glob`: convert to an ESM module

* Update packages/glob/RELEASES.md

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Daniel Kennedy
2026-01-29 10:41:33 -05:00
committed by GitHub
co-authored by Copilot
parent 5793b08cd9
commit 7a0147b5c6
18 changed files with 87 additions and 67 deletions
+3 -2
View File
@@ -14,7 +14,8 @@ module.exports = {
'^@actions/http-client/lib/auth$': '<rootDir>/packages/http-client/lib/auth.js', '^@actions/http-client/lib/auth$': '<rootDir>/packages/http-client/lib/auth.js',
'^@actions/http-client/lib/interfaces$': '<rootDir>/packages/http-client/lib/interfaces.js', '^@actions/http-client/lib/interfaces$': '<rootDir>/packages/http-client/lib/interfaces.js',
'^@actions/github$': '<rootDir>/packages/github/lib/github.js', '^@actions/github$': '<rootDir>/packages/github/lib/github.js',
'^@actions/github/lib/utils$': '<rootDir>/packages/github/lib/utils.js' '^@actions/github/lib/utils$': '<rootDir>/packages/github/lib/utils.js',
'^@actions/glob$': '<rootDir>/packages/glob/lib/glob.js'
}, },
transform: { transform: {
'^.+\\.(ts|js)$': ['ts-jest', { '^.+\\.(ts|js)$': ['ts-jest', {
@@ -29,7 +30,7 @@ module.exports = {
}] }]
}, },
transformIgnorePatterns: [ transformIgnorePatterns: [
'/node_modules/(?!(@octokit|@actions/github|@actions/http-client|@actions/io|@actions/exec|@actions/core|universal-user-agent|before-after-hook)/)' '/node_modules/(?!(@octokit|@actions/github|@actions/http-client|@actions/io|@actions/exec|@actions/core|@actions/glob|universal-user-agent|before-after-hook)/)'
], ],
verbose: true verbose: true
} }
+21 -11
View File
@@ -1,33 +1,43 @@
# @actions/glob Releases # @actions/glob Releases
### 0.5.1 ## 0.6.0
- **Breaking change**: Package is now ESM-only
- CommonJS consumers must use dynamic `import()` instead of `require()`
## 0.5.1
- Bump `@actions/core` to `2.0.3` - Bump `@actions/core` to `2.0.3`
### 0.5.0 ## 0.5.0
- Added `excludeHiddenFiles` option, which is disabled by default to preserve existing behavior [#1791: Add glob option to ignore hidden files](https://github.com/actions/toolkit/pull/1791) - Added `excludeHiddenFiles` option, which is disabled by default to preserve existing behavior [#1791: Add glob option to ignore hidden files](https://github.com/actions/toolkit/pull/1791)
### 0.4.0 ## 0.4.0
- Pass in the current workspace as a parameter to HashFiles [#1318](https://github.com/actions/toolkit/pull/1318) - Pass in the current workspace as a parameter to HashFiles [#1318](https://github.com/actions/toolkit/pull/1318)
### 0.3.0 ## 0.3.0
- Added a `verbose` option to HashFiles [#1052](https://github.com/actions/toolkit/pull/1052/files) - Added a `verbose` option to HashFiles [#1052](https://github.com/actions/toolkit/pull/1052/files)
### 0.2.1 ## 0.2.1
- Update `lockfileVersion` to `v2` in `package-lock.json [#1023](https://github.com/actions/toolkit/pull/1023)
- Update `lockfileVersion` to `v2` in `package-lock.json` [#1023](https://github.com/actions/toolkit/pull/1023)
## 0.2.0
### 0.2.0
- [Added the hashFiles function to Glob](https://github.com/actions/toolkit/pull/830) - [Added the hashFiles function to Glob](https://github.com/actions/toolkit/pull/830)
- [Added an option to filter out directories](https://github.com/actions/toolkit/pull/728) - [Added an option to filter out directories](https://github.com/actions/toolkit/pull/728)
### 0.1.2 ## 0.1.2
- [Fix bug where files were matched incorrectly](https://github.com/actions/toolkit/pull/805) - [Fix bug where files were matched incorrectly](https://github.com/actions/toolkit/pull/805)
### 0.1.1 ## 0.1.1
- Update @actions/core version - Update @actions/core version
### 0.1.0
## 0.1.0
- Initial release - Initial release
+2 -2
View File
@@ -1,6 +1,6 @@
import * as io from '../../io/src/io' import * as io from '../../io/src/io.js'
import * as path from 'path' import * as path from 'path'
import {hashFiles} from '../src/glob' import {hashFiles} from '../src/glob.js'
import {promises as fs} from 'fs' import {promises as fs} from 'fs'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
@@ -1,9 +1,9 @@
import * as child from 'child_process' import * as child from 'child_process'
import * as io from '../../io/src/io' import * as io from '../../io/src/io.js'
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import {Globber, DefaultGlobber} from '../src/internal-globber' import {Globber, DefaultGlobber} from '../src/internal-globber.js'
import {GlobOptions} from '../src/internal-glob-options' import {GlobOptions} from '../src/internal-glob-options.js'
import {promises as fs} from 'fs' import {promises as fs} from 'fs'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
@@ -1,4 +1,4 @@
import * as pathHelper from '../src/internal-path-helper' import * as pathHelper from '../src/internal-path-helper.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
@@ -1,5 +1,5 @@
import * as path from 'path' import * as path from 'path'
import {Path} from '../src/internal-path' import {Path} from '../src/internal-path.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
@@ -1,8 +1,8 @@
import * as path from 'path' import * as path from 'path'
import * as patternHelper from '../src/internal-pattern-helper' import * as patternHelper from '../src/internal-pattern-helper.js'
import {MatchKind} from '../src/internal-match-kind' import {MatchKind} from '../src/internal-match-kind.js'
import {IS_WINDOWS} from '../../io/src/io-util' import {IS_WINDOWS} from '../../io/src/io-util.js'
import {Pattern} from '../src/internal-pattern' import {Pattern} from '../src/internal-pattern.js'
describe('pattern-helper', () => { describe('pattern-helper', () => {
it('getSearchPaths omits negate search paths', () => { it('getSearchPaths omits negate search paths', () => {
@@ -1,9 +1,9 @@
import * as io from '../../io/src/io' import * as io from '../../io/src/io.js'
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import {MatchKind} from '../src/internal-match-kind' import {MatchKind} from '../src/internal-match-kind.js'
import {promises as fs} from 'fs' import {promises as fs} from 'fs'
import {Pattern} from '../src/internal-pattern' import {Pattern} from '../src/internal-pattern.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+18 -18
View File
@@ -1,41 +1,41 @@
{ {
"name": "@actions/glob", "name": "@actions/glob",
"version": "0.5.1", "version": "0.6.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@actions/glob", "name": "@actions/glob",
"version": "0.5.1", "version": "0.6.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^2.0.3", "@actions/core": "^3.0.0",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "2.0.3", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.3.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz",
"integrity": "sha512-Od9Thc3T1mQJYddvVPM4QGiLUewdh+3txmDYHHxoNdkqysR1MbCT+rFOtNUxYAz+7+6RIsqipVahY2GJqGPyxA==", "integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/exec": "^2.0.0", "@actions/exec": "^3.0.0",
"@actions/http-client": "^3.0.2" "@actions/http-client": "^4.0.0"
} }
}, },
"node_modules/@actions/exec": { "node_modules/@actions/exec": {
"version": "2.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz",
"integrity": "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw==", "integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/io": "^2.0.0" "@actions/io": "^3.0.2"
} }
}, },
"node_modules/@actions/http-client": { "node_modules/@actions/http-client": {
"version": "3.0.2", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==", "integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
@@ -43,9 +43,9 @@
} }
}, },
"node_modules/@actions/io": { "node_modules/@actions/io": {
"version": "2.0.0", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz",
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==", "integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/balanced-match": { "node_modules/balanced-match": {
+9 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@actions/glob", "name": "@actions/glob",
"version": "0.5.1", "version": "0.6.0",
"preview": true, "preview": true,
"description": "Actions glob lib", "description": "Actions glob lib",
"keywords": [ "keywords": [
@@ -10,8 +10,15 @@
], ],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/glob", "homepage": "https://github.com/actions/toolkit/tree/main/packages/glob",
"license": "MIT", "license": "MIT",
"type": "module",
"main": "lib/glob.js", "main": "lib/glob.js",
"types": "lib/glob.d.ts", "types": "lib/glob.d.ts",
"exports": {
".": {
"types": "./lib/glob.d.ts",
"import": "./lib/glob.js"
}
},
"directories": { "directories": {
"lib": "lib", "lib": "lib",
"test": "__tests__" "test": "__tests__"
@@ -37,7 +44,7 @@
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^2.0.3", "@actions/core": "^3.0.0",
"minimatch": "^3.0.4" "minimatch": "^3.0.4"
} }
} }
+4 -4
View File
@@ -1,7 +1,7 @@
import {Globber, DefaultGlobber} from './internal-globber' import {Globber, DefaultGlobber} from './internal-globber.js'
import {GlobOptions} from './internal-glob-options' import {GlobOptions} from './internal-glob-options.js'
import {HashFileOptions} from './internal-hash-file-options' import {HashFileOptions} from './internal-hash-file-options.js'
import {hashFiles as _hashFiles} from './internal-hash-files' import {hashFiles as _hashFiles} from './internal-hash-files.js'
export {Globber, GlobOptions} export {Globber, GlobOptions}
@@ -1,5 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {GlobOptions} from './internal-glob-options' import {GlobOptions} from './internal-glob-options.js'
/** /**
* Returns a copy with defaults filled in. * Returns a copy with defaults filled in.
+6 -6
View File
@@ -1,12 +1,12 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as fs from 'fs' import * as fs from 'fs'
import * as globOptionsHelper from './internal-glob-options-helper' import * as globOptionsHelper from './internal-glob-options-helper.js'
import * as path from 'path' import * as path from 'path'
import * as patternHelper from './internal-pattern-helper' import * as patternHelper from './internal-pattern-helper.js'
import {GlobOptions} from './internal-glob-options' import {GlobOptions} from './internal-glob-options.js'
import {MatchKind} from './internal-match-kind' import {MatchKind} from './internal-match-kind.js'
import {Pattern} from './internal-pattern' import {Pattern} from './internal-pattern.js'
import {SearchState} from './internal-search-state' import {SearchState} from './internal-search-state.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+1 -1
View File
@@ -4,7 +4,7 @@ import * as fs from 'fs'
import * as stream from 'stream' import * as stream from 'stream'
import * as util from 'util' import * as util from 'util'
import * as path from 'path' import * as path from 'path'
import {Globber} from './glob' import {Globber} from './glob.js'
export async function hashFiles( export async function hashFiles(
globber: Globber, globber: Globber,
+1 -1
View File
@@ -1,5 +1,5 @@
import * as path from 'path' import * as path from 'path'
import * as pathHelper from './internal-path-helper' import * as pathHelper from './internal-path-helper.js'
import assert from 'assert' import assert from 'assert'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+3 -3
View File
@@ -1,6 +1,6 @@
import * as pathHelper from './internal-path-helper' import * as pathHelper from './internal-path-helper.js'
import {MatchKind} from './internal-match-kind' import {MatchKind} from './internal-match-kind.js'
import {Pattern} from './internal-pattern' import {Pattern} from './internal-pattern.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+3 -3
View File
@@ -1,10 +1,10 @@
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import * as pathHelper from './internal-path-helper' import * as pathHelper from './internal-path-helper.js'
import assert from 'assert' import assert from 'assert'
import {Minimatch, IMinimatch, IOptions as IMinimatchOptions} from 'minimatch' import {Minimatch, IMinimatch, IOptions as IMinimatchOptions} from 'minimatch'
import {MatchKind} from './internal-match-kind' import {MatchKind} from './internal-match-kind.js'
import {Path} from './internal-path' import {Path} from './internal-path.js'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
+3 -1
View File
@@ -3,7 +3,9 @@
"compilerOptions": { "compilerOptions": {
"baseUrl": "./", "baseUrl": "./",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src" "rootDir": "./src",
"module": "node16",
"moduleResolution": "node16"
}, },
"include": [ "include": [
"./src" "./src"