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 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.
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:
-
“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
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html
index 311c581f681df4..445abd0d5ce3e0 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.11.2
+
7.12.1
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.
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.
diff --git a/deps/npm/lib/cache.js b/deps/npm/lib/cache.js
index 43902f43bbee19..5d544b2dbd185a 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/config.js b/deps/npm/lib/config.js
index f53d7e5ae271bc..4b3ac587365088 100644
--- a/deps/npm/lib/config.js
+++ b/deps/npm/lib/config.js
@@ -199,7 +199,7 @@ class Config extends BaseCommand {
; Configs like \`///:_authToken\` are auth that is restricted
; to the registry host specified.
-${data.split('\n').sort((a, b) => a.localeCompare(b)).join('\n').trim()}
+${data.split('\n').sort((a, b) => a.localeCompare(b, 'en')).join('\n').trim()}
;;;;
; all available options shown below with default values
@@ -227,7 +227,7 @@ ${defData}
if (where === 'default' && !long)
continue
- const keys = Object.keys(data).sort((a, b) => a.localeCompare(b))
+ const keys = Object.keys(data).sort((a, b) => a.localeCompare(b, 'en'))
if (!keys.length)
continue
diff --git a/deps/npm/lib/help.js b/deps/npm/lib/help.js
index 589819eb02a454..e9aade5215a8ca 100644
--- a/deps/npm/lib/help.js
+++ b/deps/npm/lib/help.js
@@ -77,7 +77,7 @@ class Help extends BaseCommand {
if (aManNumber !== bManNumber)
return aManNumber - bManNumber
- return a.localeCompare(b)
+ return a.localeCompare(b, 'en')
})
const man = mans[0]
diff --git a/deps/npm/lib/ls.js b/deps/npm/lib/ls.js
index ccd8b2ff9dea71..9fa5fddd53f82e 100644
--- a/deps/npm/lib/ls.js
+++ b/deps/npm/lib/ls.js
@@ -443,7 +443,7 @@ const augmentNodesWithMetadata = ({
}
const sortAlphabetically = (a, b) =>
- a.pkgid.localeCompare(b.pkgid)
+ a.pkgid.localeCompare(b.pkgid, 'en')
const humanOutput = ({ color, result, seenItems, unicode }) => {
// we need to traverse the entire tree in order to determine which items
diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js
index 9b656d2aeede47..a436059e9e2dac 100644
--- a/deps/npm/lib/outdated.js
+++ b/deps/npm/lib/outdated.js
@@ -68,7 +68,7 @@ class Outdated extends BaseCommand {
}))
// sorts list alphabetically
- const outdated = this.list.sort((a, b) => a.name.localeCompare(b.name))
+ const outdated = this.list.sort((a, b) => a.name.localeCompare(b.name, 'en'))
// return if no outdated packages
if (outdated.length === 0 && !this.npm.config.get('json'))
@@ -149,7 +149,7 @@ class Outdated extends BaseCommand {
: edge.dev ? 'devDependencies'
: 'dependencies'
- for (const omitType of this.npm.config.get('omit') || []) {
+ for (const omitType of this.npm.config.get('omit')) {
if (node[omitType])
return
}
diff --git a/deps/npm/lib/utils/completion/installed-deep.js b/deps/npm/lib/utils/completion/installed-deep.js
index b65c17e41d743d..2430688612cd4d 100644
--- a/deps/npm/lib/utils/completion/installed-deep.js
+++ b/deps/npm/lib/utils/completion/installed-deep.js
@@ -16,7 +16,7 @@ const installedDeep = async (npm) => {
})
.filter(i => (i.depth - 1) <= depth)
.sort((a, b) => a.depth - b.depth)
- .sort((a, b) => a.depth === b.depth ? a.name.localeCompare(b.name) : 0)
+ .sort((a, b) => a.depth === b.depth ? a.name.localeCompare(b.name, 'en') : 0)
const res = new Set()
const gArb = new Arborist({ global: true, path: resolve(npm.globalDir, '..') })
diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js
index 3a50175d5db649..aa90de8e760b7d 100644
--- a/deps/npm/lib/utils/config/definitions.js
+++ b/deps/npm/lib/utils/config/definitions.js
@@ -1943,6 +1943,7 @@ define('user-agent', {
'node/{node-version} ' +
'{platform} ' +
'{arch} ' +
+ 'workspaces/{workspaces} ' +
'{ci}',
type: String,
description: `
@@ -1953,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/lib/utils/config/describe-all.js b/deps/npm/lib/utils/config/describe-all.js
index ab3f3a63ea751c..5fb785f08310d0 100644
--- a/deps/npm/lib/utils/config/describe-all.js
+++ b/deps/npm/lib/utils/config/describe-all.js
@@ -7,7 +7,7 @@ const describeAll = () => {
const sort = ([keya, {deprecated: depa}], [keyb, {deprecated: depb}]) => {
return depa && !depb ? 1
: !depa && depb ? -1
- : keya.localeCompare(keyb)
+ : keya.localeCompare(keyb, 'en')
}
return Object.entries(definitions).sort(sort)
.map(([key, def]) => def.describe())
diff --git a/deps/npm/lib/utils/npm-usage.js b/deps/npm/lib/utils/npm-usage.js
index bc397cb4d95e66..ddb0bab0bc9a2d 100644
--- a/deps/npm/lib/utils/npm-usage.js
+++ b/deps/npm/lib/utils/npm-usage.js
@@ -62,7 +62,7 @@ const usages = (npm) => {
maxLen = Math.max(maxLen, c.length)
return set
}, [])
- .sort((a, b) => a[0].localeCompare(b[0]))
+ .sort((a, b) => a[0].localeCompare(b[0], 'en'))
.map(([c, usage]) => `\n ${c}${' '.repeat(maxLen - c.length + 1)}${
(usage.split('\n').join('\n' + ' '.repeat(maxLen + 5)))}`)
.join('\n')
diff --git a/deps/npm/lib/utils/tar.js b/deps/npm/lib/utils/tar.js
index 887c40a0f6ebee..9e7c3329530eeb 100644
--- a/deps/npm/lib/utils/tar.js
+++ b/deps/npm/lib/utils/tar.js
@@ -76,7 +76,7 @@ const getContents = async (manifest, tarball) => {
})
const comparator = (a, b) => {
- return a.path.localeCompare(b.path, undefined, {
+ return a.path.localeCompare(b.path, 'en', {
sensitivity: 'case',
numeric: true,
})
@@ -84,7 +84,7 @@ const getContents = async (manifest, tarball) => {
const isUpper = (str) => {
const ch = str.charAt(0)
- return ch >= 'A' && ch <= 'Z'
+ return ch === ch.toUpperCase()
}
const uppers = files.filter(file => isUpper(file.path))
diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js
index 91b32e2fd38fa3..9cc1aed914488d 100644
--- a/deps/npm/lib/view.js
+++ b/deps/npm/lib/view.js
@@ -202,7 +202,10 @@ class View extends BaseCommand {
const spec = npa(pkg)
// get the data about this package
- let version = spec.rawSpec || this.npm.config.get('tag')
+ let version = this.npm.config.get('tag')
+ // rawSpec is the git url if this is from git
+ if (spec.type !== 'git' && spec.rawSpec)
+ version = spec.rawSpec
const pckmnt = await packument(spec, opts)
diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1
index f1deed4c428a55..8165ccd46d5c45 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 aa7d0e5e527a51..26f42858694ada 100644
--- a/deps/npm/man/man1/npm-adduser.1
+++ b/deps/npm/man/man1/npm-adduser.1
@@ -1,4 +1,4 @@
-.TH "NPM\-ADDUSER" "1" "April 2021" "" ""
+.TH "NPM\-ADDUSER" "1" "May 2021" "" ""
.SH "NAME"
\fBnpm-adduser\fR \- Add a registry user account
.SS Synopsis
diff --git a/deps/npm/man/man1/npm-audit.1 b/deps/npm/man/man1/npm-audit.1
index ebbb019ec8a351..cd63c284730908 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 d7ddf05cb757af..61e2ab1ea91cde 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 9d453b825b9f92..c4297521de2b5f 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 08913baa6325d6..25b9d0d79118df 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 67f7245d01b9e7..481d3d23c95b0f 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 cb3e2d994356c8..dffedb6b639e6a 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 c19d0411cb78b4..2ab14312a86a7d 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 fd6cce4bc1b287..bd65bd3853c26e 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 33922d2e834c6f..c57decbba87bb4 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 97092215bd89a3..079c73e46a44a3 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 6be3351be3cf5b..95ed3584723186 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 5da2b661a5498b..1aec0eb795f411 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 c3b11a90259509..df05a562f95e80 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 445439d1554b14..425c769cfed138 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 1ac663ff18ef50..5bb3736ae6297f 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
diff --git a/deps/npm/man/man1/npm-explain.1 b/deps/npm/man/man1/npm-explain.1
index efc5314788205b..87c84f1aaf2668 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 7863f3a07115f6..205f0518e909fa 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 03ff67e95b5760..e88c89408b351e 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 dc67600e6ac2f9..81a277bb0087c2 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 a7bc089b1962fc..2f85992550d9f2 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 8e32829300023f..f97f9117b685ee 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 06cb0959fcc99e..bb6b553a60c6ff 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 b4b09e598d247b..9ba1cf0a6457dc 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
diff --git a/deps/npm/man/man1/npm-install-ci-test.1 b/deps/npm/man/man1/npm-install-ci-test.1
index 22eb734e21e975..448a8514812d45 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 521d0bc5ebf490..03efe308f2edcd 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 5ac2700d829880..c4567fb2920420 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 94afe9c3fdf81f..404b04a5ce490e 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 0f94b466398256..84a6851b284cba 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 2d4720ad8a4a97..c47da91875482f 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\.11\.2 /path/to/npm
+npm@7\.12\.1 /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 7d85be8760a8ad..18cb791b071309 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 d90143428f2e57..a7309f2dfb994a 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 3731b383d7618a..7140aef06b6144 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 adedbef0c1f56c..ab34dc891d1c13 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 9eb5ec12842bc7..385e4b8a810ba3 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 c4b8a36e954c31..82de74199e923f 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 7b2ff13efae4fe..d2d412fe8bfa9f 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 df8b82eb7b5169..18d5e14dd1a08f 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 ac7a0323a72570..c405f64f27e361 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 995c8ab5ea19b1..3a78852b5430ef 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 30b05534836db0..bdb5452181e77c 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 bd212fb466a056..4ecb71f177e31d 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 ddff01d429e204..e552a650986d8f 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 53b88e6fab99fd..22222c6541e968 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
diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1
index 068499dc99c291..5e889b15f62413 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 f348099fb48aca..e9a380ee460e19 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 d349510e5a940c..a57ffb18187c21 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 e95168e243f948..49f91c6466e852 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 fa16060953c24c..397cfea91fe5ec 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 42d8b6cc96fe12..84bdff0140dd79 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 55be734ed48d3b..143aa56462d164 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 94aa9d89ccafd7..5816ea1d21bd7b 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 cedbe681982fcc..4dd4bc2335f758 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 5adf0cda6d8261..2b45db5fc4e03b 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 0de9f431be36cd..0ee2fded986c47 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 9645ab106d0c11..e0e2a6c81b2f96 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 86c152eb6d27fb..ec4cf6d2d1ff6f 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 adaebe92db336f..2ac1f9e8478e76 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 d926c9e5282eee..02de076a10c4c1 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 498821fbb6ba9a..b3dac21b7572b1 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
diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1
index c38b46dff07ab3..ed54f2f00bc682 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 8dbeca5362bba8..4562527e1b5ade 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\.11\.2
+7\.12\.1
.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 87c018f4121915..76305688fb0e73 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 cacb710a03b030..ccf0c4f6e8f17a 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 445353eb8565e0..5fc6f442a92268 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 27076ba3361fe9..2fdbdd139a9f82 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 f880a269513a6b..1ecd71ff214540 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 a882e445ca0031..8b5b12e03829a6 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
@@ -624,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 765dd8499948a1..20bedd30009757 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 522e974fc07089..b8884ded13e4d2 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
@@ -1666,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
@@ -1684,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 00dc1b14e2415b..0935fea65f509f 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 7f29cf2c239730..13c9b9dbadf1c3 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 2ff87e4a4c45e8..941a1450073139 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 e3508f6696d720..ead032bfdf457d 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 2a0fa9e1c8ea7f..716946d732afb7 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 2dc2486de7d51b..63ebce805b4d8f 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 5b28ac54c5d1cb..dbb63528d6da75 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/CHANGELOG.md b/deps/npm/node_modules/@npmcli/arborist/CHANGELOG.md
deleted file mode 100644
index 3cd36d027b6318..00000000000000
--- a/deps/npm/node_modules/@npmcli/arborist/CHANGELOG.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# CHANGELOG
-
-## 2.0
-
-* BREAKING CHANGE: root node is now included in inventory
-* All parent/target/fsParent/etc. references set in `root` setter, rather
- than the hodgepodge of setters that existed before.
-* `treeCheck` function added, to enforce strict correctness guarantees when
- `ARBORIST_DEBUG=1` in the environment (on by default in Arborist tests).
-
-## 1.0
-
-* Release for npm v7 beta
-* Fully functional
-
-## 0.0
-
-* Proof of concept
-* Before this, it was [`read-package-tree`](http://npm.im/read-package-tree)
diff --git a/deps/npm/node_modules/@npmcli/arborist/bin/license.js b/deps/npm/node_modules/@npmcli/arborist/bin/license.js
index 4083ddc695d467..89d0d879036b0c 100644
--- a/deps/npm/node_modules/@npmcli/arborist/bin/license.js
+++ b/deps/npm/node_modules/@npmcli/arborist/bin/license.js
@@ -22,7 +22,7 @@ a.loadVirtual().then(tree => {
set.push([tree.inventory.query('license', license).size, license])
for (const [count, license] of set.sort((a, b) =>
- a[1] && b[1] ? b[0] - a[0] || a[1].localeCompare(b[1])
+ a[1] && b[1] ? b[0] - a[0] || a[1].localeCompare(b[1], 'en')
: a[1] ? -1
: b[1] ? 1
: 0))
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 9a96fd1b3797cd..f78a43319be8cb 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 || {}
@@ -75,51 +75,53 @@ const addSingle = ({pkg, spec, saveBundle, saveType}) => {
// keep it sorted, keep it unique
const bd = new Set(pkg.bundleDependencies || [])
bd.add(spec.name)
- pkg.bundleDependencies = [...bd].sort((a, b) => a.localeCompare(b))
+ pkg.bundleDependencies = [...bd].sort((a, b) => a.localeCompare(b, 'en'))
}
}
-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 7ee8dae35be1b5..ade9bbf1a152f9 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
@@ -504,6 +504,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
saveBundle,
saveType,
path: this.path,
+ log: this.log,
})
})
}
@@ -763,7 +764,7 @@ This is a one-time fix-up, please be patient...
// sort physically shallower deps up to the front of the queue,
// because they'll affect things deeper in, then alphabetical
this[_depsQueue].sort((a, b) =>
- (a.depth - b.depth) || a.path.localeCompare(b.path))
+ (a.depth - b.depth) || a.path.localeCompare(b.path, 'en'))
const node = this[_depsQueue].shift()
const bd = node.package.bundleDependencies
@@ -901,7 +902,7 @@ This is a one-time fix-up, please be patient...
}
const placed = tasks
- .sort((a, b) => a.edge.name.localeCompare(b.edge.name))
+ .sort((a, b) => a.edge.name.localeCompare(b.edge.name, 'en'))
.map(({ edge, dep }) => this[_placeDep](dep, node, edge))
const promises = []
@@ -1146,7 +1147,7 @@ This is a one-time fix-up, please be patient...
// we typically only install non-optional peers, but we have to
// factor them into the peerSet so that we can avoid conflicts
.filter(e => e.peer && !(e.valid && e.to))
- .sort(({name: a}, {name: b}) => a.localeCompare(b))
+ .sort(({name: a}, {name: b}) => a.localeCompare(b, 'en'))
for (const edge of peerEdges) {
// already placed this one, and we're happy with it.
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 93b9aa38298208..3578d50389ea64 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'),
@@ -57,6 +58,8 @@ class Arborist extends Base {
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 2a222249d7a482..a98ed23b2a458c 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
@@ -159,12 +159,12 @@ module.exports = cls => class VirtualLoader extends cls {
...depsToEdges('peerOptional', peerOptional),
...lockWS,
].sort(([atype, aname], [btype, bname]) =>
- atype.localeCompare(btype) || aname.localeCompare(bname))
+ atype.localeCompare(btype, 'en') || aname.localeCompare(bname, 'en'))
const rootEdges = [...root.edgesOut.values()]
.map(e => [e.type, e.name, e.spec])
.sort(([atype, aname], [btype, bname]) =>
- atype.localeCompare(btype) || aname.localeCompare(bname))
+ atype.localeCompare(btype, 'en') || aname.localeCompare(bname, 'en'))
if (rootEdges.length !== lockEdges.length) {
// something added or removed
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 390d3ce42aecd2..7cba1da00008ae 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js
@@ -14,7 +14,7 @@ const {
} = require('@npmcli/node-gyp')
const boolEnv = b => b ? '1' : ''
-const sortNodes = (a, b) => (a.depth - b.depth) || a.path.localeCompare(b.path)
+const sortNodes = (a, b) => (a.depth - b.depth) || a.path.localeCompare(b.path, 'en')
const _build = Symbol('build')
const _resetQueues = Symbol('resetQueues')
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 64f08756263c72..b09a9e0fe16d7a 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')
@@ -406,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)
@@ -539,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.
@@ -959,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 : '*'
@@ -968,18 +972,26 @@ module.exports = cls => class Reifier extends cls {
// would allow versions outside the requested range. Tags and
// specific versions save with the save-prefix.
const isRange = (subSpec || req).type === 'range'
- const range = !isRange || subset(prefixRange, spec, { loose: true })
- ? prefixRange : spec
- const pname = child.package.name
+
+ let range = spec
+ if (
+ !isRange ||
+ spec === '*' ||
+ subset(prefixRange, spec, { loose: true })
+ )
+ range = prefixRange
+
+ 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
@@ -988,9 +1000,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 77cd6511aea3b5..76387cde1d66ab 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/audit-report.js
@@ -78,7 +78,7 @@ class AuditReport extends Map {
}
obj.vulnerabilities = vulnerabilities
- .sort(([a], [b]) => a.localeCompare(b))
+ .sort(([a], [b]) => a.localeCompare(b, 'en'))
.reduce((set, [name, vuln]) => {
set[name] = vuln
return set
@@ -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/dep-spec.js b/deps/npm/node_modules/@npmcli/arborist/lib/dep-spec.js
deleted file mode 100644
index 92911543e16841..00000000000000
--- 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/inventory.js b/deps/npm/node_modules/@npmcli/arborist/lib/inventory.js
index cef0c4e2658998..75782918852232 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 a54f76afcdf3b3..370bfc9567d287 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/node.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/node.js
@@ -291,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,
@@ -350,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'),
]
@@ -460,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)
}
@@ -730,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 || {}
@@ -760,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 })
}
}
@@ -965,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 79f46a9e93c4a6..ce764071dc62aa 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
@@ -46,14 +46,14 @@ class ArboristNode {
// edgesOut sorted by name
if (tree.edgesOut.size) {
this.edgesOut = new Map([...tree.edgesOut.entries()]
- .sort(([a], [b]) => a.localeCompare(b))
+ .sort(([a], [b]) => a.localeCompare(b, 'en'))
.map(([name, edge]) => [name, new EdgeOut(edge)]))
}
// edgesIn sorted by location
if (tree.edgesIn.size) {
this.edgesIn = new Set([...tree.edgesIn]
- .sort((a, b) => a.from.location.localeCompare(b.from.location))
+ .sort((a, b) => a.from.location.localeCompare(b.from.location, 'en'))
.map(edge => new EdgeIn(edge)))
}
@@ -65,14 +65,14 @@ class ArboristNode {
// fsChildren sorted by path
if (tree.fsChildren.size) {
this.fsChildren = new Set([...tree.fsChildren]
- .sort(({path: a}, {path: b}) => a.localeCompare(b))
+ .sort(({path: a}, {path: b}) => a.localeCompare(b, 'en'))
.map(tree => printableTree(tree, path)))
}
// children sorted by name
if (tree.children.size) {
this.children = new Map([...tree.children.entries()]
- .sort(([a], [b]) => a.localeCompare(b))
+ .sort(([a], [b]) => a.localeCompare(b, 'en'))
.map(([name, tree]) => [name, printableTree(tree, path)]))
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
index 342e78e9e3a7b1..cff9f09633dfce 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
}
@@ -844,7 +844,7 @@ class Shrinkwrap {
/* istanbul ignore next - sort calling order is indeterminate */
return aloc.length > bloc.length ? 1
: bloc.length > aloc.length ? -1
- : aloc[aloc.length - 1].localeCompare(bloc[bloc.length - 1])
+ : aloc[aloc.length - 1].localeCompare(bloc[bloc.length - 1], 'en')
})[0]
const res = consistentResolve(node.resolved, this.path, this.path, true)
@@ -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 aba5614924ec77..57ec414248756c 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, 'en'))
+ .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 8f887a3fc96cb0..5b1d1dc1ab83d5 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
@@ -103,12 +106,12 @@ class Vuln {
vulnerableVersions: undefined,
id: undefined,
}).sort((a, b) =>
- String(a.source || a).localeCompare(String(b.source || b))),
+ String(a.source || a).localeCompare(String(b.source || b, 'en'))),
effects: [...this.effects].map(v => v.name)
- .sort(/* istanbul ignore next */(a, b) => a.localeCompare(b)),
+ .sort(/* istanbul ignore next */(a, b) => a.localeCompare(b, 'en')),
range: this.simpleRange,
nodes: [...this.nodes].map(n => n.location)
- .sort(/* istanbul ignore next */(a, b) => a.localeCompare(b)),
+ .sort(/* istanbul ignore next */(a, b) => a.localeCompare(b, 'en')),
fixAvailable: this[_fixAvailable],
}
}
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js b/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
index 14c7691f1bd42c..e237cc5c6a4614 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/yarn-lock.js
@@ -34,7 +34,7 @@ const {breadth} = require('treeverse')
// sort a key/value object into a string of JSON stringified keys and vals
const sortKV = obj => Object.keys(obj)
- .sort((a, b) => a.localeCompare(b))
+ .sort((a, b) => a.localeCompare(b, 'en'))
.map(k => ` ${JSON.stringify(k)} ${JSON.stringify(obj[k])}`)
.join('\n')
@@ -165,7 +165,7 @@ class YarnLock {
toString () {
return prefix + [...new Set([...this.entries.values()])]
.map(e => e.toString())
- .sort((a, b) => a.localeCompare(b)).join('\n\n') + '\n'
+ .sort((a, b) => a.localeCompare(b, 'en')).join('\n\n') + '\n'
}
fromTree (tree) {
@@ -175,7 +175,7 @@ class YarnLock {
tree,
visit: node => this.addEntryFromNode(node),
getChildren: node => [...node.children.values(), ...node.fsChildren]
- .sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name)),
+ .sort((a, b) => a.depth - b.depth || a.name.localeCompare(b.name, 'en')),
})
return this
}
@@ -183,7 +183,7 @@ class YarnLock {
addEntryFromNode (node) {
const specs = [...node.edgesIn]
.map(e => `${node.name}@${e.spec}`)
- .sort((a, b) => a.localeCompare(b))
+ .sort((a, b) => a.localeCompare(b, 'en'))
// Note:
// yarn will do excessive duplication in a case like this:
@@ -309,7 +309,7 @@ class YarnLockEntry {
toString () {
// sort objects to the bottom, then alphabetical
return ([...this[_specs]]
- .sort((a, b) => a.localeCompare(b))
+ .sort((a, b) => a.localeCompare(b, 'en'))
.map(JSON.stringify).join(', ') +
':\n' +
Object.getOwnPropertyNames(this)
@@ -318,7 +318,7 @@ class YarnLockEntry {
(a, b) =>
/* istanbul ignore next - sort call order is unpredictable */
(typeof this[a] === 'object') === (typeof this[b] === 'object')
- ? a.localeCompare(b)
+ ? a.localeCompare(b, 'en')
: typeof this[a] === 'object' ? 1 : -1)
.map(prop =>
typeof this[prop] !== 'object'
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index e7ac932e08d8f3..bbe87d8bf97ad2 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.4.1",
+ "version": "2.4.4",
"description": "Manage node_modules trees",
"dependencies": {
"@npmcli/installed-package-contents": "^1.0.7",
@@ -14,7 +14,7 @@
"cacache": "^15.0.3",
"common-ancestor-path": "^1.0.1",
"json-parse-even-better-errors": "^2.3.1",
- "json-stringify-nice": "^1.1.2",
+ "json-stringify-nice": "^1.1.4",
"mkdirp-infer-owner": "^2.0.0",
"npm-install-checks": "^4.0.0",
"npm-package-arg": "^8.1.0",
@@ -40,9 +40,8 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"minify-registry-metadata": "^2.1.0",
- "mutate-fs": "^2.1.1",
- "tap": "^15.0.4",
- "tcompare": "^3.0.4"
+ "tap": "^15.0.9",
+ "tcompare": "^5.0.6"
},
"scripts": {
"test": "npm run test-only --",
@@ -74,11 +73,13 @@
"bin": {
"arborist": "bin/index.js"
},
+ "//": "sk test-env locale to catch locale-specific sorting",
"tap": {
"after": "test/fixtures/cleanup.js",
"coverage-map": "map.js",
"test-env": [
- "NODE_OPTIONS=--no-warnings"
+ "NODE_OPTIONS=--no-warnings",
+ "LC_ALL=sk"
],
"node-arg": [
"--no-warnings",
diff --git a/deps/npm/node_modules/@npmcli/git/lib/clone.js b/deps/npm/node_modules/@npmcli/git/lib/clone.js
index 1fea5acc846211..6754fd7606009d 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 cee3a7baf40788..337164a9a012dc 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 9b368c31e262db..0fe94686ece20c 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/glob/README.md b/deps/npm/node_modules/glob/README.md
index 0916a48255cd6f..2dde30a597d77c 100644
--- a/deps/npm/node_modules/glob/README.md
+++ b/deps/npm/node_modules/glob/README.md
@@ -7,7 +7,7 @@ Match files using the patterns the shell uses, like stars and stuff.
This is a glob implementation in JavaScript. It uses the `minimatch`
library to do its matching.
-
+
## Usage
diff --git a/deps/npm/node_modules/glob/common.js b/deps/npm/node_modules/glob/common.js
index 66651bb3aac655..d14157a0aec8a2 100644
--- a/deps/npm/node_modules/glob/common.js
+++ b/deps/npm/node_modules/glob/common.js
@@ -1,5 +1,3 @@
-exports.alphasort = alphasort
-exports.alphasorti = alphasorti
exports.setopts = setopts
exports.ownProp = ownProp
exports.makeAbs = makeAbs
@@ -17,12 +15,8 @@ var minimatch = require("minimatch")
var isAbsolute = require("path-is-absolute")
var Minimatch = minimatch.Minimatch
-function alphasorti (a, b) {
- return a.toLowerCase().localeCompare(b.toLowerCase())
-}
-
function alphasort (a, b) {
- return a.localeCompare(b)
+ return a.localeCompare(b, 'en')
}
function setupIgnores (self, options) {
@@ -150,7 +144,7 @@ function finish (self) {
all = Object.keys(all)
if (!self.nosort)
- all = all.sort(self.nocase ? alphasorti : alphasort)
+ all = all.sort(alphasort)
// at *some* point we statted all of these
if (self.mark) {
diff --git a/deps/npm/node_modules/glob/glob.js b/deps/npm/node_modules/glob/glob.js
index 58dec0f6c2bd0b..dc27aef10b344c 100644
--- a/deps/npm/node_modules/glob/glob.js
+++ b/deps/npm/node_modules/glob/glob.js
@@ -51,8 +51,6 @@ var assert = require('assert')
var isAbsolute = require('path-is-absolute')
var globSync = require('./sync.js')
var common = require('./common.js')
-var alphasort = common.alphasort
-var alphasorti = common.alphasorti
var setopts = common.setopts
var ownProp = common.ownProp
var inflight = require('inflight')
diff --git a/deps/npm/node_modules/glob/package.json b/deps/npm/node_modules/glob/package.json
index 6477c3070cb14e..b345ae1e9fd833 100644
--- a/deps/npm/node_modules/glob/package.json
+++ b/deps/npm/node_modules/glob/package.json
@@ -2,7 +2,7 @@
"author": "Isaac Z. Schlueter (http://blog.izs.me/)",
"name": "glob",
"description": "a little globber",
- "version": "7.1.6",
+ "version": "7.1.7",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-glob.git"
@@ -27,13 +27,18 @@
"devDependencies": {
"mkdirp": "0",
"rimraf": "^2.2.8",
- "tap": "^12.0.1",
+ "tap": "^15.0.6",
"tick": "0.0.6"
},
+ "tap": {
+ "before": "test/00-setup.js",
+ "after": "test/zz-cleanup.js",
+ "jobs": 1
+ },
"scripts": {
"prepublish": "npm run benchclean",
"profclean": "rm -f v8.log profile.txt",
- "test": "tap test/*.js --cov",
+ "test": "tap",
"test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js",
"bench": "bash benchmark.sh",
"prof": "bash prof.sh && cat profile.txt",
diff --git a/deps/npm/node_modules/glob/sync.js b/deps/npm/node_modules/glob/sync.js
index c952134baa7ec0..10b0ed2c0026b1 100644
--- a/deps/npm/node_modules/glob/sync.js
+++ b/deps/npm/node_modules/glob/sync.js
@@ -11,8 +11,6 @@ var path = require('path')
var assert = require('assert')
var isAbsolute = require('path-is-absolute')
var common = require('./common.js')
-var alphasort = common.alphasort
-var alphasorti = common.alphasorti
var setopts = common.setopts
var ownProp = common.ownProp
var childrenIgnored = common.childrenIgnored
diff --git a/deps/npm/node_modules/ignore-walk/index.js b/deps/npm/node_modules/ignore-walk/index.js
index eec6851804a996..c01d57de2a0391 100644
--- a/deps/npm/node_modules/ignore-walk/index.js
+++ b/deps/npm/node_modules/ignore-walk/index.js
@@ -23,7 +23,7 @@ class Walker extends EE {
}
sort (a, b) {
- return a.localeCompare(b)
+ return a.localeCompare(b, 'en')
}
emit (ev, data) {
diff --git a/deps/npm/node_modules/ignore-walk/package.json b/deps/npm/node_modules/ignore-walk/package.json
index 99d2c2e64de9df..7d48b977e0702c 100644
--- a/deps/npm/node_modules/ignore-walk/package.json
+++ b/deps/npm/node_modules/ignore-walk/package.json
@@ -1,13 +1,13 @@
{
"name": "ignore-walk",
- "version": "3.0.3",
+ "version": "3.0.4",
"description": "Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.",
"main": "index.js",
"devDependencies": {
"mkdirp": "^0.5.1",
"mutate-fs": "^1.1.0",
"rimraf": "^2.6.1",
- "tap": "^14.6.9"
+ "tap": "^15.0.6"
},
"scripts": {
"test": "tap",
@@ -36,6 +36,9 @@
"minimatch": "^3.0.4"
},
"tap": {
+ "test-env": "LC_ALL=sk",
+ "before": "test/00-setup.js",
+ "after": "test/zz-cleanup.js",
"jobs": 1
}
}
diff --git a/deps/npm/node_modules/json-stringify-nice/index.js b/deps/npm/node_modules/json-stringify-nice/index.js
index 2c722a752c6855..36557bb055f01e 100644
--- a/deps/npm/node_modules/json-stringify-nice/index.js
+++ b/deps/npm/node_modules/json-stringify-nice/index.js
@@ -5,7 +5,7 @@ const compare = (ak, bk, prefKeys) =>
: prefKeys.includes(bk) && !prefKeys.includes(ak) ? 1
: prefKeys.includes(ak) && prefKeys.includes(bk)
? prefKeys.indexOf(ak) - prefKeys.indexOf(bk)
- : ak.localeCompare(bk)
+ : ak.localeCompare(bk, 'en')
const sort = (replacer, seen) => (key, val) => {
const prefKeys = Array.isArray(replacer) ? replacer : []
diff --git a/deps/npm/node_modules/json-stringify-nice/package.json b/deps/npm/node_modules/json-stringify-nice/package.json
index ea4f486c5e0b0c..c9663290ee4bc2 100644
--- a/deps/npm/node_modules/json-stringify-nice/package.json
+++ b/deps/npm/node_modules/json-stringify-nice/package.json
@@ -1,21 +1,34 @@
{
"name": "json-stringify-nice",
- "version": "1.1.3",
+ "version": "1.1.4",
"description": "Stringify an object sorting scalars before objects, and defaulting to 2-space indent",
"author": "Isaac Z. Schlueter (https://izs.me)",
"license": "ISC",
"scripts": {
"test": "tap",
+ "posttest": "npm run lint",
"snap": "tap",
+ "postsnap": "npm run lintfix",
+ "eslint": "eslint",
+ "lint": "npm run eslint -- index.js test/**/*.js",
+ "lintfix": "npm run lint -- --fix",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags"
},
"tap": {
+ "test-env": [
+ "LC_ALL=sk"
+ ],
"check-coverage": true
},
"devDependencies": {
- "tap": "^14.9.2"
+ "eslint": "^7.25.0",
+ "eslint-plugin-import": "^2.22.1",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^5.1.0",
+ "eslint-plugin-standard": "^5.0.0",
+ "tap": "^15.0.6"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
diff --git a/deps/npm/node_modules/libnpmexec/CHANGELOG.md b/deps/npm/node_modules/libnpmexec/CHANGELOG.md
deleted file mode 100644
index 9de3013f0ad9d8..00000000000000
--- a/deps/npm/node_modules/libnpmexec/CHANGELOG.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Changelog
-
-## v1.0.0
-
-- Initial implementation, moves the code that used to live in the **npm cli**,
-ref: https://github.com/npm/cli/blob/release/v7.10.0/lib/exec.js into this
-separate module, providing a programmatic API to the **npm exec** functionality.
diff --git a/deps/npm/node_modules/libnpmexec/README.md b/deps/npm/node_modules/libnpmexec/README.md
index a436c9a5a2bc1a..fb7a7717600197 100644
--- a/deps/npm/node_modules/libnpmexec/README.md
+++ b/deps/npm/node_modules/libnpmexec/README.md
@@ -31,7 +31,7 @@ await libexec({
- `call`: An alternative command to run when using `packages` option **String**, defaults to empty string.
- `cache`: The path location to where the npm cache folder is placed **String**
- `color`: Output should use color? **Boolean**, defaults to `false`
- - `localBin`: Location to the `node_modules/.bin` folder of the local project **String**, defaults to empty string.
+ - `localBin`: Location to the `node_modules/.bin` folder of the local project to start scanning for bin files **String**, defaults to `./node_modules/.bin`. **libexec** will walk up the directory structure looking for `node_modules/.bin` folders in parent folders that might satisfy the current `arg` and will use that bin if found.
- `locationMsg`: Overrides "at location" message when entering interactive mode **String**
- `log`: Sets an optional logger **Object**, defaults to `proc-log` module usage.
- `globalBin`: Location to the global space bin folder, same as: `$(npm bin -g)` **String**, defaults to empty string.
diff --git a/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js
index 1bee28989bf76d..9e30d62a1e102c 100644
--- a/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js
+++ b/deps/npm/node_modules/libnpmexec/lib/cache-install-dir.js
@@ -12,7 +12,7 @@ const cacheInstallDir = ({ cache, packages }) => {
const getHash = (packages) =>
crypto.createHash('sha512')
- .update(packages.sort((a, b) => a.localeCompare(b)).join('\n'))
+ .update(packages.sort((a, b) => a.localeCompare(b, 'en')).join('\n'))
.digest('hex')
.slice(0, 16)
diff --git a/deps/npm/node_modules/libnpmexec/lib/file-exists.js b/deps/npm/node_modules/libnpmexec/lib/file-exists.js
new file mode 100644
index 00000000000000..a115be14b00427
--- /dev/null
+++ b/deps/npm/node_modules/libnpmexec/lib/file-exists.js
@@ -0,0 +1,29 @@
+const { resolve } = require('path')
+const { promisify } = require('util')
+const stat = promisify(require('fs').stat)
+const walkUp = require('walk-up-path')
+
+const fileExists = (file) => stat(file)
+ .then((stat) => stat.isFile())
+ .catch(() => false)
+
+const localFileExists = async (dir, binName, root = '/') => {
+ root = resolve(root).toLowerCase()
+
+ for (const path of walkUp(resolve(dir))) {
+ const binDir = resolve(path, 'node_modules', '.bin')
+
+ if (await fileExists(resolve(binDir, binName)))
+ return binDir
+
+ if (path.toLowerCase() === root)
+ return false
+ }
+
+ return false
+}
+
+module.exports = {
+ fileExists,
+ localFileExists,
+}
diff --git a/deps/npm/node_modules/libnpmexec/lib/index.js b/deps/npm/node_modules/libnpmexec/lib/index.js
index 906a0b5407c13a..a48c654bf6a4f8 100644
--- a/deps/npm/node_modules/libnpmexec/lib/index.js
+++ b/deps/npm/node_modules/libnpmexec/lib/index.js
@@ -1,7 +1,6 @@
-const { delimiter, resolve } = require('path')
+const { delimiter, dirname, resolve } = require('path')
const { promisify } = require('util')
const read = promisify(require('read'))
-const stat = promisify(require('fs').stat)
const Arborist = require('@npmcli/arborist')
const ciDetect = require('@npmcli/ci-detect')
@@ -12,15 +11,12 @@ const pacote = require('pacote')
const readPackageJson = require('read-package-json-fast')
const cacheInstallDir = require('./cache-install-dir.js')
+const { fileExists, localFileExists } = require('./file-exists.js')
const getBinFromManifest = require('./get-bin-from-manifest.js')
const manifestMissing = require('./manifest-missing.js')
const noTTY = require('./no-tty.js')
const runScript = require('./run-script.js')
-const fileExists = (file) => stat(file)
- .then((stat) => stat.isFile())
- .catch(() => false)
-
/* istanbul ignore next */
const PATH = (
process.env.PATH || process.env.Path || process.env.path
@@ -31,7 +27,7 @@ const exec = async (opts) => {
args = [],
call = '',
color = false,
- localBin = '',
+ localBin = resolve('./node_modules/.bin'),
locationMsg = undefined,
globalBin = '',
output,
@@ -72,8 +68,10 @@ const exec = async (opts) => {
// the behavior of treating the single argument as a package name
if (needPackageCommandSwap) {
let binExists = false
- if (await fileExists(`${localBin}/${args[0]}`)) {
- pathArr.unshift(localBin)
+ const dir = dirname(dirname(localBin))
+ const localBinPath = await localFileExists(dir, args[0])
+ if (localBinPath) {
+ pathArr.unshift(localBinPath)
binExists = true
} else if (await fileExists(`${globalBin}/${args[0]}`)) {
pathArr.unshift(globalBin)
@@ -145,7 +143,7 @@ const exec = async (opts) => {
},
}))
.map(mani => mani._from)
- .sort((a, b) => a.localeCompare(b))
+ .sort((a, b) => a.localeCompare(b, 'en'))
// no need to install if already present
if (add.length) {
diff --git a/deps/npm/node_modules/libnpmexec/package.json b/deps/npm/node_modules/libnpmexec/package.json
index 1b7d24103be7af..c113ac6d0a6076 100644
--- a/deps/npm/node_modules/libnpmexec/package.json
+++ b/deps/npm/node_modules/libnpmexec/package.json
@@ -1,6 +1,6 @@
{
"name": "libnpmexec",
- "version": "1.0.1",
+ "version": "1.1.1",
"files": [
"lib"
],
@@ -46,7 +46,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
- "tap": "^15.0.2"
+ "tap": "^15.0.6"
},
"dependencies": {
"@npmcli/arborist": "^2.3.0",
@@ -58,6 +58,7 @@
"pacote": "^11.3.1",
"proc-log": "^1.0.0",
"read": "^1.0.7",
- "read-package-json-fast": "^2.0.2"
+ "read-package-json-fast": "^2.0.2",
+ "walk-up-path": "^1.0.0"
}
}
diff --git a/deps/npm/node_modules/npm-packlist/bin/index.js b/deps/npm/node_modules/npm-packlist/bin/index.js
index f06feffd9b55ae..40811db7d32e72 100755
--- a/deps/npm/node_modules/npm-packlist/bin/index.js
+++ b/deps/npm/node_modules/npm-packlist/bin/index.js
@@ -12,13 +12,14 @@ process.argv.slice(2).forEach(arg => {
dirs.push(arg)
})
-const sort = list => doSort ? list.sort((a, b) => a.localeCompare(b)) : list
+const sort = list => doSort ? list.sort((a, b) => a.localeCompare(b, 'en')) : list
const packlist = require('../')
if (!dirs.length)
console.log(sort(packlist.sync({ path: process.cwd() })).join('\n'))
-else
+else {
dirs.forEach(path => {
console.log(`> ${path}`)
console.log(sort(packlist.sync({ path })).join('\n'))
})
+}
diff --git a/deps/npm/node_modules/npm-packlist/index.js b/deps/npm/node_modules/npm-packlist/index.js
index 8f62983e6f6c0f..f498fa008ceca8 100644
--- a/deps/npm/node_modules/npm-packlist/index.js
+++ b/deps/npm/node_modules/npm-packlist/index.js
@@ -26,11 +26,10 @@ const normalizePackageBin = require('npm-normalize-package-bin')
// localized documentation and other use cases. Adding a `/` to
// these rules, while tempting and arguably more "correct", is a
// significant change that will break existing use cases.
-const packageMustHaveFileNames =
- 'readme|copying|license|licence|notice|changes|changelog|history'
+const packageMustHaveFileNames = 'readme|copying|license|licence'
const packageMustHaves = `@(${packageMustHaveFileNames}){,.*[^~$]}`
-const packageMustHavesRE = new RegExp(`^(${packageMustHaveFileNames})(\\..*[^~\$])?$`, 'i')
+const packageMustHavesRE = new RegExp(`^(${packageMustHaveFileNames})(\\..*[^~$])?$`, 'i')
const fs = require('fs')
const glob = require('glob')
@@ -76,13 +75,11 @@ const npmWalker = Class => class Walker extends Class {
'package.json',
'.npmignore',
'.gitignore',
- packageNecessaryRules
+ packageNecessaryRules,
]
opt.includeEmpty = false
opt.path = opt.path || process.cwd()
- const dirName = path.basename(opt.path)
- const parentName = path.basename(path.dirname(opt.path))
// only follow links in the root node_modules folder, because if those
// folders are included, it's because they're bundled, and bundles
@@ -90,7 +87,7 @@ const npmWalker = Class => class Walker extends Class {
// This regexp tests to see that we're either a node_modules folder,
// or a @scope within a node_modules folder, in the root's node_modules
// hierarchy (ie, not in test/foo/node_modules/ or something).
- const followRe = /^(?:\/node_modules\/(?:@[^\/]+\/[^\/]+|[^\/]+)\/)*\/node_modules(?:\/@[^\/]+)?$/
+ const followRe = /^(?:\/node_modules\/(?:@[^/]+\/[^/]+|[^/]+)\/)*\/node_modules(?:\/@[^/]+)?$/
const rootPath = opt.parent ? opt.parent.root : opt.path
const followTestPath = opt.path.replace(/\\/g, '/').substr(rootPath.length)
opt.follow = followRe.test(followTestPath)
@@ -104,10 +101,10 @@ const npmWalker = Class => class Walker extends Class {
this.bundled = opt.bundled || []
this.bundledScopes = Array.from(new Set(
this.bundled.filter(f => /^@/.test(f))
- .map(f => f.split('/')[0])))
+ .map(f => f.split('/')[0])))
const rules = defaultRules.join('\n') + '\n'
this.packageJsonCache = opt.packageJsonCache || new Map()
- super.onReadIgnoreFile(rootBuiltinRules, rules, _=>_)
+ super.onReadIgnoreFile(rootBuiltinRules, rules, _ => _)
} else {
this.bundled = []
this.bundledScopes = []
@@ -129,9 +126,8 @@ const npmWalker = Class => class Walker extends Class {
// to be in the state the user wants to include them, and
// a package.json somewhere else might be a template or
// test or something else entirely.
- if (this.parent || !entries.includes('package.json')) {
+ if (this.parent || !entries.includes('package.json'))
return super.onReaddir(entries)
- }
// when the cache has been seeded with the root manifest,
// we must respect that (it may differ from the filesystem)
@@ -141,9 +137,8 @@ const npmWalker = Class => class Walker extends Class {
const pkg = this.packageJsonCache.get(ig)
// fall back to filesystem when seeded manifest is invalid
- if (!pkg || typeof pkg !== 'object') {
+ if (!pkg || typeof pkg !== 'object')
return this.readPackageJson(entries)
- }
// feels wonky, but this ensures package bin is _always_
// normalized, as well as guarding against invalid JSON
@@ -175,7 +170,7 @@ const npmWalker = Class => class Walker extends Class {
'/package.json',
'/npm-shrinkwrap.json',
'!/package-lock.json',
- packageMustHaves,
+ packageMustHaves
)
return files
}
@@ -233,9 +228,8 @@ const npmWalker = Class => class Walker extends Class {
return this.emit('error', er)
results[i] = { negate, fileList }
- if (--n === 0) {
+ if (--n === 0)
processResults(results)
- }
}
const processResults = results => {
for (const {negate, fileList} of results) {
@@ -273,7 +267,7 @@ const npmWalker = Class => class Walker extends Class {
filterEntry (entry, partial) {
// get the partial path from the root of the walk
const p = this.path.substr(this.root.length + 1)
- const pkgre = /^node_modules\/(@[^\/]+\/?[^\/]+|[^\/]+)(\/.*)?$/
+ const pkgre = /^node_modules\/(@[^/]+\/?[^/]+|[^/]+)(\/.*)?$/
const isRoot = !this.parent
const pkg = isRoot && pkgre.test(entry) ?
entry.replace(pkgre, '$1') : null
@@ -283,7 +277,7 @@ const npmWalker = Class => class Walker extends Class {
return (
// if we're in a bundled package, check with the parent.
/^node_modules($|\/)/i.test(p) ? this.parent.filterEntry(
- this.basename + '/' + entry, partial)
+ this.basename + '/' + entry, partial)
// if package is bundled, all files included
// also include @scope dirs for bundled scoped deps
@@ -291,8 +285,8 @@ const npmWalker = Class => class Walker extends Class {
// However, this only matters if we're in the root.
// node_modules folders elsewhere, like lib/node_modules,
// should be included normally unless ignored.
- : pkg ? -1 !== this.bundled.indexOf(pkg) ||
- -1 !== this.bundledScopes.indexOf(pkg)
+ : pkg ? this.bundled.indexOf(pkg) !== -1 ||
+ this.bundledScopes.indexOf(pkg) !== -1
// only walk top node_modules if we want to bundle something
: rootNM ? !!this.bundled.length
@@ -308,10 +302,10 @@ const npmWalker = Class => class Walker extends Class {
? true
// package-lock never included
- : isRoot && entry === 'package-lock.json' ? false
+ : isRoot && entry === 'package-lock.json' ? false
- // otherwise, follow ignore-walk's logic
- : super.filterEntry(entry, partial)
+ // otherwise, follow ignore-walk's logic
+ : super.filterEntry(entry, partial)
)
}
@@ -454,12 +448,11 @@ const sort = (a, b) => {
const basea = path.basename(a).toLowerCase()
const baseb = path.basename(b).toLowerCase()
- return exta.localeCompare(extb) ||
- basea.localeCompare(baseb) ||
- a.localeCompare(b)
+ return exta.localeCompare(extb, 'en') ||
+ basea.localeCompare(baseb, 'en') ||
+ a.localeCompare(b, 'en')
}
-
module.exports = walk
walk.sync = walkSync
walk.Walker = Walker
diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json
index 1276b484136992..49fa947547b6cc 100644
--- a/deps/npm/node_modules/npm-packlist/package.json
+++ b/deps/npm/node_modules/npm-packlist/package.json
@@ -1,6 +1,6 @@
{
"name": "npm-packlist",
- "version": "2.1.5",
+ "version": "2.2.2",
"description": "Get a list of the files to add from a folder into an npm package",
"directories": {
"test": "test"
@@ -15,25 +15,38 @@
"author": "Isaac Z. Schlueter (http://blog.izs.me/)",
"license": "ISC",
"files": [
+ "bin/index.js",
"index.js"
],
"devDependencies": {
+ "eslint": "^7.25.0",
+ "eslint-plugin-import": "^2.22.1",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^5.1.0",
+ "eslint-plugin-standard": "^5.0.0",
"mutate-fs": "^2.1.1",
- "require-inject": "^1.4.4",
- "tap": "^14.10.8"
+ "tap": "^15.0.6"
},
"scripts": {
"test": "tap",
+ "posttest": "npm run lint",
"snap": "tap",
+ "postsnap": "npm run lintfix",
"preversion": "npm test",
"postversion": "npm publish",
- "prepublishOnly": "git push origin --follow-tags"
+ "prepublishOnly": "git push origin --follow-tags",
+ "eslint": "eslint",
+ "lint": "npm run eslint -- index.js bin/index.js \"test/**/*.js\"",
+ "lintfix": "npm run lint -- --fix"
},
"repository": {
"type": "git",
"url": "git+https://github.com/npm/npm-packlist.git"
},
"tap": {
+ "test-env": [
+ "LC_ALL=sk"
+ ],
"check-coverage": true,
"nyc-arg": [
"--include=index.js",
diff --git a/deps/npm/package.json b/deps/npm/package.json
index 19326a9aa59df1..70f94838882b74 100644
--- a/deps/npm/package.json
+++ b/deps/npm/package.json
@@ -1,5 +1,5 @@
{
- "version": "7.11.2",
+ "version": "7.12.1",
"name": "npm",
"description": "a package manager for JavaScript",
"keywords": [
@@ -42,7 +42,7 @@
"./package.json": "./package.json"
},
"dependencies": {
- "@npmcli/arborist": "^2.4.1",
+ "@npmcli/arborist": "^2.4.4",
"@npmcli/ci-detect": "^1.2.0",
"@npmcli/config": "^2.2.0",
"@npmcli/run-script": "^1.8.5",
@@ -57,7 +57,7 @@
"cli-columns": "^3.1.2",
"cli-table3": "^0.6.0",
"columnify": "~1.5.4",
- "glob": "^7.1.4",
+ "glob": "^7.1.7",
"graceful-fs": "^4.2.6",
"hosted-git-info": "^4.0.2",
"ini": "^2.0.0",
@@ -67,7 +67,7 @@
"leven": "^3.1.0",
"libnpmaccess": "^4.0.2",
"libnpmdiff": "^2.0.4",
- "libnpmexec": "^1.0.1",
+ "libnpmexec": "^1.1.1",
"libnpmfund": "^1.0.2",
"libnpmhook": "^6.0.2",
"libnpmorg": "^2.0.2",
@@ -182,15 +182,15 @@
"devDependencies": {
"@mdx-js/mdx": "^1.6.22",
"cmark-gfm": "^0.8.5",
- "eslint": "^7.23.0",
+ "eslint": "^7.26.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
- "eslint-plugin-promise": "^4.3.1",
+ "eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"jsdom": "^16.5.2",
"licensee": "^8.1.0",
"marked-man": "^0.7.0",
- "tap": "^15.0.6",
+ "tap": "^15.0.9",
"yaml": "^1.10.2"
},
"scripts": {
@@ -216,6 +216,9 @@
"Remove the 'files' below once we're done porting old tests over"
],
"tap": {
+ "test-env": [
+ "LC_ALL=sk"
+ ],
"color": 1,
"files": "test/{lib,bin}",
"coverage-map": "test/coverage-map.js",
diff --git a/deps/npm/tap-snapshots/test/lib/config.js.test.cjs b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs
index 68c50d699a430c..a293eda63a0b3a 100644
--- a/deps/npm/tap-snapshots/test/lib/config.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/config.js.test.cjs
@@ -88,6 +88,9 @@ exports[`test/lib/config.js TAP config edit > should write config file 2`] = `
exports[`test/lib/config.js TAP config get no args > should list configs on config get no args 1`] = `
; "cli" config from command line options
+cat = true
+chai = true
+dog = true
editor = "vi"
global = false
json = false
@@ -109,6 +112,9 @@ init.version = "1.0.0"
; "cli" config from command line options
+cat = true
+chai = true
+dog = true
editor = "vi"
global = false
json = false
@@ -118,6 +124,9 @@ long = true
exports[`test/lib/config.js TAP config list > should list configs 1`] = `
; "cli" config from command line options
+cat = true
+chai = true
+dog = true
editor = "vi"
global = false
json = false
@@ -132,6 +141,9 @@ long = false
exports[`test/lib/config.js TAP config list overrides > should list overridden configs 1`] = `
; "cli" config from command line options
+cat = true
+chai = true
+dog = true
editor = "vi"
global = false
init.author.name = "Bar"
diff --git a/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs b/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs
index 0278f6af1f2e4c..67359f4b3a3483 100644
--- a/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/ls.js.test.cjs
@@ -47,8 +47,8 @@ test-npm-ls-ignore-missing-optional@1.2.3 {project}
exports[`test/lib/ls.js TAP ls --depth=0 > should output tree containing only top-level dependencies 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---depth-0
-+-- foo@1.0.0
-\`-- lorem@1.0.0
++-- chai@1.0.0
+\`-- foo@1.0.0
`
@@ -64,7 +64,7 @@ exports[`test/lib/ls.js TAP ls --dev > should output tree containing dev deps 1`
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---dev
\`-- dev-dep@1.0.0
\`-- foo@1.0.0
- \`-- bar@1.0.0
+ \`-- dog@1.0.0
`
@@ -78,10 +78,10 @@ exports[`test/lib/ls.js TAP ls --long --depth=0 > should output tree containing
test-npm-ls@1.0.0
| {CWD}/tap-testdir-ls-ls---long---depth-0
|
++-- chai@1.0.0
+|
+-- dev-dep@1.0.0
| A DEV dep kind of dep
-+-- lorem@1.0.0
-|
+-- optional-dep@1.0.0
| Maybe a dep?
+-- peer-dep@1.0.0
@@ -95,13 +95,13 @@ exports[`test/lib/ls.js TAP ls --long > should output tree info with description
test-npm-ls@1.0.0
| {CWD}/tap-testdir-ls-ls---long
|
++-- chai@1.0.0
+|
+-- dev-dep@1.0.0
| | A DEV dep kind of dep
| \`-- foo@1.0.0
| |
-| \`-- bar@1.0.0
-|
-+-- lorem@1.0.0
+| \`-- dog@1.0.0
|
+-- optional-dep@1.0.0
| Maybe a dep?
@@ -109,7 +109,7 @@ test-npm-ls@1.0.0
| Peer-dep description here
\`-- prod-dep@1.0.0
| A PROD dep kind of dep
- \`-- bar@2.0.0
+ \`-- dog@2.0.0
A dep that bars
`
@@ -118,37 +118,37 @@ exports[`test/lib/ls.js TAP ls --only=development > should output tree containin
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-development
\`-- dev-dep@1.0.0
\`-- foo@1.0.0
- \`-- bar@1.0.0
+ \`-- dog@1.0.0
`
exports[`test/lib/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-prod
-+-- lorem@1.0.0
++-- chai@1.0.0
+-- optional-dep@1.0.0
\`-- prod-dep@1.0.0
- \`-- bar@2.0.0
+ \`-- dog@2.0.0
`
exports[`test/lib/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---depth-0
+{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/lorem
`
exports[`test/lib/ls.js TAP ls --parseable --depth=1 > should output parseable containing top-level deps and their deps only 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---depth-1
+{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/lorem
-{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable --dev > should output tree containing dev deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---dev
{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/dev-dep
{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable --link > should output tree containing linked deps 1`] = `
@@ -158,8 +158,8 @@ exports[`test/lib/ls.js TAP ls --parseable --link > should output tree containin
exports[`test/lib/ls.js TAP ls --parseable --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---long---depth-0:test-npm-ls@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/chai:chai@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/dev-dep:dev-dep@1.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/lorem:lorem@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/optional-dep:optional-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/peer-dep:peer-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/prod-dep:prod-dep@1.0.0
@@ -167,64 +167,64 @@ exports[`test/lib/ls.js TAP ls --parseable --long --depth=0 > should output tree
exports[`test/lib/ls.js TAP ls --parseable --long > should output tree info with descriptions 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---long:test-npm-ls@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/chai:chai@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/dev-dep:dev-dep@1.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/lorem:lorem@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/optional-dep:optional-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/peer-dep:peer-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep:prod-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/foo:foo@1.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep/node_modules/bar:bar@2.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/bar:bar@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep/node_modules/dog:dog@2.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/dog:dog@1.0.0
`
exports[`test/lib/ls.js TAP ls --parseable --long missing/invalid/extraneous > should output parseable result containing EXTRANEOUS/INVALID labels 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous:test-npm-ls@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/chai:chai@1.0.0:EXTRANEOUS
{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/foo:foo@1.0.0:INVALID
-{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/lorem:lorem@1.0.0:EXTRANEOUS
-{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/bar:bar@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/dog:dog@1.0.0
`
exports[`test/lib/ls.js TAP ls --parseable --long print symlink target location > should output parseable results with symlink targets 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location:test-npm-ls@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/chai:chai@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/dev-dep:dev-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/linked-dep:linked-dep@1.0.0:{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/linked-dep
-{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/lorem:lorem@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/optional-dep:optional-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/peer-dep:peer-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep:prod-dep@1.0.0
{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/foo:foo@1.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep/node_modules/bar:bar@2.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/bar:bar@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep/node_modules/dog:dog@2.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/dog:dog@1.0.0
`
exports[`test/lib/ls.js TAP ls --parseable --long with extraneous deps > should output long parseable output with extraneous info 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps:test-npm-ls@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/chai:chai@1.0.0:EXTRANEOUS
{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/foo:foo@1.0.0
-{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/lorem:lorem@1.0.0:EXTRANEOUS
-{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/bar:bar@1.0.0
+{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/dog:dog@1.0.0
`
exports[`test/lib/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---only-development
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dev-dep
{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---only-prod
-{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/lorem
+{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/optional-dep
{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep
-{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable---production
-{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/lorem
+{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/optional-dep
{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep
-{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable cycle deps > should print tree output omitting deduped ref 1`] = `
@@ -235,8 +235,8 @@ exports[`test/lib/ls.js TAP ls --parseable cycle deps > should print tree output
exports[`test/lib/ls.js TAP ls --parseable default --depth value should be 0 > should output parseable output containing only top-level dependencies 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0
+{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/lorem
`
exports[`test/lib/ls.js TAP ls --parseable empty location > should print empty result 1`] = `
@@ -245,9 +245,9 @@ exports[`test/lib/ls.js TAP ls --parseable empty location > should print empty r
exports[`test/lib/ls.js TAP ls --parseable extraneous deps > should output containing problems info 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps
+{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/lorem
-{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable from and resolved properties > should not be printed in tree output 1`] = `
@@ -268,23 +268,23 @@ exports[`test/lib/ls.js TAP ls --parseable json read problems > should print emp
exports[`test/lib/ls.js TAP ls --parseable missing package.json > should output parseable missing name/version of top-level package 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-missing-package.json
-{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/chai
+{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/dog
{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/lorem
`
exports[`test/lib/ls.js TAP ls --parseable missing/invalid/extraneous > should output parseable containing top-level deps and their deps only 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous
+{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/lorem
-{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable no args > should output parseable representation of dependencies structure 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-no-args
+{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/lorem
-{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable resolved points to git ref > should output tree containing git refs 1`] = `
@@ -294,26 +294,26 @@ exports[`test/lib/ls.js TAP ls --parseable resolved points to git ref > should o
exports[`test/lib/ls.js TAP ls --parseable unmet optional dep > should output parseable with empty entry for missing optional deps 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep
+{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/dev-dep
-{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/lorem
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/optional-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/peer-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep/node_modules/bar
-{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep/node_modules/dog
+{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable unmet peer dep > should output parseable signaling missing peer dep in problems 1`] = `
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep
+{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/chai
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/dev-dep
-{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/lorem
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/optional-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/peer-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep
{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/foo
-{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep/node_modules/bar
-{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep/node_modules/dog
+{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable using aliases > should output tree containing aliases 1`] = `
@@ -322,11 +322,11 @@ exports[`test/lib/ls.js TAP ls --parseable using aliases > should output tree co
`
exports[`test/lib/ls.js TAP ls --parseable with filter arg > should output parseable contaning only occurrences of filtered by package 1`] = `
-{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg/node_modules/lorem
+{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg/node_modules/chai
`
exports[`test/lib/ls.js TAP ls --parseable with filter arg nested dep > should output parseable contaning only occurrences of filtered package 1`] = `
-{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg-nested-dep/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg-nested-dep/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --parseable with missing filter arg > should output parseable output containing no dependencies info 1`] = `
@@ -334,16 +334,16 @@ exports[`test/lib/ls.js TAP ls --parseable with missing filter arg > should outp
`
exports[`test/lib/ls.js TAP ls --parseable with multiple filter args > should output parseable contaning only occurrences of multiple filtered packages and their ancestors 1`] = `
-{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/lorem
-{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/bar
+{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/chai
+{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/dog
`
exports[`test/lib/ls.js TAP ls --production > should output tree containing production deps 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---production
-+-- lorem@1.0.0
++-- chai@1.0.0
+-- optional-dep@1.0.0
\`-- prod-dep@1.0.0
- \`-- bar@2.0.0
+ \`-- dog@2.0.0
`
@@ -355,10 +355,10 @@ npm-broken-resolved-field-test@1.0.0 {CWD}/tap-testdir-ls-ls-broken-resolved-fie
exports[`test/lib/ls.js TAP ls colored output > should output tree containing color info 1`] = `
[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-colored-output[0m
+[0m+-- chai@1.0.0 [32m[40mextraneous[49m[39m[0m
[0m+-- foo@1.0.0 [31m[40minvalid[49m[39m[0m
-[0m| \`-- bar@1.0.0[0m
-[0m+-- [31m[40mUNMET DEPENDENCY[49m[39m ipsum@^1.0.0[0m
-[0m\`-- lorem@1.0.0 [32m[40mextraneous[49m[39m[0m
+[0m| \`-- dog@1.0.0[0m
+[0m\`-- [31m[40mUNMET DEPENDENCY[49m[39m ipsum@^1.0.0[0m
[0m[0m
`
@@ -388,8 +388,8 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-deduped-missing-dep
exports[`test/lib/ls.js TAP ls default --depth value should be 0 > should output tree containing only top-level dependencies 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-default---depth-value-should-be-0
-+-- foo@1.0.0
-\`-- lorem@1.0.0
++-- chai@1.0.0
+\`-- foo@1.0.0
`
@@ -401,9 +401,9 @@ exports[`test/lib/ls.js TAP ls empty location > should print empty result 1`] =
exports[`test/lib/ls.js TAP ls extraneous deps > should output containing problems info 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-extraneous-deps
-+-- foo@1.0.0
-| \`-- bar@1.0.0
-\`-- lorem@1.0.0 extraneous
++-- chai@1.0.0 extraneous
+\`-- foo@1.0.0
+ \`-- dog@1.0.0
`
@@ -461,14 +461,14 @@ exports[`test/lib/ls.js TAP ls invalid deduped dep > should output tree signalin
exports[`test/lib/ls.js TAP ls invalid peer dep > should output tree signaling mismatching peer dep in problems 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-invalid-peer-dep
++-- chai@1.0.0
+-- dev-dep@1.0.0
| \`-- foo@1.0.0
-| \`-- bar@1.0.0
-+-- lorem@1.0.0
+| \`-- dog@1.0.0
+-- optional-dep@1.0.0
+-- peer-dep@1.0.0 invalid
\`-- prod-dep@1.0.0
- \`-- bar@2.0.0
+ \`-- dog@2.0.0
`
@@ -494,27 +494,27 @@ filter-by-child-of-missing-dep@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-cont
exports[`test/lib/ls.js TAP ls missing package.json > should output tree missing name/version of top-level package 1`] = `
{CWD}/tap-testdir-ls-ls-missing-package.json
-+-- bar@1.0.0 extraneous
-+-- foo@1.0.0 extraneous
-| \`-- bar@1.0.0 deduped
-\`-- lorem@1.0.0 extraneous
++-- chai@1.0.0 extraneous
++-- dog@1.0.0 extraneous
+\`-- foo@1.0.0 extraneous
+ \`-- dog@1.0.0 deduped
`
exports[`test/lib/ls.js TAP ls missing/invalid/extraneous > should output tree containing missing, invalid, extraneous labels 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous
++-- chai@1.0.0 extraneous
+-- foo@1.0.0 invalid
-| \`-- bar@1.0.0
-+-- UNMET DEPENDENCY ipsum@^1.0.0
-\`-- lorem@1.0.0 extraneous
+| \`-- dog@1.0.0
+\`-- UNMET DEPENDENCY ipsum@^1.0.0
`
exports[`test/lib/ls.js TAP ls no args > should output tree representation of dependencies structure 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-no-args
-+-- foo@1.0.0
-| \`-- bar@1.0.0
-\`-- lorem@1.0.0
++-- chai@1.0.0
+\`-- foo@1.0.0
+ \`-- dog@1.0.0
`
@@ -534,15 +534,15 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-resolved-points-to-git-ref
exports[`test/lib/ls.js TAP ls unmet optional dep > should output tree with empty entry for missing optional deps 1`] = `
[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-unmet-optional-dep[0m
+[0m+-- chai@1.0.0[0m
[0m+-- dev-dep@1.0.0[0m
[0m| \`-- foo@1.0.0[0m
-[0m| \`-- bar@1.0.0[0m
-[0m+-- lorem@1.0.0[0m
+[0m| \`-- dog@1.0.0[0m
[0m+-- [33m[40mUNMET OPTIONAL DEPENDENCY[49m[39m missing-optional-dep@^1.0.0[0m
[0m+-- optional-dep@1.0.0 [31m[40minvalid[49m[39m[0m
[0m+-- peer-dep@1.0.0[0m
[0m\`-- prod-dep@1.0.0[0m
-[0m \`-- bar@2.0.0[0m
+[0m \`-- dog@2.0.0[0m
[0m[0m
`
@@ -586,14 +586,14 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-dot-filter-arg
exports[`test/lib/ls.js TAP ls with filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = `
[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg[0m
-[0m\`-- [33m[40mlorem@1.0.0[49m[39m[0m
+[0m\`-- [33m[40mchai@1.0.0[49m[39m[0m
[0m[0m
`
exports[`test/lib/ls.js TAP ls with filter arg nested dep > should output tree contaning only occurrences of filtered package and its ancestors 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg-nested-dep
\`-- foo@1.0.0
- \`-- bar@1.0.0
+ \`-- dog@1.0.0
`
@@ -605,9 +605,9 @@ test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-missing-filter-arg
exports[`test/lib/ls.js TAP ls with multiple filter args > should output tree contaning only occurrences of multiple filtered packages and their ancestors 1`] = `
test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-multiple-filter-args
-+-- foo@1.0.0
-| \`-- bar@1.0.0
-\`-- lorem@1.0.0
++-- chai@1.0.0
+\`-- foo@1.0.0
+ \`-- dog@1.0.0
`
diff --git a/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs b/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs
index e57d7110b2275a..fdb25e90eb8c3b 100644
--- a/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/outdated.js.test.cjs
@@ -7,38 +7,38 @@
'use strict'
exports[`test/lib/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1`] = `
-Package Current Wanted Latest Location Depended by
-alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
-beta 1.0.0 1.0.1 1.0.1 node_modules/beta tap-testdir-outdated-should-display-outdated-deps
-gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma tap-testdir-outdated-should-display-outdated-deps
-theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps
+Package Current Wanted Latest Location Depended by
+cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps
+chai 1.0.0 1.0.1 1.0.1 node_modules/chai tap-testdir-outdated-should-display-outdated-deps
+dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-should-display-outdated-deps
+theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --json --long > must match snapshot 1`] = `
{
- "alpha": {
+ "cat": {
"current": "1.0.0",
"wanted": "1.0.1",
"latest": "1.0.1",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha",
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat",
"type": "dependencies"
},
- "beta": {
+ "chai": {
"current": "1.0.0",
"wanted": "1.0.1",
"latest": "1.0.1",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta",
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai",
"type": "peerDependencies"
},
- "gamma": {
+ "dog": {
"current": "1.0.1",
"wanted": "1.0.1",
"latest": "2.0.0",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma",
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog",
"type": "dependencies"
},
"theta": {
@@ -53,26 +53,26 @@ exports[`test/lib/outdated.js TAP should display outdated deps outdated --json -
exports[`test/lib/outdated.js TAP should display outdated deps outdated --json > must match snapshot 1`] = `
{
- "alpha": {
+ "cat": {
"current": "1.0.0",
"wanted": "1.0.1",
"latest": "1.0.1",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha"
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat"
},
- "beta": {
+ "chai": {
"current": "1.0.0",
"wanted": "1.0.1",
"latest": "1.0.1",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta"
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai"
},
- "gamma": {
+ "dog": {
"current": "1.0.1",
"wanted": "1.0.1",
"latest": "2.0.0",
"dependent": "tap-testdir-outdated-should-display-outdated-deps",
- "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma"
+ "location": "{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog"
},
"theta": {
"wanted": "1.0.1",
@@ -84,71 +84,71 @@ exports[`test/lib/outdated.js TAP should display outdated deps outdated --json >
exports[`test/lib/outdated.js TAP should display outdated deps outdated --long > must match snapshot 1`] = `
-Package Current Wanted Latest Location Depended by Package Type Homepage
-alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps dependencies
-beta 1.0.0 1.0.1 1.0.1 node_modules/beta tap-testdir-outdated-should-display-outdated-deps peerDependencies
-gamma 1.0.1 1.0.1 2.0.0 node_modules/gamma tap-testdir-outdated-should-display-outdated-deps dependencies
-theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps dependencies
+Package Current Wanted Latest Location Depended by Package Type Homepage
+cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps dependencies
+chai 1.0.0 1.0.1 1.0.1 node_modules/chai tap-testdir-outdated-should-display-outdated-deps peerDependencies
+dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-should-display-outdated-deps dependencies
+theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps dependencies
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev --omit=peer > must match snapshot 1`] = `
-[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
-[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
-[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps
-[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
+[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
+[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps
+[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps
+[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=dev > must match snapshot 1`] = `
-[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
-[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
-[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps
-[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps
-[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
+[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
+[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps
+[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps
+[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps
+[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --omit=prod > must match snapshot 1`] = `
-[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
-[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
-[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps
-[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps
+[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
+[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps
+[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps
+[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable --long > must match snapshot 1`] = `
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies:
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:tap-testdir-outdated-should-display-outdated-deps:peerDependencies:
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:tap-testdir-outdated-should-display-outdated-deps:dependencies:
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies:
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai:chai@1.0.1:chai@1.0.0:chai@1.0.1:tap-testdir-outdated-should-display-outdated-deps:peerDependencies:
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog:dog@1.0.1:dog@1.0.1:dog@2.0.0:tap-testdir-outdated-should-display-outdated-deps:dependencies:
:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies:
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated --parseable > must match snapshot 1`] = `
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/alpha:alpha@1.0.1:alpha@1.0.0:alpha@1.0.1:tap-testdir-outdated-should-display-outdated-deps
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/beta:beta@1.0.1:beta@1.0.0:beta@1.0.1:tap-testdir-outdated-should-display-outdated-deps
-{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/gamma:gamma@1.0.1:gamma@1.0.1:gamma@2.0.0:tap-testdir-outdated-should-display-outdated-deps
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:tap-testdir-outdated-should-display-outdated-deps
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai:chai@1.0.1:chai@1.0.0:chai@1.0.1:tap-testdir-outdated-should-display-outdated-deps
+{CWD}/test/lib/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog:dog@1.0.1:dog@1.0.1:dog@2.0.0:tap-testdir-outdated-should-display-outdated-deps
:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated > must match snapshot 1`] = `
-[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
-[31malpha[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
-[31mbeta[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/beta tap-testdir-outdated-should-display-outdated-deps
-[33mgamma[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/gamma tap-testdir-outdated-should-display-outdated-deps
-[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
+[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m
+[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps
+[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps
+[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps
+[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated global > must match snapshot 1`] = `
-Package Current Wanted Latest Location Depended by
-alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha global
+Package Current Wanted Latest Location Depended by
+cat 1.0.0 1.0.1 1.0.1 node_modules/cat global
`
exports[`test/lib/outdated.js TAP should display outdated deps outdated specific dep > must match snapshot 1`] = `
-Package Current Wanted Latest Location Depended by
-alpha 1.0.0 1.0.1 1.0.1 node_modules/alpha tap-testdir-outdated-should-display-outdated-deps
+Package Current Wanted Latest Location Depended by
+cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps
`
diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
index d6761ea30c74b5..53aef86f79d1bd 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/config/describe-all.js.test.cjs
@@ -1132,7 +1132,8 @@ 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
@@ -1142,6 +1143,8 @@ their actual counterparts:
* \`{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/tap-snapshots/test/lib/utils/tar.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs
index e117b38def9b23..af0b1454b2624c 100644
--- a/deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/utils/tar.js.test.cjs
@@ -11,6 +11,9 @@ exports[`test/lib/utils/tar.js TAP should log tarball contents > must match snap
package: my-cool-pkg@1.0.0
=== Tarball Contents ===
+4B cat
+4B chai
+4B dog
97B package.json
=== Bundled Dependencies ===
@@ -20,14 +23,14 @@ bundle-dep
name: my-cool-pkg
version: 1.0.0
filename: my-cool-pkg-1.0.0.tgz
-package size: 216 B
-unpacked size: 101 B
-shasum: a604258e06adecec0b18f48e901c5802f19f7dab
-integrity: sha512-fnN6NmI8DerTt[...]6rH17jx7OIFig==
+package size: 274 B
+unpacked size: 113 B
+shasum: cd0dfccff77dff944eb761854bc0b0497d974f67
+integrity: sha512-qeFip1jH05vkW[...]zHSdMdPpYogMA==
bundled deps: 1
bundled files: 0
-own files: 2
-total files: 2
+own files: 5
+total files: 5
`
diff --git a/deps/npm/tap-snapshots/test/lib/view.js.test.cjs b/deps/npm/tap-snapshots/test/lib/view.js.test.cjs
index 1cdf356356af98..9aafe50e41896f 100644
--- a/deps/npm/tap-snapshots/test/lib/view.js.test.cjs
+++ b/deps/npm/tap-snapshots/test/lib/view.js.test.cjs
@@ -80,7 +80,7 @@ dist
.unpackedSize:[33m1[39m B
dist-tags:
-
+[1m[32mlatest[39m[22m: 1.0.0
published [33ma year ago[39m
`
@@ -97,18 +97,50 @@ dist
.unpackedSize:[33m1[39m B
dist-tags:
-
+[1m[32mlatest[39m[22m: 1.0.0
published [33ma year ago[39m
`
+exports[`test/lib/view.js TAP should log package info package from git > must match snapshot 1`] = `
+
+
+[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m
+green is a very important color
+
+[1m[31mDEPRECATED[39m[22m!! - true
+
+keywords:[33mcolors[39m, [33mgreen[39m, [33mcrayola[39m
+
+bin:[33mgreen[39m
+
+dist
+.tarball:[36mhttp://hm.green.com/1.0.0.tgz[39m
+.shasum:[33m123[39m
+.integrity:[33m---[39m
+.unpackedSize:[33m1[39m B
+
+dependencies:
+[33mred[39m: 1.0.0
+[33myellow[39m: 1.0.0
+
+maintainers:
+-[33mclaudia[39m <[36mc@yellow.com[39m>
+-[33misaacs[39m <[36mi@yellow.com[39m>
+
+dist-tags:
+[1m[32mlatest[39m[22m: 1.0.0
+`
+
exports[`test/lib/view.js TAP should log package info package with --json and semver range > must match snapshot 1`] = `
[
{
"_npmUser": "claudia ",
"name": "cyan",
- "dist-tags": {},
+ "dist-tags": {
+ "latest": "1.0.0"
+ },
"versions": [
"1.0.0",
"1.0.1"
@@ -125,7 +157,9 @@ exports[`test/lib/view.js TAP should log package info package with --json and se
{
"_npmUser": "claudia ",
"name": "cyan",
- "dist-tags": {},
+ "dist-tags": {
+ "latest": "1.0.0"
+ },
"versions": [
"1.0.0",
"1.0.1"
@@ -249,7 +283,7 @@ dist
.unpackedSize:[33m1[39m B
dist-tags:
-
+[1m[32mlatest[39m[22m: 1.0.0
published by [33mclaudia[39m <[36mclaudia@cyan.com[39m>
`
@@ -266,7 +300,7 @@ dist
.unpackedSize:[33m1[39m B
dist-tags:
-
+[1m[32mlatest[39m[22m: 1.0.0
published [33ma year ago[39m
`
diff --git a/deps/npm/test/fixtures/mock-npm.js b/deps/npm/test/fixtures/mock-npm.js
index 01f482bde291b9..aa8d44020ee361 100644
--- a/deps/npm/test/fixtures/mock-npm.js
+++ b/deps/npm/test/fixtures/mock-npm.js
@@ -2,6 +2,8 @@
// npm.config You still need a separate flatOptions but this is the first step
// to eventually just using npm itself
+const realConfig = require('../../lib/utils/config')
+
const mockLog = {
clearProgress: () => {},
disableProgress: () => {},
@@ -25,10 +27,10 @@ const mockNpm = (base = {}) => {
config: {
// for now just set `find` to what config.find should return
// this works cause `find` is not an existing config entry
- find: (k) => config[k],
- get: (k) => config[k],
+ find: (k) => ({...realConfig.defaults, ...config})[k],
+ get: (k) => ({...realConfig.defaults, ...config})[k],
set: (k, v) => config[k] = v,
- list: [config]
+ list: [{ ...realConfig.defaults, ...config}]
},
}
}
diff --git a/deps/npm/test/lib/cache.js b/deps/npm/test/lib/cache.js
index bbebae8894babe..bad0ede89e1013 100644
--- a/deps/npm/test/lib/cache.js
+++ b/deps/npm/test/lib/cache.js
@@ -134,20 +134,21 @@ t.test('cache add pkg only', t => {
})
})
-t.test('cache add pkg w/ spec modifier', t => {
+t.test('cache add multiple pkgs', t => {
t.teardown(() => {
logOutput = []
tarballStreamSpec = ''
tarballStreamOpts = {}
})
- cache.exec(['add', 'mypkg', 'latest'], err => {
+ cache.exec(['add', 'mypkg', 'anotherpkg'], err => {
t.error(err)
t.strictSame(logOutput, [
- ['silly', 'cache add', 'args', ['mypkg', 'latest']],
- ['silly', 'cache add', 'spec', 'mypkg@latest'],
+ ['silly', 'cache add', 'args', ['mypkg', 'anotherpkg']],
+ ['silly', 'cache add', 'spec', 'mypkg'],
+ ['silly', 'cache add', 'spec', 'anotherpkg'],
], 'logs correctly')
- t.equal(tarballStreamSpec, 'mypkg@latest', 'passes the correct spec to pacote')
+ t.equal(tarballStreamSpec, 'anotherpkg', 'passes the correct spec to pacote')
t.same(tarballStreamOpts, npm.flatOptions, 'passes the correct options to pacote')
t.end()
})
diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js
index 155ad0bcfb1b45..6c04293137af9e 100644
--- a/deps/npm/test/lib/config.js
+++ b/deps/npm/test/lib/config.js
@@ -49,6 +49,9 @@ const cliConfig = {
json: false,
long: false,
global: false,
+ cat: true,
+ chai: true,
+ dog: true,
}
const npm = {
@@ -197,6 +200,9 @@ t.test('config list --json', t => {
json: true,
long: false,
global: false,
+ cat: true,
+ chai: true,
+ dog: true,
},
'should list configs usin json'
)
diff --git a/deps/npm/test/lib/dist-tag.js b/deps/npm/test/lib/dist-tag.js
index 701bdc6e48c35b..6bc17168cdce0f 100644
--- a/deps/npm/test/lib/dist-tag.js
+++ b/deps/npm/test/lib/dist-tag.js
@@ -68,10 +68,9 @@ const DistTag = t.mock('../../lib/dist-tag.js', {
},
})
+const config = {}
const npm = mockNpm({
- config: {
- global: false,
- },
+ config,
output: msg => {
result = result ? [result, msg].join('\n') : msg
},
@@ -349,6 +348,10 @@ t.test('add using valid semver range as name', (t) => {
t.test('add missing args', (t) => {
npm.prefix = t.testdir({})
+ config.tag = ''
+ t.teardown(() => {
+ delete config.tag
+ })
distTag.exec(['add', '@scoped/another@7.7.7'], (err) => {
t.matchSnapshot(err, 'should exit usage error message')
t.end()
diff --git a/deps/npm/test/lib/exec.js b/deps/npm/test/lib/exec.js
index 5ecc73274876a6..33e30e24f84e0a 100644
--- a/deps/npm/test/lib/exec.js
+++ b/deps/npm/test/lib/exec.js
@@ -121,11 +121,15 @@ t.afterEach(() => {
t.test('npx foo, bin already exists locally', t => {
const path = t.testdir({
- foo: 'just some file',
+ node_modules: {
+ '.bin': {
+ foo: 'just some file',
+ },
+ },
})
PROGRESS_IGNORED = true
- npm.localBin = path
+ npm.localBin = resolve(path, 'node_modules', '.bin')
exec.exec(['foo', 'one arg', 'two arg'], er => {
t.error(er, 'npm exec')
@@ -137,7 +141,7 @@ t.test('npx foo, bin already exists locally', t => {
stdioString: true,
event: 'npx',
env: {
- PATH: [path, ...PATH].join(delimiter),
+ PATH: [npm.localBin, ...PATH].join(delimiter),
},
stdio: 'inherit',
}])
@@ -147,11 +151,15 @@ t.test('npx foo, bin already exists locally', t => {
t.test('npx foo, bin already exists globally', t => {
const path = t.testdir({
- foo: 'just some file',
+ node_modules: {
+ '.bin': {
+ foo: 'just some file',
+ },
+ },
})
PROGRESS_IGNORED = true
- npm.globalBin = path
+ npm.globalBin = resolve(path, 'node_modules', '.bin')
exec.exec(['foo', 'one arg', 'two arg'], er => {
t.error(er, 'npm exec')
@@ -163,7 +171,7 @@ t.test('npx foo, bin already exists globally', t => {
stdioString: true,
event: 'npx',
env: {
- PATH: [path, ...PATH].join(delimiter),
+ PATH: [npm.globalBin, ...PATH].join(delimiter),
},
stdio: 'inherit',
}])
@@ -593,7 +601,7 @@ t.test('run command with 2 packages, need install, verify sort', t => {
for (const packages of cases) {
t.test(packages.join(', '), t => {
config.package = packages
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b))
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
const path = t.testdir()
const installDir = resolve('cache-dir/_npx/07de77790e5f40f2')
npm.localPrefix = path
@@ -748,7 +756,7 @@ t.test('prompt when installs are needed if not already present and shell is a TT
config.package = packages
config.yes = undefined
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b))
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
const path = t.testdir()
const installDir = resolve('cache-dir/_npx/07de77790e5f40f2')
npm.localPrefix = path
@@ -817,7 +825,7 @@ t.test('skip prompt when installs are needed if not already present and shell is
config.package = packages
config.yes = undefined
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b))
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
const path = t.testdir()
const installDir = resolve('cache-dir/_npx/07de77790e5f40f2')
npm.localPrefix = path
@@ -884,7 +892,7 @@ t.test('skip prompt when installs are needed if not already present and shell is
config.package = packages
config.yes = undefined
- const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b))
+ const add = packages.map(p => `${p}@`).sort((a, b) => a.localeCompare(b, 'en'))
const path = t.testdir()
const installDir = resolve('cache-dir/_npx/f7fbba6e0636f890')
npm.localPrefix = path
diff --git a/deps/npm/test/lib/link.js b/deps/npm/test/lib/link.js
index 34c533fb72cd58..d3e66185280ae0 100644
--- a/deps/npm/test/lib/link.js
+++ b/deps/npm/test/lib/link.js
@@ -27,7 +27,7 @@ const printLinks = async (opts) => {
const arb = new Arborist(opts)
const tree = await arb.loadActual()
const linkedItems = [...tree.inventory.values()]
- .sort((a, b) => a.pkgid.localeCompare(b.pkgid))
+ .sort((a, b) => a.pkgid.localeCompare(b.pkgid, 'en'))
for (const item of linkedItems) {
if (item.target)
res += `${item.path} -> ${item.target.path}\n`
diff --git a/deps/npm/test/lib/load-all-commands.js b/deps/npm/test/lib/load-all-commands.js
index 8267cd5437ec86..935019756e282a 100644
--- a/deps/npm/test/lib/load-all-commands.js
+++ b/deps/npm/test/lib/load-all-commands.js
@@ -15,7 +15,7 @@ t.test('load each command', t => {
npm.load((er) => {
t.notOk(er)
npm.config.set('usage', true)
- for (const cmd of cmdList.sort((a, b) => a.localeCompare(b))) {
+ for (const cmd of cmdList.sort((a, b) => a.localeCompare(b, 'en'))) {
t.test(cmd, t => {
const impl = npm.commands[cmd]
if (impl.completion)
diff --git a/deps/npm/test/lib/ls.js b/deps/npm/test/lib/ls.js
index 6eeaf0ad671bc6..276a06180f6549 100644
--- a/deps/npm/test/lib/ls.js
+++ b/deps/npm/test/lib/ls.js
@@ -21,19 +21,19 @@ const simpleNmFixture = {
name: 'foo',
version: '1.0.0',
dependencies: {
- bar: '^1.0.0',
+ dog: '^1.0.0',
},
}),
},
- bar: {
+ dog: {
'package.json': JSON.stringify({
- name: 'bar',
+ name: 'dog',
version: '1.0.0',
}),
},
- lorem: {
+ chai: {
'package.json': JSON.stringify({
- name: 'lorem',
+ name: 'chai',
version: '1.0.0',
}),
},
@@ -58,13 +58,13 @@ const diffDepTypesNmFixture = {
description: 'A PROD dep kind of dep',
version: '1.0.0',
dependencies: {
- bar: '^2.0.0',
+ dog: '^2.0.0',
},
}),
node_modules: {
- bar: {
+ dog: {
'package.json': JSON.stringify({
- name: 'bar',
+ name: 'dog',
description: 'A dep that bars',
version: '2.0.0',
}),
@@ -132,7 +132,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -181,12 +181,12 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['lorem'], (err) => {
+ ls.exec(['chai'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered by package and colored output')
npm.color = false
@@ -224,12 +224,12 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['bar'], (err) => {
+ ls.exec(['dog'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of filtered package and its ancestors')
t.end()
@@ -243,7 +243,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
ipsum: '^1.0.0',
},
}),
@@ -257,7 +257,7 @@ t.test('ls', (t) => {
},
},
})
- ls.exec(['bar@*', 'lorem@1.0.0'], (err) => {
+ ls.exec(['dog@*', 'chai@1.0.0'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output tree contaning only occurrences of multiple filtered packages and their ancestors')
t.end()
@@ -271,7 +271,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -298,7 +298,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -321,7 +321,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -412,9 +412,9 @@ t.test('ls', (t) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
t.equal(
redactCwd(err.message).replace(/\r\n/g, '\n'),
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/chai\n' +
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/foo\n' +
- 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0\n' +
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous/node_modules/lorem',
+ 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
'should log missing/invalid/extraneous errors'
)
t.matchSnapshot(redactCwd(result), 'should output tree containing missing, invalid, extraneous labels')
@@ -451,7 +451,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -480,7 +480,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -509,7 +509,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
'linked-dep': '^1.0.0',
},
devDependencies: {
@@ -584,7 +584,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -613,7 +613,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -642,7 +642,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -673,7 +673,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -723,7 +723,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -835,7 +835,7 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1243,7 +1243,7 @@ t.test('ls', (t) => {
dependencies: {
a: {
version: '1.0.1',
- resolved: 'foo@bar://b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
+ resolved: 'foo@dog://b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
},
},
@@ -1544,7 +1544,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -1592,12 +1592,12 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['lorem'], (err) => {
+ ls.exec(['chai'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered by package')
t.end()
@@ -1611,12 +1611,12 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['bar'], (err) => {
+ ls.exec(['dog'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of filtered package')
t.end()
@@ -1630,7 +1630,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
ipsum: '^1.0.0',
},
}),
@@ -1644,7 +1644,7 @@ t.test('ls --parseable', (t) => {
},
},
})
- ls.exec(['bar@*', 'lorem@1.0.0'], (err) => {
+ ls.exec(['dog@*', 'chai@1.0.0'], (err) => {
t.error(err, 'npm ls')
t.matchSnapshot(redactCwd(result), 'should output parseable contaning only occurrences of multiple filtered packages and their ancestors')
t.end()
@@ -1658,7 +1658,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -1685,7 +1685,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -1708,7 +1708,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -1731,7 +1731,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -1772,7 +1772,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1801,7 +1801,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1830,7 +1830,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
'linked-dep': '^1.0.0',
},
devDependencies: {
@@ -1869,7 +1869,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1898,7 +1898,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1927,7 +1927,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -1995,7 +1995,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
'linked-dep': '^1.0.0',
},
devDependencies: {
@@ -2037,7 +2037,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -2087,7 +2087,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -2114,7 +2114,7 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -2463,7 +2463,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -2479,12 +2479,12 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2505,16 +2505,16 @@ t.test('ls --json', (t) => {
jsonParse(result),
{
problems: [
- 'extraneous: bar@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/bar',
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/chai',
+ 'extraneous: dog@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/dog',
'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo',
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/lorem',
],
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
extraneous: true,
problems: [
- 'extraneous: bar@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/bar',
+ 'extraneous: dog@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/dog',
],
},
foo: {
@@ -2524,16 +2524,16 @@ t.test('ls --json', (t) => {
'extraneous: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/foo',
],
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
extraneous: true,
problems: [
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/lorem',
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-package.json/node_modules/chai',
],
},
},
@@ -2563,22 +2563,22 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
problems: [
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/lorem',
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/chai',
],
dependencies: {
foo: {
version: '1.0.0',
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
extraneous: true,
problems: [
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/lorem',
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/chai',
],
},
},
@@ -2597,8 +2597,8 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- bar: '^1.0.0',
- lorem: '^1.0.0',
+ dog: '^1.0.0',
+ chai: '^1.0.0',
ipsum: '^1.0.0',
},
}),
@@ -2638,12 +2638,12 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['lorem'], (err) => {
+ ls.exec(['chai'], (err) => {
t.error(err, 'npm ls')
t.same(
jsonParse(result),
@@ -2651,7 +2651,7 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2674,12 +2674,12 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
})
- ls.exec(['bar'], (err) => {
+ ls.exec(['dog'], (err) => {
t.error(err, 'npm ls')
t.same(
jsonParse(result),
@@ -2690,7 +2690,7 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
@@ -2710,7 +2710,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
ipsum: '^1.0.0',
},
}),
@@ -2724,7 +2724,7 @@ t.test('ls --json', (t) => {
},
},
})
- ls.exec(['bar@*', 'lorem@1.0.0'], (err) => {
+ ls.exec(['dog@*', 'chai@1.0.0'], (err) => {
t.error(err, 'npm ls')
t.same(
jsonParse(result),
@@ -2735,12 +2735,12 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2758,7 +2758,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -2792,7 +2792,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -2808,7 +2808,7 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
},
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2830,7 +2830,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -2846,7 +2846,7 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
},
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2868,7 +2868,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
}),
...simpleNmFixture,
@@ -2884,12 +2884,12 @@ t.test('ls --json', (t) => {
foo: {
version: '1.0.0',
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
},
},
@@ -2922,9 +2922,9 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
problems: [
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/chai',
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo',
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/lorem',
],
dependencies: {
foo: {
@@ -2934,16 +2934,16 @@ t.test('ls --json', (t) => {
'invalid: foo@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/foo',
],
dependencies: {
- bar: {
+ dog: {
version: '1.0.0',
},
},
},
- lorem: {
+ chai: {
version: '1.0.0',
extraneous: true,
problems: [
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/lorem',
+ 'extraneous: chai@1.0.0 {CWD}/tap-testdir-ls-ls---json-missing-invalid-extraneous/node_modules/chai',
],
},
ipsum: {
@@ -2969,7 +2969,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -2995,7 +2995,7 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } },
+ dependencies: { dog: { version: '1.0.0' } },
},
},
},
@@ -3016,7 +3016,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3042,7 +3042,7 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } },
+ dependencies: { dog: { version: '1.0.0' } },
},
},
},
@@ -3063,7 +3063,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
'linked-dep': '^1.0.0',
},
devDependencies: {
@@ -3115,7 +3115,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3136,9 +3136,9 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- lorem: { version: '1.0.0' },
+ chai: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ 'prod-dep': { version: '1.0.0', dependencies: { dog: { version: '2.0.0' } } },
},
},
'should output json containing production deps'
@@ -3156,7 +3156,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3177,9 +3177,9 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- lorem: { version: '1.0.0' },
+ chai: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ 'prod-dep': { version: '1.0.0', dependencies: { dog: { version: '2.0.0' } } },
},
},
'should output json containing only prod deps'
@@ -3326,7 +3326,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3367,21 +3367,21 @@ t.test('ls --json', (t) => {
name: 'foo',
version: '1.0.0',
dependencies: {
- bar: {
- name: 'bar',
+ dog: {
+ name: 'dog',
version: '1.0.0',
- _id: 'bar@1.0.0',
+ _id: 'dog@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: {},
- path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/bar',
+ path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/dog',
extraneous: false,
},
},
_id: 'foo@1.0.0',
devDependencies: {},
peerDependencies: {},
- _dependencies: { bar: '^1.0.0' },
+ _dependencies: { dog: '^1.0.0' },
path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/foo',
extraneous: false,
},
@@ -3393,14 +3393,14 @@ t.test('ls --json', (t) => {
path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/dev-dep',
extraneous: false,
},
- lorem: {
- name: 'lorem',
+ chai: {
+ name: 'chai',
version: '1.0.0',
- _id: 'lorem@1.0.0',
+ _id: 'chai@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: {},
- path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/lorem',
+ path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/chai',
extraneous: false,
},
'optional-dep': {
@@ -3419,22 +3419,22 @@ t.test('ls --json', (t) => {
description: 'A PROD dep kind of dep',
version: '1.0.0',
dependencies: {
- bar: {
- name: 'bar',
+ dog: {
+ name: 'dog',
description: 'A dep that bars',
version: '2.0.0',
- _id: 'bar@2.0.0',
+ _id: 'dog@2.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: {},
- path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep/node_modules/bar',
+ path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep/node_modules/dog',
extraneous: false,
},
},
_id: 'prod-dep@1.0.0',
devDependencies: {},
peerDependencies: {},
- _dependencies: { bar: '^2.0.0' },
+ _dependencies: { dog: '^2.0.0' },
path: '{CWD}/tap-testdir-ls-ls---json---long/node_modules/prod-dep',
extraneous: false,
},
@@ -3443,7 +3443,7 @@ t.test('ls --json', (t) => {
optionalDependencies: { 'optional-dep': '^1.0.0' },
peerDependencies: { 'peer-dep': '^1.0.0' },
_id: 'test-npm-ls@1.0.0',
- _dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' },
+ _dependencies: { 'prod-dep': '^1.0.0', chai: '^1.0.0', 'optional-dep': '^1.0.0' },
path: '{CWD}/tap-testdir-ls-ls---json---long',
extraneous: false,
},
@@ -3464,7 +3464,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3507,14 +3507,14 @@ t.test('ls --json', (t) => {
path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/dev-dep',
extraneous: false,
},
- lorem: {
- name: 'lorem',
+ chai: {
+ name: 'chai',
version: '1.0.0',
- _id: 'lorem@1.0.0',
+ _id: 'chai@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: {},
- path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/lorem',
+ path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/chai',
extraneous: false,
},
'optional-dep': {
@@ -3535,7 +3535,7 @@ t.test('ls --json', (t) => {
_id: 'prod-dep@1.0.0',
devDependencies: {},
peerDependencies: {},
- _dependencies: { bar: '^2.0.0' },
+ _dependencies: { dog: '^2.0.0' },
path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0/node_modules/prod-dep',
extraneous: false,
},
@@ -3544,7 +3544,7 @@ t.test('ls --json', (t) => {
optionalDependencies: { 'optional-dep': '^1.0.0' },
peerDependencies: { 'peer-dep': '^1.0.0' },
_id: 'test-npm-ls@1.0.0',
- _dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' },
+ _dependencies: { 'prod-dep': '^1.0.0', chai: '^1.0.0', 'optional-dep': '^1.0.0' },
path: '{CWD}/tap-testdir-ls-ls---json---long---depth-0',
extraneous: false,
},
@@ -3598,7 +3598,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3635,13 +3635,13 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } },
+ dependencies: { dog: { version: '1.0.0' } },
},
},
},
- lorem: { version: '1.0.0' },
+ chai: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ 'prod-dep': { version: '1.0.0', dependencies: { dog: { version: '2.0.0' } } },
},
},
'should output json signaling missing peer dep in problems'
@@ -3657,7 +3657,7 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- lorem: '^1.0.0',
+ chai: '^1.0.0',
},
devDependencies: {
'dev-dep': '^1.0.0',
@@ -3699,12 +3699,12 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } },
+ dependencies: { dog: { version: '1.0.0' } },
},
},
},
- lorem: { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ chai: { version: '1.0.0' },
+ 'prod-dep': { version: '1.0.0', dependencies: { dog: { version: '2.0.0' } } },
'missing-optional-dep': {}, // missing optional dep has an empty entry in json output
},
},
diff --git a/deps/npm/test/lib/outdated.js b/deps/npm/test/lib/outdated.js
index 605853056a000f..f7d572821275f4 100644
--- a/deps/npm/test/lib/outdated.js
+++ b/deps/npm/test/lib/outdated.js
@@ -3,8 +3,8 @@ const mockNpm = require('../fixtures/mock-npm')
const packument = spec => {
const mocks = {
- alpha: {
- name: 'alpha',
+ cat: {
+ name: 'cat',
'dist-tags': {
latest: '1.0.1',
},
@@ -12,13 +12,13 @@ const packument = spec => {
'1.0.1': {
version: '1.0.1',
dependencies: {
- gamma: '2.0.0',
+ dog: '2.0.0',
},
},
},
},
- beta: {
- name: 'beta',
+ chai: {
+ name: 'chai',
'dist-tags': {
latest: '1.0.1',
},
@@ -28,8 +28,8 @@ const packument = spec => {
},
},
},
- gamma: {
- name: 'gamma',
+ dog: {
+ name: 'dog',
'dist-tags': {
latest: '2.0.0',
},
@@ -74,9 +74,9 @@ const output = (msg) => {
const globalDir = t.testdir({
node_modules: {
- alpha: {
+ cat: {
'package.json': JSON.stringify({
- name: 'alpha',
+ name: 'cat',
version: '1.0.0',
}, null, 2),
},
@@ -116,8 +116,8 @@ t.test('should display outdated deps', t => {
name: 'delta',
version: '1.0.0',
dependencies: {
- alpha: '^1.0.0',
- gamma: '^1.0.0',
+ cat: '^1.0.0',
+ dog: '^1.0.0',
theta: '^1.0.0',
},
devDependencies: {
@@ -127,36 +127,36 @@ t.test('should display outdated deps', t => {
lorem: '^1.0.0',
},
peerDependencies: {
- beta: '^1.0.0',
+ chai: '^1.0.0',
},
}, null, 2),
node_modules: {
- alpha: {
+ cat: {
'package.json': JSON.stringify({
- name: 'alpha',
+ name: 'cat',
version: '1.0.0',
dependencies: {
- gamma: '2.0.0',
+ dog: '2.0.0',
},
}, null, 2),
node_modules: {
- gamma: {
+ dog: {
'package.json': JSON.stringify({
- name: 'gamma',
+ name: 'dog',
version: '2.0.0',
}, null, 2),
},
},
},
- beta: {
+ chai: {
'package.json': JSON.stringify({
- name: 'beta',
+ name: 'chai',
version: '1.0.0',
}, null, 2),
},
- gamma: {
+ dog: {
'package.json': JSON.stringify({
- name: 'gamma',
+ name: 'dog',
version: '1.0.1',
}, null, 2),
},
@@ -307,7 +307,7 @@ t.test('should display outdated deps', t => {
config: {
global: false,
},
- }).exec(['alpha'], () => {
+ }).exec(['cat'], () => {
t.matchSnapshot(logs)
t.end()
})
@@ -322,13 +322,13 @@ t.test('should return if no outdated deps', t => {
name: 'delta',
version: '1.0.0',
dependencies: {
- alpha: '^1.0.0',
+ cat: '^1.0.0',
},
}, null, 2),
node_modules: {
- alpha: {
+ cat: {
'package.json': JSON.stringify({
- name: 'alpha',
+ name: 'cat',
version: '1.0.1',
}, null, 2),
},
@@ -376,7 +376,7 @@ t.test('should skip missing non-prod deps', t => {
name: 'delta',
version: '1.0.0',
devDependencies: {
- beta: '^1.0.0',
+ chai: '^1.0.0',
},
}, null, 2),
node_modules: {},
@@ -396,13 +396,13 @@ t.test('should skip invalid pkg ranges', t => {
name: 'delta',
version: '1.0.0',
dependencies: {
- alpha: '>=^2',
+ cat: '>=^2',
},
}, null, 2),
node_modules: {
- alpha: {
+ cat: {
'package.json': JSON.stringify({
- name: 'alpha',
+ name: 'cat',
version: '1.0.0',
}, null, 2),
},
@@ -421,13 +421,13 @@ t.test('should skip git specs', t => {
name: 'delta',
version: '1.0.0',
dependencies: {
- alpha: 'github:username/foo',
+ cat: 'github:username/foo',
},
}, null, 2),
node_modules: {
- alpha: {
+ cat: {
'package.json': JSON.stringify({
- name: 'alpha',
+ name: 'cat',
version: '1.0.0',
}, null, 2),
},
diff --git a/deps/npm/test/lib/utils/cleanup-log-files.js b/deps/npm/test/lib/utils/cleanup-log-files.js
index 61240b7b523dea..e97cf36b55dec0 100644
--- a/deps/npm/test/lib/utils/cleanup-log-files.js
+++ b/deps/npm/test/lib/utils/cleanup-log-files.js
@@ -71,7 +71,7 @@ t.test('rimraf fail', t => {
const warnings = []
const warn = (...warning) => warnings.push(basename(warning[2]))
return cleanup(cache, 3, warn).then(() => {
- t.strictSame(warnings.sort((a, b) => a.localeCompare(b)), [
+ t.strictSame(warnings.sort((a, b) => a.localeCompare(b, 'en')), [
'1-debug.log',
'2-debug.log',
])
diff --git a/deps/npm/test/lib/utils/completion/installed-deep.js b/deps/npm/test/lib/utils/completion/installed-deep.js
index ba14798bbec18f..21e77a568bd8a7 100644
--- a/deps/npm/test/lib/utils/completion/installed-deep.js
+++ b/deps/npm/test/lib/utils/completion/installed-deep.js
@@ -63,6 +63,15 @@ const fixture = {
'package.json': JSON.stringify({
name: 'c',
version: '1.0.0',
+ dependencies: {
+ ch: '1.0.0',
+ },
+ }),
+ },
+ ch: {
+ 'package.json': JSON.stringify({
+ name: 'ch',
+ version: '1.0.0',
}),
},
d: {
@@ -160,8 +169,8 @@ t.test('get list of package names', async t => {
['foo', '-g'],
['a-bar', '-g'],
'a', 'b', 'c',
- 'd', 'e', 'f',
- 'g', 'bb',
+ 'ch', 'd', 'e',
+ 'f', 'g', 'bb',
],
'should return list of package names and global flag'
)
@@ -211,9 +220,9 @@ t.test('limit depth', async t => {
['bar', '-g'],
['foo', '-g'],
'a', 'b',
- 'c', 'd',
- 'e', 'f',
- 'g',
+ 'c', 'ch',
+ 'd', 'e',
+ 'f', 'g',
],
'should print only packages up to the specified depth'
)
diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js
index f735223655f505..49e4152883795d 100644
--- a/deps/npm/test/lib/utils/config/definitions.js
+++ b/deps/npm/test/lib/utils/config/definitions.js
@@ -729,7 +729,7 @@ t.test('user-agent', t => {
}
const flat = {}
const expectNoCI = `npm/1.2.3 node/9.8.7 ` +
- `${process.platform} ${process.arch}`
+ `${process.platform} ${process.arch} workspaces/false`
definitions['user-agent'].flatten('user-agent', obj, flat)
t.equal(flat.userAgent, expectNoCI)
t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
@@ -742,6 +742,23 @@ t.test('user-agent', t => {
t.equal(flat.userAgent, expectCI)
t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
+
+ delete obj['ci-name']
+ obj.workspaces = true
+ obj['user-agent'] = definitions['user-agent'].default
+ const expectWorkspaces = expectNoCI.replace('workspaces/false', 'workspaces/true')
+ definitions['user-agent'].flatten('user-agent', obj, flat)
+ t.equal(flat.userAgent, expectWorkspaces)
+ t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
+ t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
+
+ delete obj.workspaces
+ obj.workspace = ['foo']
+ obj['user-agent'] = definitions['user-agent'].default
+ definitions['user-agent'].flatten('user-agent', obj, flat)
+ t.equal(flat.userAgent, expectWorkspaces)
+ t.equal(process.env.npm_config_user_agent, flat.userAgent, 'npm_user_config environment is set')
+ t.equal(obj['user-agent'], flat.userAgent, 'config user-agent template is translated')
t.end()
})
diff --git a/deps/npm/test/lib/utils/tar.js b/deps/npm/test/lib/utils/tar.js
index 5758442fcb6f69..2662d47ace4863 100644
--- a/deps/npm/test/lib/utils/tar.js
+++ b/deps/npm/test/lib/utils/tar.js
@@ -26,6 +26,9 @@ t.test('should log tarball contents', async (t) => {
'bundle-dep',
],
}, null, 2),
+ cat: 'meow',
+ chai: 'blub',
+ dog: 'woof',
node_modules: {
'bundle-dep': 'toto',
},
diff --git a/deps/npm/test/lib/utils/update-notifier.js b/deps/npm/test/lib/utils/update-notifier.js
index 1735b31057b146..ad4d407728f93f 100644
--- a/deps/npm/test/lib/utils/update-notifier.js
+++ b/deps/npm/test/lib/utils/update-notifier.js
@@ -145,15 +145,15 @@ t.test('situations in which we do not notify', t => {
})
t.test('only check weekly for GA releases', async t => {
- // the 10 is fuzz factor for test environment
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + 10
+ // One week (plus five minutes to account for test environment fuzziness)
+ STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24 * 7) + (1000 * 60 * 5)
t.equal(await updateNotifier(npm), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
t.test('only check daily for betas', async t => {
- // the 10 is fuzz factor for test environment
- STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + 10
+ // One day (plus five minutes to account for test environment fuzziness)
+ STAT_MTIME = Date.now() - (1000 * 60 * 60 * 24) + (1000 * 60 * 5)
t.equal(await updateNotifier({ ...npm, version: HAVE_BETA }), null)
t.strictSame(MANIFEST_REQUEST, [], 'no requests for manifests')
})
diff --git a/deps/npm/test/lib/view.js b/deps/npm/test/lib/view.js
index eb2beb9ff5864b..4544d7d5d1a94a 100644
--- a/deps/npm/test/lib/view.js
+++ b/deps/npm/test/lib/view.js
@@ -34,7 +34,9 @@ const packument = (nv, opts) => {
},
blue: {
name: 'blue',
- 'dist-tags': {},
+ 'dist-tags': {
+ latest: '1.0.0',
+ },
time: {
'1.0.0': '2019-08-06T16:21:09.842Z',
},
@@ -59,7 +61,9 @@ const packument = (nv, opts) => {
email: 'claudia@cyan.com',
},
name: 'cyan',
- 'dist-tags': {},
+ 'dist-tags': {
+ latest: '1.0.0',
+ },
versions: {
'1.0.0': {
version: '1.0.0',
@@ -236,6 +240,8 @@ const packument = (nv, opts) => {
},
},
}
+ if (nv.type === 'git')
+ return mocks[nv.hosted.project]
return mocks[nv.name]
}
@@ -248,7 +254,7 @@ t.test('should log package info', t => {
},
})
const npm = mockNpm({
- config: { global: false },
+ config: { unicode: false },
})
const view = new View(npm)
@@ -258,7 +264,10 @@ t.test('should log package info', t => {
},
})
const jsonNpm = mockNpm({
- config: { json: true },
+ config: {
+ json: true,
+ tag: 'latest',
+ },
})
const viewJson = new ViewJson(jsonNpm)
@@ -268,13 +277,17 @@ t.test('should log package info', t => {
},
})
const unicodeNpm = mockNpm({
- config: {
- global: false,
- unicode: true,
- },
+ config: { unicode: true },
})
const viewUnicode = new ViewUnicode(unicodeNpm)
+ t.test('package from git', t => {
+ view.exec(['https://github.com/npm/green'], () => {
+ t.matchSnapshot(logs)
+ t.end()
+ })
+ })
+
t.test('package with license, bugs, repository and other fields', t => {
view.exec(['green@1.0.0'], () => {
t.matchSnapshot(logs)
@@ -358,7 +371,6 @@ t.test('should log info of package in current working dir', t => {
prefix: testDir,
config: {
tag: '1.0.0',
- global: false,
},
})
const view = new View(npm)
@@ -388,8 +400,8 @@ t.test('should log info by field name', t => {
})
const jsonNpm = mockNpm({
config: {
+ tag: 'latest',
json: true,
- global: false,
},
})
@@ -400,9 +412,7 @@ t.test('should log info by field name', t => {
packument,
},
})
- const npm = mockNpm({
- config: { global: false },
- })
+ const npm = mockNpm()
const view = new View(npm)
t.test('readme', t => {
@@ -474,7 +484,10 @@ t.test('should log info by field name', t => {
t.test('throw error if global mode', (t) => {
const View = t.mock('../../lib/view.js')
const npm = mockNpm({
- config: { global: true },
+ config: {
+ global: true,
+ tag: 'latest',
+ },
})
const view = new View(npm)
view.exec([], (err) => {
@@ -489,7 +502,6 @@ t.test('throw ENOENT error if package.json misisng', (t) => {
const View = t.mock('../../lib/view.js')
const npm = mockNpm({
prefix: testDir,
- config: { global: false },
})
const view = new View(npm)
view.exec([], (err) => {
@@ -506,7 +518,6 @@ t.test('throw EJSONPARSE error if package.json not json', (t) => {
const View = t.mock('../../lib/view.js')
const npm = mockNpm({
prefix: testDir,
- config: { global: false },
})
const view = new View(npm)
view.exec([], (err) => {
@@ -523,7 +534,6 @@ t.test('throw error if package.json has no name', (t) => {
const View = t.mock('../../lib/view.js')
const npm = mockNpm({
prefix: testDir,
- config: { global: false },
})
const view = new View(npm)
view.exec([], (err) => {
@@ -541,7 +551,6 @@ t.test('throws when unpublished', (t) => {
const npm = mockNpm({
config: {
tag: '1.0.1',
- global: false,
},
})
const view = new View(npm)
@@ -581,6 +590,7 @@ t.test('workspaces', t => {
},
})
const config = {
+ unicode: false,
tag: 'latest',
}
let warnMsg
@@ -684,7 +694,6 @@ t.test('completion', async t => {
const npm = mockNpm({
config: {
tag: '1.0.1',
- global: false,
},
})
const view = new View(npm)
@@ -700,7 +709,6 @@ t.test('no registry completion', async t => {
const npm = mockNpm({
config: {
tag: '1.0.1',
- global: false,
},
})
const view = new View(npm)
From c182198c44e71bd0e62af84c79f9a116807cea72 Mon Sep 17 00:00:00 2001
From: James M Snell
Date: Wed, 12 May 2021 15:10:32 -0700
Subject: [PATCH 56/86] process: add `'worker'` event
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Provides a new `process.on('worker', (worker) => {})` event that
is triggered by the creation of a new `worker_thread.Worker`.
The use case is to allow hooks to be installed for monitoring
workers without having to modify the call sites around those.
Signed-off-by: James M Snell
PR-URL: https://github.com/nodejs/node/pull/38659
Reviewed-By: Anna Henningsen
Reviewed-By: Rich Trott
Reviewed-By: Gerhard Stöbich
---
doc/api/process.md | 9 +++++++++
lib/internal/worker.js | 2 ++
test/parallel/test-worker-event.js | 13 +++++++++++++
3 files changed, 24 insertions(+)
create mode 100644 test/parallel/test-worker-event.js
diff --git a/doc/api/process.md b/doc/api/process.md
index 95dd6a87855954..0e852dcb100acc 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -457,6 +457,15 @@ of the custom deprecation.
The `*-deprecation` command-line flags only affect warnings that use the name
`'DeprecationWarning'`.
+### Event: `'worker'`
+
+
+* `worker` {Worker} The {Worker} that was created.
+
+The `'worker'` event is emitted after a new {Worker} thread has been created.
+
#### Emitting custom warnings
See the [`process.emitWarning()`][process_emit_warning] method for issuing
diff --git a/lib/internal/worker.js b/lib/internal/worker.js
index f1da0d4ded4cea..f2414ebeec4aae 100644
--- a/lib/internal/worker.js
+++ b/lib/internal/worker.js
@@ -266,6 +266,8 @@ class Worker extends EventEmitter {
};
// Actually start the new thread now that everything is in place.
this[kHandle].startThread();
+
+ process.nextTick(() => process.emit('worker', this));
}
[kOnExit](code, customErr, customErrReason) {
diff --git a/test/parallel/test-worker-event.js b/test/parallel/test-worker-event.js
new file mode 100644
index 00000000000000..9d6056e1091468
--- /dev/null
+++ b/test/parallel/test-worker-event.js
@@ -0,0 +1,13 @@
+'use strict';
+
+const common = require('../common');
+const assert = require('assert');
+const {
+ Worker,
+} = require('worker_threads');
+
+process.on('worker', common.mustCall(({ threadId }) => {
+ assert.strictEqual(threadId, 1);
+}));
+
+new Worker('', { eval: true });
From ec8ab22ce6d641edaa23b4e0c41b2e7bec5605da Mon Sep 17 00:00:00 2001
From: James M Snell
Date: Wed, 12 May 2021 15:34:29 -0700
Subject: [PATCH 57/86] tools: add `Worker` to type-parser
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: James M Snell
PR-URL: https://github.com/nodejs/node/pull/38659
Reviewed-By: Anna Henningsen
Reviewed-By: Rich Trott
Reviewed-By: Gerhard Stöbich
---
test/parallel/test-worker-event.js | 3 ++-
tools/doc/type-parser.js | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/parallel/test-worker-event.js b/test/parallel/test-worker-event.js
index 9d6056e1091468..01e95ead8316cb 100644
--- a/test/parallel/test-worker-event.js
+++ b/test/parallel/test-worker-event.js
@@ -4,10 +4,11 @@ const common = require('../common');
const assert = require('assert');
const {
Worker,
+ threadId: parentThreadId,
} = require('worker_threads');
process.on('worker', common.mustCall(({ threadId }) => {
- assert.strictEqual(threadId, 1);
+ assert.strictEqual(threadId, parentThreadId + 1);
}));
new Worker('', { eval: true });
diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js
index f2b953358d03ce..4fd91f4b478149 100644
--- a/tools/doc/type-parser.js
+++ b/tools/doc/type-parser.js
@@ -223,6 +223,7 @@ const customTypesMap = {
'vm.SourceTextModule': 'vm.html#vm_class_vm_sourcetextmodule',
'MessagePort': 'worker_threads.html#worker_threads_class_messageport',
+ 'Worker': 'worker_threads.html#worker_threads_class_worker',
'X509Certificate': 'crypto.html#crypto_class_x509certificate',
From 3d8b8e133f04ce4d892bd57b4d819cd7f9b347fa Mon Sep 17 00:00:00 2001
From: Rongjian Zhang
Date: Sat, 8 May 2021 17:09:18 +0800
Subject: [PATCH 58/86] http: refactor to remove redundant argument of
_deferToConnect
PR-URL: https://github.com/nodejs/node/pull/38598
Reviewed-By: Rich Trott
Reviewed-By: Luigi Pinca
Reviewed-By: Antoine du Hamel
---
lib/_http_client.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/_http_client.js b/lib/_http_client.js
index 4184191c0fbabc..f3b88b62730175 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -818,7 +818,7 @@ function onSocketNT(req, socket, err) {
}
ClientRequest.prototype._deferToConnect = _deferToConnect;
-function _deferToConnect(method, arguments_, cb) {
+function _deferToConnect(method, arguments_) {
// This function is for calls that need to happen once the socket is
// assigned to this request and writable. It's an important promisy
// thing for all the socket calls that happen either now
@@ -828,9 +828,6 @@ function _deferToConnect(method, arguments_, cb) {
const callSocketMethod = () => {
if (method)
ReflectApply(this.socket[method], this.socket, arguments_);
-
- if (typeof cb === 'function')
- cb();
};
const onSocket = () => {
From 3d0fad3840ba40ae2faebe88abb18ef4e5349419 Mon Sep 17 00:00:00 2001
From: Rongjian Zhang
Date: Wed, 12 May 2021 22:53:04 +0800
Subject: [PATCH 59/86] test: improve coverage of lib/os.js
PR-URL: https://github.com/nodejs/node/pull/38653
Refs: https://coverage.nodejs.org/coverage-52e4fb5b23157222/lib/os.js.html#L96
Reviewed-By: Darshan Sen
Reviewed-By: Antoine du Hamel
Reviewed-By: Anna Henningsen
Reviewed-By: James M Snell
Reviewed-By: Rich Trott
Reviewed-By: Colin Ihrig
Reviewed-By: Luigi Pinca
Reviewed-By: Michael Dawson
---
test/parallel/test-os.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js
index 5ee0fb9ca8dadb..6a5b43368249db 100644
--- a/test/parallel/test-os.js
+++ b/test/parallel/test-os.js
@@ -247,6 +247,7 @@ assert.strictEqual(`${os.endianness}`, os.endianness());
assert.strictEqual(`${os.tmpdir}`, os.tmpdir());
assert.strictEqual(`${os.arch}`, os.arch());
assert.strictEqual(`${os.platform}`, os.platform());
+assert.strictEqual(`${os.version}`, os.version());
assert.strictEqual(+os.totalmem, os.totalmem());
From 4296591154fcccd830f6abe36e9420d8eadafaff Mon Sep 17 00:00:00 2001
From: Daniel Bevenius
Date: Mon, 26 Apr 2021 05:52:16 +0200
Subject: [PATCH 60/86] build,src,test,doc: enable FIPS for OpenSSL 3.0
This commit enables FIPS when Node.js is dynamically linking against
quictls/openssl-3.0.
BUILDING.md has been updated with instructions to configure and build
quictls/openssl 3.0.0-alpha-15 and includes a couple of work-arounds
which I believe are fixed in alpha-16 and can be removed when alpha-16
is available. The information might be a little too detailed/verbose
but I thought it would be helpful to at least initially include all the
steps.
PR-URL: https://github.com/nodejs/node/pull/38633
Reviewed-By: James M Snell
Reviewed-By: Rich Trott
Reviewed-By: Richard Lau
Reviewed-By: Michael Dawson
---
BUILDING.md | 130 +++++++++++++++++++++++++++++-
common.gypi | 2 +-
configure.py | 6 ++
src/crypto/crypto_util.cc | 15 ++++
src/crypto/crypto_util.h | 2 +-
test/parallel/test-crypto-fips.js | 6 +-
6 files changed, 157 insertions(+), 4 deletions(-)
diff --git a/BUILDING.md b/BUILDING.md
index 973c87b73ea1a5..6ebe84f6e1aad5 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -759,7 +759,135 @@ as `deps/icu` (You'll have: `deps/icu/source/...`)
## Building Node.js with FIPS-compliant OpenSSL
-The current version of Node.js does not support FIPS.
+The current version of Node.js does not support FIPS when statically linking
+(the default) with OpenSSL 1.1.1 but for dynamically linking it is possible
+to enable FIPS using the configuration flag `--openssl-is-fips`.
+
+### Configuring and building quictls/openssl for FIPS
+
+For quictls/openssl 3.0 it is possible to enable FIPS when dynamically linking.
+Node.js currently uses openssl-3.0.0+quic which can be configured as
+follows:
+```console
+$ git clone git@github.com:quictls/openssl.git
+$ cd openssl
+$ ./config --prefix=/path/to/install/dir/ shared enable-fips linux-x86_64
+```
+This can be compiled and installed using the following commands:
+```console
+$ make -j8
+$ make install_ssldirs
+$ make install_fips
+```
+
+After the FIPS module and configuration file have been installed by the above
+instructions we also need to update `/path/to/install/dir/ssl/openssl.cnf` to
+use the generated FIPS configuration file (`fipsmodule.cnf`):
+```text
+.include fipsmodule.cnf
+
+# List of providers to load
+[provider_sect]
+default = default_sect
+# The fips section name should match the section name inside the
+# included /path/to/install/dir/ssl/fipsmodule.cnf.
+fips = fips_sect
+
+[default_sect]
+activate = 1
+```
+
+In the above case OpenSSL is not installed in the default location so two
+environment variables need to be set, `OPENSSL_CONF`, and `OPENSSL_MODULES`
+which should point to the OpenSSL configuration file and the directory where
+OpenSSL modules are located:
+```console
+$ export OPENSSL_CONF=/path/to/install/dir/ssl/openssl.cnf
+$ export OPENSSL_MODULES=/path/to/install/dir/lib/ossl-modules
+```
+
+Node.js can then be configured to enable FIPS:
+```console
+$ ./configure --shared-openssl --shared-openssl-libpath=/path/to/install/dir/lib --shared-openssl-includes=/path/to/install/dir/include --shared-openssl-libname=crypto,ssl --openssl-is-fips
+$ export LD_LIBRARY_PATH=/path/to/install/dir/lib
+$ make -j8
+```
+
+Verify the produced executable:
+```console
+$ ldd ./node
+ linux-vdso.so.1 (0x00007ffd7917b000)
+ libcrypto.so.81.3 => /path/to/install/dir/lib/libcrypto.so.81.3 (0x00007fd911321000)
+ libssl.so.81.3 => /path/to/install/dir/lib/libssl.so.81.3 (0x00007fd91125e000)
+ libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fd911232000)
+ libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fd911039000)
+ libm.so.6 => /usr/lib64/libm.so.6 (0x00007fd910ef3000)
+ libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fd910ed9000)
+ libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fd910eb5000)
+ libc.so.6 => /usr/lib64/libc.so.6 (0x00007fd910cec000)
+ /lib64/ld-linux-x86-64.so.2 (0x00007fd9117f2000)
+```
+If the `ldd` command says that `libcrypto` cannot be found one needs to set
+`LD_LIBRARY_PATH` to point to the directory used above for
+`--shared-openssl-libpath` (see previous step).
+
+Verify the OpenSSL version:
+```console
+$ ./node -p process.versions.openssl
+3.0.0-alpha16+quic
+```
+
+Verify that FIPS is available:
+```console
+$ ./node -p 'process.config.variables.openssl_is_fips'
+true
+$ ./node --enable-fips -p 'crypto.getFips()'
+1
+```
+
+FIPS support can then be enable via the OpenSSL configuration file or
+using `--enable-fips` or `--force-fips` command line options to the Node.js
+executable. See sections
+[Enabling FIPS using Node.js options](#enabling-fips-using-node.js-options) and
+[Enabling FIPS using OpenSSL config](#enabling-fips-using-openssl-config) below.
+
+### Enabling FIPS using Node.js options
+This is done using one of the Node.js options `--enable-fips` or
+`--force-fips`, for example:
+```console
+$ node --enable-fips -p 'crypto.getFips()'
+```
+
+### Enabling FIPS using OpenSSL config
+This example show that using OpenSSL's configuration file, FIPS can be enabled
+without specifying the `--enable-fips` or `--force-fips` options by setting
+`default_properties = fips=yes` in the FIPS configuration file. See
+[link](https://github.com/openssl/openssl/blob/master/README-FIPS.md#loading-the-fips-module-at-the-same-time-as-other-providers)
+for details.
+
+For this to work the OpenSSL configuration file (default openssl.cnf) needs to
+be updated. The following shows an example:
+```console
+openssl_conf = openssl_init
+
+.include /path/to/install/dir/ssl/fipsmodule.cnf
+
+[openssl_init]
+providers = prov
+alg_section = algorithm_sect
+
+[prov]
+fips = fips_sect
+default = default_sect
+
+[default_sect]
+activate = 1
+
+[algorithm_sect]
+default_properties = fips=yes
+```
+After this change Node.js can be run without the `--enable-fips` or `--force-fips`
+options.
## Building Node.js with external core modules
diff --git a/common.gypi b/common.gypi
index 75d4b692e9b62b..4bc75c7c41c6dd 100644
--- a/common.gypi
+++ b/common.gypi
@@ -99,7 +99,7 @@
'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
}],
['openssl_fips != ""', {
- 'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
+ 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
}, {
'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
}],
diff --git a/configure.py b/configure.py
index 9ec7da8924b132..895a0869cbc9d1 100755
--- a/configure.py
+++ b/configure.py
@@ -1456,6 +1456,12 @@ def without_ssl_error(option):
if options.openssl_fips or options.openssl_fips == '':
error('FIPS is not supported in this version of Node.js')
+ if options.openssl_is_fips and not options.shared_openssl:
+ error('--openssl-is-fips is only available with --shared-openssl')
+
+ if options.openssl_is_fips:
+ o['defines'] += ['OPENSSL_FIPS']
+
if options.shared_openssl:
variables['openssl_quic'] = b(getsharedopensslhasquic.get_has_quic(options.__dict__['shared_openssl_includes']))
diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc
index 9c35a7cabbf551..0d533ce42531d1 100644
--- a/src/crypto/crypto_util.cc
+++ b/src/crypto/crypto_util.cc
@@ -14,6 +14,12 @@
#include "math.h"
+#ifdef OPENSSL_FIPS
+#if OPENSSL_VERSION_MAJOR >= 3
+#include "openssl/provider.h"
+#endif
+#endif
+
namespace node {
using v8::ArrayBuffer;
@@ -197,7 +203,16 @@ void SetFipsCrypto(const FunctionCallbackInfo& args) {
void TestFipsCrypto(const v8::FunctionCallbackInfo& args) {
#ifdef OPENSSL_FIPS
+#if OPENSSL_VERSION_MAJOR >= 3
+ OSSL_PROVIDER* fips_provider = nullptr;
+ if (OSSL_PROVIDER_available(nullptr, "fips")) {
+ fips_provider = OSSL_PROVIDER_load(nullptr, "fips");
+ }
+ const auto enabled = fips_provider == nullptr ? 0 :
+ OSSL_PROVIDER_self_test(fips_provider) ? 1 : 0;
+#else
const auto enabled = FIPS_selftest() ? 1 : 0;
+#endif
#else // OPENSSL_FIPS
const auto enabled = 0;
#endif // OPENSSL_FIPS
diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h
index 27bb6310b884d1..f2f61aa4518581 100644
--- a/src/crypto/crypto_util.h
+++ b/src/crypto/crypto_util.h
@@ -24,7 +24,7 @@
#endif // !OPENSSL_NO_ENGINE
// The FIPS-related functions are only available
// when the OpenSSL itself was compiled with FIPS support.
-#ifdef OPENSSL_FIPS
+#if defined(OPENSSL_FIPS) && OPENSSL_VERSION_MAJOR < 3
# include
#endif // OPENSSL_FIPS
diff --git a/test/parallel/test-crypto-fips.js b/test/parallel/test-crypto-fips.js
index 204951514a8ede..b6e70b62be68b9 100644
--- a/test/parallel/test-crypto-fips.js
+++ b/test/parallel/test-crypto-fips.js
@@ -66,6 +66,10 @@ testHelper(
'require("crypto").getFips()',
{ ...process.env, 'OPENSSL_CONF': '' });
+// This should succeed for both FIPS and non-FIPS builds in combination with
+// OpenSSL 1.1.1 or OpenSSL 3.0
+const test_result = testFipsCrypto();
+assert.ok(test_result === 1 || test_result === 0);
// If Node was configured using --shared-openssl fips support might be
// available depending on how OpenSSL was built. If fips support is
@@ -79,7 +83,7 @@ testHelper(
// ("Error: Cannot set FIPS mode in a non-FIPS build.").
// Due to this uncertainty the following tests are skipped when configured
// with --shared-openssl.
-if (!sharedOpenSSL()) {
+if (!sharedOpenSSL() && !common.hasOpenSSL3) {
// OpenSSL config file should be able to turn on FIPS mode
testHelper(
'stdout',
From 36bb7243ffd7a2d1c5a3252dff9af46800916c61 Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Tue, 27 Apr 2021 12:27:39 +0200
Subject: [PATCH 61/86] debugger: refactor `inspect_repl` to use primordials
PR-URL: https://github.com/nodejs/node/pull/38551
Reviewed-By: Rich Trott
Reviewed-By: James M Snell
---
lib/internal/inspector/inspect_repl.js | 567 ++++++++++++++-----------
1 file changed, 316 insertions(+), 251 deletions(-)
diff --git a/lib/internal/inspector/inspect_repl.js b/lib/internal/inspector/inspect_repl.js
index 1b23196b2138de..0fcde39bfc3e2c 100644
--- a/lib/internal/inspector/inspect_repl.js
+++ b/lib/internal/inspector/inspect_repl.js
@@ -21,10 +21,57 @@
*/
// TODO(trott): enable ESLint
-/* eslint-disable getter-return, no-restricted-syntax,
- node-core/prefer-primordials */
+/* eslint-disable getter-return, no-restricted-syntax */
'use strict';
+
+const {
+ Array,
+ ArrayFrom,
+ ArrayPrototypeFilter,
+ ArrayPrototypeFind,
+ ArrayPrototypeForEach,
+ ArrayPrototypeIncludes,
+ ArrayPrototypeIndexOf,
+ ArrayPrototypeJoin,
+ ArrayPrototypeMap,
+ ArrayPrototypePush,
+ ArrayPrototypeSlice,
+ ArrayPrototypeSome,
+ ArrayPrototypeSplice,
+ Date,
+ Error,
+ FunctionPrototypeCall,
+ JSONStringify,
+ MathMax,
+ ObjectAssign,
+ ObjectDefineProperty,
+ ObjectKeys,
+ ObjectValues,
+ Promise,
+ PromiseAll,
+ PromisePrototypeCatch,
+ PromisePrototypeThen,
+ PromiseResolve,
+ ReflectGetOwnPropertyDescriptor,
+ ReflectOwnKeys,
+ RegExpPrototypeSymbolMatch,
+ RegExpPrototypeSymbolReplace,
+ SafeArrayIterator,
+ SafeMap,
+ String,
+ StringFromCharCode,
+ StringPrototypeEndsWith,
+ StringPrototypeIncludes,
+ StringPrototypeRepeat,
+ StringPrototypeSlice,
+ StringPrototypeSplit,
+ StringPrototypeStartsWith,
+ StringPrototypeToUpperCase,
+ StringPrototypeTrim,
+ TypeError,
+} = primordials;
+
const FS = require('fs');
const Path = require('path');
const Repl = require('repl');
@@ -46,7 +93,7 @@ const SHORTCUTS = {
run: 'r',
};
-const HELP = `
+const HELP = StringPrototypeTrim(`
run, restart, r Run the application or reconnect
kill Kill a running application or disconnect
@@ -83,88 +130,83 @@ profiles[n].save(filepath = 'node.cpuprofile')
takeHeapSnapshot(filepath = 'node.heapsnapshot')
Take a heap snapshot and save to disk as JSON.
-`.trim();
+`);
const FUNCTION_NAME_PATTERN = /^(?:function\*? )?([^(\s]+)\(/;
function extractFunctionName(description) {
- const fnNameMatch = description.match(FUNCTION_NAME_PATTERN);
+ const fnNameMatch =
+ RegExpPrototypeSymbolMatch(FUNCTION_NAME_PATTERN, description);
return fnNameMatch ? `: ${fnNameMatch[1]}` : '';
}
-const PUBLIC_BUILTINS = require('module').builtinModules;
-const NATIVES = PUBLIC_BUILTINS ? internalBinding('natives') : {};
+const {
+ moduleIds: PUBLIC_BUILTINS,
+} = internalBinding('native_module');
+const NATIVES = internalBinding('natives');
function isNativeUrl(url) {
- url = url.replace(/\.js$/, '');
- if (PUBLIC_BUILTINS) {
- if (url.startsWith('node:internal/') || PUBLIC_BUILTINS.includes(url))
- return true;
- }
+ url = RegExpPrototypeSymbolReplace(/\.js$/, url, '');
- return url in NATIVES || url === 'bootstrap_node';
+ return StringPrototypeStartsWith(url, 'node:internal/') ||
+ ArrayPrototypeIncludes(PUBLIC_BUILTINS, url) ||
+ url in NATIVES || url === 'bootstrap_node';
}
function getRelativePath(filenameOrURL) {
- const dir = Path.join(Path.resolve(), 'x').slice(0, -1);
+ const dir = StringPrototypeSlice(Path.join(Path.resolve(), 'x'), 0, -1);
- const filename = filenameOrURL.startsWith('file://') ?
+ const filename = StringPrototypeStartsWith(filenameOrURL, 'file://') ?
fileURLToPath(filenameOrURL) : filenameOrURL;
// Change path to relative, if possible
- if (filename.indexOf(dir) === 0) {
- return filename.slice(dir.length);
+ if (StringPrototypeStartsWith(filename, dir)) {
+ return StringPrototypeSlice(filename, dir.length);
}
return filename;
}
-function toCallback(promise, callback) {
- function forward(...args) {
- process.nextTick(() => callback(...args));
- }
- promise.then(forward.bind(null, null), forward);
-}
-
// Adds spaces and prefix to number
// maxN is a maximum number we should have space for
function leftPad(n, prefix, maxN) {
const s = n.toString();
- const nchars = Math.max(2, String(maxN).length) + 1;
- const nspaces = nchars - s.length - 1;
+ const nchars = MathMax(2, String(maxN).length);
+ const nspaces = nchars - s.length;
- return prefix + ' '.repeat(nspaces) + s;
+ return prefix + StringPrototypeRepeat(' ', nspaces) + s;
}
function markSourceColumn(sourceText, position, useColors) {
if (!sourceText) return '';
- const head = sourceText.slice(0, position);
- let tail = sourceText.slice(position);
+ const head = StringPrototypeSlice(sourceText, 0, position);
+ let tail = StringPrototypeSlice(sourceText, position);
// Colourize char if stdout supports colours
if (useColors) {
- tail = tail.replace(/(.+?)([^\w]|$)/, '\u001b[32m$1\u001b[39m$2');
+ tail = RegExpPrototypeSymbolReplace(/(.+?)([^\w]|$)/, tail,
+ '\u001b[32m$1\u001b[39m$2');
}
// Return source line with coloured char at `position`
- return [head, tail].join('');
+ return head + tail;
}
function extractErrorMessage(stack) {
if (!stack) return '';
- const m = stack.match(/^\w+: ([^\n]+)/);
- return m ? m[1] : stack;
+ const m = RegExpPrototypeSymbolMatch(/^\w+: ([^\n]+)/, stack);
+ return m?.[1] ?? stack;
}
function convertResultToError(result) {
const { className, description } = result;
const err = new Error(extractErrorMessage(description));
err.stack = description;
- Object.defineProperty(err, 'name', { value: className });
+ ObjectDefineProperty(err, 'name', { value: className });
return err;
}
class RemoteObject {
constructor(attributes) {
- Object.assign(this, attributes);
+ ObjectAssign(this, attributes);
if (this.type === 'number') {
this.value =
this.unserializableValue ? +this.unserializableValue : +this.value;
@@ -227,18 +269,21 @@ class RemoteObject {
break;
}
if (this.preview) {
- const props = this.preview.properties
- .map((prop, idx) => {
+ const props = ArrayPrototypeMap(
+ this.preview.properties,
+ (prop, idx) => {
const value = formatProperty(prop);
if (prop.name === `${idx}`) return value;
return `${prop.name}: ${value}`;
});
if (this.preview.overflow) {
- props.push('...');
+ ArrayPrototypePush(props, '...');
}
- const singleLine = props.join(', ');
+ const singleLine = ArrayPrototypeJoin(props, ', ');
const propString =
- singleLine.length > 60 ? props.join(',\n ') : singleLine;
+ singleLine.length > 60 ?
+ ArrayPrototypeJoin(props, ',\n ') :
+ singleLine;
return this.subtype === 'array' ?
`[ ${propString} ]` : `{ ${propString} }`;
@@ -258,34 +303,39 @@ class RemoteObject {
class ScopeSnapshot {
constructor(scope, properties) {
- Object.assign(this, scope);
- this.properties = new Map(properties.map((prop) => {
+ ObjectAssign(this, scope);
+ this.properties = new SafeMap();
+ this.completionGroup = ArrayPrototypeMap(properties, (prop) => {
const value = new RemoteObject(prop.value);
- return [prop.name, value];
- }));
- this.completionGroup = properties.map((prop) => prop.name);
+ this.properties.set(prop.name, value);
+ return prop.name;
+ });
}
[customInspectSymbol](depth, opts) {
- const type = `${this.type[0].toUpperCase()}${this.type.slice(1)}`;
+ const type = StringPrototypeToUpperCase(this.type[0]) +
+ StringPrototypeSlice(this.type, 1);
const name = this.name ? `<${this.name}>` : '';
const prefix = `${type}${name} `;
- return utilInspect(this.properties, opts)
- .replace(/^Map /, prefix);
+ return RegExpPrototypeSymbolReplace(/^Map /,
+ utilInspect(this.properties, opts),
+ prefix);
}
}
function copyOwnProperties(target, source) {
- Object.getOwnPropertyNames(source).forEach((prop) => {
- const descriptor = Object.getOwnPropertyDescriptor(source, prop);
- Object.defineProperty(target, prop, descriptor);
- });
+ ArrayPrototypeForEach(
+ ReflectOwnKeys(source),
+ (prop) => {
+ const desc = ReflectGetOwnPropertyDescriptor(source, prop);
+ ObjectDefineProperty(target, prop, desc);
+ });
}
function aliasProperties(target, mapping) {
- Object.keys(mapping).forEach((key) => {
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
- Object.defineProperty(target, mapping[key], descriptor);
+ ArrayPrototypeForEach(ObjectKeys(mapping), (key) => {
+ const desc = ReflectGetOwnPropertyDescriptor(target, key);
+ ObjectDefineProperty(target, mapping[key], desc);
});
}
@@ -344,16 +394,14 @@ function createRepl(inspector) {
return !script.isNative || isCurrentScript(script);
}
- return Object.keys(knownScripts)
- .map((scriptId) => knownScripts[scriptId])
- .filter(isVisible)
- .map((script) => {
+ return ArrayPrototypeJoin(ArrayPrototypeMap(
+ ArrayPrototypeFilter(ObjectValues(knownScripts), isVisible),
+ (script) => {
const isCurrent = isCurrentScript(script);
const { isNative, url } = script;
const name = `${getRelativePath(url)}${isNative ? ' ' : ''}`;
return `${isCurrent ? '*' : ' '} ${script.scriptId}: ${name}`;
- })
- .join('\n');
+ }), '\n');
}
function listScripts(displayNatives = false) {
@@ -371,19 +419,19 @@ function createRepl(inspector) {
static createAndRegister({ profile }) {
const p = new Profile(profile);
- profiles.push(p);
+ ArrayPrototypePush(profiles, p);
return p;
}
[customInspectSymbol](depth, { stylize }) {
const { startTime, endTime } = this.data;
- const MU = String.fromChar(956);
+ const MU = StringFromCharCode(956);
return stylize(`[Profile ${endTime - startTime}${MU}s]`, 'special');
}
save(filename = 'node.cpuprofile') {
const absoluteFile = Path.resolve(filename);
- const json = JSON.stringify(this.data);
+ const json = JSONStringify(this.data);
FS.writeFileSync(absoluteFile, json);
print('Saved profile to ' + absoluteFile);
}
@@ -391,68 +439,75 @@ function createRepl(inspector) {
class SourceSnippet {
constructor(location, delta, scriptSource) {
- Object.assign(this, location);
+ ObjectAssign(this, location);
this.scriptSource = scriptSource;
this.delta = delta;
}
[customInspectSymbol](depth, options) {
const { scriptId, lineNumber, columnNumber, delta, scriptSource } = this;
- const start = Math.max(1, lineNumber - delta + 1);
+ const start = MathMax(1, lineNumber - delta + 1);
const end = lineNumber + delta + 1;
- const lines = scriptSource.split('\n');
- return lines.slice(start - 1, end).map((lineText, offset) => {
- const i = start + offset;
- const isCurrent = i === (lineNumber + 1);
-
- const markedLine = isCurrent ?
- markSourceColumn(lineText, columnNumber, options.colors) :
- lineText;
-
- let isBreakpoint = false;
- knownBreakpoints.forEach(({ location }) => {
- if (!location) return;
- if (scriptId === location.scriptId &&
+ const lines = StringPrototypeSplit(scriptSource, '\n');
+ return ArrayPrototypeJoin(
+ ArrayPrototypeMap(
+ ArrayPrototypeSlice(lines, start - 1, end),
+ (lineText, offset) => {
+ const i = start + offset;
+ const isCurrent = i === (lineNumber + 1);
+
+ const markedLine = isCurrent ?
+ markSourceColumn(lineText, columnNumber, options.colors) :
+ lineText;
+
+ let isBreakpoint = false;
+ ArrayPrototypeForEach(knownBreakpoints, ({ location }) => {
+ if (!location) return;
+ if (scriptId === location.scriptId &&
i === (location.lineNumber + 1)) {
- isBreakpoint = true;
- }
- });
+ isBreakpoint = true;
+ }
+ });
- let prefixChar = ' ';
- if (isCurrent) {
- prefixChar = '>';
- } else if (isBreakpoint) {
- prefixChar = '*';
- }
- return `${leftPad(i, prefixChar, end)} ${markedLine}`;
- }).join('\n');
+ let prefixChar = ' ';
+ if (isCurrent) {
+ prefixChar = '>';
+ } else if (isBreakpoint) {
+ prefixChar = '*';
+ }
+ return `${leftPad(i, prefixChar, end)} ${markedLine}`;
+ }), '\n');
}
}
- function getSourceSnippet(location, delta = 5) {
+ async function getSourceSnippet(location, delta = 5) {
const { scriptId } = location;
- return Debugger.getScriptSource({ scriptId })
- .then(({ scriptSource }) =>
- new SourceSnippet(location, delta, scriptSource));
+ const { scriptSource } = await Debugger.getScriptSource({ scriptId });
+ return new SourceSnippet(location, delta, scriptSource);
}
class CallFrame {
constructor(callFrame) {
- Object.assign(this, callFrame);
+ ObjectAssign(this, callFrame);
}
loadScopes() {
- return Promise.all(
- this.scopeChain
- .filter((scope) => scope.type !== 'global')
- .map((scope) => {
+ return PromiseAll(
+ new SafeArrayIterator(ArrayPrototypeMap(
+ ArrayPrototypeFilter(
+ this.scopeChain,
+ (scope) => scope.type !== 'global'
+ ),
+ async (scope) => {
const { objectId } = scope.object;
- return Runtime.getProperties({
+ const { result } = await Runtime.getProperties({
objectId,
generatePreview: true,
- }).then(({ result }) => new ScopeSnapshot(scope, result));
+ });
+ return new ScopeSnapshot(scope, result);
})
+ )
);
}
@@ -463,69 +518,72 @@ function createRepl(inspector) {
class Backtrace extends Array {
[customInspectSymbol]() {
- return this.map((callFrame, idx) => {
- const {
- location: { scriptId, lineNumber, columnNumber },
- functionName
- } = callFrame;
- const name = functionName || '(anonymous)';
-
- const script = knownScripts[scriptId];
- const relativeUrl =
+ return ArrayPrototypeJoin(
+ ArrayPrototypeMap(this, (callFrame, idx) => {
+ const {
+ location: { scriptId, lineNumber, columnNumber },
+ functionName
+ } = callFrame;
+ const name = functionName || '(anonymous)';
+
+ const script = knownScripts[scriptId];
+ const relativeUrl =
(script && getRelativePath(script.url)) || '';
- const frameLocation =
+ const frameLocation =
`${relativeUrl}:${lineNumber + 1}:${columnNumber}`;
- return `#${idx} ${name} ${frameLocation}`;
- }).join('\n');
+ return `#${idx} ${name} ${frameLocation}`;
+ }), '\n');
}
static from(callFrames) {
- return super.from(Array.from(callFrames).map((callFrame) => {
- if (callFrame instanceof CallFrame) {
- return callFrame;
- }
- return new CallFrame(callFrame);
- }));
+ return FunctionPrototypeCall(
+ ArrayFrom,
+ this,
+ callFrames,
+ (callFrame) =>
+ (callFrame instanceof CallFrame ?
+ callFrame :
+ new CallFrame(callFrame))
+ );
}
}
function prepareControlCode(input) {
if (input === '\n') return lastCommand;
// Add parentheses: exec process.title => exec("process.title");
- const match = input.match(/^\s*exec\s+([^\n]*)/);
+ const match = RegExpPrototypeSymbolMatch(/^\s*exec\s+([^\n]*)/, input);
if (match) {
- lastCommand = `exec(${JSON.stringify(match[1])})`;
+ lastCommand = `exec(${JSONStringify(match[1])})`;
} else {
lastCommand = input;
}
return lastCommand;
}
- function evalInCurrentContext(code) {
+ async function evalInCurrentContext(code) {
// Repl asked for scope variables
if (code === '.scope') {
if (!selectedFrame) {
- return Promise.reject(new Error('Requires execution to be paused'));
+ throw new Error('Requires execution to be paused');
}
- return selectedFrame.loadScopes().then((scopes) => {
- return scopes.map((scope) => scope.completionGroup);
- });
+ const scopes = await selectedFrame.loadScopes();
+ return ArrayPrototypeMap(scopes, (scope) => scope.completionGroup);
}
if (selectedFrame) {
- return Debugger.evaluateOnCallFrame({
+ return PromisePrototypeThen(Debugger.evaluateOnCallFrame({
callFrameId: selectedFrame.callFrameId,
expression: code,
objectGroup: 'node-inspect',
generatePreview: true,
- }).then(RemoteObject.fromEvalResult);
+ }), RemoteObject.fromEvalResult);
}
- return Runtime.evaluate({
+ return PromisePrototypeThen(Runtime.evaluate({
expression: code,
objectGroup: 'node-inspect',
generatePreview: true,
- }).then(RemoteObject.fromEvalResult);
+ }), RemoteObject.fromEvalResult);
}
function controlEval(input, context, filename, callback) {
@@ -539,11 +597,16 @@ function createRepl(inspector) {
const code = prepareControlCode(input);
const result = vm.runInContext(code, context, filename);
- if (result && typeof result.then === 'function') {
- toCallback(result, returnToCallback);
- return;
+ const then = result?.then;
+ if (typeof then === 'function') {
+ FunctionPrototypeCall(
+ then, result,
+ (result) => returnToCallback(null, result),
+ returnToCallback
+ );
+ } else {
+ returnToCallback(null, result);
}
- returnToCallback(null, result);
} catch (e) {
returnToCallback(e);
}
@@ -556,76 +619,63 @@ function createRepl(inspector) {
callback(error, result);
}
- try {
- const result = evalInCurrentContext(input);
-
- if (result && typeof result.then === 'function') {
- toCallback(result, returnToCallback);
- return;
- }
- returnToCallback(null, result);
- } catch (e) {
- returnToCallback(e);
- }
+ PromisePrototypeThen(evalInCurrentContext(input),
+ (result) => returnToCallback(null, result),
+ returnToCallback
+ );
}
- function formatWatchers(verbose = false) {
+ async function formatWatchers(verbose = false) {
if (!watchedExpressions.length) {
- return Promise.resolve('');
+ return '';
}
const inspectValue = (expr) =>
- evalInCurrentContext(expr)
- // .then(formatValue)
- .catch((error) => `<${error.message}>`);
+ PromisePrototypeCatch(evalInCurrentContext(expr),
+ (error) => `<${error.message}>`);
const lastIndex = watchedExpressions.length - 1;
- return Promise.all(watchedExpressions.map(inspectValue))
- .then((values) => {
- const lines = watchedExpressions
- .map((expr, idx) => {
- const prefix = `${leftPad(idx, ' ', lastIndex)}: ${expr} =`;
- const value = inspect(values[idx]);
- if (value.indexOf('\n') === -1) {
- return `${prefix} ${value}`;
- }
- return `${prefix}\n ${value.split('\n').join('\n ')}`;
- });
- return lines.join('\n');
- })
- .then((valueList) => {
- return verbose ? `Watchers:\n${valueList}\n` : valueList;
- });
+ const values = await PromiseAll(new SafeArrayIterator(
+ ArrayPrototypeMap(watchedExpressions, inspectValue)));
+ const lines = ArrayPrototypeMap(watchedExpressions, (expr, idx) => {
+ const prefix = `${leftPad(idx, ' ', lastIndex)}: ${expr} =`;
+ const value = inspect(values[idx], { colors: true });
+ if (!StringPrototypeIncludes(value, '\n')) {
+ return `${prefix} ${value}`;
+ }
+ return `${prefix}\n ${RegExpPrototypeSymbolReplace(/\n/g, value, '\n ')}`;
+ });
+ const valueList = ArrayPrototypeJoin(lines, '\n');
+ return verbose ? `Watchers:\n${valueList}\n` : valueList;
}
function watchers(verbose = false) {
- return formatWatchers(verbose).then(print);
+ return PromisePrototypeThen(formatWatchers(verbose), print);
}
// List source code
function list(delta = 5) {
- return selectedFrame.list(delta)
- .then(null, (error) => {
- print('You can\'t list source code right now');
- throw error;
- });
+ return selectedFrame.list(delta).then(null, (error) => {
+ print("You can't list source code right now");
+ throw error;
+ });
}
function handleBreakpointResolved({ breakpointId, location }) {
const script = knownScripts[location.scriptId];
const scriptUrl = script && script.url;
if (scriptUrl) {
- Object.assign(location, { scriptUrl });
+ ObjectAssign(location, { scriptUrl });
}
- const isExisting = knownBreakpoints.some((bp) => {
+ const isExisting = ArrayPrototypeSome(knownBreakpoints, (bp) => {
if (bp.breakpointId === breakpointId) {
- Object.assign(bp, { location });
+ ObjectAssign(bp, { location });
return true;
}
return false;
});
if (!isExisting) {
- knownBreakpoints.push({ breakpointId, location });
+ ArrayPrototypePush(knownBreakpoints, { breakpointId, location });
}
}
@@ -641,9 +691,11 @@ function createRepl(inspector) {
const scriptUrl = script ? script.url : location.scriptUrl;
return `${getRelativePath(scriptUrl)}:${location.lineNumber + 1}`;
}
- const breaklist = knownBreakpoints
- .map((bp, idx) => `#${idx} ${formatLocation(bp.location)}`)
- .join('\n');
+ const breaklist = ArrayPrototypeJoin(
+ ArrayPrototypeMap(
+ knownBreakpoints,
+ (bp, idx) => `#${idx} ${formatLocation(bp.location)}`),
+ '\n');
print(breaklist);
}
@@ -660,9 +712,9 @@ function createRepl(inspector) {
// setBreakpoint(): set breakpoint at current location
if (script === undefined) {
- return Debugger
- .setBreakpoint({ location: getCurrentLocation(), condition })
- .then(registerBreakpoint);
+ return PromisePrototypeThen(
+ Debugger.setBreakpoint({ location: getCurrentLocation(), condition }),
+ registerBreakpoint);
}
// setBreakpoint(line): set breakpoint in current script at specific line
@@ -671,8 +723,9 @@ function createRepl(inspector) {
scriptId: getCurrentLocation().scriptId,
lineNumber: script - 1,
};
- return Debugger.setBreakpoint({ location, condition })
- .then(registerBreakpoint);
+ return PromisePrototypeThen(
+ Debugger.setBreakpoint({ location, condition }),
+ registerBreakpoint);
}
if (typeof script !== 'string') {
@@ -680,7 +733,7 @@ function createRepl(inspector) {
}
// setBreakpoint('fn()'): Break when a function is called
- if (script.endsWith('()')) {
+ if (StringPrototypeEndsWith(script, '()')) {
const debugExpr = `debug(${script.slice(0, -2)})`;
const debugCall = selectedFrame ?
Debugger.evaluateOnCallFrame({
@@ -692,7 +745,7 @@ function createRepl(inspector) {
expression: debugExpr,
includeCommandLineAPI: true,
});
- return debugCall.then(({ result, wasThrown }) => {
+ return PromisePrototypeThen(debugCall, ({ result, wasThrown }) => {
if (wasThrown) return convertResultToError(result);
return undefined; // This breakpoint can't be removed the same way
});
@@ -704,15 +757,15 @@ function createRepl(inspector) {
if (knownScripts[script]) {
scriptId = script;
} else {
- for (const id of Object.keys(knownScripts)) {
+ ArrayPrototypeForEach(ObjectKeys(knownScripts), (id) => {
const scriptUrl = knownScripts[id].url;
- if (scriptUrl && scriptUrl.indexOf(script) !== -1) {
+ if (scriptUrl && StringPrototypeIncludes(scriptUrl, script)) {
if (scriptId !== null) {
ambiguous = true;
}
scriptId = id;
}
- }
+ });
}
if (ambiguous) {
@@ -726,19 +779,25 @@ function createRepl(inspector) {
if (scriptId !== null) {
const location = { scriptId, lineNumber: line - 1 };
- return Debugger.setBreakpoint({ location, condition })
- .then(registerBreakpoint);
+ return PromisePrototypeThen(
+ Debugger.setBreakpoint({ location, condition }),
+ registerBreakpoint);
}
- const escapedPath = script.replace(/([/\\.?*()^${}|[\]])/g, '\\$1');
+ const escapedPath = RegExpPrototypeSymbolReplace(/([/\\.?*()^${}|[\]])/g,
+ script, '\\$1');
const urlRegex = `^(.*[\\/\\\\])?${escapedPath}$`;
- return Debugger
- .setBreakpointByUrl({ urlRegex, lineNumber: line - 1, condition })
- .then((bp) => {
+ return PromisePrototypeThen(
+ Debugger.setBreakpointByUrl({
+ urlRegex,
+ lineNumber: line - 1,
+ condition,
+ }),
+ (bp) => {
// TODO: handle bp.locations in case the regex matches existing files
if (!bp.location) { // Fake it for now.
- Object.assign(bp, {
+ ObjectAssign(bp, {
actualLocation: {
scriptUrl: `.*/${script}$`,
lineNumber: line - 1,
@@ -750,41 +809,46 @@ function createRepl(inspector) {
}
function clearBreakpoint(url, line) {
- const breakpoint = knownBreakpoints.find(({ location }) => {
+ const breakpoint = ArrayPrototypeFind(knownBreakpoints, ({ location }) => {
if (!location) return false;
const script = knownScripts[location.scriptId];
if (!script) return false;
return (
- script.url.indexOf(url) !== -1 && (location.lineNumber + 1) === line
+ StringPrototypeIncludes(script.url, url) &&
+ (location.lineNumber + 1) === line
);
});
if (!breakpoint) {
print(`Could not find breakpoint at ${url}:${line}`);
- return Promise.resolve();
+ return PromiseResolve();
}
- return Debugger.removeBreakpoint({ breakpointId: breakpoint.breakpointId })
- .then(() => {
- const idx = knownBreakpoints.indexOf(breakpoint);
- knownBreakpoints.splice(idx, 1);
+ return PromisePrototypeThen(
+ Debugger.removeBreakpoint({ breakpointId: breakpoint.breakpointId }),
+ () => {
+ const idx = ArrayPrototypeIndexOf(knownBreakpoints, breakpoint);
+ ArrayPrototypeSplice(knownBreakpoints, idx, 1);
});
}
function restoreBreakpoints() {
- const lastBreakpoints = knownBreakpoints.slice();
- knownBreakpoints.length = 0;
- const newBreakpoints = lastBreakpoints
- .filter(({ location }) => !!location.scriptUrl)
- .map(({ location }) =>
- setBreakpoint(location.scriptUrl, location.lineNumber + 1));
- if (!newBreakpoints.length) return Promise.resolve();
- return Promise.all(newBreakpoints).then((results) => {
- print(`${results.length} breakpoints restored.`);
- });
+ const lastBreakpoints = ArrayPrototypeSplice(knownBreakpoints, 0);
+ const newBreakpoints = ArrayPrototypeMap(
+ ArrayPrototypeFilter(lastBreakpoints,
+ ({ location }) => !!location.scriptUrl),
+ ({ location }) => setBreakpoint(location.scriptUrl,
+ location.lineNumber + 1));
+ if (!newBreakpoints.length) return PromiseResolve();
+ return PromisePrototypeThen(
+ PromiseAll(new SafeArrayIterator(newBreakpoints)),
+ (results) => {
+ print(`${results.length} breakpoints restored.`);
+ });
}
function setPauseOnExceptions(state) {
- return Debugger.setPauseOnExceptions({ state })
- .then(() => {
+ return PromisePrototypeThen(
+ Debugger.setPauseOnExceptions({ state }),
+ () => {
pauseOnExceptionState = state;
});
}
@@ -810,13 +874,13 @@ function createRepl(inspector) {
const header = `${breakType} in ${scriptUrl}:${lineNumber + 1}`;
inspector.suspendReplWhile(() =>
- Promise.all([formatWatchers(true), selectedFrame.list(2)])
- .then(({ 0: watcherList, 1: context }) => {
- if (watcherList) {
- return `${watcherList}\n${inspect(context)}`;
- }
- return inspect(context);
- }).then((breakContext) => {
+ PromisePrototypeThen(
+ PromiseAll(new SafeArrayIterator(
+ [formatWatchers(true), selectedFrame.list(2)])),
+ ({ 0: watcherList, 1: context }) => {
+ const breakContext = watcherList ?
+ `${watcherList}\n${inspect(context)}` :
+ inspect(context);
print(`${header}\n${breakContext}`);
}));
});
@@ -839,15 +903,15 @@ function createRepl(inspector) {
Profiler.on('consoleProfileFinished', ({ profile }) => {
Profile.createAndRegister({ profile });
- print([
- 'Captured new CPU profile.',
- `Access it with profiles[${profiles.length - 1}]`,
- ].join('\n'));
+ print(
+ 'Captured new CPU profile.\n' +
+ `Access it with profiles[${profiles.length - 1}]`
+ );
});
function initializeContext(context) {
- inspector.domainNames.forEach((domain) => {
- Object.defineProperty(context, domain, {
+ ArrayPrototypeForEach(inspector.domainNames, (domain) => {
+ ObjectDefineProperty(context, domain, {
value: inspector[domain],
enumerable: true,
configurable: true,
@@ -913,8 +977,8 @@ function createRepl(inspector) {
},
get profileEnd() {
- return Profiler.stop()
- .then(Profile.createAndRegister);
+ return PromisePrototypeThen(Profiler.stop(),
+ Profile.createAndRegister);
},
get profiles() {
@@ -963,8 +1027,9 @@ function createRepl(inspector) {
HeapProfiler.on('addHeapSnapshotChunk', onChunk);
print('Heap snapshot: 0/0', false);
- HeapProfiler.takeHeapSnapshot({ reportProgress: true })
- .then(onResolve, onReject);
+ PromisePrototypeThen(
+ HeapProfiler.takeHeapSnapshot({ reportProgress: true }),
+ onResolve, onReject);
});
},
@@ -973,21 +1038,22 @@ function createRepl(inspector) {
},
watch(expr) {
- watchedExpressions.push(expr);
+ ArrayPrototypePush(watchedExpressions, expr);
},
unwatch(expr) {
- const index = watchedExpressions.indexOf(expr);
+ const index = ArrayPrototypeIndexOf(watchedExpressions, expr);
// Unwatch by expression
// or
// Unwatch by watcher number
- watchedExpressions.splice(index !== -1 ? index : +expr, 1);
+ ArrayPrototypeSplice(watchedExpressions,
+ index !== -1 ? index : +expr, 1);
},
get repl() {
// Don't display any default messages
- const listeners = repl.listeners('SIGINT').slice(0);
+ const listeners = ArrayPrototypeSlice(repl.listeners('SIGINT'));
repl.removeAllListeners('SIGINT');
const oldContext = repl.context;
@@ -995,7 +1061,7 @@ function createRepl(inspector) {
exitDebugRepl = () => {
// Restore all listeners
process.nextTick(() => {
- listeners.forEach((listener) => {
+ ArrayPrototypeForEach(listeners, (listener) => {
repl.on('SIGINT', listener);
});
});
@@ -1038,11 +1104,11 @@ function createRepl(inspector) {
},
get version() {
- return Runtime.evaluate({
+ return PromisePrototypeThen(Runtime.evaluate({
expression: 'process.versions.v8',
contextId: 1,
returnByValue: true,
- }).then(({ result }) => {
+ }), ({ result }) => {
print(result.value);
});
},
@@ -1067,18 +1133,17 @@ function createRepl(inspector) {
aliasProperties(context, SHORTCUTS);
}
- function initAfterStart() {
- return Runtime.enable()
- .then(() => Profiler.enable())
- .then(() => Profiler.setSamplingInterval({ interval: 100 }))
- .then(() => Debugger.enable())
- .then(() => Debugger.setPauseOnExceptions({ state: 'none' }))
- .then(() => Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
- .then(() => Debugger.setBlackboxPatterns({ patterns: [] }))
- .then(() =>
- Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }))
- .then(() => restoreBreakpoints())
- .then(() => Runtime.runIfWaitingForDebugger());
+ async function initAfterStart() {
+ await Runtime.enable();
+ await Profiler.enable();
+ await Profiler.setSamplingInterval({ interval: 100 });
+ await Debugger.enable();
+ await Debugger.setPauseOnExceptions({ state: 'none' });
+ await Debugger.setAsyncCallStackDepth({ maxDepth: 0 });
+ await Debugger.setBlackboxPatterns({ patterns: [] });
+ await Debugger.setPauseOnExceptions({ state: pauseOnExceptionState });
+ await restoreBreakpoints();
+ return Runtime.runIfWaitingForDebugger();
}
return function startRepl() {
From 5a0b52120a6ccaf80b01f61dfb2d5b50d27c544b Mon Sep 17 00:00:00 2001
From: Rongjian Zhang
Date: Sat, 8 May 2021 19:01:04 +0800
Subject: [PATCH 62/86] test: improve coverage of lib/_http_client.js
PR-URL: https://github.com/nodejs/node/pull/38599
Refs: https://coverage.nodejs.org/coverage-f37c26b8a2e10d0a/lib/_http_client.js.html#L200
Reviewed-By: Rich Trott
Reviewed-By: Antoine du Hamel
Reviewed-By: James M Snell
Reviewed-By: Trivikram Kamat
---
test/parallel/test-http-createConnection.js | 56 +++++++++++--------
.../test-http-insecure-parser-per-stream.js | 12 ++++
2 files changed, 44 insertions(+), 24 deletions(-)
diff --git a/test/parallel/test-http-createConnection.js b/test/parallel/test-http-createConnection.js
index a65b9a158c679d..1425b964a75aa3 100644
--- a/test/parallel/test-http-createConnection.js
+++ b/test/parallel/test-http-createConnection.js
@@ -25,32 +25,36 @@ const http = require('http');
const net = require('net');
const assert = require('assert');
+function commonHttpGet(fn) {
+ if (typeof fn === 'function') {
+ fn = common.mustCall(fn);
+ }
+ return new Promise((resolve, reject) => {
+ http.get({ createConnection: fn }, (res) => {
+ resolve(res);
+ }).on('error', (err) => {
+ reject(err);
+ });
+ });
+}
+
const server = http.createServer(common.mustCall(function(req, res) {
res.end();
-}, 4)).listen(0, '127.0.0.1', function() {
- let fn = common.mustCall(createConnection);
- http.get({ createConnection: fn }, function(res) {
- res.resume();
- fn = common.mustCall(createConnectionAsync);
- http.get({ createConnection: fn }, function(res) {
- res.resume();
- fn = common.mustCall(createConnectionBoth1);
- http.get({ createConnection: fn }, function(res) {
- res.resume();
- fn = common.mustCall(createConnectionBoth2);
- http.get({ createConnection: fn }, function(res) {
- res.resume();
- fn = common.mustCall(createConnectionError);
- http.get({ createConnection: fn }, function(res) {
- assert.fail('Unexpected response callback');
- }).on('error', common.mustCall(function(err) {
- assert.strictEqual(err.message, 'Could not create socket');
- server.close();
- }));
- });
- });
- });
+}, 4)).listen(0, '127.0.0.1', async () => {
+ await commonHttpGet(createConnection);
+ await commonHttpGet(createConnectionAsync);
+ await commonHttpGet(createConnectionBoth1);
+ await commonHttpGet(createConnectionBoth2);
+
+ // Errors
+ await assert.rejects(() => commonHttpGet(createConnectionError), {
+ message: 'sync'
+ });
+ await assert.rejects(() => commonHttpGet(createConnectionAsyncError), {
+ message: 'async'
});
+
+ server.close();
});
function createConnection() {
@@ -78,5 +82,9 @@ function createConnectionBoth2(options, cb) {
}
function createConnectionError(options, cb) {
- process.nextTick(cb, new Error('Could not create socket'));
+ throw new Error('sync');
+}
+
+function createConnectionAsyncError(options, cb) {
+ process.nextTick(cb, new Error('async'));
}
diff --git a/test/parallel/test-http-insecure-parser-per-stream.js b/test/parallel/test-http-insecure-parser-per-stream.js
index d2b8ffe708770c..2ba245c8f419b1 100644
--- a/test/parallel/test-http-insecure-parser-per-stream.js
+++ b/test/parallel/test-http-insecure-parser-per-stream.js
@@ -80,3 +80,15 @@ const MakeDuplexPair = require('../common/duplexpair');
'Hello: foo\x08foo\r\n' +
'\r\n\r\n');
}
+
+// Test 5: Invalid argument type
+{
+ assert.throws(
+ () => http.request({ insecureHTTPParser: 0 }, common.mustNotCall()),
+ common.expectsError({
+ code: 'ERR_INVALID_ARG_TYPE',
+ message: 'The "options.insecureHTTPParser" property must be of' +
+ ' type boolean. Received type number (0)'
+ })
+ );
+}
From 6620a3182e1dd6f0c0dd6361ce0d37f42f65a4fc Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Wed, 12 May 2021 12:13:16 +0200
Subject: [PATCH 63/86] doc: add ESM code examples in url.md
PR-URL: https://github.com/nodejs/node/pull/38651
Reviewed-By: James M Snell
Reviewed-By: Masashi Hirano
---
doc/api/url.md | 79 +++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 66 insertions(+), 13 deletions(-)
diff --git a/doc/api/url.md b/doc/api/url.md
index ce528f5f6c8007..b64bbc405f455e 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -9,7 +9,11 @@
The `url` module provides utilities for URL resolution and parsing. It can be
accessed using:
-```js
+```mjs
+import url from 'url';
+```
+
+```cjs
const url = require('url');
```
@@ -61,7 +65,13 @@ const myURL =
Parsing the URL string using the Legacy API:
-```js
+```mjs
+import url from 'url';
+const myURL =
+ url.parse('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash');
+```
+
+```cjs
const url = require('url');
const myURL =
url.parse('https://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash');
@@ -135,7 +145,12 @@ const myURL = new URL('/foo', 'https://example.org/');
The URL constructor is accessible as a property on the global object.
It can also be imported from the built-in url module:
-```js
+```mjs
+import { URL } from 'url';
+console.log(URL === globalThis.URL); // Prints 'true'.
+```
+
+```cjs
console.log(URL === require('url').URL); // Prints 'true'.
```
@@ -573,10 +588,6 @@ and [`url.format()`][] methods would produce.
The `toString()` method on the `URL` object returns the serialized URL. The
value returned is equivalent to that of [`url.href`][] and [`url.toJSON()`][].
-Because of the need for standard compliance, this method does not allow users
-to customize the serialization process of the URL. For more flexibility,
-[`require('url').format()`][] method might be of interest.
-
#### `url.toJSON()`
* Returns: {string}
@@ -931,8 +942,20 @@ invalid domain, the empty string is returned.
It performs the inverse operation to [`url.domainToUnicode()`][].
-```js
+```mjs
+import url from 'url';
+
+console.log(url.domainToASCII('español.com'));
+// Prints xn--espaol-zwa.com
+console.log(url.domainToASCII('中文.com'));
+// Prints xn--fiq228c.com
+console.log(url.domainToASCII('xn--iñvalid.com'));
+// Prints an empty string
+```
+
+```cjs
const url = require('url');
+
console.log(url.domainToASCII('español.com'));
// Prints xn--espaol-zwa.com
console.log(url.domainToASCII('中文.com'));
@@ -956,8 +979,20 @@ domain, the empty string is returned.
It performs the inverse operation to [`url.domainToASCII()`][].
-```js
+```mjs
+import url from 'url';
+
+console.log(url.domainToUnicode('xn--espaol-zwa.com'));
+// Prints español.com
+console.log(url.domainToUnicode('xn--fiq228c.com'));
+// Prints 中文.com
+console.log(url.domainToUnicode('xn--iñvalid.com'));
+// Prints an empty string
+```
+
+```cjs
const url = require('url');
+
console.log(url.domainToUnicode('xn--espaol-zwa.com'));
// Prints español.com
console.log(url.domainToUnicode('xn--fiq228c.com'));
@@ -1079,7 +1114,26 @@ added: v15.7.0
This utility function converts a URL object into an ordinary options object as
expected by the [`http.request()`][] and [`https.request()`][] APIs.
-```js
+```mjs
+import { urlToHttpOptions } from 'url';
+const myURL = new URL('https://a:b@測試?abc#foo');
+
+console.log(urlToHttpOptions(myUrl));
+/**
+{
+ protocol: 'https:',
+ hostname: 'xn--g6w251d',
+ hash: '#foo',
+ search: '?abc',
+ pathname: '/',
+ path: '/?abc',
+ href: 'https://a:b@xn--g6w251d/?abc#foo',
+ auth: 'a:b'
+}
+*/
+```
+
+```cjs
const { urlToHttpOptions } = require('url');
const myURL = new URL('https://a:b@測試?abc#foo');
@@ -1124,8 +1178,8 @@ changes:
> Stability: 3 - Legacy: Use the WHATWG URL API instead.
-The legacy `urlObject` (`require('url').Url`) is created and returned by the
-`url.parse()` function.
+The legacy `urlObject` (`require('url').Url` or `import { Url } from 'url'`) is
+created and returned by the `url.parse()` function.
#### `urlObject.auth`
@@ -1499,7 +1553,6 @@ console.log(myURL.origin);
[`https.request()`]: https.md#https_https_request_options_callback
[`new URL()`]: #url_new_url_input_base
[`querystring`]: querystring.md
-[`require('url').format()`]: #url_url_format_url_options
[`url.domainToASCII()`]: #url_url_domaintoascii_domain
[`url.domainToUnicode()`]: #url_url_domaintounicode_domain
[`url.format()`]: #url_url_format_urlobject
From c4b161cb8952b4da0e6f5528fa59bf93d62d76c0 Mon Sep 17 00:00:00 2001
From: Qingyu Deng
Date: Wed, 12 May 2021 19:58:49 +0800
Subject: [PATCH 64/86] doc: change color of doctag on night mode
Fixes: https://github.com/nodejs/node/issues/38641
PR-URL: https://github.com/nodejs/node/pull/38652
Reviewed-By: Antoine du Hamel
Reviewed-By: Derek Lewis
Reviewed-By: Luigi Pinca
Reviewed-By: Rich Trott
Reviewed-By: Zijian Liu
Reviewed-By: Colin Ihrig
Reviewed-By: James M Snell
---
doc/api_assets/hljs.css | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/api_assets/hljs.css b/doc/api_assets/hljs.css
index dc5f1d41a65945..bbf076987530d6 100644
--- a/doc/api_assets/hljs.css
+++ b/doc/api_assets/hljs.css
@@ -36,7 +36,8 @@
}
.dark-mode .hljs-keyword,
-.dark-mode .hljs-attribute {
+.dark-mode .hljs-attribute,
+.dark-mode .hljs-doctag {
color: #66d9ef;
}
From 1765e32c45a3904cc250bc1bdb2333afb970b5e8 Mon Sep 17 00:00:00 2001
From: Gabriel Schulhof
Date: Fri, 14 May 2021 08:41:24 -0700
Subject: [PATCH 65/86] doc: update contact info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Gabriel Schulhof
PR-URL: https://github.com/nodejs/node/pull/38689
Reviewed-By: Anna Henningsen
Reviewed-By: Luigi Pinca
Reviewed-By: Richard Lau
Reviewed-By: Michael Dawson
Reviewed-By: Juan José Arboleda
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index cb52be2efb7436..7dd77cb0cedf55 100644
--- a/README.md
+++ b/README.md
@@ -176,7 +176,7 @@ For information about the governance of the Node.js project, see
* [fhinkel](https://github.com/fhinkel) -
**Franziska Hinkelmann** <franziska.hinkelmann@gmail.com> (she/her)
* [gabrielschulhof](https://github.com/gabrielschulhof) -
-**Gabriel Schulhof** <gabriel.schulhof@intel.com>
+**Gabriel Schulhof** <gabrielschulhof@gmail.com>
* [gireeshpunathil](https://github.com/gireeshpunathil) -
**Gireesh Punathil** <gpunathi@in.ibm.com> (he/him)
* [jasnell](https://github.com/jasnell) -
@@ -314,7 +314,7 @@ For information about the governance of the Node.js project, see
* [Flarna](https://github.com/Flarna) -
**Gerhard Stöbich** <deb2001-github@yahoo.de> (he/they)
* [gabrielschulhof](https://github.com/gabrielschulhof) -
-**Gabriel Schulhof** <gabriel.schulhof@intel.com>
+**Gabriel Schulhof** <gabrielschulhof@gmail.com>
* [gdams](https://github.com/gdams) -
**George Adams** <george.adams@uk.ibm.com> (he/him)
* [geek](https://github.com/geek) -
From 608d0e11f3007648276520e81d6d9672a434f10b Mon Sep 17 00:00:00 2001
From: Ruy Adorno
Date: Thu, 13 May 2021 16:18:53 -0400
Subject: [PATCH 66/86] deps: upgrade npm to 7.13.0
PR-URL: https://github.com/nodejs/node/pull/38682
Reviewed-By: Rich Trott
Reviewed-By: Danielle Adams
Reviewed-By: Trivikram Kamat
Reviewed-By: Luigi Pinca
Reviewed-By: Colin Ihrig
---
deps/npm/CHANGELOG.md | 18 +++
deps/npm/docs/content/commands/npm-fund.md | 56 ++++++++
deps/npm/docs/content/commands/npm-publish.md | 7 +
deps/npm/docs/output/commands/npm-fund.html | 45 ++++++
deps/npm/docs/output/commands/npm-ls.html | 2 +-
.../npm/docs/output/commands/npm-publish.html | 9 ++
deps/npm/docs/output/commands/npm.html | 2 +-
deps/npm/lib/fund.js | 16 ++-
deps/npm/lib/publish.js | 76 ++++++----
deps/npm/lib/workspaces/arborist-cmd.js | 24 ++++
deps/npm/man/man1/npm-fund.1 | 67 +++++++++
deps/npm/man/man1/npm-ls.1 | 2 +-
deps/npm/man/man1/npm-publish.1 | 7 +
deps/npm/man/man1/npm.1 | 2 +-
.../@npmcli/arborist/lib/arborist/index.js | 23 +++
.../arborist/lib/get-workspace-nodes.js | 33 +++++
.../@npmcli/arborist/package.json | 2 +-
deps/npm/node_modules/libnpmfund/CHANGELOG.md | 6 -
deps/npm/node_modules/libnpmfund/README.md | 5 +-
deps/npm/node_modules/libnpmfund/index.js | 63 +++++----
deps/npm/node_modules/libnpmfund/package.json | 19 ++-
deps/npm/package.json | 8 +-
.../tap-snapshots/test/lib/fund.js.test.cjs | 20 +++
.../test/lib/publish.js.test.cjs | 103 ++++++++++++++
.../test/lib/utils/npm-usage.js.test.cjs | 3 +
deps/npm/test/lib/fund.js | 86 ++++++++++++
deps/npm/test/lib/publish.js | 132 +++++++++++++++---
deps/npm/test/lib/workspaces/arborist-cmd.js | 109 +++++++++++++++
28 files changed, 846 insertions(+), 99 deletions(-)
create mode 100644 deps/npm/lib/workspaces/arborist-cmd.js
create mode 100644 deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js
delete mode 100644 deps/npm/node_modules/libnpmfund/CHANGELOG.md
create mode 100644 deps/npm/test/lib/workspaces/arborist-cmd.js
diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md
index bed0f87c2b80c9..1c36c70875f722 100644
--- a/deps/npm/CHANGELOG.md
+++ b/deps/npm/CHANGELOG.md
@@ -1,3 +1,21 @@
+## v7.13.0 (2021-05-13)
+
+* [`076420c14`](https://github.com/npm/cli/commit/076420c149d097056f687e44e21744b743b86e4e)
+ [#3231](https://github.com/npm/cli/issues/3231)
+ feat(publish): add workspace support
+ ([@wraithgar](https://github.com/wraithgar))
+* [`370b36a36`](https://github.com/npm/cli/commit/370b36a36ca226840761e4214cbccaf2a1a90e3c)
+ [#3241](https://github.com/npm/cli/issues/3241)
+ feat(fund): add workspaces support
+ ([@ruyadorno](https://github.com/ruyadorno))
+
+### DEPENDENCIES
+
+* [`0c18e4f77`](https://github.com/npm/cli/commit/0c18e4f774562fa054fedf323bea25805ebf39b3)
+ `@npmcli/arborist@2.5.0`
+* [`b551c6811`](https://github.com/npm/cli/commit/b551c6811251dbc901f47fea3c137f93e205a9e4)
+ `libnpmfund@1.1.0`
+
## v7.12.1 (2021-05-10)
### BUG FIXES
diff --git a/deps/npm/docs/content/commands/npm-fund.md b/deps/npm/docs/content/commands/npm-fund.md
index aa1b26b9a8971b..45c5dfaac2afc2 100644
--- a/deps/npm/docs/content/commands/npm-fund.md
+++ b/deps/npm/docs/content/commands/npm-fund.md
@@ -8,6 +8,7 @@ description: Retrieve funding information
```bash
npm fund []
+npm fund [-w ]
```
### Description
@@ -24,6 +25,43 @@ The list will avoid duplicated entries and will stack all packages that
share the same url as a single entry. Thus, the list does not have the same
shape of the output from `npm ls`.
+#### Example
+
+### Workspaces support
+
+It's possible to filter the results to only include a single workspace and its
+dependencies using the `workspace` config option.
+
+#### Example:
+
+Here's an example running `npm fund` in a project with a configured
+workspace `a`:
+
+```bash
+$ npm fund
+test-workspaces-fund@1.0.0
++-- https://example.com/a
+| | `-- a@1.0.0
+| `-- https://example.com/maintainer
+| `-- foo@1.0.0
++-- https://example.com/npmcli-funding
+| `-- @npmcli/test-funding
+`-- https://example.com/org
+ `-- bar@2.0.0
+```
+
+And here is an example of the expected result when filtering only by
+a specific workspace `a` in the same project:
+
+```bash
+$ npm fund -w a
+test-workspaces-fund@1.0.0
+`-- https://example.com/a
+ | `-- a@1.0.0
+ `-- https://example.com/maintainer
+ `-- foo@2.0.0
+```
+
### Configuration
#### browser
@@ -48,6 +86,23 @@ Show information in JSON format.
Whether to represent the tree structure using unicode characters.
Set it to `false` in order to use all-ansi output.
+#### `workspace`
+
+* Default:
+* Type: String (can be set multiple times)
+
+Enable running a command in the context of the configured workspaces of the
+current project while filtering by running only the workspaces defined by
+this configuration option.
+
+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
+nested workspaces)
+
+This value is not exported to the environment for child processes.
+
#### which
* Type: Number
@@ -61,3 +116,4 @@ If there are multiple funding sources, which 1-indexed source URL to open.
* [npm docs](/commands/npm-docs)
* [npm ls](/commands/npm-ls)
* [npm config](/commands/npm-config)
+* [npm workspaces](/using-npm/workspaces)
diff --git a/deps/npm/docs/content/commands/npm-publish.md b/deps/npm/docs/content/commands/npm-publish.md
index fc13e672223589..10e65f895ec5bc 100644
--- a/deps/npm/docs/content/commands/npm-publish.md
+++ b/deps/npm/docs/content/commands/npm-publish.md
@@ -47,6 +47,13 @@ by specifying a different default registry or using a
actually publishing to the registry. Reports the details of what would
have been published.
+* `[--workspaces]`: Enables workspace context while publishing. All
+ workspace packages will be published.
+
+* `[--workspace]`: Enables workspaces context and limits results to only
+ those specified by this config item. Only the packages in the
+ workspaces given will be published.
+
The publish will fail if the package name and version combination already
exists in the specified registry.
diff --git a/deps/npm/docs/output/commands/npm-fund.html b/deps/npm/docs/output/commands/npm-fund.html
index bd9118fe326559..16539cfd998685 100644
--- a/deps/npm/docs/output/commands/npm-fund.html
+++ b/deps/npm/docs/output/commands/npm-fund.html
@@ -146,6 +146,7 @@
Table of contents
Synopsis
npm fund [<pkg>]
+npm fund [-w <workspace-name>]
Description
This command retrieves information on how to fund the dependencies of a
@@ -158,6 +159,33 @@
Description
The list will avoid duplicated entries and will stack all packages that
share the same url as a single entry. Thus, the list does not have the same
shape of the output from npm ls.
+
Example
+
Workspaces support
+
It’s possible to filter the results to only include a single workspace and its
+dependencies using the workspace config option.
+
Example:
+
Here’s an example running npm fund in a project with a configured
+workspace a:
And here is an example of the expected result when filtering only by
+a specific workspace a in the same project:
+
$ npm fund -w a
+test-workspaces-fund@1.0.0
+`-- https://example.com/a
+ | `-- a@1.0.0
+ `-- https://example.com/maintainer
+ `-- foo@2.0.0
+
Configuration
browser
@@ -178,6 +206,22 @@
unicode
Whether to represent the tree structure using unicode characters.
Set it to false in order to use all-ansi output.
+
workspace
+
+
Default:
+
Type: String (can be set multiple times)
+
+
Enable running a command in the context of the configured workspaces of the
+current project while filtering by running only the workspaces defined by
+this configuration option.
+
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
+nested workspaces)
+
+
This value is not exported to the environment for child processes.
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:
-
actually publishing to the registry. Reports the details of what would
have been published.
+
+
[--workspaces]: Enables workspace context while publishing. All
+workspace packages will be published.
+
+
+
[--workspace]: Enables workspaces context and limits results to only
+those specified by this config item. Only the packages in the
+workspaces given will be published.
+
The publish will fail if the package name and version combination already
exists in the specified registry.
npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
diff --git a/deps/npm/lib/fund.js b/deps/npm/lib/fund.js
index 25d3462f638693..55d2f65dc4b55c 100644
--- a/deps/npm/lib/fund.js
+++ b/deps/npm/lib/fund.js
@@ -13,15 +13,14 @@ const {
const completion = require('./utils/completion/installed-deep.js')
const openUrl = require('./utils/open-url.js')
+const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js')
const getPrintableName = ({ name, version }) => {
const printableVersion = version ? `@${version}` : ''
return `${name}${printableVersion}`
}
-const BaseCommand = require('./base-command.js')
-
-class Fund extends BaseCommand {
+class Fund extends ArboristWorkspaceCmd {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get description () {
return 'Retrieve funding information'
@@ -38,6 +37,7 @@ class Fund extends BaseCommand {
'json',
'browser',
'unicode',
+ 'workspace',
'which',
]
}
@@ -92,10 +92,16 @@ class Fund extends BaseCommand {
return
}
+ const fundingInfo = getFundingInfo(tree, {
+ ...this.flatOptions,
+ log: this.npm.log,
+ workspaces: this.workspaces,
+ })
+
if (this.npm.config.get('json'))
- this.npm.output(this.printJSON(getFundingInfo(tree)))
+ this.npm.output(this.printJSON(fundingInfo))
else
- this.npm.output(this.printHuman(getFundingInfo(tree)))
+ this.npm.output(this.printHuman(fundingInfo))
}
printJSON (fundingInfo) {
diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js
index b121cb3d36773a..b33839903a266d 100644
--- a/deps/npm/lib/publish.js
+++ b/deps/npm/lib/publish.js
@@ -8,13 +8,19 @@ const pacote = require('pacote')
const npa = require('npm-package-arg')
const npmFetch = require('npm-registry-fetch')
-const flatten = require('./utils/config/flatten.js')
const otplease = require('./utils/otplease.js')
const { getContents, logTar } = require('./utils/tar.js')
+const getWorkspaces = require('./workspaces/get-workspaces.js')
+
+// for historical reasons, publishConfig in package.json can contain ANY config
+// keys that npm supports in .npmrc files and elsewhere. We *may* want to
+// revisit this at some point, and have a minimal set that's a SemVer-major
+// change that ought to get a RFC written on it.
+const flatten = require('./utils/config/flatten.js')
-// this is the only case in the CLI where we use the old full slow
-// 'read-package-json' module, because we want to pull in all the
-// defaults and metadata, like git sha's and default scripts and all that.
+// this is the only case in the CLI where we want to use the old full slow
+// 'read-package-json' module, because we want to pull in all the defaults and
+// metadata, like git sha's and default scripts and all that.
const readJson = util.promisify(require('read-package-json'))
const BaseCommand = require('./base-command.js')
@@ -30,7 +36,7 @@ class Publish extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get params () {
- return ['tag', 'access', 'dry-run']
+ return ['tag', 'access', 'dry-run', 'workspace', 'workspaces']
}
/* istanbul ignore next - see test/lib/load-all-commands.js */
@@ -44,6 +50,10 @@ class Publish extends BaseCommand {
this.publish(args).then(() => cb()).catch(cb)
}
+ execWorkspaces (args, filters, cb) {
+ this.publishWorkspaces(args, filters).then(() => cb()).catch(cb)
+ }
+
async publish (args) {
if (args.length === 0)
args = ['.']
@@ -56,6 +66,7 @@ class Publish extends BaseCommand {
const dryRun = this.npm.config.get('dry-run')
const json = this.npm.config.get('json')
const defaultTag = this.npm.config.get('tag')
+ const silent = log.level === 'silent'
if (semver.validRange(defaultTag))
throw new Error('Tag name must not be a valid SemVer range: ' + defaultTag.trim())
@@ -68,7 +79,7 @@ class Publish extends BaseCommand {
let manifest = await this.getManifest(spec, opts)
if (manifest.publishConfig)
- Object.assign(opts, this.publishConfigToOpts(manifest.publishConfig))
+ flatten(manifest.publishConfig, opts)
// only run scripts for directory type publishes
if (spec.type === 'directory') {
@@ -77,7 +88,7 @@ class Publish extends BaseCommand {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
- banner: log.level !== 'silent',
+ banner: !silent,
})
}
@@ -89,7 +100,7 @@ class Publish extends BaseCommand {
// note that publishConfig might have changed as well!
manifest = await this.getManifest(spec, opts)
if (manifest.publishConfig)
- Object.assign(opts, this.publishConfigToOpts(manifest.publishConfig))
+ flatten(manifest.publishConfig, opts)
// note that logTar calls npmlog.notice(), so if we ARE in silent mode,
// this will do nothing, but we still want it in the debuglog if it fails.
@@ -114,7 +125,7 @@ class Publish extends BaseCommand {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
- banner: log.level !== 'silent',
+ banner: !silent,
})
await runScript({
@@ -122,19 +133,43 @@ class Publish extends BaseCommand {
path: spec.fetchSpec,
stdio: 'inherit',
pkg: manifest,
- banner: log.level !== 'silent',
+ banner: !silent,
})
}
- const silent = log.level === 'silent'
- if (!silent && json)
- this.npm.output(JSON.stringify(pkgContents, null, 2))
- else if (!silent)
- this.npm.output(`+ ${pkgContents.id}`)
+ if (!this.workspaces) {
+ if (!silent && json)
+ this.npm.output(JSON.stringify(pkgContents, null, 2))
+ else if (!silent)
+ this.npm.output(`+ ${pkgContents.id}`)
+ }
return pkgContents
}
+ async publishWorkspaces (args, filters) {
+ // Suppresses JSON output in publish() so we can handle it here
+ this.workspaces = true
+
+ const results = {}
+ const json = this.npm.config.get('json')
+ const silent = log.level === 'silent'
+ const workspaces =
+ await getWorkspaces(filters, { path: this.npm.localPrefix })
+ for (const [name, workspace] of workspaces.entries()) {
+ const pkgContents = await this.publish([workspace])
+ // This needs to be in-line w/ the rest of the output that non-JSON
+ // publish generates
+ if (!silent && !json)
+ this.npm.output(`+ ${pkgContents.id}`)
+ else
+ results[name] = pkgContents
+ }
+
+ if (!silent && json)
+ this.npm.output(JSON.stringify(results, null, 2))
+ }
+
// if it's a directory, read it from the file system
// otherwise, get the full metadata from whatever it is
getManifest (spec, opts) {
@@ -142,16 +177,5 @@ class Publish extends BaseCommand {
return readJson(`${spec.fetchSpec}/package.json`)
return pacote.manifest(spec, { ...opts, fullMetadata: true })
}
-
- // for historical reasons, publishConfig in package.json can contain
- // ANY config keys that npm supports in .npmrc files and elsewhere.
- // We *may* want to revisit this at some point, and have a minimal set
- // that's a SemVer-major change that ought to get a RFC written on it.
- publishConfigToOpts (publishConfig) {
- // create a new object that inherits from the config stack
- // then squash the css-case into camelCase opts, like we do
- // this is Object.assign()'ed onto the base npm.flatOptions
- return flatten(publishConfig, {})
- }
}
module.exports = Publish
diff --git a/deps/npm/lib/workspaces/arborist-cmd.js b/deps/npm/lib/workspaces/arborist-cmd.js
new file mode 100644
index 00000000000000..f08843bd9ea5a8
--- /dev/null
+++ b/deps/npm/lib/workspaces/arborist-cmd.js
@@ -0,0 +1,24 @@
+// This is the base for all commands whose execWorkspaces just gets
+// a list of workspace names and passes it on to new Arborist() to
+// be able to run a filtered Arborist.reify() at some point.
+
+const BaseCommand = require('../base-command.js')
+const getWorkspaces = require('../workspaces/get-workspaces.js')
+class ArboristCmd extends BaseCommand {
+ /* istanbul ignore next - see test/lib/load-all-commands.js */
+ static get params () {
+ return [
+ 'workspace',
+ ]
+ }
+
+ execWorkspaces (args, filters, cb) {
+ getWorkspaces(filters, { path: this.npm.localPrefix })
+ .then(workspaces => {
+ this.workspaces = [...workspaces.keys()]
+ this.exec(args, cb)
+ })
+ }
+}
+
+module.exports = ArboristCmd
diff --git a/deps/npm/man/man1/npm-fund.1 b/deps/npm/man/man1/npm-fund.1
index 81a277bb0087c2..aa21dad231882a 100644
--- a/deps/npm/man/man1/npm-fund.1
+++ b/deps/npm/man/man1/npm-fund.1
@@ -6,6 +6,7 @@
.RS 2
.nf
npm fund []
+npm fund [\-w ]
.fi
.RE
.SS Description
@@ -21,6 +22,44 @@ to pass the \fB\-\-which\fP option to disambiguate\.
The list will avoid duplicated entries and will stack all packages that
share the same url as a single entry\. Thus, the list does not have the same
shape of the output from \fBnpm ls\fP\|\.
+.SS Example
+.SS Workspaces support
+.P
+It's possible to filter the results to only include a single workspace and its
+dependencies using the \fBworkspace\fP config option\.
+.SS Example:
+.P
+Here's an example running \fBnpm fund\fP in a project with a configured
+workspace \fBa\fP:
+.P
+.RS 2
+.nf
+$ npm fund
+test\-workspaces\-fund@1\.0\.0
++\-\- https://example\.com/a
+| | `\-\- a@1\.0\.0
+| `\-\- https://example\.com/maintainer
+| `\-\- foo@1\.0\.0
++\-\- https://example\.com/npmcli\-funding
+| `\-\- @npmcli/test\-funding
+`\-\- https://example\.com/org
+ `\-\- bar@2\.0\.0
+.fi
+.RE
+.P
+And here is an example of the expected result when filtering only by
+a specific workspace \fBa\fP in the same project:
+.P
+.RS 2
+.nf
+$ npm fund \-w a
+test\-workspaces\-fund@1\.0\.0
+`\-\- https://example\.com/a
+ | `\-\- a@1\.0\.0
+ `\-\- https://example\.com/maintainer
+ `\-\- foo@2\.0\.0
+.fi
+.RE
.SS Configuration
.SS browser
.RS 0
@@ -53,6 +92,32 @@ Default: true
.P
Whether to represent the tree structure using unicode characters\.
Set it to \fBfalse\fP in order to use all\-ansi output\.
+.SS \fBworkspace\fP
+.RS 0
+.IP \(bu 2
+Default:
+.IP \(bu 2
+Type: String (can be set multiple times)
+
+.RE
+.P
+Enable running a command in the context of the configured workspaces of the
+current project while filtering by running only the workspaces defined by
+this configuration option\.
+.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
+nested workspaces)
+
+.RE
+.P
+This value is not exported to the environment for child processes\.
.SS which
.RS 0
.IP \(bu 2
@@ -73,5 +138,7 @@ npm help docs
npm help ls
.IP \(bu 2
npm help config
+.IP \(bu 2
+npm help workspaces
.RE
diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1
index c47da91875482f..d7013b296440c0 100644
--- a/deps/npm/man/man1/npm-ls.1
+++ b/deps/npm/man/man1/npm-ls.1
@@ -26,7 +26,7 @@ example, running \fBnpm ls promzard\fP in npm's source tree will show:
.P
.RS 2
.nf
-npm@7\.12\.1 /path/to/npm
+npm@7\.13\.0 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.fi
diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1
index c405f64f27e361..906c5a36e194fe 100644
--- a/deps/npm/man/man1/npm-publish.1
+++ b/deps/npm/man/man1/npm-publish.1
@@ -45,6 +45,13 @@ from a TTY then you'll be prompted\.
\fB[\-\-dry\-run]\fP: As of \fBnpm@6\fP, does everything publish would do except
actually publishing to the registry\. Reports the details of what would
have been published\.
+.IP \(bu 2
+\fB[\-\-workspaces]\fP: Enables workspace context while publishing\. All
+workspace packages will be published\.
+.IP \(bu 2
+\fB[\-\-workspace]\fP: Enables workspaces context and limits results to only
+those specified by this config item\. Only the packages in the
+workspaces given will be published\.
.RE
.P
diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1
index 4562527e1b5ade..4921bcc656a555 100644
--- a/deps/npm/man/man1/npm.1
+++ b/deps/npm/man/man1/npm.1
@@ -10,7 +10,7 @@ npm [args]
.RE
.SS Version
.P
-7\.12\.1
+7\.13\.0
.SS Description
.P
npm is the package manager for the Node JavaScript platform\. It puts
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 3578d50389ea64..cd39df01af6c6f 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
@@ -45,6 +45,7 @@ const mixins = [
]
const Base = mixins.reduce((a, b) => b(a), require('events'))
+const getWorkspaceNodes = require('../get-workspace-nodes.js')
class Arborist extends Base {
constructor (options = {}) {
@@ -64,6 +65,28 @@ class Arborist extends Base {
this.path = resolve(this.options.path)
process.emit('timeEnd', 'arborist:ctor')
}
+
+ // returns an array of the actual nodes for all the workspaces
+ workspaceNodes (tree, workspaces) {
+ return getWorkspaceNodes(tree, workspaces, this.log)
+ }
+
+ // returns a set of workspace nodes and all their deps
+ workspaceDependencySet (tree, workspaces) {
+ const wsNodes = this.workspaceNodes(tree, workspaces)
+ const set = new Set(wsNodes)
+ for (const node of set) {
+ for (const edge of node.edgesOut.values()) {
+ const dep = edge.to
+ if (dep) {
+ set.add(dep)
+ if (dep.target)
+ set.add(dep.target)
+ }
+ }
+ }
+ return set
+ }
}
module.exports = Arborist
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js b/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js
new file mode 100644
index 00000000000000..6db489f69c5185
--- /dev/null
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/get-workspace-nodes.js
@@ -0,0 +1,33 @@
+// Get the actual nodes corresponding to a root node's child workspaces,
+// given a list of workspace names.
+const relpath = require('./relpath.js')
+const getWorkspaceNodes = (tree, workspaces, log) => {
+ const wsMap = tree.workspaces
+ if (!wsMap) {
+ log.warn('workspaces', 'filter set, but no workspaces present')
+ return []
+ }
+
+ const nodes = []
+ for (const name of workspaces) {
+ const path = wsMap.get(name)
+ if (!path) {
+ log.warn('workspaces', `${name} in filter set, but not in workspaces`)
+ continue
+ }
+
+ const loc = relpath(tree.realpath, path)
+ const node = tree.inventory.get(loc)
+
+ if (!node) {
+ log.warn('workspaces', `${name} in filter set, but no workspace folder present`)
+ continue
+ }
+
+ nodes.push(node)
+ }
+
+ return nodes
+}
+
+module.exports = getWorkspaceNodes
diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index bbe87d8bf97ad2..fd579cbf27fdc8 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.4.4",
+ "version": "2.5.0",
"description": "Manage node_modules trees",
"dependencies": {
"@npmcli/installed-package-contents": "^1.0.7",
diff --git a/deps/npm/node_modules/libnpmfund/CHANGELOG.md b/deps/npm/node_modules/libnpmfund/CHANGELOG.md
deleted file mode 100644
index b890b58e1405ae..00000000000000
--- a/deps/npm/node_modules/libnpmfund/CHANGELOG.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Changelog
-
-## 0.0.0-pre.0
-
-- Initial pre-release.
-
diff --git a/deps/npm/node_modules/libnpmfund/README.md b/deps/npm/node_modules/libnpmfund/README.md
index c373a9ceb7dd57..8ab663f634d6fb 100644
--- a/deps/npm/node_modules/libnpmfund/README.md
+++ b/deps/npm/node_modules/libnpmfund/README.md
@@ -73,7 +73,10 @@ Options:
- `countOnly`: Uses the tree-traversal logic from **npm fund** but skips over
any obj definition and just returns an obj containing `{ length }` - useful for
things such as printing a `6 packages are looking for funding` msg.
-- `path`: Location to current working directory
+- `workspaces`: `Array` List of workspaces names to filter for,
+the result will only include a subset of the resulting tree that includes
+only the nodes that are children of the listed workspaces names.
+- `path`, `registry` and more [Arborist](https://github.com/npm/arborist/) options.
##### `> fund.readTree(tree, [opts]) -> Promise