summaryrefslogtreecommitdiff
path: root/deps/npm/lib
diff options
context:
space:
mode:
authorclaudiahdz <cghr1990@gmail.com>2020-07-21 15:51:21 -0500
committerAnna Henningsen <anna@addaleax.net>2020-09-22 19:54:31 +0200
commit7ef1f6a71dacd6474afc39590127117beeb8b757 (patch)
treef397c62ec1ab7e0b78b25d31706607e65bcd6145 /deps/npm/lib
parent9c725919fcc91b4d27b0feb9a70926e689a7a96a (diff)
downloadnode-new-7ef1f6a71dacd6474afc39590127117beeb8b757.tar.gz
deps: upgrade npm to 6.14.7
PR-URL: https://github.com/nodejs/node/pull/34468 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/npm/lib')
-rw-r--r--deps/npm/lib/explore.js3
-rw-r--r--deps/npm/lib/install.js3
-rw-r--r--deps/npm/lib/install/deps.js2
-rw-r--r--deps/npm/lib/install/inflate-shrinkwrap.js8
-rw-r--r--deps/npm/lib/install/save.js4
-rw-r--r--deps/npm/lib/ls.js2
6 files changed, 18 insertions, 4 deletions
diff --git a/deps/npm/lib/explore.js b/deps/npm/lib/explore.js
index 0c9930f8e4..32c93d6553 100644
--- a/deps/npm/lib/explore.js
+++ b/deps/npm/lib/explore.js
@@ -23,14 +23,13 @@ function explore (args, cb) {
var opts = {cwd: cwd, stdio: 'inherit'}
var shellArgs = []
- if (args) {
+ if (args.length) {
if (isWindows) {
var execCmd = escapeExecPath(args.shift())
var execArgs = [execCmd].concat(args.map(escapeArg))
opts.windowsVerbatimArguments = true
shellArgs = ['/d', '/s', '/c'].concat(execArgs)
} else {
- shellArgs.unshift('-c')
shellArgs = ['-c', args.map(escapeArg).join(' ').trim()]
}
}
diff --git a/deps/npm/lib/install.js b/deps/npm/lib/install.js
index 378ada7b05..ef492063b3 100644
--- a/deps/npm/lib/install.js
+++ b/deps/npm/lib/install.js
@@ -650,6 +650,9 @@ Installer.prototype.saveToDependencies = function (cb) {
validate('F', arguments)
if (this.failing) return cb()
log.silly('install', 'saveToDependencies')
+ // Note idealTree will be mutated during the save operations below as the
+ // package is reloaded from disk to preserve additional details. This means
+ // steps after postInstall will see a slightly different package object.
if (this.saveOnlyLock) {
saveShrinkwrap(this.idealTree, cb)
} else {
diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js
index 72c7192963..960dd375d0 100644
--- a/deps/npm/lib/install/deps.js
+++ b/deps/npm/lib/install/deps.js
@@ -76,7 +76,7 @@ function doesChildVersionMatch (child, requested, requestor) {
if (childReq.rawSpec === requested.rawSpec) return true
if (childReq.type === requested.type) {
if (childReq.saveSpec === requested.saveSpec) return true
- if (childReq.fetchSpec === requested.fetchSpec) return true
+ if ((childReq.fetchSpec === requested.fetchSpec) && requested.type !== 'git') return true
}
}
// If _requested didn't exist OR if it didn't match then we'll try using
diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js
index 122068c201..f89aa81549 100644
--- a/deps/npm/lib/install/inflate-shrinkwrap.js
+++ b/deps/npm/lib/install/inflate-shrinkwrap.js
@@ -52,6 +52,14 @@ function inflateShrinkwrap (topPath, tree, swdeps, opts) {
const sw = swdeps[name]
const dependencies = sw.dependencies || {}
const requested = realizeShrinkwrapSpecifier(name, sw, topPath)
+
+ if (Object.keys(sw).length === 0) {
+ let message = `Object for dependency "${name}" is empty.\n`
+ message += 'Something went wrong. Regenerate the package-lock.json with "npm install".\n'
+ message += 'If using a shrinkwrap, regenerate with "npm shrinkwrap".'
+ return Promise.reject(new Error(message))
+ }
+
return inflatableChild(
onDisk[name], name, topPath, tree, sw, requested, opts
).then((child) => {
diff --git a/deps/npm/lib/install/save.js b/deps/npm/lib/install/save.js
index 92b44a1080..986233a516 100644
--- a/deps/npm/lib/install/save.js
+++ b/deps/npm/lib/install/save.js
@@ -8,6 +8,7 @@ const iferr = require('iferr')
const log = require('npmlog')
const moduleName = require('../utils/module-name.js')
const npm = require('../npm.js')
+const packageId = require('../utils/package-id.js')
const parseJSON = require('../utils/parse-json.js')
const path = require('path')
const stringifyPackage = require('stringify-package')
@@ -131,6 +132,9 @@ function savePackageJson (tree, next) {
} else {
writeFileAtomic(saveTarget, json, next)
}
+
+ // Restore derived id as it was removed when reloading from disk
+ tree.package._id = packageId(tree.package)
}))
}
diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js
index 78a2b1d791..c333f236ba 100644
--- a/deps/npm/lib/ls.js
+++ b/deps/npm/lib/ls.js
@@ -545,7 +545,7 @@ function makeParseable_ (data, long, dir, depth, parent, d) {
return data.path +
':' + (data._id || '') +
- ':' + (data.realPath !== data.path ? data.realPath : '') +
+ (data.link && data.link !== data.path ? ':' + data.link : '') +
(data.extraneous ? ':EXTRANEOUS' : '') +
(data.error && data.path !== path.resolve(npm.globalDir, '..') ? ':ERROR' : '') +
(data.invalid ? ':INVALID' : '') +