Skip to content

Commit d1c1724

Browse files
ruyadornodanielleadams
authored andcommitted
deps: upgrade npm to 7.5.3
PR-URL: #37283 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 6db5e79 commit d1c1724

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3403
-339
lines changed

deps/npm/CHANGELOG.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
1-
## v7.5.2 (2021-02-02
1+
## v7.5.3 (2021-02-08)
2+
3+
### BUG FIXES
4+
5+
* [`df596bf4c`](https://github.com/npm/cli/commit/df596bf4c10d6917672579cc38800f5e846002bc)
6+
fix(publish): follow all configs for registry auth check
7+
[#2602](https://github.com/npm/cli/issues/2602)
8+
([@wraithgar](https://github.com/wraithgar))
9+
* [`6d7afb03c`](https://github.com/npm/cli/commit/6d7afb03cd7602b60e709516711a2f94cd61ff25)
10+
[#2613](https://github.com/npm/cli/issues/2613)
11+
install script: pass -q to curl calls to disable user .curlrc files
12+
([@nlf](https://github.com/nlf))
13+
14+
### DEPENDENCIES
15+
16+
* [`3294fed6f`](https://github.com/npm/cli/commit/3294fed6f18626516978c21fac5f28ecfdb58124)
17+
18+
* prevent infinite recursion in git dep preparation
19+
* [`0f7a3a87c`](https://github.com/npm/cli/commit/0f7a3a87c12e30bdd2cdab596ca6511de787c969)
20+
21+
* avoid duplicating optionalDependencies as dependencies in package.json
22+
* [`6f46b0f7f`](https://github.com/npm/cli/commit/6f46b0f7fef9891e6de4af3547c70a67cb3a7a13)
23+
24+
* [`df4f65acc`](https://github.com/npm/cli/commit/df4f65acc4ceaf15db4c227670e80f94584c055c)
25+
26+
* [`7038c2ff4`](https://github.com/npm/cli/commit/7038c2ff49022f8babd495d1b831b5c82d6aed05)
27+
28+
* [`54cd4c87a`](https://github.com/npm/cli/commit/54cd4c87a71c9381519d8ac52e306096066dc92e)
29+
30+
* [`9ab36aae4`](https://github.com/npm/cli/commit/9ab36aae429784df754211d5f086a515012b9bdd)
31+
32+
* [`e1822cf27`](https://github.com/npm/cli/commit/e1822cf277336728f1d5696ffe0db3ea6e700d9e)
33+
34+
35+
## v7.5.2 (2021-02-02)
236

337
### BUG FIXES
438

deps/npm/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
You can download & install **`npm`** directly from [**npmjs**.com](https://npmjs.com/) using our custom `install.sh` script:
1616

1717
```bash
18-
curl -L https://www.npmjs.com/install.sh | sh
18+
curl -qL https://www.npmjs.com/install.sh | sh
1919
```
2020

2121
#### Node Version Managers
@@ -50,4 +50,4 @@ npm <command>
5050
### Acknowledgments
5151

5252
* `npm` is configured to use the **npm Public Registry** at [https://registry.npmjs.org](https://registry.npmjs.org) by default; Usage of this registry is subject to **Terms of Use** available at [https://npmjs.com/policies/terms](https://npmjs.com/policies/terms)
53-
* You can configure `npm` to use any other compatible registry you prefer. You can read more about configuring third-party registries [here](https://docs.npmjs.com/cli/v7/using-npm/registry)
53+
* You can configure `npm` to use any other compatible registry you prefer. You can read more about configuring third-party registries [here](https://docs.npmjs.com/cli/v7/using-npm/registry)

deps/npm/docs/output/commands/npm-ls.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ <h3 id="description">Description</h3>
159159
the results to only the paths to the packages named. Note that nested
160160
packages will <em>also</em> show the paths to the specified packages. For
161161
example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
162-
<pre lang="bash"><code>[email protected].2 /path/to/npm
162+
<pre lang="bash"><code>[email protected].3 /path/to/npm
163163
164164
165165
</code></pre>

deps/npm/docs/output/commands/npm.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
148148
<pre lang="bash"><code>npm &lt;command&gt; [args]
149149
</code></pre>
150150
<h3 id="version">Version</h3>
151-
<p>7.5.2</p>
151+
<p>7.5.3</p>
152152
<h3 id="description">Description</h3>
153153
<p>npm is the package manager for the Node JavaScript platform. It puts
154154
modules in place so that node can find them, and manages dependency

deps/npm/lib/help.js

+58-50
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ help.completion = function (opts, cb) {
88
}
99

1010
const npmUsage = require('./utils/npm-usage.js')
11-
var path = require('path')
12-
var spawn = require('./utils/spawn')
13-
var npm = require('./npm.js')
14-
var log = require('npmlog')
15-
var openUrl = require('./utils/open-url')
16-
var glob = require('glob')
17-
var output = require('./utils/output.js')
11+
const { spawn } = require('child_process')
12+
const path = require('path')
13+
const npm = require('./npm.js')
14+
const log = require('npmlog')
15+
const openUrl = require('./utils/open-url')
16+
const glob = require('glob')
17+
const output = require('./utils/output.js')
1818

1919
const usage = require('./utils/usage.js')
2020

2121
help.usage = usage('help', 'npm help <term> [<terms..>]')
2222

2323
function help (args, cb) {
24-
var argv = npm.config.parsedArgv.cooked
24+
const argv = npm.config.parsedArgv.cooked
2525

26-
var argnum = 0
26+
let argnum = 0
2727
if (args.length === 2 && ~~args[0])
2828
argnum = ~~args.shift()
2929

@@ -34,7 +34,7 @@ function help (args, cb) {
3434
const affordances = {
3535
'find-dupes': 'dedupe',
3636
}
37-
var section = affordances[args[0]] || npm.deref(args[0]) || args[0]
37+
let section = affordances[args[0]] || npm.deref(args[0]) || args[0]
3838

3939
// npm help <noargs>: show basic usage
4040
if (!section) {
@@ -52,15 +52,12 @@ function help (args, cb) {
5252
return cb()
5353
}
5454

55-
var pref = [1, 5, 7]
56-
if (argnum) {
57-
pref = [argnum].concat(pref.filter(function (n) {
58-
return n !== argnum
59-
}))
60-
}
55+
let pref = [1, 5, 7]
56+
if (argnum)
57+
pref = [argnum].concat(pref.filter(n => n !== argnum))
6158

6259
// npm help <section>: Try to find the path
63-
var manroot = path.resolve(__dirname, '..', 'man')
60+
const manroot = path.resolve(__dirname, '..', 'man')
6461

6562
// legacy
6663
if (section === 'global')
@@ -71,18 +68,18 @@ function help (args, cb) {
7168
// find either /section.n or /npm-section.n
7269
// The glob is used in the glob. The regexp is used much
7370
// further down. Globs and regexps are different
74-
var compextglob = '.+(gz|bz2|lzma|[FYzZ]|xz)'
75-
var compextre = '\\.(gz|bz2|lzma|[FYzZ]|xz)$'
76-
var f = '+(npm-' + section + '|' + section + ').[0-9]?(' + compextglob + ')'
77-
return glob(manroot + '/*/' + f, function (er, mans) {
71+
const compextglob = '.+(gz|bz2|lzma|[FYzZ]|xz)'
72+
const compextre = '\\.(gz|bz2|lzma|[FYzZ]|xz)$'
73+
const f = '+(npm-' + section + '|' + section + ').[0-9]?(' + compextglob + ')'
74+
return glob(manroot + '/*/' + f, (er, mans) => {
7875
if (er)
7976
return cb(er)
8077

8178
if (!mans.length)
8279
return npm.commands['help-search'](args, cb)
8380

84-
mans = mans.map(function (man) {
85-
var ext = path.extname(man)
81+
mans = mans.map((man) => {
82+
const ext = path.extname(man)
8683
if (man.match(new RegExp(compextre)))
8784
man = path.basename(man, ext)
8885

@@ -94,14 +91,12 @@ function help (args, cb) {
9491
}
9592

9693
function pickMan (mans, pref_) {
97-
var nre = /([0-9]+)$/
98-
var pref = {}
99-
pref_.forEach(function (sect, i) {
100-
pref[sect] = i
101-
})
102-
mans = mans.sort(function (a, b) {
103-
var an = a.match(nre)[1]
104-
var bn = b.match(nre)[1]
94+
const nre = /([0-9]+)$/
95+
const pref = {}
96+
pref_.forEach((sect, i) => pref[sect] = i)
97+
mans = mans.sort((a, b) => {
98+
const an = a.match(nre)[1]
99+
const bn = b.match(nre)[1]
105100
return an === bn ? (a > b ? -1 : 1)
106101
: pref[an] < pref[bn] ? -1
107102
: 1
@@ -110,48 +105,61 @@ function pickMan (mans, pref_) {
110105
}
111106

112107
function viewMan (man, cb) {
113-
var nre = /([0-9]+)$/
114-
var num = man.match(nre)[1]
115-
var section = path.basename(man, '.' + num)
108+
const nre = /([0-9]+)$/
109+
const num = man.match(nre)[1]
110+
const section = path.basename(man, '.' + num)
116111

117112
// at this point, we know that the specified man page exists
118-
var manpath = path.join(__dirname, '..', 'man')
119-
var env = {}
113+
const manpath = path.join(__dirname, '..', 'man')
114+
const env = {}
120115
Object.keys(process.env).forEach(function (i) {
121116
env[i] = process.env[i]
122117
})
123118
env.MANPATH = manpath
124-
var viewer = npm.config.get('viewer')
119+
const viewer = npm.config.get('viewer')
120+
121+
const opts = {
122+
env,
123+
stdio: 'inherit',
124+
}
125125

126-
var conf
126+
let bin = 'man'
127+
const args = []
127128
switch (viewer) {
128129
case 'woman':
129-
var a = ['-e', '(woman-find-file \'' + man + '\')']
130-
conf = { env: env, stdio: 'inherit' }
131-
var woman = spawn('emacsclient', a, conf)
132-
woman.on('close', cb)
130+
bin = 'emacsclient'
131+
args.push('-e', `(woman-find-file '${man}')`)
133132
break
134133

135134
case 'browser':
135+
bin = false
136136
try {
137-
var url = htmlMan(man)
137+
const url = htmlMan(man)
138+
openUrl(url, 'help available at the following URL', cb)
138139
} catch (err) {
139140
return cb(err)
140141
}
141-
openUrl(url, 'help available at the following URL', cb)
142142
break
143143

144144
default:
145-
conf = { env: env, stdio: 'inherit' }
146-
var manProcess = spawn('man', [num, section], conf)
147-
manProcess.on('close', cb)
145+
args.push(num, section)
148146
break
149147
}
148+
149+
if (bin) {
150+
const proc = spawn(bin, args, opts)
151+
proc.on('exit', (code) => {
152+
if (code)
153+
return cb(new Error(`help process exited with code: ${code}`))
154+
155+
return cb()
156+
})
157+
}
150158
}
151159

152160
function htmlMan (man) {
153-
var sect = +man.match(/([0-9]+)$/)[1]
154-
var f = path.basename(man).replace(/[.]([0-9]+)$/, '')
161+
let sect = +man.match(/([0-9]+)$/)[1]
162+
const f = path.basename(man).replace(/[.]([0-9]+)$/, '')
155163
switch (sect) {
156164
case 1:
157165
sect = 'commands'
@@ -169,7 +177,7 @@ function htmlMan (man) {
169177
}
170178

171179
function getSections (cb) {
172-
var g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]')
180+
const g = path.resolve(__dirname, '../man/man[0-9]/*.[0-9]')
173181
glob(g, function (er, files) {
174182
if (er)
175183
return cb(er)

deps/npm/lib/ls.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ const getJsonOutputItem = (node, { global, long }) => {
163163
Object.assign(item, packageInfo)
164164
item.extraneous = false
165165
item.path = node.path
166-
item._dependencies = node.package.dependencies || {}
166+
item._dependencies = {
167+
...node.package.dependencies,
168+
...node.package.optionalDependencies,
169+
}
167170
item.devDependencies = node.package.devDependencies || {}
168171
item.peerDependencies = node.package.peerDependencies || {}
169172
}

deps/npm/lib/publish.js

+18-23
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const libpub = require('libnpmpublish').publish
66
const runScript = require('@npmcli/run-script')
77
const pacote = require('pacote')
88
const npa = require('npm-package-arg')
9+
const npmFetch = require('npm-registry-fetch')
910

1011
const npm = require('./npm.js')
1112
const output = require('./utils/output.js')
@@ -71,27 +72,12 @@ const publish_ = async (arg, opts) => {
7172
// you can publish name@version, ./foo.tgz, etc.
7273
// even though the default is the 'file:.' cwd.
7374
const spec = npa(arg)
74-
const manifest = await getManifest(spec, opts)
75+
76+
let manifest = await getManifest(spec, opts)
7577

7678
if (manifest.publishConfig)
7779
Object.assign(opts, publishConfigToOpts(manifest.publishConfig))
7880

79-
const { registry } = opts
80-
if (!registry) {
81-
throw Object.assign(new Error('No registry specified.'), {
82-
code: 'ENOREGISTRY',
83-
})
84-
}
85-
86-
if (!dryRun) {
87-
const creds = npm.config.getCredentialsByURI(registry)
88-
if (!creds.token && !creds.username) {
89-
throw Object.assign(new Error('This command requires you to be logged in.'), {
90-
code: 'ENEEDAUTH',
91-
})
92-
}
93-
}
94-
9581
// only run scripts for directory type publishes
9682
if (spec.type === 'directory') {
9783
await runScript({
@@ -105,18 +91,27 @@ const publish_ = async (arg, opts) => {
10591
const tarballData = await pack(spec, opts)
10692
const pkgContents = await getContents(manifest, tarballData)
10793

94+
// The purpose of re-reading the manifest is in case it changed,
95+
// so that we send the latest and greatest thing to the registry
96+
// note that publishConfig might have changed as well!
97+
manifest = await getManifest(spec, opts)
98+
if (manifest.publishConfig)
99+
Object.assign(opts, publishConfigToOpts(manifest.publishConfig))
100+
108101
// note that logTar calls npmlog.notice(), so if we ARE in silent mode,
109102
// this will do nothing, but we still want it in the debuglog if it fails.
110103
if (!json)
111104
logTar(pkgContents, { log, unicode })
112105

113106
if (!dryRun) {
114-
// The purpose of re-reading the manifest is in case it changed,
115-
// so that we send the latest and greatest thing to the registry
116-
// note that publishConfig might have changed as well!
117-
const manifest = await getManifest(spec, opts)
118-
if (manifest.publishConfig)
119-
Object.assign(opts, publishConfigToOpts(manifest.publishConfig))
107+
const resolved = npa.resolve(manifest.name, manifest.version)
108+
const registry = npmFetch.pickRegistry(resolved, opts)
109+
const creds = npm.config.getCredentialsByURI(registry)
110+
if (!creds.token && !creds.username) {
111+
throw Object.assign(new Error('This command requires you to be logged in.'), {
112+
code: 'ENEEDAUTH',
113+
})
114+
}
120115
await otplease(opts, opts => libpub(manifest, tarballData, opts))
121116
}
122117

deps/npm/lib/utils/no-progress-while-running.js

-25
This file was deleted.

0 commit comments

Comments
 (0)