summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/@npmcli/arborist
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/@npmcli/arborist')
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js2
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js24
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/lib/tracker.js5
-rw-r--r--deps/npm/node_modules/@npmcli/arborist/package.json17
4 files changed, 38 insertions, 10 deletions
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
index 6c46656eb9..09a6f70054 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/index.js
+++ b/deps/npm/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/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js b/deps/npm/node_modules/@npmcli/arborist/lib/shrinkwrap.js
index f9f4297dba..828b9f3282 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
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js b/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js
index c90404f00a..47267872ce 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/tracker.js
+++ b/deps/npm/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/deps/npm/node_modules/@npmcli/arborist/package.json b/deps/npm/node_modules/@npmcli/arborist/package.json
index 77c11e7221..cf4224234c 100644
--- a/deps/npm/node_modules/@npmcli/arborist/package.json
+++ b/deps/npm/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"
}
}