From 62faf8adba19d6ef26238887a453d013fe58ae75 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 3 May 2022 13:57:22 -0700 Subject: [PATCH] deps: pacote@13.2.0 (#4837) --- node_modules/pacote/lib/fetcher.js | 11 +++++++++-- node_modules/pacote/lib/remote.js | 13 ++++++++----- node_modules/pacote/package.json | 6 +++--- package-lock.json | 14 +++++++------- package.json | 2 +- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/node_modules/pacote/lib/fetcher.js b/node_modules/pacote/lib/fetcher.js index 65e97e205204e..d88724c5d1973 100644 --- a/node_modules/pacote/lib/fetcher.js +++ b/node_modules/pacote/lib/fetcher.js @@ -105,8 +105,15 @@ class FetcherBase { this[_readPackageJson] = readPackageJsonFast } - // config values: npmjs (default), never - this.replaceRegistryHost = opts.replaceRegistryHost === 'never' ? 'never' : 'npmjs' + // config values: npmjs (default), never, always + // we don't want to mutate the original value + if (opts.replaceRegistryHost !== 'never' + && opts.replaceRegistryHost !== 'always' + ) { + this.replaceRegistryHost = 'npmjs' + } else { + this.replaceRegistryHost = opts.replaceRegistryHost + } this.defaultTag = opts.defaultTag || 'latest' this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org') diff --git a/node_modules/pacote/lib/remote.js b/node_modules/pacote/lib/remote.js index 3404ea9474944..14e687805d47a 100644 --- a/node_modules/pacote/lib/remote.js +++ b/node_modules/pacote/lib/remote.js @@ -5,7 +5,7 @@ const pacoteVersion = require('../package.json').version const fetch = require('npm-registry-fetch') const Minipass = require('minipass') // The default registry URL is a string of great magic. -const magic = /^https?:\/\/registry\.npmjs\.org\// +const magicHost = 'https://registry.npmjs.org' const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches') const _headers = Symbol('_headers') @@ -13,10 +13,13 @@ class RemoteFetcher extends Fetcher { constructor (spec, opts) { super(spec, opts) this.resolved = this.spec.fetchSpec - if (this.replaceRegistryHost === 'npmjs' - && magic.test(this.resolved) - && !magic.test(this.registry + '/')) { - this.resolved = this.resolved.replace(magic, this.registry + '/') + const resolvedURL = new URL(this.resolved) + if ( + (this.replaceRegistryHost === 'npmjs' + && resolvedURL.origin === magicHost) + || this.replaceRegistryHost === 'always' + ) { + this.resolved = new URL(resolvedURL.pathname, this.registry).href } // nam is a fermented pork sausage that is good to eat diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index af8166d4ea19e..a978852b2db91 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "13.1.1", + "version": "13.2.0", "description": "JavaScript package downloader", "author": "GitHub Inc.", "bin": { @@ -26,7 +26,7 @@ }, "devDependencies": { "@npmcli/eslint-config": "^3.0.1", - "@npmcli/template-oss": "3.2.2", + "@npmcli/template-oss": "3.4.2", "hosted-git-info": "^5.0.0", "mutate-fs": "^2.1.1", "nock": "^13.2.4", @@ -74,7 +74,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "3.2.2", + "version": "3.4.2", "windowsCI": false } } diff --git a/package-lock.json b/package-lock.json index 7babdc84abc78..89f3515d7b3bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -138,7 +138,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "^6.0.2", "opener": "^1.5.2", - "pacote": "^13.1.1", + "pacote": "^13.2.0", "parse-conflict-json": "^2.0.2", "proc-log": "^2.0.1", "qrcode-terminal": "^0.12.0", @@ -5563,9 +5563,9 @@ } }, "node_modules/pacote": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.1.1.tgz", - "integrity": "sha512-MTT3k1OhUo+IpvoHGp25OwsRU0L+kJQM236OCywxvY4OIJ/YfloNW2/Yc3HMASH10BkfZaGMVK/pxybB7fWcLw==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.2.0.tgz", + "integrity": "sha512-IT4/xHT8eLi4cJdKSGCuqooWp2YwRP5OgrQypbBlLG8Ubzw+h7s57QbrA2SegQcdGefD81ZvuI+aL0JlfFcPCA==", "inBundle": true, "dependencies": { "@npmcli/git": "^3.0.0", @@ -13898,9 +13898,9 @@ } }, "pacote": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.1.1.tgz", - "integrity": "sha512-MTT3k1OhUo+IpvoHGp25OwsRU0L+kJQM236OCywxvY4OIJ/YfloNW2/Yc3HMASH10BkfZaGMVK/pxybB7fWcLw==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.2.0.tgz", + "integrity": "sha512-IT4/xHT8eLi4cJdKSGCuqooWp2YwRP5OgrQypbBlLG8Ubzw+h7s57QbrA2SegQcdGefD81ZvuI+aL0JlfFcPCA==", "requires": { "@npmcli/git": "^3.0.0", "@npmcli/installed-package-contents": "^1.0.7", diff --git a/package.json b/package.json index e1f683219311a..14c1ceb6963dc 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "^6.0.2", "opener": "^1.5.2", - "pacote": "^13.1.1", + "pacote": "^13.2.0", "parse-conflict-json": "^2.0.2", "proc-log": "^2.0.1", "qrcode-terminal": "^0.12.0",