Skip to content

Commit c0200e2

Browse files
npm-robotdanielleadams
authored andcommitted
deps: upgrade npm to 8.1.3
PR-URL: #40726 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 25a166d commit c0200e2

285 files changed

Lines changed: 12513 additions & 15221 deletions

File tree

Some content is hidden

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

‎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-
<prelang="bash"><code>npm@8.1.2 /path/to/npm
162+
<prelang="bash"><code>npm@8.1.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
<prelang="bash"><code>npm &lt;command&gt; [args]
149149
</code></pre>
150150
<h3id="version">Version</h3>
151-
<p>8.1.2</p>
151+
<p>8.1.3</p>
152152
<h3id="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‎

Lines changed: 2 additions & 3 deletions
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
thrownewError('The programmatic API was removed in npm v8.0.0')
5-
}
Lines changed: 4 additions & 7 deletions
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-
constBaseCommand=require('../base-command.js')
5+
constBaseCommand=require('./base-command.js')
66
classArboristCmdextendsBaseCommand{
77
getisArboristCmd(){
88
returntrue
@@ -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+
asyncexecWorkspaces(args,filters){
21+
awaitthis.setWorkspaces(filters)
22+
returnthis.exec(args)
2623
}
2724
}
2825

‎deps/npm/lib/base-command.js‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Base class for npm.commands[cmd]
1+
// Base class for npmcommands
22
constusageUtil=require('./utils/usage.js')
33
constConfigDefinitions=require('./utils/config/definitions.js')
44
constgetWorkspaces=require('./workspaces/get-workspaces.js')
@@ -53,19 +53,15 @@ class BaseCommand {
5353
returnresults
5454
}
5555

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

68-
execWorkspaces(args,filters,cb){
64+
asyncexecWorkspaces(args,filters){
6965
throwObject.assign(
7066
newError('This command does not support workspaces.'),
7167
{code: 'ENOWORKSPACES'}

‎deps/npm/lib/cli.js‎

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

1919
checkForUnsupportedNode()
2020

21-
constnpm=require('../lib/npm.js')
21+
constNpm=require('../lib/npm.js')
22+
constnpm=newNpm()
2223
constexitHandler=require('../lib/utils/exit-handler.js')
2324
exitHandler.setNpm(npm)
2425

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

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

42+
letcmd
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-
constcmd=npm.argv.shift()
60+
cmd=npm.argv.shift()
5961
if(!cmd){
60-
npm.output(npm.usage)
62+
npm.output(awaitnpm.usage)
6163
process.exitCode=1
6264
returnexitHandler()
6365
}
6466

65-
constimpl=npm.commands[cmd]
66-
if(!impl){
67+
awaitnpm.exec(cmd,npm.argv)
68+
exitHandler()
69+
}catch(err){
70+
if(err.code==='EUNKNOWNCOMMAND'){
6771
constdidYouMean=require('./utils/did-you-mean.js')
6872
constsuggestions=awaitdidYouMean(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
returnexitHandler()
7276
}
73-
74-
impl(npm.argv,exitHandler)
75-
}catch(err){
7677
returnexitHandler(err)
7778
}
7879
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const path = require('path')
33
constlibaccess=require('libnpmaccess')
44
constreadPackageJson=require('read-package-json-fast')
55

6-
constotplease=require('./utils/otplease.js')
7-
constgetIdentity=require('./utils/get-identity.js')
8-
constBaseCommand=require('./base-command.js')
6+
constotplease=require('../utils/otplease.js')
7+
constgetIdentity=require('../utils/get-identity.js')
8+
constBaseCommand=require('../base-command.js')
99

1010
constsubcommands=[
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-
asyncaccess([cmd, ...args]){
79+
asyncexec([cmd, ...args]){
8480
if(!cmd)
8581
throwthis.usageError('Subcommand is required.')
8682

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
constlog=require('npmlog')
2-
constreplaceInfo=require('./utils/replace-info.js')
3-
constBaseCommand=require('./base-command.js')
2+
constreplaceInfo=require('../utils/replace-info.js')
3+
constBaseCommand=require('../base-command.js')
44
constauthTypes={
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
classAddUserextendsBaseCommand{
@@ -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-
asyncadduser(args){
27+
asyncexec(args){
3228
const{ scope }=this.npm.flatOptions
3329
constregistry=this.getRegistry(this.npm.flatOptions)
3430
constauth=this.getAuthType(this.npm.flatOptions)
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
constArborist=require('@npmcli/arborist')
22
constauditReport=require('npm-audit-report')
3-
constreifyFinish=require('./utils/reify-finish.js')
4-
constauditError=require('./utils/audit-error.js')
5-
constArboristWorkspaceCmd=require('./workspaces/arborist-cmd.js')
3+
constreifyFinish=require('../utils/reify-finish.js')
4+
constauditError=require('../utils/audit-error.js')
5+
constArboristWorkspaceCmd=require('../arborist-cmd.js')
66

77
classAuditextendsArboristWorkspaceCmd{
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-
asyncaudit(args){
50+
asyncexec(args){
5551
constreporter=this.npm.config.get('json') ? 'json' : 'detail'
5652
constopts={
5753
...this.npm.flatOptions,
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
constenvPath=require('./utils/path.js')
2-
constBaseCommand=require('./base-command.js')
1+
constenvPath=require('../utils/path.js')
2+
constBaseCommand=require('../base-command.js')
33

44
classBinextendsBaseCommand{
55
staticgetdescription(){
@@ -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-
asyncbin(args){
17+
asyncexec(args){
2218
constb=this.npm.bin
2319
this.npm.output(b)
2420
if(this.npm.config.get('global')&&!envPath.includes(b))

0 commit comments

Comments
 (0)