Skip to content

Commit 4b09222

Browse files
npm-cli-botRafaelGSS
authored andcommitted
deps: upgrade npm to 9.6.3
PR-URL: #47325 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luke Karrys <luke@lukekarrys.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1c21fbf commit 4b09222

File tree

321 files changed

+12274
-15792
lines changed

Some content is hidden

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

321 files changed

+12274
-15792
lines changed

deps/npm/README.md

+1-11
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,7 @@ curl -qL https://www.npmjs.com/install.sh | sh
2727

2828
#### Node Version Managers
2929

30-
If you're looking to manage multiple versions of **`node`** &/or **`npm`**, consider using a "Node Version Manager" such as:
31-
32-
* [**`nvm`**](https://github.com/nvm-sh/nvm)
33-
* [**`nvs`**](https://github.com/jasongin/nvs)
34-
* [**`nave`**](https://github.com/isaacs/nave)
35-
* [**`n`**](https://github.com/tj/n)
36-
* [**`volta`**](https://github.com/volta-cli/volta)
37-
* [**`nodenv`**](https://github.com/nodenv/nodenv)
38-
* [**`asdf-nodejs`**](https://github.com/asdf-vm/asdf-nodejs)
39-
* [**`nvm-windows`**](https://github.com/coreybutler/nvm-windows)
40-
* [**`fnm`**](https://github.com/Schniz/fnm)
30+
If you're looking to manage multiple versions of **`Node.js`** &/or **`npm`**, consider using a [node version manager](https://github.com/search?q=node%20version%20manager&type=repositories)
4131

4232
### Usage
4333

deps/npm/docs/content/commands/npm-ls.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
2727
example, running `npm ls promzard` in npm's source tree will show:
2828

2929
```bash
30-
npm@9.6.2 /path/to/npm
30+
npm@9.6.3 /path/to/npm
3131
└─┬ init-package-json@0.0.4
3232
└── promzard@0.1.5
3333
```

deps/npm/docs/content/commands/npm-prefix.md

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ folder instead of the current working directory. See
5252
### See Also
5353

5454
* [npm root](/commands/npm-root)
55-
* [npm bin](/commands/npm-bin)
5655
* [npm folders](/configuring-npm/folders)
5756
* [npm config](/commands/npm-config)
5857
* [npmrc](/configuring-npm/npmrc)

deps/npm/docs/content/commands/npm-root.md

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ folder instead of the current working directory. See
4444
### See Also
4545

4646
* [npm prefix](/commands/npm-prefix)
47-
* [npm bin](/commands/npm-bin)
4847
* [npm folders](/configuring-npm/folders)
4948
* [npm config](/commands/npm-config)
5049
* [npmrc](/configuring-npm/npmrc)

deps/npm/docs/content/commands/npm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.
1414

1515
### Version
1616

17-
9.6.2
17+
9.6.3
1818

1919
### Description
2020

deps/npm/docs/content/configuring-npm/install.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,8 @@ npm -v
3838
Node version managers allow you to install and switch between multiple
3939
versions of Node.js and npm on your system so you can test your
4040
applications on multiple versions of npm to ensure they work for users on
41-
different versions.
42-
43-
#### OSX or Linux Node version managers
44-
45-
* [nvm](https://github.com/creationix/nvm)
46-
* [n](https://github.com/tj/n)
47-
48-
#### Windows Node version managers
49-
50-
* [nodist](https://github.com/marcelklehr/nodist)
51-
* [nvm-windows](https://github.com/coreybutler/nvm-windows)
41+
different versions. You can
42+
[search for them on GitHub](https://github.com/search?q=node%20version%20manager&type=repositories).
5243

5344
### Using a Node installer to install Node.js and npm
5445

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><code class="language-bash">npm@9.6.2 /path/to/npm
163+
<pre><code class="language-bash">npm@9.6.3 /path/to/npm
164164
└─┬ init-package-json@0.0.4
165165
└── promzard@0.1.5
166166
</code></pre>

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

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ <h4 id="global"><code>global</code></h4>
180180
<h3 id="see-also">See Also</h3>
181181
<ul>
182182
<li><a href="../commands/npm-root.html">npm root</a></li>
183-
<li><a href="../commands/npm-bin.html">npm bin</a></li>
184183
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
185184
<li><a href="../commands/npm-config.html">npm config</a></li>
186185
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>

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

-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ <h4 id="global"><code>global</code></h4>
175175
<h3 id="see-also">See Also</h3>
176176
<ul>
177177
<li><a href="../commands/npm-prefix.html">npm prefix</a></li>
178-
<li><a href="../commands/npm-bin.html">npm bin</a></li>
179178
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
180179
<li><a href="../commands/npm-config.html">npm config</a></li>
181180
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ <h2 id="table-of-contents">Table of contents</h2>
150150
</code></pre>
151151
<p>Note: This command is unaware of workspaces.</p>
152152
<h3 id="version">Version</h3>
153-
<p>9.6.2</p>
153+
<p>9.6.3</p>
154154
<h3 id="description">Description</h3>
155155
<p>npm is the package manager for the Node JavaScript platform. It puts
156156
modules in place so that node can find them, and manages dependency

deps/npm/docs/output/configuring-npm/install.html

+3-12
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ <h1 id="install">install</h1>
142142

143143
<section id="table_of_contents">
144144
<h2 id="table-of-contents">Table of contents</h2>
145-
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#overview">Overview</a></li><li><a href="#checking-your-version-of-npm-and-nodejs">Checking your version of npm and Node.js</a></li><li><a href="#using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node version manager to install Node.js and npm</a></li><ul><li><a href="#osx-or-linux-node-version-managers">OSX or Linux Node version managers</a></li><li><a href="#windows-node-version-managers">Windows Node version managers</a></li></ul><li><a href="#using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</a></li><ul><li><a href="#os-x-or-windows-node-installers">OS X or Windows Node installers</a></li><li><a href="#linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</a></li><li><a href="#less-common-operating-systems">Less-common operating systems</a></li></ul></ul></div>
145+
<div id="_table_of_contents"><ul><li><a href="#description">Description</a></li><li><a href="#overview">Overview</a></li><li><a href="#checking-your-version-of-npm-and-nodejs">Checking your version of npm and Node.js</a></li><li><a href="#using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node version manager to install Node.js and npm</a></li><li><a href="#using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</a></li><ul><li><a href="#os-x-or-windows-node-installers">OS X or Windows Node installers</a></li><li><a href="#linux-or-other-operating-systems-node-installers">Linux or other operating systems Node installers</a></li><li><a href="#less-common-operating-systems">Less-common operating systems</a></li></ul></ul></div>
146146
</section>
147147

148148
<div id="_content"><h3 id="description">Description</h3>
@@ -172,17 +172,8 @@ <h3 id="using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node ver
172172
<p>Node version managers allow you to install and switch between multiple
173173
versions of Node.js and npm on your system so you can test your
174174
applications on multiple versions of npm to ensure they work for users on
175-
different versions.</p>
176-
<h4 id="osx-or-linux-node-version-managers">OSX or Linux Node version managers</h4>
177-
<ul>
178-
<li><a href="https://github.com/creationix/nvm">nvm</a></li>
179-
<li><a href="https://github.com/tj/n">n</a></li>
180-
</ul>
181-
<h4 id="windows-node-version-managers">Windows Node version managers</h4>
182-
<ul>
183-
<li><a href="https://github.com/marcelklehr/nodist">nodist</a></li>
184-
<li><a href="https://github.com/coreybutler/nvm-windows">nvm-windows</a></li>
185-
</ul>
175+
different versions. You can
176+
<a href="https://github.com/search?q=node%20version%20manager&amp;type=repositories">search for them on GitHub</a>.</p>
186177
<h3 id="using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</h3>
187178
<p>If you are unable to use a Node version manager, you can use a Node
188179
installer to install both Node.js and npm on your system.</p>

deps/npm/lib/cli.js

+34-79
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
1-
// This is separate to indicate that it should contain code we expect to work in
2-
// all conceivably runnable versions of node. This is a best effort to catch
3-
// syntax errors to give users a good error message if they are using a node
4-
// version that doesn't allow syntax we are using such as private properties, etc
5-
const createEnginesValidation = () => {
6-
const node = process.version.replace(/-.*$/, '')
1+
/* eslint-disable max-len */
2+
// Code in this file should work in all conceivably runnable versions of node.
3+
// A best effort is made to catch syntax errors to give users a good error message if they are using a node version that doesn't allow syntax we are using in other files such as private properties, etc
4+
5+
// Separated out for easier unit testing
6+
module.exports = async process => {
7+
// set it here so that regardless of what happens later, we don't
8+
// leak any private CLI configs to other programs
9+
process.title = 'npm'
10+
11+
// if npm is called as "npmg" or "npm_g", then run in global mode.
12+
if (process.argv[1][process.argv[1].length - 1] === 'g') {
13+
process.argv.splice(1, 1, 'npm', '-g')
14+
}
15+
16+
const nodeVersion = process.version.replace(/-.*$/, '')
717
const pkg = require('../package.json')
818
const engines = pkg.engines.node
9-
const npm = `v${pkg.version}`
10-
11-
const cols = Math.min(Math.max(20, process.stdout.columns) || 80, 80)
12-
const wrap = (lines) => lines
13-
.join(' ')
14-
.split(/[ \n]+/)
15-
.reduce((left, right) => {
16-
const last = left.split('\n').pop()
17-
const join = last.length && last.length + right.length > cols ? '\n' : ' '
18-
return left + join + right
19-
})
20-
.trim()
21-
22-
const unsupportedMessage = wrap([
23-
`npm ${npm} does not support Node.js ${node}.`,
24-
`You should probably upgrade to a newer version of node as we can't make any`,
25-
`promises that npm will work with this version.`,
26-
`This version of npm supports the following node versions: \`${engines}\`.`,
27-
'You can find the latest version at https://nodejs.org/.',
28-
])
29-
30-
const brokenMessage = wrap([
31-
`ERROR: npm ${npm} is known not to run on Node.js ${node}.`,
32-
`You'll need to upgrade to a newer Node.js version in order to use this version of npm.`,
33-
`This version of npm supports the following node versions: \`${engines}\`.`,
34-
'You can find the latest version at https://nodejs.org/.',
35-
])
36-
37-
// coverage ignored because this is only hit in very unsupported node versions
38-
// and it's a best effort attempt to show something nice in those cases
19+
const npmVersion = `v${pkg.version}`
20+
21+
const unsupportedMessage = `npm ${npmVersion} does not support Node.js ${nodeVersion}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
22+
23+
const brokenMessage = `ERROR: npm ${npmVersion} is known not to run on Node.js ${nodeVersion}. This version of npm supports the following node versions: \`${engines}\`. You can find the latest version at https://nodejs.org/.`
24+
25+
// Coverage ignored because this is only hit in very unsupported node versions and it's a best effort attempt to show something nice in those cases
3926
/* istanbul ignore next */
4027
const syntaxErrorHandler = (err) => {
4128
if (err instanceof SyntaxError) {
@@ -51,74 +38,42 @@ const createEnginesValidation = () => {
5138
process.on('uncaughtException', syntaxErrorHandler)
5239
process.on('unhandledRejection', syntaxErrorHandler)
5340

54-
return {
55-
node,
56-
engines,
57-
unsupportedMessage,
58-
off: () => {
59-
process.off('uncaughtException', syntaxErrorHandler)
60-
process.off('unhandledRejection', syntaxErrorHandler)
61-
},
62-
}
63-
}
64-
65-
// Separated out for easier unit testing
66-
module.exports = async process => {
67-
// set it here so that regardless of what happens later, we don't
68-
// leak any private CLI configs to other programs
69-
process.title = 'npm'
70-
71-
// if npm is called as "npmg" or "npm_g", then run in global mode.
72-
if (process.argv[1][process.argv[1].length - 1] === 'g') {
73-
process.argv.splice(1, 1, 'npm', '-g')
74-
}
75-
76-
// Nothing should happen before this line if we can't guarantee it will
77-
// not have syntax errors in some version of node
78-
const validateEngines = createEnginesValidation()
79-
8041
const satisfies = require('semver/functions/satisfies')
8142
const exitHandler = require('./utils/exit-handler.js')
8243
const Npm = require('./npm.js')
8344
const npm = new Npm()
8445
exitHandler.setNpm(npm)
8546

86-
// only log node and npm paths in argv initially since argv can contain
87-
// sensitive info. a cleaned version will be logged later
47+
// only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later
8848
const log = require('./utils/log-shim.js')
8949
log.verbose('cli', process.argv.slice(0, 2).join(' '))
9050
log.info('using', 'npm@%s', npm.version)
9151
log.info('using', 'node@%s', process.version)
9252

93-
// At this point we've required a few files and can be pretty sure
94-
// we dont contain invalid syntax for this version of node. It's
95-
// possible a lazy require would, but that's unlikely enough that
96-
// it's not worth catching anymore and we attach the more important
97-
// exit handlers.
98-
validateEngines.off()
53+
// At this point we've required a few files and can be pretty sure we dont contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers.
54+
process.off('uncaughtException', syntaxErrorHandler)
55+
process.off('unhandledRejection', syntaxErrorHandler)
9956
process.on('uncaughtException', exitHandler)
10057
process.on('unhandledRejection', exitHandler)
10158

102-
// It is now safe to log a warning if they are using a version of node
103-
// that is not going to fail on syntax errors but is still unsupported
104-
// and untested and might not work reliably. This is safe to use the logger
105-
// now which we want since this will show up in the error log too.
106-
if (!satisfies(validateEngines.node, validateEngines.engines)) {
107-
log.warn('cli', validateEngines.unsupportedMessage)
59+
// It is now safe to log a warning if they are using a version of node that is not going to fail on syntax errors but is still unsupported and untested and might not work reliably. This is safe to use the logger now which we want since this will show up in the error log too.
60+
if (!satisfies(nodeVersion, engines)) {
61+
log.warn('cli', unsupportedMessage)
10862
}
10963

11064
let cmd
111-
// now actually fire up npm and run the command.
112-
// this is how to use npm programmatically:
65+
// Now actually fire up npm and run the command.
66+
// This is how to use npm programmatically:
11367
try {
11468
await npm.load()
11569

70+
// npm -v
11671
if (npm.config.get('version', 'cli')) {
11772
npm.output(npm.version)
11873
return exitHandler()
11974
}
12075

121-
// npm --versions=cli
76+
// npm --versions
12277
if (npm.config.get('versions', 'cli')) {
12378
npm.argv = ['version']
12479
npm.config.set('usage', false, 'cli')

deps/npm/lib/commands/completion.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ const nopt = require('nopt')
3434
const { resolve } = require('path')
3535

3636
const { definitions, shorthands } = require('../utils/config/index.js')
37-
const { aliases, commands, plumbing } = require('../utils/cmd-list.js')
38-
const aliasNames = Object.keys(aliases)
39-
const fullList = commands.concat(aliasNames).filter(c => !plumbing.includes(c))
37+
const { commands, aliases } = require('../utils/cmd-list.js')
4038
const configNames = Object.keys(definitions)
4139
const shorthandNames = Object.keys(shorthands)
4240
const allConfs = configNames.concat(shorthandNames)
@@ -263,7 +261,8 @@ const isFlag = word => {
263261
// complete against the npm commands
264262
// if they all resolve to the same thing, just return the thing it already is
265263
const cmdCompl = (opts, npm) => {
266-
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
264+
const allCommands = commands.concat(Object.keys(aliases))
265+
const matches = allCommands.filter(c => c.startsWith(opts.partialWord))
267266
if (!matches.length) {
268267
return matches
269268
}
@@ -273,7 +272,7 @@ const cmdCompl = (opts, npm) => {
273272
return [...derefs]
274273
}
275274

276-
return fullList
275+
return allCommands
277276
}
278277

279278
module.exports = Completion

deps/npm/lib/commands/explain.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Explain extends ArboristWorkspaceCmd {
7878
this.npm.output(JSON.stringify(expls, null, 2))
7979
} else {
8080
this.npm.output(expls.map(expl => {
81-
return explainNode(expl, Infinity, this.npm.color)
81+
return explainNode(expl, Infinity, this.npm.chalk)
8282
}).join('\n\n'))
8383
}
8484
}

deps/npm/lib/commands/fund.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const archy = require('archy')
22
const Arborist = require('@npmcli/arborist')
3-
const chalk = require('chalk')
43
const pacote = require('pacote')
54
const semver = require('semver')
65
const npa = require('npm-package-arg')
@@ -96,7 +95,6 @@ class Fund extends ArboristWorkspaceCmd {
9695
}
9796

9897
printHuman (fundingInfo) {
99-
const color = this.npm.color
10098
const unicode = this.npm.config.get('unicode')
10199
const seenUrls = new Map()
102100

@@ -117,7 +115,7 @@ class Fund extends ArboristWorkspaceCmd {
117115

118116
if (url) {
119117
item.label = tree({
120-
label: color ? chalk.bgBlack.white(url) : url,
118+
label: this.npm.chalk.bgBlack.white(url),
121119
nodes: [pkgRef],
122120
}).trim()
123121

@@ -154,7 +152,7 @@ class Fund extends ArboristWorkspaceCmd {
154152
})
155153

156154
const res = tree(result)
157-
return color ? chalk.reset(res) : res
155+
return this.npm.chalk.reset(res)
158156
}
159157

160158
async openFundingUrl ({ path, tree, spec, fundingSourceNumber }) {

0 commit comments

Comments
 (0)