@npmcli/arborist 4.3.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/bin/actual.js +16 -20
- package/bin/audit.js +23 -26
- package/bin/funding.js +35 -31
- package/bin/ideal.js +11 -18
- package/bin/index.js +92 -63
- package/bin/lib/logging.js +62 -26
- package/bin/lib/options.js +117 -53
- package/bin/lib/print-tree.js +2 -3
- package/bin/lib/timers.js +17 -15
- package/bin/license.js +44 -34
- package/bin/prune.js +21 -22
- package/bin/reify.js +21 -22
- package/bin/shrinkwrap.js +5 -10
- package/bin/virtual.js +11 -15
- package/lib/add-rm-pkg-deps.js +12 -11
- package/lib/arborist/build-ideal-tree.js +12 -13
- package/lib/arborist/index.js +1 -3
- package/lib/arborist/rebuild.js +17 -17
- package/lib/arborist/reify.js +16 -10
- package/lib/audit-report.js +7 -8
- package/lib/get-workspace-nodes.js +4 -1
- package/lib/shrinkwrap.js +5 -7
- package/lib/tracker.js +6 -17
- package/package.json +15 -11
|
@@ -14,6 +14,7 @@ const fs = require('fs')
|
|
|
14
14
|
const lstat = promisify(fs.lstat)
|
|
15
15
|
const readlink = promisify(fs.readlink)
|
|
16
16
|
const { depth } = require('treeverse')
|
|
17
|
+
const log = require('proc-log')
|
|
17
18
|
|
|
18
19
|
const {
|
|
19
20
|
OK,
|
|
@@ -248,7 +249,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
|
|
|
248
249
|
try {
|
|
249
250
|
c()
|
|
250
251
|
} catch (er) {
|
|
251
|
-
|
|
252
|
+
log.warn(er.code, er.message, {
|
|
252
253
|
package: er.pkgid,
|
|
253
254
|
required: er.required,
|
|
254
255
|
current: er.current,
|
|
@@ -532,7 +533,6 @@ Try using the package name instead, e.g:
|
|
|
532
533
|
saveBundle,
|
|
533
534
|
saveType,
|
|
534
535
|
path: this.path,
|
|
535
|
-
log: this.log,
|
|
536
536
|
})
|
|
537
537
|
})
|
|
538
538
|
}
|
|
@@ -602,7 +602,7 @@ Try using the package name instead, e.g:
|
|
|
602
602
|
// be printed by npm-audit-report as if they can be fixed, because
|
|
603
603
|
// they can't.
|
|
604
604
|
if (bundler) {
|
|
605
|
-
|
|
605
|
+
log.warn(`audit fix ${node.name}@${node.version}`,
|
|
606
606
|
`${node.location}\nis a bundled dependency of\n${
|
|
607
607
|
bundler.name}@${bundler.version} at ${bundler.location}\n` +
|
|
608
608
|
'It cannot be fixed automatically.\n' +
|
|
@@ -637,14 +637,14 @@ Try using the package name instead, e.g:
|
|
|
637
637
|
if (!node.isProjectRoot && !node.isWorkspace) {
|
|
638
638
|
// not something we're going to fix, sorry. have to cd into
|
|
639
639
|
// that directory and fix it yourself.
|
|
640
|
-
|
|
640
|
+
log.warn('audit', 'Manual fix required in linked project ' +
|
|
641
641
|
`at ./${node.location} for ${name}@${simpleRange}.\n` +
|
|
642
642
|
`'cd ./${node.location}' and run 'npm audit' for details.`)
|
|
643
643
|
continue
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
if (!fixAvailable) {
|
|
647
|
-
|
|
647
|
+
log.warn('audit', `No fix available for ${name}@${simpleRange}`)
|
|
648
648
|
continue
|
|
649
649
|
}
|
|
650
650
|
|
|
@@ -652,7 +652,7 @@ Try using the package name instead, e.g:
|
|
|
652
652
|
const breakingMessage = isSemVerMajor
|
|
653
653
|
? 'a SemVer major change'
|
|
654
654
|
: 'outside your stated dependency range'
|
|
655
|
-
|
|
655
|
+
log.warn('audit', `Updating ${name} to ${version},` +
|
|
656
656
|
`which is ${breakingMessage}.`)
|
|
657
657
|
|
|
658
658
|
await this[_add](node, { add: [`${name}@${version}`] })
|
|
@@ -727,7 +727,7 @@ Try using the package name instead, e.g:
|
|
|
727
727
|
const heading = ancient ? 'ancient lockfile' : 'old lockfile'
|
|
728
728
|
if (ancient || !this.options.lockfileVersion ||
|
|
729
729
|
this.options.lockfileVersion >= defaultLockfileVersion) {
|
|
730
|
-
|
|
730
|
+
log.warn(heading,
|
|
731
731
|
`
|
|
732
732
|
The ${meta.type} file was created with an old version of npm,
|
|
733
733
|
so supplemental metadata must be fetched from the registry.
|
|
@@ -744,7 +744,7 @@ This is a one-time fix-up, please be patient...
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
queue.push(async () => {
|
|
747
|
-
|
|
747
|
+
log.silly('inflate', node.location)
|
|
748
748
|
const { resolved, version, path, name, location, integrity } = node
|
|
749
749
|
// don't try to hit the registry for linked deps
|
|
750
750
|
const useResolved = resolved && (
|
|
@@ -753,8 +753,7 @@ This is a one-time fix-up, please be patient...
|
|
|
753
753
|
const id = useResolved ? resolved
|
|
754
754
|
: version || `file:${node.path}`
|
|
755
755
|
const spec = npa.resolve(name, id, dirname(path))
|
|
756
|
-
const
|
|
757
|
-
const t = `idealTree:inflate:${sloc}`
|
|
756
|
+
const t = `idealTree:inflate:${location}`
|
|
758
757
|
this.addTracker(t)
|
|
759
758
|
await pacote.manifest(spec, {
|
|
760
759
|
...this.options,
|
|
@@ -765,7 +764,7 @@ This is a one-time fix-up, please be patient...
|
|
|
765
764
|
node.package = { ...mani, _id: `${mani.name}@${mani.version}` }
|
|
766
765
|
}).catch((er) => {
|
|
767
766
|
const warning = `Could not fetch metadata for ${name}@${id}`
|
|
768
|
-
|
|
767
|
+
log.warn(heading, warning, er)
|
|
769
768
|
})
|
|
770
769
|
this.finishTracker(t)
|
|
771
770
|
})
|
|
@@ -794,7 +793,7 @@ This is a one-time fix-up, please be patient...
|
|
|
794
793
|
this[_depsQueue].push(tree)
|
|
795
794
|
// XXX also push anything that depends on a node with a name
|
|
796
795
|
// in the override list
|
|
797
|
-
|
|
796
|
+
log.silly('idealTree', 'buildDeps')
|
|
798
797
|
this.addTracker('idealTree', tree.name, '')
|
|
799
798
|
return this[_buildDepStep]()
|
|
800
799
|
.then(() => process.emit('timeEnd', 'idealTree:buildDeps'))
|
|
@@ -1233,7 +1232,7 @@ This is a one-time fix-up, please be patient...
|
|
|
1233
1232
|
if (this[_manifests].has(spec.raw)) {
|
|
1234
1233
|
return this[_manifests].get(spec.raw)
|
|
1235
1234
|
} else {
|
|
1236
|
-
|
|
1235
|
+
log.silly('fetch manifest', spec.raw)
|
|
1237
1236
|
const p = pacote.manifest(spec, options)
|
|
1238
1237
|
.then(mani => {
|
|
1239
1238
|
this[_manifests].set(spec.raw, mani)
|
package/lib/arborist/index.js
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
|
|
29
29
|
const { resolve } = require('path')
|
|
30
30
|
const { homedir } = require('os')
|
|
31
|
-
const procLog = require('proc-log')
|
|
32
31
|
const { depth } = require('treeverse')
|
|
33
32
|
const { saveTypeMap } = require('../add-rm-pkg-deps.js')
|
|
34
33
|
|
|
@@ -74,7 +73,6 @@ class Arborist extends Base {
|
|
|
74
73
|
path: options.path || '.',
|
|
75
74
|
cache: options.cache || `${homedir()}/.npm/_cacache`,
|
|
76
75
|
packumentCache: options.packumentCache || new Map(),
|
|
77
|
-
log: options.log || procLog,
|
|
78
76
|
workspacesEnabled: options.workspacesEnabled !== false,
|
|
79
77
|
lockfileVersion: lockfileVersion(options.lockfileVersion),
|
|
80
78
|
}
|
|
@@ -94,7 +92,7 @@ class Arborist extends Base {
|
|
|
94
92
|
|
|
95
93
|
// returns an array of the actual nodes for all the workspaces
|
|
96
94
|
workspaceNodes (tree, workspaces) {
|
|
97
|
-
return getWorkspaceNodes(tree, workspaces
|
|
95
|
+
return getWorkspaceNodes(tree, workspaces)
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
// returns a set of workspace nodes and all their deps
|
package/lib/arborist/rebuild.js
CHANGED
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
isNodeGypPackage,
|
|
14
14
|
defaultGypInstallScript,
|
|
15
15
|
} = require('@npmcli/node-gyp')
|
|
16
|
+
const log = require('proc-log')
|
|
16
17
|
|
|
17
18
|
const boolEnv = b => b ? '1' : ''
|
|
18
19
|
const sortNodes = (a, b) =>
|
|
@@ -135,15 +136,19 @@ module.exports = cls => class Builder extends cls {
|
|
|
135
136
|
process.emit('time', `build:${type}`)
|
|
136
137
|
|
|
137
138
|
await this[_buildQueues](nodes)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
139
|
+
// links should run prepare scripts and only link bins after that
|
|
140
|
+
if (type !== 'links') {
|
|
141
|
+
if (!this[_ignoreScripts]) {
|
|
142
|
+
await this[_runScripts]('preinstall')
|
|
143
|
+
}
|
|
144
|
+
if (this[_binLinks]) {
|
|
145
|
+
await this[_linkAllBins]()
|
|
146
|
+
}
|
|
147
|
+
if (!this[_ignoreScripts]) {
|
|
148
|
+
await this[_runScripts]('install')
|
|
149
|
+
await this[_runScripts]('postinstall')
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
147
152
|
await this[_runScripts]('prepare')
|
|
148
153
|
|
|
149
154
|
if (this[_binLinks]) {
|
|
@@ -151,11 +156,6 @@ module.exports = cls => class Builder extends cls {
|
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
|
|
154
|
-
if (!this[_ignoreScripts]) {
|
|
155
|
-
await this[_runScripts]('install')
|
|
156
|
-
await this[_runScripts]('postinstall')
|
|
157
|
-
}
|
|
158
|
-
|
|
159
159
|
process.emit('timeEnd', `build:${type}`)
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -297,7 +297,7 @@ module.exports = cls => class Builder extends cls {
|
|
|
297
297
|
|
|
298
298
|
const timer = `build:run:${event}:${location}`
|
|
299
299
|
process.emit('time', timer)
|
|
300
|
-
|
|
300
|
+
log.info('run', pkg._id, event, location, pkg.scripts[event])
|
|
301
301
|
const env = {
|
|
302
302
|
npm_package_resolved: resolved,
|
|
303
303
|
npm_package_integrity: integrity,
|
|
@@ -319,7 +319,7 @@ module.exports = cls => class Builder extends cls {
|
|
|
319
319
|
}
|
|
320
320
|
const p = runScript(runOpts).catch(er => {
|
|
321
321
|
const { code, signal } = er
|
|
322
|
-
|
|
322
|
+
log.info('run', pkg._id, event, { code, signal })
|
|
323
323
|
throw er
|
|
324
324
|
}).then(({ args, code, signal, stdout, stderr }) => {
|
|
325
325
|
this.scriptsRun.add({
|
|
@@ -333,7 +333,7 @@ module.exports = cls => class Builder extends cls {
|
|
|
333
333
|
stdout,
|
|
334
334
|
stderr,
|
|
335
335
|
})
|
|
336
|
-
|
|
336
|
+
log.info('run', pkg._id, event, { code, signal })
|
|
337
337
|
})
|
|
338
338
|
|
|
339
339
|
await (this[_doHandleOptionalFailure]
|
package/lib/arborist/reify.js
CHANGED
|
@@ -8,6 +8,7 @@ const npa = require('npm-package-arg')
|
|
|
8
8
|
const semver = require('semver')
|
|
9
9
|
const debug = require('../debug.js')
|
|
10
10
|
const walkUp = require('walk-up-path')
|
|
11
|
+
const log = require('proc-log')
|
|
11
12
|
|
|
12
13
|
const { dirname, resolve, relative } = require('path')
|
|
13
14
|
const { depth: dfwalk } = require('treeverse')
|
|
@@ -390,7 +391,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
390
391
|
[_addNodeToTrashList] (node, retire = false) {
|
|
391
392
|
const paths = [node.path, ...node.binPaths]
|
|
392
393
|
const moves = this[_retiredPaths]
|
|
393
|
-
|
|
394
|
+
log.silly('reify', 'mark', retire ? 'retired' : 'deleted', paths)
|
|
394
395
|
for (const path of paths) {
|
|
395
396
|
if (retire) {
|
|
396
397
|
const retired = retirePath(path)
|
|
@@ -413,7 +414,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
413
414
|
this[_addNodeToTrashList](diff.actual, true)
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
|
-
|
|
417
|
+
log.silly('reify', 'moves', moves)
|
|
417
418
|
const movePromises = Object.entries(moves)
|
|
418
419
|
.map(([from, to]) => this[_renamePath](from, to))
|
|
419
420
|
return promiseAllRejectLate(movePromises)
|
|
@@ -532,7 +533,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
532
533
|
return promiseAllRejectLate(unlinks)
|
|
533
534
|
.then(() => {
|
|
534
535
|
if (failures.length) {
|
|
535
|
-
|
|
536
|
+
log.warn('cleanup', 'Failed to remove some directories', failures)
|
|
536
537
|
}
|
|
537
538
|
})
|
|
538
539
|
.then(() => process.emit('timeEnd', 'reify:rollback:createSparse'))
|
|
@@ -624,7 +625,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
624
625
|
this[_nmValidated].add(nm)
|
|
625
626
|
return
|
|
626
627
|
}
|
|
627
|
-
|
|
628
|
+
log.warn('reify', 'Removing non-directory', nm)
|
|
628
629
|
await rimraf(nm)
|
|
629
630
|
}
|
|
630
631
|
|
|
@@ -647,8 +648,8 @@ module.exports = cls => class Reifier extends cls {
|
|
|
647
648
|
'please re-try this operation once it completes\n' +
|
|
648
649
|
'so that the damage can be corrected, or perform\n' +
|
|
649
650
|
'a fresh install with no lockfile if the problem persists.'
|
|
650
|
-
|
|
651
|
-
|
|
651
|
+
log.warn('reify', warning)
|
|
652
|
+
log.verbose('reify', 'unrecognized node in tree', node.path)
|
|
652
653
|
node.parent = null
|
|
653
654
|
node.fsParent = null
|
|
654
655
|
this[_addNodeToTrashList](node)
|
|
@@ -691,7 +692,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
691
692
|
[_warnDeprecated] (node) {
|
|
692
693
|
const { _id, deprecated } = node.package
|
|
693
694
|
if (deprecated) {
|
|
694
|
-
|
|
695
|
+
log.warn('deprecated', `${_id}: ${deprecated}`)
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
698
|
|
|
@@ -701,7 +702,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
701
702
|
return (node.optional ? p.catch(er => {
|
|
702
703
|
const set = optionalSet(node)
|
|
703
704
|
for (node of set) {
|
|
704
|
-
|
|
705
|
+
log.verbose('reify', 'failed optional dependency', node.path)
|
|
705
706
|
this[_addNodeToTrashList](node)
|
|
706
707
|
}
|
|
707
708
|
}) : p).then(() => node)
|
|
@@ -716,7 +717,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
716
717
|
// Shrinkwrap and Node classes carefully, so for now, just treat
|
|
717
718
|
// the default reg as the magical animal that it has been.
|
|
718
719
|
return resolved && resolved
|
|
719
|
-
.replace(/^https?:\/\/registry
|
|
720
|
+
.replace(/^https?:\/\/registry\.npmjs\.org\//, this.registry)
|
|
720
721
|
}
|
|
721
722
|
|
|
722
723
|
// bundles are *sort of* like shrinkwraps, in that the branch is defined
|
|
@@ -1129,7 +1130,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1129
1130
|
|
|
1130
1131
|
return promiseAllRejectLate(promises).then(() => {
|
|
1131
1132
|
if (failures.length) {
|
|
1132
|
-
|
|
1133
|
+
log.warn('cleanup', 'Failed to remove some directories', failures)
|
|
1133
1134
|
}
|
|
1134
1135
|
})
|
|
1135
1136
|
.then(() => process.emit('timeEnd', 'reify:trash'))
|
|
@@ -1369,6 +1370,10 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1369
1370
|
devDependencies = {},
|
|
1370
1371
|
optionalDependencies = {},
|
|
1371
1372
|
peerDependencies = {},
|
|
1373
|
+
// bundleDependencies is not required by PackageJson like the other fields here
|
|
1374
|
+
// PackageJson also doesn't omit an empty array for this field so defaulting this
|
|
1375
|
+
// to an empty array would add that field to every package.json file.
|
|
1376
|
+
bundleDependencies,
|
|
1372
1377
|
} = tree.package
|
|
1373
1378
|
|
|
1374
1379
|
pkgJson.update({
|
|
@@ -1376,6 +1381,7 @@ module.exports = cls => class Reifier extends cls {
|
|
|
1376
1381
|
devDependencies,
|
|
1377
1382
|
optionalDependencies,
|
|
1378
1383
|
peerDependencies,
|
|
1384
|
+
bundleDependencies,
|
|
1379
1385
|
})
|
|
1380
1386
|
await pkgJson.save()
|
|
1381
1387
|
}
|
package/lib/audit-report.js
CHANGED
|
@@ -13,7 +13,7 @@ const _fixAvailable = Symbol('fixAvailable')
|
|
|
13
13
|
const _checkTopNode = Symbol('checkTopNode')
|
|
14
14
|
const _init = Symbol('init')
|
|
15
15
|
const _omit = Symbol('omit')
|
|
16
|
-
const
|
|
16
|
+
const log = require('proc-log')
|
|
17
17
|
|
|
18
18
|
const fetch = require('npm-registry-fetch')
|
|
19
19
|
|
|
@@ -98,14 +98,13 @@ class AuditReport extends Map {
|
|
|
98
98
|
this.calculator = new Calculator(opts)
|
|
99
99
|
this.error = null
|
|
100
100
|
this.options = opts
|
|
101
|
-
this.log = opts.log || procLog
|
|
102
101
|
this.tree = tree
|
|
103
102
|
this.filterSet = opts.filterSet
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
async run () {
|
|
107
106
|
this.report = await this[_getReport]()
|
|
108
|
-
|
|
107
|
+
log.silly('audit report', this.report)
|
|
109
108
|
if (this.report) {
|
|
110
109
|
await this[_init]()
|
|
111
110
|
}
|
|
@@ -304,7 +303,7 @@ class AuditReport extends Map {
|
|
|
304
303
|
|
|
305
304
|
async [_getReport] () {
|
|
306
305
|
// if we're not auditing, just return false
|
|
307
|
-
if (this.options.audit === false || this.tree.inventory.size === 1) {
|
|
306
|
+
if (this.options.audit === false || this.options.offline === true || this.tree.inventory.size === 1) {
|
|
308
307
|
return null
|
|
309
308
|
}
|
|
310
309
|
|
|
@@ -313,7 +312,7 @@ class AuditReport extends Map {
|
|
|
313
312
|
try {
|
|
314
313
|
// first try the super fast bulk advisory listing
|
|
315
314
|
const body = prepareBulkData(this.tree, this[_omit], this.filterSet)
|
|
316
|
-
|
|
315
|
+
log.silly('audit', 'bulk request', body)
|
|
317
316
|
|
|
318
317
|
// no sense asking if we don't have anything to audit,
|
|
319
318
|
// we know it'll be empty
|
|
@@ -331,7 +330,7 @@ class AuditReport extends Map {
|
|
|
331
330
|
|
|
332
331
|
return await res.json()
|
|
333
332
|
} catch (er) {
|
|
334
|
-
|
|
333
|
+
log.silly('audit', 'bulk request failed', String(er.body))
|
|
335
334
|
// that failed, try the quick audit endpoint
|
|
336
335
|
const body = prepareData(this.tree, this.options)
|
|
337
336
|
const res = await fetch('/-/npm/v1/security/audits/quick', {
|
|
@@ -344,8 +343,8 @@ class AuditReport extends Map {
|
|
|
344
343
|
return AuditReport.auditToBulk(await res.json())
|
|
345
344
|
}
|
|
346
345
|
} catch (er) {
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
log.verbose('audit error', er)
|
|
347
|
+
log.silly('audit error', String(er.body))
|
|
349
348
|
this.error = er
|
|
350
349
|
return null
|
|
351
350
|
} finally {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// Get the actual nodes corresponding to a root node's child workspaces,
|
|
2
2
|
// given a list of workspace names.
|
|
3
|
+
|
|
4
|
+
const log = require('proc-log')
|
|
3
5
|
const relpath = require('./relpath.js')
|
|
4
|
-
|
|
6
|
+
|
|
7
|
+
const getWorkspaceNodes = (tree, workspaces) => {
|
|
5
8
|
const wsMap = tree.workspaces
|
|
6
9
|
if (!wsMap) {
|
|
7
10
|
log.warn('workspaces', 'filter set, but no workspaces present')
|
package/lib/shrinkwrap.js
CHANGED
|
@@ -33,7 +33,7 @@ const mismatch = (a, b) => a && b && a !== b
|
|
|
33
33
|
// After calling this.commit(), any nodes not present in the tree will have
|
|
34
34
|
// been removed from the shrinkwrap data as well.
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const log = require('proc-log')
|
|
37
37
|
const YarnLock = require('./yarn-lock.js')
|
|
38
38
|
const { promisify } = require('util')
|
|
39
39
|
const rimraf = promisify(require('rimraf'))
|
|
@@ -80,8 +80,8 @@ const swKeyOrder = [
|
|
|
80
80
|
]
|
|
81
81
|
|
|
82
82
|
// used to rewrite from yarn registry to npm registry
|
|
83
|
-
const yarnRegRe = /^https?:\/\/registry
|
|
84
|
-
const npmRegRe = /^https?:\/\/registry
|
|
83
|
+
const yarnRegRe = /^https?:\/\/registry\.yarnpkg\.com\//
|
|
84
|
+
const npmRegRe = /^https?:\/\/registry\.npmjs\.org\//
|
|
85
85
|
|
|
86
86
|
// sometimes resolved: is weird or broken, or something npa can't handle
|
|
87
87
|
const specFromResolved = resolved => {
|
|
@@ -329,14 +329,12 @@ class Shrinkwrap {
|
|
|
329
329
|
newline = '\n',
|
|
330
330
|
shrinkwrapOnly = false,
|
|
331
331
|
hiddenLockfile = false,
|
|
332
|
-
log = procLog,
|
|
333
332
|
lockfileVersion,
|
|
334
333
|
} = options
|
|
335
334
|
|
|
336
335
|
this.lockfileVersion = hiddenLockfile ? 3
|
|
337
336
|
: lockfileVersion ? parseInt(lockfileVersion, 10)
|
|
338
337
|
: null
|
|
339
|
-
this.log = log
|
|
340
338
|
this[_awaitingUpdate] = new Map()
|
|
341
339
|
this.tree = null
|
|
342
340
|
this.path = resolve(path || '.')
|
|
@@ -479,9 +477,9 @@ class Shrinkwrap {
|
|
|
479
477
|
/* istanbul ignore else */
|
|
480
478
|
if (typeof this.filename === 'string') {
|
|
481
479
|
const rel = relpath(this.path, this.filename)
|
|
482
|
-
|
|
480
|
+
log.verbose('shrinkwrap', `failed to load ${rel}`, er)
|
|
483
481
|
} else {
|
|
484
|
-
|
|
482
|
+
log.verbose('shrinkwrap', `failed to load ${this.path}`, er)
|
|
485
483
|
}
|
|
486
484
|
this.loadingError = er
|
|
487
485
|
this.loadedFromDisk = false
|
package/lib/tracker.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
const _progress = Symbol('_progress')
|
|
2
2
|
const _onError = Symbol('_onError')
|
|
3
|
-
const
|
|
3
|
+
const npmlog = require('npmlog')
|
|
4
4
|
|
|
5
5
|
module.exports = cls => class Tracker extends cls {
|
|
6
6
|
constructor (options = {}) {
|
|
7
7
|
super(options)
|
|
8
|
-
this.log = options.log || procLog
|
|
9
8
|
this[_progress] = new Map()
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
addTracker (section, subsection = null, key = null) {
|
|
13
|
-
// TrackerGroup type object not found
|
|
14
|
-
if (!this.log.newGroup) {
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
|
|
18
12
|
if (section === null || section === undefined) {
|
|
19
13
|
this[_onError](`Tracker can't be null or undefined`)
|
|
20
14
|
}
|
|
@@ -31,13 +25,13 @@ module.exports = cls => class Tracker extends cls {
|
|
|
31
25
|
this[_onError](`Tracker "${section}" already exists`)
|
|
32
26
|
} else if (!hasTracker && subsection === null) {
|
|
33
27
|
// 1. no existing tracker, no subsection
|
|
34
|
-
// Create a new tracker from
|
|
28
|
+
// Create a new tracker from npmlog
|
|
35
29
|
// starts progress bar
|
|
36
30
|
if (this[_progress].size === 0) {
|
|
37
|
-
|
|
31
|
+
npmlog.enableProgress()
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
this[_progress].set(section,
|
|
34
|
+
this[_progress].set(section, npmlog.newGroup(section))
|
|
41
35
|
} else if (!hasTracker && subsection !== null) {
|
|
42
36
|
// 2. no parent tracker and subsection
|
|
43
37
|
this[_onError](`Parent tracker "${section}" does not exist`)
|
|
@@ -53,11 +47,6 @@ module.exports = cls => class Tracker extends cls {
|
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
finishTracker (section, subsection = null, key = null) {
|
|
56
|
-
// TrackerGroup type object not found
|
|
57
|
-
if (!this.log.newGroup) {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
|
|
61
50
|
if (section === null || section === undefined) {
|
|
62
51
|
this[_onError](`Tracker can't be null or undefined`)
|
|
63
52
|
}
|
|
@@ -88,7 +77,7 @@ module.exports = cls => class Tracker extends cls {
|
|
|
88
77
|
// remove progress bar if all
|
|
89
78
|
// trackers are finished
|
|
90
79
|
if (this[_progress].size === 0) {
|
|
91
|
-
|
|
80
|
+
npmlog.disableProgress()
|
|
92
81
|
}
|
|
93
82
|
} else if (!hasTracker && subsection === null) {
|
|
94
83
|
// 1. no existing parent tracker, no subsection
|
|
@@ -103,7 +92,7 @@ module.exports = cls => class Tracker extends cls {
|
|
|
103
92
|
}
|
|
104
93
|
|
|
105
94
|
[_onError] (msg) {
|
|
106
|
-
|
|
95
|
+
npmlog.disableProgress()
|
|
107
96
|
throw new Error(msg)
|
|
108
97
|
}
|
|
109
98
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/arborist",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Manage node_modules trees",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
7
7
|
"@npmcli/installed-package-contents": "^1.0.7",
|
|
8
8
|
"@npmcli/map-workspaces": "^2.0.0",
|
|
9
|
-
"@npmcli/metavuln-calculator": "^
|
|
9
|
+
"@npmcli/metavuln-calculator": "^3.0.0",
|
|
10
10
|
"@npmcli/move-file": "^1.1.0",
|
|
11
11
|
"@npmcli/name-from-folder": "^1.0.1",
|
|
12
12
|
"@npmcli/node-gyp": "^1.0.3",
|
|
13
13
|
"@npmcli/package-json": "^1.0.1",
|
|
14
|
-
"@npmcli/run-script": "^
|
|
14
|
+
"@npmcli/run-script": "^3.0.0",
|
|
15
15
|
"bin-links": "^3.0.0",
|
|
16
16
|
"cacache": "^15.0.3",
|
|
17
17
|
"common-ancestor-path": "^1.0.1",
|
|
@@ -19,13 +19,15 @@
|
|
|
19
19
|
"json-stringify-nice": "^1.1.4",
|
|
20
20
|
"mkdirp": "^1.0.4",
|
|
21
21
|
"mkdirp-infer-owner": "^2.0.0",
|
|
22
|
+
"nopt": "^5.0.0",
|
|
22
23
|
"npm-install-checks": "^4.0.0",
|
|
23
|
-
"npm-package-arg": "^
|
|
24
|
-
"npm-pick-manifest": "^
|
|
25
|
-
"npm-registry-fetch": "^
|
|
26
|
-
"
|
|
24
|
+
"npm-package-arg": "^9.0.0",
|
|
25
|
+
"npm-pick-manifest": "^7.0.0",
|
|
26
|
+
"npm-registry-fetch": "^13.0.0",
|
|
27
|
+
"npmlog": "^6.0.1",
|
|
28
|
+
"pacote": "^13.0.2",
|
|
27
29
|
"parse-conflict-json": "^2.0.1",
|
|
28
|
-
"proc-log": "^
|
|
30
|
+
"proc-log": "^2.0.0",
|
|
29
31
|
"promise-all-reject-late": "^1.0.0",
|
|
30
32
|
"promise-call-limit": "^1.0.1",
|
|
31
33
|
"read-package-json-fast": "^2.0.2",
|
|
@@ -60,11 +62,13 @@
|
|
|
60
62
|
"benchmark": "node scripts/benchmark.js",
|
|
61
63
|
"benchclean": "rm -rf scripts/benchmark/*/",
|
|
62
64
|
"npmclilint": "npmcli-lint",
|
|
63
|
-
"postlint": "npm-template-check"
|
|
65
|
+
"postlint": "npm-template-check",
|
|
66
|
+
"template-copy": "npm-template-copy --force"
|
|
64
67
|
},
|
|
65
68
|
"repository": {
|
|
66
69
|
"type": "git",
|
|
67
|
-
"url": "https://github.com/npm/
|
|
70
|
+
"url": "https://github.com/npm/cli",
|
|
71
|
+
"directory": "workspaces/arborist"
|
|
68
72
|
},
|
|
69
73
|
"author": "GitHub Inc.",
|
|
70
74
|
"license": "ISC",
|
|
@@ -99,6 +103,6 @@
|
|
|
99
103
|
"!test/fixtures/*.js"
|
|
100
104
|
],
|
|
101
105
|
"templateOSS": {
|
|
102
|
-
"version": "2.
|
|
106
|
+
"version": "2.9.2"
|
|
103
107
|
}
|
|
104
108
|
}
|