From 95cd0f803d7bd3c3d366710d80f621feaf0a1e67 Mon Sep 17 00:00:00 2001
From: Darcy Clarke This will set a registry for the given scope and login or create a user for
that registry at the same time. Default: false If specified, save configuration indicating that all requests to the given
-registry should include authorization information. Useful for private
-registries. Can be used with This will ensure that all requests to that registry (including for tarballs)
-include an authorization header. This setting may be necessary for use with
-private registries where metadata and package tarballs are stored on hosts with
-different hostnames. See add:
-Add the specified package to the local cache. This command is primarily
+Add the specified packages to the local cache. This command is primarily
intended to be used internally by npm, but it can provide a way to
add data to the local installation cache explicitly. This command is similar to This command is similar to Using npm-adduser
Table of contents
-
+
Synopsis
-npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy]
+
@@ -177,17 +177,6 @@ npm adduser [--registry=url] [--scope=@orgname] [--auth-type=legacy]
aliases: login, add-user
scope
always-auth
---registry
and / or --scope
, e.g.
-npm adduser --registry=http://private-registry.example.com --always-auth
-
always-auth
in config
for more details on always-auth. Registry-specific configuration of always-auth
takes precedence over any global configuration.auth-type
'legacy'
Table of contents
Synopsis
-npm cache add <tarball file>
-npm cache add <folder>
-npm cache add <tarball url>
-npm cache add <name>@<version>
+
npm cache add <tarball file>...
+npm cache add <folder>...
+npm cache add <tarball url>...
+npm cache add <name>@<version>...
npm cache clean
aliases: npm cache clear, npm cache rm
@@ -161,7 +161,7 @@
Description
Table of contents
npm ci
Description
-npm install
, except
+npm install
, except
it’s meant to be used in automated environments such as test platforms,
continuous integration, and deployment – or any situation where you want
to make sure you’re doing a clean install of your dependencies.Description
npm find-dupes
will run the command in --dry-run
mode.See Also
See Also
Table of contents
npm exec --package=<pkg>[@<version>] -- <cmd> [args...]
npm exec -c '<cmd> [args...]'
npm exec --package=foo -c '<cmd> [args...]'
-npm exec [-ws] [-w <workspace-name] [args...]
+npm exec [--ws] [-w <workspace-name] [args...]
npx <pkg>[@<specifier>] [args...]
npx -p <pkg>[@<specifier>] <cmd> [args...]
@@ -276,7 +276,7 @@ Workspaces support
the configured workspaces when using the workspaces
configuration options,
in this example we’re using eslint to lint any js file found within each
workspace folder:
npm exec -ws -- eslint ./*.js
+npm exec --ws -- eslint ./*.js
Filtering workspaces
It’s also possible to execute a command in a single workspace using the
@@ -348,7 +348,7 @@
workspace
workspaces
-- Alias:
-ws
+- Alias:
--ws
- Type: Boolean
- Default:
false
@@ -363,6 +363,7 @@ See Also
npm restart
npm stop
npm config
+npm workspaces
diff --git a/deps/npm/docs/output/commands/npm-explore.html b/deps/npm/docs/output/commands/npm-explore.html
index cd52ff96a68486a..8d1e2843d73effa 100644
--- a/deps/npm/docs/output/commands/npm-explore.html
+++ b/deps/npm/docs/output/commands/npm-explore.html
@@ -171,7 +171,6 @@ See Also
npm folders
npm edit
npm rebuild
-npm build
npm install
diff --git a/deps/npm/docs/output/commands/npm-find-dupes.html b/deps/npm/docs/output/commands/npm-find-dupes.html
index 32d8993b99cc4d8..7f7f3c101b258a1 100644
--- a/deps/npm/docs/output/commands/npm-find-dupes.html
+++ b/deps/npm/docs/output/commands/npm-find-dupes.html
@@ -152,10 +152,10 @@ Description
duplications, without actually changing the package tree.
See Also
diff --git a/deps/npm/docs/output/commands/npm-init.html b/deps/npm/docs/output/commands/npm-init.html
index 62dc20093b2e94d..1aa0408baff8f5c 100644
--- a/deps/npm/docs/output/commands/npm-init.html
+++ b/deps/npm/docs/output/commands/npm-init.html
@@ -141,29 +141,29 @@ npm-init
Table of contents
-
+
Synopsis
npm init [--force|-f|--yes|-y|--scope]
-npm init <@scope> (same as `npx <@scope>/create`)
-npm init [<@scope>/]<name> (same as `npx [<@scope>/]create-<name>`)
+npm init <@scope> (same as `npm exec <@scope>/create`)
+npm init [<@scope>/]<name> (same as `npm exec [<@scope>/]create-<name>`)
+npm init [-w <dir>] [args...]
Description
npm init <initializer>
can be used to set up a new or existing npm
package.
initializer
in this case is an npm package named create-<initializer>
,
-which will be installed by npx
, and then have its
+which will be installed by npm-exec
, and then have its
main bin executed – presumably creating or updating package.json
and
running any other initialization-related operations.
-The init command is transformed to a corresponding npx
operation as
+
The init command is transformed to a corresponding npm exec
operation as
follows:
-npm init foo
-> npx create-foo
-npm init @usr/foo
-> npx @usr/create-foo
-npm init @usr
-> npx @usr/create
+npm init foo
-> npm exec create-foo
+npm init @usr/foo
-> npm exec @usr/create-foo
+npm init @usr
-> npm exec @usr/create
-Any additional options will be passed directly to the command, so npm init foo -- --hello
will map to npx create-foo --hello
.
If the initializer is omitted (by just calling npm init
), init will fall
back to legacy init behavior. It will ask you a bunch of questions, and
then write a package.json for you. It will attempt to make reasonable
@@ -171,6 +171,15 @@
Description
strictly additive, so it will keep any fields and values that were already
set. You can also use -y
/--yes
to skip the questionnaire altogether. If
you pass --scope
, it will create a scoped package.
+Forwarding additional options
+Any additional options will be passed directly to the command, so npm init foo -- --hello
will map to npm exec -- create-foo --hello
.
+To better illustrate how options are forwarded, here’s a more evolved
+example showing options passed to both the npm cli and a create package,
+both following commands are equivalent:
+
+npm init foo -y --registry=<url> -- --hello -a
+npm exec -y --registry=<url> -- create-foo --hello -a
+
Examples
Create a new React-based project using
create-react-app
:
@@ -189,6 +198,51 @@ Examples
Generate it without having it ask any questions:
$ npm init -y
+Workspaces support
+It’s possible to create a new workspace within your project by using the
+workspace
config option. When using npm init -w <dir>
the cli will
+create the folders and boilerplate expected while also adding a reference
+to your project package.json
"workspaces": []
property in order to make
+sure that new generated workspace is properly set up as such.
+Given a project with no workspaces, e.g:
+.
++-- package.json
+
+You may generate a new workspace using the legacy init:
+$ npm init -w packages/a
+
+That will generate a new folder and package.json
file, while also updating
+your top-level package.json
to add the reference to this new workspace:
+.
++-- package.json
+`-- packages
+ `-- a
+ `-- package.json
+
+The workspaces init also supports the npm init <initializer> -w <dir>
+syntax, following the same set of rules explained earlier in the initial
+Description section of this page. Similar to the previous example of
+creating a new React-based project using
+create-react-app
, the following syntax
+will make sure to create the new react app as a nested workspace within your
+project and configure your package.json
to recognize it as such:
+npm init -w packages/my-react-app react-app .
+
+This will make sure to generate your react app as expected, one important
+consideration to have in mind is that npm exec
is going to be run in the
+context of the newly created folder for that workspace, and that’s the reason
+why in this example the initializer uses the initializer name followed with a
+dot to represent the current directory in that context, e.g: react-app .
:
+.
++-- package.json
+`-- packages
+ +-- a
+ | `-- package.json
+ `-- my-react-app
+ +-- README
+ +-- package.json
+ `-- ...
+
A note on caching
The npm cli utilizes its internal package cache when using the package
name specified. You can use the following to change how and when the
@@ -203,6 +257,31 @@
prefer-offline
offline
Forces full offline mode. Any packages not locally cached will result in
an error.
+workspace
+
+- Alias:
-w
+- Type: Array
+- Default:
[]
+
+Enable running npm init
in the context of workspaces, creating any missing
+folders, generating files and adding/updating the "workspaces"
property of
+the project package.json
.
+the provided names or paths provided.
+Valid values for the workspace
config are either:
+
+- Workspace names
+- Path to a workspace directory
+- Path to a parent workspace directory (will result to selecting all of the
+children workspaces)
+
+workspaces
+
+- Alias:
-ws
+- Type: Boolean
+- Default:
false
+
+Run npm init
in the context of all configured workspaces for the
+current project.
See Also
- init-package-json module
@@ -210,6 +289,7 @@ See Also
- npm version
- npm scope
- npm exec
+- npm workspaces
diff --git a/deps/npm/docs/output/commands/npm-install.html b/deps/npm/docs/output/commands/npm-install.html
index 2794b9a983d04ce..8fff20fe836fad7 100644
--- a/deps/npm/docs/output/commands/npm-install.html
+++ b/deps/npm/docs/output/commands/npm-install.html
@@ -614,7 +614,6 @@ See Also
npm link
npm rebuild
npm scripts
-npm build
npm config
npmrc
npm registry
diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html
index 5e2f75138a62b9e..d11c865c9d96ad8 100644
--- a/deps/npm/docs/output/commands/npm-ls.html
+++ b/deps/npm/docs/output/commands/npm-ls.html
@@ -159,7 +159,7 @@ Description
the results to only the paths to the packages named. Note that nested
packages will also show the paths to the specified packages. For
example, running npm ls promzard
in npm’s source tree will show:
-npm@7.10.0 /path/to/npm
+npm@7.12.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
diff --git a/deps/npm/docs/output/commands/npm-run-script.html b/deps/npm/docs/output/commands/npm-run-script.html
index 6fc343dfbaf5f9c..1e47bfec108529e 100644
--- a/deps/npm/docs/output/commands/npm-run-script.html
+++ b/deps/npm/docs/output/commands/npm-run-script.html
@@ -282,7 +282,7 @@ workspace
workspaces
-- Alias:
-ws
+- Alias:
--ws
- Type: Boolean
- Default:
false
@@ -296,6 +296,7 @@ See Also
npm restart
npm stop
npm config
+npm workspaces
diff --git a/deps/npm/docs/output/commands/npm-unpublish.html b/deps/npm/docs/output/commands/npm-unpublish.html
index 75751d3408cfa18..737d5336c83b6e6 100644
--- a/deps/npm/docs/output/commands/npm-unpublish.html
+++ b/deps/npm/docs/output/commands/npm-unpublish.html
@@ -159,7 +159,7 @@ Warning
Description
This removes a package version from the registry, deleting its entry and
removing the tarball.
-The npm registry will return an error if you are not logged
+The npm registry will return an error if you are not logged
in.
If you do not specify a version or if you remove all of a package’s
versions then the registry will remove the root package entry entirely.
@@ -175,7 +175,7 @@ See Also
npm registry
npm adduser
npm owner
-npm login
+npm login
diff --git a/deps/npm/docs/output/commands/npm-view.html b/deps/npm/docs/output/commands/npm-view.html
index d3a1251673c2b67..77786b74fd8c92e 100644
--- a/deps/npm/docs/output/commands/npm-view.html
+++ b/deps/npm/docs/output/commands/npm-view.html
@@ -141,7 +141,7 @@ npm-view
Table of contents
-
+
Synopsis
@@ -186,7 +186,7 @@ Description
“Person” fields are shown as a string if they would be shown as an
object. So, for example, this will show the list of npm
contributors in
-the shortened string format. (See package.json
for more on this.)
+the shortened string format. (See package.json
for more on this.)
npm view npm contributors
If a version range is provided, then data will be printed for every
@@ -198,6 +198,17 @@
Description
this:
npm view connect versions
+Configuration
+json
+Show information in JSON format. See Output
below.
+workspaces
+Enables workspaces context while searching the package.json
in the
+current folder. Information about packages named in each workspace will
+be viewed.
+workspace
+Enables workspaces context and limits results to only those specified by
+this config item. Only the information about packages named in the
+workspaces given here will be viewed.
Output
If only a single string field for a single version is output, then it
will not be colorized or quoted, to enable piping the output to
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index dde689df3ee3876..405d56f623b5742 100644
--- a/deps/npm/docs/output/commands/npm.html
+++ b/deps/npm/docs/output/commands/npm.html
@@ -148,7 +148,7 @@
Table of contents
npm <command> [args]
Version
-7.10.0
+7.12.0
Description
npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
@@ -222,7 +222,7 @@
Developer Usage
Create an account or log in. When you do this, npm will store
credentials in the user config file config file.
publish:
-Use the npm publish
command to upload your
+Use the npm publish
command to upload your
code to the registry.
Configuration
diff --git a/deps/npm/docs/output/configuring-npm/folders.html b/deps/npm/docs/output/configuring-npm/folders.html
index 20027ea3a9f41ba..6cdae3cd1eca018 100644
--- a/deps/npm/docs/output/configuring-npm/folders.html
+++ b/deps/npm/docs/output/configuring-npm/folders.html
@@ -292,7 +292,7 @@ Publishing
not be included in the package tarball.
This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re-publish those items that
-cannot be found elsewhere. See package.json
for more information.
+cannot be found elsewhere. See package.json
for more information.
See also
- package.json
diff --git a/deps/npm/docs/output/configuring-npm/package-json.html b/deps/npm/docs/output/configuring-npm/package-json.html
index 9c58ebf85f6a592..f9c3ee6e4f5b83b 100644
--- a/deps/npm/docs/output/configuring-npm/package-json.html
+++ b/deps/npm/docs/output/configuring-npm/package-json.html
@@ -435,6 +435,7 @@ bin
Please make sure that your file(s) referenced in bin
starts with
#!/usr/bin/env node
, otherwise the scripts are started without the node
executable!
+Note that you can also set the executable files using directories.bin.
man
Specify either a single file or an array of filenames to put in place for
the man
program to find.
@@ -566,7 +567,7 @@ dependencies
tarball or git URL.
Please do not put test harnesses or transpilers or other “development”
time tools in your dependencies
object. See devDependencies
, below.
-See semver for more details about specifying version ranges.
+See semver for more details about specifying version ranges.
version
Must match version
exactly
>version
Must be greater than version
diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html
index 5599777347b3a1e..881080eb121c06a 100644
--- a/deps/npm/docs/output/using-npm/config.html
+++ b/deps/npm/docs/output/using-npm/config.html
@@ -141,7 +141,7 @@ config
Table of contents
-- Description
- Shorthands and Other CLI Niceties
- Config Settings
_auth
access
all
allow-same-version
always-auth
audit
audit-level
before
bin-links
browser
ca
cache
cafile
call
cert
ci-name
cidr
color
commit-hooks
depth
description
diff
diff-dst-prefix
diff-ignore-all-space
diff-name-only
diff-no-prefix
diff-src-prefix
diff-text
diff-unified
dry-run
editor
engine-strict
fetch-retries
fetch-retry-factor
fetch-retry-maxtimeout
fetch-retry-mintimeout
fetch-timeout
force
foreground-scripts
format-package-lock
fund
git
git-tag-version
global
global-style
globalconfig
heading
https-proxy
if-present
ignore-scripts
include
include-staged
init-author-email
init-author-name
init-author-url
init-license
init-module
init-version
json
key
legacy-bundling
legacy-peer-deps
link
local-address
loglevel
logs-max
long
maxsockets
message
node-options
node-version
noproxy
npm-version
offline
omit
otp
package
package-lock
package-lock-only
parseable
prefer-offline
prefer-online
prefix
preid
progress
proxy
read-only
rebuild-bundle
registry
save
save-bundle
save-dev
save-exact
save-optional
save-peer
save-prefix
save-prod
scope
script-shell
searchexclude
searchlimit
searchopts
searchstaleness
shell
sign-git-commit
sign-git-tag
strict-peer-deps
strict-ssl
tag
tag-version-prefix
timing
umask
unicode
update-notifier
usage
user-agent
userconfig
version
versions
viewer
which
workspace
workspaces
yes
also
auth-type
cache-max
cache-min
dev
init.author.email
init.author.name
init.author.url
init.license
init.module
init.version
only
optional
production
shrinkwrap
sso-poll-frequency
sso-type
tmp
- See also
+- Description
- Shorthands and Other CLI Niceties
- Config Settings
_auth
access
all
allow-same-version
audit
audit-level
before
bin-links
browser
ca
cache
cafile
call
cert
ci-name
cidr
color
commit-hooks
depth
description
diff
diff-dst-prefix
diff-ignore-all-space
diff-name-only
diff-no-prefix
diff-src-prefix
diff-text
diff-unified
dry-run
editor
engine-strict
fetch-retries
fetch-retry-factor
fetch-retry-maxtimeout
fetch-retry-mintimeout
fetch-timeout
force
foreground-scripts
format-package-lock
fund
git
git-tag-version
global
global-style
globalconfig
heading
https-proxy
if-present
ignore-scripts
include
include-staged
init-author-email
init-author-name
init-author-url
init-license
init-module
init-version
json
key
legacy-bundling
legacy-peer-deps
link
local-address
loglevel
logs-max
long
maxsockets
message
node-options
node-version
noproxy
npm-version
offline
omit
otp
package
package-lock
package-lock-only
parseable
prefer-offline
prefer-online
prefix
preid
progress
proxy
read-only
rebuild-bundle
registry
save
save-bundle
save-dev
save-exact
save-optional
save-peer
save-prefix
save-prod
scope
script-shell
searchexclude
searchlimit
searchopts
searchstaleness
shell
sign-git-commit
sign-git-tag
strict-peer-deps
strict-ssl
tag
tag-version-prefix
timing
umask
unicode
update-notifier
usage
user-agent
userconfig
version
versions
viewer
which
workspace
workspaces
yes
also
auth-type
cache-max
cache-min
dev
init.author.email
init.author.name
init.author.url
init.license
init.module
init.version
only
optional
production
shrinkwrap
sso-poll-frequency
sso-type
tmp
- See also
Description
@@ -279,13 +279,6 @@ allow-same-version
Prevents throwing an error when npm version
is used to set the new version
to the same value as the current version.
-always-auth
-
-- Default: false
-- Type: Boolean
-
-Force npm to always require authentication when accessing the registry, even
-for GET
requests.
audit
- Default: true
@@ -1055,7 +1048,7 @@ script-shell
- Default: ‘/bin/sh’ on POSIX systems, ‘cmd.exe’ on Windows
- Type: null or String
-The shell to use for scripts run with the npm run
command.
+The shell to use for scripts run with the npm exec
, npm run
and npm init <pkg>
commands.
searchexclude
- Default: “”
@@ -1200,7 +1193,8 @@ usage
Show short usage output about the command specified.
user-agent
-- Default: “npm/{npm-version} node/{node-version} {platform} {arch} {ci}”
+- Default: “npm/{npm-version} node/{node-version} {platform} {arch}
+workspaces/{workspaces} {ci}”
- Type: String
Sets the User-Agent request header. The following fields are replaced with
@@ -1210,6 +1204,8 @@
user-agent
{node-version}
- The Node.js version in use
{platform}
- The value of process.platform
{arch}
- The value of process.arch
+{workspaces}
- Set to true
if the workspaces
or workspace
options
+are set.
{ci}
- The value of the ci-name
config, if set, prefixed with ci/
, or
an empty string if ci-name
is empty.
diff --git a/deps/npm/docs/output/using-npm/scripts.html b/deps/npm/docs/output/using-npm/scripts.html
index e231cfec2ab81e7..dde9b1b75d71947 100644
--- a/deps/npm/docs/output/using-npm/scripts.html
+++ b/deps/npm/docs/output/using-npm/scripts.html
@@ -141,7 +141,7 @@ scripts
Table of contents
-
+
Description
@@ -260,11 +260,6 @@ npm diff
<
prepare
-npm env
-
-env
(You can override the default behavior of npm env
by defining
-a custom env
entry in your scripts
object)
-
npm install
These also run when you run npm install -g <pkg-name>
@@ -314,7 +309,7 @@ npm restartrestart
postrestart
-npm run <user defined>
+npm run <user defined>
pre<user-defined>
<user-defined>
diff --git a/deps/npm/lib/adduser.js b/deps/npm/lib/adduser.js
index f35b9829fe946e4..fb1e323512b6d0c 100644
--- a/deps/npm/lib/adduser.js
+++ b/deps/npm/lib/adduser.js
@@ -21,7 +21,6 @@ class AddUser extends BaseCommand {
return [
'registry',
'scope',
- 'always-auth',
]
}
diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js
index 43902f43bbee19a..5d544b2dbd185a6 100644
--- a/deps/npm/lib/cache.js
+++ b/deps/npm/lib/cache.js
@@ -86,32 +86,30 @@ with --force.`)
return rimraf(cachePath)
}
- // npm cache add
- // npm cache add
- // npm cache add
- // npm cache add
+ // npm cache add ...
+ // npm cache add ...
+ // npm cache add ...
+ // npm cache add ...
async add (args) {
const usage = 'Usage:\n' +
- ' npm cache add \n' +
- ' npm cache add @\n' +
- ' npm cache add \n' +
- ' npm cache add \n'
+ ' npm cache add ...\n' +
+ ' npm cache add @...\n' +
+ ' npm cache add ...\n' +
+ ' npm cache add ...\n'
log.silly('cache add', 'args', args)
- const spec = args[0] && args[0] +
- (args[1] === undefined || args[1] === null ? '' : `@${args[1]}`)
-
- if (!spec)
+ if (args.length === 0)
throw Object.assign(new Error(usage), { code: 'EUSAGE' })
- log.silly('cache add', 'spec', spec)
-
- // we ask pacote for the thing, and then just throw the data
- // away so that it tee-pipes it into the cache like it does
- // for a normal request.
- await pacote.tarball.stream(spec, stream => {
- stream.resume()
- return stream.promise()
- }, this.npm.flatOptions)
+ return Promise.all(args.map(spec => {
+ log.silly('cache add', 'spec', spec)
+ // we ask pacote for the thing, and then just throw the data
+ // away so that it tee-pipes it into the cache like it does
+ // for a normal request.
+ return pacote.tarball.stream(spec, stream => {
+ stream.resume()
+ return stream.promise()
+ }, this.npm.flatOptions)
+ }))
}
async verify () {
diff --git a/deps/npm/lib/exec.js b/deps/npm/lib/exec.js
index f8c76eeed4c5150..3da672f9915fddb 100644
--- a/deps/npm/lib/exec.js
+++ b/deps/npm/lib/exec.js
@@ -1,18 +1,6 @@
-const { promisify } = require('util')
-const read = promisify(require('read'))
-const chalk = require('chalk')
-const mkdirp = require('mkdirp-infer-owner')
-const readPackageJson = require('read-package-json-fast')
-const Arborist = require('@npmcli/arborist')
-const runScript = require('@npmcli/run-script')
-const { resolve, delimiter } = require('path')
-const ciDetect = require('@npmcli/ci-detect')
-const crypto = require('crypto')
-const pacote = require('pacote')
-const npa = require('npm-package-arg')
-const fileExists = require('./utils/file-exists.js')
-const PATH = require('./utils/path.js')
+const libexec = require('libnpmexec')
const BaseCommand = require('./base-command.js')
+const getLocationMsg = require('./exec/get-workspace-location-msg.js')
const getWorkspaces = require('./workspaces/get-workspaces.js')
// it's like this:
@@ -40,13 +28,6 @@ const getWorkspaces = require('./workspaces/get-workspaces.js')
// runScript({ pkg, event: 'npx', ... })
// process.env.npm_lifecycle_event = 'npx'
-const nocolor = {
- reset: s => s,
- bold: s => s,
- dim: s => s,
- green: s => s,
-}
-
class Exec extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
@@ -86,276 +67,50 @@ class Exec extends BaseCommand {
// When commands go async and we can dump the boilerplate exec methods this
// can be named correctly
async _exec (_args, { locationMsg, path, runPath }) {
+ const args = [..._args]
+ const cache = this.npm.config.get('cache')
const call = this.npm.config.get('call')
- const shell = this.npm.config.get('shell')
- // dereferenced because we manipulate it later
- const packages = [...this.npm.config.get('package')]
+ const color = this.npm.config.get('color')
+ const {
+ flatOptions,
+ localBin,
+ log,
+ globalBin,
+ output,
+ } = this.npm
+ const scriptShell = this.npm.config.get('script-shell') || undefined
+ const packages = this.npm.config.get('package')
+ const yes = this.npm.config.get('yes')
if (call && _args.length)
throw this.usage
- const args = [..._args]
- const pathArr = [...PATH]
-
- // nothing to maybe install, skip the arborist dance
- if (!call && !args.length && !packages.length) {
- return await this.run({
- args,
- call,
- locationMsg,
- shell,
- path,
- pathArr,
- runPath,
- })
- }
-
- const needPackageCommandSwap = args.length && !packages.length
- // if there's an argument and no package has been explicitly asked for
- // check the local and global bin paths for a binary named the same as
- // the argument and run it if it exists, otherwise fall through to
- // the behavior of treating the single argument as a package name
- if (needPackageCommandSwap) {
- let binExists = false
- if (await fileExists(`${this.npm.localBin}/${args[0]}`)) {
- pathArr.unshift(this.npm.localBin)
- binExists = true
- } else if (await fileExists(`${this.npm.globalBin}/${args[0]}`)) {
- pathArr.unshift(this.npm.globalBin)
- binExists = true
- }
-
- if (binExists) {
- return await this.run({
- args,
- call,
- locationMsg,
- path,
- pathArr,
- runPath,
- shell,
- })
- }
-
- packages.push(args[0])
- }
-
- // If we do `npm exec foo`, and have a `foo` locally, then we'll
- // always use that, so we don't really need to fetch the manifest.
- // So: run npa on each packages entry, and if it is a name with a
- // rawSpec==='', then try to readPackageJson at
- // node_modules/${name}/package.json, and only pacote fetch if
- // that fails.
- const manis = await Promise.all(packages.map(async p => {
- const spec = npa(p, path)
- if (spec.type === 'tag' && spec.rawSpec === '') {
- // fall through to the pacote.manifest() approach
- try {
- const pj = resolve(path, 'node_modules', spec.name)
- return await readPackageJson(pj)
- } catch (er) {}
- }
- // Force preferOnline to true so we are making sure to pull in the latest
- // This is especially useful if the user didn't give us a version, and
- // they expect to be running @latest
- return await pacote.manifest(p, {
- ...this.npm.flatOptions,
- preferOnline: true,
- })
- }))
-
- if (needPackageCommandSwap)
- args[0] = this.getBinFromManifest(manis[0])
-
- // figure out whether we need to install stuff, or if local is fine
- const localArb = new Arborist({
- ...this.npm.flatOptions,
- path,
- })
- const tree = await localArb.loadActual()
-
- // do we have all the packages in manifest list?
- const needInstall = manis.some(mani => this.manifestMissing(tree, mani))
-
- if (needInstall) {
- const installDir = this.cacheInstallDir(packages)
- await mkdirp(installDir)
- const arb = new Arborist({
- ...this.npm.flatOptions,
- log: this.npm.log,
- path: installDir,
- })
- const tree = await arb.loadActual()
-
- // at this point, we have to ensure that we get the exact same
- // version, because it's something that has only ever been installed
- // by npm exec in the cache install directory
- const add = manis.filter(mani => this.manifestMissing(tree, {
- ...mani,
- _from: `${mani.name}@${mani.version}`,
- }))
- .map(mani => mani._from)
- .sort((a, b) => a.localeCompare(b))
-
- // no need to install if already present
- if (add.length) {
- if (!this.npm.config.get('yes')) {
- // set -n to always say no
- if (this.npm.config.get('yes') === false)
- throw new Error('canceled')
-
- if (!process.stdin.isTTY || ciDetect()) {
- this.npm.log.warn('exec', `The following package${
- add.length === 1 ? ' was' : 's were'
- } not found and will be installed: ${
- add.map((pkg) => pkg.replace(/@$/, '')).join(', ')
- }`)
- } else {
- const addList = add.map(a => ` ${a.replace(/@$/, '')}`)
- .join('\n') + '\n'
- const prompt = `Need to install the following packages:\n${
- addList
- }Ok to proceed? `
- const confirm = await read({ prompt, default: 'y' })
- if (confirm.trim().toLowerCase().charAt(0) !== 'y')
- throw new Error('canceled')
- }
- }
- await arb.reify({
- ...this.npm.flatOptions,
- log: this.npm.log,
- add,
- })
- }
- pathArr.unshift(resolve(installDir, 'node_modules/.bin'))
- }
-
- return await this.run({
+ return libexec({
+ ...flatOptions,
args,
call,
+ cache,
+ color,
+ localBin,
locationMsg,
+ log,
+ globalBin,
+ output,
+ packages,
path,
- pathArr,
runPath,
- shell,
+ scriptShell,
+ yes,
})
}
- async run ({ args, call, locationMsg, path, pathArr, runPath, shell }) {
- // turn list of args into command string
- const script = call || args.shift() || shell
-
- // do the fakey runScript dance
- // still should work if no package.json in cwd
- const realPkg = await readPackageJson(`${path}/package.json`)
- .catch(() => ({}))
- const pkg = {
- ...realPkg,
- scripts: {
- ...(realPkg.scripts || {}),
- npx: script,
- },
- }
-
- this.npm.log.disableProgress()
- try {
- if (script === shell) {
- if (process.stdin.isTTY) {
- if (ciDetect())
- return this.npm.log.warn('exec', 'Interactive mode disabled in CI environment')
-
- const color = this.npm.config.get('color')
- const colorize = color ? chalk : nocolor
-
- locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}`
-
- this.npm.output(`${
- colorize.reset('\nEntering npm script environment')
- }${
- colorize.reset(locationMsg)
- }${
- colorize.bold('\nType \'exit\' or ^D when finished\n')
- }`)
- }
- }
- return await runScript({
- ...this.npm.flatOptions,
- pkg,
- banner: false,
- // we always run in cwd, not --prefix
- path: runPath,
- stdioString: true,
- event: 'npx',
- args,
- env: {
- PATH: pathArr.join(delimiter),
- },
- stdio: 'inherit',
- })
- } finally {
- this.npm.log.enableProgress()
- }
- }
-
- manifestMissing (tree, mani) {
- // if the tree doesn't have a child by that name/version, return true
- // true means we need to install it
- const child = tree.children.get(mani.name)
- // if no child, we have to load it
- if (!child)
- return true
-
- // if no version/tag specified, allow whatever's there
- if (mani._from === `${mani.name}@`)
- return false
-
- // otherwise the version has to match what we WOULD get
- return child.version !== mani.version
- }
-
- getBinFromManifest (mani) {
- // if we have a bin matching (unscoped portion of) packagename, use that
- // otherwise if there's 1 bin or all bin value is the same (alias), use
- // that, otherwise fail
- const bin = mani.bin || {}
- if (new Set(Object.values(bin)).size === 1)
- return Object.keys(bin)[0]
-
- // XXX probably a util to parse this better?
- const name = mani.name.replace(/^@[^/]+\//, '')
- if (bin[name])
- return name
-
- // XXX need better error message
- throw Object.assign(new Error('could not determine executable to run'), {
- pkgid: mani._id,
- })
- }
-
- cacheInstallDir (packages) {
- // only packages not found in ${prefix}/node_modules
- return resolve(this.npm.config.get('cache'), '_npx', this.getHash(packages))
- }
-
- getHash (packages) {
- return crypto.createHash('sha512')
- .update(packages.sort((a, b) => a.localeCompare(b)).join('\n'))
- .digest('hex')
- .slice(0, 16)
- }
-
async _execWorkspaces (args, filters) {
const workspaces =
await getWorkspaces(filters, { path: this.npm.localPrefix })
- const getLocationMsg = async path => {
- const color = this.npm.config.get('color')
- const colorize = color ? chalk : nocolor
- const { _id } = await readPackageJson(`${path}/package.json`)
- return ` in workspace ${colorize.green(_id)} at location:\n${colorize.dim(path)}`
- }
+ const color = this.npm.config.get('color')
for (const workspacePath of workspaces.values()) {
- const locationMsg = await getLocationMsg(workspacePath)
+ const locationMsg = await getLocationMsg({ color, path: workspacePath })
await this._exec(args, {
locationMsg,
path: workspacePath,
@@ -364,4 +119,5 @@ class Exec extends BaseCommand {
}
}
}
+
module.exports = Exec
diff --git a/deps/npm/lib/exec/get-workspace-location-msg.js b/deps/npm/lib/exec/get-workspace-location-msg.js
new file mode 100644
index 000000000000000..813b11e78922231
--- /dev/null
+++ b/deps/npm/lib/exec/get-workspace-location-msg.js
@@ -0,0 +1,25 @@
+const chalk = require('chalk')
+const readPackageJson = require('read-package-json-fast')
+
+const nocolor = {
+ dim: s => s,
+ green: s => s,
+}
+
+const getLocationMsg = async ({ color, path }) => {
+ const colorize = color ? chalk : nocolor
+ const { _id } =
+ await readPackageJson(`${path}/package.json`)
+ .catch(() => ({}))
+
+ const workspaceMsg = _id
+ ? ` in workspace ${colorize.green(_id)}`
+ : ` in a ${colorize.green('new')} workspace`
+ const locationMsg = ` at location:\n${
+ colorize.dim(path)
+ }`
+
+ return `${workspaceMsg}${locationMsg}`
+}
+
+module.exports = getLocationMsg
diff --git a/deps/npm/lib/init.js b/deps/npm/lib/init.js
index 81c6733885a68ef..7d7f6bab37668f2 100644
--- a/deps/npm/lib/init.js
+++ b/deps/npm/lib/init.js
@@ -1,6 +1,14 @@
+const fs = require('fs')
+const { relative, resolve } = require('path')
+const mkdirp = require('mkdirp-infer-owner')
const initJson = require('init-package-json')
const npa = require('npm-package-arg')
+const rpj = require('read-package-json-fast')
+const libexec = require('libnpmexec')
+const parseJSON = require('json-parse-even-better-errors')
+const mapWorkspaces = require('@npmcli/map-workspaces')
+const getLocationMsg = require('./exec/get-workspace-location-msg.js')
const BaseCommand = require('./base-command.js')
class Init extends BaseCommand {
@@ -9,6 +17,11 @@ class Init extends BaseCommand {
return 'Create a package.json file'
}
+ /* istanbul ignore next - see test/lib/load-all-commands.js */
+ static get params () {
+ return ['workspace', 'workspaces']
+ }
+
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get name () {
return 'init'
@@ -27,42 +40,107 @@ class Init extends BaseCommand {
this.init(args).then(() => cb()).catch(cb)
}
+ execWorkspaces (args, filters, cb) {
+ this.initWorkspaces(args, filters).then(() => cb()).catch(cb)
+ }
+
async init (args) {
- // the new npx style way
+ // npm exec style
+ if (args.length)
+ return (await this.execCreate({ args, path: process.cwd() }))
+
+ // no args, uses classic init-package-json boilerplate
+ await this.template()
+ }
+
+ async initWorkspaces (args, filters) {
+ // reads package.json for the top-level folder first, by doing this we
+ // ensure the command throw if no package.json is found before trying
+ // to create a workspace package.json file or its folders
+ const pkg = await rpj(resolve(this.npm.localPrefix, 'package.json'))
+ const wPath = filterArg => resolve(this.npm.localPrefix, filterArg)
+
+ // npm-exec style, runs in the context of each workspace filter
if (args.length) {
- const initerName = args[0]
- let packageName = initerName
- if (/^@[^/]+$/.test(initerName))
- packageName = initerName + '/create'
- else {
- const req = npa(initerName)
- if (req.type === 'git' && req.hosted) {
- const { user, project } = req.hosted
- packageName = initerName
- .replace(user + '/' + project, user + '/create-' + project)
- } else if (req.registry) {
- packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-')
- if (req.rawSpec)
- packageName += '@' + req.rawSpec
- } else {
- throw Object.assign(new Error(
- 'Unrecognized initializer: ' + initerName +
- '\nFor more package binary executing power check out `npx`:' +
- '\nhttps://www.npmjs.com/package/npx'
- ), { code: 'EUNSUPPORTED' })
- }
+ for (const filterArg of filters) {
+ const path = wPath(filterArg)
+ await mkdirp(path)
+ await this.execCreate({ args, path })
+ await this.setWorkspace({ pkg, workspacePath: path })
+ }
+ return
+ }
+
+ // no args, uses classic init-package-json boilerplate
+ for (const filterArg of filters) {
+ const path = wPath(filterArg)
+ await mkdirp(path)
+ await this.template(path)
+ await this.setWorkspace({ pkg, workspacePath: path })
+ }
+ }
+
+ async execCreate ({ args, path }) {
+ const [initerName, ...otherArgs] = args
+ let packageName = initerName
+
+ if (/^@[^/]+$/.test(initerName))
+ packageName = initerName + '/create'
+ else {
+ const req = npa(initerName)
+ if (req.type === 'git' && req.hosted) {
+ const { user, project } = req.hosted
+ packageName = initerName
+ .replace(user + '/' + project, user + '/create-' + project)
+ } else if (req.registry) {
+ packageName = req.name.replace(/^(@[^/]+\/)?/, '$1create-')
+ if (req.rawSpec)
+ packageName += '@' + req.rawSpec
+ } else {
+ throw Object.assign(new Error(
+ 'Unrecognized initializer: ' + initerName +
+ '\nFor more package binary executing power check out `npx`:' +
+ '\nhttps://www.npmjs.com/package/npx'
+ ), { code: 'EUNSUPPORTED' })
}
- this.npm.config.set('package', [])
- const newArgs = [packageName, ...args.slice(1)]
- return new Promise((res, rej) => {
- this.npm.commands.exec(newArgs, er => er ? rej(er) : res())
- })
}
- // the old way
- const dir = process.cwd()
+ const newArgs = [packageName, ...otherArgs]
+ const cache = this.npm.config.get('cache')
+ const { color } = this.npm.flatOptions
+ const {
+ flatOptions,
+ localBin,
+ log,
+ globalBin,
+ output,
+ } = this.npm
+ const locationMsg = await getLocationMsg({ color, path })
+ const runPath = path
+ const scriptShell = this.npm.config.get('script-shell') || undefined
+ const yes = this.npm.config.get('yes')
+
+ await libexec({
+ ...flatOptions,
+ args: newArgs,
+ cache,
+ color,
+ localBin,
+ locationMsg,
+ log,
+ globalBin,
+ output,
+ path,
+ runPath,
+ scriptShell,
+ yes,
+ })
+ }
+
+ async template (path = process.cwd()) {
this.npm.log.pause()
this.npm.log.disableProgress()
+
const initFile = this.npm.config.get('init-module')
if (!this.npm.config.get('yes') && !this.npm.config.get('force')) {
this.npm.output([
@@ -78,9 +156,10 @@ class Init extends BaseCommand {
'Press ^C at any time to quit.',
].join('\n'))
}
+
// XXX promisify init-package-json
await new Promise((res, rej) => {
- initJson(dir, initFile, this.npm.config, (er, data) => {
+ initJson(path, initFile, this.npm.config, (er, data) => {
this.npm.log.resume()
this.npm.log.enableProgress()
this.npm.log.silly('package data', data)
@@ -97,5 +176,56 @@ class Init extends BaseCommand {
})
})
}
+
+ async setWorkspace ({ pkg, workspacePath }) {
+ const workspaces = await mapWorkspaces({ cwd: this.npm.localPrefix, pkg })
+
+ // skip setting workspace if current package.json glob already satisfies it
+ for (const wPath of workspaces.values()) {
+ if (wPath === workspacePath)
+ return
+ }
+
+ // if a create-pkg didn't generate a package.json at the workspace
+ // folder level, it might not be recognized as a workspace by
+ // mapWorkspaces, so we're just going to avoid touching the
+ // top-level package.json
+ try {
+ fs.statSync(resolve(workspacePath, 'package.json'))
+ } catch (err) {
+ return
+ }
+
+ let manifest
+ try {
+ manifest =
+ fs.readFileSync(resolve(this.npm.localPrefix, 'package.json'), 'utf-8')
+ } catch (error) {
+ throw new Error('package.json not found')
+ }
+
+ try {
+ manifest = parseJSON(manifest)
+ } catch (error) {
+ throw new Error(`Invalid package.json: ${error}`)
+ }
+
+ if (!manifest.workspaces)
+ manifest.workspaces = []
+
+ manifest.workspaces.push(relative(this.npm.localPrefix, workspacePath))
+
+ // format content
+ const {
+ [Symbol.for('indent')]: indent,
+ [Symbol.for('newline')]: newline,
+ } = manifest
+
+ const content = (JSON.stringify(manifest, null, indent) + '\n')
+ .replace(/\n/g, newline)
+
+ fs.writeFileSync(resolve(this.npm.localPrefix, 'package.json'), content)
+ }
}
+
module.exports = Init
diff --git a/deps/npm/lib/logout.js b/deps/npm/lib/logout.js
index adc19a923af9ab0..0887ec397bf1ae3 100644
--- a/deps/npm/lib/logout.js
+++ b/deps/npm/lib/logout.js
@@ -41,7 +41,7 @@ class Logout extends BaseCommand {
method: 'DELETE',
ignoreBody: true,
})
- } else if (auth.username || auth.password)
+ } else if (auth.isBasicAuth)
log.verbose('logout', `clearing user credentials for ${reg}`)
else {
const msg = `not logged in to ${reg}, so can't log out!`
diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js
index 65b3ddfe7611b78..ccd8b2ff9dea71c 100644
--- a/deps/npm/lib/ls.js
+++ b/deps/npm/lib/ls.js
@@ -166,7 +166,10 @@ class LS extends BaseCommand {
)
}
- if (problems.size) {
+ const shouldThrow = problems.size &&
+ ![...problems].every(problem => problem.startsWith('extraneous:'))
+
+ if (shouldThrow) {
throw Object.assign(
new Error([...problems].join(EOL)),
{ code: 'ELSPROBLEMS' }
@@ -302,7 +305,7 @@ const getJsonOutputItem = (node, { global, long }) => {
if (node.isRoot && hasPackageJson)
item.name = node.package.name || node.name
- if (long) {
+ if (long && !node[_missing]) {
item.name = item[_name]
const { dependencies, ...packageInfo } = node.package
Object.assign(item, packageInfo)
@@ -411,9 +414,11 @@ const augmentNodesWithMetadata = ({
path: node.path,
isLink: node.isLink,
realpath: node.realpath,
+ [_type]: node[_type],
[_invalid]: node[_invalid],
[_missing]: node[_missing],
- [_dedupe]: true,
+ // if it's missing, it's not deduped, it's just missing
+ [_dedupe]: !node[_missing],
}
} else {
// keeps track of already seen nodes in order to check for dedupes
diff --git a/deps/npm/lib/pack.js b/deps/npm/lib/pack.js
index 8e61efabb36e4d9..5c0da6be7b6e04c 100644
--- a/deps/npm/lib/pack.js
+++ b/deps/npm/lib/pack.js
@@ -45,22 +45,34 @@ class Pack extends BaseCommand {
args = ['.']
const unicode = this.npm.config.get('unicode')
+ const dryRun = this.npm.config.get('dry-run')
- // clone the opts because pacote mutates it with resolved/integrity
- const tarballs = await Promise.all(args.map(async (arg) => {
+ // Get the manifests and filenames first so we can bail early on manifest
+ // errors before making any tarballs
+ const manifests = []
+ for (const arg of args) {
const spec = npa(arg)
- const dryRun = this.npm.config.get('dry-run')
const manifest = await pacote.manifest(spec, this.npm.flatOptions)
+ if (!manifest._id)
+ throw new Error('Invalid package, must have name and version')
+
const filename = `${manifest.name}-${manifest.version}.tgz`
.replace(/^@/, '').replace(/\//, '-')
+ manifests.push({ arg, filename, manifest })
+ }
+
+ // Load tarball names up for printing afterward to isolate from the
+ // noise generated during packing
+ const tarballs = []
+ for (const { arg, filename, manifest } of manifests) {
const tarballData = await libpack(arg, this.npm.flatOptions)
const pkgContents = await getContents(manifest, tarballData)
if (!dryRun)
await writeFile(filename, tarballData)
- return pkgContents
- }))
+ tarballs.push(pkgContents)
+ }
for (const tar of tarballs) {
logTar(tar, { log, unicode })
diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js
index db1f25e9517defe..aa90de8e760b7db 100644
--- a/deps/npm/lib/utils/config/definitions.js
+++ b/deps/npm/lib/utils/config/definitions.js
@@ -199,16 +199,6 @@ define('also', {
},
})
-define('always-auth', {
- default: false,
- type: Boolean,
- description: `
- Force npm to always require authentication when accessing the registry,
- even for \`GET\` requests.
- `,
- flatten,
-})
-
define('audit', {
default: true,
type: Boolean,
@@ -1660,7 +1650,8 @@ define('script-shell', {
`,
type: [null, String],
description: `
- The shell to use for scripts run with the \`npm run\` command.
+ The shell to use for scripts run with the \`npm exec\`,
+ \`npm run\` and \`npm init \` commands.
`,
flatten (key, obj, flatOptions) {
flatOptions.scriptShell = obj[key] || undefined
@@ -1952,6 +1943,7 @@ define('user-agent', {
'node/{node-version} ' +
'{platform} ' +
'{arch} ' +
+ 'workspaces/{workspaces} ' +
'{ci}',
type: String,
description: `
@@ -1962,17 +1954,23 @@ define('user-agent', {
* \`{node-version}\` - The Node.js version in use
* \`{platform}\` - The value of \`process.platform\`
* \`{arch}\` - The value of \`process.arch\`
+ * \`{workspaces}\` - Set to \`true\` if the \`workspaces\` or \`workspace\`
+ options are set.
* \`{ci}\` - The value of the \`ci-name\` config, if set, prefixed with
\`ci/\`, or an empty string if \`ci-name\` is empty.
`,
flatten (key, obj, flatOptions) {
const value = obj[key]
const ciName = obj['ci-name']
+ let inWorkspaces = false
+ if (obj.workspaces || obj.workspace && obj.workspace.length)
+ inWorkspaces = true
flatOptions.userAgent =
value.replace(/\{node-version\}/gi, obj['node-version'])
.replace(/\{npm-version\}/gi, obj['npm-version'])
.replace(/\{platform\}/gi, process.platform)
.replace(/\{arch\}/gi, process.arch)
+ .replace(/\{workspaces\}/gi, inWorkspaces)
.replace(/\{ci\}/gi, ciName ? `ci/${ciName}` : '')
.trim()
// user-agent is a unique kind of config item that gets set from a template
diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1
index f1deed4c428a55d..8165ccd46d5c45b 100644
--- a/deps/npm/man/man1/npm-access.1
+++ b/deps/npm/man/man1/npm-access.1
@@ -1,4 +1,4 @@
-.TH "NPM\-ACCESS" "1" "April 2021" "" ""
+.TH "NPM\-ACCESS" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-access\fR \- Set access level on published packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1
index 9daa39292d4fc7a..26f42858694adae 100644
--- a/deps/npm/man/man1/npm-adduser.1
+++ b/deps/npm/man/man1/npm-adduser.1
@@ -1,11 +1,11 @@
-.TH "NPM\-ADDUSER" "1" "April 2021" "" ""
+.TH "NPM\-ADDUSER" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-adduser\fR \- Add a registry user account
.SS Synopsis
.P
.RS 2
.nf
-npm adduser [\-\-registry=url] [\-\-scope=@orgname] [\-\-always\-auth] [\-\-auth\-type=legacy]
+npm adduser [\-\-registry=url] [\-\-scope=@orgname] [\-\-auth\-type=legacy]
aliases: login, add\-user
.fi
@@ -54,24 +54,6 @@ npm adduser \-\-registry=http://myregistry\.example\.com \-\-scope=@myco
.P
This will set a registry for the given scope and login or create a user for
that registry at the same time\.
-.SS always\-auth
-.P
-Default: false
-.P
-If specified, save configuration indicating that all requests to the given
-registry should include authorization information\. Useful for private
-registries\. Can be used with \fB\-\-registry\fP and / or \fB\-\-scope\fP, e\.g\.
-.P
-.RS 2
-.nf
-npm adduser \-\-registry=http://private\-registry\.example\.com \-\-always\-auth
-.fi
-.RE
-.P
-This will ensure that all requests to that registry (including for tarballs)
-include an authorization header\. This setting may be necessary for use with
-private registries where metadata and package tarballs are stored on hosts with
-different hostnames\. See \fBalways\-auth\fP in npm help \fBconfig\fP for more details on always\-auth\. Registry\-specific configuration of \fBalways\-auth\fP takes precedence over any global configuration\.
.SS auth\-type
.RS 0
.IP \(bu 2
diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1
index ebbb019ec8a351a..cd63c284730908d 100644
--- a/deps/npm/man/man1/npm-audit.1
+++ b/deps/npm/man/man1/npm-audit.1
@@ -1,4 +1,4 @@
-.TH "NPM\-AUDIT" "1" "April 2021" "" ""
+.TH "NPM\-AUDIT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-audit\fR \- Run a security audit
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1
index d7ddf05cb757af8..61e2ab1ea91cde6 100644
--- a/deps/npm/man/man1/npm-bin.1
+++ b/deps/npm/man/man1/npm-bin.1
@@ -1,4 +1,4 @@
-.TH "NPM\-BIN" "1" "April 2021" "" ""
+.TH "NPM\-BIN" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-bin\fR \- Display npm bin folder
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1
index 9d453b825b9f923..c4297521de2b5f5 100644
--- a/deps/npm/man/man1/npm-bugs.1
+++ b/deps/npm/man/man1/npm-bugs.1
@@ -1,4 +1,4 @@
-.TH "NPM\-BUGS" "1" "April 2021" "" ""
+.TH "NPM\-BUGS" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-bugs\fR \- Report bugs for a package in a web browser
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1
index 08913baa6325d60..25b9d0d79118df9 100644
--- a/deps/npm/man/man1/npm-cache.1
+++ b/deps/npm/man/man1/npm-cache.1
@@ -1,14 +1,14 @@
-.TH "NPM\-CACHE" "1" "April 2021" "" ""
+.TH "NPM\-CACHE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-cache\fR \- Manipulates packages cache
.SS Synopsis
.P
.RS 2
.nf
-npm cache add
-npm cache add
-npm cache add
-npm cache add @
+npm cache add \.\.\.
+npm cache add \.\.\.
+npm cache add \.\.\.
+npm cache add @\.\.\.
npm cache clean
aliases: npm cache clear, npm cache rm
@@ -24,7 +24,7 @@ Used to add, list, or clean the npm cache folder\.
.RS 0
.IP \(bu 2
add:
-Add the specified package to the local cache\. This command is primarily
+Add the specified packages to the local cache\. This command is primarily
intended to be used internally by npm, but it can provide a way to
add data to the local installation cache explicitly\.
.IP \(bu 2
diff --git a/deps/npm/man/man1/npm-ci.1 b/deps/npm/man/man1/npm-ci.1
index 67f7245d01b9e79..481d3d23c95b0f7 100644
--- a/deps/npm/man/man1/npm-ci.1
+++ b/deps/npm/man/man1/npm-ci.1
@@ -1,4 +1,4 @@
-.TH "NPM\-CI" "1" "April 2021" "" ""
+.TH "NPM\-CI" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-ci\fR \- Install a project with a clean slate
.SS Synopsis
@@ -10,7 +10,7 @@ npm ci
.RE
.SS Description
.P
-This command is similar to \fBnpm install\fP \fI/cli\-commands/install\fR, except
+This command is similar to npm help \fBinstall\fP, except
it's meant to be used in automated environments such as test platforms,
continuous integration, and deployment \-\- or any situation where you want
to make sure you're doing a clean install of your dependencies\.
diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1
index cb3e2d994356c8c..dffedb6b639e6a0 100644
--- a/deps/npm/man/man1/npm-completion.1
+++ b/deps/npm/man/man1/npm-completion.1
@@ -1,4 +1,4 @@
-.TH "NPM\-COMPLETION" "1" "April 2021" "" ""
+.TH "NPM\-COMPLETION" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-completion\fR \- Tab Completion for npm
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1
index c19d0411cb78b47..2ab14312a86a7d8 100644
--- a/deps/npm/man/man1/npm-config.1
+++ b/deps/npm/man/man1/npm-config.1
@@ -1,4 +1,4 @@
-.TH "NPM\-CONFIG" "1" "April 2021" "" ""
+.TH "NPM\-CONFIG" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-config\fR \- Manage the npm configuration files
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1
index fd6cce4bc1b287b..bd65bd3853c26e7 100644
--- a/deps/npm/man/man1/npm-dedupe.1
+++ b/deps/npm/man/man1/npm-dedupe.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DEDUPE" "1" "April 2021" "" ""
+.TH "NPM\-DEDUPE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-dedupe\fR \- Reduce duplication in the package tree
.SS Synopsis
@@ -78,12 +78,12 @@ Using \fBnpm find\-dupes\fP will run the command in \fB\-\-dry\-run\fP mode\.
.SS See Also
.RS 0
.IP \(bu 2
-npm find\-dupes \fI/cli\-commands/find\-dupes\fR
+npm help find\-dupes
.IP \(bu 2
-npm ls \fI/cli\-commands/ls\fR
+npm help ls
.IP \(bu 2
-npm update \fI/cli\-commands/update\fR
+npm help update
.IP \(bu 2
-npm install \fI/cli\-commands/install\fR
+npm help install
.RE
diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1
index 33922d2e834c6ff..c57decbba87bb43 100644
--- a/deps/npm/man/man1/npm-deprecate.1
+++ b/deps/npm/man/man1/npm-deprecate.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DEPRECATE" "1" "April 2021" "" ""
+.TH "NPM\-DEPRECATE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-deprecate\fR \- Deprecate a version of a package
.SS Synopsis
@@ -48,8 +48,8 @@ npm help publish
.IP \(bu 2
npm help registry
.IP \(bu 2
-npm owner \fI/cli\-commands/owner\fR
+npm help owner
.IP \(bu 2
-npm owner \fI/cli\-commands/adduser\fR
+npm help owner
.RE
diff --git a/deps/npm/man/man1/npm-diff.1 b/deps/npm/man/man1/npm-diff.1
index 97092215bd89a30..079c73e46a44a30 100644
--- a/deps/npm/man/man1/npm-diff.1
+++ b/deps/npm/man/man1/npm-diff.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DIFF" "1" "April 2021" "" ""
+.TH "NPM\-DIFF" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-diff\fR \- The registry diff command
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1
index 6be3351be3cf5b4..95ed3584723186a 100644
--- a/deps/npm/man/man1/npm-dist-tag.1
+++ b/deps/npm/man/man1/npm-dist-tag.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DIST\-TAG" "1" "April 2021" "" ""
+.TH "NPM\-DIST\-TAG" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-dist-tag\fR \- Modify package distribution tags
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1
index 5da2b661a5498bf..1aec0eb795f4110 100644
--- a/deps/npm/man/man1/npm-docs.1
+++ b/deps/npm/man/man1/npm-docs.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DOCS" "1" "April 2021" "" ""
+.TH "NPM\-DOCS" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-docs\fR \- Open documentation for a package in a web browser
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-doctor.1 b/deps/npm/man/man1/npm-doctor.1
index c3b11a90259509e..df05a562f95e802 100644
--- a/deps/npm/man/man1/npm-doctor.1
+++ b/deps/npm/man/man1/npm-doctor.1
@@ -1,4 +1,4 @@
-.TH "NPM\-DOCTOR" "1" "April 2021" "" ""
+.TH "NPM\-DOCTOR" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-doctor\fR \- Check your npm environment
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1
index 445439d1554b14b..425c769cfed1380 100644
--- a/deps/npm/man/man1/npm-edit.1
+++ b/deps/npm/man/man1/npm-edit.1
@@ -1,4 +1,4 @@
-.TH "NPM\-EDIT" "1" "April 2021" "" ""
+.TH "NPM\-EDIT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-edit\fR \- Edit an installed package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-exec.1 b/deps/npm/man/man1/npm-exec.1
index 3711534c58e912b..5bb3736ae6297fc 100644
--- a/deps/npm/man/man1/npm-exec.1
+++ b/deps/npm/man/man1/npm-exec.1
@@ -1,4 +1,4 @@
-.TH "NPM\-EXEC" "1" "April 2021" "" ""
+.TH "NPM\-EXEC" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-exec\fR \- Run a command from a local or remote npm package
.SS Synopsis
@@ -9,7 +9,7 @@ npm exec \-\- [@] [args\.\.\.]
npm exec \-\-package=[@] \-\- [args\.\.\.]
npm exec \-c ' [args\.\.\.]'
npm exec \-\-package=foo \-c ' [args\.\.\.]'
-npm exec [\-ws] [\-w [@] [args\.\.\.]
npx \-p [@] [args\.\.\.]
@@ -205,7 +205,7 @@ workspace folder:
.P
.RS 2
.nf
-npm exec \-ws \-\- eslint \./*\.js
+npm exec \-\-ws \-\- eslint \./*\.js
.fi
.RE
.SS Filtering workspaces
@@ -317,7 +317,7 @@ children workspaces)
.SS workspaces
.RS 0
.IP \(bu 2
-Alias: \fB\-ws\fP
+Alias: \fB\-\-ws\fP
.IP \(bu 2
Type: Boolean
.IP \(bu 2
@@ -343,5 +343,7 @@ npm help restart
npm help stop
.IP \(bu 2
npm help config
+.IP \(bu 2
+npm help workspaces
.RE
diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1
index efc5314788205bf..87c84f1aaf26683 100644
--- a/deps/npm/man/man1/npm-explain.1
+++ b/deps/npm/man/man1/npm-explain.1
@@ -1,4 +1,4 @@
-.TH "NPM\-EXPLAIN" "1" "April 2021" "" ""
+.TH "NPM\-EXPLAIN" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-explain\fR \- Explain installed packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1
index 7863f3a07115f6e..205f0518e909fa2 100644
--- a/deps/npm/man/man1/npm-explore.1
+++ b/deps/npm/man/man1/npm-explore.1
@@ -1,4 +1,4 @@
-.TH "NPM\-EXPLORE" "1" "April 2021" "" ""
+.TH "NPM\-EXPLORE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-explore\fR \- Browse an installed package
.SS Synopsis
@@ -49,8 +49,6 @@ npm help edit
.IP \(bu 2
npm help rebuild
.IP \(bu 2
-npm help build
-.IP \(bu 2
npm help install
.RE
diff --git a/deps/npm/man/man1/npm-find-dupes.1 b/deps/npm/man/man1/npm-find-dupes.1
index 03ff67e95b57609..e88c89408b351e3 100644
--- a/deps/npm/man/man1/npm-find-dupes.1
+++ b/deps/npm/man/man1/npm-find-dupes.1
@@ -1,4 +1,4 @@
-.TH "NPM\-FIND\-DUPES" "1" "April 2021" "" ""
+.TH "NPM\-FIND\-DUPES" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-find-dupes\fR \- Find duplication in the package tree
.SS Synopsis
@@ -15,12 +15,12 @@ duplications, without actually changing the package tree\.
.SS See Also
.RS 0
.IP \(bu 2
-npm dedupe \fI/cli\-commands/dedupe\fR
+npm help dedupe
.IP \(bu 2
-npm ls \fI/cli\-commands/ls\fR
+npm help ls
.IP \(bu 2
-npm update \fI/cli\-commands/update\fR
+npm help update
.IP \(bu 2
-npm install \fI/cli\-commands/install\fR
+npm help install
.RE
diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1
index dc67600e6ac2f9a..81a277bb0087c26 100644
--- a/deps/npm/man/man1/npm-fund.1
+++ b/deps/npm/man/man1/npm-fund.1
@@ -1,4 +1,4 @@
-.TH "NPM\-FUND" "1" "April 2021" "" ""
+.TH "NPM\-FUND" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-fund\fR \- Retrieve funding information
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1
index a7bc089b1962fc1..2f85992550d9f29 100644
--- a/deps/npm/man/man1/npm-help-search.1
+++ b/deps/npm/man/man1/npm-help-search.1
@@ -1,4 +1,4 @@
-.TH "NPM\-HELP\-SEARCH" "1" "April 2021" "" ""
+.TH "NPM\-HELP\-SEARCH" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-help-search\fR \- Search npm help documentation
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1
index 8e32829300023f9..f97f9117b685ee1 100644
--- a/deps/npm/man/man1/npm-help.1
+++ b/deps/npm/man/man1/npm-help.1
@@ -1,4 +1,4 @@
-.TH "NPM\-HELP" "1" "April 2021" "" ""
+.TH "NPM\-HELP" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-help\fR \- Get help on npm
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-hook.1 b/deps/npm/man/man1/npm-hook.1
index 06cb0959fcc99e0..bb6b553a60c6ff5 100644
--- a/deps/npm/man/man1/npm-hook.1
+++ b/deps/npm/man/man1/npm-hook.1
@@ -1,4 +1,4 @@
-.TH "NPM\-HOOK" "1" "April 2021" "" ""
+.TH "NPM\-HOOK" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-hook\fR \- Manage registry hooks
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1
index b3be3f35e6f6c24..9ba1cf0a6457dc4 100644
--- a/deps/npm/man/man1/npm-init.1
+++ b/deps/npm/man/man1/npm-init.1
@@ -1,4 +1,4 @@
-.TH "NPM\-INIT" "1" "April 2021" "" ""
+.TH "NPM\-INIT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-init\fR \- Create a package\.json file
.SS Synopsis
@@ -6,8 +6,9 @@
.RS 2
.nf
npm init [\-\-force|\-f|\-\-yes|\-y|\-\-scope]
-npm init <@scope> (same as `npx <@scope>/create`)
-npm init [<@scope>/] (same as `npx [<@scope>/]create\-`)
+npm init <@scope> (same as `npm exec <@scope>/create`)
+npm init [<@scope>/] (same as `npm exec [<@scope>/]create\-`)
+npm init [\-w ] [args\.\.\.]
.fi
.RE
.SS Description
@@ -16,25 +17,22 @@ npm init [<@scope>/] (same as `npx [<@scope>/]create\-`)
package\.
.P
\fBinitializer\fP in this case is an npm package named \fBcreate\-\fP,
-which will be installed by \fBnpx\fP \fIhttps://npm\.im/npx\fR, and then have its
+which will be installed by npm help \fBnpm\-exec\fP, and then have its
main bin executed \-\- presumably creating or updating \fBpackage\.json\fP and
running any other initialization\-related operations\.
.P
-The init command is transformed to a corresponding \fBnpx\fP operation as
+The init command is transformed to a corresponding \fBnpm exec\fP operation as
follows:
.RS 0
.IP \(bu 2
-\fBnpm init foo\fP \-> \fBnpx create\-foo\fP
+\fBnpm init foo\fP \-> \fBnpm exec create\-foo\fP
.IP \(bu 2
-\fBnpm init @usr/foo\fP \-> \fBnpx @usr/create\-foo\fP
+\fBnpm init @usr/foo\fP \-> \fBnpm exec @usr/create\-foo\fP
.IP \(bu 2
-\fBnpm init @usr\fP \-> \fBnpx @usr/create\fP
+\fBnpm init @usr\fP \-> \fBnpm exec @usr/create\fP
.RE
.P
-Any additional options will be passed directly to the command, so \fBnpm init
-foo \-\- \-\-hello\fP will map to \fBnpx create\-foo \-\-hello\fP\|\.
-.P
If the initializer is omitted (by just calling \fBnpm init\fP), init will fall
back to legacy init behavior\. It will ask you a bunch of questions, and
then write a package\.json for you\. It will attempt to make reasonable
@@ -42,6 +40,21 @@ guesses based on existing fields, dependencies, and options selected\. It is
strictly additive, so it will keep any fields and values that were already
set\. You can also use \fB\-y\fP/\fB\-\-yes\fP to skip the questionnaire altogether\. If
you pass \fB\-\-scope\fP, it will create a scoped package\.
+.SS Forwarding additional options
+.P
+Any additional options will be passed directly to the command, so \fBnpm init
+foo \-\- \-\-hello\fP will map to \fBnpm exec \-\- create\-foo \-\-hello\fP\|\.
+.P
+To better illustrate how options are forwarded, here's a more evolved
+example showing options passed to both the \fBnpm cli\fR and a create package,
+both following commands are equivalent:
+.RS 0
+.IP \(bu 2
+\fBnpm init foo \-y \-\-registry= \-\- \-\-hello \-a\fP
+.IP \(bu 2
+\fBnpm exec \-y \-\-registry= \-\- create\-foo \-\-hello \-a\fP
+
+.RE
.SS Examples
.P
Create a new React\-based project using
@@ -80,6 +93,77 @@ Generate it without having it ask any questions:
$ npm init \-y
.fi
.RE
+.SS Workspaces support
+.P
+It's possible to create a new workspace within your project by using the
+\fBworkspace\fP config option\. When using \fBnpm init \-w \fP the cli will
+create the folders and boilerplate expected while also adding a reference
+to your project \fBpackage\.json\fP \fB"workspaces": []\fP property in order to make
+sure that new generated \fBworkspace\fR is properly set up as such\.
+.P
+Given a project with no workspaces, e\.g:
+.P
+.RS 2
+.nf
+\|\.
++\-\- package\.json
+.fi
+.RE
+.P
+You may generate a new workspace using the legacy init:
+.P
+.RS 2
+.nf
+$ npm init \-w packages/a
+.fi
+.RE
+.P
+That will generate a new folder and \fBpackage\.json\fP file, while also updating
+your top\-level \fBpackage\.json\fP to add the reference to this new workspace:
+.P
+.RS 2
+.nf
+\|\.
++\-\- package\.json
+`\-\- packages
+ `\-\- a
+ `\-\- package\.json
+.fi
+.RE
+.P
+The workspaces init also supports the \fBnpm init \-w \fP
+syntax, following the same set of rules explained earlier in the initial
+\fBDescription\fR section of this page\. Similar to the previous example of
+creating a new React\-based project using
+\fBcreate\-react\-app\fP \fIhttps://npm\.im/create\-react\-app\fR, the following syntax
+will make sure to create the new react app as a nested \fBworkspace\fR within your
+project and configure your \fBpackage\.json\fP to recognize it as such:
+.P
+.RS 2
+.nf
+npm init \-w packages/my\-react\-app react\-app \.
+.fi
+.RE
+.P
+This will make sure to generate your react app as expected, one important
+consideration to have in mind is that \fBnpm exec\fP is going to be run in the
+context of the newly created folder for that workspace, and that's the reason
+why in this example the initializer uses the initializer name followed with a
+dot to represent the current directory in that context, e\.g: \fBreact\-app \.\fP:
+.P
+.RS 2
+.nf
+\|\.
++\-\- package\.json
+`\-\- packages
+ +\-\- a
+ | `\-\- package\.json
+ `\-\- my\-react\-app
+ +\-\- README
+ +\-\- package\.json
+ `\-\- \.\.\.
+.fi
+.RE
.SS A note on caching
.P
The npm cli utilizes its internal package cache when using the package
@@ -98,6 +182,47 @@ requested from the server\. To force full offline mode, use \fBoffline\fP\|\.
.P
Forces full offline mode\. Any packages not locally cached will result in
an error\.
+.SS workspace
+.RS 0
+.IP \(bu 2
+Alias: \fB\-w\fP
+.IP \(bu 2
+Type: Array
+.IP \(bu 2
+Default: \fB[]\fP
+
+.RE
+.P
+Enable running \fBnpm init\fP in the context of workspaces, creating any missing
+folders, generating files and adding/updating the \fB"workspaces"\fP property of
+the project \fBpackage\.json\fP\|\.
+.P
+the provided names or paths provided\.
+.P
+Valid values for the \fBworkspace\fP config are either:
+.RS 0
+.IP \(bu 2
+Workspace names
+.IP \(bu 2
+Path to a workspace directory
+.IP \(bu 2
+Path to a parent workspace directory (will result to selecting all of the
+children workspaces)
+
+.RE
+.SS workspaces
+.RS 0
+.IP \(bu 2
+Alias: \fB\-ws\fP
+.IP \(bu 2
+Type: Boolean
+.IP \(bu 2
+Default: \fBfalse\fP
+
+.RE
+.P
+Run \fBnpm init\fP in the context of all configured workspaces for the
+current project\.
.SS See Also
.RS 0
.IP \(bu 2
@@ -110,5 +235,7 @@ npm help version
npm help scope
.IP \(bu 2
npm help exec
+.IP \(bu 2
+npm help workspaces
.RE
diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1
index 22eb734e21e9754..448a8514812d453 100644
--- a/deps/npm/man/man1/npm-install-ci-test.1
+++ b/deps/npm/man/man1/npm-install-ci-test.1
@@ -1,4 +1,4 @@
-.TH "NPM\-INSTALL\-CI\-TEST" "1" "April 2021" "" ""
+.TH "NPM\-INSTALL\-CI\-TEST" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-install-ci-test\fR \- Install a project with a clean slate and run tests
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1
index 521d0bc5ebf490d..03efe308f2edcde 100644
--- a/deps/npm/man/man1/npm-install-test.1
+++ b/deps/npm/man/man1/npm-install-test.1
@@ -1,4 +1,4 @@
-.TH "NPM\-INSTALL\-TEST" "1" "April 2021" "" ""
+.TH "NPM\-INSTALL\-TEST" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-install-test\fR \- Install package(s) and run tests
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1
index 5ac2700d8298800..c4567fb29204203 100644
--- a/deps/npm/man/man1/npm-install.1
+++ b/deps/npm/man/man1/npm-install.1
@@ -1,4 +1,4 @@
-.TH "NPM\-INSTALL" "1" "April 2021" "" ""
+.TH "NPM\-INSTALL" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-install\fR \- Install a package
.SS Synopsis
@@ -576,8 +576,6 @@ npm help rebuild
.IP \(bu 2
npm help scripts
.IP \(bu 2
-npm help build
-.IP \(bu 2
npm help config
.IP \(bu 2
npm help npmrc
diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1
index 94afe9c3fdf81fa..404b04a5ce490e6 100644
--- a/deps/npm/man/man1/npm-link.1
+++ b/deps/npm/man/man1/npm-link.1
@@ -1,4 +1,4 @@
-.TH "NPM\-LINK" "1" "April 2021" "" ""
+.TH "NPM\-LINK" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-link\fR \- Symlink a package folder
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1
index 0f94b4663982563..84a6851b284cba1 100644
--- a/deps/npm/man/man1/npm-logout.1
+++ b/deps/npm/man/man1/npm-logout.1
@@ -1,4 +1,4 @@
-.TH "NPM\-LOGOUT" "1" "April 2021" "" ""
+.TH "NPM\-LOGOUT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-logout\fR \- Log out of the registry
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index 6f1041b8dcb83d0..e2d6c980c279e3e 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -1,4 +1,4 @@
-.TH "NPM\-LS" "1" "April 2021" "" ""
+.TH "NPM\-LS" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-ls\fR \- List installed packages
.SS Synopsis
@@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
-npm@7\.10\.0 /path/to/npm
+npm@7\.12\.0 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
diff --git a/deps/npm/man/man1/npm-org.1 b/deps/npm/man/man1/npm-org.1
index 7d85be8760a8ad1..18cb791b071309c 100644
--- a/deps/npm/man/man1/npm-org.1
+++ b/deps/npm/man/man1/npm-org.1
@@ -1,4 +1,4 @@
-.TH "NPM\-ORG" "1" "April 2021" "" ""
+.TH "NPM\-ORG" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-org\fR \- Manage orgs
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1
index d90143428f2e57a..a7309f2dfb994a8 100644
--- a/deps/npm/man/man1/npm-outdated.1
+++ b/deps/npm/man/man1/npm-outdated.1
@@ -1,4 +1,4 @@
-.TH "NPM\-OUTDATED" "1" "April 2021" "" ""
+.TH "NPM\-OUTDATED" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-outdated\fR \- Check for outdated packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1
index 3731b383d7618a8..7140aef06b61447 100644
--- a/deps/npm/man/man1/npm-owner.1
+++ b/deps/npm/man/man1/npm-owner.1
@@ -1,4 +1,4 @@
-.TH "NPM\-OWNER" "1" "April 2021" "" ""
+.TH "NPM\-OWNER" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-owner\fR \- Manage package owners
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1
index adedbef0c1f56cc..ab34dc891d1c135 100644
--- a/deps/npm/man/man1/npm-pack.1
+++ b/deps/npm/man/man1/npm-pack.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PACK" "1" "April 2021" "" ""
+.TH "NPM\-PACK" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-pack\fR \- Create a tarball from a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1
index 9eb5ec12842bc7b..385e4b8a810ba3d 100644
--- a/deps/npm/man/man1/npm-ping.1
+++ b/deps/npm/man/man1/npm-ping.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PING" "1" "April 2021" "" ""
+.TH "NPM\-PING" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-ping\fR \- Ping npm registry
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1
index c4b8a36e954c312..82de74199e923f8 100644
--- a/deps/npm/man/man1/npm-prefix.1
+++ b/deps/npm/man/man1/npm-prefix.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PREFIX" "1" "April 2021" "" ""
+.TH "NPM\-PREFIX" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-prefix\fR \- Display prefix
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-profile.1 b/deps/npm/man/man1/npm-profile.1
index 7b2ff13efae4fe8..d2d412fe8bfa9f9 100644
--- a/deps/npm/man/man1/npm-profile.1
+++ b/deps/npm/man/man1/npm-profile.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PROFILE" "1" "April 2021" "" ""
+.TH "NPM\-PROFILE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-profile\fR \- Change settings on your registry profile
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1
index df8b82eb7b51696..18d5e14dd1a08fe 100644
--- a/deps/npm/man/man1/npm-prune.1
+++ b/deps/npm/man/man1/npm-prune.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PRUNE" "1" "April 2021" "" ""
+.TH "NPM\-PRUNE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-prune\fR \- Remove extraneous packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1
index ac7a0323a72570a..c405f64f27e361f 100644
--- a/deps/npm/man/man1/npm-publish.1
+++ b/deps/npm/man/man1/npm-publish.1
@@ -1,4 +1,4 @@
-.TH "NPM\-PUBLISH" "1" "April 2021" "" ""
+.TH "NPM\-PUBLISH" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-publish\fR \- Publish a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1
index 995c8ab5ea19b13..3a78852b5430efd 100644
--- a/deps/npm/man/man1/npm-rebuild.1
+++ b/deps/npm/man/man1/npm-rebuild.1
@@ -1,4 +1,4 @@
-.TH "NPM\-REBUILD" "1" "April 2021" "" ""
+.TH "NPM\-REBUILD" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-rebuild\fR \- Rebuild a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1
index 30b05534836db04..bdb5452181e77c1 100644
--- a/deps/npm/man/man1/npm-repo.1
+++ b/deps/npm/man/man1/npm-repo.1
@@ -1,4 +1,4 @@
-.TH "NPM\-REPO" "1" "April 2021" "" ""
+.TH "NPM\-REPO" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-repo\fR \- Open package repository page in the browser
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1
index bd212fb466a056f..4ecb71f177e31d0 100644
--- a/deps/npm/man/man1/npm-restart.1
+++ b/deps/npm/man/man1/npm-restart.1
@@ -1,4 +1,4 @@
-.TH "NPM\-RESTART" "1" "April 2021" "" ""
+.TH "NPM\-RESTART" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-restart\fR \- Restart a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1
index ddff01d429e2044..e552a650986d8f2 100644
--- a/deps/npm/man/man1/npm-root.1
+++ b/deps/npm/man/man1/npm-root.1
@@ -1,4 +1,4 @@
-.TH "NPM\-ROOT" "1" "April 2021" "" ""
+.TH "NPM\-ROOT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-root\fR \- Display npm root
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1
index b108b5491feedca..22222c6541e9681 100644
--- a/deps/npm/man/man1/npm-run-script.1
+++ b/deps/npm/man/man1/npm-run-script.1
@@ -1,4 +1,4 @@
-.TH "NPM\-RUN\-SCRIPT" "1" "April 2021" "" ""
+.TH "NPM\-RUN\-SCRIPT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-run-script\fR \- Run arbitrary package scripts
.SS Synopsis
@@ -221,7 +221,7 @@ children workspaces)
.SS workspaces
.RS 0
.IP \(bu 2
-Alias: \fB\-ws\fP
+Alias: \fB\-\-ws\fP
.IP \(bu 2
Type: Boolean
.IP \(bu 2
@@ -245,5 +245,7 @@ npm help restart
npm help stop
.IP \(bu 2
npm help config
+.IP \(bu 2
+npm help workspaces
.RE
diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1
index 068499dc99c2919..5e889b15f62413c 100644
--- a/deps/npm/man/man1/npm-search.1
+++ b/deps/npm/man/man1/npm-search.1
@@ -1,4 +1,4 @@
-.TH "NPM\-SEARCH" "1" "April 2021" "" ""
+.TH "NPM\-SEARCH" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-search\fR \- Search for packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-set-script.1 b/deps/npm/man/man1/npm-set-script.1
index f348099fb48aca2..e9a380ee460e199 100644
--- a/deps/npm/man/man1/npm-set-script.1
+++ b/deps/npm/man/man1/npm-set-script.1
@@ -1,4 +1,4 @@
-.TH "NPM\-SET\-SCRIPT" "1" "April 2021" "" ""
+.TH "NPM\-SET\-SCRIPT" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-set-script\fR \- Set tasks in the scripts section of package\.json
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1
index d349510e5a940cd..a57ffb18187c217 100644
--- a/deps/npm/man/man1/npm-shrinkwrap.1
+++ b/deps/npm/man/man1/npm-shrinkwrap.1
@@ -1,4 +1,4 @@
-.TH "NPM\-SHRINKWRAP" "1" "April 2021" "" ""
+.TH "NPM\-SHRINKWRAP" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-shrinkwrap\fR \- Lock down dependency versions for publication
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1
index e95168e243f9489..49f91c6466e8525 100644
--- a/deps/npm/man/man1/npm-star.1
+++ b/deps/npm/man/man1/npm-star.1
@@ -1,4 +1,4 @@
-.TH "NPM\-STAR" "1" "April 2021" "" ""
+.TH "NPM\-STAR" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-star\fR \- Mark your favorite packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1
index fa16060953c24cb..397cfea91fe5ec0 100644
--- a/deps/npm/man/man1/npm-stars.1
+++ b/deps/npm/man/man1/npm-stars.1
@@ -1,4 +1,4 @@
-.TH "NPM\-STARS" "1" "April 2021" "" ""
+.TH "NPM\-STARS" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-stars\fR \- View packages marked as favorites
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1
index 42d8b6cc96fe12a..84bdff0140dd797 100644
--- a/deps/npm/man/man1/npm-start.1
+++ b/deps/npm/man/man1/npm-start.1
@@ -1,4 +1,4 @@
-.TH "NPM\-START" "1" "April 2021" "" ""
+.TH "NPM\-START" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-start\fR \- Start a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1
index 55be734ed48d3b4..143aa56462d1648 100644
--- a/deps/npm/man/man1/npm-stop.1
+++ b/deps/npm/man/man1/npm-stop.1
@@ -1,4 +1,4 @@
-.TH "NPM\-STOP" "1" "April 2021" "" ""
+.TH "NPM\-STOP" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-stop\fR \- Stop a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1
index 94aa9d89ccafd7f..5816ea1d21bd7bf 100644
--- a/deps/npm/man/man1/npm-team.1
+++ b/deps/npm/man/man1/npm-team.1
@@ -1,4 +1,4 @@
-.TH "NPM\-TEAM" "1" "April 2021" "" ""
+.TH "NPM\-TEAM" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-team\fR \- Manage organization teams and team memberships
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1
index cedbe681982fcce..4dd4bc2335f7580 100644
--- a/deps/npm/man/man1/npm-test.1
+++ b/deps/npm/man/man1/npm-test.1
@@ -1,4 +1,4 @@
-.TH "NPM\-TEST" "1" "April 2021" "" ""
+.TH "NPM\-TEST" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-test\fR \- Test a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-token.1 b/deps/npm/man/man1/npm-token.1
index 5adf0cda6d82612..2b45db5fc4e03bc 100644
--- a/deps/npm/man/man1/npm-token.1
+++ b/deps/npm/man/man1/npm-token.1
@@ -1,4 +1,4 @@
-.TH "NPM\-TOKEN" "1" "April 2021" "" ""
+.TH "NPM\-TOKEN" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-token\fR \- Manage your authentication tokens
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1
index 0de9f431be36cda..0ee2fded986c470 100644
--- a/deps/npm/man/man1/npm-uninstall.1
+++ b/deps/npm/man/man1/npm-uninstall.1
@@ -1,4 +1,4 @@
-.TH "NPM\-UNINSTALL" "1" "April 2021" "" ""
+.TH "NPM\-UNINSTALL" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-uninstall\fR \- Remove a package
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1
index 9645ab106d0c110..e0e2a6c81b2f960 100644
--- a/deps/npm/man/man1/npm-unpublish.1
+++ b/deps/npm/man/man1/npm-unpublish.1
@@ -1,4 +1,4 @@
-.TH "NPM\-UNPUBLISH" "1" "April 2021" "" ""
+.TH "NPM\-UNPUBLISH" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-unpublish\fR \- Remove a package from the registry
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-unstar.1 b/deps/npm/man/man1/npm-unstar.1
index 86c152eb6d27fb7..ec4cf6d2d1ff6fa 100644
--- a/deps/npm/man/man1/npm-unstar.1
+++ b/deps/npm/man/man1/npm-unstar.1
@@ -1,4 +1,4 @@
-.TH "NPM\-UNSTAR" "1" "April 2021" "" ""
+.TH "NPM\-UNSTAR" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-unstar\fR \- Remove an item from your favorite packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1
index adaebe92db336f8..2ac1f9e8478e760 100644
--- a/deps/npm/man/man1/npm-update.1
+++ b/deps/npm/man/man1/npm-update.1
@@ -1,4 +1,4 @@
-.TH "NPM\-UPDATE" "1" "April 2021" "" ""
+.TH "NPM\-UPDATE" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-update\fR \- Update packages
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1
index d926c9e5282eee5..02de076a10c4c15 100644
--- a/deps/npm/man/man1/npm-version.1
+++ b/deps/npm/man/man1/npm-version.1
@@ -1,4 +1,4 @@
-.TH "NPM\-VERSION" "1" "April 2021" "" ""
+.TH "NPM\-VERSION" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-version\fR \- Bump a package version
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1
index 5ecf79851399a96..b3dac21b7572b17 100644
--- a/deps/npm/man/man1/npm-view.1
+++ b/deps/npm/man/man1/npm-view.1
@@ -1,4 +1,4 @@
-.TH "NPM\-VIEW" "1" "April 2021" "" ""
+.TH "NPM\-VIEW" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-view\fR \- View registry info
.SS Synopsis
@@ -111,6 +111,20 @@ this:
npm view connect versions
.fi
.RE
+.SS Configuration
+.SS json
+.P
+Show information in JSON format\. See \fBOutput\fP \fI#output\fR below\.
+.SS workspaces
+.P
+Enables workspaces context while searching the \fBpackage\.json\fP in the
+current folder\. Information about packages named in each workspace will
+be viewed\.
+.SS workspace
+.P
+Enables workspaces context and limits results to only those specified by
+this config item\. Only the information about packages named in the
+workspaces given here will be viewed\.
.SS Output
.P
If only a single string field for a single version is output, then it
diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1
index c38b46dff07ab3d..ed54f2f00bc682f 100644
--- a/deps/npm/man/man1/npm-whoami.1
+++ b/deps/npm/man/man1/npm-whoami.1
@@ -1,4 +1,4 @@
-.TH "NPM\-WHOAMI" "1" "April 2021" "" ""
+.TH "NPM\-WHOAMI" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-whoami\fR \- Display npm username
.SS Synopsis
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 595b8e68477b821..19f5b3c30b51f95 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -1,4 +1,4 @@
-.TH "NPM" "1" "April 2021" "" ""
+.TH "NPM" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm\fR \- javascript package manager
.SS Synopsis
@@ -10,7 +10,7 @@ npm [args]
.RE
.SS Version
.P
-7\.10\.0
+7\.12\.0
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
diff --git a/deps/npm/man/man1/npx.1 b/deps/npm/man/man1/npx.1
index 87c018f4121915e..76305688fb0e735 100644
--- a/deps/npm/man/man1/npx.1
+++ b/deps/npm/man/man1/npx.1
@@ -1,4 +1,4 @@
-.TH "NPX" "1" "April 2021" "" ""
+.TH "NPX" "1" "May 2021" "" ""
.SH "NAME"
\fBnpx\fR \- Run a command from a local or remote npm package
.SS Synopsis
diff --git a/deps/npm/man/man5/folders.5 b/deps/npm/man/man5/folders.5
index cacb710a03b030d..ccf0c4f6e8f17ab 100644
--- a/deps/npm/man/man5/folders.5
+++ b/deps/npm/man/man5/folders.5
@@ -1,4 +1,4 @@
-.TH "FOLDERS" "5" "April 2021" "" ""
+.TH "FOLDERS" "5" "May 2021" "" ""
.SH "NAME"
\fBfolders\fR \- Folder Structures Used by npm
.SS Description
diff --git a/deps/npm/man/man5/install.5 b/deps/npm/man/man5/install.5
index 445353eb8565e0e..5fc6f442a922687 100644
--- a/deps/npm/man/man5/install.5
+++ b/deps/npm/man/man5/install.5
@@ -1,4 +1,4 @@
-.TH "INSTALL" "5" "April 2021" "" ""
+.TH "INSTALL" "5" "May 2021" "" ""
.SH "NAME"
\fBinstall\fR \- Download and install node and npm
.SS Description
diff --git a/deps/npm/man/man5/npm-shrinkwrap-json.5 b/deps/npm/man/man5/npm-shrinkwrap-json.5
index 27076ba3361fe9c..2fdbdd139a9f821 100644
--- a/deps/npm/man/man5/npm-shrinkwrap-json.5
+++ b/deps/npm/man/man5/npm-shrinkwrap-json.5
@@ -1,4 +1,4 @@
-.TH "NPM\-SHRINKWRAP\.JSON" "5" "April 2021" "" ""
+.TH "NPM\-SHRINKWRAP\.JSON" "5" "May 2021" "" ""
.SH "NAME"
\fBnpm-shrinkwrap.json\fR \- A publishable lockfile
.SS Description
diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5
index f880a269513a6b4..1ecd71ff2145409 100644
--- a/deps/npm/man/man5/npmrc.5
+++ b/deps/npm/man/man5/npmrc.5
@@ -1,4 +1,4 @@
-.TH "NPMRC" "5" "April 2021" "" ""
+.TH "NPMRC" "5" "May 2021" "" ""
.SH "NAME"
\fBnpmrc\fR \- The npm config files
.SS Description
diff --git a/deps/npm/man/man5/package-json.5 b/deps/npm/man/man5/package-json.5
index 9943296b25c3536..8b5b12e03829a68 100644
--- a/deps/npm/man/man5/package-json.5
+++ b/deps/npm/man/man5/package-json.5
@@ -1,4 +1,4 @@
-.TH "PACKAGE\.JSON" "5" "April 2021" "" ""
+.TH "PACKAGE\.JSON" "5" "May 2021" "" ""
.SH "NAME"
\fBpackage.json\fR \- Specifics of npm's package\.json handling
.SS Description
@@ -437,6 +437,8 @@ would be the same as this:
Please make sure that your file(s) referenced in \fBbin\fP starts with
\fB#!/usr/bin/env node\fP, otherwise the scripts are started without the node
executable!
+.P
+Note that you can also set the executable files using directories\.bin \fI#directoriesbin\fR\|\.
.SS man
.P
Specify either a single file or an array of filenames to put in place for
@@ -622,7 +624,7 @@ tarball or git URL\.
\fBPlease do not put test harnesses or transpilers or other "development"
time tools in your \fBdependencies\fP object\.\fR See \fBdevDependencies\fP, below\.
.P
-See npm help semver for more details about specifying version ranges\.
+See semver \fIhttps://github\.com/npm/node\-semver#versions\fR for more details about specifying version ranges\.
.RS 0
.IP \(bu 2
\fBversion\fP Must match \fBversion\fP exactly
diff --git a/deps/npm/man/man5/package-lock-json.5 b/deps/npm/man/man5/package-lock-json.5
index 765dd8499948a1c..20bedd300097579 100644
--- a/deps/npm/man/man5/package-lock-json.5
+++ b/deps/npm/man/man5/package-lock-json.5
@@ -1,4 +1,4 @@
-.TH "PACKAGE\-LOCK\.JSON" "5" "April 2021" "" ""
+.TH "PACKAGE\-LOCK\.JSON" "5" "May 2021" "" ""
.SH "NAME"
\fBpackage-lock.json\fR \- A manifestation of the manifest
.SS Description
diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7
index 211651fed6412f0..b8884ded13e4d2d 100644
--- a/deps/npm/man/man7/config.7
+++ b/deps/npm/man/man7/config.7
@@ -1,4 +1,4 @@
-.TH "CONFIG" "7" "April 2021" "" ""
+.TH "CONFIG" "7" "May 2021" "" ""
.SH "NAME"
\fBconfig\fR \- More than you probably want to know about npm configuration
.SS Description
@@ -217,17 +217,6 @@ Type: Boolean
.P
Prevents throwing an error when \fBnpm version\fP is used to set the new version
to the same value as the current version\.
-.SS \fBalways\-auth\fP
-.RS 0
-.IP \(bu 2
-Default: false
-.IP \(bu 2
-Type: Boolean
-
-.RE
-.P
-Force npm to always require authentication when accessing the registry, even
-for \fBGET\fP requests\.
.SS \fBaudit\fP
.RS 0
.IP \(bu 2
@@ -1455,7 +1444,8 @@ Type: null or String
.RE
.P
-The shell to use for scripts run with the \fBnpm run\fP command\.
+The shell to use for scripts run with the \fBnpm exec\fP, \fBnpm run\fP and \fBnpm
+init \fP commands\.
.SS \fBsearchexclude\fP
.RS 0
.IP \(bu 2
@@ -1676,7 +1666,8 @@ Show short usage output about the command specified\.
.SS \fBuser\-agent\fP
.RS 0
.IP \(bu 2
-Default: "npm/{npm\-version} node/{node\-version} {platform} {arch} {ci}"
+Default: "npm/{npm\-version} node/{node\-version} {platform} {arch}
+workspaces/{workspaces} {ci}"
.IP \(bu 2
Type: String
@@ -1694,6 +1685,9 @@ their actual counterparts:
.IP \(bu 2
\fB{arch}\fP \- The value of \fBprocess\.arch\fP
.IP \(bu 2
+\fB{workspaces}\fP \- Set to \fBtrue\fP if the \fBworkspaces\fP or \fBworkspace\fP options
+are set\.
+.IP \(bu 2
\fB{ci}\fP \- The value of the \fBci\-name\fP config, if set, prefixed with \fBci/\fP, or
an empty string if \fBci\-name\fP is empty\.
diff --git a/deps/npm/man/man7/developers.7 b/deps/npm/man/man7/developers.7
index 00dc1b14e2415b8..0935fea65f509f8 100644
--- a/deps/npm/man/man7/developers.7
+++ b/deps/npm/man/man7/developers.7
@@ -1,4 +1,4 @@
-.TH "DEVELOPERS" "7" "April 2021" "" ""
+.TH "DEVELOPERS" "7" "May 2021" "" ""
.SH "NAME"
\fBdevelopers\fR \- Developer Guide
.SS Description
diff --git a/deps/npm/man/man7/orgs.7 b/deps/npm/man/man7/orgs.7
index 7f29cf2c2397301..13c9b9dbadf1c36 100644
--- a/deps/npm/man/man7/orgs.7
+++ b/deps/npm/man/man7/orgs.7
@@ -1,4 +1,4 @@
-.TH "ORGS" "7" "April 2021" "" ""
+.TH "ORGS" "7" "May 2021" "" ""
.SH "NAME"
\fBorgs\fR \- Working with Teams & Orgs
.SS Description
diff --git a/deps/npm/man/man7/registry.7 b/deps/npm/man/man7/registry.7
index 2ff87e4a4c45e82..941a1450073139b 100644
--- a/deps/npm/man/man7/registry.7
+++ b/deps/npm/man/man7/registry.7
@@ -1,4 +1,4 @@
-.TH "REGISTRY" "7" "April 2021" "" ""
+.TH "REGISTRY" "7" "May 2021" "" ""
.SH "NAME"
\fBregistry\fR \- The JavaScript Package Registry
.SS Description
diff --git a/deps/npm/man/man7/removal.7 b/deps/npm/man/man7/removal.7
index e3508f6696d720a..ead032bfdf457d0 100644
--- a/deps/npm/man/man7/removal.7
+++ b/deps/npm/man/man7/removal.7
@@ -1,4 +1,4 @@
-.TH "REMOVAL" "7" "April 2021" "" ""
+.TH "REMOVAL" "7" "May 2021" "" ""
.SH "NAME"
\fBremoval\fR \- Cleaning the Slate
.SS Synopsis
diff --git a/deps/npm/man/man7/scope.7 b/deps/npm/man/man7/scope.7
index 2a0fa9e1c8ea7f9..716946d732afb7e 100644
--- a/deps/npm/man/man7/scope.7
+++ b/deps/npm/man/man7/scope.7
@@ -1,4 +1,4 @@
-.TH "SCOPE" "7" "April 2021" "" ""
+.TH "SCOPE" "7" "May 2021" "" ""
.SH "NAME"
\fBscope\fR \- Scoped packages
.SS Description
diff --git a/deps/npm/man/man7/scripts.7 b/deps/npm/man/man7/scripts.7
index 2dc2486de7d51be..63ebce805b4d8f0 100644
--- a/deps/npm/man/man7/scripts.7
+++ b/deps/npm/man/man7/scripts.7
@@ -1,4 +1,4 @@
-.TH "SCRIPTS" "7" "April 2021" "" ""
+.TH "SCRIPTS" "7" "May 2021" "" ""
.SH "NAME"
\fBscripts\fR \- How npm handles the "scripts" field
.SS Description
@@ -160,13 +160,6 @@ These all run after the actual installation of modules into
.IP \(bu 2
\fBprepare\fP
-.RE
-.SS npm help \fBenv\fP
-.RS 0
-.IP \(bu 2
-\fBenv\fP (You can override the default behavior of \fBnpm env\fP by defining
- a custom \fBenv\fP entry in your \fBscripts\fP object)
-
.RE
.SS npm help \fBinstall\fP
.P
diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7
index 5b28ac54c5d1cb4..dbb63528d6da752 100644
--- a/deps/npm/man/man7/workspaces.7
+++ b/deps/npm/man/man7/workspaces.7
@@ -1,4 +1,4 @@
-.TH "WORKSPACES" "7" "April 2021" "" ""
+.TH "WORKSPACES" "7" "May 2021" "" ""
.SH "NAME"
\fBworkspaces\fR \- Working with workspaces
.SS Description
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js
index a7d20a1f5364700..9420bca3c320cd5 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/logging.js
@@ -20,13 +20,21 @@ const levelMap = new Map(levels.reduce((set, level, index) => {
}, []))
const { inspect, format } = require('util')
+const colors = process.stderr.isTTY
+const magenta = colors ? msg => `\x1B[35m${msg}\x1B[39m` : m => m
if (loglevel !== 'silent') {
process.on('log', (level, ...args) => {
if (levelMap.get(level) < levelMap.get(loglevel))
return
- const pref = `${process.pid} ${level} `
+ const pref = `${process.pid} ${magenta(level)} `
if (level === 'warn' && args[0] === 'ERESOLVE')
- args[2] = inspect(args[2], { depth: 10 })
+ args[2] = inspect(args[2], { depth: 10, colors })
+ else {
+ args = args.map(a => {
+ return typeof a === 'string' ? a
+ : inspect(a, { depth: 10, colors })
+ })
+ }
const msg = pref + format(...args).trim().split('\n').join(`\n${pref}`)
console.error(msg)
})
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js
index 3b73c0bf6ddd322..e72217c1e4ed9cf 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/lib/timers.js
@@ -1,4 +1,5 @@
const timers = Object.create(null)
+const { format } = require('util')
process.on('time', name => {
if (timers[name])
@@ -6,17 +7,20 @@ process.on('time', name => {
timers[name] = process.hrtime()
})
+const dim = process.stderr.isTTY ? msg => `\x1B[2m${msg}\x1B[22m` : m => m
+const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m
process.on('timeEnd', name => {
if (!timers[name])
throw new Error('timer not started! ' + name)
const res = process.hrtime(timers[name])
delete timers[name]
- console.error(`${process.pid} ${name}`, res[0] * 1e3 + res[1] / 1e6)
+ const msg = format(`${process.pid} ${name}`, res[0] * 1e3 + res[1] / 1e6)
+ console.error(dim(msg))
})
process.on('exit', () => {
for (const name of Object.keys(timers)) {
- console.error('Dangling timer: ', name)
+ console.error(red('Dangling timer:'), name)
process.exitCode = 1
}
})
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js
index 7f90f20cf381766..3352802c2de873d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/virtual.js
@@ -8,7 +8,8 @@ require('./lib/timers.js')
const start = process.hrtime()
new Arborist(options).loadVirtual().then(tree => {
const end = process.hrtime(start)
- print(tree)
+ if (!options.quiet)
+ print(tree)
if (options.save)
tree.meta.save()
console.error(`read ${tree.inventory.size} deps in ${end[0] * 1000 + end[1] / 1e6}ms`)
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
index 9a96fd1b3797cd0..25113cbedff39df 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/add-rm-pkg-deps.js
@@ -1,60 +1,60 @@
// add and remove dependency specs to/from pkg manifest
-const removeFromOthers = (name, type, pkg) => {
- const others = new Set([
- 'dependencies',
- 'optionalDependencies',
- 'devDependencies',
- 'peerDependenciesMeta',
- 'peerDependencies',
- ])
-
- switch (type) {
- case 'prod':
- others.delete('dependencies')
- break
- case 'dev':
- others.delete('devDependencies')
- others.delete('peerDependencies')
- others.delete('peerDependenciesMeta')
- break
- case 'optional':
- others.delete('optionalDependencies')
- break
- case 'peer':
- case 'peerOptional':
- others.delete('devDependencies')
- others.delete('peerDependencies')
- others.delete('peerDependenciesMeta')
- break
- }
-
- for (const other of others)
- deleteSubKey(pkg, other, name)
-}
-
-const add = ({pkg, add, saveBundle, saveType}) => {
+const add = ({pkg, add, saveBundle, saveType, log}) => {
for (const spec of add)
- addSingle({pkg, spec, saveBundle, saveType})
+ addSingle({pkg, spec, saveBundle, saveType, log})
return pkg
}
-const addSingle = ({pkg, spec, saveBundle, saveType}) => {
- if (!saveType)
- saveType = getSaveType(pkg, spec)
+// Canonical source of both the map between saveType and where it correlates to
+// in the package, and the names of all our dependencies attributes
+const saveTypeMap = new Map([
+ ['dev', 'devDependencies'],
+ ['optional', 'optionalDependencies'],
+ ['prod', 'dependencies'],
+ ['peerOptional', 'peerDependencies'],
+ ['peer', 'peerDependencies'],
+])
+const addSingle = ({pkg, spec, saveBundle, saveType, log}) => {
const { name, rawSpec } = spec
- removeFromOthers(name, saveType, pkg)
- const type = saveType === 'prod' ? 'dependencies'
- : saveType === 'optional' ? 'optionalDependencies'
- : saveType === 'peer' || saveType === 'peerOptional' ? 'peerDependencies'
- : saveType === 'dev' ? 'devDependencies'
- : /* istanbul ignore next */ null
- pkg[type] = pkg[type] || {}
- if (rawSpec !== '' || pkg[type][name] === undefined)
- pkg[type][name] = rawSpec || '*'
+ // if the user does not give us a type, we infer which type(s)
+ // to keep based on the same order of priority we do when
+ // building the tree as defined in the _loadDeps method of
+ // the node class.
+ if (!saveType)
+ saveType = inferSaveType(pkg, spec.name)
+
+ if (saveType === 'prod') {
+ // a production dependency can only exist as production (rpj ensures it
+ // doesn't coexist w/ optional)
+ deleteSubKey(pkg, 'devDependencies', name, 'dependencies', log)
+ deleteSubKey(pkg, 'peerDependencies', name, 'dependencies', log)
+ } else if (saveType === 'dev') {
+ // a dev dependency may co-exist as peer, or optional, but not production
+ deleteSubKey(pkg, 'dependencies', name, 'devDependencies', log)
+ } else if (saveType === 'optional') {
+ // an optional dependency may co-exist as dev (rpj ensures it doesn't
+ // coexist w/ prod)
+ deleteSubKey(pkg, 'peerDependencies', name, 'optionalDependencies', log)
+ } else { // peer or peerOptional is all that's left
+ // a peer dependency may coexist as dev
+ deleteSubKey(pkg, 'dependencies', name, 'peerDependencies', log)
+ deleteSubKey(pkg, 'optionalDependencies', name, 'peerDependencies', log)
+ }
+
+ const depType = saveTypeMap.get(saveType)
+
+ pkg[depType] = pkg[depType] || {}
+ if (rawSpec !== '' || pkg[depType][name] === undefined)
+ pkg[depType][name] = rawSpec || '*'
+ if (saveType === 'optional') {
+ // Affordance for previous npm versions that require this behaviour
+ pkg.dependencies = pkg.dependencies || {}
+ pkg.dependencies[name] = pkg.optionalDependencies[name]
+ }
if (saveType === 'peer' || saveType === 'peerOptional') {
const pdm = pkg.peerDependenciesMeta || {}
@@ -79,47 +79,49 @@ const addSingle = ({pkg, spec, saveBundle, saveType}) => {
}
}
-const getSaveType = (pkg, spec) => {
- const {name} = spec
- const {
- // these names are so lonnnnngggg
- devDependencies: devDeps,
- optionalDependencies: optDeps,
- peerDependencies: peerDeps,
- peerDependenciesMeta: peerDepsMeta,
- } = pkg
-
- if (peerDeps && peerDeps[name] !== undefined) {
- if (peerDepsMeta && peerDepsMeta[name] && peerDepsMeta[name].optional)
- return 'peerOptional'
- else
- return 'peer'
- } else if (devDeps && devDeps[name] !== undefined)
- return 'dev'
- else if (optDeps && optDeps[name] !== undefined)
- return 'optional'
- else
- return 'prod'
+// Finds where the package is already in the spec and infers saveType from that
+const inferSaveType = (pkg, name) => {
+ for (const saveType of saveTypeMap.keys()) {
+ if (hasSubKey(pkg, saveTypeMap.get(saveType), name)) {
+ if (
+ saveType === 'peerOptional' &&
+ (!hasSubKey(pkg, 'peerDependenciesMeta', name) ||
+ !pkg.peerDependenciesMeta[name].optional)
+ )
+ return 'peer'
+ return saveType
+ }
+ }
+ return 'prod'
}
-const deleteSubKey = (obj, k, sk) => {
- if (obj[k]) {
- delete obj[k][sk]
- if (!Object.keys(obj[k]).length)
- delete obj[k]
+const hasSubKey = (pkg, depType, name) => {
+ return pkg[depType] && Object.prototype.hasOwnProperty.call(pkg[depType], name)
+}
+
+// Removes a subkey and warns about it if it's being replaced
+const deleteSubKey = (pkg, depType, name, replacedBy, log) => {
+ if (hasSubKey(pkg, depType, name)) {
+ if (replacedBy && log)
+ log.warn('idealTree', `Removing ${depType}.${name} in favor of ${replacedBy}.${name}`)
+ delete pkg[depType][name]
+
+ // clean up peerDependenciesMeta if we are removing something from peerDependencies
+ if (depType === 'peerDependencies' && pkg.peerDependenciesMeta) {
+ delete pkg.peerDependenciesMeta[name]
+ if (!Object.keys(pkg.peerDependenciesMeta).length)
+ delete pkg.peerDependenciesMeta
+ }
+
+ if (!Object.keys(pkg[depType]).length)
+ delete pkg[depType]
}
}
const rm = (pkg, rm) => {
- for (const type of [
- 'dependencies',
- 'optionalDependencies',
- 'peerDependencies',
- 'peerDependenciesMeta',
- 'devDependencies',
- ]) {
+ for (const depType of new Set(saveTypeMap.values())) {
for (const name of rm)
- deleteSubKey(pkg, type, name)
+ deleteSubKey(pkg, depType, name)
}
if (pkg.bundleDependencies) {
pkg.bundleDependencies = pkg.bundleDependencies
@@ -130,4 +132,4 @@ const rm = (pkg, rm) => {
return pkg
}
-module.exports = { add, rm }
+module.exports = { add, rm, saveTypeMap, hasSubKey }
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index f836fc04d8826f7..6176707c3c65111 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -47,6 +47,7 @@ const _flagsSuspect = Symbol.for('flagsSuspect')
const _workspaces = Symbol.for('workspaces')
const _prune = Symbol('prune')
const _preferDedupe = Symbol('preferDedupe')
+const _pruneDedupable = Symbol('pruneDedupable')
const _legacyBundling = Symbol('legacyBundling')
const _parseSettings = Symbol('parseSettings')
const _initTree = Symbol('initTree')
@@ -503,6 +504,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
saveBundle,
saveType,
path: this.path,
+ log: this.log,
})
})
}
@@ -1188,6 +1190,16 @@ This is a one-time fix-up, please be patient...
}
}
+ // There is something present already, and we're not happy about it
+ // See if the thing we WOULD be happy with is also going to satisfy
+ // the other dependents on the current node.
+ const current = edge.to
+ const dep = await this[_nodeFromEdge](edge, null, null, required)
+ if (dep.canReplace(current)) {
+ await this[_nodeFromEdge](edge, node.parent, null, required)
+ continue
+ }
+
// at this point we know that there is a dep there, and
// we don't like it. always fail strictly, always allow forcibly or
// in non-strict mode if it's not our fault. don't warn here, because
@@ -1332,6 +1344,21 @@ This is a one-time fix-up, please be patient...
// this is an overridden peer dep
this[_warnPeerConflict](edge)
}
+
+ // if we get a KEEP in a update scenario, then we MAY have something
+ // already duplicating this unnecessarily! For example:
+ // ```
+ // root
+ // +-- x (dep: y@1.x)
+ // | +-- y@1.0.0
+ // +-- y@1.1.0
+ // ```
+ // Now say we do `reify({update:['y']})`, and the latest version is
+ // 1.1.0, which we already have in the root. We'll try to place y@1.1.0
+ // first in x, then in the root, ending with KEEP, because we already
+ // have it. In that case, we ought to REMOVE the nm/x/nm/y node, because
+ // it is an unnecessary duplicate.
+ this[_pruneDedupable](target, true)
return []
}
@@ -1387,8 +1414,8 @@ This is a one-time fix-up, please be patient...
// MAY end up putting a better/identical node further up the tree in
// a way that causes an unnecessary duplication. If so, remove the
// now-unnecessary node.
- if (edge.valid && edge.to.parent !== target && newDep.canReplace(edge.to))
- edge.to.parent = null
+ if (edge.valid && edge.to && edge.to !== newDep)
+ this[_pruneDedupable](edge.to, false)
// visit any dependents who are upset by this change
// if it's an angry overridden peer edge, however, make sure we
@@ -1404,30 +1431,8 @@ This is a one-time fix-up, please be patient...
// prune anything deeper in the tree that can be replaced by this
if (this.idealTree) {
for (const node of this.idealTree.inventory.query('name', newDep.name)) {
- if (node !== newDep &&
- node.isDescendantOf(target) &&
- !node.inShrinkwrap &&
- !node.inBundle &&
- node.canReplaceWith(newDep)) {
- // don't prune if the dupe is necessary!
- // root (a, d)
- // +-- a (b, c2)
- // | +-- b (c2) <-- place c2 for b, lands at root
- // +-- d (e)
- // +-- e (c1, d)
- // +-- c1
- // +-- f (c2)
- // +-- c2 <-- pruning this would be bad
-
- const mask = node.parent !== target &&
- node.parent &&
- node.parent.parent &&
- node.parent.parent !== target &&
- node.parent.parent.resolve(newDep.name)
-
- if (!mask || mask === newDep || node.canReplaceWith(mask))
- node.parent = null
- }
+ if (node.isDescendantOf(target))
+ this[_pruneDedupable](node, false)
}
}
@@ -1460,6 +1465,21 @@ This is a one-time fix-up, please be patient...
return placed
}
+ // prune all the nodes in a branch of the tree that can be safely removed
+ // This is only the most basic duplication detection; it finds if there
+ // is another satisfying node further up the tree, and if so, dedupes.
+ // Even in legacyBundling mode, we do this amount of deduplication.
+ [_pruneDedupable] (node, descend = true) {
+ if (node.canDedupe(this[_preferDedupe])) {
+ node.root = null
+ return
+ }
+ if (descend) {
+ for (const child of node.children.values())
+ this[_pruneDedupable](child)
+ }
+ }
+
[_pruneForReplacement] (node, oldDeps) {
// gather up all the invalid edgesOut, and any now-extraneous
// deps that the new node doesn't depend on but the old one did.
@@ -1612,32 +1632,137 @@ This is a one-time fix-up, please be patient...
// placed here as well. the virtualRoot already has the appropriate
// overrides applied.
if (peerEntryEdge) {
- const peerSet = getPeerSet(current)
- OUTER: for (const p of peerSet) {
- // if any have a non-peer dep from the target, or a peer dep if
- // the target is root, then cannot safely replace and dupe deeper.
+ const currentPeerSet = getPeerSet(current)
+
+ // We are effectively replacing currentPeerSet with newPeerSet
+ // If there are any non-peer deps coming into the currentPeerSet,
+ // which are currently valid, and are from the target, then that
+ // means that we have to ensure that they're not going to be made
+ // invalid by putting the newPeerSet in place.
+ // If the edge comes from somewhere deeper than the target, then
+ // that's fine, because we'll create an invalid edge, detect it,
+ // and duplicate the node further into the tree.
+ // loop through the currentPeerSet checking for valid edges on
+ // the members of the peer set which will be made invalid.
+ const targetEdges = new Set()
+ for (const p of currentPeerSet) {
for (const edge of p.edgesIn) {
- if (peerSet.has(edge.from))
+ // edge from within the peerSet, ignore
+ if (currentPeerSet.has(edge.from))
continue
+ // only care about valid edges from target.
+ // edges from elsewhere can dupe if offended, invalid edges
+ // are already being fixed or will be later.
+ if (edge.from !== target || !edge.valid)
+ continue
+ targetEdges.add(edge)
+ }
+ }
- // only respect valid edges, however, since we're likely trying
- // to fix the very one that's currently broken! If the virtual
- // root's replacement is ok, and doesn't have any invalid edges
- // indicating that it was an overridden peer, then ignore the
- // conflict and continue. If it WAS an override, then we need
- // to get the conflict here so that we can decide whether to
- // accept the current dep node, clobber it, or fail the install.
- if (edge.from === target && edge.valid) {
- const rep = dep.parent.children.get(edge.name)
- const override = rep && ([...rep.edgesIn].some(e => !e.valid))
- if (!rep || !rep.satisfies(edge) || override) {
+ for (const edge of targetEdges) {
+ // see if we intend to replace this one anyway
+ const rep = dep.parent.children.get(edge.name)
+ const current = edge.to
+ if (!rep) {
+ // this isn't one we're replacing. but it WAS included in the
+ // peerSet for some reason, so make sure that it's still
+ // ok with the replacements in the new peerSet
+ for (const curEdge of current.edgesOut.values()) {
+ const newRepDep = dep.parent.children.get(curEdge.name)
+ if (curEdge.valid && newRepDep && !newRepDep.satisfies(curEdge)) {
canReplace = false
- break OUTER
+ break
}
}
+ continue
+ }
+
+ // was this replacement already an override of some sort?
+ const override = [...rep.edgesIn].some(e => !e.valid)
+ // if we have a rep, and it's ok to put in this location, and
+ // it's not already part of an override in the peerSet, then
+ // we can continue with it.
+ if (rep.satisfies(edge) && !override)
+ continue
+ // Otherwise, we cannot replace.
+ canReplace = false
+ break
+ }
+ // if we're going to be replacing the peerSet, we have to remove
+ // and re-resolve any members of the old peerSet that are not
+ // present in the new one, and which will have invalid edges.
+ // We know that they're not depended upon by the target, or else
+ // they would have caused a conflict, so they'll get landed deeper
+ // in the tree, if possible.
+ if (canReplace) {
+ let needNesting = false
+ OUTER: for (const node of currentPeerSet) {
+ const rep = dep.parent.children.get(node.name)
+ // has a replacement, already addressed above
+ if (rep)
+ continue
+
+ // ok, it has been placed here to dedupe, see if it needs to go
+ // back deeper within the tree.
+ for (const edge of node.edgesOut.values()) {
+ const repDep = dep.parent.children.get(edge.name)
+ // not in new peerSet, maybe fine.
+ if (!repDep)
+ continue
+
+ // new thing will be fine, no worries
+ if (repDep.satisfies(edge))
+ continue
+
+ // uhoh, we'll have to nest them.
+ needNesting = true
+ break OUTER
+ }
+ }
+
+ // to nest, just delete everything without a target dep
+ // that's in the current peerSet, and add their dependants
+ // to the _depsQueue for evaluation. Some of these MAY end
+ // up in the same location again, and that's fine.
+ if (needNesting) {
+ // avoid mutating the tree while we're examining it
+ const dependants = new Set()
+ const reresolve = new Set()
+ OUTER: for (const node of currentPeerSet) {
+ const rep = dep.parent.children.get(node.name)
+ if (rep)
+ continue
+ // create a separate set for each one, so we can skip any
+ // that might somehow have an incoming target edge
+ const deps = new Set()
+ for (const edge of node.edgesIn) {
+ // a target dep, skip this dep entirely, already addressed
+ // ignoring for coverage, because it really ought to be
+ // impossible, but I can't prove it yet, so this is here
+ // for safety.
+ /* istanbul ignore if - should be impossible */
+ if (edge.from === target)
+ continue OUTER
+ // ignore this edge, it'll either be replaced or re-resolved
+ if (currentPeerSet.has(edge.from))
+ continue
+ // ok, we care about this one.
+ deps.add(edge.from)
+ }
+ reresolve.add(node)
+ for (const d of deps)
+ dependants.add(d)
+ }
+ for (const dependant of dependants) {
+ this[_depsQueue].push(dependant)
+ this[_depsSeen].delete(dependant)
+ }
+ for (const node of reresolve)
+ node.root = null
}
}
}
+
if (canReplace) {
const ret = this[_canPlacePeers](dep, target, edge, REPLACE, peerEntryEdge, peerPath, isSource)
/* istanbul ignore else - extremely rare that the peer set would
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
index 09a6f700547f21b..3578d50389ea64d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
@@ -29,6 +29,7 @@
const {resolve} = require('path')
const {homedir} = require('os')
const procLog = require('../proc-log.js')
+const { saveTypeMap } = require('../add-rm-pkg-deps.js')
const mixins = [
require('../tracker.js'),
@@ -54,9 +55,11 @@ class Arborist extends Base {
...options,
path: options.path || '.',
cache: options.cache || `${homedir()}/.npm/_cacache`,
- packumentCache: new Map(),
+ packumentCache: options.packumentCache || new Map(),
log: options.log || procLog,
}
+ if (options.saveType && !saveTypeMap.get(options.saveType))
+ throw new Error(`Invalid saveType ${options.saveType}`)
this.cache = resolve(this.options.cache)
this.path = resolve(this.options.path)
process.emit('timeEnd', 'arborist:ctor')
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
index 3a38905b77433d7..2a222249d7a482f 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
@@ -93,7 +93,8 @@ module.exports = cls => class VirtualLoader extends cls {
this.virtualTree = root
const {links, nodes} = this[resolveNodes](s, root)
await this[resolveLinks](links, nodes)
- this[assignBundles](nodes)
+ if (!(s.originalLockfileVersion >= 2))
+ this[assignBundles](nodes)
if (this[flagsSuspect])
this[reCalcDepFlags](nodes.values())
return root
@@ -220,22 +221,24 @@ module.exports = cls => class VirtualLoader extends cls {
[assignBundles] (nodes) {
for (const [location, node] of nodes) {
// Skip assignment of parentage for the root package
- if (!location)
+ if (!location || node.target && !node.target.location)
continue
const { name, parent, package: { inBundle }} = node
+
if (!parent)
continue
// read inBundle from package because 'package' here is
// actually a v2 lockfile metadata entry.
- // If the *parent* is also bundled, though, then we assume
- // that it's being pulled in just by virtue of that.
+ // If the *parent* is also bundled, though, or if the parent has
+ // no dependency on it, then we assume that it's being pulled in
+ // just by virtue of its parent or a transitive dep being bundled.
const { package: ppkg } = parent
const { inBundle: parentBundled } = ppkg
- if (inBundle && !parentBundled) {
+ if (inBundle && !parentBundled && parent.edgesOut.has(node.name)) {
if (!ppkg.bundleDependencies)
ppkg.bundleDependencies = [name]
- else if (!ppkg.bundleDependencies.includes(name))
+ else
ppkg.bundleDependencies.push(name)
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
index 9c52d009d6fd8d4..390d3ce42aecd28 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
@@ -115,10 +115,6 @@ module.exports = cls => class Builder extends cls {
await this[_runScripts]('preinstall')
if (this[_binLinks] && type !== 'links')
await this[_linkAllBins]()
- if (!this[_ignoreScripts]) {
- await this[_runScripts]('install')
- await this[_runScripts]('postinstall')
- }
// links should also run prepare scripts and only link bins after that
if (type === 'links') {
@@ -128,6 +124,11 @@ module.exports = cls => class Builder extends cls {
await this[_linkAllBins]()
}
+ if (!this[_ignoreScripts]) {
+ await this[_runScripts]('install')
+ await this[_runScripts]('postinstall')
+ }
+
process.emit('timeEnd', `build:${type}`)
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
index aaaa3d61c862b9e..f7731e1c90da08f 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js
@@ -3,9 +3,8 @@
const onExit = require('../signal-handling.js')
const pacote = require('pacote')
const rpj = require('read-package-json-fast')
-const { updateDepSpec } = require('../dep-spec.js')
const AuditReport = require('../audit-report.js')
-const {subset} = require('semver')
+const {subset, intersects} = require('semver')
const npa = require('npm-package-arg')
const {dirname, resolve, relative} = require('path')
@@ -28,6 +27,7 @@ const promiseAllRejectLate = require('promise-all-reject-late')
const optionalSet = require('../optional-set.js')
const updateRootPackageJson = require('../update-root-package-json.js')
const calcDepFlags = require('../calc-dep-flags.js')
+const { saveTypeMap, hasSubKey } = require('../add-rm-pkg-deps.js')
const _retiredPaths = Symbol('retiredPaths')
const _retiredUnchanged = Symbol('retiredUnchanged')
@@ -49,7 +49,8 @@ const _loadTrees = Symbol.for('loadTrees')
const _diffTrees = Symbol.for('diffTrees')
const _createSparseTree = Symbol.for('createSparseTree')
const _loadShrinkwrapsAndUpdateTrees = Symbol.for('loadShrinkwrapsAndUpdateTrees')
-const _shrinkwrapUnpacked = Symbol('shrinkwrapUnpacked')
+const _shrinkwrapInflated = Symbol('shrinkwrapInflated')
+const _bundleUnpacked = Symbol('bundleUnpacked')
const _reifyNode = Symbol.for('reifyNode')
const _extractOrLink = Symbol('extractOrLink')
// defined by rebuild mixin
@@ -108,7 +109,7 @@ module.exports = cls => class Reifier extends cls {
this.diff = null
this[_retiredPaths] = {}
- this[_shrinkwrapUnpacked] = new Set()
+ this[_shrinkwrapInflated] = new Set()
this[_retiredUnchanged] = {}
this[_sparseTreeDirs] = new Set()
this[_sparseTreeRoots] = new Set()
@@ -316,6 +317,7 @@ module.exports = cls => class Reifier extends cls {
// find all the nodes that need to change between the actual
// and ideal trees.
this.diff = Diff.calculate({
+ shrinkwrapInflated: this[_shrinkwrapInflated],
filterNodes,
actual: this.actualTree,
ideal: this.idealTree,
@@ -404,11 +406,14 @@ module.exports = cls => class Reifier extends cls {
return
process.emit('time', 'reify:trashOmits')
+ // node.parent is checked to make sure this is a node that's in the tree, and
+ // not the parent-less top level nodes
const filter = node =>
- node.peer && this[_omitPeer] ||
- node.dev && this[_omitDev] ||
- node.optional && this[_omitOptional] ||
- node.devOptional && this[_omitOptional] && this[_omitDev]
+ node.isDescendantOf(this.idealTree) &&
+ (node.peer && this[_omitPeer] ||
+ node.dev && this[_omitDev] ||
+ node.optional && this[_omitOptional] ||
+ node.devOptional && this[_omitOptional] && this[_omitDev])
for (const node of this.idealTree.inventory.filter(filter))
this[_addNodeToTrashList](node)
@@ -423,7 +428,8 @@ module.exports = cls => class Reifier extends cls {
const dirs = this.diff.leaves
.filter(diff => {
return (diff.action === 'ADD' || diff.action === 'CHANGE') &&
- !this[_sparseTreeDirs].has(diff.ideal.path)
+ !this[_sparseTreeDirs].has(diff.ideal.path) &&
+ !diff.ideal.isLink
})
.map(diff => diff.ideal.path)
@@ -457,9 +463,9 @@ module.exports = cls => class Reifier extends cls {
// we need to unpack them, read that shrinkwrap file, and then update
// the tree by calling loadVirtual with the node as the root.
[_loadShrinkwrapsAndUpdateTrees] () {
- const seen = this[_shrinkwrapUnpacked]
+ const seen = this[_shrinkwrapInflated]
const shrinkwraps = this.diff.leaves
- .filter(d => (d.action === 'CHANGE' || d.action === 'ADD') &&
+ .filter(d => (d.action === 'CHANGE' || d.action === 'ADD' || !d.action) &&
d.ideal.hasShrinkwrap && !seen.has(d.ideal) &&
!this[_trashList].has(d.ideal.path))
@@ -472,7 +478,7 @@ module.exports = cls => class Reifier extends cls {
return promiseAllRejectLate(shrinkwraps.map(diff => {
const node = diff.ideal
seen.add(node)
- return this[_reifyNode](node)
+ return diff.action ? this[_reifyNode](node) : node
}))
.then(nodes => promiseAllRejectLate(nodes.map(node => new Arborist({
...this.options,
@@ -503,7 +509,7 @@ module.exports = cls => class Reifier extends cls {
const { npmVersion, nodeVersion } = this.options
const p = Promise.resolve()
- .then(() => {
+ .then(async () => {
// when we reify an optional node, check the engine and platform
// first. be sure to ignore the --force and --engine-strict flags,
// since we always want to skip any optional packages we can't install.
@@ -513,11 +519,11 @@ module.exports = cls => class Reifier extends cls {
checkEngine(node.package, npmVersion, nodeVersion, false)
checkPlatform(node.package, false)
}
+ await this[_checkBins](node)
+ await this[_extractOrLink](node)
+ await this[_warnDeprecated](node)
+ await this[_loadAncientPackageDetails](node)
})
- .then(() => this[_checkBins](node))
- .then(() => this[_extractOrLink](node))
- .then(() => this[_warnDeprecated](node))
- .then(() => this[_loadAncientPackageDetails](node))
return this[_handleOptionalFailure](node, p)
.then(() => {
@@ -536,8 +542,8 @@ module.exports = cls => class Reifier extends cls {
// Do the best with what we have, or else remove it from the tree
// entirely, since we can't possibly reify it.
const res = node.resolved ? `${node.name}@${this[_registryResolved](node.resolved)}`
- : node.package.name && node.version
- ? `${node.package.name}@${node.version}`
+ : node.packageName && node.version
+ ? `${node.packageName}@${node.version}`
: null
// no idea what this thing is. remove it from the tree.
@@ -563,10 +569,11 @@ module.exports = cls => class Reifier extends cls {
})
}
- [_symlink] (node) {
+ async [_symlink] (node) {
const dir = dirname(node.path)
const target = node.realpath
const rel = relative(dir, target)
+ await mkdirp(dir)
return symlink(rel, node.path, 'junction')
}
@@ -633,8 +640,10 @@ module.exports = cls => class Reifier extends cls {
[_loadBundlesAndUpdateTrees] (
depth = 0, bundlesByDepth = this[_getBundlesByDepth]()
) {
- if (depth === 0)
+ if (depth === 0) {
+ this[_bundleUnpacked] = new Set()
process.emit('time', 'reify:loadBundles')
+ }
const maxBundleDepth = bundlesByDepth.get('maxBundleDepth')
if (depth > maxBundleDepth) {
// if we did something, then prune the tree and update the diffs
@@ -650,13 +659,17 @@ module.exports = cls => class Reifier extends cls {
// shallower bundle overwriting them with a bundled meta-dep.
const set = (bundlesByDepth.get(depth) || [])
.filter(node => node.root === this.idealTree &&
+ node.target !== node.root &&
!this[_trashList].has(node.path))
if (!set.length)
return this[_loadBundlesAndUpdateTrees](depth + 1, bundlesByDepth)
// extract all the nodes with bundles
- return promiseAllRejectLate(set.map(node => this[_reifyNode](node)))
+ return promiseAllRejectLate(set.map(node => {
+ this[_bundleUnpacked].add(node)
+ return this[_reifyNode](node)
+ }))
// then load their unpacked children and move into the ideal tree
.then(nodes =>
promiseAllRejectLate(nodes.map(node => new this.constructor({
@@ -678,8 +691,13 @@ module.exports = cls => class Reifier extends cls {
tree: this.diff,
visit: diff => {
const node = diff.ideal
- if (node && !node.isProjectRoot && node.package.bundleDependencies &&
- node.package.bundleDependencies.length) {
+ if (!node)
+ return
+ if (node.isProjectRoot || (node.target && node.target.isProjectRoot))
+ return
+
+ const { bundleDependencies } = node.package
+ if (bundleDependencies && bundleDependencies.length) {
maxBundleDepth = Math.max(maxBundleDepth, node.depth)
if (!bundlesByDepth.has(node.depth))
bundlesByDepth.set(node.depth, [node])
@@ -784,14 +802,14 @@ module.exports = cls => class Reifier extends cls {
return
const node = diff.ideal
- const bd = node.package.bundleDependencies
- const sw = this[_shrinkwrapUnpacked].has(node)
+ const bd = this[_bundleUnpacked].has(node)
+ const sw = this[_shrinkwrapInflated].has(node)
// check whether we still need to unpack this one.
// test the inDepBundle last, since that's potentially a tree walk.
const doUnpack = node && // can't unpack if removed!
!node.isRoot && // root node already exists
- !(bd && bd.length) && // already unpacked to read bundle
+ !bd && // already unpacked to read bundle
!sw && // already unpacked to read sw
!node.inDepBundle // already unpacked by another dep's bundle
@@ -944,6 +962,7 @@ module.exports = cls => class Reifier extends cls {
const spec = subSpec ? subSpec.rawSpec : rawSpec
const child = root.children.get(name)
+ let newSpec
if (req.registry) {
const version = child.version
const prefixRange = version ? this[_savePrefix] + version : '*'
@@ -955,16 +974,17 @@ module.exports = cls => class Reifier extends cls {
const isRange = (subSpec || req).type === 'range'
const range = !isRange || subset(prefixRange, spec, { loose: true })
? prefixRange : spec
- const pname = child.package.name
+ const pname = child.packageName
const alias = name !== pname
- updateDepSpec(pkg, name, (alias ? `npm:${pname}@` : '') + range)
+ newSpec = alias ? `npm:${pname}@${range}` : range
} else if (req.hosted) {
// save the git+https url if it has auth, otherwise shortcut
const h = req.hosted
const opt = { noCommittish: false }
- const save = h.https && h.auth ? `git+${h.https(opt)}`
- : h.shortcut(opt)
- updateDepSpec(pkg, name, save)
+ if (h.https && h.auth)
+ newSpec = `git+${h.https(opt)}`
+ else
+ newSpec = h.shortcut(opt)
} else if (req.type === 'directory' || req.type === 'file') {
// save the relative path in package.json
// Normally saveSpec is updated with the proper relative
@@ -973,9 +993,37 @@ module.exports = cls => class Reifier extends cls {
// thing, so just get the ultimate fetchSpec and relativize it.
const p = req.fetchSpec.replace(/^file:/, '')
const rel = relpath(root.realpath, p)
- updateDepSpec(pkg, name, `file:${rel}`)
+ newSpec = `file:${rel}`
} else
- updateDepSpec(pkg, name, req.saveSpec)
+ newSpec = req.saveSpec
+
+ if (options.saveType) {
+ const depType = saveTypeMap.get(options.saveType)
+ pkg[depType][name] = newSpec
+ // rpj will have moved it here if it was in both
+ // if it is empty it will be deleted later
+ if (options.saveType === 'prod' && pkg.optionalDependencies)
+ delete pkg.optionalDependencies[name]
+ } else {
+ if (hasSubKey(pkg, 'dependencies', name))
+ pkg.dependencies[name] = newSpec
+
+ if (hasSubKey(pkg, 'devDependencies', name)) {
+ pkg.devDependencies[name] = newSpec
+ // don't update peer or optional if we don't have to
+ if (hasSubKey(pkg, 'peerDependencies', name) && !intersects(newSpec, pkg.peerDependencies[name]))
+ pkg.peerDependencies[name] = newSpec
+
+ if (hasSubKey(pkg, 'optionalDependencies', name) && !intersects(newSpec, pkg.optionalDependencies[name]))
+ pkg.optionalDependencies[name] = newSpec
+ } else {
+ if (hasSubKey(pkg, 'peerDependencies', name))
+ pkg.peerDependencies[name] = newSpec
+
+ if (hasSubKey(pkg, 'optionalDependencies', name))
+ pkg.optionalDependencies[name] = newSpec
+ }
+ }
}
// refresh the edges so they have the correct specs
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
index 77cd6511aea3b53..9a0178c59c9e638 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
@@ -101,13 +101,14 @@ class AuditReport extends Map {
async run () {
this.report = await this[_getReport]()
+ this.log.silly('audit report', this.report)
if (this.report)
await this[_init]()
return this
}
isVulnerable (node) {
- const vuln = this.get(node.package.name)
+ const vuln = this.get(node.packageName)
return !!(vuln && vuln.isVulnerable(node))
}
@@ -144,7 +145,7 @@ class AuditReport extends Map {
super.set(name, vuln)
const p = []
- for (const node of this.tree.inventory.query('name', name)) {
+ for (const node of this.tree.inventory.query('packageName', name)) {
if (shouldOmit(node, this[_omit]))
continue
@@ -167,7 +168,7 @@ class AuditReport extends Map {
this[_checkTopNode](dep, vuln, spec)
else {
// calculate a metavuln, if necessary
- p.push(this.calculator.calculate(dep.name, advisory).then(meta => {
+ p.push(this.calculator.calculate(dep.packageName, advisory).then(meta => {
if (meta.testVersion(dep.version, spec))
advisories.add(meta)
}))
@@ -228,6 +229,9 @@ class AuditReport extends Map {
if (!specObj.registry)
return false
+ if (specObj.subSpec)
+ spec = specObj.subSpec.rawSpec
+
// We don't provide fixes for top nodes other than root, but we
// still check to see if the node is fixable with a different version,
// and if that is a semver major bump.
@@ -289,6 +293,7 @@ class AuditReport extends Map {
try {
// first try the super fast bulk advisory listing
const body = prepareBulkData(this.tree, this[_omit])
+ this.log.silly('audit', 'bulk request', body)
// no sense asking if we don't have anything to audit,
// we know it'll be empty
@@ -304,7 +309,8 @@ class AuditReport extends Map {
})
return await res.json()
- } catch (_) {
+ } catch (er) {
+ this.log.silly('audit', 'bulk request failed', String(er.body))
// that failed, try the quick audit endpoint
const body = prepareData(this.tree, this.options)
const res = await fetch('/-/npm/v1/security/audits/quick', {
@@ -330,6 +336,7 @@ class AuditReport extends Map {
// return true if we should ignore this one
const shouldOmit = (node, omit) =>
!node.version ? true
+ : node.isRoot ? true
: omit.size === 0 ? false
: node.dev && omit.has('dev') ||
node.optional && omit.has('optional') ||
@@ -338,9 +345,9 @@ const shouldOmit = (node, omit) =>
const prepareBulkData = (tree, omit) => {
const payload = {}
- for (const name of tree.inventory.query('name')) {
+ for (const name of tree.inventory.query('packageName')) {
const set = new Set()
- for (const node of tree.inventory.query('name', name)) {
+ for (const node of tree.inventory.query('packageName', name)) {
if (shouldOmit(node, omit))
continue
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/debug.js b/deps/npm/node_modules/@npmcli/arborist/lib/debug.js
index 5acacee69e2232f..aeda7229d5e8cbb 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/debug.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/debug.js
@@ -12,6 +12,7 @@
// run in debug mode if explicitly requested, running arborist tests,
// or working in the arborist project directory.
+
const debug = process.env.ARBORIST_DEBUG !== '0' && (
process.env.ARBORIST_DEBUG === '1' ||
/\barborist\b/.test(process.env.NODE_DEBUG || '') ||
@@ -21,4 +22,10 @@ const debug = process.env.ARBORIST_DEBUG !== '0' && (
)
module.exports = debug ? fn => fn() : () => {}
-module.exports.log = (...msg) => module.exports(() => console.error(...msg))
+const red = process.stderr.isTTY ? msg => `\x1B[31m${msg}\x1B[39m` : m => m
+module.exports.log = (...msg) => module.exports(() => {
+ const { format } = require('util')
+ const prefix = `\n${process.pid} ${red(format(msg.shift()))} `
+ msg = (prefix + format(...msg).trim().split('\n').join(prefix)).trim()
+ console.error(msg)
+})
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/dep-spec.js b/deps/npm/node_modules/@npmcli/arborist/lib/dep-spec.js
deleted file mode 100644
index 92911543e168413..000000000000000
--- a/deps/npm/node_modules/@npmcli/arborist/lib/dep-spec.js
+++ /dev/null
@@ -1,43 +0,0 @@
-const types = [
- 'peerDependencies',
- 'devDependencies',
- 'optionalDependencies',
- 'dependencies',
-]
-
-const findType = (pkg, name) => {
- for (const t of types) {
- if (pkg[t] && typeof pkg[t] === 'object' && pkg[t][name] !== undefined)
- return t
- }
- return 'dependencies'
-}
-
-// given a dep name and spec, update it wherever it exists in
-// the manifest, or add the spec to 'dependencies' if not found.
-const updateDepSpec = (pkg, name, newSpec) => {
- const type = findType(pkg, name)
- pkg[type] = pkg[type] || {}
- pkg[type][name] = newSpec
- return pkg
-}
-
-// sort alphabetically all types of deps for a given package
-const orderDeps = (pkg) => {
- for (const type of types) {
- if (pkg && pkg[type]) {
- pkg[type] = Object.keys(pkg[type])
- .sort((a, b) => a.localeCompare(b))
- .reduce((res, key) => {
- res[key] = pkg[type][key]
- return res
- }, {})
- }
- }
- return pkg
-}
-
-module.exports = {
- orderDeps,
- updateDepSpec,
-}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
index 84a8bae412f54d7..ff58ea76ee7849f 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/diff.js
@@ -11,8 +11,9 @@ const {existsSync} = require('fs')
const ssri = require('ssri')
class Diff {
- constructor ({actual, ideal, filterSet}) {
+ constructor ({actual, ideal, filterSet, shrinkwrapInflated}) {
this.filterSet = filterSet
+ this.shrinkwrapInflated = shrinkwrapInflated
this.children = []
this.actual = actual
this.ideal = ideal
@@ -30,7 +31,7 @@ class Diff {
this.removed = []
}
- static calculate ({actual, ideal, filterNodes = []}) {
+ static calculate ({actual, ideal, filterNodes = [], shrinkwrapInflated = new Set()}) {
// if there's a filterNode, then:
// - get the path from the root to the filterNode. The root or
// root.target should have an edge either to the filterNode or
@@ -77,7 +78,7 @@ class Diff {
}
return depth({
- tree: new Diff({actual, ideal, filterSet}),
+ tree: new Diff({actual, ideal, filterSet, shrinkwrapInflated}),
getChildren,
leave,
})
@@ -135,7 +136,7 @@ const allChildren = node => {
// to create the diff tree
const getChildren = diff => {
const children = []
- const {actual, ideal, unchanged, removed, filterSet} = diff
+ const {actual, ideal, unchanged, removed, filterSet, shrinkwrapInflated} = diff
// Note: we DON'T diff fsChildren themselves, because they are either
// included in the package contents, or part of some other project, and
@@ -144,11 +145,20 @@ const getChildren = diff => {
// responsible for installing.
const actualKids = allChildren(actual)
const idealKids = allChildren(ideal)
+
+ if (ideal && ideal.hasShrinkwrap && !shrinkwrapInflated.has(ideal)) {
+ // Guaranteed to get a diff.leaves here, because we always
+ // be called with a proper Diff object when ideal has a shrinkwrap
+ // that has not been inflated.
+ diff.leaves.push(diff)
+ return children
+ }
+
const paths = new Set([...actualKids.keys(), ...idealKids.keys()])
for (const path of paths) {
const actual = actualKids.get(path)
const ideal = idealKids.get(path)
- diffNode(actual, ideal, children, unchanged, removed, filterSet)
+ diffNode(actual, ideal, children, unchanged, removed, filterSet, shrinkwrapInflated)
}
if (diff.leaves && !children.length)
@@ -157,7 +167,7 @@ const getChildren = diff => {
return children
}
-const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => {
+const diffNode = (actual, ideal, children, unchanged, removed, filterSet, shrinkwrapInflated) => {
if (filterSet.size && !(filterSet.has(ideal) || filterSet.has(actual)))
return
@@ -165,10 +175,10 @@ const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => {
// if it's a match, then get its children
// otherwise, this is the child diff node
- if (action) {
+ if (action || (!shrinkwrapInflated.has(ideal) && ideal.hasShrinkwrap)) {
if (action === 'REMOVE')
removed.push(actual)
- children.push(new Diff({actual, ideal, filterSet}))
+ children.push(new Diff({actual, ideal, filterSet, shrinkwrapInflated}))
} else {
unchanged.push(ideal)
// !*! Weird dirty hack warning !*!
@@ -199,7 +209,7 @@ const diffNode = (actual, ideal, children, unchanged, removed, filterSet) => {
for (const node of bundledChildren)
node.parent = ideal
}
- children.push(...getChildren({actual, ideal, unchanged, removed, filterSet}))
+ children.push(...getChildren({actual, ideal, unchanged, removed, filterSet, shrinkwrapInflated}))
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/index.js
index fd7d8817258ed6b..c7b07ce28e4df02 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/index.js
@@ -3,5 +3,6 @@ module.exports.Arborist = module.exports
module.exports.Node = require('./node.js')
module.exports.Link = require('./link.js')
module.exports.Edge = require('./edge.js')
+module.exports.Shrinkwrap = require('./shrinkwrap.js')
// XXX export the other classes, too. shrinkwrap, diff, etc.
// they're handy!
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/inventory.js b/deps/npm/node_modules/@npmcli/arborist/lib/inventory.js
index cef0c4e2658998b..75782918852232a 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/inventory.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/inventory.js
@@ -4,7 +4,7 @@
// keys is the set of fields to be able to query.
const _primaryKey = Symbol('_primaryKey')
const _index = Symbol('_index')
-const defaultKeys = ['name', 'license', 'funding', 'realpath']
+const defaultKeys = ['name', 'license', 'funding', 'realpath', 'packageName']
const { hasOwnProperty } = Object.prototype
const debug = require('./debug.js')
class Inventory extends Map {
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/node.js b/deps/npm/node_modules/@npmcli/arborist/lib/node.js
index 197804e0ce0e3fb..370bfc9567d287c 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js
@@ -28,6 +28,7 @@
// where we need to quickly find all instances of a given package name within a
// tree.
+const semver = require('semver')
const nameFromFolder = require('@npmcli/name-from-folder')
const Edge = require('./edge.js')
const Inventory = require('./inventory.js')
@@ -290,6 +291,10 @@ class Node {
return this[_package].version || ''
}
+ get packageName () {
+ return this[_package].name || null
+ }
+
get pkgid () {
const { name = '', version = '' } = this.package
// root package will prefer package name over folder name,
@@ -349,10 +354,10 @@ class Node {
}
const why = {
- name: this.isProjectRoot ? this.package.name : this.name,
+ name: this.isProjectRoot ? this.packageName : this.name,
version: this.package.version,
}
- if (this.errors.length || !this.package.name || !this.package.version) {
+ if (this.errors.length || !this.packageName || !this.package.version) {
why.errors = this.errors.length ? this.errors : [
new Error('invalid package: lacks name and/or version'),
]
@@ -459,7 +464,7 @@ class Node {
if (this.isProjectRoot)
return false
const { root } = this
- const { type, to } = root.edgesOut.get(this.package.name) || {}
+ const { type, to } = root.edgesOut.get(this.packageName) || {}
return type === 'workspace' && to && (to.target === this || to === this)
}
@@ -729,20 +734,14 @@ class Node {
[_loadDeps] () {
// Caveat! Order is relevant!
- // packages in optionalDependencies and prod/peer/dev are
- // optional. Packages in both deps and devDeps are required.
+ // Packages in optionalDependencies are optional.
+ // Packages in both deps and devDeps are required.
// Note the subtle breaking change from v6: it is no longer possible
// to have a different spec for a devDep than production dep.
- this[_loadDepType](this.package.optionalDependencies, 'optional')
// Linked targets that are disconnected from the tree are tops,
// but don't have a 'path' field, only a 'realpath', because we
// don't know their canonical location. We don't need their devDeps.
- const { isTop, path, sourceReference } = this
- const { isTop: srcTop, path: srcPath } = sourceReference || {}
- if (isTop && path && (!sourceReference || srcTop && srcPath))
- this[_loadDepType](this.package.devDependencies, 'dev')
-
const pd = this.package.peerDependencies
if (pd && typeof pd === 'object' && !this.legacyPeerDeps) {
const pm = this.package.peerDependenciesMeta || {}
@@ -759,19 +758,22 @@ class Node {
}
this[_loadDepType](this.package.dependencies, 'prod')
+ this[_loadDepType](this.package.optionalDependencies, 'optional')
+
+ const { isTop, path, sourceReference } = this
+ const { isTop: srcTop, path: srcPath } = sourceReference || {}
+ if (isTop && path && (!sourceReference || srcTop && srcPath))
+ this[_loadDepType](this.package.devDependencies, 'dev')
}
- [_loadDepType] (obj, type) {
- const from = this
+ [_loadDepType] (deps, type) {
const ad = this.package.acceptDependencies || {}
- for (const [name, spec] of Object.entries(obj || {})) {
- const accept = ad[name]
- // if it's already set, then we keep the existing edge
- // Prod deps should not be marked as dev, however.
- // NB: the Edge ctor adds itself to from.edgesOut
+ // Because of the order in which _loadDeps runs, we always want to
+ // prioritize a new edge over an existing one
+ for (const [name, spec] of Object.entries(deps || {})) {
const current = this.edgesOut.get(name)
- if (!current || current.dev && type === 'prod')
- new Edge({ from, name, spec, accept, type })
+ if (!current || current.type !== 'workspace')
+ new Edge({ from: this, name, spec, accept: ad[name], type })
}
}
@@ -885,6 +887,43 @@ class Node {
return node.canReplaceWith(this)
}
+ // return true if it's safe to remove this node, because anything that
+ // is depending on it would be fine with the thing that they would resolve
+ // to if it was removed, or nothing is depending on it in the first place.
+ canDedupe (preferDedupe = false) {
+ // not allowed to mess with shrinkwraps or bundles
+ if (this.inDepBundle || this.inShrinkwrap)
+ return false
+
+ // it's a top level pkg, or a dep of one
+ if (!this.parent || !this.parent.parent)
+ return false
+
+ // no one wants it, remove it
+ if (this.edgesIn.size === 0)
+ return true
+
+ const other = this.parent.parent.resolve(this.name)
+
+ // nothing else, need this one
+ if (!other)
+ return false
+
+ // if it's the same thing, then always fine to remove
+ if (other.matches(this))
+ return true
+
+ // if the other thing can't replace this, then skip it
+ if (!other.canReplace(this))
+ return false
+
+ // if we prefer dedupe, or if the version is greater/equal, take the other
+ if (preferDedupe || semver.gte(other.version, this.version))
+ return true
+
+ return false
+ }
+
satisfies (requested) {
if (requested instanceof Edge)
return this.name === requested.name && requested.satisfiedBy(this)
@@ -927,8 +966,8 @@ class Node {
// if no resolved, check both package name and version
// otherwise, conclude that they are different things
- return this.package.name && node.package.name &&
- this.package.name === node.package.name &&
+ return this.packageName && node.packageName &&
+ this.packageName === node.packageName &&
this.version && node.version &&
this.version === node.version
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
index 169984fcf17ea1c..e611f55a4bd639a 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/printable.js
@@ -7,8 +7,8 @@ const relpath = require('./relpath.js')
class ArboristNode {
constructor (tree, path) {
this.name = tree.name
- if (tree.package.name && tree.package.name !== this.name)
- this.packageName = tree.package.name
+ if (tree.packageName && tree.packageName !== this.name)
+ this.packageName = tree.packageName
if (tree.version)
this.version = tree.version
this.location = tree.location
@@ -29,6 +29,15 @@ class ArboristNode {
this.peer = true
if (tree.inBundle)
this.bundled = true
+ if (tree.inDepBundle)
+ this.bundler = tree.getBundler().location
+ const bd = tree.package && tree.package.bundleDependencies
+ if (bd && bd.length)
+ this.bundleDependencies = bd
+ if (tree.inShrinkwrap)
+ this.inShrinkwrap = true
+ else if (tree.hasShrinkwrap)
+ this.hasShrinkwrap = true
if (tree.error)
this.error = treeError(tree.error)
if (tree.errors && tree.errors.length)
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
index 342e78e9e3a7b1c..d9065ffa0258f0d 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
@@ -254,7 +254,7 @@ class Shrinkwrap {
meta[key.replace(/^_/, '')] = val
})
// we only include name if different from the node path name
- const pname = node.package.name
+ const pname = node.packageName
if (pname && pname !== node.name)
meta.name = pname
@@ -825,7 +825,7 @@ class Shrinkwrap {
[_buildLegacyLockfile] (node, lock, path = []) {
if (node === this.tree) {
// the root node
- lock.name = node.package.name || node.name
+ lock.name = node.packageName || node.name
if (node.version)
lock.version = node.version
}
@@ -870,9 +870,9 @@ class Shrinkwrap {
lock.from = spec.raw
} else if (!node.isRoot &&
node.package &&
- node.package.name &&
- node.package.name !== node.name)
- lock.version = `npm:${node.package.name}@${node.version}`
+ node.packageName &&
+ node.packageName !== node.name)
+ lock.version = `npm:${node.packageName}@${node.version}`
else if (node.package && node.version)
lock.version = node.version
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js b/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js
index aba5614924ec77c..4a88707b9c4793a 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/update-root-package-json.js
@@ -6,8 +6,6 @@ const {resolve} = require('path')
const parseJSON = require('json-parse-even-better-errors')
-const { orderDeps } = require('./dep-spec.js')
-
const depTypes = new Set([
'dependencies',
'optionalDependencies',
@@ -15,6 +13,20 @@ const depTypes = new Set([
'peerDependencies',
])
+// sort alphabetically all types of deps for a given package
+const orderDeps = (pkg) => {
+ for (const type of depTypes) {
+ if (pkg && pkg[type]) {
+ pkg[type] = Object.keys(pkg[type])
+ .sort((a, b) => a.localeCompare(b))
+ .reduce((res, key) => {
+ res[key] = pkg[type][key]
+ return res
+ }, {})
+ }
+ }
+ return pkg
+}
const parseJsonSafe = json => {
try {
return parseJSON(json)
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js b/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
index 8f887a3fc96cb04..2561bc80646cf4f 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/vuln.js
@@ -83,6 +83,9 @@ class Vuln {
if (!specObj.registry)
return true
+ if (specObj.subSpec)
+ spec = specObj.subSpec.rawSpec
+
for (const v of this.versions) {
if (satisfies(v, spec) && !satisfies(v, this.range, semverOpt))
return false
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index d08102ce0cf12dd..ebc84f6fc32a98b 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/node_modules/@npmcli/arborist/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/arborist",
- "version": "2.3.0",
+ "version": "2.4.2",
"description": "Manage node_modules trees",
"dependencies": {
"@npmcli/installed-package-contents": "^1.0.7",
@@ -19,7 +19,7 @@
"npm-install-checks": "^4.0.0",
"npm-package-arg": "^8.1.0",
"npm-pick-manifest": "^6.1.0",
- "npm-registry-fetch": "^9.0.0",
+ "npm-registry-fetch": "^10.0.0",
"pacote": "^11.2.6",
"parse-conflict-json": "^1.1.1",
"promise-all-reject-late": "^1.0.0",
@@ -41,8 +41,7 @@
"eslint-plugin-standard": "^4.0.1",
"minify-registry-metadata": "^2.1.0",
"mutate-fs": "^2.1.1",
- "require-inject": "^1.4.4",
- "tap": "^14.11.0",
+ "tap": "^15.0.4",
"tcompare": "^3.0.4"
},
"scripts": {
@@ -76,10 +75,8 @@
"arborist": "bin/index.js"
},
"tap": {
- "100": true,
"after": "test/fixtures/cleanup.js",
"coverage-map": "map.js",
- "esm": false,
"test-env": [
"NODE_OPTIONS=--no-warnings"
],
@@ -87,6 +84,6 @@
"--no-warnings",
"--no-deprecation"
],
- "timeout": "120"
+ "timeout": "240"
}
}
diff --git a/deps/npm/node_modules/@npmcli/config/lib/index.js b/deps/npm/node_modules/@npmcli/config/lib/index.js
index 21a37ded48e7c36..f947896f0ba3481 100644
--- a/deps/npm/node_modules/@npmcli/config/lib/index.js
+++ b/deps/npm/node_modules/@npmcli/config/lib/index.js
@@ -197,11 +197,6 @@ class Config {
throw new Error('call config.load() before setting values')
if (!confTypes.has(where))
throw new Error('invalid config location param: ' + where)
- if (key === '_auth') {
- const { email } = this.getCredentialsByURI(this.get('registry'))
- if (!email)
- throw new Error('Cannot set _auth without first setting email')
- }
this[_checkDeprecated](key)
const { data } = this.data.get(where)
data[key] = val
@@ -282,6 +277,14 @@ class Config {
// symbols, as that module also does a bunch of get operations
this[_loaded] = true
+ process.emit('time', 'config:load:credentials')
+ const reg = this.get('registry')
+ const creds = this.getCredentialsByURI(reg)
+ // ignore this error because a failed set will strip out anything that
+ // might be a security hazard, which was the intention.
+ try { this.setCredentialsByURI(reg, creds) } catch (_) {}
+ process.emit('timeEnd', 'config:load:credentials')
+
// set proper globalPrefix now that everything is loaded
this.globalPrefix = this.get('prefix')
@@ -588,14 +591,17 @@ class Config {
const nerfed = nerfDart(uri)
const def = nerfDart(this.get('registry'))
if (def === nerfed) {
+ // do not delete email, that shouldn't be nerfed any more.
+ // just delete the nerfed copy, if one exists.
this.delete(`-authtoken`, 'user')
this.delete(`_authToken`, 'user')
+ this.delete(`_authtoken`, 'user')
this.delete(`_auth`, 'user')
this.delete(`_password`, 'user')
this.delete(`username`, 'user')
- this.delete(`email`, 'user')
}
this.delete(`${nerfed}:-authtoken`, 'user')
+ this.delete(`${nerfed}:_authtoken`, 'user')
this.delete(`${nerfed}:_authToken`, 'user')
this.delete(`${nerfed}:_auth`, 'user')
this.delete(`${nerfed}:_password`, 'user')
@@ -603,7 +609,7 @@ class Config {
this.delete(`${nerfed}:email`, 'user')
}
- setCredentialsByURI (uri, { token, username, password, email, alwaysAuth }) {
+ setCredentialsByURI (uri, { token, username, password, email }) {
const nerfed = nerfDart(uri)
const def = nerfDart(this.get('registry'))
@@ -611,41 +617,45 @@ class Config {
// remove old style auth info not limited to a single registry
this.delete('_password', 'user')
this.delete('username', 'user')
- this.delete('email', 'user')
this.delete('_auth', 'user')
this.delete('_authtoken', 'user')
+ this.delete('-authtoken', 'user')
this.delete('_authToken', 'user')
}
- this.delete(`${nerfed}:-authtoken`)
+ // email used to be nerfed always. if we're using the default
+ // registry, de-nerf it.
+ if (nerfed === def) {
+ email = email ||
+ this.get('email', 'user') ||
+ this.get(`${nerfed}:email`, 'user')
+ if (email)
+ this.set('email', email, 'user')
+ }
+
+ // field that hasn't been used as documented for a LONG time,
+ // and as of npm 7.10.0, isn't used at all. We just always
+ // send auth if we have it, only to the URIs under the nerf dart.
+ this.delete(`${nerfed}:always-auth`, 'user')
+
+ this.delete(`${nerfed}:-authtoken`, 'user')
+ this.delete(`${nerfed}:_authtoken`, 'user')
+ this.delete(`${nerfed}:email`, 'user')
if (token) {
this.set(`${nerfed}:_authToken`, token, 'user')
this.delete(`${nerfed}:_password`, 'user')
this.delete(`${nerfed}:username`, 'user')
- this.delete(`${nerfed}:email`, 'user')
- this.delete(`${nerfed}:always-auth`, 'user')
- } else if (username || password || email) {
- if (username || password) {
- if (!username)
- throw new Error('must include username')
- if (!password)
- throw new Error('must include password')
- }
- if (!email)
- throw new Error('must include email')
+ } else if (username || password) {
+ if (!username)
+ throw new Error('must include username')
+ if (!password)
+ throw new Error('must include password')
this.delete(`${nerfed}:_authToken`, 'user')
- if (username || password) {
- this.set(`${nerfed}:username`, username, 'user')
- // note: not encrypted, no idea why we bothered to do this, but oh well
- // protects against shoulder-hacks if password is memorable, I guess?
- const encoded = Buffer.from(password, 'utf8').toString('base64')
- this.set(`${nerfed}:_password`, encoded, 'user')
- }
- this.set(`${nerfed}:email`, email, 'user')
- if (alwaysAuth !== undefined)
- this.set(`${nerfed}:always-auth`, alwaysAuth, 'user')
- else
- this.delete(`${nerfed}:always-auth`, 'user')
+ this.set(`${nerfed}:username`, username, 'user')
+ // note: not encrypted, no idea why we bothered to do this, but oh well
+ // protects against shoulder-hacks if password is memorable, I guess?
+ const encoded = Buffer.from(password, 'utf8').toString('base64')
+ this.set(`${nerfed}:_password`, encoded, 'user')
} else {
throw new Error('No credentials to set.')
}
@@ -656,18 +666,12 @@ class Config {
const nerfed = nerfDart(uri)
const creds = {}
- // you can set always-auth for a single registry, or as a default
- const alwaysAuthReg = this.get(`${nerfed}:always-auth`)
- if (alwaysAuthReg !== undefined)
- creds.alwaysAuth = !!alwaysAuthReg
- else
- creds.alwaysAuth = this.get('always-auth')
-
const email = this.get(`${nerfed}:email`) || this.get('email')
if (email)
creds.email = email
const tokenReg = this.get(`${nerfed}:_authToken`) ||
+ this.get(`${nerfed}:_authtoken`) ||
this.get(`${nerfed}:-authtoken`) ||
nerfed === nerfDart(this.get('registry')) && this.get('_authToken')
@@ -686,6 +690,16 @@ class Config {
return creds
}
+ const authReg = this.get(`${nerfed}:_auth`)
+ if (authReg) {
+ const authDecode = Buffer.from(authReg, 'base64').toString('utf8')
+ const authSplit = authDecode.split(':')
+ creds.username = authSplit.shift()
+ creds.password = authSplit.join(':')
+ creds.auth = authReg
+ return creds
+ }
+
// at this point, we can only use the values if the URI is the
// default registry.
const defaultNerf = nerfDart(this.get('registry'))
diff --git a/deps/npm/node_modules/@npmcli/config/package.json b/deps/npm/node_modules/@npmcli/config/package.json
index 767718a9d61c753..f80669640ebd4ec 100644
--- a/deps/npm/node_modules/@npmcli/config/package.json
+++ b/deps/npm/node_modules/@npmcli/config/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/config",
- "version": "2.1.0",
+ "version": "2.2.0",
"files": [
"lib"
],
@@ -24,7 +24,7 @@
"coverage-map": "map.js"
},
"devDependencies": {
- "tap": "^14.10.8"
+ "tap": "^15.0.4"
},
"dependencies": {
"ini": "^2.0.0",
diff --git a/deps/npm/node_modules/@npmcli/git/lib/clone.js b/deps/npm/node_modules/@npmcli/git/lib/clone.js
index 1fea5acc8462113..6754fd7606009dd 100644
--- a/deps/npm/node_modules/@npmcli/git/lib/clone.js
+++ b/deps/npm/node_modules/@npmcli/git/lib/clone.js
@@ -30,7 +30,7 @@ const pickManifest = require('npm-pick-manifest')
const fs = require('fs')
const mkdirp = require('mkdirp')
-module.exports = (repo, ref = 'HEAD', target = null, /* istanbul ignore next */ opts = {}) =>
+module.exports = (repo, ref = 'HEAD', target = null, opts = {}) =>
revs(repo, opts).then(revs => clone(
repo,
revs,
diff --git a/deps/npm/node_modules/@npmcli/git/lib/spawn.js b/deps/npm/node_modules/@npmcli/git/lib/spawn.js
index cee3a7baf407881..337164a9a012dcd 100644
--- a/deps/npm/node_modules/@npmcli/git/lib/spawn.js
+++ b/deps/npm/node_modules/@npmcli/git/lib/spawn.js
@@ -10,6 +10,11 @@ module.exports = (gitArgs, opts = {}) => {
if (gitPath instanceof Error) { return Promise.reject(gitPath) }
+ // undocumented option, mostly only here for tests
+ const args = opts.allowReplace || gitArgs[0] === '--no-replace-objects'
+ ? gitArgs
+ : ['--no-replace-objects', ...gitArgs]
+
const log = opts.log || procLog
let retry = opts.retry
if (retry === null || retry === undefined) {
@@ -22,11 +27,11 @@ module.exports = (gitArgs, opts = {}) => {
}
return promiseRetry((retry, number) => {
if (number !== 1) {
- log.silly('pacote', `Retrying git command: ${
- gitArgs.join(' ')} attempt # ${number}`)
+ log.silly('git', `Retrying git command: ${
+ args.join(' ')} attempt # ${number}`)
}
- return spawn(gitPath, gitArgs, makeOpts(opts))
+ return spawn(gitPath, args, makeOpts(opts))
.catch(er => {
if (!shouldRetry(er.stderr, number)) {
throw er
diff --git a/deps/npm/node_modules/@npmcli/git/package.json b/deps/npm/node_modules/@npmcli/git/package.json
index 9b368c31e262db5..0fe94686ece20cd 100644
--- a/deps/npm/node_modules/@npmcli/git/package.json
+++ b/deps/npm/node_modules/@npmcli/git/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/git",
- "version": "2.0.8",
+ "version": "2.0.9",
"main": "lib/index.js",
"files": [
"lib/*.js"
@@ -29,7 +29,7 @@
"devDependencies": {
"slash": "^3.0.0",
"standard": "^16.0.3",
- "tap": "^14.11.0"
+ "tap": "^15.0.6"
},
"dependencies": {
"@npmcli/promise-spawn": "^1.3.2",
diff --git a/deps/npm/node_modules/@npmcli/run-script/README.md b/deps/npm/node_modules/@npmcli/run-script/README.md
index 59b473d94706c5a..ff8f5d354718c38 100644
--- a/deps/npm/node_modules/@npmcli/run-script/README.md
+++ b/deps/npm/node_modules/@npmcli/run-script/README.md
@@ -103,7 +103,7 @@ terminal, then it is up to the user to end it, of course.
- The `package.json` fields described in
[RFC183](https://github.com/npm/rfcs/pull/183/files).
- `scriptShell` Optional, defaults to `/bin/sh` on Unix, defaults to
- `env.comspec` or `cmd` on Windows. Custom script to use to execute the
+ `env.ComSpec` or `cmd` on Windows. Custom script to use to execute the
command.
- `stdio` Optional, defaults to `'pipe'`. The same as the `stdio` argument
passed to `child_process` functions in Node.js. Note that if a stdio
diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js
index 8ee24c06daf7b1d..8f299954a7a8010 100644
--- a/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js
+++ b/deps/npm/node_modules/@npmcli/run-script/lib/make-spawn-args.js
@@ -8,7 +8,7 @@ const makeSpawnArgs = options => {
const {
event,
path,
- scriptShell = isWindows ? process.env.comspec || 'cmd' : 'sh',
+ scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh',
env = {},
stdio,
cmd,
diff --git a/deps/npm/node_modules/@npmcli/run-script/package.json b/deps/npm/node_modules/@npmcli/run-script/package.json
index 7e0e5255de4105d..756f87f1d4d3808 100644
--- a/deps/npm/node_modules/@npmcli/run-script/package.json
+++ b/deps/npm/node_modules/@npmcli/run-script/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/run-script",
- "version": "1.8.4",
+ "version": "1.8.5",
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
"author": "Isaac Z. Schlueter (https://izs.me)",
"license": "ISC",
@@ -25,7 +25,7 @@
"eslint-plugin-standard": "^5.0.0",
"minipass": "^3.1.1",
"require-inject": "^1.4.4",
- "tap": "^14.11.0"
+ "tap": "^15.0.4"
},
"dependencies": {
"@npmcli/node-gyp": "^1.0.2",
diff --git a/deps/npm/node_modules/balanced-match/.github/FUNDING.yml b/deps/npm/node_modules/balanced-match/.github/FUNDING.yml
new file mode 100644
index 000000000000000..cea8b16e9edc40b
--- /dev/null
+++ b/deps/npm/node_modules/balanced-match/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+tidelift: "npm/balanced-match"
+patreon: juliangruber
diff --git a/deps/npm/node_modules/chalk/package.json b/deps/npm/node_modules/chalk/package.json
index 0d99f0f28621f2f..c2d63f67e5e955c 100644
--- a/deps/npm/node_modules/chalk/package.json
+++ b/deps/npm/node_modules/chalk/package.json
@@ -1,6 +1,6 @@
{
"name": "chalk",
- "version": "4.1.0",
+ "version": "4.1.1",
"description": "Terminal string styling done right",
"license": "MIT",
"repository": "chalk/chalk",
diff --git a/deps/npm/node_modules/chalk/readme.md b/deps/npm/node_modules/chalk/readme.md
index 338f42cb8b525bd..851259216bc193b 100644
--- a/deps/npm/node_modules/chalk/readme.md
+++ b/deps/npm/node_modules/chalk/readme.md
@@ -13,6 +13,48 @@
+
+
+---
+
+
+
+
+
+ Sindre Sorhus' open source work is supported by the community on GitHub Sponsors and Dev
+
+
+ Special thanks to:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ All your environment variables, in one place
+
+ Stop struggling with scattered API keys, hacking together home-brewed tools,
+
+ and avoiding access controls. Keep your team and servers in sync with Doppler.
+
+
+
+
+
+---
+
+
+
## Highlights
- Expressive API
diff --git a/deps/npm/node_modules/init-package-json/default-input.js b/deps/npm/node_modules/init-package-json/default-input.js
index 8e9fe0b573ea5f7..d1f65841d6c5a34 100644
--- a/deps/npm/node_modules/init-package-json/default-input.js
+++ b/deps/npm/node_modules/init-package-json/default-input.js
@@ -12,7 +12,7 @@ function isTestPkg (p) {
}
function niceName (n) {
- return n.replace(/^node-|[.-]js$/g, '').replace(' ', '-').toLowerCase()
+ return n.replace(/^node-|[.-]js$/g, '').replace(/\s+/g, ' ').replace(/ /g, '-').toLowerCase()
}
function readDeps (test, excluded) { return function (cb) {
@@ -45,7 +45,7 @@ function readDeps (test, excluded) { return function (cb) {
})
}}
-var name = package.name || basename
+var name = niceName(package.name || basename)
var spec
try {
spec = npa(name)
@@ -61,7 +61,7 @@ if (scope) {
name = scope + '/' + name
}
}
-exports.name = yes ? name : prompt('package name', niceName(name), function (data) {
+exports.name = yes ? name : prompt('package name', name, function (data) {
var its = validateName(data)
if (its.validForNewPackages) return data
var errors = (its.errors || []).concat(its.warnings || [])
diff --git a/deps/npm/node_modules/init-package-json/package.json b/deps/npm/node_modules/init-package-json/package.json
index 91c6bfba82049db..584e313b4c2c7cd 100644
--- a/deps/npm/node_modules/init-package-json/package.json
+++ b/deps/npm/node_modules/init-package-json/package.json
@@ -1,6 +1,6 @@
{
"name": "init-package-json",
- "version": "2.0.2",
+ "version": "2.0.3",
"main": "init-package-json.js",
"scripts": {
"test": "tap",
@@ -17,19 +17,19 @@
"description": "A node module to get your node module started",
"dependencies": {
"glob": "^7.1.1",
- "npm-package-arg": "^8.1.0",
+ "npm-package-arg": "^8.1.2",
"promzard": "^0.3.0",
"read": "~1.0.1",
- "read-package-json": "^3.0.0",
- "semver": "^7.3.2",
+ "read-package-json": "^3.0.1",
+ "semver": "^7.3.5",
"validate-npm-package-license": "^3.0.4",
"validate-npm-package-name": "^3.0.0"
},
"devDependencies": {
- "@npmcli/config": "^1.2.1",
+ "@npmcli/config": "^2.1.0",
"mkdirp": "^1.0.4",
"rimraf": "^3.0.2",
- "tap": "^14.10.8"
+ "tap": "^14.11.0"
},
"engines": {
"node": ">=10"
diff --git a/deps/npm/node_modules/just-diff/index.d.ts b/deps/npm/node_modules/just-diff/index.d.ts
new file mode 100644
index 000000000000000..cd3126daeb3aed5
--- /dev/null
+++ b/deps/npm/node_modules/just-diff/index.d.ts
@@ -0,0 +1,20 @@
+// Definitions by: Cameron Hunter
+// Modified by: Angus Croll
+type Operation = "add" | "replace" | "remove";
+
+type JSONPatchPathConverter