Skip to content

Commit

Permalink
deps: upgrade npm to 10.2.4
Browse files Browse the repository at this point in the history
PR-URL: nodejs#50751
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
npm-cli-bot authored and martenrichter committed Nov 26, 2023
1 parent cf3f7a8 commit 57d3131
Show file tree
Hide file tree
Showing 143 changed files with 2,417 additions and 1,013 deletions.
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm-ls.md
Original file line number Diff line number Diff line change
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
[email protected].3 /path/to/npm
[email protected].4 /path/to/npm
└─┬ [email protected]
└── [email protected]
```
Expand Down
5 changes: 2 additions & 3 deletions deps/npm/docs/content/commands/npm-prune.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ then only packages matching one of the supplied names are removed.
Extraneous packages are those present in the `node_modules` folder that are
not listed as any package's dependency list.

If the `--production` flag is specified or the `NODE_ENV` environment
If the `--omit=dev` flag is specified or the `NODE_ENV` environment
variable is set to `production`, this command will remove the packages
specified in your `devDependencies`. Setting `--no-production` will negate
`NODE_ENV` being set to `production`.
specified in your `devDependencies`.

If the `--dry-run` flag is used then no changes will actually be made.

Expand Down
7 changes: 7 additions & 0 deletions deps/npm/docs/content/commands/npm-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ For example, to show the dependencies of the `ronn` package at version
npm view [email protected] dependencies
```

By default, `npm view` shows data about the current project context (by looking for a `package.json`).
To show field data for the current project use a file path (i.e. `.`):

```bash
npm view . dependencies
```

You can view child fields by separating them with a period.
To view the git repository URL for the latest version of `npm`, you would run the following command:

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note: This command is unaware of workspaces.

### Version

10.2.3
10.2.4

### Description

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
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">[email protected].3 /path/to/npm
<pre><code class="language-bash">[email protected].4 /path/to/npm
└─┬ [email protected]
└── [email protected]
</code></pre>
Expand Down
5 changes: 2 additions & 3 deletions deps/npm/docs/output/commands/npm-prune.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ <h3 id="description">Description</h3>
then only packages matching one of the supplied names are removed.</p>
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
not listed as any package's dependency list.</p>
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
<p>If the <code>--omit=dev</code> flag is specified or the <code>NODE_ENV</code> environment
variable is set to <code>production</code>, this command will remove the packages
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
<code>NODE_ENV</code> being set to <code>production</code>.</p>
specified in your <code>devDependencies</code>.</p>
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
have made with <code>--dry-run</code>) are printed as a JSON object.</p>
Expand Down
4 changes: 4 additions & 0 deletions deps/npm/docs/output/commands/npm-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ <h3 id="description">Description</h3>
<code>0.3.5</code>, you could do the following:</p>
<pre><code class="language-bash">npm view [email protected] dependencies
</code></pre>
<p>By default, <code>npm view</code> shows data about the current project context (by looking for a <code>package.json</code>).
To show field data for the current project use a file path (i.e. <code>.</code>):</p>
<pre><code class="language-bash">npm view . dependencies
</code></pre>
<p>You can view child fields by separating them with a period.
To view the git repository URL for the latest version of <code>npm</code>, you would run the following command:</p>
<pre><code class="language-bash">npm view npm repository.url
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
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>10.2.3</p>
<p>10.2.4</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
25 changes: 17 additions & 8 deletions deps/npm/lib/commands/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,33 @@ class Exec extends BaseCommand {
for (const [name, path] of this.workspaces) {
const locationMsg =
`in workspace ${this.npm.chalk.green(name)} at location:\n${this.npm.chalk.dim(path)}`
await this.callExec(args, { locationMsg, runPath: path })
await this.callExec(args, { name, locationMsg, runPath: path })
}
}

