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 6a48ea1384261..852c7df76524f 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js +++ b/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js @@ -130,7 +130,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { } // public method - buildIdealTree (options = {}) { + async buildIdealTree (options = {}) { if (this.idealTree) return Promise.resolve(this.idealTree) @@ -154,16 +154,18 @@ module.exports = cls => class IdealTreeBuilder extends cls { // start tracker block this.addTracker('idealTree') - return this[_initTree]() - .then(() => this[_applyUserRequests](options)) - .then(() => this[_buildDeps]()) - .then(() => this[_fixDepFlags]()) - .then(() => this[_pruneFailedOptional]()) - .then(() => { - process.emit('timeEnd', 'idealTree') - this.finishTracker('idealTree') - return this.idealTree - }) + try { + await this[_initTree]() + await this[_applyUserRequests](options) + await this[_buildDeps]() + await this[_fixDepFlags]() + await this[_pruneFailedOptional]() + } finally { + process.emit('timeEnd', 'idealTree') + this.finishTracker('idealTree') + } + + return this.idealTree } [_parseSettings] (options) { @@ -629,7 +631,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { // instead of nesting forever, when the loop occurs, create // a symbolic link to the earlier instance for (let p = edge.from.resolveParent; p; p = p.resolveParent) { - if (p.matches(node)) + if (p.matches(node) && !p.isRoot) return new Link({ parent, target: p }) } return this[_loadPeerSet](node) diff --git a/node_modules/@npmcli/arborist/lib/arborist/reify.js b/node_modules/@npmcli/arborist/lib/arborist/reify.js index 13fdd11176a16..01cbccc803427 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/reify.js +++ b/node_modules/@npmcli/arborist/lib/arborist/reify.js @@ -206,6 +206,7 @@ module.exports = cls => class Reifier extends cls { actual: this.actualTree, ideal: this.idealTree, }) + for (const node of this.diff.removed) { // a node in a dep bundle will only be removed if its bundling dep // is removed as well. in which case, we don't have to delete it! @@ -661,8 +662,11 @@ module.exports = cls => class Reifier extends cls { const unpacks = [] dfwalk({ tree: this.diff, - filter: diff => diff.ideal, visit: diff => { + // no unpacking if we don't want to change this thing + if (diff.action !== 'CHANGE' && diff.action !== 'ADD') + return + const node = diff.ideal const bd = node.package.bundleDependencies const sw = node.hasShrinkwrap @@ -765,7 +769,10 @@ module.exports = cls => class Reifier extends cls { const nodes = [] dfwalk({ tree: this.diff, - leave: diff => nodes.push(diff.ideal), + leave: diff => { + if (!diff.ideal.isRoot) + nodes.push(diff.ideal) + }, // process adds before changes, ignore removals getChildren: diff => diff && diff.children, filter: diff => diff.action === 'ADD' || diff.action === 'CHANGE' diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index 7c303c4b5c86f..7f4df9eba903d 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "0.0.14", + "version": "0.0.15", "description": "Manage node_modules trees", "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", diff --git a/package-lock.json b/package-lock.json index 55cf84f2c8a03..915a1cec5545b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "npm", - "version": "7.0.0-beta.1", + "version": "7.0.0-beta.2", "bundleDependencies": [ "@npmcli/arborist", "@npmcli/ci-detect", @@ -46,6 +46,7 @@ "libnpmteam", "libnpmversion", "lockfile", + "make-fetch-happen", "meant", "mkdirp", "mkdirp-infer-owner", @@ -82,12 +83,11 @@ "uuid", "validate-npm-package-name", "which", - "write-file-atomic", - "make-fetch-happen" + "write-file-atomic" ], "license": "Artistic-2.0", "dependencies": { - "@npmcli/arborist": "^0.0.14", + "@npmcli/arborist": "^0.0.15", "@npmcli/ci-detect": "^1.2.0", "@npmcli/run-script": "^1.4.0", "abbrev": "~1.1.1", @@ -395,9 +395,9 @@ "dev": true }, "node_modules/@npmcli/arborist": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.14.tgz", - "integrity": "sha512-UWLPw8ahdYNJGrstg9yYOIsMsDhjUSRckys9ofElNASlOgjBKuX2gvbebyCuUKxje9uxwdq+OTp9DJ8iRR6pgg==", + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.15.tgz", + "integrity": "sha512-z/vBh3WXNQTz2DBcNYlA9aA5Jbh7Q3C6WQ0iBJS1FjshrtvlkTp3vaRQS/koSRVl1P2Q6f5sCAJLraU44Q5CEA==", "inBundle": true, "dependencies": { "@npmcli/installed-package-contents": "^1.0.5", @@ -9429,9 +9429,9 @@ "dev": true }, "@npmcli/arborist": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.14.tgz", - "integrity": "sha512-UWLPw8ahdYNJGrstg9yYOIsMsDhjUSRckys9ofElNASlOgjBKuX2gvbebyCuUKxje9uxwdq+OTp9DJ8iRR6pgg==", + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-0.0.15.tgz", + "integrity": "sha512-z/vBh3WXNQTz2DBcNYlA9aA5Jbh7Q3C6WQ0iBJS1FjshrtvlkTp3vaRQS/koSRVl1P2Q6f5sCAJLraU44Q5CEA==", "requires": { "@npmcli/installed-package-contents": "^1.0.5", "@npmcli/map-workspaces": "0.0.0-pre.1", diff --git a/package.json b/package.json index 5ec625aaef080..98a8378acb466 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^0.0.14", + "@npmcli/arborist": "^0.0.15", "@npmcli/ci-detect": "^1.2.0", "@npmcli/run-script": "^1.4.0", "abbrev": "~1.1.1",