summaryrefslogtreecommitdiff
path: root/deps/npm/lib
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2016-11-21 15:19:45 -0800
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-12-05 10:33:46 -0500
commitc8cf71de6c56a826a10525d880c179f814a5f368 (patch)
treee9a8ca0a19f00452d28238f5f6e46540fa56cc23 /deps/npm/lib
parent0ae1684396d87bffe6bf3a4c77c30bb725bfc5d4 (diff)
downloadnode-new-c8cf71de6c56a826a10525d880c179f814a5f368.tar.gz
deps: upgrade npm to 3.10.10
PR-URL: https://github.com/nodejs/node/pull/9847 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/lib')
-rw-r--r--deps/npm/lib/install/deps.js8
-rw-r--r--deps/npm/lib/install/inflate-shrinkwrap.js6
2 files changed, 9 insertions, 5 deletions
diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js
index 4d315ab188..d7081296db 100644
--- a/deps/npm/lib/install/deps.js
+++ b/deps/npm/lib/install/deps.js
@@ -326,14 +326,16 @@ function andForEachChild (load, next) {
}
}
-function isDepOptional (tree, name) {
+function isDepOptional (tree, name, pkg) {
+ if (pkg.package && pkg.package._optional) return true
if (!tree.package.optionalDependencies) return false
if (tree.package.optionalDependencies[name] != null) return true
return false
}
var failedDependency = exports.failedDependency = function (tree, name_pkg) {
- var name, pkg
+ var name
+ var pkg = {}
if (typeof name_pkg === 'string') {
name = name_pkg
} else {
@@ -342,7 +344,7 @@ var failedDependency = exports.failedDependency = function (tree, name_pkg) {
}
tree.children = tree.children.filter(noModuleNameMatches(name))
- if (isDepOptional(tree, name)) {
+ if (isDepOptional(tree, name, pkg)) {
return false
}
diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js
index ab1bdd1f19..b70e9576bf 100644
--- a/deps/npm/lib/install/inflate-shrinkwrap.js
+++ b/deps/npm/lib/install/inflate-shrinkwrap.js
@@ -45,14 +45,16 @@ function inflateShrinkwrap (topPath, tree, swdeps, finishInflating) {
return inflateShrinkwrap(topPath, child, dependencies || {}, next)
} else {
var from = sw.from || requested.raw
- return fetchPackageMetadata(requested, topPath, iferr(next, andAddShrinkwrap(from, dependencies, next)))
+ var optional = sw.optional
+ return fetchPackageMetadata(requested, topPath, iferr(next, andAddShrinkwrap(from, optional, dependencies, next)))
}
}
}
- function andAddShrinkwrap (from, dependencies, next) {
+ function andAddShrinkwrap (from, optional, dependencies, next) {
return function (pkg) {
pkg._from = from
+ pkg._optional = optional
addShrinkwrap(pkg, iferr(next, andAddBundled(pkg, dependencies, next)))
}
}