-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esm: use "node:" internal namespace for builtins #35387
Conversation
Review requested:
|
To be very explicit, this breaks any code which imports |
The likelihood that there's lots of code that uses a protocol whatsoever is vanishingly small; it seems like a good idea to get this change into v15. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could use primordials here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Co-authored-by: Antoine du Hamel <[email protected]>
PR-URL: #35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Landed in ee9e3e7. |
PR-URL: #35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Backport-PR-URL: #35757 PR-URL: #35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Backport-PR-URL: #35757 PR-URL: #35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#35387 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Jan Krems <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Which added support for named exports for CJS via static analysis: nodejs/node#35249 nodejs/node@1e8cb08edc for v15 nodejs/node@f551f52f83 for v14.13 nodejs/node@9eb1fa1924 for v12.20 This is also necessary for `node:` scheme support, checked by the `unicorn/prefer-node-protocol` ESLint rule (currently disabled pending support in eslint-plugin-node): nodejs/node#35387 nodejs/node@ee9e3e75aa for v15 nodejs/node@91b820e939 for v14.13.1 nodejs/node@0f757bc2df for v12.20 Signed-off-by: Kevin Locke <[email protected]>
Which added support for named exports for CJS via static analysis: nodejs/node#35249 nodejs/node@1e8cb08edc for v15 nodejs/node@f551f52f83 for v14.13 nodejs/node@9eb1fa1924 for v12.20 This is also necessary for `node:` scheme support, checked by the `unicorn/prefer-node-protocol` ESLint rule (currently disabled pending support in eslint-plugin-node): nodejs/node#35387 nodejs/node@ee9e3e75aa for v15 nodejs/node@91b820e939 for v14.13.1 nodejs/node@0f757bc2df for v12.20 Signed-off-by: Kevin Locke <[email protected]>
Support for the 'node:' prefixed builtin module namespace was introduced for `require()` expressions in Node v16.0.0, and backported to v14.18.0. This was never supported in Node v15.x or chronologically older. All of the current API history notes in the docs using 'node:' prefixed module `require()`s happen to be documenting changes in Node versions from before the time when support was first introduced. This commit reverts those `require()`s in the history notes to be un-prefixed. (They were incorrect as written; The prefixed `require()`s would not work for those older Node versions.) This change prevents the API history notes from inaccurately implying 'node:' prefixed builtin modules were introduced many Node versions ago, or were `require()`-able with the 'node:' prefix in those Node versions. Refs: nodejs#35387 Refs: nodejs#37246 Refs: nodejs#42752
Support for the 'node:' prefixed builtin module namespace was introduced for `require()` expressions in Node v16.0.0, and backported to v14.18.0. This was never supported in Node v15.x or chronologically older. All of the current API history notes in the docs using 'node:' prefixed module `require()`s happen to be documenting changes in Node versions from before the time when support was first introduced. This commit reverts those `require()`s in the history notes to be un-prefixed. (They were incorrect as written; The prefixed `require()`s would not work for those older Node versions.) This change prevents the API history notes from inaccurately implying 'node:' prefixed builtin modules were introduced many Node versions ago, or were `require()`-able with the 'node:' prefix in those Node versions. Refs: #35387 Refs: #37246 Refs: #42752 PR-URL: #43768 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Support for the 'node:' prefixed builtin module namespace was introduced for `require()` expressions in Node v16.0.0, and backported to v14.18.0. This was never supported in Node v15.x or chronologically older. All of the current API history notes in the docs using 'node:' prefixed module `require()`s happen to be documenting changes in Node versions from before the time when support was first introduced. This commit reverts those `require()`s in the history notes to be un-prefixed. (They were incorrect as written; The prefixed `require()`s would not work for those older Node versions.) This change prevents the API history notes from inaccurately implying 'node:' prefixed builtin modules were introduced many Node versions ago, or were `require()`-able with the 'node:' prefix in those Node versions. Refs: #35387 Refs: #37246 Refs: #42752 PR-URL: #43768 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Support for the 'node:' prefixed builtin module namespace was introduced for `require()` expressions in Node v16.0.0, and backported to v14.18.0. This was never supported in Node v15.x or chronologically older. All of the current API history notes in the docs using 'node:' prefixed module `require()`s happen to be documenting changes in Node versions from before the time when support was first introduced. This commit reverts those `require()`s in the history notes to be un-prefixed. (They were incorrect as written; The prefixed `require()`s would not work for those older Node versions.) This change prevents the API history notes from inaccurately implying 'node:' prefixed builtin modules were introduced many Node versions ago, or were `require()`-able with the 'node:' prefix in those Node versions. Refs: #35387 Refs: #37246 Refs: #42752 PR-URL: #43768 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Support for the 'node:' prefixed builtin module namespace was introduced for `require()` expressions in Node v16.0.0, and backported to v14.18.0. This was never supported in Node v15.x or chronologically older. All of the current API history notes in the docs using 'node:' prefixed module `require()`s happen to be documenting changes in Node versions from before the time when support was first introduced. This commit reverts those `require()`s in the history notes to be un-prefixed. (They were incorrect as written; The prefixed `require()`s would not work for those older Node versions.) This change prevents the API history notes from inaccurately implying 'node:' prefixed builtin modules were introduced many Node versions ago, or were `require()`-able with the 'node:' prefix in those Node versions. Refs: nodejs/node#35387 Refs: nodejs/node#37246 Refs: nodejs/node#42752 PR-URL: nodejs/node#43768 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
This has been discussed a couple of times in the past few meetings that the internal representation for builtins should align with policies using the
node:
scheme as well as to allow this to be the scheme to make public for users in future if we ever want to expose it more explicitly in any modules APIs or interfaces.This is strictly a minor breaking change, but should have relatively low usage in the wild and is entirely limited to the experimental modules and loader cases.
@nodejs/modules-active-members
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes