@CharlieHelps your task is described below. read the instructions and reply with an implementation plan:
Objective: Update the alias package in packages/alias to use ESM only and update minimum platform dependencies
Steps:
- Update the minimum node version in package.json to 20.19.0. (20.19.0 is the first LTS maintenance version which supports frictionless inline ESM/CJS imports/requires)
- Update the minimum rollup version in package.json to 4.0.0
- Given the minimum Node version of 20.19.0, update any code within
packages/alias to use modern Node APIs unless it is detrimental to performance
- Create a new
.config directory at the repo root
- Create a copy of
shared/rollup.config.mjs at .config/rollup-plugin.mjs and remove the typescript rollup plugin from .config/rollup-plugin.mjs
- Create a copy of
tsconfig.base.json at .config/tsconfig.base.json
- Create a copy of
shared/tsconfig.json at .config/tsconfig.plugin.json, and change the extended config to ./tsconfig.base.json
- Update
.config/tsconfig.base.json to use the latest module, resolution, lib settings which corresponds to the alias plugin moving to ESM only
- Update
.config/tsconfig.plugin.json, set noEmit: false and outDir: tsc.out
- Update the
packages/alias/tsconfig.json symlink to point to .config/tsconfig.plugin.json
- Update the plugin's build scripts to execute
tsc --project tsconfig.json before rollup is executed
- Update the
packages/alias/rollup.config.mjs file to use .config/rollup-plugin.mjs
- Update the
packages/alias/rollup.config.mjs file to target the files in ./tsc.out
- Update the
packages/alias/rollup.config.mjs file to use the appropriate rollup plugin (if one exists, otherwise use code) to include/copy source maps and type definitions from tsc.out to dist
- Update the
packages/alias/package.json file to properly setup properties and exports for an ESM only package
- Compare the types created from
tsc to those which were previously hand-authored in packages/alias/types/index.d.ts - improve the code in packages/alias/src/index.ts if the hand-authored types contain information that the generated types do not - we want to make sure we're not degrading the developer experience
- Install vitest 4.0.1 at the repository root using
pnpm add vitest@latest -w -D
- Create a new vitest config file in
.config which forces snapshots to be saved in the relative test directory under .snapshots
- Run current tests to understand how they work
- Remove all CJS branches in tests, they will no longer be relevant
- Convert tests in
packages/alias/test from Ava to vitest and update the test files to use typescript (.ts) instead of plain javascript
- Run tests and include the snapshot files in any commits. Any existing snapshot files will need to be overwritten as existing files will be in the Ava format. This is OK since we know that tests are passing
- Update CONTRIBUTING.md to include information about the
current-package symlink described below
Notes:
- Each package’s tests include a symlink at test/node_modules/current-package pointing back to the
package root (../..). If you see import ... from 'current-package' that's where the import points to
- PR title should follow the format
feat({plugin})!: ESM only. Update Node and Rollup minimum versions
@CharlieHelps your task is described below. read the instructions and reply with an implementation plan:
Objective: Update the alias package in packages/alias to use ESM only and update minimum platform dependencies
Steps:
packages/aliasto use modern Node APIs unless it is detrimental to performance.configdirectory at the repo rootshared/rollup.config.mjsat.config/rollup-plugin.mjsand remove the typescript rollup plugin from.config/rollup-plugin.mjstsconfig.base.jsonat.config/tsconfig.base.jsonshared/tsconfig.jsonat.config/tsconfig.plugin.json, and change the extended config to./tsconfig.base.json.config/tsconfig.base.jsonto use the latest module, resolution, lib settings which corresponds to the alias plugin moving to ESM only.config/tsconfig.plugin.json, setnoEmit: falseandoutDir: tsc.outpackages/alias/tsconfig.jsonsymlink to point to.config/tsconfig.plugin.jsontsc --project tsconfig.jsonbefore rollup is executedpackages/alias/rollup.config.mjsfile to use.config/rollup-plugin.mjspackages/alias/rollup.config.mjsfile to target the files in./tsc.outpackages/alias/rollup.config.mjsfile to use the appropriate rollup plugin (if one exists, otherwise use code) to include/copy source maps and type definitions fromtsc.outtodistpackages/alias/package.jsonfile to properly setup properties and exports for an ESM only packagetscto those which were previously hand-authored inpackages/alias/types/index.d.ts- improve the code inpackages/alias/src/index.tsif the hand-authored types contain information that the generated types do not - we want to make sure we're not degrading the developer experiencepnpm add vitest@latest -w -D.configwhich forces snapshots to be saved in the relative test directory under.snapshotspackages/alias/testfrom Ava to vitest and update the test files to use typescript (.ts) instead of plain javascriptcurrent-packagesymlink described belowNotes:
package root (../..). If you see
import ... from 'current-package'that's where the import points tofeat({plugin})!: ESM only. Update Node and Rollup minimum versions