Skip to content

Commit b578328

Browse files
npm-robotMylesBorins
authored andcommitted
deps: upgrade npm to 8.4.1
PR-URL: #41836 Reviewed-By: Ruy Adorno <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 2b7c4b4 commit b578328

File tree

229 files changed

+3692
-830
lines changed

Some content is hidden

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

229 files changed

+3692
-830
lines changed

deps/npm/docs/content/configuring-npm/package-json.md

+4
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,10 @@ include any versions, as that information is specified in `dependencies`.
838838

839839
If this is spelled `"bundleDependencies"`, then that is also honored.
840840

841+
Alternatively, `"bundledDependencies"` can be defined as a boolean value. A
842+
value of `true` will bundle all dependencies, a value of `false` will bundle
843+
none.
844+
841845
### optionalDependencies
842846

843847
If a dependency can be used, but you would like npm to proceed if it cannot

deps/npm/docs/content/using-npm/config.md

+2
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@ When package package-locks are disabled, automatic pruning of extraneous
11901190
modules will also be disabled. To remove extraneous modules with
11911191
package-locks disabled use `npm prune`.
11921192

1193+
This configuration does not affect `npm ci`.
1194+
11931195
<!-- automatically generated, do not edit manually -->
11941196
<!-- see lib/utils/config/definitions.js -->
11951197

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ <h3 id="description">Description</h3>
160160
the results to only the paths to the packages named. Note that nested
161161
packages will <em>also</em> show the paths to the specified packages. For
162162
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
163-
<pre lang="bash"><code>npm@8.3.2 /path/to/npm
163+
<pre lang="bash"><code>npm@8.4.1 /path/to/npm
164164
165165
166166
</code></pre>

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

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

deps/npm/docs/output/configuring-npm/package-json.html

+3
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,9 @@ <h3 id="bundleddependencies">bundledDependencies</h3>
774774
can be installed in a new project by executing <code>npm install awesome-web-framework-1.0.0.tgz</code>. Note that the package names do not
775775
include any versions, as that information is specified in <code>dependencies</code>.</p>
776776
<p>If this is spelled <code>"bundleDependencies"</code>, then that is also honored.</p>
777+
<p>Alternatively, <code>"bundledDependencies"</code> can be defined as a boolean value. A
778+
value of <code>true</code> will bundle all dependencies, a value of <code>false</code> will bundle
779+
none.</p>
777780
<h3 id="optionaldependencies">optionalDependencies</h3>
778781
<p>If a dependency can be used, but you would like npm to proceed if it cannot
779782
be found or fails to install, then you may put it in the

deps/npm/docs/output/using-npm/config.html

+1
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,7 @@ <h4 id="package-lock"><code>package-lock</code></h4>
11001100
<p>When package package-locks are disabled, automatic pruning of extraneous
11011101
modules will also be disabled. To remove extraneous modules with
11021102
package-locks disabled use <code>npm prune</code>.</p>
1103+
<p>This configuration does not affect <code>npm ci</code>.</p>
11031104
<!-- raw HTML omitted -->
11041105
<!-- raw HTML omitted -->
11051106
<h4 id="package-lock-only"><code>package-lock-only</code></h4>

deps/npm/lib/commands/access.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const path = require('path')
33
const libaccess = require('libnpmaccess')
44
const readPackageJson = require('read-package-json-fast')
55

6+
const log = require('../utils/log-shim.js')
67
const otplease = require('../utils/otplease.js')
78
const getIdentity = require('../utils/get-identity.js')
89
const BaseCommand = require('../base-command.js')
@@ -76,7 +77,10 @@ class Access extends BaseCommand {
7677
throw this.usageError(`${cmd} is not a recognized subcommand.`)
7778
}
7879

79-
return this[cmd](args, this.npm.flatOptions)
80+
return this[cmd](args, {
81+
...this.npm.flatOptions,
82+
log,
83+
})
8084
}
8185

