Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: upgrade npm to 10.7.0 #52767

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 18 additions & 21 deletions deps/npm/bin/npm.ps1
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent

$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
$NODE_EXE="$PSScriptRoot/node.exe"
if (-not (Test-Path $NODE_EXE)) {
$NODE_EXE="$PSScriptRoot/node"
}
$ret=0

$nodeexe = "node$exe"
$nodebin = $(Get-Command $nodeexe -ErrorAction SilentlyContinue -ErrorVariable F).Source
if ($nodebin -eq $null) {
Write-Host "$nodeexe not found."
exit 1
if (-not (Test-Path $NODE_EXE)) {
$NODE_EXE="node"
}
$nodedir = $(New-Object -ComObject Scripting.FileSystemObject).GetFile("$nodebin").ParentFolder.Path

$npmprefixjs="$nodedir/node_modules/npm/bin/npm-prefix.js"
$npmprefix=(& $nodeexe $npmprefixjs)
$NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js"
$NPM_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npm-cli.js"
$NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS)

if ($LASTEXITCODE -ne 0) {
Write-Host "Could not determine Node.js install directory"
exit 1
}
$npmprefixclijs="$npmprefix/node_modules/npm/bin/npm-cli.js"

$NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
if (Test-Path $NPM_PREFIX_NPM_CLI_JS) {
$NPM_CLI_JS=$NPM_PREFIX_NPM_CLI_JS
}

# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & $nodeexe $npmprefixclijs $args
$input | & $NODE_EXE $NPM_CLI_JS $args
} else {
& $nodeexe $npmprefixclijs $args
& $NODE_EXE $NPM_CLI_JS $args
}
$ret=$LASTEXITCODE
exit $ret

