aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/lib/install
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/install')
-rw-r--r--deps/npm/lib/install/is-only-dev.js5
-rw-r--r--deps/npm/lib/install/is-only-optional.js5
2 files changed, 6 insertions, 4 deletions
diff --git a/deps/npm/lib/install/is-only-dev.js b/deps/npm/lib/install/is-only-dev.js
index 2877c61a22..804497393e 100644
--- a/deps/npm/lib/install/is-only-dev.js
+++ b/deps/npm/lib/install/is-only-dev.js
@@ -28,9 +28,10 @@ function andIsOnlyDev (name, seen) {
return isDev && !isProd
} else {
if (seen.has(req)) return true
- seen = new Set(seen)
seen.add(req)
- return isOnlyDev(req, seen)
+ const result = isOnlyDev(req, seen)
+ seen.delete(req)
+ return result
}
}
}
diff --git a/deps/npm/lib/install/is-only-optional.js b/deps/npm/lib/install/is-only-optional.js
index 81e227bae7..ea27eadcfa 100644
--- a/deps/npm/lib/install/is-only-optional.js
+++ b/deps/npm/lib/install/is-only-optional.js
@@ -11,11 +11,12 @@ function isOptional (node, seen) {
if (seen.has(node) || node.requiredBy.length === 0) {
return false
}
- seen = new Set(seen)
seen.add(node)
const swOptional = node.fromShrinkwrap && node.package._optional
- return node.requiredBy.every(function (req) {
+ const result = node.requiredBy.every(function (req) {
if (req.fakeChild && swOptional) return true
return isOptDep(req, moduleName(node)) || isOptional(req, seen)
})
+ seen.delete(node)
+ return result
}