diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-01 19:38:43 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-02 16:08:55 +0300 |
commit | f3d67000a0a6bdce5cbb9ad506a008e5d709bb71 (patch) | |
tree | 650f0737f1d7676f374b523f27bf9b26bb70bb00 /deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js | |
parent | 725d48ae777ec23e915370019a60a835a2569711 (diff) |
deps: upgrade npm to 7.6.0
PR-URL: https://github.com/nodejs/node/pull/37559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js')
-rw-r--r-- | deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js index f9f4297dbae..828b9f32823 100644 --- a/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js @@ -32,6 +32,7 @@ const mismatch = (a, b) => a && b && a !== b // After calling this.commit(), any nodes not present in the tree will have // been removed from the shrinkwrap data as well. +const procLog = require('./proc-log.js') const YarnLock = require('./yarn-lock.js') const {promisify} = require('util') const rimraf = promisify(require('rimraf')) @@ -39,7 +40,23 @@ const fs = require('fs') const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) const stat = promisify(fs.stat) -const readdir = promisify(fs.readdir) +const readdir_ = promisify(fs.readdir) + +// XXX remove when drop support for node v10 +const lstat = promisify(fs.lstat) +/* istanbul ignore next - version specific polyfill */ +const readdir = async (path, opt) => { + if (!opt || !opt.withFileTypes) + return readdir_(path, opt) + const ents = await readdir_(path, opt) + if (typeof ents[0] === 'string') { + return Promise.all(ents.map(async ent => { + return Object.assign(await lstat(path + '/' + ent), { name: ent }) + })) + } + return ents +} + const { resolve, basename } = require('path') const specFromLock = require('./spec-from-lock.js') const versionFromTgz = require('./version-from-tgz.js') @@ -265,7 +282,10 @@ class Shrinkwrap { newline = '\n', shrinkwrapOnly = false, hiddenLockfile = false, + log = procLog, } = options + + this.log = log this[_awaitingUpdate] = new Map() this.tree = null this.path = resolve(path || '.') @@ -398,6 +418,8 @@ class Shrinkwrap { // all good! hidden lockfile is the newest thing in here. return data }).catch(er => { + const rel = relpath(this.path, this.filename) + this.log.verbose('shrinkwrap', `failed to load ${rel}`, er) this.loadingError = er this.loadedFromDisk = false this.ancientLockfile = false |