chore: drop Node 20, target ES2022 and build packages as ESM-only - #273
chore: drop Node 20, target ES2022 and build packages as ESM-only#273ulissesferreira wants to merge 3 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring alerts on:
|
45ceeb7 to
f806c43
Compare
f6c2506 to
d9ef6b0
Compare
- Require Node.js ^22.14.0 || ^24 everywhere (engines, yarn constraints, CI matrix); Node 18 and 20 are EOL. - Bump the shared TypeScript target and lib from ES2020 to ES2022. - Replace the dual CommonJS/ESM ts-bridge build with an ESM-only build using tsc --build. Packages now ship dist/index.js and dist/index.d.ts; lodash is replaced with lodash-es. - Update the library template and yarn constraints accordingly.
Jest's CommonJS runtime cannot require the now ESM-only `@metamask/snap-networks-utils`, so map it to its uncompiled source in each snap's Jest configuration (along with the source's Node16-style `.js` specifiers and `lodash-es`). Also dedupe `@types/lodash` in the lockfile.
7ca777d to
fae75e6
Compare
|
@SocketSecurity ignore npm/lodash-es@4.18.1 Reviewed: lodash-es is a well-established, widely used utility library; the flag stems from its optional |
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| "node": "^22.14.0 || ^24" |
There was a problem hiding this comment.
Matches Core's
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| "node": "^22.14.0 || ^24" |
There was a problem hiding this comment.
Matches Core's
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| "node": "^22.14.0 || ^24" |
There was a problem hiding this comment.
Matches Core's
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| "node": "^22.14.0 || ^24" |
There was a problem hiding this comment.
Matches Core's
| }, | ||
| "engines": { | ||
| "node": ">=20" | ||
| "node": "^22.14.0 || ^24" |
There was a problem hiding this comment.
Matches Core's
fae75e6 to
5130520
Compare
|
There was a problem hiding this comment.
Personal interest
i understand why we drop Node 20
but not sure the intension to use
ES2022 and build packages as ESM-only
as this result 2 style on the mono-repo, while core they are aligned in 1?
on share library, we do
import module from "xxx.js"
on snap , we do
import module from "xxx"
|
After a conversation with @stanleyyconsensys, we have decided to deprecate this PR in favor of a smaller one where we just deprecate Node 20 from our pipelines and bump the target compiled TypeScript / JavaScript because we are unsure if we will be able to support moving UI |


Explanation
Following the same changes happening in MetaMask/core (#9976, #10019, #9536):
Drop Node 20
engines.nodeis now^22.14.0 || ^24in the root and all packages, enforced by the Yarn constraints, and the CI test matrix now runs on 22.x and 24.x only.ES2022
targetandlibsettings are bumped fromES2020toES2022.ESM-only
@metamask/snap-networks-utilsis now built as ESM-only withtsc --build, replacing the dual CommonJS/ESM build produced byts-bridge. Published artifacts aredist/index.jsanddist/index.d.ts.lodashis replaced withlodash-es, and relative imports use explicit.jsextensions (required for Node16 ESM resolution).Checklist