Uh oh!
There was an error while loading. Please reload this page.
module: revert checking for package.json before extensions - #15015
Conversation
mscdex
commented
Aug 24, 2017
I'm not sure we need to use the word "revert" if the current behavior was added a very long time ago. |
bmeck
commented
Aug 24, 2017
@mscdex it has accidental side effects, I would prefer to keep that word. |
If it was unintentional and undocumented, it's a bug - I think the term isn't bound by recency. |
targos
commented
Sep 13, 2017
/cc @nodejs/tsc I am in favor of this change |
BridgeAR
commented
Dec 5, 2017
I am also in favor of this. It seems like a more correct approach than the way it is currently working. As there was no progress for a long time, I would like to have the @nodejs/tsc to have a look at this and to decide on how to move forward. There are already two TSC votes in favor. |
BridgeAR
left a comment
There was a problem hiding this comment.
This needs a rebase. LGTM otherwise
There was a problem hiding this comment.
There is a new eslint rule in place that prevents messages without dynamic content (or it is at least planned). I do see that it makes sense to have a individual message here, so we should either explicitly accept the message here or maybe just change the inner.js export content to contain a property with a string, remove the message and use deepStrictEqual. With the latter the error message should be explicit enough.
There was a problem hiding this comment.
@BridgeAR If that rule ever comes to pass, we can always disable it with a comment for the instances where a string literal makes sense. So this can stay as is, if the proposed lint rule is the only motivation for changing it.
BridgeAR
commented
Dec 11, 2017
@bmeck I guess you actually want this to be looked at and it to get merged, right? In that case it will need a rebase and the title should be changed accordingly. |
fhinkel
commented
Dec 13, 2017
@BridgeAR I don't see any -1. With the approvals, I think we can go ahead and merge it (after a rebase). Can we take this off the TSC agenda? Or am I missing something? |
mcollina
left a comment
There was a problem hiding this comment.
LGTM with a better PR description and commit description
BridgeAR
commented
Dec 15, 2017
@fhinkel sure, I just removed the labels. I just wanted to make sure it is properly looked at as it was originally controversial if that should be changed or not. |
BridgeAR
commented
Dec 28, 2017
Ping @bmeck |
bmeck
commented
Dec 29, 2017
I can make a better description tomorrow and I think we are approved beyond that. |
jasnell
commented
Jan 22, 2018
Should be plenty of time for that assuming it lands by end of March... :-) |
Anyone know about the treatment of the trailing Update: Okay confirmed. Windows supports paths ending in |
bmeck
commented
Jan 22, 2018
The surrounding code is only looking at |
It looks like it goes The Update: Filed the bug: #18299. |
There was a problem hiding this comment.
👆 at the moment because the trailing slash check is for forward-slash-only, on Windows paths ending in a backslash hit that code path (which is removed in this PR). This means it will now fall through to the tryExtensions call on line 234, instead of the tryPackage call on line 243.
Note: Assumes a fixed #18299
BridgeAR
commented
Feb 7, 2018
BridgeAR
commented
Feb 9, 2018
@bmeck it seems like there is a lint error and a tests constantly fails: Would you be so kind and take a look? :-) |
The documented resolution algorithm was regressed and started to search for package.json files prior to searching for file extensions when searching for a specifier. Oddly, it did not search for index files at same time it searched for package.json. This reverts that regression and restores the documented behavior of searching for file extensions prior to searching directories. Fixes: nodejs#14990 PR-URL: nodejs#15015 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
BridgeAR
commented
Feb 17, 2018
I just rebased this, fixed the linter error and fixed the test issue. I am a bit confused that the old test is now working as before. @bmeck can you please have a look at this? |
BridgeAR
commented
Feb 17, 2018
bmeck
commented
Feb 17, 2018
@BridgeAR I'm dealing w/ family, won't get to this in next few days. |
Ping @bmeck. I hope everything is fine on your side :-) |
bmeck
commented
Mar 2, 2018
@BridgeAR I'm still pretty under water with workload due to things, nothing seems really apparent on why it would fail. I could try to revert and then git bisect if desired but won't get to it for a while. |
BridgeAR
commented
Mar 2, 2018
BridgeAR
commented
Mar 2, 2018
And I rebased and pushed the changes here. So this is good to go if you give your LG. |
bmeck
commented
Mar 2, 2018
@BridgeAR that test change looks correct, this PR should be adding trailing |
The documented resolution algorithm started to search for package.json files prior to searching for file extensions when searching for a specifier. Oddly, it did not search for index files at same time it searched for package.json. This restores the documented behavior of searching for file extensions prior to searching directories. PR-URL: nodejs#15015Fixes: nodejs#14990 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
BridgeAR
commented
Mar 11, 2018
Landed in 1ed36ae 🎉 |
The documented resolution algorithm started to search for package.json files prior to searching for file extensions when searching for a specifier. Oddly, it did not search for index files at same time it searched for package.json. This restores the documented behavior of searching for file extensions prior to searching directories. PR-URL: nodejs#15015Fixes: nodejs#14990 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe>
This PR reverts a regression from a change in behavior that deviated from the documented behavior of the module resolution algorithm. The deviation caused the module resolution algorithm to check for
package.jsonfiles when traversing up to a parent directory before following the documented module resolution algorithm.Link discussing the regression in greater depth
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
module