Skip to content

Commit ecc180f

Browse files
npm-cli-botmarco-ippolito
authored andcommitted
deps: upgrade npm to 10.5.2
PR-URL: #52458 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 0ec4d9d commit ecc180f

File tree

89 files changed

+3333
-2609
lines changed

Some content is hidden

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

89 files changed

+3333
-2609
lines changed

β€Ždeps/npm/docs/content/commands/npm-audit.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The `sig` is generated using the following template: `${package.name}@${package.
9090

9191
Keys response:
9292

93-
- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601"): `YYYY-MM-DDTHH:mm:ss.sssZ`
93+
- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDTHH:mm:ss.sssZ`
9494
- `keydid`: sha256 fingerprint of the public key
9595
- `keytype`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI
9696
- `scheme`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI

β€Ž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.5.1 /path/to/npm
30+
npm@10.5.2 /path/to/npm
3131
└─┬ init-package-json@0.0.4
3232
└── promzard@0.1.5
3333
```

β€Ž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.5.1
17+
10.5.2
1818

1919
### Description
2020

β€Ždeps/npm/docs/output/commands/npm-audit.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ <h3 id="audit-signatures">Audit Signatures</h3>
209209
</code></pre>
210210
<p>Keys response:</p>
211211
<ul>
212-
<li><code>expires</code>: null or a simplified extended <a href="https://en.wikipedia.org/wiki/ISO_8601%22">ISO 8601 format</a>: <code>YYYY-MM-DDTHH:mm:ss.sssZ</code></li>
212+
<li><code>expires</code>: null or a simplified extended <a href="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601 format</a>: <code>YYYY-MM-DDTHH:mm:ss.sssZ</code></li>
213213
<li><code>keydid</code>: sha256 fingerprint of the public key</li>
214214
<li><code>keytype</code>: only <code>ecdsa-sha2-nistp256</code> is currently supported by the npm CLI</li>
215215
<li><code>scheme</code>: only <code>ecdsa-sha2-nistp256</code> is currently supported by the npm CLI</li>

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

β€Ž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.5.1</p>
153+
<p>10.5.2</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/base-command.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
const { relative } = require('path')
44

55
const { definitions } = require('@npmcli/config/lib/definitions')
6-
const getWorkspaces = require('./workspaces/get-workspaces.js')
76
const { aliases: cmdAliases } = require('./utils/cmd-list')
87
const log = require('./utils/log-shim.js')
98

@@ -170,6 +169,7 @@ class BaseCommand {
170169
const relativeFrom = prefixInsideCwd ? this.npm.localPrefix : process.cwd()
171170

172171
const filters = this.npm.config.get('workspace')
172+
const getWorkspaces = require('./workspaces/get-workspaces.js')
173173
const ws = await getWorkspaces(filters, {
174174
path: this.npm.localPrefix,
175175
includeWorkspaceRoot,

β€Ždeps/npm/lib/commands/owner.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const log = require('../utils/log-shim')
55
const otplease = require('../utils/otplease.js')
66
const pkgJson = require('@npmcli/package-json')
77
const BaseCommand = require('../base-command.js')
8+
const { redact } = require('@npmcli/redact')
89

910
const readJson = async (path) => {
1011
try {
@@ -119,7 +120,7 @@ class Owner extends BaseCommand {
119120
this.npm.output(maintainers.map(m => `${m.name} <${m.email}>`).join('\n'))
120121
}
121122
} catch (err) {
122-
log.error('owner ls', "Couldn't get owner data", npmFetch.cleanUrl(pkg))
123+
log.error('owner ls', "Couldn't get owner data", redact(pkg))
123124
throw err
124125
}
125126
}

β€Ždeps/npm/lib/commands/ping.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { cleanUrl } = require('npm-registry-fetch')
1+
const { redact } = require('@npmcli/redact')
22
const log = require('../utils/log-shim')
33
const pingUtil = require('../utils/ping.js')
44
const BaseCommand = require('../base-command.js')
@@ -9,7 +9,7 @@ class Ping extends BaseCommand {
99
static name = 'ping'
1010

1111
async exec (args) {
12-
const cleanRegistry = cleanUrl(this.npm.config.get('registry'))
12+
const cleanRegistry = redact(this.npm.config.get('registry'))
1313
log.notice('PING', cleanRegistry)
1414
const start = Date.now()
1515
const details = await pingUtil({ ...this.npm.flatOptions })

β€Ždeps/npm/lib/commands/publish.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,12 @@ class Publish extends BaseCommand {
220220
})
221221
}
222222
if (manifest.publishConfig) {
223-
flatten(manifest.publishConfig, opts)
223+
const cliFlags = this.npm.config.data.get('cli').raw
224+
// Filter out properties set in CLI flags to prioritize them over
225+
// corresponding `publishConfig` settings
226+
const filteredPublishConfig = Object.fromEntries(
227+
Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
228+
flatten(filteredPublishConfig, opts)
224229
}
225230
return manifest
226231
}

β€Ždeps/npm/lib/commands/unpublish.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ class Unpublish extends BaseCommand {
141141
// If localPrefix has a package.json with a name that matches the package
142142
// being unpublished, load up the publishConfig
143143
if (manifest?.name === spec.name && manifest.publishConfig) {
144-
flatten(manifest.publishConfig, opts)
144+
const cliFlags = this.npm.config.data.get('cli').raw
145+
// Filter out properties set in CLI flags to prioritize them over
146+
// corresponding `publishConfig` settings
147+
const filteredPublishConfig = Object.fromEntries(
148+
Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
149+
flatten(filteredPublishConfig, opts)
145150
}
146151

147152
const versions = await Unpublish.getKeysOfVersions(spec.name, opts)

β€Ždeps/npm/lib/utils/error-message.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { format } = require('util')
22
const { resolve } = require('path')
3-
const nameValidator = require('validate-npm-package-name')
43
const { redactLog: replaceInfo } = require('@npmcli/redact')
54
const { report } = require('./explain-eresolve.js')
65
const log = require('./log-shim')
@@ -215,6 +214,7 @@ const errorMessage = (er, npm) => {
215214
detail.push(['404', ''])
216215
detail.push(['404', '', `'${replaceInfo(er.pkgid)}' is not in this registry.`])
217216

217+
const nameValidator = require('validate-npm-package-name')
218218
const valResult = nameValidator(pkg)
219219

220220
if (!valResult.validForNewPackages) {

β€Ždeps/npm/lib/utils/log-file.js

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
const os = require('os')
22
const { join, dirname, basename } = require('path')
33
const { format } = require('util')
4-
const { glob } = require('glob')
54
const { Minipass } = require('minipass')
65
const fsMiniPass = require('fs-minipass')
76
const fs = require('fs/promises')
87
const log = require('./log-shim')
98
const Display = require('./display')
109

1110
const padZero = (n, length) => n.toString().padStart(length.toString().length, '0')
12-
const globify = pattern => pattern.split('\\').join('/')
1311

1412
class LogFiles {
1513
// Default to a plain minipass stream so we can buffer
@@ -199,25 +197,49 @@ class LogFiles {
199197

200198
try {
201199
const logPath = this.#getLogFilePath()
202-
const logGlob = join(dirname(logPath), basename(logPath)
200+
const patternFileName = basename(logPath)
203201
// tell glob to only match digits
204-
.replace(/\d/g, '[0123456789]')
202+
.replace(/\d/g, 'd')
205203
// Handle the old (prior to 8.2.0) log file names which did not have a
206204
// counter suffix
207-
.replace(/-\.log$/, '*.log')
208-
)
205+
.replace('-.log', '')
206+
207+
let files = await fs.readdir(
208+
dirname(logPath), {
209+
withFileTypes: true,
210+
encoding: 'utf-8',
211+
})
212+
files = files.sort((a, b) => basename(a.name).localeCompare(basename(b.name), 'en'))
213+
214+
const logFiles = []
215+
216+
for (const file of files) {
217+
if (!file.isFile()) {
218+
continue
219+
}
220+
221+
const genericFileName = file.name.replace(/\d/g, 'd')
222+
const filePath = join(dirname(logPath), basename(file.name))
223+
224+
// Always ignore the currently written files
225+
if (
226+
genericFileName.includes(patternFileName)
227+
&& genericFileName.endsWith('.log')
228+
&& !this.#files.includes(filePath)
229+
) {
230+
logFiles.push(filePath)
231+
}
232+
}
209233

210-
// Always ignore the currently written files
211-
const files = await glob(globify(logGlob), { ignore: this.#files.map(globify), silent: true })
212-
const toDelete = files.length - this.#logsMax
234+
const toDelete = logFiles.length - this.#logsMax
213235

214236
if (toDelete <= 0) {
215237
return
216238
}
217239

218240
log.silly('logfile', `start cleaning logs, removing ${toDelete} files`)
219241

220-
for (const file of files.slice(0, toDelete)) {
242+
for (const file of logFiles.slice(0, toDelete)) {
221243
try {
222244
await fs.rm(file, { force: true })
223245
} catch (e) {

β€Ždeps/npm/lib/utils/update-notifier.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// Check daily for betas, and weekly otherwise.
44

55
const ciInfo = require('ci-info')
6-
const semver = require('semver')
6+
const gt = require('semver/functions/gt')
7+
const gte = require('semver/functions/gte')
8+
const parse = require('semver/functions/parse')
79
const { stat, writeFile } = require('fs/promises')
810
const { resolve } = require('path')
911

@@ -38,12 +40,12 @@ const updateCheck = async (npm, spec, version, current) => {
3840
// and should get the updates from that release train.
3941
// Note that this isn't another http request over the network, because
4042
// the packument will be cached by pacote from previous request.
41-
if (semver.gt(version, latest) && spec === 'latest') {
43+
if (gt(version, latest) && spec === 'latest') {
4244
return updateNotifier(npm, `^${version}`)
4345
}
4446

4547
// if we already have something >= the desired spec, then we're done
46-
if (semver.gte(version, latest)) {
48+
if (gte(version, latest)) {
4749
return null
4850
}
4951

@@ -53,7 +55,7 @@ const updateCheck = async (npm, spec, version, current) => {
5355
// ok! notify the user about this update they should get.
5456
// The message is saved for printing at process exit so it will not get
5557
// lost in any other messages being printed as part of the command.
56-
const update = semver.parse(mani.version)
58+
const update = parse(mani.version)
5759
const type = update.major !== current.major ? 'major'
5860
: update.minor !== current.minor ? 'minor'
5961
: update.patch !== current.patch ? 'patch'
@@ -79,7 +81,7 @@ const updateNotifier = async (npm, spec = 'latest') => {
7981
// if we're on a prerelease train, then updates are coming fast
8082
// check for a new one daily. otherwise, weekly.
8183
const { version } = npm
82-
const current = semver.parse(version)
84+
const current = parse(version)
8385

8486
// if we're on a beta train, always get the next beta
8587
if (current.prerelease.length) {

β€Ždeps/npm/man/man1/npm-audit.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Public signing keys are provided at \fBregistry-host.tld/-/npm/v1/keys\fR in the
8080
Keys response:
8181
.RS 0
8282
.IP \(bu 4
83-
\fBexpires\fR: null or a simplified extended \fBISO 8601 format\fR \fI\(lahttps://en.wikipedia.org/wiki/ISO_8601"\(ra\fR: \fBYYYY-MM-DDTHH:mm:ss.sssZ\fR
83+
\fBexpires\fR: null or a simplified extended \fBISO 8601 format\fR \fI\(lahttps://en.wikipedia.org/wiki/ISO_8601\(ra\fR: \fBYYYY-MM-DDTHH:mm:ss.sssZ\fR
8484
.IP \(bu 4
8585
\fBkeydid\fR: sha256 fingerprint of the public key
8686
.IP \(bu 4

β€Ždeps/npm/man/man1/npm-ls.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
2020
.P
2121
.RS 2
2222
.nf
23-
npm@10.5.1 /path/to/npm
23+
npm@10.5.2 /path/to/npm
2424
└─┬ init-package-json@0.0.4
2525
└── promzard@0.1.5
2626
.fi

β€Ždeps/npm/man/man1/npm.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ npm
1212
Note: This command is unaware of workspaces.
1313
.SS "Version"
1414
.P
15-
10.5.1
15+
10.5.2
1616
.SS "Description"
1717
.P
1818
npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

β€Ždeps/npm/node_modules/@npmcli/agent/lib/agents.js

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/npm/node_modules/@npmcli/agent/package.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/npm/node_modules/@npmcli/arborist/lib/place-dep.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Ždeps/npm/node_modules/@npmcli/arborist/package.json

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)