Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2021-10-28 09:12:56 +0300
committerLuke Karrys <luke@lukekarrys.com>2021-10-28 21:31:13 +0300
commit8af94726b098031c7c0cae7ed50cc4e2e3499181 (patch)
treeefb7e2a38493042e8e13fd6db207f4d9710b14a4 /node_modules
parent070901d7a6e3110a04ef41d8fcf14ffbfcce1496 (diff)
deps: arborist@4.0.3
PR-URL: https://github.com/npm/cli/pull/3953 Credit: @lukekarrys Close: #3953 Reviewed-by: @nlf
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/@npmcli/arborist/lib/shrinkwrap.js35
-rw-r--r--node_modules/@npmcli/arborist/package.json11
2 files changed, 28 insertions, 18 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"