-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: fix an error in resolution algorithm steps #29940
Conversation
@@ -159,6 +159,7 @@ require(X) from module at path Y | |||
3. If X begins with './' or '/' or '../' | |||
a. LOAD_AS_FILE(Y + X) | |||
b. LOAD_AS_DIRECTORY(Y + X) | |||
c. THROW "not found" | |||
4. LOAD_NODE_MODULES(X, dirname(Y)) |
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.
alternatively, could this be prefixed with “else”?
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 thought of that but noticed that other steps here prefer throwing in the if instead.
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 agree it's consistent with the other blocks.
cc @nodejs/modules-active-members |
@@ -159,6 +159,7 @@ require(X) from module at path Y | |||
3. If X begins with './' or '/' or '../' | |||
a. LOAD_AS_FILE(Y + X) | |||
b. LOAD_AS_DIRECTORY(Y + X) | |||
c. THROW "not found" | |||
4. LOAD_NODE_MODULES(X, dirname(Y)) |
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 agree it's consistent with the other blocks.
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 think this is correct.
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic.
Fixed the commit message to wrap at 72 characters. |
Waiting for #30117 to land before resolving the conflicts. |
Landed that PR, should be safe to rebase now! |
Huh, looks like there's no conflicts here anymore 😄 |
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 6f39f10 |
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
As it is, if `X begins with './' or '/' or '../'` (step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4). But that doesn't seem to reflect the actual logic. PR-URL: #29940 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
As it is, if
X begins with './' or '/' or '../'
(step 3), it reads as if it were possible for the algorithm to do a node_modules lookup (step 4) when 3.a or 3.b couldn't find the module. But that doesn't seem to reflect the actual logic.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes