Skip to content

Commit

Permalink
Revert "module: fix check for package.json at volume root"
Browse files Browse the repository at this point in the history
This reverts commit 51af89f.

This has needed to be backed out of both the 14.5.0 and 14.6.0
releases due to creating regressions across multiple projects
including:

* coffeescript
* JSONStream
* gulp
* and more

We should reopen a PR to figure out how to land this in a way
that is non-breaking.

Refs: #33476

PR-URL: #34403
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
MylesBorins authored and cjihrig committed Jul 22, 2020
1 parent 5250da4 commit 247ce2e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const {
SafeSet,
String,
StringPrototypeIndexOf,
StringPrototypeLastIndexOf,
StringPrototypeMatch,
StringPrototypeSlice,
StringPrototypeStartsWith,
Expand Down Expand Up @@ -310,13 +309,12 @@ function readPackageScope(checkPath) {
const rootSeparatorIndex = checkPath.indexOf(path.sep);
let separatorIndex;
while (
(separatorIndex = StringPrototypeLastIndexOf(checkPath, path.sep)) >=
rootSeparatorIndex
(separatorIndex = checkPath.lastIndexOf(path.sep)) > rootSeparatorIndex
) {
checkPath = checkPath.slice(0, separatorIndex);
if (checkPath.endsWith(path.sep + 'node_modules'))
return false;
const pjson = readPackage(checkPath + path.sep);
const pjson = readPackage(checkPath);
if (pjson) return {
path: checkPath,
data: pjson
Expand Down

0 comments on commit 247ce2e

Please sign in to comment.