@npmcli/arborist 7.3.0 → 7.3.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.
|
@@ -4,7 +4,7 @@ const rpj = require('read-package-json-fast')
|
|
|
4
4
|
const npa = require('npm-package-arg')
|
|
5
5
|
const pacote = require('pacote')
|
|
6
6
|
const cacache = require('cacache')
|
|
7
|
-
const promiseCallLimit = require('promise-call-limit')
|
|
7
|
+
const { callLimit: promiseCallLimit } = require('promise-call-limit')
|
|
8
8
|
const realpath = require('../../lib/realpath.js')
|
|
9
9
|
const { resolve, dirname } = require('path')
|
|
10
10
|
const treeCheck = require('../tree-check.js')
|
|
@@ -56,30 +56,52 @@ const _global = Symbol.for('global')
|
|
|
56
56
|
const _idealTreePrune = Symbol.for('idealTreePrune')
|
|
57
57
|
|
|
58
58
|
// Push items in, pop them sorted by depth and then path
|
|
59
|
+
// Sorts physically shallower deps up to the front of the queue, because
|
|
60
|
+
// they'll affect things deeper in, then alphabetical for consistency between
|
|
61
|
+
// installs
|
|
59
62
|
class DepsQueue {
|
|
63
|
+
// [{ sorted, items }] indexed by depth
|
|
60
64
|
#deps = []
|
|
61
65
|
#sorted = true
|
|
66
|
+
#minDepth = 0
|
|
67
|
+
#length = 0
|
|
62
68
|
|
|
63
69
|
get length () {
|
|
64
|
-
return this.#
|
|
70
|
+
return this.#length
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
push (item) {
|
|
68
|
-
if (!this.#deps.
|
|
69
|
-
this.#
|
|
70
|
-
this.#deps.
|
|
74
|
+
if (!this.#deps[item.depth]) {
|
|
75
|
+
this.#length++
|
|
76
|
+
this.#deps[item.depth] = { sorted: true, items: [item] }
|
|
77
|
+
// no minDepth check needed, this branch is only reached when we are in
|
|
78
|
+
// the middle of a shallower depth and creating a new one
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
if (!this.#deps[item.depth].items.includes(item)) {
|
|
82
|
+
this.#length++
|
|
83
|
+
this.#deps[item.depth].sorted = false
|
|
84
|
+
this.#deps[item.depth].items.push(item)
|
|
85
|
+
if (item.depth < this.#minDepth) {
|
|
86
|
+
this.#minDepth = item.depth
|
|
87
|
+
}
|
|
71
88
|
}
|
|
72
89
|
}
|
|
73
90
|
|
|
74
91
|
pop () {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
let depth
|
|
93
|
+
while (!depth?.items.length) {
|
|
94
|
+
depth = this.#deps[this.#minDepth]
|
|
95
|
+
if (!depth?.items.length) {
|
|
96
|
+
this.#minDepth++
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!depth.sorted) {
|
|
100
|
+
depth.items.sort((a, b) => localeCompare(a.path, b.path))
|
|
101
|
+
depth.sorted = true
|
|
81
102
|
}
|
|
82
|
-
|
|
103
|
+
this.#length--
|
|
104
|
+
return depth.items.shift()
|
|
83
105
|
}
|
|
84
106
|
}
|
|
85
107
|
|
|
@@ -1016,7 +1038,7 @@ This is a one-time fix-up, please be patient...
|
|
|
1016
1038
|
// may well be an optional dep that has gone missing. it'll
|
|
1017
1039
|
// fail later anyway.
|
|
1018
1040
|
for (const e of this.#problemEdges(placed)) {
|
|
1019
|
-
promises.push(
|
|
1041
|
+
promises.push(() =>
|
|
1020
1042
|
this.#fetchManifest(npa.resolve(e.name, e.spec, fromPath(placed, e)))
|
|
1021
1043
|
.catch(er => null)
|
|
1022
1044
|
)
|
|
@@ -1031,7 +1053,7 @@ This is a one-time fix-up, please be patient...
|
|
|
1031
1053
|
}
|
|
1032
1054
|
}
|
|
1033
1055
|
|
|
1034
|
-
await
|
|
1056
|
+
await promiseCallLimit(promises)
|
|
1035
1057
|
return this.#buildDepStep()
|
|
1036
1058
|
}
|
|
1037
1059
|
|
|
@@ -1208,8 +1230,12 @@ This is a one-time fix-up, please be patient...
|
|
|
1208
1230
|
} else {
|
|
1209
1231
|
const cleanRawSpec = cleanUrl(spec.rawSpec)
|
|
1210
1232
|
log.silly('fetch manifest', spec.raw.replace(spec.rawSpec, cleanRawSpec))
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1233
|
+
const o = {
|
|
1234
|
+
...options,
|
|
1235
|
+
fullMetadata: true,
|
|
1236
|
+
}
|
|
1237
|
+
const p = pacote.manifest(spec, o)
|
|
1238
|
+
.then(({ license, ...mani }) => {
|
|
1213
1239
|
this.#manifests.set(spec.raw, mani)
|
|
1214
1240
|
return mani
|
|
1215
1241
|
})
|
package/lib/arborist/rebuild.js
CHANGED
|
@@ -7,7 +7,7 @@ const promiseAllRejectLate = require('promise-all-reject-late')
|
|
|
7
7
|
const rpj = require('read-package-json-fast')
|
|
8
8
|
const binLinks = require('bin-links')
|
|
9
9
|
const runScript = require('@npmcli/run-script')
|
|
10
|
-
const promiseCallLimit = require('promise-call-limit')
|
|
10
|
+
const { callLimit: promiseCallLimit } = require('promise-call-limit')
|
|
11
11
|
const { resolve } = require('path')
|
|
12
12
|
const {
|
|
13
13
|
isNodeGypPackage,
|
|
@@ -387,7 +387,7 @@ module.exports = cls => class Builder extends cls {
|
|
|
387
387
|
: p)
|
|
388
388
|
|
|
389
389
|
process.emit('timeEnd', timer)
|
|
390
|
-
}), limit)
|
|
390
|
+
}), { limit })
|
|
391
391
|
process.emit('timeEnd', `build:run:${event}`)
|
|
392
392
|
}
|
|
393
393
|
|
package/lib/arborist/reify.js
CHANGED
|
@@ -31,6 +31,7 @@ const relpath = require('../relpath.js')
|
|
|
31
31
|
const Diff = require('../diff.js')
|
|
32
32
|
const retirePath = require('../retire-path.js')
|
|
33
33
|
const promiseAllRejectLate = require('promise-all-reject-late')
|
|
34
|
+
const { callLimit: promiseCallLimit } = require('promise-call-limit')
|
|
34
35
|
const optionalSet = require('../optional-set.js')
|
|
35
36
|
const calcDepFlags = require('../calc-dep-flags.js')
|
|
36
37
|
const { saveTypeMap, hasSubKey } = require('../add-rm-pkg-deps.js')
|
|
@@ -817,10 +818,12 @@ module.exports = cls => class Reifier extends cls {
|
|
|
817
818
|
}
|
|
818
819
|
|
|
819
820
|
// extract all the nodes with bundles
|
|
820
|
-
return
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
821
|
+
return promiseCallLimit(set.map(node => {
|
|
822
|
+
return () => {
|
|
823
|
+
this[_bundleUnpacked].add(node)
|
|
824
|
+
return this[_reifyNode](node)
|
|
825
|
+
}
|
|
826
|
+
}), { rejectLate: true })
|
|
824
827
|
// then load their unpacked children and move into the ideal tree
|
|
825
828
|
.then(nodes =>
|
|
826
829
|
promiseAllRejectLate(nodes.map(async node => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npmcli/arborist",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Manage node_modules trees",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@isaacs/string-locale-compare": "^1.1.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"parse-conflict-json": "^3.0.0",
|
|
31
31
|
"proc-log": "^3.0.0",
|
|
32
32
|
"promise-all-reject-late": "^1.0.0",
|
|
33
|
-
"promise-call-limit": "^
|
|
33
|
+
"promise-call-limit": "^3.0.1",
|
|
34
34
|
"read-package-json-fast": "^3.0.2",
|
|
35
35
|
"semver": "^7.3.7",
|
|
36
36
|
"ssri": "^10.0.5",
|