summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js')
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js b/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
index 9c1bc7d3f2..4afb5e47cf 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/dep-valid.js
@@ -84,15 +84,21 @@ const depValid = (child, requested, requestor) => {
const reqHost = requested.hosted
const reqCommit = /^[a-fA-F0-9]{40}$/.test(requested.gitCommittish || '')
const nc = { noCommittish: !reqCommit }
- const sameRepo =
- resHost ? reqHost && reqHost.ssh(nc) === resHost.ssh(nc)
- : resRepo.fetchSpec === requested.fetchSpec
-
- return !sameRepo ? false
- : !requested.gitRange ? true
- : semver.satisfies(child.package.version, requested.gitRange, {
- loose: true,
- })
+ if (!resHost) {
+ if (resRepo.fetchSpec !== requested.fetchSpec) {
+ return false
+ }
+ } else {
+ if (reqHost?.ssh(nc) !== resHost.ssh(nc)) {
+ return false
+ }
+ }
+ if (!requested.gitRange) {
+ return true
+ }
+ return semver.satisfies(child.package.version, requested.gitRange, {
+ loose: true,
+ })
}
default: // unpossible, just being cautious