Skip to content

Commit

Permalink
deps: npm-package-arg@10.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Dec 7, 2022
1 parent dfd5d46 commit 875bd56
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 22 deletions.
2 changes: 1 addition & 1 deletion mock-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@npmcli/eslint-config": "^4.0.1",
"@npmcli/template-oss": "4.11.0",
"nock": "^13.2.9",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.6",
"tap": "^16.3.0"
}
Expand Down
26 changes: 26 additions & 0 deletions node_modules/npm-package-arg/lib/npa.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'
module.exports = npa
module.exports.resolve = resolve
module.exports.toPurl = toPurl
module.exports.Result = Result

const url = require('url')
Expand Down Expand Up @@ -87,6 +88,24 @@ function resolve (name, spec, where, arg) {
}
}

const defaultRegistry = 'https://registry.npmjs.org'

function toPurl (arg, reg = defaultRegistry) {
const res = npa(arg)

if (res.type !== 'version') {
throw invalidPurlType(res.type, res.raw)
}

// URI-encode leading @ of scoped packages
let purl = 'pkg:npm/' + res.name.replace(/^@/, '%40') + '@' + res.rawSpec
if (reg !== defaultRegistry) {
purl += '?repository_url=' + reg
}

return purl
}

function invalidPackageName (name, valid, raw) {
// eslint-disable-next-line max-len
const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join('; ')}.`)
Expand All @@ -101,6 +120,13 @@ function invalidTagName (name, raw) {
return err
}

function invalidPurlType (type, raw) {
// eslint-disable-next-line max-len
const err = new Error(`Invalid type "${type}" of package "${raw}": Purl can only be generated for "version" types.`)
err.code = 'EINVALIDPURLTYPE'
return err
}

function Result (opts) {
this.type = opts.type
this.registry = opts.registry
Expand Down
6 changes: 3 additions & 3 deletions node_modules/npm-package-arg/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "npm-package-arg",
"version": "10.0.0",
"version": "10.1.0",
"description": "Parse the things that can be arguments to `npm install`",
"main": "./lib/npa.js",
"directories": {
Expand All @@ -18,7 +18,7 @@
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.6.1",
"@npmcli/template-oss": "4.10.0",
"tap": "^16.0.1"
},
"scripts": {
Expand Down Expand Up @@ -54,6 +54,6 @@
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.6.1"
"version": "4.10.0"
}
}
22 changes: 11 additions & 11 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"nopt": "^7.0.0",
"npm-audit-report": "^4.0.0",
"npm-install-checks": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-profile": "^7.0.1",
"npm-registry-fetch": "^14.0.2",
Expand Down Expand Up @@ -213,7 +213,7 @@
"@npmcli/eslint-config": "^4.0.1",
"@npmcli/template-oss": "4.11.0",
"nock": "^13.2.9",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.6",
"tap": "^16.3.0"
},
Expand Down Expand Up @@ -9519,9 +9519,9 @@
}
},
"node_modules/npm-package-arg": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.0.0.tgz",
"integrity": "sha512-7dkh8mRp7s0KwVHKIVJnFCJQ2B34gOGnzgBjDGyprycmARq/82SX/lhilQ95ZuacP/G/1gsS345iAkKmxWBQ2Q==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-10.1.0.tgz",
"integrity": "sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA==",
"inBundle": true,
"dependencies": {
"hosted-git-info": "^6.0.0",
Expand Down Expand Up @@ -15006,7 +15006,7 @@
"minimatch": "^5.1.0",
"nopt": "^7.0.0",
"npm-install-checks": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-registry-fetch": "^14.0.2",
"npmlog": "^7.0.1",
Expand Down Expand Up @@ -15064,7 +15064,7 @@
"version": "7.0.0",
"license": "ISC",
"dependencies": {
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-registry-fetch": "^14.0.2"
},
"devDependencies": {
Expand All @@ -15088,7 +15088,7 @@
"binary-extensions": "^2.2.0",
"diff": "^5.1.0",
"minimatch": "^5.0.1",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.2",
"tar": "^6.1.0"
},
Expand All @@ -15109,7 +15109,7 @@
"@npmcli/run-script": "^6.0.0",
"chalk": "^4.1.0",
"ci-info": "^3.6.1",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npmlog": "^7.0.1",
"pacote": "^15.0.2",
"proc-log": "^3.0.0",
Expand Down Expand Up @@ -15189,7 +15189,7 @@
"dependencies": {
"@npmcli/arborist": "^6.1.4",
"@npmcli/run-script": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.2"
},
"devDependencies": {
Expand All @@ -15208,7 +15208,7 @@
"license": "ISC",
"dependencies": {
"normalize-package-data": "^5.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-registry-fetch": "^14.0.2",
"semver": "^7.3.7",
"ssri": "^10.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"nopt": "^7.0.0",
"npm-audit-report": "^4.0.0",
"npm-install-checks": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-profile": "^7.0.1",
"npm-registry-fetch": "^14.0.2",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"minimatch": "^5.1.0",
"nopt": "^7.0.0",
"npm-install-checks": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-pick-manifest": "^8.0.1",
"npm-registry-fetch": "^14.0.2",
"npmlog": "^7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmaccess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"bugs": "https://github.com/npm/libnpmaccess/issues",
"homepage": "https://npmjs.com/package/libnpmaccess",
"dependencies": {
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-registry-fetch": "^14.0.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmdiff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"binary-extensions": "^2.2.0",
"diff": "^5.1.0",
"minimatch": "^5.0.1",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.2",
"tar": "^6.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmexec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@npmcli/run-script": "^6.0.0",
"chalk": "^4.1.0",
"ci-info": "^3.6.1",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npmlog": "^7.0.1",
"pacote": "^15.0.2",
"proc-log": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dependencies": {
"@npmcli/arborist": "^6.1.4",
"@npmcli/run-script": "^6.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"pacote": "^15.0.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmpublish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"homepage": "https://npmjs.com/package/libnpmpublish",
"dependencies": {
"normalize-package-data": "^5.0.0",
"npm-package-arg": "^10.0.0",
"npm-package-arg": "^10.1.0",
"npm-registry-fetch": "^14.0.2",
"semver": "^7.3.7",
"ssri": "^10.0.0"
Expand Down

0 comments on commit 875bd56

Please sign in to comment.