Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
module: ensure 'node:'-only modules can access node_modules#42430
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
nodejs-github-bot commented Mar 22, 2022
Review requested:
|
ljharb commented Mar 22, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I'm really not clear on what this does. It's actually incredibly critical that, for example, requiring Every core module can be accessed both with or without |
giltayar commented Mar 22, 2022
Isn't the whole point of the (I may be misunderstanding the |
ljharb commented Mar 22, 2022
@giltayar anything that is a core module - I'm not aware of any core modules that only can be accessed with the |
Trott commented Mar 22, 2022
ljharb commented Mar 22, 2022
Oof, why is it only with the prefix? |
giltayar commented Mar 22, 2022
Thanks @ljharb! So (just a thought) shouldn't |
ljharb commented Mar 22, 2022
That already doesn’t work, afaik. |
cjihrig commented Mar 22, 2022
For some background, #42325 added a new core module named We currently treat new top level modules as semver major changes because they can conflict with userland modules. There has been talk for a while now of exposing new core modules only under the I didn't really want to be the first one to introduce a
That's correct.
That was previously the case. The idea is to introduce new core modules only under the Sorry for any confusion this caused. |
targos commented Mar 22, 2022
I'm not convinced it's a good idea to have |
cjihrig commented Mar 22, 2022
cjihrig commented Mar 22, 2022
martinheidegger commented Mar 22, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Since I was the original person who brought this up... From the node perspective, the first package only under Personally, I have no problem with A neat side-effect I also found is that it advertises the At the end of the day, my opinion on all of this is not strong, my goal was just to make the testing framework be the best it could be. |
cjihrig commented Mar 22, 2022
I like the idea of using the
|
ljharb commented Mar 22, 2022
also, fwiw, @Gozala may be willing to donate the |
cjihrig commented Mar 22, 2022
Another very minor point - using |
targos commented Mar 23, 2022
Agreed. I have seen many times people who |
Uh oh!
There was an error while loading. Please reload this page.
bmeck commented Mar 23, 2022
I don't see how naming with and without the prefix is actually going to help in the vast majority of real world situations with this point.
I would understand the point if the goal was to avoid I think it would be nice but not direly important to require https://www.npmjs.com/package/fs style reservation when possible. If truly wanting npm to be scoped out you could also add yet another mitigation to make sure it doesn't exist on the registry by using a scope like I am -1 on the process we use to land new modules being blocked by this |
bnb commented Mar 23, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
FWIW I also particularly don't like the Personally, creating new and unique edge cases that people will have to learn is significantly worse than having an underscore in a name (and I really hate underscores.) Thinking about this from the perspective of someone who's having to switch to Node.js occasionally for their job from their preferred language/platform or thinking about it from the perspective of someone who's just learning to code, this is a confusing departure for reasons that are beyond anything that will impact them or that they'll care about in the near term. IMO we should want to set them up for success with testing, and introducing an oddity like this explicitly increases the barrier to that. I am -1 on having this be an edge case and would strongly prefer that we use another module name (if we really have to, |
bmeck commented Mar 23, 2022
@bnb if we use something like |
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
nodejs-github-bot commented Apr 14, 2022
Landed in 93c4dc5 |
This commit allows require() and import to search the node_modules directories when importing a core module that must have the node: scheme. This prevents these core modules from shadowing userland modules with the same name but no prefix. PR-URL: nodejs#42430 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit allows require() and import to search the node_modules directories when importing a core module that must have the node: scheme. This prevents these core modules from shadowing userland modules with the same name but no prefix. PR-URL: #42430 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit allows require() and import to search the node_modules directories when importing a core module that must have the node: scheme. This prevents these core modules from shadowing userland modules with the same name but no prefix. PR-URL: nodejs/node#42430 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Richard Lau <[email protected]>
This commit allows
require()andimportto search thenode_modulesdirectories when importing a core module that must have thenode:scheme. This prevents these core modules from shadowing userland modules with the same name but no scheme.