diff options
author | Luke Karrys <luke@lukekarrys.com> | 2021-10-28 09:12:56 +0300 |
---|---|---|
committer | Luke Karrys <luke@lukekarrys.com> | 2021-10-28 21:31:13 +0300 |
commit | 8af94726b098031c7c0cae7ed50cc4e2e3499181 (patch) | |
tree | efb7e2a38493042e8e13fd6db207f4d9710b14a4 | |
parent | 070901d7a6e3110a04ef41d8fcf14ffbfcce1496 (diff) |
deps: arborist@4.0.3
PR-URL: https://github.com/npm/cli/pull/3953
Credit: @lukekarrys
Close: #3953
Reviewed-by: @nlf
-rw-r--r-- | node_modules/@npmcli/arborist/lib/shrinkwrap.js | 35 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/package.json | 11 | ||||
-rw-r--r-- | package-lock.json | 14 | ||||
-rw-r--r-- | package.json | 2 |
4 files changed, 36 insertions, 26 deletions
diff --git a/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/node_modules/@npmcli/arborist/lib/shrinkwrap.js index 93e1cb1a4..e7dd435ca 100644 --- a/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/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/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index 1954be5b3..cfa74a805 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/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/package-lock.json b/package-lock.json index 3fe8a086c..5f45cca04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,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", @@ -772,9 +772,9 @@ } }, "node_modules/@npmcli/arborist": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.2.tgz", - "integrity": "sha512-tmuUNr66acGh8oOo6rKLNOaleeUDSymxTBQJFzDpRET8kG1nzLwIRMpV+CZkzmQ0tbCQ1NMyDvBeyu+kaJ+Dtw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.3.tgz", + "integrity": "sha512-gFz/dNJtpv2bYXlupcUpEaWlFDRUNmvVnQNbE6dY4ild6beZ2SkG4R5/CM4GZZwj9HD2TyfGjO350Ja+xlLzuA==", "inBundle": true, "dependencies": { "@isaacs/string-locale-compare": "^1.0.1", @@ -11082,9 +11082,9 @@ "dev": true }, "@npmcli/arborist": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.2.tgz", - "integrity": "sha512-tmuUNr66acGh8oOo6rKLNOaleeUDSymxTBQJFzDpRET8kG1nzLwIRMpV+CZkzmQ0tbCQ1NMyDvBeyu+kaJ+Dtw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-4.0.3.tgz", + "integrity": "sha512-gFz/dNJtpv2bYXlupcUpEaWlFDRUNmvVnQNbE6dY4ild6beZ2SkG4R5/CM4GZZwj9HD2TyfGjO350Ja+xlLzuA==", "requires": { "@isaacs/string-locale-compare": "^1.0.1", "@npmcli/installed-package-contents": "^1.0.7", diff --git a/package.json b/package.json index b92ca93f6..7856494e7 100644 --- a/package.json +++ b/package.json @@ -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", |