From f2cef54b6f93526c9c33db6bb2bf203c6e40859b Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Mon, 29 Mar 2021 15:27:51 -0400 Subject: [PATCH] deps: upgrade npm to 7.7.6 PR-URL: https://github.com/nodejs/node/pull/37968 Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig --- deps/npm/AUTHORS | 2 + deps/npm/CHANGELOG.md | 28 ++++++++++++++ deps/npm/docs/content/using-npm/config.md | 2 +- deps/npm/docs/content/using-npm/workspaces.md | 2 +- deps/npm/docs/output/commands/npm-ls.html | 2 +- deps/npm/docs/output/commands/npm.html | 2 +- deps/npm/docs/output/using-npm/config.html | 2 +- .../npm/docs/output/using-npm/workspaces.html | 2 +- deps/npm/lib/cli.js | 4 +- deps/npm/lib/utils/config/definitions.js | 2 +- deps/npm/man/man1/npm-ls.1 | 2 +- deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man7/config.7 | 2 +- deps/npm/man/man7/workspaces.7 | 2 +- .../metavuln-calculator/lib/get-dep-spec.js | 6 +-- .../@npmcli/metavuln-calculator/package.json | 2 +- deps/npm/node_modules/libnpmversion/README.md | 5 +++ .../node_modules/libnpmversion/lib/index.js | 2 + .../node_modules/libnpmversion/package.json | 2 +- deps/npm/node_modules/npm-packlist/index.js | 9 ++++- .../node_modules/npm-packlist/package.json | 4 +- deps/npm/package.json | 8 ++-- .../smoke-tests-index.js-TAP.test.js | 37 +++++++++++++++++++ ...b-utils-config-describe-all.js-TAP.test.js | 2 +- deps/npm/test/lib/cli.js | 29 +++++++++++++-- 25 files changed, 131 insertions(+), 31 deletions(-) diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index c4a8c4e45ec..a257559bbf5 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -768,3 +768,5 @@ kbayrhammer James Chen-Smith Yash Singh Danielle Church +Seth Thomas +Andreas diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index 74f5b5f1c58..b4fbc426b78 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,31 @@ +## v7.7.6 (2021-03-29) + +### BUG FIXES + +* [`9dd2ed518`](https://github.com/npm/cli/commit/9dd2ed5189b6f283094664e9e192cf1598ec3f79) + fix empty newline printed to stderr + ([@ruyadorno](https://github.com/ruyadorno)) +* [`9d391462a`](https://github.com/npm/cli/commit/9d391462a25f637219501e2430ef1f7b89710816) + [#2973](https://github.com/npm/cli/issues/2973) + fix spelling in workspaces.md file + ([@sethomas](https://github.com/sethomas)) +* [`4b100249a`](https://github.com/npm/cli/commit/4b100249a6cad67e002186816e64817313b636c7) + [#2979](https://github.com/npm/cli/issues/2979) + change 'maxsockets' default value back to 15 + ([@wallrat](https://github.com/wallrat)) + +### DEPENDENCIES + +* [`a28f89572`](https://github.com/npm/cli/commit/a28f89572a708cced69cc938f877eaa969dbad9e) + `libnpmversion@1.1.0` + * fix reading `script-shell` config on `npm version` lifecycle scripts +* [`03734c29e`](https://github.com/npm/cli/commit/03734c29e00191d17f164d1c0e75d9f228268842) + `npm-packlist@2.1.5` + * fix packaging `bundledDependencies` +* [`80ce2a019`](https://github.com/npm/cli/commit/80ce2a019526632b01b70e1c75c42608dc160332) + `@npmcli/metavuln-calculator@1.1.1` + * fix error auditing package documents with missing dependencies + ## v7.7.5 (2021-03-25) ### BUG FIXES diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index c701a361afb..cfce5396f40 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -795,7 +795,7 @@ Show extended information in `npm ls` and `npm search`. #### `maxsockets` -* Default: Infinity +* Default: 15 * Type: Number The maximum number of connections to use per origin (protocol/host/port diff --git a/deps/npm/docs/content/using-npm/workspaces.md b/deps/npm/docs/content/using-npm/workspaces.md index 28fccd2200c..ab37cc16c22 100644 --- a/deps/npm/docs/content/using-npm/workspaces.md +++ b/deps/npm/docs/content/using-npm/workspaces.md @@ -90,7 +90,7 @@ nested workspaces to be consumed elsewhere. ### Running commands in the context of workspaces -You man use the `workspace` configuration option to run commands in the context +You can use the `workspace` configuration option to run commands in the context of a configured workspace. Following is a quick example on how to use the `npm run` command in the context diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index 9b4aa1b0abf..914d1d12144 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@ tree at all, use npm explain the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm’s source tree will show:

