diff options
author | Gar <gar+gh@danger.computer> | 2021-02-25 20:44:56 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-02-25 20:44:56 +0300 |
commit | 28d036ae9179f742bd0518e558a54f014a7a895e (patch) | |
tree | 5bb37330de95638bc41711c06ba7bb72eea26bab /node_modules/@npmcli | |
parent | b9fa7e32a63a3dc3a4865865c4ca737c862b9cf2 (diff) |
arborist@2.2.5
Diffstat (limited to 'node_modules/@npmcli')
-rw-r--r-- | node_modules/@npmcli/arborist/lib/arborist/index.js | 2 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/lib/shrinkwrap.js | 24 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/lib/tracker.js | 5 | ||||
-rw-r--r-- | node_modules/@npmcli/arborist/package.json | 17 |
4 files changed, 38 insertions, 10 deletions
diff --git a/node_modules/@npmcli/arborist/lib/arborist/index.js b/node_modules/@npmcli/arborist/lib/arborist/index.js index 6c46656eb..09a6f7005 100644 --- a/node_modules/@npmcli/arborist/lib/arborist/index.js +++ b/node_modules/@npmcli/arborist/lib/arborist/index.js @@ -28,6 +28,7 @@ const {resolve} = require('path') const {homedir} = require('os') +const procLog = require('../proc-log.js') const mixins = [ require('../tracker.js'), @@ -54,6 +55,7 @@ class Arborist extends Base { path: options.path || '.', cache: options.cache || `${homedir()}/.npm/_cacache`, packumentCache: new Map(), + log: options.log || procLog, } this.cache = resolve(this.options.cache) this.path = resolve(this.options.path) diff --git a/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/node_modules/@npmcli/arborist/lib/shrinkwrap.js index f9f4297db..828b9f328 100644 --- a/node_modules/@npmcli/arborist/lib/shrinkwrap.js +++ b/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 diff --git a/node_modules/@npmcli/arborist/lib/tracker.js b/node_modules/@npmcli/arborist/lib/tracker.js index c90404f00..47267872c 100644 --- a/node_modules/@npmcli/arborist/lib/tracker.js +++ b/node_modules/@npmcli/arborist/lib/tracker.js @@ -1,13 +1,12 @@ -const procLog = require('./proc-log.js') - const _progress = Symbol('_progress') const _onError = Symbol('_onError') +const procLog = require('./proc-log.js') module.exports = cls => class Tracker extends cls { constructor (options = {}) { super(options) - this[_progress] = new Map() this.log = options.log || procLog + this[_progress] = new Map() } addTracker (section, subsection = null, key = null) { diff --git a/node_modules/@npmcli/arborist/package.json b/node_modules/@npmcli/arborist/package.json index 77c11e722..cf4224234 100644 --- a/node_modules/@npmcli/arborist/package.json +++ b/node_modules/@npmcli/arborist/package.json @@ -1,9 +1,9 @@ { "name": "@npmcli/arborist", - "version": "2.2.4", + "version": "2.2.5", "description": "Manage node_modules trees", "dependencies": { - "@npmcli/installed-package-contents": "^1.0.6", + "@npmcli/installed-package-contents": "^1.0.7", "@npmcli/map-workspaces": "^1.0.2", "@npmcli/metavuln-calculator": "^1.1.0", "@npmcli/move-file": "^1.1.0", @@ -46,7 +46,8 @@ "tcompare": "^3.0.4" }, "scripts": { - "test": "tap", + "test": "npm run test-only --", + "test-only": "tap", "posttest": "npm run lint", "snap": "tap", "postsnap": "npm run lint", @@ -76,12 +77,16 @@ }, "tap": { "100": true, - "node-arg": [ - "--unhandled-rejections=strict" - ], "after": "test/fixtures/cleanup.js", "coverage-map": "map.js", "esm": false, + "test-env": [ + "NODE_OPTIONS=--no-warnings" + ], + "node-arg": [ + "--no-warnings", + "--no-deprecation" + ], "timeout": "120" } } |