diff --git a/deps/npm/docs/content/using-npm/config.md b/deps/npm/docs/content/using-npm/config.md index ddabe01d7d8d4c..a5017e61db914b 100644 --- a/deps/npm/docs/content/using-npm/config.md +++ b/deps/npm/docs/content/using-npm/config.md @@ -987,7 +987,7 @@ When passed to `npm config` this refers to which config file to use. * Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version -* Type: null, 1, 2, or 3 +* Type: null, 1, 2, 3, "1", "2", or "3" Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: diff --git a/deps/npm/docs/output/commands/npm-ls.html b/deps/npm/docs/output/commands/npm-ls.html index d13c14c6e2fbe8..398d46b6ac5ed7 100644 --- a/deps/npm/docs/output/commands/npm-ls.html +++ b/deps/npm/docs/output/commands/npm-ls.html @@ -159,7 +159,7 @@

Description

the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm’s source tree will show:

-
npm@8.1.1 /path/to/npm
+
npm@8.1.2 /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 63f5416e5977d7..3e42f7dfb73bcc 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

-

8.1.1

+

8.1.2

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 1f67ec7939bd36..dbdb6fcbc11116 100644 --- a/deps/npm/docs/output/using-npm/config.html +++ b/deps/npm/docs/output/using-npm/config.html @@ -939,7 +939,7 @@

lockfile-version

Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are:

