deps: upgrade npm to 7.5.3 · nodejs/node@d1c1724 · GitHub
Skip to content

Commit d1c1724

Browse files
ruyadornodanielleadams
authored andcommitted
deps: upgrade npm to 7.5.3
PR-URL: #37283 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6db5e79 commit d1c1724

92 files changed

Lines changed: 3403 additions & 339 deletions

Some content is hidden

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

deps/npm/CHANGELOG.md

Lines changed: 35 additions & 1 deletion

deps/npm/README.md

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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>npm@7.5.2 /path/to/npm
162+
<pre lang="bash"><code>npm@7.5.3 /path/to/npm
163163
└─┬ init-package-json@0.0.4
164164
└── promzard@0.1.5
165165
</code></pre>

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 58 additions & 50 deletions
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 18 additions & 23 deletions

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

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)