-
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
module: prevent format
from being set to null
internaly
#53015
Conversation
Review requested:
|
format
from being null
format
from being set to null
internaly
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.
The reason for this is to simplify tests. The format
value might be null
or it might be undefined
based on arbitrary things like which code path is followed. Our internal code is careful to do loose tests like format == null
to account for format
being either null or undefined, but not all the tests are so loose. Eliminating null
from the potential possibilities means that our tests can remain precise while not breaking as we refactor code paths. The internal conditions will remain loose so that user hooks can still set format: null
.
https://github.com/nodejs/node/blob/main/doc/api/module.md needs updating too, the various lines like this: * `format` {string|null|undefined} The format optionally supplied by the
`resolve` hook chain To remove |
IIUC, before this change, |
I accidentally found this PR and looked a bit into the details (might still miss something). But iiuc the goal of the module detection is to allow I can have a look and open a PR if I find a solution. I agree that cc: @aduh95, @GeoffreyBooth |
#53016 has some more information, but essentially, in the end, we want it to default to CJS, but it defaults to |
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.
I disagree this simplifies anything, let's not land this – it'd be a small breaking change, but still a breaking change, and we should have some justification for breaking things
I was actually planning on closing this favor of another PR (I need to find it then I'll link it) |
With all the changes and backtraces my PR's have caused regarding changes similar to this, @GeoffreyBooth and I agreed that preventing
format
from being set tonull
internaly would at least be a step in the right direction.