async callExec (args, { locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages
async callExec (args, { name, locationMsg, runPath } = {}) {
// This is where libnpmexec will look for locally installed packages at the project level
const localPrefix = this.npm.localPrefix
// This is where libnpmexec will look for locally installed packages at the workspace level
let localBin = this.npm.localBin
let path = localPrefix

// This is where libnpmexec will actually run the scripts from
if (!runPath) {
runPath = process.cwd()
} else {
// We have to consider if the workspace has its own separate versions
// libnpmexec will walk up to localDir after looking here
localBin = resolve(this.npm.localDir, name, 'node_modules', '.bin')
// We also need to look for `bin` entries in the workspace package.json
// libnpmexec will NOT look in the project root for the bin entry
path = runPath
}

const call = this.npm.config.get('call')
let globalPath
const {
flatOptions,
localBin,
globalBin,
globalDir,
chalk,
Expand Down Expand Up @@ -79,14 +88,14 @@ class Exec extends BaseCommand {
// copy args so they dont get mutated
args: [...args],
call,
localBin,
locationMsg,
chalk,
globalBin,
globalPath,
localBin,
locationMsg,
output,
chalk,
packages,
path: localPrefix,
path,
runPath,
scriptShell,
yes,
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/commands/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const npa = require('npm-package-arg')
const pickManifest = require('npm-pick-manifest')
const localeCompare = require('@isaacs/string-locale-compare')('en')

const ansiTrim = require('strip-ansi')
const ArboristWorkspaceCmd = require('../arborist-cmd.js')

class Outdated extends ArboristWorkspaceCmd {
Expand All @@ -23,6 +22,7 @@ class Outdated extends ArboristWorkspaceCmd {
]

async exec (args) {
const { default: stripAnsi } = await import('strip-ansi')
const global = resolve(this.npm.globalDir, '..')
const where = this.npm.global
? global
Expand Down Expand Up @@ -106,7 +106,7 @@ class Outdated extends ArboristWorkspaceCmd {

const tableOpts = {
align: ['l', 'r', 'r', 'r', 'l'],
stringLength: s => ansiTrim(s).length,
stringLength: s => stripAnsi(s).length,
}
this.npm.output(table(outTable, tableOpts))
}
Expand Down
7 changes: 3 additions & 4 deletions deps/npm/lib/commands/pkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ class Pkg extends BaseCommand {
}
}

// only outputs if not running with workspaces config,
// in case you're retrieving info for workspaces the pkgWorkspaces
// will handle the output to make sure it get keyed by ws name
if (!this.npm.config.get('workspaces')) {
// only outputs if not running with workspaces config
// execWorkspaces will handle the output otherwise
if (!this.workspaces) {
this.npm.output(JSON.stringify(result, null, 2))
}

Expand Down
8 changes: 4 additions & 4 deletions deps/npm/lib/commands/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ class Search extends BaseCommand {

const filterStream = new FilterStream()

// Grab a configured output stream that will spit out packages in the
// desired format.
const outputStream = formatSearchStream({
const { default: stripAnsi } = await import('strip-ansi')
// Grab a configured output stream that will spit out packages in the desired format.
const outputStream = await formatSearchStream({
args, // --searchinclude options are not highlighted
...opts,
})
}, stripAnsi)

log.silly('search', 'searching packages')
const p = new Pipeline(
Expand Down
6 changes: 3 additions & 3 deletions deps/npm/lib/commands/token.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Table = require('cli-table3')
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
const log = require('../utils/log-shim.js')
const profile = require('npm-profile')

Expand Down Expand Up @@ -137,7 +136,7 @@ class Token extends BaseCommand {
const readonly = conf.readOnly

const password = await readUserInfo.password()
const validCIDR = this.validateCIDRList(cidr)
const validCIDR = await this.validateCIDRList(cidr)
log.info('token', 'creating')
const result = await pulseTillDone.withPromise(
otplease(this.npm, conf, c => profile.createToken(password, readonly, validCIDR, c))
Expand Down Expand Up @@ -209,7 +208,8 @@ class Token extends BaseCommand {
return byId
}

validateCIDRList (cidrs) {
async validateCIDRList (cidrs) {
const { v4: isCidrV4, v6: isCidrV6 } = await import('is-cidr')
const maybeList = [].concat(cidrs).filter(Boolean)
const list = maybeList.length === 1 ? maybeList[0].split(/,\s*/) : maybeList
for (const cidr of list) {
Expand Down
Loading

0 comments on commit 57d3131

Please sign in to comment.