8286
public ([pkg], opts) {

deps/npm/lib/commands/ci.js

+24
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const runScript = require('@npmcli/run-script')
66
const fs = require('fs')
77
const readdir = util.promisify(fs.readdir)
88
const log = require('../utils/log-shim.js')
9+
const validateLockfile = require('../utils/validate-lockfile.js')
910

1011
const removeNodeModules = async where => {
1112
const rimrafOpts = { glob: false }
@@ -37,6 +38,7 @@ class CI extends ArboristWorkspaceCmd {
3738
const where = this.npm.prefix
3839
const opts = {
3940
...this.npm.flatOptions,
41+
packageLock: true, // npm ci should never skip lock files
4042
path: where,
4143
log,
4244
save: false, // npm ci should never modify the lockfile or package.json
@@ -55,6 +57,28 @@ class CI extends ArboristWorkspaceCmd {
5557
}),
5658
removeNodeModules(where),
5759
])
60+
61+
// retrieves inventory of packages from loaded virtual tree (lock file)
62+
const virtualInventory = new Map(arb.virtualTree.inventory)
63+
64+
// build ideal tree step needs to come right after retrieving the virtual
65+
// inventory since it's going to erase the previous ref to virtualTree
66+
await arb.buildIdealTree()
67+
68+
// verifies that the packages from the ideal tree will match
69+
// the same versions that are present in the virtual tree (lock file)
70+
// throws a validation error in case of mismatches
71+
const errors = validateLockfile(virtualInventory, arb.idealTree.inventory)
72+
if (errors.length) {
73+
throw new Error(
74+
'`npm ci` can only install packages when your package.json and ' +
75+
'package-lock.json or npm-shrinkwrap.json are in sync. Please ' +
76+
'update your lock file with `npm install` ' +
77+
'before continuing.\n\n' +
78+
errors.join('\n') + '\n'
79+
)
80+
}
81+
5882
await arb.reify(opts)
5983

6084
const ignoreScripts = this.npm.config.get('ignore-scripts')

deps/npm/lib/commands/deprecate.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const fetch = require('npm-registry-fetch')
2+
const log = require('../utils/log-shim.js')
23
const otplease = require('../utils/otplease.js')
34
const npa = require('npm-package-arg')
45
const semver = require('semver')
@@ -50,6 +51,7 @@ class Deprecate extends BaseCommand {
5051
...this.npm.flatOptions,
5152
spec: p,
5253
query: { write: true },
54+
log,
5355
})
5456

5557
Object.keys(packument.versions)
@@ -64,6 +66,7 @@ class Deprecate extends BaseCommand {
6466
method: 'PUT',
6567
body: packument,
6668
ignoreBody: true,
69+
log,
6770
}))
6871
}
6972
}

