pacote 13.0.4 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bin.js CHANGED
@@ -110,7 +110,7 @@ const parseArg = arg => {
110
110
  const k = split.shift()
111
111
  const v = split.join('=')
112
112
  const no = /^no-/.test(k) && !v
113
- const key = (no ? k.substr(3) : k)
113
+ const key = (no ? k.slice(3) : k)
114
114
  .replace(/^tag$/, 'defaultTag')
115
115
  .replace(/-([a-z])/g, (_, c) => c.toUpperCase())
116
116
  const value = v ? v.replace(/^~/, process.env.HOME) : !no
package/lib/fetcher.js CHANGED
@@ -105,6 +105,9 @@ class FetcherBase {
105
105
  this[_readPackageJson] = readPackageJsonFast
106
106
  }
107
107
 
108
+ // config values: npmjs (default), never
109
+ this.replaceRegistryHost = opts.replaceRegistryHost === 'never' ? 'never' : 'npmjs'
110
+
108
111
  this.defaultTag = opts.defaultTag || 'latest'
109
112
  this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org')
110
113
 
@@ -325,18 +328,18 @@ class FetcherBase {
325
328
  }
326
329
  return this.resolve().then(() => retry(tryAgain =>
327
330
  streamHandler(this[_istream](this[_tarballFromResolved]()))
328
- .catch(er => {
331
+ .catch(streamErr => {
329
332
  // Most likely data integrity. A cache ENOENT error is unlikely
330
333
  // here, since we're definitely not reading from the cache, but it
331
334
  // IS possible that the fetch subsystem accessed the cache, and the
332
335
  // entry got blown away or something. Try one more time to be sure.
333
- if (this.isRetriableError(er)) {
336
+ if (this.isRetriableError(streamErr)) {
334
337
  log.warn('tarball', `tarball data for ${
335
338
  this.spec
336
339
  } (${this.integrity}) seems to be corrupted. Trying again.`)
337
- return this.cleanupCached().then(() => tryAgain(er))
340
+ return this.cleanupCached().then(() => tryAgain(streamErr))
338
341
  }
339
- throw er
342
+ throw streamErr
340
343
  }), { retries: 1, minTimeout: 0, maxTimeout: 0 }))
341
344
  }
342
345
 
package/lib/remote.js CHANGED
@@ -13,7 +13,9 @@ class RemoteFetcher extends Fetcher {
13
13
  constructor (spec, opts) {
14
14
  super(spec, opts)
15
15
  this.resolved = this.spec.fetchSpec
16
- if (magic.test(this.resolved) && !magic.test(this.registry + '/')) {
16
+ if (this.replaceRegistryHost === 'npmjs'
17
+ && magic.test(this.resolved)
18
+ && !magic.test(this.registry + '/')) {
17
19
  this.resolved = this.resolved.replace(magic, this.registry + '/')
18
20
  }
19
21
 
@@ -2,7 +2,7 @@ const removeTrailingSlashes = (input) => {
2
2
  // in order to avoid regexp redos detection
3
3
  let output = input
4
4
  while (output.endsWith('/')) {
5
- output = output.substr(0, output.length - 1)
5
+ output = output.slice(0, -1)
6
6
  }
7
7
  return output
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacote",
3
- "version": "13.0.4",
3
+ "version": "13.1.0",
4
4
  "description": "JavaScript package downloader",
5
5
  "author": "GitHub Inc.",
6
6
  "bin": {
@@ -14,25 +14,28 @@
14
14
  "preversion": "npm test",
15
15
  "postversion": "npm publish",
16
16
  "prepublishOnly": "git push origin --follow-tags",
17
- "lint": "eslint '**/*.js'",
18
- "postlint": "npm-template-check",
17
+ "lint": "eslint \"**/*.js\"",
18
+ "postlint": "template-oss-check",
19
19
  "lintfix": "npm run lint -- --fix",
20
20
  "posttest": "npm run lint",
21
- "template-copy": "npm-template-copy --force"
21
+ "template-oss-apply": "template-oss-apply --force"
22
22
  },
23
23
  "tap": {
24
24
  "timeout": 300,
25
25
  "coverage-map": "map.js"
26
26
  },
27
27
  "devDependencies": {
28
- "@npmcli/template-oss": "^2.9.2",
28
+ "@npmcli/eslint-config": "^3.0.1",
29
+ "@npmcli/template-oss": "3.2.2",
30
+ "hosted-git-info": "^5.0.0",
29
31
  "mutate-fs": "^2.1.1",
32
+ "nock": "^13.2.4",
30
33
  "npm-registry-mock": "^1.3.1",
31
- "tap": "^15.1.6"
34
+ "tap": "^16.0.1"
32
35
  },
33
36
  "files": [
34
- "bin",
35
- "lib"
37
+ "bin/",
38
+ "lib/"
36
39
  ],
37
40
  "keywords": [
38
41
  "packages",
@@ -42,7 +45,7 @@
42
45
  "dependencies": {
43
46
  "@npmcli/git": "^3.0.0",
44
47
  "@npmcli/installed-package-contents": "^1.0.7",
45
- "@npmcli/promise-spawn": "^1.2.0",
48
+ "@npmcli/promise-spawn": "^3.0.0",
46
49
  "@npmcli/run-script": "^3.0.1",
47
50
  "cacache": "^16.0.0",
48
51
  "chownr": "^2.0.0",
@@ -56,18 +59,22 @@
56
59
  "npm-registry-fetch": "^13.0.1",
57
60
  "proc-log": "^2.0.0",
58
61
  "promise-retry": "^2.0.1",
59
- "read-package-json": "^4.1.2",
62
+ "read-package-json": "^5.0.0",
60
63
  "read-package-json-fast": "^2.0.3",
61
64
  "rimraf": "^3.0.2",
62
- "ssri": "^8.0.1",
65
+ "ssri": "^9.0.0",
63
66
  "tar": "^6.1.11"
64
67
  },
65
68
  "engines": {
66
- "node": "^12.13.0 || ^14.15.0 || >=16"
69
+ "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
70
+ },
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "https://github.com/npm/pacote.git"
67
74
  },
68
- "repository": "git@github.com:npm/pacote",
69
75
  "templateOSS": {
70
- "version": "2.9.2",
76
+ "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
77
+ "version": "3.2.2",
71
78
  "windowsCI": false
72
79
  }
73
80
  }