diff --git a/deps/npm/lib/publish.js b/deps/npm/lib/publish.js index 32e70129f2c031..5e064a34bc041f 100644 --- a/deps/npm/lib/publish.js +++ b/deps/npm/lib/publish.js @@ -8,6 +8,7 @@ const pacote = require('pacote') const npa = require('npm-package-arg') const npmFetch = require('npm-registry-fetch') const chalk = require('chalk') +const replaceInfo = require('./utils/replace-info.js') const otplease = require('./utils/otplease.js') const { getContents, logTar } = require('./utils/tar.js') @@ -68,7 +69,7 @@ class Publish extends BaseCommand { if (args.length !== 1) throw this.usageError() - log.verbose('publish', args) + log.verbose('publish', replaceInfo(args)) const unicode = this.npm.config.get('unicode') const dryRun = this.npm.config.get('dry-run') diff --git a/deps/npm/lib/utils/config/definitions.js b/deps/npm/lib/utils/config/definitions.js index c9806b3c2890f8..a725ee0fa1d6fc 100644 --- a/deps/npm/lib/utils/config/definitions.js +++ b/deps/npm/lib/utils/config/definitions.js @@ -1157,7 +1157,7 @@ define('location', { define('lockfile-version', { default: null, - type: [null, 1, 2, 3], + type: [null, 1, 2, 3, '1', '2', '3'], defaultDescription: ` Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version @@ -1179,7 +1179,9 @@ define('lockfile-version', { on disk than lockfile version 2, but not interoperable with older npm versions. Ideal if all users are on npm version 7 and higher. `, - flatten, + flatten: (key, obj, flatOptions) => { + flatOptions.lockfileVersion = obj[key] && parseInt(obj[key], 10) + }, }) define('loglevel', { diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 6e6a5482fdbd22..99609df8d79047 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@8\.1\.1 /path/to/npm +npm@8\.1\.2 /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 108b97fd78b4d7..eb30baef3eb93d 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 -8\.1\.1 +8\.1\.2 .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 1cd82ea02b5a49..98fbf2060ec993 100644 --- a/deps/npm/man/man7/config.7 +++ b/deps/npm/man/man7/config.7 @@ -1254,7 +1254,7 @@ When passed to \fBnpm config\fP this refers to which config file to use\. Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version .IP \(bu 2 -Type: null, 1, 2, or 3 +Type: null, 1, 2, 3, "1", "2", or "3" .RE .P diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index 93e1cb1a45ca23..e7dd435ca34fe9 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -238,21 +238,31 @@ class Shrinkwrap { return swKeyOrder } - static reset (options) { + static async reset (options) { // still need to know if it was loaded from the disk, but don't // bother reading it if we're gonna just throw it away. const s = new Shrinkwrap(options) s.reset() - return s[_maybeStat]().then(([sw, lock]) => { - s.filename = resolve(s.path, - (s.hiddenLockfile ? 'node_modules/.package-lock' - : s.shrinkwrapOnly || sw ? 'npm-shrinkwrap' - : 'package-lock') + '.json') - s.loadedFromDisk = !!(sw || lock) - s.type = basename(s.filename) - return s - }) + const [sw, lock] = await s[_maybeStat]() + + s.filename = resolve(s.path, + (s.hiddenLockfile ? 'node_modules/.package-lock' + : s.shrinkwrapOnly || sw ? 'npm-shrinkwrap' + : 'package-lock') + '.json') + s.loadedFromDisk = !!(sw || lock) + s.type = basename(s.filename) + + try { + if (s.loadedFromDisk && !s.lockfileVersion) { + const json = parseJSON(await maybeReadFile(s.filename)) + if (json.lockfileVersion > defaultLockfileVersion) { + s.lockfileVersion = json.lockfileVersion + } + } + } catch (e) {} + + return s } static metaFromNode (node, path) { @@ -380,9 +390,10 @@ class Shrinkwrap { reset () { this.tree = null this[_awaitingUpdate] = new Map() - this.originalLockfileVersion = this.lockfileVersion + const lockfileVersion = this.lockfileVersion || defaultLockfileVersion + this.originalLockfileVersion = lockfileVersion this.data = { - lockfileVersion: this.lockfileVersion || defaultLockfileVersion, + lockfileVersion, requires: true, packages: {}, dependencies: {}, diff --git a/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json index 1954be5b3d7caf..cfa74a805b1163 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": "4.0.2", + "version": "4.0.3", "description": "Manage node_modules trees", "dependencies": { "@isaacs/string-locale-compare": "^1.0.1", @@ -45,11 +45,10 @@ "tcompare": "^5.0.6" }, "scripts": { - "test": "npm run test-only --", - "test-only": "tap", - "posttest": "npm run lint --", + "test": "tap", + "posttest": "npm run lint", "snap": "tap", - "postsnap": "npm run lintfix --", + "postsnap": "npm run lintfix", "test-proxy": "ARBORIST_TEST_PROXY=1 tap --snapshot", "preversion": "npm test", "postversion": "npm publish", @@ -88,7 +87,7 @@ "--no-warnings", "--no-deprecation" ], - "timeout": "240" + "timeout": "360" }, "engines": { "node": "^12.13.0 || ^14.15.0 || >=16" diff --git a/deps/npm/package.json b/deps/npm/package.json index b92ca93f613c5c..cb8b46e8a480f6 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "8.1.1", + "version": "8.1.2", "name": "npm", "description": "a package manager for JavaScript", "workspaces": [ @@ -55,7 +55,7 @@ }, "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", - "@npmcli/arborist": "^4.0.2", + "@npmcli/arborist": "^4.0.3", "@npmcli/ci-detect": "^1.4.0", "@npmcli/config": "^2.3.0", "@npmcli/map-workspaces": "^2.0.0", diff --git a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs index aaf59e6a2be340..8c85225f2f998f 100644 --- a/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs +++ b/deps/npm/tap-snapshots/test/lib/utils/config/definitions.js.test.cjs @@ -1061,7 +1061,7 @@ exports[`test/lib/utils/config/definitions.js TAP > config description for lockf * Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version -* Type: null, 1, 2, or 3 +* Type: null, 1, 2, 3, "1", "2", or "3" Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: 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 dc55893d00bf9f..1ebb336092e390 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 @@ -861,7 +861,7 @@ When passed to \`npm config\` this refers to which config file to use. * Default: Version 2 if no lockfile or current lockfile version less than or equal to 2, otherwise maintain current lockfile version -* Type: null, 1, 2, or 3 +* Type: null, 1, 2, 3, "1", "2", or "3" Set the lockfile format version to be used in package-lock.json and npm-shrinkwrap-json files. Possible options are: diff --git a/deps/npm/test/lib/utils/config/definitions.js b/deps/npm/test/lib/utils/config/definitions.js index 622e603bc75c61..15b43715f45bd4 100644 --- a/deps/npm/test/lib/utils/config/definitions.js +++ b/deps/npm/test/lib/utils/config/definitions.js @@ -892,3 +892,12 @@ t.test('workspaces derived', t => { t.equal(flat.workspacesEnabled, false) t.end() }) + +t.test('lockfile version', t => { + const flat = {} + definitions['lockfile-version'].flatten('lockfile-version', { + 'lockfile-version': '3', + }, flat) + t.match(flat.lockfileVersion, 3, 'flattens to a number') + t.end() +})