npm-package-arg
Advanced tools
Comparing version 9.0.2 to 9.1.0
@@ -12,2 +12,3 @@ 'use strict' | ||
const { homedir } = require('os') | ||
const log = require('proc-log') | ||
@@ -124,2 +125,3 @@ const isWindows = process.platform === 'win32' || global.FAKE_WINDOWS | ||
this.gitCommittish = opts.gitCommittish | ||
this.gitSubdir = opts.gitSubdir | ||
this.hosted = opts.hosted | ||
@@ -160,9 +162,43 @@ } | ||
function setGitCommittish (res, committish) { | ||
if (committish != null && committish.length >= 7 && committish.slice(0, 7) === 'semver:') { | ||
res.gitRange = decodeURIComponent(committish.slice(7)) | ||
if (!committish) { | ||
res.gitCommittish = null | ||
} else { | ||
res.gitCommittish = committish === '' ? null : committish | ||
return res | ||
} | ||
// for each :: separated item: | ||
for (const part of committish.split('::')) { | ||
// if the item has no : the n it is a commit-ish | ||
if (!part.includes(':')) { | ||
if (res.gitRange) { | ||
throw new Error('cannot override existing semver range with a committish') | ||
} | ||
if (res.gitCommittish) { | ||
throw new Error('cannot override existing committish with a second committish') | ||
} | ||
res.gitCommittish = part | ||
continue | ||
} | ||
// split on name:value | ||
const [name, value] = part.split(':') | ||
// if name is semver do semver lookup of ref or tag | ||
if (name === 'semver') { | ||
if (res.gitCommittish) { | ||
throw new Error('cannot override existing committish with a semver range') | ||
} | ||
if (res.gitRange) { | ||
throw new Error('cannot override existing semver range with a second semver range') | ||
} | ||
res.gitRange = decodeURIComponent(value) | ||
continue | ||
} | ||
if (name === 'path') { | ||
if (res.gitSubdir) { | ||
throw new Error('cannot override existing path with a second path') | ||
} | ||
res.gitSubdir = `/${value}` | ||
continue | ||
} | ||
log.warn('npm-package-arg', `ignoring unknown key "${name}"`) | ||
} | ||
return res | ||
@@ -169,0 +205,0 @@ } |
{ | ||
"name": "npm-package-arg", | ||
"version": "9.0.2", | ||
"version": "9.1.0", | ||
"description": "Parse the things that can be arguments to `npm install`", | ||
@@ -15,2 +15,3 @@ "main": "./lib/npa.js", | ||
"hosted-git-info": "^5.0.0", | ||
"proc-log": "^2.0.1", | ||
"semver": "^7.3.5", | ||
@@ -21,3 +22,3 @@ "validate-npm-package-name": "^4.0.0" | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.2.1", | ||
"@npmcli/template-oss": "3.5.0", | ||
"tap": "^16.0.1" | ||
@@ -57,4 +58,4 @@ }, | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "3.2.1" | ||
"version": "3.5.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18492
365
4
+ Addedproc-log@^2.0.1
+ Addedproc-log@2.0.1(transitive)