Skip to content

Conversation

@ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Dec 17, 2025

Summary

Users importing these packages in Node.js projects get ERR_MODULE_NOT_FOUND errors because the published code is missing file extensions that Node.js requires. This PR adds the missing .js extensions to fix the imports.

Packages fixed: @actions/expressions, @actions/workflow-parser, @actions/languageservice

Deferred: @actions/languageserver (blocked by upstream dependency)

Related Issues

Approach

Used Option B (manual .js extensions) from the migration plan, which:

  • Uses .js extensions in source TypeScript files
  • Works with TypeScript 4.7+ with node16 moduleResolution
  • Avoids ts-jest compatibility issues with rewriteRelativeImportExtensions
  • No post-processing scripts needed

Changes

  • Update tsconfig.build.json in each package to use module: node16 and moduleResolution: node16
  • Add .js extensions to all relative import paths
  • Fix yaml internal type imports in workflow-parser by defining local types
  • Add skipLibCheck: true to handle @types/node compatibility issues
  • Add TypeScript 5.8.3 override in root package.json
  • Add ESM migration plan documentation

Test Results

Package Tests Status
expressions 1068 ✅ Pass
workflow-parser 292 ✅ Pass
languageservice 452 ✅ Pass

Deferred

The languageserver package is deferred from this migration due to test hang issues that need further investigation. See docs/esm-migration-plan.md for details.

Related

Migrate expressions, workflow-parser, and languageservice packages to use
proper ESM imports with .js extensions that work with node16 moduleResolution.

Changes:
- Update tsconfig.build.json in each package to use module: node16 and
  moduleResolution: node16
- Add .js extensions to all relative import paths (Option B approach)
- Fix yaml internal type imports in workflow-parser by defining local types
- Add skipLibCheck to handle @types/node compatibility issues
- Add TypeScript 5.8.3 override in root package.json
- Add ESM migration plan documentation

The languageserver package is deferred due to test hang issues that need
further investigation.

Fixes #154 - Upgrade moduleResolution from node to node16 or nodenext
Fixes #110 - Published ESM code has imports without file extensions
Fixes #64 - expressions: ERR_MODULE_NOT_FOUND attempting to run example
Fixes #146 - Can not import @actions/workflow-parser

Test results:
- expressions: 1068 tests passed
- workflow-parser: 292 tests passed
- languageservice: 452 tests passed
@ericsciple ericsciple requested a review from a team as a code owner December 17, 2025 07:19
Copilot AI review requested due to automatic review settings December 17, 2025 07:19
@ericsciple ericsciple marked this pull request as draft December 17, 2025 07:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates three packages (expressions, workflow-parser, and languageservice) to proper ESM with node16 moduleResolution by adding .js extensions to all relative imports. This fixes critical issues where published ESM packages had extensionless imports that failed to load in Node.js 12+.

Key Changes:

  • Updated tsconfig.build.json in each package to use module: node16 and moduleResolution: node16
  • Added .js extensions to all relative import statements in TypeScript source files
  • Upgraded TypeScript to 5.8.3 with override in root package.json
  • Added comprehensive migration documentation

Reviewed changes

Copilot reviewed 185 out of 186 changed files in this pull request and generated no comments.

Show a summary per file
File Description
workflow-parser/tsconfig.build.json Added node16 module/moduleResolution config with skipLibCheck
workflow-parser/src/**/*.ts Added .js extensions to ~100+ import statements across all source files
workflow-parser/src/workflows/yaml-object-reader.ts Defined local types for yaml internals to avoid importing unexported types
languageservice/tsconfig.build.json Added node16 module/moduleResolution config with skipLibCheck
languageservice/src/**/*.ts Added .js extensions to ~150+ import statements across all source files
expressions/tsconfig.build.json Added node16 module/moduleResolution config with skipLibCheck
expressions/src/**/*.ts Added .js extensions to ~80+ import statements across all source files
package.json Added TypeScript 5.8.3 as dev dependency with override configuration
package-lock.json Updated TypeScript versions across workspace, maintaining 4.9.5 for languageserver
docs/esm-migration-plan.md Added comprehensive 262-line migration plan documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Update languageserver blocker: vscode-languageserver v8.0.2 lacks ESM
  exports (not a test hang issue)
- Document that Option B (manual .js extensions) was chosen over Option A
  due to ts-jest compatibility issues
- Add workaround for yaml package internal types (LinePos, NodeBase)
- Update migration status table with accurate reason for deferral
- Add skipLibCheck note for @types/node compatibility
@ericsciple ericsciple marked this pull request as ready for review December 17, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants