From 51fb83ce93fdd7e289da7b2aabc95b0518f0aa31 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 20 Oct 2021 15:54:57 -0700 Subject: [PATCH] deps: @npmcli/arborist@4.0.2 * fix: skip peer conflict check if there is a current node PR-URL: https://github.com/npm/cli/pull/3921 Credit: @lukekarrys Close: #3921 Reviewed-by: @wraithgar --- .../@npmcli/arborist/lib/can-place-dep.js | 15 ++++++++++----- node_modules/@npmcli/arborist/package.json | 2 +- package-lock.json | 14 +++++++------- package.json | 2 +- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/node_modules/@npmcli/arborist/lib/can-place-dep.js b/node_modules/@npmcli/arborist/lib/can-place-dep.js index 6be59093c034f..2278e25e3b0f3 100644 --- a/node_modules/@npmcli/arborist/lib/can-place-dep.js +++ b/node_modules/@npmcli/arborist/lib/can-place-dep.js @@ -145,7 +145,12 @@ class CanPlaceDep { return CONFLICT } - if (targetEdge && !dep.satisfies(targetEdge) && targetEdge !== this.edge) { + // skip this test if there's a current node, because we might be able + // to dedupe against it anyway + if (!current && + targetEdge && + !dep.satisfies(targetEdge) && + targetEdge !== this.edge) { return CONFLICT } @@ -167,10 +172,10 @@ class CanPlaceDep { const { version: newVer } = dep const tryReplace = curVer && newVer && semver.gte(newVer, curVer) if (tryReplace && dep.canReplace(current)) { - /* XXX-istanbul ignore else - It's extremely rare that a replaceable - * node would be a conflict, if the current one wasn't a conflict, - * but it is theoretically possible if peer deps are pinned. In - * that case we treat it like any other conflict, and keep trying */ + // It's extremely rare that a replaceable node would be a conflict, if + // the current one wasn't a conflict, but it is theoretically possible + // if peer deps are pinned. In that case we treat it like any other + // conflict, and keep trying. const cpp = this.canPlacePeers(REPLACE) if (cpp !== CONFLICT) { return cpp diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index d131ccf1545fa..1954be5b3d7ca 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/arborist", - "version": "4.0.1", + "version": "4.0.2", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.0.1", diff --git a/package-lock.json b/package-lock.json index 38fd6b7fc6b24..35dfbe2611f6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,7 @@ ], "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^4.0.1", + "@npmcli/arborist": "^4.0.2", "@npmcli/ci-detect": "^1.4.0", "@npmcli/config": "^2.3.0", "@npmcli/map-workspaces": "^2.0.0", @@ -772,9 +772,9 @@ } }, "node_modules/@npmcli/arborist": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.1.tgz", - "integrity": "sha512-EhHFbvwNbkVl2T0FYUyxt00pxLCuqMSloikOOpjGXGSHLZSkItQGxDM3ly4liKGEBuU1qJBRH3VlJJKCz0c6vQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.2.tgz", + "integrity": "sha512-tmuUNr66acGh8oOo6rKLNOaleeUDSymxTBQJFzDpRET8kG1nzLwIRMpV+CZkzmQ0tbCQ1NMyDvBeyu+kaJ+Dtw==", "inBundle": true, "dependencies": { "@isaacs/string-locale-compare": "^1.0.1", @@ -11082,9 +11082,9 @@ "dev": true }, "@npmcli/arborist": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.1.tgz", - "integrity": "sha512-EhHFbvwNbkVl2T0FYUyxt00pxLCuqMSloikOOpjGXGSHLZSkItQGxDM3ly4liKGEBuU1qJBRH3VlJJKCz0c6vQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.2.tgz", + "integrity": "sha512-tmuUNr66acGh8oOo6rKLNOaleeUDSymxTBQJFzDpRET8kG1nzLwIRMpV+CZkzmQ0tbCQ1NMyDvBeyu+kaJ+Dtw==", "requires": { "@isaacs/string-locale-compare": "^1.0.1", "@npmcli/installed-package-contents": "^1.0.7", diff --git a/package.json b/package.json index 8a4e01b9a6d4e..91527005ce9f9 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^4.0.1", + "@npmcli/arborist": "^4.0.2", "@npmcli/ci-detect": "^1.4.0", "@npmcli/config": "^2.3.0", "@npmcli/map-workspaces": "^2.0.0",