PR: ESM Migration, Vite 8 Upgrade, and Dependency Overhaul#1649
PR: ESM Migration, Vite 8 Upgrade, and Dependency Overhaul#1649onemen wants to merge 29 commits intoraineorshine:mainfrom
Conversation
- update vite config - use lodash-es instead of lodash - use memoize instead of old fast-memoize
ES Modules cannot be stubbed To allow stubbing of npm functions in tests, we export the functions that need to be stubbed as properties of an object (npmApi, pnpmApi, yarnApi) that can be imported and stubbed in tests without affecting the rest of the module. (+1 squashed commits) use tsx instead of ts-node with mocha
…rning: `url.parse()` in node 24
…ch is a built-in module in node
- Update major devDependencies to latest. - Remove `legacy-peer-deps=true` to ensure strict, modern resolution. - Implement surgical `overrides` to resolve peer dependency conflicts across the ESLint, Microsoft, and Verdaccio toolchains. - Fix hoisting issue where `ajv/dist/core` was missing in nested node_modules under Node 25.
- Remove legacy __dirname in favor of getDirname(import.meta.url). - Enable Mocha --exit to ensure clean termination on Node 25. - Clean up listener guards and diagnostic hooks. - Successfully verified 530+ tests across modern Node environments.
update vite config remove unused nodeExternals, we see ssr.noExternal=true so we don't want to exclude node modules from the bundle
update export use tsx instead of vite-node
…ation warning: `url.parse()` in node 24" The issue was fixed in parse-github-url v1.0.4 This reverts commit 02e99e4.
- Replace custom 'test/bun-install.sh' with 'oven-sh/setup-bun@v2' action. - Add 'check-environment' before-hook to provide helpful install links. - Fix TypeScript 'Property does not exist' errors via namespace imports. - Resolve ESLint 'Parsing error' in VS Code using tsconfigRootDir. - Update test logic to use node:child_process for better cross-platform compatibility.
Update resolveConfig to use a file path instead of a directory to correctly load .prettierrc.json in ESM.
Re-generate src/types/RunOptions.json with correct project formatting.
Fixes pre-push hook failures caused by formatting mismatches.
Update mocha configuration to ignore test/bun/* during unit tests. This prevents CI failures in environments where Bun is not yet installed.
Build: Update Vite config to use explicit output arrays for es and cjs formats.
Build: Force .cjs extensions for CommonJS chunks to prevent Node.js from parsing them as ESM in "type: module" projects.
E2E: Fix TypeError in ESM E2E tests by aligning namespace imports with the new build output.
E2E: Add Windows fallback for lsof in test/e2e.sh using netstat and taskkill to allow local registry cleanup on Windows 11.
|
let me know if there are any documentation that need update |
- Update CONTRIBUTING.md with source map documentation - Add Development section with Node.js requirements and test instructions - Update Executable Stack Trace section to reflect generated source maps - Add v21.0.0 entry to CHANGELOG.md documenting breaking changes - Add Requirements section to README.md with Node.js and npm version constraints
|
check the updates in ab34e63 |
| { | ||
| /** | ||
| * Because this function depends on both the first object AND the options object, | ||
| * we must provide a cacheKey. Modern memoize provides both args in an array. | ||
| */ | ||
| cacheKey: ([configs, options]) => { | ||
| return JSON.stringify([configs, options.packageFile, options.cwd, options.registry, options.timeout]) | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Explicit cache keys are going to be fragile and hard to maintain. If the function changes to use additional options in the future, there is no compile-time check to ensure these cache keys stay in sync, resulting in hard-to-catch caching bugs.
Instead, we should use a default serializer like fast-memoize did. Perhaps JSON.stringify would suffice?
There was a problem hiding this comment.
You also use JSON.stringify in fetchUpgradedPackumentMemo
do you want to modify both
by Perhaps JSON.stringify would suffice did you mean JSON.stringify([configs, options])
There was a problem hiding this comment.
Just cacheKey: JSON.stringify I believe. You can use this same pattern in all the memoize calls to preserve the existing behavior and avoid explicitly listing the inputs.
Description
This PR transitions the project to a native ESM architecture while maintaining dual-build support (ESM/CJS) via Vite. It includes a major overhaul of the development toolchain, upgrading core dependencies to their 2026 standards, and significantly modernizing the internal logic.
Key Changes
tsxfor module loading (e.g., via--import tsx), ensuring seamless TypeScript support in an ESM context.ts-json-schema-generatorand implemented in-process Prettier formatting.vite buildand replacedvite-nodewithtsx.strip-ansiwith the Node.js built-innode:util/stripVTControlCharacters.typechecktopre-pushhooks and the linting action.This is a major breaking change and requires a major version bump:
require(esm)support and the Rolldown engine.camelcase^6.3.0^9.0.0chai^4.3.10^6.2.2chai-as-promised^7.1.2^8.0.2find-up5.0.08.0.0p-map^4.0.0^7.0.4untildify^4.0.0^6.0.0Note on Mocha +
tsxSince the project is now ESM, we are using
tsxto handle the TypeScript transformation during test execution. If you are running tests manually, ensure you are using the new command structure:mocha --node-option import=tsx 'test/**/*.test.ts'(or your defined script inpackage.json).