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:
-rw-r--r--node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js2
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js53
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/load-actual.js2
-rw-r--r--node_modules/@npmcli/arborist/lib/arborist/load-virtual.js3
-rw-r--r--node_modules/@npmcli/arborist/lib/node.js39
-rw-r--r--node_modules/@npmcli/arborist/package.json2
-rw-r--r--package-lock.json11
-rw-r--r--package.json2
8 files changed, 70 insertions, 44 deletions
diff --git a/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
index c050bde53..9e4825c52 100644
--- a/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
+++ b/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
@@ -15,6 +15,8 @@ const removeFromOthers = (name, type, pkg) => {
break
case 'dev':
others.delete('devDependencies')
+ others.delete('peerDependencies')
+ others.delete('peerDependenciesMeta')
break
case 'optional':
others.delete('optionalDependencies')
diff --git a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index ae9965e2e..c5e4bae32 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -856,9 +856,12 @@ This is a one-time fix-up, please be patient...
if (edge.to && edge.to.inShrinkwrap)
return false
- // If the edge has no destination, that's a problem.
- if (!edge.to)
- return edge.type !== 'peerOptional'
+ // If the edge has no destination, that's a problem, unless
+ // if it's peerOptional and not explicitly requested.
+ if (!edge.to) {
+ return edge.type !== 'peerOptional' ||
+ this[_explicitRequests].has(edge.name)
+ }
// If the edge has an error, there's a problem.
if (!edge.valid)
@@ -1339,20 +1342,36 @@ This is a one-time fix-up, please be patient...
// If strict or ours, conflict. Otherwise, keep.
if (isSource) {
// check to see if the current module could go deeper in the tree
- const peerSet = getPeerSet(current)
let canReplace = true
- OUTER: for (const p of peerSet) {
- // if any have a non-peer dep from the target, or a peer dep if
- // the target is root, then cannot safely replace and dupe deeper.
- for (const edge of p.edgesIn) {
- if (peerSet.has(edge.from))
- continue
-
- // only respect valid edges, however, since we're likely trying
- // to fix the very one that's currently broken!
- if (edge.from === target && edge.valid) {
- canReplace = false
- break OUTER
+ // only do this check when we're placing peers. when we're placing
+ // the original in the source, we know that the edge from the source
+ // is the thing we're trying to place, so its peer set will need to be
+ // placed here as well. the virtualRoot already has the appropriate
+ // overrides applied.
+ if (peerEntryEdge) {
+ const peerSet = getPeerSet(current)
+ OUTER: for (const p of peerSet) {
+ // if any have a non-peer dep from the target, or a peer dep if
+ // the target is root, then cannot safely replace and dupe deeper.
+ for (const edge of p.edgesIn) {
+ if (peerSet.has(edge.from))
+ continue
+
+ // only respect valid edges, however, since we're likely trying
+ // to fix the very one that's currently broken! If the virtual
+ // root's replacement is ok, and doesn't have any invalid edges
+ // indicating that it was an overridden peer, then ignore the
+ // conflict and continue. If it WAS an override, then we need
+ // to get the conflict here so that we can decide whether to
+ // accept the current dep node, clobber it, or fail the install.
+ if (edge.from === target && edge.valid) {
+ const rep = dep.parent.children.get(edge.name)
+ const override = rep && ([...rep.edgesIn].some(e => !e.valid))
+ if (!rep || !rep.satisfies(edge) || override) {
+ canReplace = false
+ break OUTER
+ }
+ }
}
}
}
@@ -1468,7 +1487,7 @@ This is a one-time fix-up, please be patient...
if (fromInv && fromInv !== link.target)
link.target = fromInv
- const external = /^\.\.\//.test(loc)
+ const external = /^\.\.(\/|$)/.test(loc)
if (external && !this[_follow]) {
// outside the root, somebody else's problem, ignore it
diff --git a/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
index 5c440cfc7..219b6378f 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
@@ -129,14 +129,12 @@ module.exports = cls => class ActualLoader extends cls {
})
if (meta.loadedFromDisk) {
this[_actualTree].meta = meta
- meta.add(this[_actualTree])
return this[_loadActualVirtually]({ root })
} else {
const meta = await Shrinkwrap.load({
path: this[_actualTree].path,
})
this[_actualTree].meta = meta
- meta.add(this[_actualTree])
return this[_loadActualActually]({ root, ignoreMissing })
}
}
diff --git a/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
index 7d0572826..14c960927 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
@@ -71,7 +71,6 @@ module.exports = cls => class VirtualLoader extends cls {
}
async [loadFromShrinkwrap] (s, root) {
- root.meta = s
// root is never any of these things, but might be a brand new
// baby Node object that never had its dep flags calculated.
root.extraneous = false
@@ -80,7 +79,7 @@ module.exports = cls => class VirtualLoader extends cls {
root.devOptional = false
root.peer = false
this[checkRootEdges](s, root)
- s.add(root)
+ root.meta = s
this.virtualTree = root
const {links, nodes} = this[resolveNodes](s, root)
await this[resolveLinks](links, nodes)
diff --git a/node_modules/@npmcli/arborist/lib/node.js b/node_modules/@npmcli/arborist/lib/node.js
index e30ae0232..1cf6be2ea 100644
--- a/node_modules/@npmcli/arborist/lib/node.js
+++ b/node_modules/@npmcli/arborist/lib/node.js
@@ -58,6 +58,7 @@ const _global = Symbol.for('global')
const _workspaces = Symbol('_workspaces')
const _explain = Symbol('_explain')
const _explanation = Symbol('_explanation')
+const _meta = Symbol('_meta')
const relpath = require('./relpath.js')
const consistentResolve = require('./consistent-resolve.js')
@@ -175,13 +176,13 @@ class Node {
this.edgesIn = new Set()
this.edgesOut = new Map()
- // only relevant for the root and top nodes
- this.meta = meta
-
// have to set the internal package ref before assigning the parent,
// because this.package is read when adding to inventory
this[_package] = pkg
+ // only relevant for the root and top nodes
+ this.meta = meta
+
// Note: this is _slightly_ less efficient for the initial tree
// building than it could be, but in exchange, it's a much simpler
// algorithm.
@@ -226,6 +227,16 @@ class Node {
this[_loadDeps]()
}
+ get meta () {
+ return this[_meta]
+ }
+
+ set meta (meta) {
+ this[_meta] = meta
+ if (meta)
+ meta.add(this)
+ }
+
get global () {
return this.root[_global]
}
@@ -358,19 +369,13 @@ class Node {
if (edge)
why.dependents.push(edge.explain(seen))
else {
- // if we have an edge from the root, just show that, and stop there
- // no need to go deeper, because it doesn't provide much more value.
+ // ignore invalid edges, since those aren't satisfied by this thing,
+ // and are not keeping it held in this spot anyway.
const edges = []
for (const edge of this.edgesIn) {
if (!edge.valid && !edge.from.isRoot)
continue
- if (edge.from.isRoot) {
- edges.length = 0
- edges.push(edge)
- break
- }
-
edges.push(edge)
}
for (const edge of edges)
@@ -497,6 +502,12 @@ class Node {
this[_loadDepType](this.package.optionalDependencies, 'optional')
this[_loadDepType](this.package.dependencies, 'prod')
+ // Linked targets that are disconnected from the tree are tops,
+ // but don't have a 'path' field, only a 'realpath', because we
+ // don't know their canonical location. We don't need their devDeps.
+ if (this.isTop && this.path)
+ this[_loadDepType](this.package.devDependencies, 'dev')
+
const pd = this.package.peerDependencies
if (pd && typeof pd === 'object' && !this.legacyPeerDeps) {
const pm = this.package.peerDependenciesMeta || {}
@@ -511,12 +522,6 @@ class Node {
this[_loadDepType](peerDependencies, 'peer')
this[_loadDepType](peerOptional, 'peerOptional')
}
-
- // Linked targets that are disconnected from the tree are tops,
- // but don't have a 'path' field, only a 'realpath', because we
- // don't know their canonical location. We don't need their devDeps.
- if (this.isTop && this.path)
- this[_loadDepType](this.package.devDependencies, 'dev')
}
[_loadDepType] (obj, type) {
diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json
index 580419a10..58bfc3e0b 100644
--- a/node_modules/@npmcli/arborist/package.json
+++ b/node_modules/@npmcli/arborist/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/arborist",
- "version": "1.0.3",
+ "version": "1.0.4",
"description": "Manage node_modules trees",
"dependencies": {
"@npmcli/installed-package-contents": "^1.0.5",
diff --git a/package-lock.json b/package-lock.json
index 2c09851d9..047199e68 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -78,7 +78,7 @@
],
"license": "Artistic-2.0",
"dependencies": {
- "@npmcli/arborist": "^1.0.3",
+ "@npmcli/arborist": "^1.0.4",
"@npmcli/ci-detect": "^1.2.0",
"@npmcli/config": "^1.2.1",
"@npmcli/run-script": "^1.7.0",
@@ -383,9 +383,10 @@
}
},
"node_modules/@npmcli/arborist": {
- "version": "1.0.3",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.4.tgz",
+ "integrity": "sha512-1P0+eYHxSQ6PHWm7hQGA0l8xgw4isbrG0eT9I6J9zY32GgUb/ehmMSbgWuXK3/ADWTdldBLnSBICR2oWX4YW7A==",
"inBundle": true,
- "license": "ISC",
"dependencies": {
"@npmcli/installed-package-contents": "^1.0.5",
"@npmcli/map-workspaces": "^1.0.1",
@@ -8259,7 +8260,9 @@
}
},
"@npmcli/arborist": {
- "version": "1.0.3",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-1.0.4.tgz",
+ "integrity": "sha512-1P0+eYHxSQ6PHWm7hQGA0l8xgw4isbrG0eT9I6J9zY32GgUb/ehmMSbgWuXK3/ADWTdldBLnSBICR2oWX4YW7A==",
"requires": {
"@npmcli/installed-package-contents": "^1.0.5",
"@npmcli/map-workspaces": "^1.0.1",
diff --git a/package.json b/package.json
index bed78187f..2a3bd04b4 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"./package.json": "./package.json"
},
"dependencies": {
- "@npmcli/arborist": "^1.0.3",
+ "@npmcli/arborist": "^1.0.4",
"@npmcli/ci-detect": "^1.2.0",
"@npmcli/config": "^1.2.1",
"@npmcli/run-script": "^1.7.0",