diff options
Diffstat (limited to 'deps/npm/lib/install/deps.js')
-rw-r--r-- | deps/npm/lib/install/deps.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index d7081296db..bdbd817007 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -406,6 +406,11 @@ function loadDeps (tree, log, next) { exports.loadDevDeps = function (tree, log, next) { validate('OOF', arguments) if (!tree.package.devDependencies) return andFinishTracker.now(log, next) + // if any of our prexisting children are from a shrinkwrap then we skip + // loading dev deps as the shrinkwrap will already have provided them for us. + if (tree.children.some(function (child) { return child.shrinkwrapDev })) { + return andFinishTracker.now(log, next) + } asyncMap(Object.keys(tree.package.devDependencies), function (dep, done) { // things defined as both dev dependencies and regular dependencies are treated // as the former @@ -416,7 +421,7 @@ exports.loadDevDeps = function (tree, log, next) { }, andForEachChild(loadDeps, andFinishTracker(log, next))) } -exports.loadExtraneous = function loadExtraneous (tree, log, next) { +var loadExtraneous = exports.loadExtraneous = function (tree, log, next) { var seen = {} function loadExtraneous (tree, log, next) { validate('OOF', arguments) @@ -431,6 +436,9 @@ exports.loadExtraneous = function loadExtraneous (tree, log, next) { exports.loadExtraneous.andResolveDeps = function (tree, log, next) { validate('OOF', arguments) + // For canonicalized trees (eg from shrinkwrap) we don't want to bother + // resolving the dependencies of extraneous deps. + if (tree.loaded) return loadExtraneous(tree, log, next) asyncMap(tree.children.filter(function (child) { return !child.loaded }), function (child, done) { resolveWithExistingModule(child, tree, log, done) }, andForEachChild(loadDeps, andFinishTracker(log, next))) @@ -631,6 +639,14 @@ var earliestInstallable = exports.earliestInstallable = function (requiredBy, tr return null } + var devDeps = tree.package.devDependencies || {} + if (tree.isTop && devDeps[pkg.name]) { + var requested = npa(pkg.name + '@' + devDeps[pkg.name]) + if (!doesChildVersionMatch({package: pkg}, requested, tree)) { + return null + } + } + if (tree.phantomChildren && tree.phantomChildren[pkg.name]) return null if (tree.isTop) return tree |