@npmcli/arborist 2.6.4 → 2.8.1
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/bin/dedupe.js +46 -0
- package/lib/arborist/build-ideal-tree.js +118 -704
- package/lib/arborist/index.js +1 -1
- package/lib/arborist/load-actual.js +1 -1
- package/lib/arborist/load-virtual.js +1 -1
- package/lib/arborist/rebuild.js +3 -3
- package/lib/arborist/reify.js +128 -41
- package/lib/calc-dep-flags.js +3 -3
- package/lib/can-place-dep.js +402 -0
- package/lib/deepest-nesting-target.js +16 -0
- package/lib/diff.js +3 -5
- package/lib/edge.js +2 -0
- package/lib/node.js +40 -6
- package/lib/peer-entry-sets.js +72 -0
- package/lib/place-dep.js +551 -0
- package/lib/printable.js +10 -0
- package/lib/shrinkwrap.js +12 -8
- package/package.json +7 -4
- package/lib/peer-set.js +0 -25
package/bin/dedupe.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const Arborist = require('../')
|
|
2
|
+
|
|
3
|
+
const options = require('./lib/options.js')
|
|
4
|
+
const print = require('./lib/print-tree.js')
|
|
5
|
+
require('./lib/logging.js')
|
|
6
|
+
require('./lib/timers.js')
|
|
7
|
+
|
|
8
|
+
const printDiff = diff => {
|
|
9
|
+
const {depth} = require('treeverse')
|
|
10
|
+
depth({
|
|
11
|
+
tree: diff,
|
|
12
|
+
visit: d => {
|
|
13
|
+
if (d.location === '')
|
|
14
|
+
return
|
|
15
|
+
switch (d.action) {
|
|
16
|
+
case 'REMOVE':
|
|
17
|
+
console.error('REMOVE', d.actual.location)
|
|
18
|
+
break
|
|
19
|
+
case 'ADD':
|
|
20
|
+
console.error('ADD', d.ideal.location, d.ideal.resolved)
|
|
21
|
+
break
|
|
22
|
+
case 'CHANGE':
|
|
23
|
+
console.error('CHANGE', d.actual.location, {
|
|
24
|
+
from: d.actual.resolved,
|
|
25
|
+
to: d.ideal.resolved,
|
|
26
|
+
})
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
getChildren: d => d.children,
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const start = process.hrtime()
|
|
35
|
+
process.emit('time', 'install')
|
|
36
|
+
const arb = new Arborist(options)
|
|
37
|
+
arb.dedupe(options).then(tree => {
|
|
38
|
+
process.emit('timeEnd', 'install')
|
|
39
|
+
const end = process.hrtime(start)
|
|
40
|
+
print(tree)
|
|
41
|
+
if (options.dryRun)
|
|
42
|
+
printDiff(arb.diff)
|
|
43
|
+
console.error(`resolved ${tree.inventory.size} deps in ${end[0] + end[1] / 1e9}s`)
|
|
44
|
+
if (tree.meta && options.save)
|
|
45
|
+
tree.meta.save()
|
|
46
|
+
}).catch(er => console.error(require('util').inspect(er, { depth: Infinity })))
|