Skip to content

Commit

Permalink
deps: upgrade npm to 10.5.2
Browse files Browse the repository at this point in the history
PR-URL: #52458
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
  • Loading branch information
npm-cli-bot authored and marco-ippolito committed May 2, 2024
1 parent 68e4134 commit da532ca
Show file tree
Hide file tree
Showing 89 changed files with 3,333 additions and 2,609 deletions.
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ The `sig` is generated using the following template: `${package.name}@${package.

Keys response:

- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601"): `YYYY-MM-DDTHH:mm:ss.sssZ`
- `expires`: null or a simplified extended [ISO 8601 format](https://en.wikipedia.org/wiki/ISO_8601): `YYYY-MM-DDTHH:mm:ss.sssZ`
- `keydid`: sha256 fingerprint of the public key
- `keytype`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI
- `scheme`: only `ecdsa-sha2-nistp256` is currently supported by the npm CLI
Expand Down
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
npm@10.5.1 /path/to/npm
npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
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.5.1
10.5.2

### Description

Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h3 id="audit-signatures">Audit Signatures</h3>
</code></pre>
<p>Keys response:</p>
<ul>
<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>
<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>
<li><code>keydid</code>: sha256 fingerprint of the public key</li>
<li><code>keytype</code>: only <code>ecdsa-sha2-nistp256</code> is currently supported by the npm CLI</li>
<li><code>scheme</code>: only <code>ecdsa-sha2-nistp256</code> is currently supported by the npm CLI</li>
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">npm@10.5.1 /path/to/npm
<pre><code class="language-bash">npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
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.5.1</p>
<p>10.5.2</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
2 changes: 1 addition & 1 deletion deps/npm/lib/base-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const { relative } = require('path')

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

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

const filters = this.npm.config.get('workspace')
const getWorkspaces = require('./workspaces/get-workspaces.js')
const ws = await getWorkspaces(filters, {
path: this.npm.localPrefix,
includeWorkspaceRoot,
Expand Down
3 changes: 2 additions & 1 deletion deps/npm/lib/commands/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const log = require('../utils/log-shim')
const otplease = require('../utils/otplease.js')
const pkgJson = require('@npmcli/package-json')
const BaseCommand = require('../base-command.js')
const { redact } = require('@npmcli/redact')

const readJson = async (path) => {
try {
Expand Down Expand Up @@ -119,7 +120,7 @@ class Owner extends BaseCommand {
this.npm.output(maintainers.map(m => `${m.name} <${m.email}>`).join('\n'))
}
} catch (err) {
log.error('owner ls', "Couldn't get owner data", npmFetch.cleanUrl(pkg))
log.error('owner ls', "Couldn't get owner data", redact(pkg))
throw err
}
}
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/commands/ping.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { cleanUrl } = require('npm-registry-fetch')
const { redact } = require('@npmcli/redact')
const log = require('../utils/log-shim')
const pingUtil = require('../utils/ping.js')
const BaseCommand = require('../base-command.js')
Expand All @@ -9,7 +9,7 @@ class Ping extends BaseCommand {
static name = 'ping'

async exec (args) {
const cleanRegistry = cleanUrl(this.npm.config.get('registry'))
const cleanRegistry = redact(this.npm.config.get('registry'))
log.notice('PING', cleanRegistry)
const start = Date.now()
const details = await pingUtil({ ...this.npm.flatOptions })
Expand Down
7 changes: 6 additions & 1 deletion deps/npm/lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ class Publish extends BaseCommand {
})
}
if (manifest.publishConfig) {
flatten(manifest.publishConfig, opts)
const cliFlags = this.npm.config.data.get('cli').raw
// Filter out properties set in CLI flags to prioritize them over
// corresponding `publishConfig` settings
const filteredPublishConfig = Object.fromEntries(
Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
flatten(filteredPublishConfig, opts)
}
return manifest
}
Expand Down
7 changes: 6 additions & 1 deletion deps/npm/lib/commands/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ class Unpublish extends BaseCommand {
// If localPrefix has a package.json with a name that matches the package
// being unpublished, load up the publishConfig
if (manifest?.name === spec.name && manifest.publishConfig) {
flatten(manifest.publishConfig, opts)
const cliFlags = this.npm.config.data.get('cli').raw
// Filter out properties set in CLI flags to prioritize them over
// corresponding `publishConfig` settings
const filteredPublishConfig = Object.fromEntries(
Object.entries(manifest.publishConfig).filter(([key]) => !(key in cliFlags)))
flatten(filteredPublishConfig, opts)
}

const versions = await Unpublish.getKeysOfVersions(spec.name, opts)
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/lib/utils/error-message.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { format } = require('util')
const { resolve } = require('path')
const nameValidator = require('validate-npm-package-name')
const { redactLog: replaceInfo } = require('@npmcli/redact')
const { report } = require('./explain-eresolve.js')
const log = require('./log-shim')
Expand Down Expand Up @@ -215,6 +214,7 @@ const errorMessage = (er, npm) => {
detail.push(['404', ''])
detail.push(['404', '', `'${replaceInfo(er.pkgid)}' is not in this registry.`])

const nameValidator = require('validate-npm-package-name')
const valResult = nameValidator(pkg)

if (!valResult.validForNewPackages) {
Expand Down
42 changes: 32 additions & 10 deletions deps/npm/lib/utils/log-file.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const os = require('os')
const { join, dirname, basename } = require('path')
const { format } = require('util')
const { glob } = require('glob')
const { Minipass } = require('minipass')
const fsMiniPass = require('fs-minipass')
const fs = require('fs/promises')
const log = require('./log-shim')
const Display = require('./display')

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

class LogFiles {
// Default to a plain minipass stream so we can buffer
Expand Down Expand Up @@ -199,25 +197,49 @@ class LogFiles {

try {
const logPath = this.#getLogFilePath()
const logGlob = join(dirname(logPath), basename(logPath)
const patternFileName = basename(logPath)
// tell glob to only match digits
.replace(/\d/g, '[0123456789]')
.replace(/\d/g, 'd')
// Handle the old (prior to 8.2.0) log file names which did not have a
// counter suffix
.replace(/-\.log$/, '*.log')
)
.replace('-.log', '')

let files = await fs.readdir(
dirname(logPath), {
withFileTypes: true,
encoding: 'utf-8',
})
files = files.sort((a, b) => basename(a.name).localeCompare(basename(b.name), 'en'))

const logFiles = []

for (const file of files) {
if (!file.isFile()) {
continue
}

const genericFileName = file.name.replace(/\d/g, 'd')
const filePath = join(dirname(logPath), basename(file.name))

// Always ignore the currently written files
if (
genericFileName.includes(patternFileName)
&& genericFileName.endsWith('.log')
&& !this.#files.includes(filePath)
) {
logFiles.push(filePath)
}
}

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

if (toDelete <= 0) {
return
}

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

for (const file of files.slice(0, toDelete)) {
for (const file of logFiles.slice(0, toDelete)) {
try {
await fs.rm(file, { force: true })
} catch (e) {
Expand Down
12 changes: 7 additions & 5 deletions deps/npm/lib/utils/update-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// Check daily for betas, and weekly otherwise.

const ciInfo = require('ci-info')
const semver = require('semver')
const gt = require('semver/functions/gt')
const gte = require('semver/functions/gte')
const parse = require('semver/functions/parse')
const { stat, writeFile } = require('fs/promises')
const { resolve } = require('path')

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

// if we already have something >= the desired spec, then we're done
if (semver.gte(version, latest)) {
if (gte(version, latest)) {
return null
}

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

// if we're on a beta train, always get the next beta
if (current.prerelease.length) {
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-audit.1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Public signing keys are provided at \fBregistry-host.tld/-/npm/v1/keys\fR in the
Keys response:
.RS 0
.IP \(bu 4
\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
\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
.IP \(bu 4
\fBkeydid\fR: sha256 fingerprint of the public key
.IP \(bu 4
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-ls.1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Positional arguments are \fBname@version-range\fR identifiers, which will limit
.P
.RS 2
.nf
npm@10.5.1 /path/to/npm
npm@10.5.2 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
.fi
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ npm
Note: This command is unaware of workspaces.
.SS "Version"
.P
10.5.1
10.5.2
.SS "Description"
.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 conflicts intelligently.
Expand Down
5 changes: 4 additions & 1 deletion deps/npm/node_modules/@npmcli/agent/lib/agents.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions deps/npm/node_modules/@npmcli/agent/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions deps/npm/node_modules/@npmcli/arborist/lib/place-dep.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion deps/npm/node_modules/@npmcli/arborist/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit da532ca

Please sign in to comment.