exit $LASTEXITCODE
2 changes: 1 addition & 1 deletion deps/npm/bin/npx-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const removed = new Set([

const { definitions, shorthands } = require('@npmcli/config/lib/definitions')
const npmSwitches = Object.entries(definitions)
.filter(([key, { type }]) => type === Boolean ||
.filter(([, { type }]) => type === Boolean ||
(Array.isArray(type) && type.includes(Boolean)))
.map(([key]) => key)

Expand Down
39 changes: 18 additions & 21 deletions deps/npm/bin/npx.ps1
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent

$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
$NODE_EXE="$PSScriptRoot/node.exe"
if (-not (Test-Path $NODE_EXE)) {
$NODE_EXE="$PSScriptRoot/node"
}
$ret=0

$nodeexe = "node$exe"
$nodebin = $(Get-Command $nodeexe -ErrorAction SilentlyContinue -ErrorVariable F).Source
if ($nodebin -eq $null) {
Write-Host "$nodeexe not found."
exit 1
if (-not (Test-Path $NODE_EXE)) {
$NODE_EXE="node"
}
$nodedir = $(New-Object -ComObject Scripting.FileSystemObject).GetFile("$nodebin").ParentFolder.Path

$npmprefixjs="$nodedir/node_modules/npm/bin/npm-prefix.js"
$npmprefix=(& $nodeexe $npmprefixjs)
$NPM_PREFIX_JS="$PSScriptRoot/node_modules/npm/bin/npm-prefix.js"
$NPX_CLI_JS="$PSScriptRoot/node_modules/npm/bin/npx-cli.js"
$NPM_PREFIX=(& $NODE_EXE $NPM_PREFIX_JS)

if ($LASTEXITCODE -ne 0) {
Write-Host "Could not determine Node.js install directory"
exit 1
}
$npmprefixclijs="$npmprefix/node_modules/npm/bin/npx-cli.js"

$NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
if (Test-Path $NPM_PREFIX_NPX_CLI_JS) {
$NPX_CLI_JS=$NPM_PREFIX_NPX_CLI_JS
}

# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & $nodeexe $npmprefixclijs $args
$input | & $NODE_EXE $NPX_CLI_JS $args
} else {
& $nodeexe $npmprefixclijs $args
& $NODE_EXE $NPX_CLI_JS $args
}
$ret=$LASTEXITCODE
exit $ret

exit $LASTEXITCODE
2 changes: 1 addition & 1 deletion deps/npm/docs/content/commands/npm-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Set access level on published packages
### Synopsis

```bash
npm access list packages [<user>|<scope>|<scope:team> [<package>]
npm access list packages [<user>|<scope>|<scope:team>] [<package>]
npm access list collaborators [<package> [<user>]]
npm access get status [<package>]
npm access set status=public|private [<package>]
Expand Down
21 changes: 11 additions & 10 deletions deps/npm/docs/content/commands/npm-doctor.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Check the health of your npm environment
### Synopsis

```bash
npm doctor [ping] [registry] [versions] [environment] [permissions] [cache]
npm doctor [connection] [registry] [versions] [environment] [permissions] [cache]
```

Note: This command is unaware of workspaces.
Expand Down Expand Up @@ -38,20 +38,21 @@ there are any recommended changes, it will display them. By default npm
runs all of these checks. You can limit what checks are ran by
specifying them as extra arguments.

#### `npm ping`
#### `Connecting to the registry`

By default, npm installs from the primary npm registry,
`registry.npmjs.org`. `npm doctor` hits a special ping endpoint within the
registry. This can also be checked with `npm ping`. If this check fails,
you may be using a proxy that needs to be configured, or may need to talk
to your IT staff to get access over HTTPS to `registry.npmjs.org`.
`registry.npmjs.org`. `npm doctor` hits a special connection testing
endpoint within the registry. This can also be checked with `npm ping`.
If this check fails, you may be using a proxy that needs to be
configured, or may need to talk to your IT staff to get access over
HTTPS to `registry.npmjs.org`.

This check is done against whichever registry you've configured (you can
see what that is by running `npm config get registry`), and if you're using
a private registry that doesn't support the `/whoami` endpoint supported by
the primary registry, this check may fail.

#### `npm -v`
#### `Checking npm version`

While Node.js may come bundled with a particular version of npm, it's the
policy of the CLI team that we recommend all users run `npm@latest` if they
Expand All @@ -61,7 +62,7 @@ support releases typically only receive critical security and regression
fixes. The team believes that the latest tested version of npm is almost
always likely to be the most functional and defect-free version of npm.

#### `node -v`
#### `Checking node version`

For most users, in most circumstances, the best version of Node will be the
latest long-term support (LTS) release. Those of you who want access to new
Expand All @@ -70,7 +71,7 @@ be running a newer version, and some may be required to run an older
version of Node because of enterprise change control policies. That's OK!
But in general, the npm team recommends that most users run Node.js LTS.

#### `npm config get registry`
#### `Checking configured npm registry`

You may be installing from private package registries for your project or
company. That's great! Others may be following tutorials or StackOverflow
Expand All @@ -79,7 +80,7 @@ Sometimes, this may entail changing the registry you're pointing at. This
part of `npm doctor` just lets you, and maybe whoever's helping you with
support, know that you're not using the default registry.

#### `which git`
#### `Checking for git executable in PATH`

While it's documented in the README, it may not be obvious that npm needs
Git installed to do many of the things that it does. Also, in some cases
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.2 /path/to/npm
npm@10.7.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
Expand Down
33 changes: 11 additions & 22 deletions deps/npm/docs/content/commands/npm-profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,17 @@ support this interface.
* `npm profile get [<property>]`: Display all of the properties of your
profile, or one or more specific properties. It looks like:

```bash
+-----------------+---------------------------+
| name | example |
+-----------------+---------------------------+
| email | me@example.com (verified) |
+-----------------+---------------------------+
| two factor auth | auth-and-writes |
+-----------------+---------------------------+
| fullname | Example User |
+-----------------+---------------------------+
| homepage | |
+-----------------+---------------------------+
| freenode | |
+-----------------+---------------------------+
| twitter | |
+-----------------+---------------------------+
| github | |
+-----------------+---------------------------+
| created | 2015-02-26T01:38:35.892Z |
+-----------------+---------------------------+
| updated | 2017-10-02T21:29:45.922Z |
+-----------------+---------------------------+
```
name: example
email: e@example.com (verified)
two-factor auth: auth-and-writes
fullname: Example User
homepage:
freenode:
twitter:
github:
created: 2015-02-26T01:38:35.892Z
updated: 2017-10-02T21:29:45.922Z
```

* `npm profile set <property> <value>`: Set the value of a profile
Expand Down
11 changes: 1 addition & 10 deletions deps/npm/docs/content/commands/npm-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Search for packages
### Synopsis

```bash
npm search [search terms ...]
npm search <search term> [<search term> ...]

aliases: find, s, se
```
Expand Down Expand Up @@ -39,15 +39,6 @@ expression characters in most shells.)

### Configuration

#### `long`

* Default: false
* Type: Boolean

Show extended information in `ls`, `search`, and `help-search`.



#### `json`

* Default: false
Expand Down
38 changes: 10 additions & 28 deletions deps/npm/docs/content/commands/npm-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,14 @@ This lets you list, create and revoke authentication tokens.
Shows a table of all active authentication tokens. You can request
this as JSON with `--json` or tab-separated values with `--parseable`.

```bash
+--------+---------+------------+----------+----------------+
| id | token | created | read-only | CIDR whitelist |
+--------+---------+------------+----------+----------------+
| 7f3134 | 1fa9ba… | 2017-10-02 | yes | |
+--------+---------+------------+----------+----------------+
| c03241 | af7aef… | 2017-10-02 | no | 192.168.0.1/24 |
+--------+---------+------------+----------+----------------+
| e0cf92 | 3a436a… | 2017-10-02 | no | |
+--------+---------+------------+----------+----------------+
| 63eb9d | 74ef35… | 2017-09-28 | no | |
+--------+---------+------------+----------+----------------+
| 2daaa8 | cbad5f… | 2017-09-26 | no | |
+--------+---------+------------+----------+----------------+
| 68c2fe | 127e51… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
| 6334e1 | 1dadd1… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
```
Read only token npm_1f… with id 7f3134 created 2017-10-21

Publish token npm_af… with id c03241 created 2017-10-02
with IP Whitelist: 192.168.0.1/24

Publish token npm_… with id e0cf92 created 2017-10-02

```

* `npm token create [--read-only] [--cidr=<cidr-ranges>]`:
Expand All @@ -55,16 +45,8 @@ This lets you list, create and revoke authentication tokens.
website](https://docs.npmjs.com/creating-and-viewing-access-tokens)
for more information on generating automation tokens.

```bash
+----------------+--------------------------------------+
| token | a73c9572-f1b9-8983-983d-ba3ac3cc913d |
+----------------+--------------------------------------+
| cidr_whitelist | |
+----------------+--------------------------------------+
| readonly | false |
+----------------+--------------------------------------+
| created | 2017-10-02T07:52:24.838Z |
+----------------+--------------------------------------+
```
Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
```

* `npm token revoke <token|id>`:
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.2
10.7.0

### Description

Expand Down
7 changes: 7 additions & 0 deletions deps/npm/docs/content/configuring-npm/package-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,13 @@ Overrides provide a way to replace a package in your dependency tree with
another version, or another package entirely. These changes can be scoped as
specific or as vague as desired.

Overrides are only considered in the root `package.json` file for a project.
Overrides in installed dependencies (including
[workspaces](/using-npm/workspaces)) are not considered in dependency tree
resolution. Published packages may dictate their resolutions by pinning
dependencies or using an
[`npm-shrinkwrap.json`](/configuring-npm/npm-shrinkwrap-json) file.

To make sure the package `foo` is always installed as version `1.0.0` no matter
what version your dependencies rely on:

Expand Down
2 changes: 2 additions & 0 deletions deps/npm/docs/content/configuring-npm/package-lock-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ various purposes:
picture of the package tree, reducing the need to read `package.json`
files, and allowing for significant performance improvements.

When `npm` creates or updates `package-lock.json`, it will infer line endings and indentation from `package.json` so that the formatting of both files matches.

### `package-lock.json` vs `npm-shrinkwrap.json`

Both of these files have the same format, and perform similar functions in
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const replaceConfig = (src, { path }) => {
}

const allConfig = Object.entries(definitions).sort(sort)
.map(([_, def]) => def.describe())
.map(([, def]) => def.describe())
.join('\n\n')

return src.replace(replacer, allConfig)
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-access.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h2 id="table-of-contents">Table of contents</h2>
</section>

<div id="_content"><h3 id="synopsis">Synopsis</h3>
<pre><code class="language-bash">npm access list packages [&lt;user&gt;|&lt;scope&gt;|&lt;scope:team&gt; [&lt;package&gt;]
<pre><code class="language-bash">npm access list packages [&lt;user&gt;|&lt;scope&gt;|&lt;scope:team&gt;] [&lt;package&gt;]
npm access list collaborators [&lt;package&gt; [&lt;user&gt;]]
npm access get status [&lt;package&gt;]
npm access set status=public|private [&lt;package&gt;]
Expand Down
Loading
Loading