Skip to content

Switch to ESM and add native TypeScript task loading (Node 22.18+), update tests and docs#1

Open
benjaie wants to merge 2 commits into
type-strippingfrom
codex/enable-verbatim-syntax-and-switch-to-esm
Open

Switch to ESM and add native TypeScript task loading (Node 22.18+), update tests and docs#1
benjaie wants to merge 2 commits into
type-strippingfrom
codex/enable-verbatim-syntax-and-switch-to-esm

Conversation

@benjaie

@benjaie benjaie commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Modernize the package to be published as ESM, leverage Node's native type-stripping for erasable TypeScript, and make .ts/.mts first-class task file extensions.
  • Increase minimum Node version support to a current LTS (Node 22.18+) to rely on native ESM/TypeScript features and avoid older Node issues.
  • Update examples, docs, and tests to match ESM-style usage and ensure loader behavior is deterministic for both ESM and legacy CommonJS consumers.

Description

  • Mark the package ESM in docs and release notes and document breaking changes (ESM package, .js tasks in ESM projects must use export default, and .ts/.mts are supported by default).
  • Add .ts and .mts to the default fileExtensions in src/config.ts, src/index.ts docs, LoadTaskFromJsPlugin.ts defaults, and various doc examples and performance presets.
  • Convert many example task files and README snippets to ESM-style import and export default and add TS/MTS fixtures (__tests__/fixtures-esm/tasks/typescript.ts and module-typescript.mts).
  • Update tests to use import type for type-only imports where appropriate and add assertions that .ts/.mts tasks are discovered and executed.
  • Rename jest.config.js to jest.config.cjs and configure Jest to treat .ts as ESM via extensionsToTreatAsEsm: [".ts"].
  • Update tsconfig.json to enable verbatimModuleSyntax to better preserve ESM semantics during compilation.
  • Update RELEASE_NOTES.md, docs under website/docs/ and contributing guides to explain ESM/TS changes and Node requirements.

Testing

  • Ran the TypeScript build (yarn prepack) to ensure compilation and type output succeed, and it completed successfully.
  • Ran the unit test suite (yarn test / jest) including the updated fixtures and tests verifying .ts/.mts task loading, and all tests passed.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant