Skip to content

Commit

Permalink
deps: upgrade npm to 9.6.3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
npm-cli-bot authored and RafaelGSS committed Apr 8, 2023
1 parent 1c21fbf commit 4b09222
Show file tree
Hide file tree
Showing 321 changed files with 12,274 additions and 15,792 deletions.
12 changes: 1 addition & 11 deletions deps/npm/README.md
Expand Up @@ -27,17 +27,7 @@ curl -qL https://www.npmjs.com/install.sh | sh

#### Node Version Managers

If you're looking to manage multiple versions of **`node`** &/or **`npm`**, consider using a "Node Version Manager" such as:

* [**`nvm`**](https://github.com/nvm-sh/nvm)
* [**`nvs`**](https://github.com/jasongin/nvs)
* [**`nave`**](https://github.com/isaacs/nave)
* [**`n`**](https://github.com/tj/n)
* [**`volta`**](https://github.com/volta-cli/volta)
* [**`nodenv`**](https://github.com/nodenv/nodenv)
* [**`asdf-nodejs`**](https://github.com/asdf-vm/asdf-nodejs)
* [**`nvm-windows`**](https://github.com/coreybutler/nvm-windows)
* [**`fnm`**](https://github.com/Schniz/fnm)
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)

### Usage

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm-ls.md
Expand Up @@ -27,7 +27,7 @@ packages will *also* show the paths to the specified packages. For
example, running `npm ls promzard` in npm's source tree will show:

```bash
npm@9.6.2 /path/to/npm
npm@9.6.3 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
Expand Down
1 change: 0 additions & 1 deletion deps/npm/docs/content/commands/npm-prefix.md
Expand Up @@ -52,7 +52,6 @@ folder instead of the current working directory. See
### See Also

* [npm root](/commands/npm-root)
* [npm bin](/commands/npm-bin)
* [npm folders](/configuring-npm/folders)
* [npm config](/commands/npm-config)
* [npmrc](/configuring-npm/npmrc)
1 change: 0 additions & 1 deletion deps/npm/docs/content/commands/npm-root.md
Expand Up @@ -44,7 +44,6 @@ folder instead of the current working directory. See
### See Also

* [npm prefix](/commands/npm-prefix)
* [npm bin](/commands/npm-bin)
* [npm folders](/configuring-npm/folders)
* [npm config](/commands/npm-config)
* [npmrc](/configuring-npm/npmrc)
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm.md
Expand Up @@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.

### Version

9.6.2
9.6.3

### Description

Expand Down
13 changes: 2 additions & 11 deletions deps/npm/docs/content/configuring-npm/install.md
Expand Up @@ -38,17 +38,8 @@ npm -v
Node version managers allow you to install and switch between multiple
versions of Node.js and npm on your system so you can test your
applications on multiple versions of npm to ensure they work for users on
different versions.

#### OSX or Linux Node version managers

* [nvm](https://github.com/creationix/nvm)
* [n](https://github.com/tj/n)

#### Windows Node version managers

* [nodist](https://github.com/marcelklehr/nodist)
* [nvm-windows](https://github.com/coreybutler/nvm-windows)
different versions. You can
[search for them on GitHub](https://github.com/search?q=node%20version%20manager&type=repositories).

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

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Expand Up @@ -160,7 +160,7 @@ <h3 id="description">Description</h3>
the results to only the paths to the packages named. Note that nested
packages will <em>also</em> show the paths to the specified packages. For
example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
<pre><code class="language-bash">npm@9.6.2 /path/to/npm
<pre><code class="language-bash">npm@9.6.3 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
1 change: 0 additions & 1 deletion deps/npm/docs/output/commands/npm-prefix.html
Expand Up @@ -180,7 +180,6 @@ <h4 id="global"><code>global</code></h4>
<h3 id="see-also">See Also</h3>
<ul>
<li><a href="../commands/npm-root.html">npm root</a></li>
<li><a href="../commands/npm-bin.html">npm bin</a></li>
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
<li><a href="../commands/npm-config.html">npm config</a></li>
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
Expand Down
1 change: 0 additions & 1 deletion deps/npm/docs/output/commands/npm-root.html
Expand Up @@ -175,7 +175,6 @@ <h4 id="global"><code>global</code></h4>
<h3 id="see-also">See Also</h3>
<ul>
<li><a href="../commands/npm-prefix.html">npm prefix</a></li>
<li><a href="../commands/npm-bin.html">npm bin</a></li>
<li><a href="../configuring-npm/folders.html">npm folders</a></li>
<li><a href="../commands/npm-config.html">npm config</a></li>
<li><a href="../configuring-npm/npmrc.html">npmrc</a></li>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Expand Up @@ -150,7 +150,7 @@ <h2 id="table-of-contents">Table of contents</h2>
</code></pre>
<p>Note: This command is unaware of workspaces.</p>
<h3 id="version">Version</h3>
<p>9.6.2</p>
<p>9.6.3</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
Expand Down
15 changes: 3 additions & 12 deletions deps/npm/docs/output/configuring-npm/install.html
Expand Up @@ -142,7 +142,7 @@ <h1 id="install">install</h1>

<section id="table_of_contents">
<h2 id="table-of-contents">Table of contents</h2>
<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>
<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>
</section>

<div id="_content"><h3 id="description">Description</h3>
Expand Down Expand Up @@ -172,17 +172,8 @@ <h3 id="using-a-node-version-manager-to-install-nodejs-and-npm">Using a Node ver
<p>Node version managers allow you to install and switch between multiple
versions of Node.js and npm on your system so you can test your
applications on multiple versions of npm to ensure they work for users on
different versions.</p>
<h4 id="osx-or-linux-node-version-managers">OSX or Linux Node version managers</h4>
<ul>
<li><a href="https://github.com/creationix/nvm">nvm</a></li>
<li><a href="https://github.com/tj/n">n</a></li>
</ul>
<h4 id="windows-node-version-managers">Windows Node version managers</h4>
<ul>
<li><a href="https://github.com/marcelklehr/nodist">nodist</a></li>
<li><a href="https://github.com/coreybutler/nvm-windows">nvm-windows</a></li>
</ul>
different versions. You can
<a href="https://github.com/search?q=node%20version%20manager&amp;type=repositories">search for them on GitHub</a>.</p>
<h3 id="using-a-node-installer-to-install-nodejs-and-npm">Using a Node installer to install Node.js and npm</h3>
<p>If you are unable to use a Node version manager, you can use a Node
installer to install both Node.js and npm on your system.</p>
Expand Down
113 changes: 34 additions & 79 deletions deps/npm/lib/cli.js
@@ -1,41 +1,28 @@
// This is separate to indicate that it should contain code we expect to work in
// all conceivably runnable versions of node. This is a best effort 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 such as private properties, etc
const createEnginesValidation = () => {
const node = process.version.replace(/-.*$/, '')
/* eslint-disable max-len */
// Code in this file should work in all conceivably runnable versions of node.
// 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

// Separated out for easier unit testing
module.exports = async process => {
// set it here so that regardless of what happens later, we don't
// leak any private CLI configs to other programs
process.title = 'npm'

// if npm is called as "npmg" or "npm_g", then run in global mode.
if (process.argv[1][process.argv[1].length - 1] === 'g') {
process.argv.splice(1, 1, 'npm', '-g')
}

const nodeVersion = process.version.replace(/-.*$/, '')
const pkg = require('../package.json')
const engines = pkg.engines.node
const npm = `v${pkg.version}`

const cols = Math.min(Math.max(20, process.stdout.columns) || 80, 80)
const wrap = (lines) => lines
.join(' ')
.split(/[ \n]+/)
.reduce((left, right) => {
const last = left.split('\n').pop()
const join = last.length && last.length + right.length > cols ? '\n' : ' '
return left + join + right
})
.trim()

const unsupportedMessage = wrap([
`npm ${npm} does not support Node.js ${node}.`,
`You should probably upgrade to a newer version of node as we can't make any`,
`promises that npm will work with this version.`,
`This version of npm supports the following node versions: \`${engines}\`.`,
'You can find the latest version at https://nodejs.org/.',
])

const brokenMessage = wrap([
`ERROR: npm ${npm} is known not to run on Node.js ${node}.`,
`You'll need to upgrade to a newer Node.js version in order to use this version of npm.`,
`This version of npm supports the following node versions: \`${engines}\`.`,
'You can find the latest version at https://nodejs.org/.',
])

// 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
const npmVersion = `v${pkg.version}`

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/.`

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/.`

// 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
/* istanbul ignore next */
const syntaxErrorHandler = (err) => {
if (err instanceof SyntaxError) {
Expand All @@ -51,74 +38,42 @@ const createEnginesValidation = () => {
process.on('uncaughtException', syntaxErrorHandler)
process.on('unhandledRejection', syntaxErrorHandler)

return {
node,
engines,
unsupportedMessage,
off: () => {
process.off('uncaughtException', syntaxErrorHandler)
process.off('unhandledRejection', syntaxErrorHandler)
},
}
}

// Separated out for easier unit testing
module.exports = async process => {
// set it here so that regardless of what happens later, we don't
// leak any private CLI configs to other programs
process.title = 'npm'

// if npm is called as "npmg" or "npm_g", then run in global mode.
if (process.argv[1][process.argv[1].length - 1] === 'g') {
process.argv.splice(1, 1, 'npm', '-g')
}

// Nothing should happen before this line if we can't guarantee it will
// not have syntax errors in some version of node
const validateEngines = createEnginesValidation()

const satisfies = require('semver/functions/satisfies')
const exitHandler = require('./utils/exit-handler.js')
const Npm = require('./npm.js')
const npm = new Npm()
exitHandler.setNpm(npm)

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

// 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.
validateEngines.off()
// 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.
process.off('uncaughtException', syntaxErrorHandler)
process.off('unhandledRejection', syntaxErrorHandler)
process.on('uncaughtException', exitHandler)
process.on('unhandledRejection', exitHandler)

// 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.
if (!satisfies(validateEngines.node, validateEngines.engines)) {
log.warn('cli', validateEngines.unsupportedMessage)
// 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.
if (!satisfies(nodeVersion, engines)) {
log.warn('cli', unsupportedMessage)
}

let cmd
// now actually fire up npm and run the command.
// this is how to use npm programmatically:
// Now actually fire up npm and run the command.
// This is how to use npm programmatically:
try {
await npm.load()

// npm -v
if (npm.config.get('version', 'cli')) {
npm.output(npm.version)
return exitHandler()
}

// npm --versions=cli
// npm --versions
if (npm.config.get('versions', 'cli')) {
npm.argv = ['version']
npm.config.set('usage', false, 'cli')
Expand Down
9 changes: 4 additions & 5 deletions deps/npm/lib/commands/completion.js
Expand Up @@ -34,9 +34,7 @@ const nopt = require('nopt')
const { resolve } = require('path')

const { definitions, shorthands } = require('../utils/config/index.js')
const { aliases, commands, plumbing } = require('../utils/cmd-list.js')
const aliasNames = Object.keys(aliases)
const fullList = commands.concat(aliasNames).filter(c => !plumbing.includes(c))
const { commands, aliases } = require('../utils/cmd-list.js')
const configNames = Object.keys(definitions)
const shorthandNames = Object.keys(shorthands)
const allConfs = configNames.concat(shorthandNames)
Expand Down Expand Up @@ -263,7 +261,8 @@ const isFlag = word => {
// complete against the npm commands
// if they all resolve to the same thing, just return the thing it already is
const cmdCompl = (opts, npm) => {
const matches = fullList.filter(c => c.startsWith(opts.partialWord))
const allCommands = commands.concat(Object.keys(aliases))
const matches = allCommands.filter(c => c.startsWith(opts.partialWord))
if (!matches.length) {
return matches
}
Expand All @@ -273,7 +272,7 @@ const cmdCompl = (opts, npm) => {
return [...derefs]
}

return fullList
return allCommands
}

module.exports = Completion
2 changes: 1 addition & 1 deletion deps/npm/lib/commands/explain.js
Expand Up @@ -78,7 +78,7 @@ class Explain extends ArboristWorkspaceCmd {
this.npm.output(JSON.stringify(expls, null, 2))
} else {
this.npm.output(expls.map(expl => {
return explainNode(expl, Infinity, this.npm.color)
return explainNode(expl, Infinity, this.npm.chalk)
}).join('\n\n'))
}
}
Expand Down
6 changes: 2 additions & 4 deletions deps/npm/lib/commands/fund.js
@@ -1,6 +1,5 @@
const archy = require('archy')
const Arborist = require('@npmcli/arborist')
const chalk = require('chalk')
const pacote = require('pacote')
const semver = require('semver')
const npa = require('npm-package-arg')
Expand Down Expand Up @@ -96,7 +95,6 @@ class Fund extends ArboristWorkspaceCmd {
}

printHuman (fundingInfo) {
const color = this.npm.color
const unicode = this.npm.config.get('unicode')
const seenUrls = new Map()

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

if (url) {
item.label = tree({
label: color ? chalk.bgBlack.white(url) : url,
label: this.npm.chalk.bgBlack.white(url),
nodes: [pkgRef],
}).trim()

Expand Down Expand Up @@ -154,7 +152,7 @@ class Fund extends ArboristWorkspaceCmd {
})

const res = tree(result)
return color ? chalk.reset(res) : res
return this.npm.chalk.reset(res)
}

async openFundingUrl ({ path, tree, spec, fundingSourceNumber }) {
Expand Down

0 comments on commit 4b09222

Please sign in to comment.