Skip to content

Commit 57d3131

Browse files
npm-cli-botmartenrichter
authored andcommitted
deps: upgrade npm to 10.2.4
PR-URL: nodejs#50751 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent cf3f7a8 commit 57d3131

File tree

143 files changed

+2417
-1013
lines changed

Some content is hidden

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

143 files changed

+2417
-1013
lines changed

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@10.2.3 /path/to/npm
30+
npm@10.2.4 /path/to/npm
3131
└─┬ init-package-json@0.0.4
3232
└── promzard@0.1.5
3333
```

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ then only packages matching one of the supplied names are removed.
1818
Extraneous packages are those present in the `node_modules` folder that are
1919
not listed as any package's dependency list.
2020

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

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

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

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ For example, to show the dependencies of the `ronn` package at version
3232
npm view ronn@0.3.5 dependencies
3333
```
3434

35+
By default, `npm view` shows data about the current project context (by looking for a `package.json`).
36+
To show field data for the current project use a file path (i.e. `.`):
37+
38+
```bash
39+
npm view . dependencies
40+
```
41+
3542
You can view child fields by separating them with a period.
3643
To view the git repository URL for the latest version of `npm`, you would run the following command:
3744

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-
10.2.3
17+
10.2.4
1818

1919
### Description
2020

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

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ <h3 id="description">Description</h3>
153153
then only packages matching one of the supplied names are removed.</p>
154154
<p>Extraneous packages are those present in the <code>node_modules</code> folder that are
155155
not listed as any package's dependency list.</p>
156-
<p>If the <code>--production</code> flag is specified or the <code>NODE_ENV</code> environment
156+
<p>If the <code>--omit=dev</code> flag is specified or the <code>NODE_ENV</code> environment
157157
variable is set to <code>production</code>, this command will remove the packages
158-
specified in your <code>devDependencies</code>. Setting <code>--no-production</code> will negate
159-
<code>NODE_ENV</code> being set to <code>production</code>.</p>
158+
specified in your <code>devDependencies</code>.</p>
160159
<p>If the <code>--dry-run</code> flag is used then no changes will actually be made.</p>
161160
<p>If the <code>--json</code> flag is used, then the changes <code>npm prune</code> made (or would
162161
have made with <code>--dry-run</code>) are printed as a JSON object.</p>

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

+4
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ <h3 id="description">Description</h3>
161161
<code>0.3.5</code>, you could do the following:</p>
162162
<pre><code class="language-bash">npm view ronn@0.3.5 dependencies
163163
</code></pre>
164+
<p>By default, <code>npm view</code> shows data about the current project context (by looking for a <code>package.json</code>).
165+
To show field data for the current project use a file path (i.e. <code>.</code>):</p>
166+
<pre><code class="language-bash">npm view . dependencies
167+
</code></pre>
164168
<p>You can view child fields by separating them with a period.
165169
To view the git repository URL for the latest version of <code>npm</code>, you would run the following command:</p>
166170
<pre><code class="language-bash">npm view npm repository.url

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>10.2.3</p>
153+
<p>10.2.4</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/lib/commands/exec.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,33 @@ class Exec extends BaseCommand {
3434
for (const [name, path] of this.workspaces) {
3535
const locationMsg =
3636
`in workspace ${this.npm.chalk.green(name)} at location:\n${this.npm.chalk.dim(path)}`
37-
await this.callExec(args, { locationMsg, runPath: path })
37+
await this.callExec(args, { name, locationMsg, runPath: path })
3838
}
3939
}
4040

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

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

5060
const call = this.npm.config.get('call')
5161
let globalPath
5262
const {
5363
flatOptions,
54-
localBin,
5564
globalBin,
5665
globalDir,
5766
chalk,
@@ -79,14 +88,14 @@ class Exec extends BaseCommand {
7988
// copy args so they dont get mutated
8089
args: [...args],
8190
call,
82-
localBin,
83-
locationMsg,
91+
chalk,
8492
globalBin,
8593
globalPath,
94+
localBin,
95+
locationMsg,
8696
output,
87-
chalk,
8897
packages,
89-
path: localPrefix,
98+
path,
9099
runPath,
91100
scriptShell,
92101
yes,

deps/npm/lib/commands/outdated.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const npa = require('npm-package-arg')
66
const pickManifest = require('npm-pick-manifest')
77
const localeCompare = require('@isaacs/string-locale-compare')('en')
88

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

1211
class Outdated extends ArboristWorkspaceCmd {
@@ -23,6 +22,7 @@ class Outdated extends ArboristWorkspaceCmd {
2322
]
2423

2524
async exec (args) {
25+
const { default: stripAnsi } = await import('strip-ansi')
2626
const global = resolve(this.npm.globalDir, '..')
2727
const where = this.npm.global
2828
? global
@@ -106,7 +106,7 @@ class Outdated extends ArboristWorkspaceCmd {
106106

107107
const tableOpts = {
108108
align: ['l', 'r', 'r', 'r', 'l'],
109-
stringLength: s => ansiTrim(s).length,
109+
stringLength: s => stripAnsi(s).length,
110110
}
111111
this.npm.output(table(outTable, tableOpts))
112112
}

deps/npm/lib/commands/pkg.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ class Pkg extends BaseCommand {
8282
}
8383
}
8484

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

deps/npm/lib/commands/search.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ class Search extends BaseCommand {
8181

8282
const filterStream = new FilterStream()
8383

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

9191
log.silly('search', 'searching packages')
9292
const p = new Pipeline(

deps/npm/lib/commands/token.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const Table = require('cli-table3')
2-
const { v4: isCidrV4, v6: isCidrV6 } = require('is-cidr')
32
const log = require('../utils/log-shim.js')
43
const profile = require('npm-profile')
54

@@ -137,7 +136,7 @@ class Token extends BaseCommand {
137136
const readonly = conf.readOnly
138137

139138
const password = await readUserInfo.password()
140-
const validCIDR = this.validateCIDRList(cidr)
139+
const validCIDR = await this.validateCIDRList(cidr)
141140
log.info('token', 'creating')
142141
const result = await pulseTillDone.withPromise(
143142
otplease(this.npm, conf, c => profile.createToken(password, readonly, validCIDR, c))
@@ -209,7 +208,8 @@ class Token extends BaseCommand {
209208
return byId
210209
}
211210

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

0 commit comments

Comments
 (0)