Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/install/inflate-shrinkwrap.js')
-rw-r--r--lib/install/inflate-shrinkwrap.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/install/inflate-shrinkwrap.js b/lib/install/inflate-shrinkwrap.js
index 8514f00dd..596885613 100644
--- a/lib/install/inflate-shrinkwrap.js
+++ b/lib/install/inflate-shrinkwrap.js
@@ -14,17 +14,22 @@ const realizeShrinkwrapSpecifier = require('./realize-shrinkwrap-specifier.js')
const validate = require('aproba')
const path = require('path')
-module.exports = function (tree, swdeps, finishInflating) {
+module.exports = function (tree, swdeps, opts, finishInflating) {
if (!npm.config.get('shrinkwrap')) return finishInflating()
+ if (arguments.length === 3) {
+ finishInflating = opts
+ opts = {}
+ }
tree.loaded = true
- return inflateShrinkwrap(tree.path, tree, swdeps).then(
+ return inflateShrinkwrap(tree.path, tree, swdeps, opts).then(
() => finishInflating(),
finishInflating
)
}
-function inflateShrinkwrap (topPath, tree, swdeps) {
- validate('SOO', arguments)
+function inflateShrinkwrap (topPath, tree, swdeps, opts) {
+ validate('SOO|SOOO', arguments)
+ if (!opts) opts = {}
const onDisk = {}
tree.children.forEach((child) => {
onDisk[moduleName(child)] = child
@@ -43,7 +48,7 @@ function inflateShrinkwrap (topPath, tree, swdeps) {
const dependencies = sw.dependencies || {}
const requested = realizeShrinkwrapSpecifier(name, sw, topPath)
return inflatableChild(
- onDisk[name], name, topPath, tree, sw, requested
+ onDisk[name], name, topPath, tree, sw, requested, opts
).then((child) => {
return inflateShrinkwrap(topPath, child, dependencies)
})
@@ -58,8 +63,8 @@ function normalizePackageDataNoErrors (pkg) {
}
}
-function inflatableChild (onDiskChild, name, topPath, tree, sw, requested) {
- validate('OSSOOO|ZSSOOO', arguments)
+function inflatableChild (onDiskChild, name, topPath, tree, sw, requested, opts) {
+ validate('OSSOOOO|ZSSOOOO', arguments)
if (onDiskChild && childIsEquivalent(sw, requested, onDiskChild)) {
// The version on disk matches the shrinkwrap entry.
if (!onDiskChild.fromShrinkwrap) onDiskChild.fromShrinkwrap = true
@@ -77,7 +82,7 @@ function inflatableChild (onDiskChild, name, topPath, tree, sw, requested) {
normalizePackageDataNoErrors(onDiskChild.package)
tree.children.push(onDiskChild)
return BB.resolve(onDiskChild)
- } else if (sw.version && sw.integrity) {
+ } else if (opts.fakeChildren !== false && sw.version && sw.integrity) {
// The shrinkwrap entry has an integrity field. We can fake a pkg to get
// the installer to do a content-address fetch from the cache, if possible.
return BB.resolve(makeFakeChild(name, topPath, tree, sw, requested))