diff options
author | isaacs <i@izs.me> | 2021-02-01 22:47:04 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2021-02-01 22:47:04 +0300 |
commit | 7e4e88e938323e34a2a41176472d8e43e84bd4dd (patch) | |
tree | 8a3cdb897b97678f82572dc08aa664a765bb8c6e /node_modules/@npmcli | |
parent | 7b1a5399cfbfcc7a7194c4aa4bbadfbce6cbbe66 (diff) |
@npmcli/arborist@2.1.1, pacote@11.2.4
* Properly raise ERESOLVE errors on root dev dependencies
* Ignore ERESOLVE errors when performing git dep 'prepare' scripts
* Always reinstall packages that are explicitly requested
* fix global update all so it actually updates things
* Install bins properly when global root is a link
Diffstat (limited to 'node_modules/@npmcli')
4 files changed, 23 insertions, 17 deletions
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 9328b8043..ae92b74ce 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -416,7 +416,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { await this[_add](options) // triggers a refresh of all edgesOut - if (options.add && options.add.length || options.rm && options.rm.length) + if (options.add && options.add.length || options.rm && options.rm.length || this[_global]) tree.package = tree.package process.emit('timeEnd', 'idealTree:userRequests') } @@ -1148,6 +1148,7 @@ This is a one-time fix-up, please be patient... [_placeDep] (dep, node, edge, peerEntryEdge = null, peerPath = []) { if (edge.to && !edge.error && + !this[_explicitRequests].has(edge.name) && !this[_updateNames].includes(edge.name) && !this[_isVulnerable](edge.to)) return [] diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js index 19c7fa384..6cc129a7c 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -233,7 +233,7 @@ module.exports = cls => class Reifier extends cls { const actualOpt = this[_global] ? { ignoreMissing: true, global: true, - filter: (node, kid) => !node.isRoot && node !== node.root.target + filter: (node, kid) => this[_explicitRequests].size === 0 || !node.isProjectRoot ? true : (node.edgesOut.has(kid) || this[_explicitRequests].has(kid)), } : { ignoreMissing: true } @@ -605,7 +605,7 @@ module.exports = cls => class Reifier extends cls { tree: this.diff, visit: diff => { const node = diff.ideal - if (node && !node.isRoot && node.package.bundleDependencies && + if (node && !node.isProjectRoot && node.package.bundleDependencies && node.package.bundleDependencies.length) { maxBundleDepth = Math.max(maxBundleDepth, node.depth) if (!bundlesByDepth.has(node.depth)) @@ -811,7 +811,7 @@ module.exports = cls => class Reifier extends cls { dfwalk({ tree: this.diff, leave: diff => { - if (!diff.ideal.isRoot) + if (!diff.ideal.isProjectRoot) nodes.push(diff.ideal) }, // process adds before changes, ignore removals diff --git a/node_modules/@npmcli/arborist/lib/node.js b/node_modules/@npmcli/arborist/lib/node.js index 01147b9d4..9a6b86e40 100644 --- a/node_modules/@npmcli/arborist/lib/node.js +++ b/node_modules/@npmcli/arborist/lib/node.js @@ -247,7 +247,7 @@ class Node { // true for packages installed directly in the global node_modules folder get globalTop () { - return this.global && this.parent.isRoot + return this.global && this.parent.isProjectRoot } get workspaces () { @@ -294,8 +294,11 @@ class Node { const { name = '', version = '' } = this.package // root package will prefer package name over folder name, // and never be called an alias. - const myname = this.isRoot ? name || this.name : this.name - const alias = !this.isRoot && name && myname !== name ? `npm:${name}@` : '' + const { isProjectRoot } = this + const myname = isProjectRoot ? name || this.name + : this.name + const alias = !isProjectRoot && name && myname !== name ? `npm:${name}@` + : '' return `${myname}@${alias}${version}` } @@ -339,14 +342,14 @@ class Node { } [_explain] (edge, seen) { - if (this.isRoot && !this.sourceReference) { + if (this.isProjectRoot && !this.sourceReference) { return { location: this.path, } } const why = { - name: this.isRoot ? this.package.name : this.name, + name: this.isProjectRoot ? this.package.name : this.name, version: this.package.version, } if (this.errors.length || !this.package.name || !this.package.version) { @@ -384,7 +387,7 @@ class Node { // and are not keeping it held in this spot anyway. const edges = [] for (const edge of this.edgesIn) { - if (!edge.valid && !edge.from.isRoot) + if (!edge.valid && !edge.from.isProjectRoot) continue edges.push(edge) @@ -453,7 +456,7 @@ class Node { } get isWorkspace () { - if (this.isRoot) + if (this.isProjectRoot) return false const { root } = this const { type, to } = root.edgesOut.get(this.package.name) || {} @@ -733,7 +736,9 @@ class Node { // 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.sourceReference) + const { isTop, path, sourceReference } = this + const { isTop: srcTop, path: srcPath } = sourceReference || {} + if (isTop && path && (!sourceReference || srcTop && srcPath)) this[_loadDepType](this.package.devDependencies, 'dev') const pd = this.package.peerDependencies @@ -902,8 +907,8 @@ class Node { if (this.isLink) return node.isLink && this.target.matches(node.target) - // if they're two root nodes, they're different if the paths differ - if (this.isRoot && node.isRoot) + // if they're two project root nodes, they're different if the paths differ + if (this.isProjectRoot && node.isProjectRoot) return this.path === node.path // if the integrity matches, then they're the same. diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index bf0de2993..2107652c6 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "2.1.0", + "version": "2.1.1", "description": "Manage node_modules trees", "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", @@ -20,7 +20,7 @@ "npm-package-arg": "^8.1.0", "npm-pick-manifest": "^6.1.0", "npm-registry-fetch": "^9.0.0", - "pacote": "^11.2.3", + "pacote": "^11.2.4", "parse-conflict-json": "^1.1.1", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", @@ -55,7 +55,7 @@ "postversion": "npm publish", "prepublishOnly": "git push origin --follow-tags", "eslint": "eslint", - "lint": "npm run eslint -- \"lib/**/*.js\"", + "lint": "npm run eslint -- \"lib/**/*.js\" \"test/arborist/*.js\" \"test/*.js\"", "lintfix": "npm run lint -- --fix", "benchmark": "node scripts/benchmark.js", "benchclean": "rm -rf scripts/benchmark/*/" |