Skip to content

Commit 9711ccf

Browse files
npm-robottargos
authored andcommitted
deps: upgrade npm to 8.1.3
PR-URL: #40726 Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Voltrex <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 3d89623 commit 9711ccf

File tree

285 files changed

+12513
-15221
lines changed

Some content is hidden

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

285 files changed

+12513
-15221
lines changed

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>8.1.2</p>
151+
<p>8.1.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/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
if (require.main === module) {
1+
if (require.main === module)
22
require('./lib/cli.js')(process)
3-
} else {
3+
else
44
throw new Error('The programmatic API was removed in npm v8.0.0')
5-
}

deps/npm/lib/workspaces/arborist-cmd.js deps/npm/lib/arborist-cmd.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// a list of workspace names and passes it on to new Arborist() to
33
// be able to run a filtered Arborist.reify() at some point.
44

5-
const BaseCommand = require('../base-command.js')
5+
const BaseCommand = require('./base-command.js')
66
class ArboristCmd extends BaseCommand {
77
get isArboristCmd () {
88
return true
@@ -17,12 +17,9 @@ class ArboristCmd extends BaseCommand {
1717
]
1818
}
1919

20-
execWorkspaces (args, filters, cb) {
21-
this.setWorkspaces(filters, true)
22-
.then(() => {
23-
this.exec(args, cb)
24-
})
25-
.catch(er => cb(er))
20+
async execWorkspaces (args, filters) {
21+
await this.setWorkspaces(filters)
22+
return this.exec(args)
2623
}
2724
}
2825

deps/npm/lib/base-command.js

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Base class for npm.commands[cmd]
1+
// Base class for npm commands
22
const usageUtil = require('./utils/usage.js')
33
const ConfigDefinitions = require('./utils/config/definitions.js')
44
const getWorkspaces = require('./workspaces/get-workspaces.js')
@@ -53,19 +53,15 @@ class BaseCommand {
5353
return results
5454
}
5555

56-
usageError (msg) {
57-
if (!msg) {
58-
return Object.assign(new Error(`\nUsage: ${this.usage}`), {
59-
code: 'EUSAGE',
60-
})
61-
}
62-
63-
return Object.assign(new Error(`\nUsage: ${msg}\n\n${this.usage}`), {
56+
usageError (prefix = '') {
57+
if (prefix)
58+
prefix += '\n\n'
59+
return Object.assign(new Error(`\nUsage: ${prefix}${this.usage}`), {
6460
code: 'EUSAGE',
6561
})
6662
}
6763

68-
execWorkspaces (args, filters, cb) {
64+
async execWorkspaces (args, filters) {
6965
throw Object.assign(
7066
new Error('This command does not support workspaces.'),
7167
{ code: 'ENOWORKSPACES' }

deps/npm/lib/cli.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = async (process) => {
1818

1919
checkForUnsupportedNode()
2020

21-
const npm = require('../lib/npm.js')
21+
const Npm = require('../lib/npm.js')
22+
const npm = new Npm()
2223
const exitHandler = require('../lib/utils/exit-handler.js')
2324
exitHandler.setNpm(npm)
2425

@@ -38,6 +39,7 @@ module.exports = async (process) => {
3839

3940
const updateNotifier = require('../lib/utils/update-notifier.js')
4041

42+
let cmd
4143
// now actually fire up npm and run the command.
4244
// this is how to use npm programmatically:
4345
try {
@@ -55,24 +57,23 @@ module.exports = async (process) => {
5557

5658
updateNotifier(npm)
5759

58-
const cmd = npm.argv.shift()
60+
cmd = npm.argv.shift()
5961
if (!cmd) {
60-
npm.output(npm.usage)
62+
npm.output(await npm.usage)
6163
process.exitCode = 1
6264
return exitHandler()
6365
}
6466

65-
const impl = npm.commands[cmd]
66-
if (!impl) {
67+
await npm.exec(cmd, npm.argv)
68+
exitHandler()
69+
} catch (err) {
70+
if (err.code === 'EUNKNOWNCOMMAND') {
6771
const didYouMean = require('./utils/did-you-mean.js')
6872
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
6973
npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`)
7074
process.exitCode = 1
7175
return exitHandler()
7276
}
73-
74-
impl(npm.argv, exitHandler)
75-
} catch (err) {
7677
return exitHandler(err)
7778
}
7879
}

deps/npm/lib/access.js deps/npm/lib/commands/access.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const path = require('path')
33
const libaccess = require('libnpmaccess')
44
const readPackageJson = require('read-package-json-fast')
55

6-
const otplease = require('./utils/otplease.js')
7-
const getIdentity = require('./utils/get-identity.js')
8-
const BaseCommand = require('./base-command.js')
6+
const otplease = require('../utils/otplease.js')
7+
const getIdentity = require('../utils/get-identity.js')
8+
const BaseCommand = require('../base-command.js')
99

1010
const subcommands = [
1111
'public',
@@ -76,11 +76,7 @@ class Access extends BaseCommand {
7676
}
7777
}
7878

79-
exec (args, cb) {
80-
this.access(args).then(() => cb()).catch(cb)
81-
}
82-
83-
async access ([cmd, ...args]) {
79+
async exec ([cmd, ...args]) {
8480
if (!cmd)
8581
throw this.usageError('Subcommand is required.')
8682

deps/npm/lib/adduser.js deps/npm/lib/commands/adduser.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const log = require('npmlog')
2-
const replaceInfo = require('./utils/replace-info.js')
3-
const BaseCommand = require('./base-command.js')
2+
const replaceInfo = require('../utils/replace-info.js')
3+
const BaseCommand = require('../base-command.js')
44
const authTypes = {
5-
legacy: require('./auth/legacy.js'),
6-
oauth: require('./auth/oauth.js'),
7-
saml: require('./auth/saml.js'),
8-
sso: require('./auth/sso.js'),
5+
legacy: require('../auth/legacy.js'),
6+
oauth: require('../auth/oauth.js'),
7+
saml: require('../auth/saml.js'),
8+
sso: require('../auth/sso.js'),
99
}
1010

1111
class AddUser extends BaseCommand {
@@ -24,11 +24,7 @@ class AddUser extends BaseCommand {
2424
]
2525
}
2626

27-
exec (args, cb) {
28-
this.adduser(args).then(() => cb()).catch(cb)
29-
}
30-
31-
async adduser (args) {
27+
async exec (args) {
3228
const { scope } = this.npm.flatOptions
3329
const registry = this.getRegistry(this.npm.flatOptions)
3430
const auth = this.getAuthType(this.npm.flatOptions)

deps/npm/lib/audit.js deps/npm/lib/commands/audit.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const Arborist = require('@npmcli/arborist')
22
const auditReport = require('npm-audit-report')
3-
const reifyFinish = require('./utils/reify-finish.js')
4-
const auditError = require('./utils/audit-error.js')
5-
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
3+
const reifyFinish = require('../utils/reify-finish.js')
4+
const auditError = require('../utils/audit-error.js')
5+
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
66

77
class Audit extends ArboristWorkspaceCmd {
88
/* istanbul ignore next - see test/lib/load-all-commands.js */
@@ -47,11 +47,7 @@ class Audit extends ArboristWorkspaceCmd {
4747
}
4848
}
4949

50-
exec (args, cb) {
51-
this.audit(args).then(() => cb()).catch(cb)
52-
}
53-
54-
async audit (args) {
50+
async exec (args) {
5551
const reporter = this.npm.config.get('json') ? 'json' : 'detail'
5652
const opts = {
5753
...this.npm.flatOptions,

deps/npm/lib/bin.js deps/npm/lib/commands/bin.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const envPath = require('./utils/path.js')
2-
const BaseCommand = require('./base-command.js')
1+
const envPath = require('../utils/path.js')
2+
const BaseCommand = require('../base-command.js')
33

44
class Bin extends BaseCommand {
55
static get description () {
@@ -14,11 +14,7 @@ class Bin extends BaseCommand {
1414
return ['global']
1515
}
1616

17-
exec (args, cb) {
18-
this.bin(args).then(() => cb()).catch(cb)
19-
}
20-
21-
async bin (args) {
17+
async exec (args) {
2218
const b = this.npm.bin
2319
this.npm.output(b)
2420
if (this.npm.config.get('global') && !envPath.includes(b))

deps/npm/lib/birthday.js deps/npm/lib/commands/birthday.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const BaseCommand = require('./base-command.js')
1+
const BaseCommand = require('../base-command.js')
22

33
class Birthday extends BaseCommand {
4-
exec (args, cb) {
4+
async exec () {
55
this.npm.config.set('package', ['@npmcli/npm-birthday'])
66
this.npm.config.set('yes', true)
7-
return this.npm.commands.exec(['npm-birthday'], cb)
7+
const exec = await this.npm.cmd('exec')
8+
return exec.exec(['npm-birthday'])
89
}
910
}
1011

deps/npm/lib/bugs.js deps/npm/lib/commands/bugs.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const log = require('npmlog')
22
const pacote = require('pacote')
3-
const openUrl = require('./utils/open-url.js')
4-
const hostedFromMani = require('./utils/hosted-git-info-from-manifest.js')
5-
const BaseCommand = require('./base-command.js')
3+
const openUrl = require('../utils/open-url.js')
4+
const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
5+
const BaseCommand = require('../base-command.js')
66

77
class Bugs extends BaseCommand {
88
static get description () {
@@ -22,11 +22,7 @@ class Bugs extends BaseCommand {
2222
return ['browser', 'registry']
2323
}
2424

25-
exec (args, cb) {
26-
this.bugs(args).then(() => cb()).catch(cb)
27-
}
28-
29-
async bugs (args) {
25+
async exec (args) {
3026
if (!args || !args.length)
3127
args = ['.']
3228

deps/npm/lib/cache.js deps/npm/lib/commands/cache.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const pacote = require('pacote')
55
const path = require('path')
66
const rimraf = promisify(require('rimraf'))
77
const semver = require('semver')
8-
const BaseCommand = require('./base-command.js')
8+
const BaseCommand = require('../base-command.js')
99
const npa = require('npm-package-arg')
1010
const jsonParse = require('json-parse-even-better-errors')
1111
const localeCompare = require('@isaacs/string-locale-compare')('en')
@@ -104,11 +104,7 @@ class Cache extends BaseCommand {
104104
}
105105
}
106106

107-
exec (args, cb) {
108-
this.cache(args).then(() => cb()).catch(cb)
109-
}
110-
111-
async cache (args) {
107+
async exec (args) {
112108
const cmd = args.shift()
113109
switch (cmd) {
114110
case 'rm': case 'clear': case 'clean':
@@ -120,7 +116,7 @@ class Cache extends BaseCommand {
120116
case 'ls':
121117
return await this.ls(args)
122118
default:
123-
throw Object.assign(new Error(this.usage), { code: 'EUSAGE' })
119+
throw this.usageError()
124120
}
125121
}
126122

@@ -165,14 +161,9 @@ class Cache extends BaseCommand {
165161
// npm cache add <tarball>...
166162
// npm cache add <folder>...
167163
async add (args) {
168-
const usage = 'Usage:\n' +
169-
' npm cache add <tarball-url>...\n' +
170-
' npm cache add <pkg>@<ver>...\n' +
171-
' npm cache add <tarball>...\n' +
172-
' npm cache add <folder>...\n'
173164
log.silly('cache add', 'args', args)
174165
if (args.length === 0)
175-
throw Object.assign(new Error(usage), { code: 'EUSAGE' })
166+
throw this.usageError('First argument to `add` is required')
176167

177168
return Promise.all(args.map(spec => {
178169
log.silly('cache add', 'spec', spec)

deps/npm/lib/ci.js deps/npm/lib/commands/ci.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const util = require('util')
22
const Arborist = require('@npmcli/arborist')
33
const rimraf = util.promisify(require('rimraf'))
4-
const reifyFinish = require('./utils/reify-finish.js')
4+
const reifyFinish = require('../utils/reify-finish.js')
55
const runScript = require('@npmcli/run-script')
66
const fs = require('fs')
77
const readdir = util.promisify(fs.readdir)
@@ -17,7 +17,7 @@ const removeNodeModules = async where => {
1717
await Promise.all(entries.map(f => rimraf(`${path}/${f}`, rimrafOpts)))
1818
process.emit('timeEnd', 'npm-ci:rm')
1919
}
20-
const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
20+
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
2121

2222
class CI extends ArboristWorkspaceCmd {
2323
/* istanbul ignore next - see test/lib/load-all-commands.js */
@@ -39,11 +39,7 @@ class CI extends ArboristWorkspaceCmd {
3939
]
4040
}
4141

42-
exec (args, cb) {
43-
this.ci().then(() => cb()).catch(cb)
44-
}
45-
46-
async ci () {
42+
async exec () {
4743
if (this.npm.config.get('global')) {
4844
const err = new Error('`npm ci` does not work for global packages')
4945
err.code = 'ECIGLOBAL'

0 commit comments

Comments
 (0)