feat!: drop support for Node 18 and 20 - #328
Open
cryptodev-2s wants to merge 4 commits into
Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
The following preview build has been published: |
cryptodev-2s
removed this pull request from stack #329
September 9, 2026 11:46
cryptodev-2s
force-pushed
the
migrate/drop-node-18-20
branch
from
September 9, 2026 11:46
c44fd50 to
08c239d
Compare
|
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. |
cryptodev-2s
changed the base branch from
migrate/pr2h-fix-tsd
to
migrate/swap-depcheck-for-knip
September 9, 2026 11:47
cryptodev-2s
added this pull request to stack #331
September 9, 2026 11:47
cryptodev-2s
force-pushed
the
migrate/drop-node-18-20
branch
2 times, most recently
from
September 9, 2026 16:10
ced5e47 to
4f428cc
Compare
cryptodev-2s
force-pushed
the
migrate/drop-node-18-20
branch
from
September 9, 2026 16:32
4f428cc to
424c070
Compare
cryptodev-2s
force-pushed
the
migrate/drop-node-18-20
branch
from
September 9, 2026 18:31
424c070 to
8f59757
Compare
Mirrors MetaMask/core#9976, the bottom of core's foundational stack. BREAKING: the supported range moves from ^18.18 || ^20.14 || >=22 to ^22.14.0 || ^24, the same range core adopts. The CI matrix drops to 22 and 24, and constraints.pro is updated to match. This lands before the TypeScript and target/lib changes on purpose. Core sequenced its stack Node, then ESM, then TypeScript, then target/lib, and that order is a dependency chain rather than an arbitrary grouping: raising the runtime floor first is what justifies each step above it, and emitting a higher target is only defensible once the floor guarantees it.
Follows from the runtime floor moving to Node 22. Core makes the same bump in the same PR as its Node drop (MetaMask/core#9976), rather than alongside the TypeScript change, since the types track the supported runtime.
cryptodev-2s
force-pushed
the
migrate/drop-node-18-20
branch
from
September 9, 2026 18:47
8f59757 to
07bb86e
Compare
Follow up to removing the Node 18 polyfill in the same PR. The remaining `webcrypto` usage was the other half of the same workaround: const originalSubtle = globalThis.crypto?.subtle ?? webcrypto.subtle; The fallback only mattered when globalThis.crypto could be absent, which was Node 18. The floor here is now ^22.14.0 || ^24, where the global is always present, so this reads `globalThis.crypto.subtle` and the `crypto` import goes with it. All 12 tests still pass. The node-builtins disable is still required: with it removed the rule still reports nine occurrences, because it treats the global `crypto` as experimental until Node 23.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #324, which GitHub auto-closed as merged during a stack reorder when its head briefly became an ancestor of its base. The changes never reached
main; this carries the same two commits.Mirrors MetaMask/core#9976, the bottom of core's foundational stack.
engines.node^18.18 || ^20.14 || >=22^22.14.0 || ^24@types/node~18.18.14^22.13.14constraints.prois updated soyarn constraintsenforces the new range. Core makes the@types/nodebump in this same PR rather than with its TypeScript change, since the types track the supported runtime.Position in the stack
This now sits below the ESM conversion (#323), so everything up to and including this PR is still a hybrid CJS/ESM build:
That matters for testing. A preview build from here still resolves through
main: ./dist/index.cjswith therequirecondition intact, so it can be consumed bymetamask-extensionas-is. Everything below the ESM cut can therefore be verified against a real downstream consumer before the breaking change lands.Note
Medium Risk
Breaking
engineschange affects every downstream install and CI on Node 18/20; application logic changes are minimal aside from test assumptions.Overview
Breaking: supported Node is now
^22.14.0 || ^24(aligned with MetaMask core), replacing^18.18 || ^20.14 || >=22.That range is enforced in
package.jsonengines,constraints.proforyarn constraints, and the CI matrix inbuild-lint-test.yml(22 and 24 only). Dev typings move from@types/node~18 to ^22, with lockfile updates.Test and lint setup no longer assume Node 18:
hashing.test.tsdrops thewebcryptopolyfill and semver gate, assumingglobalThis.cryptoon the new floor. ESLint comments for test files are updated to match Node 22+ behavior for the globalcryptobuiltin.Reviewed by Cursor Bugbot for commit b51551d. Bugbot is set up for automated code reviews on this repo. Configure here.