deps/npm/lib/commands/diff.js

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class Diff extends BaseCommand {
6161
...this.npm.flatOptions,
6262
diffFiles: args,
6363
where: this.top,
64+
log,
6465
})
6566
return this.npm.output(res)
6667
}
@@ -193,6 +194,7 @@ class Diff extends BaseCommand {
193194
const packument = await pacote.packument(spec, {
194195
...this.npm.flatOptions,
195196
preferOnline: true,
197+
log,
196198
})
197199
bSpec = pickManifest(
198200
packument,

deps/npm/lib/commands/dist-tag.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class DistTag extends BaseCommand {
2929
}
3030

3131
async exec ([cmdName, pkg, tag]) {
32-
const opts = this.npm.flatOptions
32+
const opts = {
33+
...this.npm.flatOptions,
34+
log,
35+
}
3336

3437
if (['add', 'a', 'set', 's'].includes(cmdName)) {
3538
return this.add(pkg, tag, opts)

deps/npm/lib/commands/hook.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const hookApi = require('libnpmhook')
22
const otplease = require('../utils/otplease.js')
33
const relativeDate = require('tiny-relative-date')
44
const Table = require('cli-table3')
5+
const log = require('../utils/log-shim.js')
56

67
const BaseCommand = require('../base-command.js')
78
class Hook extends BaseCommand {
@@ -20,7 +21,10 @@ class Hook extends BaseCommand {
2021
]
2122

2223
async exec (args) {
23-
return otplease(this.npm.flatOptions, (opts) => {
24+
return otplease({
25+
...this.npm.flatOptions,
26+
log,
27+
}, (opts) => {
2428
switch (args[0]) {
2529
case 'add':
2630
return this.add(args[1], args[2], args[3], opts)

deps/npm/lib/commands/logout.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const getAuth = require('npm-registry-fetch/auth.js')
1+
const getAuth = require('npm-registry-fetch/lib/auth.js')
22
const npmFetch = require('npm-registry-fetch')
33
const log = require('../utils/log-shim')
44
const BaseCommand = require('../base-command.js')
@@ -25,6 +25,7 @@ class Logout extends BaseCommand {
2525
...this.npm.flatOptions,
2626
method: 'DELETE',
2727
ignoreBody: true,
28+
log,
2829
})
2930
} else if (auth.isBasicAuth) {
3031
log.verbose('logout', `clearing user credentials for ${reg}`)

deps/npm/lib/commands/outdated.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ class Outdated extends ArboristWorkspaceCmd {
193193
}
194194

195195
async getOutdatedInfo (edge) {
196-
const spec = npa(edge.name)
196+
let alias = false
197+
try {
198+
alias = npa(edge.spec).subSpec
199+
} catch (err) {
200+
}
201+
const spec = npa(alias ? alias.name : edge.name)
197202
const node = edge.to || edge
198203
const { path, location } = node
199204
const { version: current } = node.package || {}
@@ -217,7 +222,7 @@ class Outdated extends ArboristWorkspaceCmd {
217222

218223
try {
219224
const packument = await this.getPackument(spec)
220-
const expected = edge.spec
225+
const expected = alias ? alias.fetchSpec : edge.spec
221226
// if it's not a range, version, or tag, skip it
222227
try {
223228
if (!npa(`${edge.name}@${edge.spec}`).registry) {
@@ -239,7 +244,7 @@ class Outdated extends ArboristWorkspaceCmd {
239244
: 'global'
240245

241246
this.list.push({
242-
name: edge.name,
247+
name: alias ? edge.spec.replace('npm', edge.name) : edge.name,
243248
path,
244249
type,
245250
current,

deps/npm/lib/commands/owner.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ class Owner extends BaseCommand {
5757
}
5858

5959
async exec ([action, ...args]) {
60-
const opts = this.npm.flatOptions
60+
const opts = {
61+
...this.npm.flatOptions,
62+
log,
63+
}
6164
switch (action) {
6265
case 'ls':
6366
case 'list':
@@ -195,6 +198,7 @@ class Owner extends BaseCommand {
195198
method: 'PUT',
196199
body,
197200
spec,
201+
log,
198202
})
199203
})
200204

deps/npm/lib/commands/ping.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Ping extends BaseCommand {
1010
async exec (args) {
1111
log.notice('PING', this.npm.config.get('registry'))
1212
const start = Date.now()
13-
const details = await pingUtil(this.npm.flatOptions)
13+
const details = await pingUtil({ ...this.npm.flatOptions, log })
1414
const time = Date.now() - start
1515
log.notice('PONG', `${time}ms`)
1616
if (this.npm.config.get('json')) {

deps/npm/lib/commands/profile.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Profile extends BaseCommand {
108108
async get (args) {
109109
const tfa = 'two-factor auth'
110110
const info = await pulseTillDone.withPromise(
111-
npmProfile.get(this.npm.flatOptions)
111+
npmProfile.get({ ...this.npm.flatOptions, log })
112112
)
113113

114114
if (!info.cidr_whitelist) {
@@ -170,7 +170,7 @@ class Profile extends BaseCommand {
170170
}
171171

172172
async set (args) {
173-
const conf = this.npm.flatOptions
173+
const conf = { ...this.npm.flatOptions, log }
174174
const prop = (args[0] || '').toLowerCase().trim()
175175

176176
let value = args.length > 1 ? args.slice(1).join(' ') : null
@@ -285,7 +285,7 @@ class Profile extends BaseCommand {
285285
if (auth.basic) {
286286
log.info('profile', 'Updating authentication to bearer token')
287287
const result = await npmProfile.createToken(
288-
auth.basic.password, false, [], this.npm.flatOptions
288+
auth.basic.password, false, [], { ...this.npm.flatOptions, log }
289289
)
290290

291291
if (!result.token) {
@@ -309,7 +309,7 @@ class Profile extends BaseCommand {
309309

310310
log.info('profile', 'Determine if tfa is pending')
311311
const userInfo = await pulseTillDone.withPromise(
312-
npmProfile.get(this.npm.flatOptions)
312+
npmProfile.get({ ...this.npm.flatOptions, log })
313313
)
314314

315315
const conf = { ...this.npm.flatOptions }

deps/npm/lib/commands/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Publish extends BaseCommand {
6161
throw new Error('Tag name must not be a valid SemVer range: ' + defaultTag.trim())
6262
}
6363

64-
const opts = { ...this.npm.flatOptions }
64+
const opts = { ...this.npm.flatOptions, log }
6565

6666
// you can publish name@version, ./foo.tgz, etc.
6767
// even though the default is the 'file:.' cwd.

deps/npm/lib/commands/star.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ class Star extends BaseCommand {
2929
const pkgs = args.map(npa)
3030
for (const pkg of pkgs) {
3131
const [username, fullData] = await Promise.all([
32-
getIdentity(this.npm, this.npm.flatOptions),
32+
getIdentity(this.npm, { ...this.npm.flatOptions, log }),
3333
fetch.json(pkg.escapedName, {
3434
...this.npm.flatOptions,
3535
spec: pkg,
3636
query: { write: true },
3737
preferOnline: true,
38+
log,
3839
}),
3940
])
4041

@@ -63,6 +64,7 @@ class Star extends BaseCommand {
6364
spec: pkg,
6465
method: 'PUT',
6566
body,
67+
log,
6668
})
6769

6870
this.npm.output(show + ' ' + pkg.name)

deps/npm/lib/commands/team.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const columns = require('cli-columns')
22
const libteam = require('libnpmteam')
33

4+
const log = require('../utils/log-shim.js')
45
const otplease = require('../utils/otplease.js')
56

67
const BaseCommand = require('../base-command.js')
@@ -42,7 +43,7 @@ class Team extends BaseCommand {
4243
// XXX: "description" option to libnpmteam is used as a description of the
4344
// team, but in npm's options, this is a boolean meaning "show the
4445
// description in npm search output". Hence its being set to null here.
45-
await otplease(this.npm.flatOptions, opts => {
46+
await otplease({ ...this.npm.flatOptions, log }, opts => {
4647
entity = entity.replace(/^@/, '')
4748
switch (cmd) {
4849
case 'create': return this.create(entity, opts)

deps/npm/lib/commands/token.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Token extends BaseCommand {
168168
}
169169

170170
config () {
171-
const conf = { ...this.npm.flatOptions }
171+
const conf = { ...this.npm.flatOptions, log }
172172
const creds = this.npm.config.getCredentialsByURI(conf.registry)
173173
if (creds.token) {
174174
conf.auth = { token: creds.token }

deps/npm/lib/commands/unpublish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Unpublish extends BaseCommand {
3232
return []
3333
}
3434

35-
const opts = this.npm.flatOptions
35+
const opts = { ...this.npm.flatOptions, log }
3636
const username = await getIdentity(this.npm, { ...opts }).catch(() => null)
3737
if (!username) {
3838
return []

deps/npm/lib/commands/whoami.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const getIdentity = require('../utils/get-identity.js')
2+
const log = require('../utils/log-shim.js')
23

34
const BaseCommand = require('../base-command.js')
45
class Whoami extends BaseCommand {
@@ -7,7 +8,7 @@ class Whoami extends BaseCommand {
78
static params = ['registry']
89

910
async exec (args) {
10-
const username = await getIdentity(this.npm, this.npm.flatOptions)
11+
const username = await getIdentity(this.npm, { ...this.npm.flatOptions, log })
1112
this.npm.output(
1213
this.npm.config.get('json') ? JSON.stringify(username) : username
1314
)

deps/npm/lib/utils/config/definitions.js

+2
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ define('package-lock', {
14171417
When package package-locks are disabled, automatic pruning of extraneous
14181418
modules will also be disabled. To remove extraneous modules with
14191419
package-locks disabled use \`npm prune\`.
1420+
1421+
This configuration does not affect \`npm ci\`.
14201422
`,
14211423
flatten: (key, obj, flatOptions) => {
14221424
flatten(key, obj, flatOptions)

0 commit comments

Comments
 (0)