From 2d5797ea01e17b1559d792613446e1435e588a35 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Thu, 15 Jul 2021 14:30:39 -0400 Subject: [PATCH] pacote@11.3.5 --- node_modules/@npmcli/git/lib/errors.js | 36 ++++++++++++++++++++ node_modules/@npmcli/git/lib/index.js | 3 +- node_modules/@npmcli/git/lib/make-error.js | 33 ++++++++++++++++++ node_modules/@npmcli/git/lib/should-retry.js | 17 --------- node_modules/@npmcli/git/lib/spawn.js | 9 ++--- node_modules/@npmcli/git/package.json | 2 +- node_modules/pacote/lib/fetcher.js | 8 +++++ node_modules/pacote/lib/git.js | 7 +++- node_modules/pacote/package.json | 4 +-- package-lock.json | 30 ++++++++-------- package.json | 2 +- 11 files changed, 109 insertions(+), 42 deletions(-) create mode 100644 node_modules/@npmcli/git/lib/errors.js create mode 100644 node_modules/@npmcli/git/lib/make-error.js delete mode 100644 node_modules/@npmcli/git/lib/should-retry.js diff --git a/node_modules/@npmcli/git/lib/errors.js b/node_modules/@npmcli/git/lib/errors.js new file mode 100644 index 0000000000000..25b2b9f9fd6a6 --- /dev/null +++ b/node_modules/@npmcli/git/lib/errors.js @@ -0,0 +1,36 @@ + +const maxRetry = 3 + +class GitError extends Error { + shouldRetry () { + return false + } +} + +class GitConnectionError extends GitError { + constructor (message) { + super('A git connection error occurred') + } + + shouldRetry (number) { + return number < maxRetry + } +} + +class GitPathspecError extends GitError { + constructor (message) { + super('The git reference could not be found') + } +} + +class GitUnknownError extends GitError { + constructor (message) { + super('An unknown git error occurred') + } +} + +module.exports = { + GitConnectionError, + GitPathspecError, + GitUnknownError +} diff --git a/node_modules/@npmcli/git/lib/index.js b/node_modules/@npmcli/git/lib/index.js index 50fd889b89b5a..20d7cfd01cfd1 100644 --- a/node_modules/@npmcli/git/lib/index.js +++ b/node_modules/@npmcli/git/lib/index.js @@ -4,5 +4,6 @@ module.exports = { spawn: require('./spawn.js'), is: require('./is.js'), find: require('./find.js'), - isClean: require('./is-clean.js') + isClean: require('./is-clean.js'), + errors: require('./errors.js') } diff --git a/node_modules/@npmcli/git/lib/make-error.js b/node_modules/@npmcli/git/lib/make-error.js new file mode 100644 index 0000000000000..043a8e6e95181 --- /dev/null +++ b/node_modules/@npmcli/git/lib/make-error.js @@ -0,0 +1,33 @@ +const { + GitConnectionError, + GitPathspecError, + GitUnknownError +} = require('./errors.js') + +const connectionErrorRe = new RegExp([ + 'remote error: Internal Server Error', + 'The remote end hung up unexpectedly', + 'Connection timed out', + 'Operation timed out', + 'Failed to connect to .* Timed out', + 'Connection reset by peer', + 'SSL_ERROR_SYSCALL', + 'The requested URL returned error: 503' +].join('|')) + +const missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/ + +function makeError (er) { + const message = er.stderr + let gitEr + if (connectionErrorRe.test(message)) { + gitEr = new GitConnectionError(message) + } else if (missingPathspecRe.test(message)) { + gitEr = new GitPathspecError(message) + } else { + gitEr = new GitUnknownError(message) + } + return Object.assign(gitEr, er) +} + +module.exports = makeError diff --git a/node_modules/@npmcli/git/lib/should-retry.js b/node_modules/@npmcli/git/lib/should-retry.js deleted file mode 100644 index 8082bb5d7c6e7..0000000000000 --- a/node_modules/@npmcli/git/lib/should-retry.js +++ /dev/null @@ -1,17 +0,0 @@ -const transientErrors = [ - 'remote error: Internal Server Error', - 'The remote end hung up unexpectedly', - 'Connection timed out', - 'Operation timed out', - 'Failed to connect to .* Timed out', - 'Connection reset by peer', - 'SSL_ERROR_SYSCALL', - 'The requested URL returned error: 503' -].join('|') - -const transientErrorRe = new RegExp(transientErrors) - -const maxRetry = 3 - -module.exports = (error, number) => - transientErrorRe.test(error) && (number < maxRetry) diff --git a/node_modules/@npmcli/git/lib/spawn.js b/node_modules/@npmcli/git/lib/spawn.js index 337164a9a012d..1c89a4c53cf86 100644 --- a/node_modules/@npmcli/git/lib/spawn.js +++ b/node_modules/@npmcli/git/lib/spawn.js @@ -1,6 +1,6 @@ const spawn = require('@npmcli/promise-spawn') const promiseRetry = require('promise-retry') -const shouldRetry = require('./should-retry.js') +const makeError = require('./make-error.js') const whichGit = require('./which.js') const makeOpts = require('./opts.js') const procLog = require('./proc-log.js') @@ -33,10 +33,11 @@ module.exports = (gitArgs, opts = {}) => { return spawn(gitPath, args, makeOpts(opts)) .catch(er => { - if (!shouldRetry(er.stderr, number)) { - throw er + const gitError = makeError(er) + if (!gitError.shouldRetry(number)) { + throw gitError } - retry(er) + retry(gitError) }) }, retry) } diff --git a/node_modules/@npmcli/git/package.json b/node_modules/@npmcli/git/package.json index 0fe94686ece20..9475da5007a7d 100644 --- a/node_modules/@npmcli/git/package.json +++ b/node_modules/@npmcli/git/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/git", - "version": "2.0.9", + "version": "2.1.0", "main": "lib/index.js", "files": [ "lib/*.js" diff --git a/node_modules/pacote/lib/fetcher.js b/node_modules/pacote/lib/fetcher.js index d488e88ff7236..69dd025b7bd98 100644 --- a/node_modules/pacote/lib/fetcher.js +++ b/node_modules/pacote/lib/fetcher.js @@ -119,6 +119,13 @@ class FetcherBase { '--no-progress', '--no-save', '--no-audit', + // override any omit settings from the environment + '--include=dev', + '--include=peer', + '--include=optional', + // we need the actual things, not just the lockfile + '--no-package-lock-only', + '--no-dry-run', ] } @@ -430,6 +437,7 @@ class FetcherBase { return { cwd, noChmod: true, + noMtime: true, filter: (name, entry) => { if (/Link$/.test(entry.type)) return false diff --git a/node_modules/pacote/lib/git.js b/node_modules/pacote/lib/git.js index 973e13ea9be43..18f42547bb3ac 100644 --- a/node_modules/pacote/lib/git.js +++ b/node_modules/pacote/lib/git.js @@ -85,6 +85,9 @@ class GitFetcher extends Fetcher { [_resolvedFromHosted] (hosted) { return this[_resolvedFromRepo](hosted.https && hosted.https()) .catch(er => { + // Throw early since we know pathspec errors will fail again if retried + if (er instanceof git.errors.GitPathspecError) + throw er const ssh = hosted.sshurl && hosted.sshurl() // no fallthrough if we can't fall through or have https auth if (!ssh || hosted.auth) @@ -260,9 +263,11 @@ class GitFetcher extends Fetcher { // is present, otherwise ssh if the hosted type provides it [_cloneHosted] (ref, tmp) { const hosted = this.spec.hosted - const https = hosted.https() return this[_cloneRepo](hosted.https({ noCommittish: true }), ref, tmp) .catch(er => { + // Throw early since we know pathspec errors will fail again if retried + if (er instanceof git.errors.GitPathspecError) + throw er const ssh = hosted.sshurl && hosted.sshurl({ noCommittish: true }) // no fallthrough if we can't fall through or have https auth if (!ssh || hosted.auth) diff --git a/node_modules/pacote/package.json b/node_modules/pacote/package.json index 7472c6eeab0cc..437bb8f79e1d8 100644 --- a/node_modules/pacote/package.json +++ b/node_modules/pacote/package.json @@ -1,6 +1,6 @@ { "name": "pacote", - "version": "11.3.4", + "version": "11.3.5", "description": "JavaScript package downloader", "author": "Isaac Z. Schlueter (https://izs.me)", "bin": { @@ -33,7 +33,7 @@ "git" ], "dependencies": { - "@npmcli/git": "^2.0.1", + "@npmcli/git": "^2.1.0", "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", "@npmcli/run-script": "^1.8.2", diff --git a/package-lock.json b/package-lock.json index 9aba845886f26..c73e70292dd36 100644 --- a/package-lock.json +++ b/package-lock.json @@ -134,7 +134,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.3.3", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7", @@ -814,9 +814,9 @@ } }, "node_modules/@npmcli/git": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.9.tgz", - "integrity": "sha512-hTMbMryvOqGLwnmMBKs5usbPsJtyEsMsgXwJbmNrsEuQQh1LAIMDU77IoOrwkCg+NgQWl+ySlarJASwM3SutCA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz", + "integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==", "inBundle": true, "dependencies": { "@npmcli/promise-spawn": "^1.3.2", @@ -5896,12 +5896,12 @@ } }, "node_modules/pacote": { - "version": "11.3.4", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.4.tgz", - "integrity": "sha512-RfahPCunM9GI7ryJV/zY0bWQiokZyLqaSNHXtbNSoLb7bwTvBbJBEyCJ01KWs4j1Gj7GmX8crYXQ1sNX6P2VKA==", + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz", + "integrity": "sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==", "inBundle": true, "dependencies": { - "@npmcli/git": "^2.0.1", + "@npmcli/git": "^2.1.0", "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", "@npmcli/run-script": "^1.8.2", @@ -10936,9 +10936,9 @@ } }, "@npmcli/git": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.0.9.tgz", - "integrity": "sha512-hTMbMryvOqGLwnmMBKs5usbPsJtyEsMsgXwJbmNrsEuQQh1LAIMDU77IoOrwkCg+NgQWl+ySlarJASwM3SutCA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/git/-/git-2.1.0.tgz", + "integrity": "sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==", "requires": { "@npmcli/promise-spawn": "^1.3.2", "lru-cache": "^6.0.0", @@ -14693,11 +14693,11 @@ } }, "pacote": { - "version": "11.3.4", - "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.4.tgz", - "integrity": "sha512-RfahPCunM9GI7ryJV/zY0bWQiokZyLqaSNHXtbNSoLb7bwTvBbJBEyCJ01KWs4j1Gj7GmX8crYXQ1sNX6P2VKA==", + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz", + "integrity": "sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==", "requires": { - "@npmcli/git": "^2.0.1", + "@npmcli/git": "^2.1.0", "@npmcli/installed-package-contents": "^1.0.6", "@npmcli/promise-spawn": "^1.2.0", "@npmcli/run-script": "^1.8.2", diff --git a/package.json b/package.json index fd77e92bf217c..9c9fea9230a05 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "npm-user-validate": "^1.0.1", "npmlog": "~4.1.2", "opener": "^1.5.2", - "pacote": "^11.3.3", + "pacote": "^11.3.5", "parse-conflict-json": "^1.1.1", "qrcode-terminal": "^0.12.0", "read": "~1.0.7",