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

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js')
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js62
1 files changed, 33 insertions, 29 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
index e2180fd4c80..d5448bbcba9 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
@@ -184,34 +184,32 @@ const assertNoNewer = async (path, data, lockTime, dir = path, seen = null) => {
? Promise.resolve([{ name: 'node_modules', isDirectory: () => true }])
: readdir(parent, { withFileTypes: true })
- return children.catch(() => [])
- .then(ents => Promise.all(ents.map(async ent => {
- const child = resolve(parent, ent.name)
- if (ent.isDirectory() && !/^\./.test(ent.name)) {
- await assertNoNewer(path, data, lockTime, child, seen)
- } else if (ent.isSymbolicLink()) {
- const target = resolve(parent, await readlink(child))
- const tstat = await stat(target).catch(
- /* istanbul ignore next - windows */ () => null)
- seen.add(relpath(path, child))
- /* istanbul ignore next - windows cannot do this */
- if (tstat && tstat.isDirectory() && !seen.has(relpath(path, target))) {
- await assertNoNewer(path, data, lockTime, target, seen)
- }
- }
- })))
- .then(() => {
- if (dir !== path) {
- return
+ const ents = await children.catch(() => [])
+ await Promise.all(ents.map(async ent => {
+ const child = resolve(parent, ent.name)
+ if (ent.isDirectory() && !/^\./.test(ent.name)) {
+ await assertNoNewer(path, data, lockTime, child, seen)
+ } else if (ent.isSymbolicLink()) {
+ const target = resolve(parent, await readlink(child))
+ const tstat = await stat(target).catch(
+ /* istanbul ignore next - windows */ () => null)
+ seen.add(relpath(path, child))
+ /* istanbul ignore next - windows cannot do this */
+ if (tstat && tstat.isDirectory() && !seen.has(relpath(path, target))) {
+ await assertNoNewer(path, data, lockTime, target, seen)
}
+ }
+ }))
+ if (dir !== path) {
+ return
+ }
- // assert that all the entries in the lockfile were seen
- for (const loc of new Set(Object.keys(data.packages))) {
- if (!seen.has(loc)) {
- throw 'missing from node_modules: ' + loc
- }
- }
- })
+ // assert that all the entries in the lockfile were seen
+ for (const loc of new Set(Object.keys(data.packages))) {
+ if (!seen.has(loc)) {
+ throw 'missing from node_modules: ' + loc
+ }
+ }
}
const _awaitingUpdate = Symbol('_awaitingUpdate')
@@ -261,7 +259,9 @@ class Shrinkwrap {
s.lockfileVersion = json.lockfileVersion
}
}
- } catch (e) {}
+ } catch {
+ // ignore errors
+ }
return s
}
@@ -442,7 +442,7 @@ class Shrinkwrap {
this.newline = newline !== undefined ? newline : this.newline
}
- load () {
+ async load () {
// we don't need to load package-lock.json except for top of tree nodes,
// only npm-shrinkwrap.json.
return this[_maybeRead]().then(([sw, lock, yarn]) => {
@@ -464,7 +464,9 @@ class Shrinkwrap {
// ignore invalid yarn data. we'll likely clobber it later anyway.
try {
this.yarnLock.parse(yarn)
- } catch (_) {}
+ } catch {
+ // ignore errors
+ }
}
return data ? parseJSON(data) : {}
@@ -515,8 +517,10 @@ class Shrinkwrap {
!(lock.lockfileVersion >= 2) && !lock.requires
// load old lockfile deps into the packages listing
+ // eslint-disable-next-line promise/always-return
if (lock.dependencies && !lock.packages) {
return rpj(this.path + '/package.json').then(pkg => pkg, er => ({}))
+ // eslint-disable-next-line promise/always-return
.then(pkg => {
this[_loadAll]('', null, this.data)
this[_fixDependencies](pkg)