From 28d036ae9179f742bd0518e558a54f014a7a895e Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 25 Feb 2021 09:44:56 -0800 Subject: [PATCH] arborist@2.2.5 --- .../@npmcli/arborist/lib/arborist/index.js | 2 ++ .../@npmcli/arborist/lib/shrinkwrap.js | 24 ++++++++++++++++++- node_modules/@npmcli/arborist/lib/tracker.js | 5 ++-- node_modules/@npmcli/arborist/package.json | 17 ++++++++----- package-lock.json | 18 +++++++------- package.json | 2 +- 6 files changed, 48 insertions(+), 20 deletions(-) diff --git a/node_modules/@npmcli/arborist/lib/arborist/index.js b/node_modules/@npmcli/arborist/lib/arborist/index.js index 6c46656eb9292..09a6f700547f2 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 f9f4297dbae86..828b9f328232e 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 c90404f00aa9b..47267872ce780 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 77c11e7221816..cf4224234cd45 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" } } diff --git a/package-lock.json b/package-lock.json index f65b97ca39082..1a811f719bd0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -252,7 +252,7 @@ ], "license": "Artistic-2.0", "dependencies": { - "@npmcli/arborist": "^2.2.4", + "@npmcli/arborist": "^2.2.5", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", "@npmcli/run-script": "^1.8.3", @@ -813,12 +813,12 @@ } }, "node_modules/@npmcli/arborist": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.2.4.tgz", - "integrity": "sha512-JajrhRKOgHe/s3kC5OKc6j5hKv2C6dDLMXx0lDP3jU70rUyHV0w0bqUTYeJAcu1y+eyA4szj6/PUcIQUsQmCVQ==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.2.5.tgz", + "integrity": "sha512-nLnhRZsUa1kPryyI0N6hLGX6lsQTFDqBJRTNHmZNmjgzP7ZBKiqz8y6ItsouT2CpWhvmoIpnstLyoglIQyo0YQ==", "inBundle": true, "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", @@ -10946,11 +10946,11 @@ "dev": true }, "@npmcli/arborist": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.2.4.tgz", - "integrity": "sha512-JajrhRKOgHe/s3kC5OKc6j5hKv2C6dDLMXx0lDP3jU70rUyHV0w0bqUTYeJAcu1y+eyA4szj6/PUcIQUsQmCVQ==", + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/@npmcli/arborist/-/arborist-2.2.5.tgz", + "integrity": "sha512-nLnhRZsUa1kPryyI0N6hLGX6lsQTFDqBJRTNHmZNmjgzP7ZBKiqz8y6ItsouT2CpWhvmoIpnstLyoglIQyo0YQ==", "requires": { - "@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", diff --git a/package.json b/package.json index 4af2d03946b83..b18405407a352 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@npmcli/arborist": "^2.2.4", + "@npmcli/arborist": "^2.2.5", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^1.2.9", "@npmcli/run-script": "^1.8.3",