-
npm@7.7.5 /path/to/npm
+
npm@7.7.6 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 
diff --git a/deps/npm/docs/output/commands/npm.html b/deps/npm/docs/output/commands/npm.html index e6cd6878a22..c71daa36198 100644 --- a/deps/npm/docs/output/commands/npm.html +++ b/deps/npm/docs/output/commands/npm.html @@ -148,7 +148,7 @@ npm command-line interface
npm <command> [args]
 

Version

-

7.7.5

+

7.7.6

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 diff --git a/deps/npm/docs/output/using-npm/config.html b/deps/npm/docs/output/using-npm/config.html index 6fe8f828157..717f1021e5c 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -811,7 +811,7 @@ npm registry. Must be IPv4 in versions of Node prior to 0.12.

Show extended information in npm ls and npm search.

maxsockets

    -
  • Default: Infinity
  • +
  • Default: 15
  • Type: Number

The maximum number of connections to use per origin (protocol/host/port diff --git a/deps/npm/docs/output/using-npm/workspaces.html b/deps/npm/docs/output/using-npm/workspaces.html index 0fb1391c797..66ab8b1f793 100644 --- a/deps/npm/docs/output/using-npm/workspaces.html +++ b/deps/npm/docs/output/using-npm/workspaces.html @@ -207,7 +207,7 @@ console.log(moduleA) // -> a in such a way that is also easy to publish these nested workspaces to be consumed elsewhere.

Running commands in the context of workspaces

-

You man use the workspace configuration option to run commands in the context +

You can use the workspace configuration option to run commands in the context of a configured workspace.

Following is a quick example on how to use the npm run command in the context of nested workspaces. For a project containing multiple workspaces, e.g:

diff --git a/deps/npm/lib/cli.js b/deps/npm/lib/cli.js index 46859f150e3..f42132f9443 100644 --- a/deps/npm/lib/cli.js +++ b/deps/npm/lib/cli.js @@ -61,9 +61,6 @@ module.exports = (process) => { impl(npm.argv, errorHandler) else { try { - // I don't know why this is needed but we get a cb() not called if we - // omit it - npm.log.level = 'silent' if (cmd) { const didYouMean = require('./utils/did-you-mean.js') const suggestions = await didYouMean(npm, npm.localPrefix, cmd) @@ -71,6 +68,7 @@ module.exports = (process) => { } else npm.output(npm.usage) process.exitCode = 1 + return errorHandler() } catch (err) { errorHandler(err) } diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index 512ea8af98c..db66aa495ba 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -1154,7 +1154,7 @@ define('long', { }) define('maxsockets', { - default: Infinity, + default: 15, type: Number, description: ` The maximum number of connections to use per origin (protocol/host/port diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index b1fd65b15be..61b45baff32 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\.7\.5 /path/to/npm +npm@7\.7\.6 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index 81e5ab92149..db27e4087d1 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\.7\.5 +7\.7\.6 .SS Description .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man7/config.7 b/deps/npm/man/man7/config.7 index bd581c88809..d232871c0c5 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1065,7 +1065,7 @@ Show extended information in \fBnpm ls\fP and \fBnpm search\fP\|\. .SS \fBmaxsockets\fP .RS 0 .IP \(bu 2 -Default: Infinity +Default: 15 .IP \(bu 2 Type: Number diff --git a/deps/npm/man/man7/workspaces.7 b/deps/npm/man/man7/workspaces.7 index 2fa6a9ccccd..f8c5a0c4d44 100644 --- a/deps/npm/man/man7/workspaces.7 +++ b/deps/npm/man/man7/workspaces.7 @@ -92,7 +92,7 @@ in such a way that is also easy to npm help publish these nested workspaces to be consumed elsewhere\. .SS Running commands in the context of workspaces .P -You man use the \fBworkspace\fP configuration option to run commands in the context +You can use the \fBworkspace\fP configuration option to run commands in the context of a configured workspace\. .P Following is a quick example on how to use the \fBnpm run\fP command in the context diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js index 35e83d02a1b..8d1d72b8c46 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/lib/get-dep-spec.js @@ -8,8 +8,8 @@ module.exports = (mani, name) => { peerDependencies: peerDeps = {}, } = mani - return typeof deps[name] === 'string' ? deps[name] - : typeof optDeps[name] === 'string' ? optDeps[name] - : typeof peerDeps[name] === 'string' ? peerDeps[name] + return deps && typeof deps[name] === 'string' ? deps[name] + : optDeps && typeof optDeps[name] === 'string' ? optDeps[name] + : peerDeps && typeof peerDeps[name] === 'string' ? peerDeps[name] : null } diff --git a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json index f7a4f5cc47a..4ad6193ae6a 100644 --- a/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json +++ b/deps/npm/node_modules/@npmcli/metavuln-calculator/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/metavuln-calculator", - "version": "1.1.0", + "version": "1.1.1", "main": "lib/index.js", "files": [ "lib" diff --git a/deps/npm/node_modules/libnpmversion/README.md b/deps/npm/node_modules/libnpmversion/README.md index daa0b88157c..e82e7cd6f87 100644 --- a/deps/npm/node_modules/libnpmversion/README.md +++ b/deps/npm/node_modules/libnpmversion/README.md @@ -25,6 +25,7 @@ npmVersion(arg, { signGitTag: false, // default false, gpg sign the git tag force: false, // push forward recklessly if any problems happen ignoreScripts: false, // do not run pre/post/version lifecycle scripts + scriptShell: '/bin/bash', // shell to run lifecycle scripts in message: 'v%s', // message for tag and commit, replace %s with the version }).then(newVersion => { console.error('version updated!', newVersion) @@ -149,6 +150,10 @@ Push forward recklessly if any problems happen. Default `false`. Do not run pre/post/version lifecycle scripts. Default `false`. +#### `scriptShell` String + +Path to the shell, which should execute the lifecycle scripts. Defaults to `/bin/sh` on unix, or `cmd.exe` on windows. + #### `message` String The message for the git commit and annotated git tag that are created. diff --git a/deps/npm/node_modules/libnpmversion/lib/index.js b/deps/npm/node_modules/libnpmversion/lib/index.js index c3f554834bf..683941cdea4 100644 --- a/deps/npm/node_modules/libnpmversion/lib/index.js +++ b/deps/npm/node_modules/libnpmversion/lib/index.js @@ -13,6 +13,7 @@ module.exports = async (newversion, opts = {}) => { signGitTag = false, force = false, ignoreScripts = false, + scriptShell = undefined, preid = null, log = proclog, message = 'v%s', @@ -31,6 +32,7 @@ module.exports = async (newversion, opts = {}) => { signGitTag, force, ignoreScripts, + scriptShell, preid, pkg, log, diff --git a/deps/npm/node_modules/libnpmversion/package.json b/deps/npm/node_modules/libnpmversion/package.json index 0135c21e723..30d94c7a146 100644 --- a/deps/npm/node_modules/libnpmversion/package.json +++ b/deps/npm/node_modules/libnpmversion/package.json @@ -1,6 +1,6 @@ { "name": "libnpmversion", - "version": "1.0.12", + "version": "1.1.0", "main": "lib/index.js", "files": [ "lib/*.js" diff --git a/deps/npm/node_modules/npm-packlist/index.js b/deps/npm/node_modules/npm-packlist/index.js index cf87b18528b..8f62983e6f6 100644 --- a/deps/npm/node_modules/npm-packlist/index.js +++ b/deps/npm/node_modules/npm-packlist/index.js @@ -182,6 +182,13 @@ const npmWalker = Class => class Walker extends Class { getPackageFiles (entries, pkg) { try { + // XXX this could be changed to use read-package-json-fast + // which handles the normalizing of bins for us, and simplifies + // the test for bundleDependencies and bundledDependencies later. + // HOWEVER if we do this, we need to be sure that we're careful + // about what we write back out since rpj-fast removes some fields + // that the user likely wants to keep. it also would add a second + // file read that we would want to optimize away. pkg = normalizePackageBin(JSON.parse(pkg.toString())) } catch (er) { // not actually a valid package.json @@ -202,7 +209,7 @@ const npmWalker = Class => class Walker extends Class { // the files list as the effective readdir result, that means it // looks like we don't have a node_modules folder at all unless we // include it here. - if (pkg.bundleDependencies && entries.includes('node_modules')) + if ((pkg.bundleDependencies || pkg.bundledDependencies) && entries.includes('node_modules')) pkg.files.push('node_modules') const patterns = Array.from(new Set(pkg.files)).reduce((set, pattern) => { diff --git a/deps/npm/node_modules/npm-packlist/package.json b/deps/npm/node_modules/npm-packlist/package.json index 6f60521059a..1276b484136 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.4", + "version": "2.1.5", "description": "Get a list of the files to add from a folder into an npm package", "directories": { "test": "test" @@ -20,7 +20,7 @@ "devDependencies": { "mutate-fs": "^2.1.1", "require-inject": "^1.4.4", - "tap": "^14.10.7" + "tap": "^14.10.8" }, "scripts": { "test": "tap", diff --git a/deps/npm/package.json b/deps/npm/package.json index 1e821ececaf..0f078d18be5 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "7.7.5", + "version": "7.7.6", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -74,7 +74,7 @@ "libnpmpublish": "^4.0.0", "libnpmsearch": "^3.1.0", "libnpmteam": "^2.0.2", - "libnpmversion": "^1.0.12", + "libnpmversion": "^1.1.0", "make-fetch-happen": "^8.0.14", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", @@ -180,12 +180,12 @@ "devDependencies": { "@mdx-js/mdx": "^1.6.22", "cmark-gfm": "^0.8.5", - "eslint": "^7.22.0", + "eslint": "^7.23.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.3.1", "eslint-plugin-standard": "^5.0.0", - "jsdom": "^16.5.1", + "jsdom": "^16.5.2", "licensee": "^8.1.0", "marked-man": "^0.7.0", "require-inject": "^1.4.4", diff --git a/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js b/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js index 4d840ceef6a..5c3fb823111 100644 --- a/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js +++ b/deps/npm/tap-snapshots/smoke-tests-index.js-TAP.test.js @@ -5,6 +5,43 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' +exports[`smoke-tests/index.js TAP npm (no args) > should have expected no args output 1`] = ` +npm + +Usage: + +npm install install all the dependencies in your project +npm install add the dependency to your project +npm test run this project's tests +npm run run the script named +npm -h quick help on +npm -l display usage info for all commands +npm help search for help on +npm help npm more involved overview + +All commands: + + access, adduser, audit, bin, bugs, cache, ci, completion, + config, dedupe, deprecate, diff, dist-tag, docs, doctor, + edit, exec, explain, explore, find-dupes, fund, get, help, + hook, init, install, install-ci-test, install-test, link, + ll, login, logout, ls, org, outdated, owner, pack, ping, + prefix, profile, prune, publish, rebuild, repo, restart, + root, run-script, search, set, set-script, shrinkwrap, star, + stars, start, stop, team, test, token, uninstall, unpublish, + unstar, update, version, view, whoami + +Specify configs in the ini-formatted file: + {CWD}/smoke-tests/index/.npmrc +or on the command line via: npm --key=value + +More configuration info: npm help config +Configuration fields: npm help 7 config + +npm {CWD} + +` + exports[`smoke-tests/index.js TAP npm diff > should have expected diff output 1`] = ` diff --git a/package.json b/package.json index v1.0.4..v1.1.1 100644 diff --git a/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js b/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js index a85f90ac841..2a3d0146b18 100644 --- a/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js +++ b/deps/npm/tap-snapshots/test-lib-utils-config-describe-all.js-TAP.test.js @@ -674,7 +674,7 @@ Show extended information in \`npm ls\` and \`npm search\`. #### \`maxsockets\` -* Default: Infinity +* Default: 15 * Type: Number The maximum number of connections to use per origin (protocol/host/port diff --git a/deps/npm/test/lib/cli.js b/deps/npm/test/lib/cli.js index 40da77bf44e..28e44394e16 100644 --- a/deps/npm/test/lib/cli.js +++ b/deps/npm/test/lib/cli.js @@ -172,17 +172,37 @@ t.test('gracefully handles error printing usage', t => { t.teardown(() => { npmock.output = output errorHandlerCb = null + errorHandlerCalled = null }) const proc = { - argv: ['node', 'npm', 'asdf'], + argv: ['node', 'npm'], on: () => {}, } npmock.argv = [] - npmock.output = (msg) => { - throw new Error('test exception') + errorHandlerCb = () => { + t.match(errorHandlerCalled, [], 'should call errorHandler with no args') + t.end() + } + cli(proc) +}) + +t.test('handles output error', t => { + const { output } = npmock + t.teardown(() => { + npmock.output = output + errorHandlerCb = null + errorHandlerCalled = null + }) + const proc = { + argv: ['node', 'npm'], + on: () => {}, + } + npmock.argv = [] + npmock.output = () => { + throw new Error('ERR') } errorHandlerCb = () => { - t.match(errorHandlerCalled, /test exception/) + t.match(errorHandlerCalled, /ERR/, 'should call errorHandler with error') t.end() } cli(proc) @@ -191,6 +211,7 @@ t.test('gracefully handles error printing usage', t => { t.test('load error calls error handler', t => { t.teardown(() => { errorHandlerCb = null + errorHandlerCalled = null LOAD_ERROR = null })