Migrate to ESM and upgrade dependencies#1574
Open
gowridurgad wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the setup-node codebase and tooling from CommonJS to ESM, aligning runtime behavior (NodeNext resolution + import.meta.url) with updated dependencies and ESM-compatible lint/test configuration.
Changes:
- Switch TypeScript compilation to
module: NodeNextand update internal relative imports to include.jsextensions. - Migrate Jest and ESLint configuration to ESM-friendly setups (flat ESLint config + TS Jest config + ESM mocking patterns).
- Upgrade Actions/toolkit and related dependencies, and refresh
licensedmetadata accordingly.
Reviewed changes
Copilot reviewed 73 out of 85 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Switch TS module output to NodeNext and exclude jest config from compilation. |
| src/util.ts | Update catch clause style while keeping behavior unchanged. |
| src/setup-node.ts | Update entrypoint import to ESM-friendly .js specifier. |
| src/main.ts | Convert internal imports to .js and replace __dirname usage with import.meta.url resolution. |
| src/distributions/v8-canary/canary_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/rc/rc_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/official_builds/official_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/nightly/nightly_builds.ts | Update internal imports to .js specifiers. |
| src/distributions/installer-factory.ts | Update internal imports to .js specifiers. |
| src/distributions/base-distribution.ts | Update imports for ESM and replace __dirname usage with import.meta.url resolution. |
| src/distributions/base-distribution-prerelease.ts | Update internal imports to .js specifiers. |
| src/cache-utils.ts | Update internal import to .js and fix async command output usage (await). |
| src/cache-save.ts | Update internal imports to .js specifiers. |
| src/cache-restore.ts | Update internal imports to .js specifiers. |
| package.json | Mark package as ESM, update scripts, and upgrade dependencies/tooling. |
| jest.config.ts | Add ESM-compatible Jest configuration using ts-jest with useESM. |
| jest.config.js | Remove legacy CommonJS Jest configuration. |
| eslint.config.mjs | Add flat ESLint config in ESM format. |
| dist/setup/package.json | Add package boundary metadata for the bundled setup entrypoint. |
| dist/cache-save/package.json | Add package boundary metadata for the bundled post-action entrypoint. |
| .prettierrc.json | Add Prettier configuration in JSON format. |
| .prettierrc.js | Remove legacy CommonJS Prettier configuration. |
| .licensed.yml | Update allowed/reviewed licenses and normalize indentation for reviewed packages. |
| .eslintrc.js | Remove legacy ESLint config (replaced by flat config). |
| .eslintignore | Remove legacy ignore file (handled via flat config ignores). |
| tests/rc-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/problem-matcher.test.ts | Update tests to use ESM JSON import attributes and Jest globals. |
| tests/official-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/nightly-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/mock/glob-mock.test.ts | Update internal test import to .js specifier and Jest globals. |
| tests/main.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/canary-installer.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/cache-utils.test.ts | Update tests to mock @actions/exec.getExecOutput and align with async command execution. |
| tests/cache-save.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/cache-restore.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| tests/authutil.test.ts | Update tests for ESM execution + ESM-safe mocking/import patterns. |
| .licenses/npm/xml-naming.dep.yml | Normalize license metadata formatting (homepage field). |
| .licenses/npm/wrappy.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/universal-user-agent.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/strnum.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/semver.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/semver-6.3.1.dep.yml | Remove old semver v6 license metadata entry. |
| .licenses/npm/once.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/minimatch-3.1.5.dep.yml | Add license metadata for additional minimatch version present in resolution. |
| .licenses/npm/minimatch-10.2.5.dep.yml | Add license metadata for upgraded minimatch version present in resolution. |
| .licenses/npm/json-with-bigint.dep.yml | Update license metadata to match dependency name/version/copyright. |
| .licenses/npm/fast-xml-parser.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/fast-content-type-parse.dep.yml | Update license metadata to match new dependency and reviewed status. |
| .licenses/npm/deprecation.dep.yml | Remove license metadata entry (dependency resolution changed). |
| .licenses/npm/brace-expansion-5.0.6.dep.yml | Update license metadata to match resolved dependency content. |
| .licenses/npm/brace-expansion-1.1.13.dep.yml | Add license metadata for additional brace-expansion version present in resolution. |
| .licenses/npm/before-after-hook.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/balanced-match-4.0.4.dep.yml | Add license metadata for additional balanced-match version present in resolution. |
| .licenses/npm/balanced-match-1.0.2.dep.yml | Add license metadata for additional balanced-match version present in resolution. |
| .licenses/npm/@typespec/ts-http-runtime.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/types.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/types-13.10.0.dep.yml | Remove old @octokit/types license metadata entry. |
| .licenses/npm/@octokit/request.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/request-error.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/plugin-paginate-rest.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/openapi-types.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@octokit/graphql.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/endpoint.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/core.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@octokit/auth-token.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@nodable/entities.dep.yml | Update license metadata formatting/version alignment. |
| .licenses/npm/@azure/storage-common.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/storage-blob.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-xml.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-rest-pipeline.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/core-http-compat.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@azure/abort-controller.dep.yml | Add license metadata for newly present dependency in resolution. |
| .licenses/npm/@actions/tool-cache.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/io.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/http-client-4.0.1.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@actions/glob-0.7.0.dep.yml | Update license metadata to match upgraded dependency version/content. |
| .licenses/npm/@actions/glob-0.6.1.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/github.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/exec.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/core.dep.yml | Update license metadata to match upgraded dependency version. |
| .licenses/npm/@actions/cache.dep.yml | Update license metadata to match upgraded dependency version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Migrates setup-node from CommonJS to ECMAScript Modules (ESM)
Related issue:
Add link to the related issue.
Check list: