Skip to content

Commit

Permalink
deps: upgrade npm to 9.8.0
Browse files Browse the repository at this point in the history
PR-URL: #48665
Reviewed-By: Luke Karrys <luke@lukekarrys.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
  • Loading branch information
npm-cli-bot authored and juanarbol committed Jul 13, 2023
1 parent 999ae0c commit 150e155
Show file tree
Hide file tree
Showing 135 changed files with 941 additions and 570 deletions.
27 changes: 22 additions & 5 deletions deps/npm/bin/npm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
IS_WSL="true"
fi

function no_node_dir {
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
}

NODE_EXE="$basedir/node.exe"
if ! [ -x "$NODE_EXE" ]; then
NODE_EXE="$basedir/node"
Expand All @@ -21,13 +31,20 @@ fi

# this path is passed to node.exe, so it needs to match whatever
# kind of paths Node.js thinks it's using, typically win32 paths.
CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)')"
CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)' 2> /dev/null)"
if [ $? -ne 0 ]; then
# this fails under WSL 1 so add an additional message. we also suppress stderr above
# because the actual error raised is not helpful. in WSL 1 node.exe cannot handle
# output redirection properly. See https://github.com/microsoft/WSL/issues/2370
if [ "$IS_WSL" == "true" ]; then
echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2
fi
no_node_dir
fi
NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js"
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
if [ $? -ne 0 ]; then
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
no_node_dir
fi
NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"

Expand All @@ -37,7 +54,7 @@ NPM_WSL_PATH="/.."
# WSL can run Windows binaries, so we have to give it the win32 path
# however, WSL bash tests against posix paths, so we need to construct that
# to know if npm is installed globally.
if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
if [ "$IS_WSL" == "true" ]; then
NPM_WSL_PATH=`wslpath "$NPM_PREFIX_NPM_CLI_JS"`
fi
if [ -f "$NPM_PREFIX_NPM_CLI_JS" ] || [ -f "$NPM_WSL_PATH" ]; then
Expand Down
35 changes: 35 additions & 0 deletions deps/npm/bin/npm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/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"
}
$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
}
$nodedir = $(New-Object -ComObject Scripting.FileSystemObject).GetFile("$nodebin").ParentFolder.Path

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

# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & $nodeexe $npmprefixclijs $args
} else {
& $nodeexe $npmprefixclijs $args
}
$ret=$LASTEXITCODE
exit $ret
27 changes: 22 additions & 5 deletions deps/npm/bin/npx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
IS_WSL="true"
fi

function no_node_dir {
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
}

NODE_EXE="$basedir/node.exe"
if ! [ -x "$NODE_EXE" ]; then
NODE_EXE="$basedir/node"
Expand All @@ -21,14 +31,21 @@ fi

# this path is passed to node.exe, so it needs to match whatever
# kind of paths Node.js thinks it's using, typically win32 paths.
CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)')"
CLI_BASEDIR="$("$NODE_EXE" -p 'require("path").dirname(process.execPath)' 2> /dev/null)"
if [ $? -ne 0 ]; then
# this fails under WSL 1 so add an additional message. we also suppress stderr above
# because the actual error raised is not helpful. in WSL 1 node.exe cannot handle
# output redirection properly. See https://github.com/microsoft/WSL/issues/2370
if [ "$IS_WSL" == "true" ]; then
echo "WSL 1 is not supported. Please upgrade to WSL 2 or above." >&2
fi
no_node_dir
fi
NPM_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npm-cli.js"
NPX_CLI_JS="$CLI_BASEDIR/node_modules/npm/bin/npx-cli.js"
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
if [ $? -ne 0 ]; then
# if this didn't work, then everything else below will fail
echo "Could not determine Node.js install directory" >&2
exit 1
no_node_dir
fi
NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"

Expand All @@ -38,7 +55,7 @@ NPX_WSL_PATH="/.."
# WSL can run Windows binaries, so we have to give it the win32 path
# however, WSL bash tests against posix paths, so we need to construct that
# to know if npm is installed globally.
if [ `uname` = 'Linux' ] && type wslpath &>/dev/null ; then
if [ "$IS_WSL" == "true" ]; then
NPX_WSL_PATH=`wslpath "$NPM_PREFIX_NPX_CLI_JS"`
fi
if [ -f "$NPM_PREFIX_NPX_CLI_JS" ] || [ -f "$NPX_WSL_PATH" ]; then
Expand Down
35 changes: 35 additions & 0 deletions deps/npm/bin/npx.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/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"
}
$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
}
$nodedir = $(New-Object -ComObject Scripting.FileSystemObject).GetFile("$nodebin").ParentFolder.Path

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

# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & $nodeexe $npmprefixclijs $args
} else {
& $nodeexe $npmprefixclijs $args
}
$ret=$LASTEXITCODE
exit $ret
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@9.7.2 /path/to/npm
npm@9.8.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
Expand Down
8 changes: 8 additions & 0 deletions deps/npm/docs/content/commands/npm-pkg.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ npm pkg get [<key> [<key> ...]]
npm pkg delete <key> [<key> ...]
npm pkg set [<array>[<index>].<key>=<value> ...]
npm pkg set [<array>[].<key>=<value> ...]
npm pkg fix
```
### Description
Expand Down Expand Up @@ -141,6 +142,13 @@ Returned values are always in **json** format.
npm pkg delete scripts.build
```
* `npm pkg fix`
Auto corrects common errors in your `package.json`. npm already
does this during `publish`, which leads to subtle (mostly harmless)
differences between the contents of your `package.json` file and the
manifest that npm uses during installation.
### Workspaces support
You can set/get/delete items across your configured workspaces by using the
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

9.7.2
9.8.0

### 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">npm@9.7.2 /path/to/npm
<pre><code class="language-bash">npm@9.8.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
8 changes: 8 additions & 0 deletions deps/npm/docs/output/commands/npm-pkg.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ <h2 id="table-of-contents">Table of contents</h2>
npm pkg delete &lt;key&gt; [&lt;key&gt; ...]
npm pkg set [&lt;array&gt;[&lt;index&gt;].&lt;key&gt;=&lt;value&gt; ...]
npm pkg set [&lt;array&gt;[].&lt;key&gt;=&lt;value&gt; ...]
npm pkg fix
</code></pre>
<h3 id="description">Description</h3>
<p>A command that automates the management of <code>package.json</code> files.
Expand Down Expand Up @@ -236,6 +237,13 @@ <h3 id="description">Description</h3>
<pre><code class="language-bash">npm pkg delete scripts.build
</code></pre>
</li>
<li>
<p><code>npm pkg fix</code></p>
<p>Auto corrects common errors in your <code>package.json</code>. npm already
does this during <code>publish</code>, which leads to subtle (mostly harmless)
differences between the contents of your <code>package.json</code> file and the
manifest that npm uses during installation.</p>
</li>
</ul>
<h3 id="workspaces-support">Workspaces support</h3>
<p>You can set/get/delete items across your configured workspaces by using the
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>9.7.2</p>
<p>9.8.0</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
8 changes: 8 additions & 0 deletions deps/npm/lib/commands/pkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Pkg extends BaseCommand {
'delete <key> [<key> ...]',
'set [<array>[<index>].<key>=<value> ...]',
'set [<array>[].<key>=<value> ...]',
'fix',
]

static params = [
Expand Down Expand Up @@ -45,6 +46,8 @@ class Pkg extends BaseCommand {
return this.set(_args)
case 'delete':
return this.delete(_args)
case 'fix':
return this.fix(_args)
default:
throw this.usageError()
}
Expand Down Expand Up @@ -136,6 +139,11 @@ class Pkg extends BaseCommand {
pkgJson.update(q.toJSON())
await pkgJson.save()
}

async fix () {
const pkgJson = await PackageJson.fix(this.prefix)
await pkgJson.save()
}
}

module.exports = Pkg
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-access.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-ACCESS" "1" "June 2023" "" ""
.TH "NPM-ACCESS" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-access\fR - Set access level on published packages
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-adduser.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-ADDUSER" "1" "June 2023" "" ""
.TH "NPM-ADDUSER" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-adduser\fR - Add a registry user account
.SS "Synopsis"
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
@@ -1,4 +1,4 @@
.TH "NPM-AUDIT" "1" "June 2023" "" ""
.TH "NPM-AUDIT" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-audit\fR - Run a security audit
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-bugs.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-BUGS" "1" "June 2023" "" ""
.TH "NPM-BUGS" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-bugs\fR - Report bugs for a package in a web browser
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-cache.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-CACHE" "1" "June 2023" "" ""
.TH "NPM-CACHE" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-cache\fR - Manipulates packages cache
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-ci.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-CI" "1" "June 2023" "" ""
.TH "NPM-CI" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-ci\fR - Clean install a project
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-completion.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-COMPLETION" "1" "June 2023" "" ""
.TH "NPM-COMPLETION" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-completion\fR - Tab Completion for npm
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-config.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-CONFIG" "1" "June 2023" "" ""
.TH "NPM-CONFIG" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-config\fR - Manage the npm configuration files
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-dedupe.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DEDUPE" "1" "June 2023" "" ""
.TH "NPM-DEDUPE" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-dedupe\fR - Reduce duplication in the package tree
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-deprecate.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DEPRECATE" "1" "June 2023" "" ""
.TH "NPM-DEPRECATE" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-deprecate\fR - Deprecate a version of a package
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-diff.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DIFF" "1" "June 2023" "" ""
.TH "NPM-DIFF" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-diff\fR - The registry diff command
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-dist-tag.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DIST-TAG" "1" "June 2023" "" ""
.TH "NPM-DIST-TAG" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-dist-tag\fR - Modify package distribution tags
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-docs.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DOCS" "1" "June 2023" "" ""
.TH "NPM-DOCS" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-docs\fR - Open documentation for a package in a web browser
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-doctor.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-DOCTOR" "1" "June 2023" "" ""
.TH "NPM-DOCTOR" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-doctor\fR - Check your npm environment
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-edit.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-EDIT" "1" "June 2023" "" ""
.TH "NPM-EDIT" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-edit\fR - Edit an installed package
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-exec.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-EXEC" "1" "June 2023" "" ""
.TH "NPM-EXEC" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-exec\fR - Run a command from a local or remote npm package
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-explain.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-EXPLAIN" "1" "June 2023" "" ""
.TH "NPM-EXPLAIN" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-explain\fR - Explain installed packages
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-explore.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-EXPLORE" "1" "June 2023" "" ""
.TH "NPM-EXPLORE" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-explore\fR - Browse an installed package
.SS "Synopsis"
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/man/man1/npm-find-dupes.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH "NPM-FIND-DUPES" "1" "June 2023" "" ""
.TH "NPM-FIND-DUPES" "1" "July 2023" "" ""
.SH "NAME"
\fBnpm-find-dupes\fR - Find duplication in the package tree
.SS "Synopsis"
Expand Down
Loading

0 comments on commit 150e155

Please sign in to comment.