From 875bd56c33ca5eef80c2a50a11808445f2a39a2a Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 7 Dec 2022 13:17:09 -0700 Subject: [PATCH] deps: npm-package-arg@10.1.0 --- mock-registry/package.json | 2 +- node_modules/npm-package-arg/lib/npa.js | 26 +++++++++++++++++++++++ node_modules/npm-package-arg/package.json | 6 +++--- package-lock.json | 22 +++++++++---------- package.json | 2 +- workspaces/arborist/package.json | 2 +- workspaces/libnpmaccess/package.json | 2 +- workspaces/libnpmdiff/package.json | 2 +- workspaces/libnpmexec/package.json | 2 +- workspaces/libnpmpack/package.json | 2 +- workspaces/libnpmpublish/package.json | 2 +- 11 files changed, 48 insertions(+), 22 deletions(-) diff --git a/mock-registry/package.json b/mock-registry/package.json index 80dc35423c466..702a8769c3d50 100644 --- a/mock-registry/package.json +++ b/mock-registry/package.json @@ -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" } diff --git a/node_modules/npm-package-arg/lib/npa.js b/node_modules/npm-package-arg/lib/npa.js index 10af67be538f3..36bd18cd9f9a6 100644 --- a/node_modules/npm-package-arg/lib/npa.js +++ b/node_modules/npm-package-arg/lib/npa.js @@ -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') @@ -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('; ')}.`) @@ -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 diff --git a/node_modules/npm-package-arg/package.json b/node_modules/npm-package-arg/package.json index 9ade534a2d88c..bb9e71b258a93 100644 --- a/node_modules/npm-package-arg/package.json +++ b/node_modules/npm-package-arg/package.json @@ -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": { @@ -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": { @@ -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" } } diff --git a/package-lock.json b/package-lock.json index 62531d9a9dc2f..65eaa67262db3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", @@ -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" }, @@ -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", @@ -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", @@ -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": { @@ -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" }, @@ -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", @@ -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": { @@ -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" diff --git a/package.json b/package.json index 073d4108ae144..69d5e1e379f9c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 83a625aabea5e..43fd49b4b112a 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -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", diff --git a/workspaces/libnpmaccess/package.json b/workspaces/libnpmaccess/package.json index 4938c0c150f76..a2b5129d1d962 100644 --- a/workspaces/libnpmaccess/package.json +++ b/workspaces/libnpmaccess/package.json @@ -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": { diff --git a/workspaces/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json index 79708170654d2..3fbf7e1140c96 100644 --- a/workspaces/libnpmdiff/package.json +++ b/workspaces/libnpmdiff/package.json @@ -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" }, diff --git a/workspaces/libnpmexec/package.json b/workspaces/libnpmexec/package.json index 8fb82c090b420..106d1ee2e4a52 100644 --- a/workspaces/libnpmexec/package.json +++ b/workspaces/libnpmexec/package.json @@ -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", diff --git a/workspaces/libnpmpack/package.json b/workspaces/libnpmpack/package.json index 26a40cbd139f8..a36f679bdf14f 100644 --- a/workspaces/libnpmpack/package.json +++ b/workspaces/libnpmpack/package.json @@ -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": { diff --git a/workspaces/libnpmpublish/package.json b/workspaces/libnpmpublish/package.json index 50879ad1eb9c1..909a310043c2c 100644 --- a/workspaces/libnpmpublish/package.json +++ b/workspaces/libnpmpublish/package.json @@ -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"