From 8b6bf0db49a3378bd85a0d1ffdd19fbdd68a944a Mon Sep 17 00:00:00 2001 From: nlf Date: Mon, 22 Feb 2021 09:16:35 -0800 Subject: [PATCH] pacote@11.2.7 --- node_modules/pacote/lib/dir.js | 9 +++++++++ node_modules/pacote/lib/git.js | 12 ++---------- node_modules/pacote/lib/util/add-git-sha.js | 15 +++++++++++++++ node_modules/pacote/package.json | 2 +- package-lock.json | 14 +++++++------- package.json | 2 +- 6 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 node_modules/pacote/lib/util/add-git-sha.js diff --git a/node_modules/pacote/lib/dir.js b/node_modules/pacote/lib/dir.js index 16660d9821eb4..4a89348b9290c 100644 --- a/node_modules/pacote/lib/dir.js +++ b/node_modules/pacote/lib/dir.js @@ -33,11 +33,20 @@ class DirFetcher extends Fetcher { // we *only* run prepare. // pre/post-pack is run by the npm CLI for publish and pack, // but this function is *also* run when installing git deps + const stdio = this.opts.foregroundScripts ? 'inherit' : 'pipe' + + // hide the banner if loglevel is silent, or if prepare running + // in the background. + const banner = this.opts.log && this.opts.log.level === 'silent' ? false + : stdio === 'inherit' + return runScript({ pkg: mani, event: 'prepare', path: this.resolved, stdioString: true, + stdio, + banner, env: { npm_package_resolved: this.resolved, npm_package_integrity: this.integrity, diff --git a/node_modules/pacote/lib/git.js b/node_modules/pacote/lib/git.js index 14d8a833659ce..973e13ea9be43 100644 --- a/node_modules/pacote/lib/git.js +++ b/node_modules/pacote/lib/git.js @@ -18,6 +18,7 @@ const _resolvedFromHosted = Symbol('_resolvedFromHosted') const _resolvedFromClone = Symbol('_resolvedFromClone') const _tarballFromResolved = Symbol.for('pacote.Fetcher._tarballFromResolved') const _addGitSha = Symbol('_addGitSha') +const addGitSha = require('./util/add-git-sha.js') const _clone = Symbol('_clone') const _cloneHosted = Symbol('_cloneHosted') const _cloneRepo = Symbol('_cloneRepo') @@ -131,16 +132,7 @@ class GitFetcher extends Fetcher { // when we get the git sha, we affix it to our spec to build up // either a git url with a hash, or a tarball download URL [_addGitSha] (sha) { - if (this.spec.hosted) { - const h = this.spec.hosted - const opt = { noCommittish: true } - const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt) - - this[_setResolvedWithSha](`${base}#${sha}`) - } else { - const u = url.format(new url.URL(`#${sha}`, this.spec.rawSpec)) - this[_setResolvedWithSha](url.format(u)) - } + this[_setResolvedWithSha](addGitSha(this.spec, sha)) } [_resolvedFromClone] () { diff --git a/node_modules/pacote/lib/util/add-git-sha.js b/node_modules/pacote/lib/util/add-git-sha.js new file mode 100644 index 0000000000000..843fe5b600caf --- /dev/null +++ b/node_modules/pacote/lib/util/add-git-sha.js @@ -0,0 +1,15 @@ +// add a sha to a git remote url spec +const addGitSha = (spec, sha) => { + if (spec.hosted) { + const h = spec.hosted + const opt = { noCommittish: true } + const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt) + + return `${base}#${sha}` + } else { + // don't use new URL for this, because it doesn't handle scp urls + return spec.rawSpec.replace(/#.*$/, '') + `#${sha}` + } +} + +module.exports = addGitSha diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 8c25e68330bdc..a1668056f9794 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "11.2.6", + "version": "11.2.7", "description": "JavaScript package downloader", "author": "Isaac Z. Schlueter (https://izs.me)", "bin": { diff --git a/package-lock.json b/package-lock.json index a0562456942f6..70b06c271db56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -301,7 +301,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.2.6", + "pacote": "^11.2.7", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", @@ -5964,9 +5964,9 @@ } }, "node_modules/pacote": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.6.tgz", - "integrity": "sha512-xCl++Hb3aBC7LaWMimbO4xUqZVsEbKDVc6KKDIIyAeBYrmMwY1yJC2nES/lsGd8sdQLUosgBxQyuVNncZ2Ru0w==", + "version": "11.2.7", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.7.tgz", + "integrity": "sha512-ogxPor11v/rnU9ukwLlI2dPx22q9iob1+yZyqSwerKsOvBMhU9e+SJHtxY4y2N0MRH4/5jGsGiRLsZeJWyM4dQ==", "inBundle": true, "dependencies": { "@npmcli/git": "^2.0.1", @@ -15070,9 +15070,9 @@ } }, "pacote": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.6.tgz", - "integrity": "sha512-xCl++Hb3aBC7LaWMimbO4xUqZVsEbKDVc6KKDIIyAeBYrmMwY1yJC2nES/lsGd8sdQLUosgBxQyuVNncZ2Ru0w==", + "version": "11.2.7", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.2.7.tgz", + "integrity": "sha512-ogxPor11v/rnU9ukwLlI2dPx22q9iob1+yZyqSwerKsOvBMhU9e+SJHtxY4y2N0MRH4/5jGsGiRLsZeJWyM4dQ==", "requires": { "@npmcli/git": "^2.0.1", "@npmcli/installed-package-contents": "^1.0.6", diff --git a/package.json b/package.json index 726b2991727ee..33bd16b6c3669 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.2.6", + "pacote": "^11.2.7", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7",