@npmcli/arborist 4.3.0 → 4.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.
- package/lib/arborist/build-ideal-tree.js +33 -17
- package/package.json +1 -1
|
@@ -1250,24 +1250,40 @@ This is a one-time fix-up, please be patient...
|
|
|
1250
1250
|
// Don't bother to load the manifest for link deps, because the target
|
|
1251
1251
|
// might be within another package that doesn't exist yet.
|
|
1252
1252
|
const { legacyPeerDeps } = this
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1253
|
+
|
|
1254
|
+
// spec is a directory, link it
|
|
1255
|
+
if (spec.type === 'directory') {
|
|
1256
|
+
return this[_linkFromSpec](name, spec, parent, edge)
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
// if the spec matches a workspace name, then see if the workspace node will
|
|
1260
|
+
// satisfy the edge. if it does, we return the workspace node to make sure it
|
|
1261
|
+
// takes priority.
|
|
1262
|
+
if (this.idealTree.workspaces && this.idealTree.workspaces.has(spec.name)) {
|
|
1263
|
+
const existingNode = this.idealTree.edgesOut.get(spec.name).to
|
|
1264
|
+
if (existingNode && existingNode.isWorkspace && existingNode.satisfies(edge)) {
|
|
1265
|
+
return edge.to
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
// spec isn't a directory, and either isn't a workspace or the workspace we have
|
|
1270
|
+
// doesn't satisfy the edge. try to fetch a manifest and build a node from that.
|
|
1271
|
+
return this[_fetchManifest](spec)
|
|
1272
|
+
.then(pkg => new Node({ name, pkg, parent, legacyPeerDeps }), error => {
|
|
1273
|
+
error.requiredBy = edge.from.location || '.'
|
|
1274
|
+
|
|
1275
|
+
// failed to load the spec, either because of enotarget or
|
|
1276
|
+
// fetch failure of some other sort. save it so we can verify
|
|
1277
|
+
// later that it's optional, otherwise the error is fatal.
|
|
1278
|
+
const n = new Node({
|
|
1279
|
+
name,
|
|
1280
|
+
parent,
|
|
1281
|
+
error,
|
|
1282
|
+
legacyPeerDeps,
|
|
1270
1283
|
})
|
|
1284
|
+
this[_loadFailures].add(n)
|
|
1285
|
+
return n
|
|
1286
|
+
})
|
|
1271
1287
|
}
|
|
1272
1288
|
|
|
1273
1289
|
[_linkFromSpec] (name, spec, parent, edge) {
|