-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 <duhamelantoine1995@gmail.com>
PR-URL: #35387 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Landed in ee9e3e7. |
PR-URL: #35387 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#35387 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
PR-URL: nodejs#35387 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <kevin@kevinlocke.name>
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 <kevin@kevinlocke.name>
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 <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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 <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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