pacote 13.0.6 → 13.2.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/fetcher.js CHANGED
@@ -105,6 +105,16 @@ class FetcherBase {
105
105
  this[_readPackageJson] = readPackageJsonFast
106
106
  }
107
107
 
108
+ // config values: npmjs (default), never, always
109
+ // we don't want to mutate the original value
110
+ if (opts.replaceRegistryHost !== 'never'
111
+ && opts.replaceRegistryHost !== 'always'
112
+ ) {
113
+ this.replaceRegistryHost = 'npmjs'
114
+ } else {
115
+ this.replaceRegistryHost = opts.replaceRegistryHost
116
+ }
117
+
108
118
  this.defaultTag = opts.defaultTag || 'latest'
109
119
  this.registry = removeTrailingSlashes(opts.registry || 'https://registry.npmjs.org')
110
120
 
package/lib/remote.js CHANGED
@@ -5,7 +5,7 @@ const pacoteVersion = require('../package.json').version
5
5
  const fetch = require('npm-registry-fetch')
6
6
  const Minipass = require('minipass')
7
7
  // The default registry URL is a string of great magic.
8
- const magic = /^https?:\/\/registry\.npmjs\.org\//
8
+ const magicHost = 'https://registry.npmjs.org'
9
9
 
10
10
  const _cacheFetches = Symbol.for('pacote.Fetcher._cacheFetches')
11
11
  const _headers = Symbol('_headers')
@@ -13,8 +13,13 @@ 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 + '/')) {
17
- this.resolved = this.resolved.replace(magic, this.registry + '/')
16
+ const resolvedURL = new URL(this.resolved)
17
+ if (
18
+ (this.replaceRegistryHost === 'npmjs'
19
+ && resolvedURL.origin === magicHost)
20
+ || this.replaceRegistryHost === 'always'
21
+ ) {
22
+ this.resolved = new URL(resolvedURL.pathname, this.registry).href
18
23
  }
19
24
 
20
25
  // nam is a fermented pork sausage that is good to eat
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacote",
3
- "version": "13.0.6",
3
+ "version": "13.2.0",
4
4
  "description": "JavaScript package downloader",
5
5
  "author": "GitHub Inc.",
6
6
  "bin": {
@@ -26,9 +26,10 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@npmcli/eslint-config": "^3.0.1",
29
- "@npmcli/template-oss": "3.2.2",
29
+ "@npmcli/template-oss": "3.4.2",
30
30
  "hosted-git-info": "^5.0.0",
31
31
  "mutate-fs": "^2.1.1",
32
+ "nock": "^13.2.4",
32
33
  "npm-registry-mock": "^1.3.1",
33
34
  "tap": "^16.0.1"
34
35
  },
@@ -53,7 +54,7 @@
53
54
  "minipass": "^3.1.6",
54
55
  "mkdirp": "^1.0.4",
55
56
  "npm-package-arg": "^9.0.0",
56
- "npm-packlist": "^4.0.0",
57
+ "npm-packlist": "^5.0.0",
57
58
  "npm-pick-manifest": "^7.0.0",
58
59
  "npm-registry-fetch": "^13.0.1",
59
60
  "proc-log": "^2.0.0",
@@ -73,7 +74,7 @@
73
74
  },
74
75
  "templateOSS": {
75
76
  "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
76
- "version": "3.2.2",
77
+ "version": "3.4.2",
77
78
  "windowsCI": false
78
79
  }
79
80
  }