-
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
module: ensure 'node:'-only modules can access node_modules #42430
Conversation
Review requested:
|
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 |
Isn't the whole point of the (I may be misunderstanding the |
@giltayar anything that is a core module - I'm not aware of any core modules that only can be accessed with the |
Oof, why is it only with the prefix? |
Thanks @ljharb! So (just a thought) shouldn't |
That already doesn’t work, afaik. |
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. |
I'm not convinced it's a good idea to have |
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. |
I like the idea of using the
|
also, fwiw, @Gozala may be willing to donate the |
Another very minor point - using |
Agreed. I have seen many times people who |
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 |
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, |
@bnb if we use something like |
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 <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com>
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 <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com>
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 <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com>
This commit allows
require()
andimport
to search thenode_modules
directories 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.