@antongolub/lockfile 0.0.0-snapshot.63 → 0.0.0-snapshot.64
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/dist/formats/bun-text.js +68 -38
- package/dist/formats/npm-1.js +73 -42
- package/dist/formats/npm-2.js +129 -90
- package/dist/formats/npm-3.js +108 -74
- package/dist/formats/pnpm-v5.js +95 -67
- package/dist/formats/pnpm-v6.js +103 -74
- package/dist/formats/pnpm-v9.js +103 -74
- package/dist/formats/yarn-berry-v10.js +111 -69
- package/dist/formats/yarn-berry-v4.js +111 -69
- package/dist/formats/yarn-berry-v5.js +111 -69
- package/dist/formats/yarn-berry-v6.js +111 -69
- package/dist/formats/yarn-berry-v7.js +111 -69
- package/dist/formats/yarn-berry-v8.js +111 -69
- package/dist/formats/yarn-berry-v9.js +111 -69
- package/dist/formats/yarn-classic.js +93 -47
- package/dist/index.js +420 -313
- package/dist/modify.js +25 -18
- package/dist/optimize.js +1 -1
- package/dist/registry.d.ts +5 -1
- package/dist/registry.js +40 -35
- package/package.json +3 -2
package/dist/formats/bun-text.js
CHANGED
|
@@ -126,11 +126,12 @@ function tarballKeyInputsOfNode(node) {
|
|
|
126
126
|
var cmpStr = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
127
127
|
var cmpAlias = (a, b) => a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : cmpStr(a, b);
|
|
128
128
|
var cmpEdgeBy = (end) => (a, b) => {
|
|
129
|
+
var _a, _b;
|
|
129
130
|
const c = cmpStr(end === "dst" ? a.dst : a.src, end === "dst" ? b.dst : b.src);
|
|
130
131
|
if (c !== 0) return c;
|
|
131
132
|
const k = cmpStr(a.kind, b.kind);
|
|
132
133
|
if (k !== 0) return k;
|
|
133
|
-
return cmpAlias(a.attrs
|
|
134
|
+
return cmpAlias((_a = a.attrs) == null ? void 0 : _a.alias, (_b = b.attrs) == null ? void 0 : _b.alias);
|
|
134
135
|
};
|
|
135
136
|
function emptyState() {
|
|
136
137
|
return {
|
|
@@ -166,7 +167,10 @@ function removeMatching(arr, pred) {
|
|
|
166
167
|
arr.splice(i, 1);
|
|
167
168
|
return true;
|
|
168
169
|
}
|
|
169
|
-
var tripleKey = (e) =>
|
|
170
|
+
var tripleKey = (e) => {
|
|
171
|
+
var _a;
|
|
172
|
+
return `${e.src}\0${e.kind}\0${e.dst}\0${((_a = e.attrs) == null ? void 0 : _a.alias) ?? ""}`;
|
|
173
|
+
};
|
|
170
174
|
function rebindNodeId(s, oldId, newId, newNode) {
|
|
171
175
|
s.nodes.set(newId, newNode);
|
|
172
176
|
s.nodes.delete(oldId);
|
|
@@ -177,7 +181,10 @@ function rebindNodeId(s, oldId, newId, newNode) {
|
|
|
177
181
|
const peerInc = s.incoming.get(e.dst);
|
|
178
182
|
if (peerInc) {
|
|
179
183
|
const idx = peerInc.findIndex(
|
|
180
|
-
(x) =>
|
|
184
|
+
(x) => {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
return x.src === oldId && x.kind === e.kind && x.dst === e.dst && ((_a = x.attrs) == null ? void 0 : _a.alias) === ((_b = e.attrs) == null ? void 0 : _b.alias);
|
|
187
|
+
}
|
|
181
188
|
);
|
|
182
189
|
if (idx >= 0) peerInc[idx] = e;
|
|
183
190
|
}
|
|
@@ -189,7 +196,10 @@ function rebindNodeId(s, oldId, newId, newNode) {
|
|
|
189
196
|
const peerOut = s.outgoing.get(e.src);
|
|
190
197
|
if (peerOut) {
|
|
191
198
|
const idx = peerOut.findIndex(
|
|
192
|
-
(x) =>
|
|
199
|
+
(x) => {
|
|
200
|
+
var _a, _b;
|
|
201
|
+
return x.src === e.src && x.kind === e.kind && x.dst === oldId && ((_a = x.attrs) == null ? void 0 : _a.alias) === ((_b = e.attrs) == null ? void 0 : _b.alias);
|
|
202
|
+
}
|
|
193
203
|
);
|
|
194
204
|
if (idx >= 0) peerOut[idx] = e;
|
|
195
205
|
}
|
|
@@ -202,12 +212,14 @@ function protocolOf(range) {
|
|
|
202
212
|
return /^[a-z][a-z0-9+.-]*$/i.test(prefix) ? prefix : void 0;
|
|
203
213
|
}
|
|
204
214
|
function isPublishedSelfLink(edge) {
|
|
205
|
-
|
|
215
|
+
var _a;
|
|
216
|
+
const range = (_a = edge.attrs) == null ? void 0 : _a.range;
|
|
206
217
|
if (range === void 0) return false;
|
|
207
218
|
const proto = protocolOf(range);
|
|
208
219
|
return proto === void 0 || proto === "npm";
|
|
209
220
|
}
|
|
210
221
|
function validate(s) {
|
|
222
|
+
var _a, _b, _c, _d, _e;
|
|
211
223
|
for (const d of s.diagnostics) {
|
|
212
224
|
if (d.severity === "error") {
|
|
213
225
|
throw new GraphError("INVARIANT_VIOLATION", `unresolved error diagnostic: ${d.code} \u2014 ${d.message}`);
|
|
@@ -224,7 +236,7 @@ function validate(s) {
|
|
|
224
236
|
}
|
|
225
237
|
const k = tripleKey(e);
|
|
226
238
|
if (seen.has(k)) {
|
|
227
|
-
const aliasSuffix = e.attrs
|
|
239
|
+
const aliasSuffix = ((_a = e.attrs) == null ? void 0 : _a.alias) !== void 0 ? ` (alias=${e.attrs.alias})` : "";
|
|
228
240
|
throw new GraphError("INVARIANT_VIOLATION", `duplicate edge: ${e.src} \u2192${e.kind} ${e.dst}${aliasSuffix}`);
|
|
229
241
|
}
|
|
230
242
|
seen.add(k);
|
|
@@ -234,14 +246,14 @@ function validate(s) {
|
|
|
234
246
|
if (node.workspacePath !== void 0) {
|
|
235
247
|
const inc = s.incoming.get(id) ?? [];
|
|
236
248
|
for (const edge of inc) {
|
|
237
|
-
if (s.nodes.get(edge.src)
|
|
238
|
-
if (s.tarballs.get(stripPeerContextFromNodeId(edge.src))
|
|
249
|
+
if (((_b = s.nodes.get(edge.src)) == null ? void 0 : _b.workspacePath) !== void 0) continue;
|
|
250
|
+
if (((_d = (_c = s.tarballs.get(stripPeerContextFromNodeId(edge.src))) == null ? void 0 : _c.resolution) == null ? void 0 : _d.type) === "directory") continue;
|
|
239
251
|
if (isPublishedSelfLink(edge)) {
|
|
240
252
|
s.diagnostics.push({
|
|
241
253
|
code: "SEAL_PUBLISHED_SELF_LINK",
|
|
242
254
|
subject: id,
|
|
243
255
|
severity: "info",
|
|
244
|
-
message: `published self-link: ${edge.src} \u2192${edge.kind} ${id} (range ${edge.attrs
|
|
256
|
+
message: `published self-link: ${edge.src} \u2192${edge.kind} ${id} (range ${(_e = edge.attrs) == null ? void 0 : _e.range}) \u2014 published dependency resolved to co-located workspace`
|
|
245
257
|
});
|
|
246
258
|
continue;
|
|
247
259
|
}
|
|
@@ -315,9 +327,9 @@ var GraphImpl = class _GraphImpl {
|
|
|
315
327
|
}
|
|
316
328
|
}
|
|
317
329
|
*walk(seeds, opts) {
|
|
318
|
-
const direction = opts
|
|
319
|
-
const kinds = opts
|
|
320
|
-
const maxDepth = opts
|
|
330
|
+
const direction = (opts == null ? void 0 : opts.direction) ?? "out";
|
|
331
|
+
const kinds = opts == null ? void 0 : opts.kinds;
|
|
332
|
+
const maxDepth = (opts == null ? void 0 : opts.maxDepth) ?? Infinity;
|
|
321
333
|
const visited = /* @__PURE__ */ new Set();
|
|
322
334
|
const initial = Array.isArray(seeds) ? seeds : [seeds];
|
|
323
335
|
const stack = [];
|
|
@@ -525,8 +537,11 @@ var GraphImpl = class _GraphImpl {
|
|
|
525
537
|
if (!next.nodes.has(src)) throw new GraphError("PATCH_REJECTED", `addEdge: src ${src} missing`);
|
|
526
538
|
if (!next.nodes.has(dst)) throw new GraphError("PATCH_REJECTED", `addEdge: dst ${dst} missing`);
|
|
527
539
|
const existing = next.outgoing.get(src) ?? [];
|
|
528
|
-
const newAlias = attrs
|
|
529
|
-
if (existing.some((e2) =>
|
|
540
|
+
const newAlias = attrs == null ? void 0 : attrs.alias;
|
|
541
|
+
if (existing.some((e2) => {
|
|
542
|
+
var _a;
|
|
543
|
+
return e2.dst === dst && e2.kind === kind && ((_a = e2.attrs) == null ? void 0 : _a.alias) === newAlias;
|
|
544
|
+
})) {
|
|
530
545
|
const aliasSuffix = newAlias !== void 0 ? ` (alias=${newAlias})` : "";
|
|
531
546
|
throw new GraphError("PATCH_REJECTED", `addEdge: duplicate ${src} \u2192${kind} ${dst}${aliasSuffix}`);
|
|
532
547
|
}
|
|
@@ -536,16 +551,20 @@ var GraphImpl = class _GraphImpl {
|
|
|
536
551
|
applied.push({ kind: "edge-added", subject: { src, dst, kind } });
|
|
537
552
|
},
|
|
538
553
|
removeEdge(src, dst, kind) {
|
|
554
|
+
var _a, _b;
|
|
539
555
|
const outs = next.outgoing.get(src);
|
|
540
556
|
let removedAlias;
|
|
541
|
-
const found = outs
|
|
557
|
+
const found = (outs == null ? void 0 : outs.findIndex((e) => e.dst === dst && e.kind === kind)) ?? -1;
|
|
542
558
|
if (!outs || found < 0) {
|
|
543
559
|
throw new GraphError("PATCH_REJECTED", `removeEdge: ${src} \u2192${kind} ${dst} missing`);
|
|
544
560
|
}
|
|
545
|
-
removedAlias = outs[found]
|
|
561
|
+
removedAlias = (_b = (_a = outs[found]) == null ? void 0 : _a.attrs) == null ? void 0 : _b.alias;
|
|
546
562
|
outs.splice(found, 1);
|
|
547
563
|
const ins = next.incoming.get(dst);
|
|
548
|
-
if (ins) removeMatching(ins, (e) =>
|
|
564
|
+
if (ins) removeMatching(ins, (e) => {
|
|
565
|
+
var _a2;
|
|
566
|
+
return e.src === src && e.kind === kind && ((_a2 = e.attrs) == null ? void 0 : _a2.alias) === removedAlias;
|
|
567
|
+
});
|
|
549
568
|
applied.push({ kind: "edge-removed", subject: { src, dst, kind } });
|
|
550
569
|
},
|
|
551
570
|
replacePeerContext(id, peers) {
|
|
@@ -740,12 +759,14 @@ function bunTextWouldCollapse(specifier) {
|
|
|
740
759
|
return isWorkspaceSpecifier(specifier);
|
|
741
760
|
}
|
|
742
761
|
function isWorkspaceEdge(edge) {
|
|
743
|
-
|
|
762
|
+
var _a;
|
|
763
|
+
return ((_a = edge.attrs) == null ? void 0 : _a.workspace) === true;
|
|
744
764
|
}
|
|
745
765
|
function workspaceRangeOfEdge(edge, dst) {
|
|
766
|
+
var _a, _b;
|
|
746
767
|
if (!isWorkspaceEdge(edge)) return void 0;
|
|
747
|
-
if (edge.attrs
|
|
748
|
-
const specifier = edge.attrs
|
|
768
|
+
if (((_a = edge.attrs) == null ? void 0 : _a.workspaceRange) !== void 0) return edge.attrs.workspaceRange;
|
|
769
|
+
const specifier = ((_b = edge.attrs) == null ? void 0 : _b.range) ?? "";
|
|
749
770
|
const sourceLooksProtocol = isWorkspaceSpecifier(specifier);
|
|
750
771
|
const canonicalSpecifier = sourceLooksProtocol ? specifier : "";
|
|
751
772
|
if (dst.version === void 0 || dst.version === "") return { specifier: canonicalSpecifier };
|
|
@@ -938,7 +959,8 @@ function rememberSidecar(graph, sidecar) {
|
|
|
938
959
|
sidecarByGraph.set(graph, sidecar);
|
|
939
960
|
}
|
|
940
961
|
function getBunOverridesCanonical(graph) {
|
|
941
|
-
|
|
962
|
+
var _a;
|
|
963
|
+
return (_a = sidecarByGraph.get(graph)) == null ? void 0 : _a.canonicalOverrides;
|
|
942
964
|
}
|
|
943
965
|
function check(input) {
|
|
944
966
|
if (!/"lockfileVersion"\s*:\s*1\b/.test(input)) return false;
|
|
@@ -1026,7 +1048,7 @@ function parse(input, _options = {}) {
|
|
|
1026
1048
|
continue;
|
|
1027
1049
|
}
|
|
1028
1050
|
const wsManifest = workspaces[parsed2.path];
|
|
1029
|
-
const wsVersion = wsManifest
|
|
1051
|
+
const wsVersion = (wsManifest == null ? void 0 : wsManifest.version) ?? "0.0.0";
|
|
1030
1052
|
const wsId = `${parsed2.name}@${wsVersion}`;
|
|
1031
1053
|
if (!seenNodeIds.has(wsId)) {
|
|
1032
1054
|
seenNodeIds.add(wsId);
|
|
@@ -1155,24 +1177,28 @@ function parse(input, _options = {}) {
|
|
|
1155
1177
|
}
|
|
1156
1178
|
}
|
|
1157
1179
|
function stringify(graph, options = {}) {
|
|
1180
|
+
var _a, _b, _c;
|
|
1158
1181
|
const sidecar = sidecarByGraph.get(graph);
|
|
1159
|
-
const emitDiagnostic = (diagnostic) =>
|
|
1182
|
+
const emitDiagnostic = (diagnostic) => {
|
|
1183
|
+
var _a2;
|
|
1184
|
+
return (_a2 = options.onDiagnostic) == null ? void 0 : _a2.call(options, diagnostic);
|
|
1185
|
+
};
|
|
1160
1186
|
const warnedPatches = /* @__PURE__ */ new Set();
|
|
1161
1187
|
const warnedPeerVirt = /* @__PURE__ */ new Set();
|
|
1162
1188
|
const rootNode = locateRootNode(graph, sidecar);
|
|
1163
1189
|
const memberNodes = Array.from(graph.nodes()).filter((n) => n.workspacePath !== void 0 && n.workspacePath !== "").sort((a, b) => cmpStr2(a.workspacePath, b.workspacePath));
|
|
1164
1190
|
const workspacesBlock = {
|
|
1165
|
-
"": buildWorkspaceManifest(graph, rootNode, sidecar
|
|
1191
|
+
"": buildWorkspaceManifest(graph, rootNode, (_a = sidecar == null ? void 0 : sidecar.workspaces.get("")) == null ? void 0 : _a.manifest, emitDiagnostic)
|
|
1166
1192
|
};
|
|
1167
1193
|
for (const member of memberNodes) {
|
|
1168
1194
|
const path = member.workspacePath;
|
|
1169
|
-
workspacesBlock[path] = buildWorkspaceManifest(graph, member, sidecar
|
|
1195
|
+
workspacesBlock[path] = buildWorkspaceManifest(graph, member, (_b = sidecar == null ? void 0 : sidecar.workspaces.get(path)) == null ? void 0 : _b.manifest, emitDiagnostic);
|
|
1170
1196
|
}
|
|
1171
1197
|
const packagesBlock = {};
|
|
1172
1198
|
for (const member of [...memberNodes].sort((a, b) => cmpStr2(a.name, b.name))) {
|
|
1173
1199
|
packagesBlock[member.name] = [`${member.name}@workspace:${member.workspacePath}`];
|
|
1174
1200
|
}
|
|
1175
|
-
const regularNodes = Array.from(graph.nodes()).filter((n) => n.id !== rootNode
|
|
1201
|
+
const regularNodes = Array.from(graph.nodes()).filter((n) => n.id !== (rootNode == null ? void 0 : rootNode.id) && n.workspacePath === void 0).sort(
|
|
1176
1202
|
(a, b) => cmpStr2(a.name, b.name) || cmpStr2(a.version, b.version) || (a.patch === void 0 ? 0 : 1) - (b.patch === void 0 ? 0 : 1)
|
|
1177
1203
|
);
|
|
1178
1204
|
const warnedResolutions = /* @__PURE__ */ new Set();
|
|
@@ -1187,7 +1213,7 @@ function stringify(graph, options = {}) {
|
|
|
1187
1213
|
}
|
|
1188
1214
|
emittedNameVersion.add(nameVersion);
|
|
1189
1215
|
const inner = buildInnerBlock(graph, node, sidecar);
|
|
1190
|
-
const integritySrc = graph.tarballOf(node.id)
|
|
1216
|
+
const integritySrc = (_c = graph.tarballOf(node.id)) == null ? void 0 : _c.integrity;
|
|
1191
1217
|
const integrity = (integritySrc && emitSri(integritySrc)) ?? "";
|
|
1192
1218
|
const key = chooseNodeEmitKey(node, sidecar, packagesBlock);
|
|
1193
1219
|
packagesBlock[key] = [`${node.name}@${node.version}`, "", inner, integrity];
|
|
@@ -1201,10 +1227,10 @@ function stringify(graph, options = {}) {
|
|
|
1201
1227
|
out.overrides = overridesBlock;
|
|
1202
1228
|
}
|
|
1203
1229
|
out.packages = packagesBlock;
|
|
1204
|
-
if (sidecar
|
|
1230
|
+
if ((sidecar == null ? void 0 : sidecar.patchedDependencies) !== void 0 && Object.keys(sidecar.patchedDependencies).length > 0) {
|
|
1205
1231
|
out.patchedDependencies = sortRecord(sidecar.patchedDependencies);
|
|
1206
1232
|
}
|
|
1207
|
-
if (sidecar
|
|
1233
|
+
if ((sidecar == null ? void 0 : sidecar.trustedDependencies) !== void 0 && sidecar.trustedDependencies.length > 0) {
|
|
1208
1234
|
out.trustedDependencies = [...sidecar.trustedDependencies].sort(cmpStr2);
|
|
1209
1235
|
}
|
|
1210
1236
|
const json = renderJsonc(out);
|
|
@@ -1214,8 +1240,8 @@ function resolveOverridesBlock(callerOverrides, sidecar, emitDiagnostic) {
|
|
|
1214
1240
|
if (callerOverrides !== void 0) {
|
|
1215
1241
|
return callerOverrides.length > 0 ? projectOverrides(callerOverrides, "npm", emitDiagnostic) : void 0;
|
|
1216
1242
|
}
|
|
1217
|
-
if (sidecar
|
|
1218
|
-
if (sidecar
|
|
1243
|
+
if ((sidecar == null ? void 0 : sidecar.nativeOverrides) !== void 0) return sidecar.nativeOverrides;
|
|
1244
|
+
if ((sidecar == null ? void 0 : sidecar.canonicalOverrides) !== void 0 && sidecar.canonicalOverrides.length > 0) {
|
|
1219
1245
|
return projectOverrides(sidecar.canonicalOverrides, "npm", emitDiagnostic);
|
|
1220
1246
|
}
|
|
1221
1247
|
return void 0;
|
|
@@ -1539,7 +1565,7 @@ function isWorkspaceProtocolRange(range) {
|
|
|
1539
1565
|
return range.startsWith("workspace:");
|
|
1540
1566
|
}
|
|
1541
1567
|
function locateRootNode(graph, sidecar) {
|
|
1542
|
-
if (sidecar
|
|
1568
|
+
if ((sidecar == null ? void 0 : sidecar.rootId) !== void 0) {
|
|
1543
1569
|
const node = graph.getNode(sidecar.rootId);
|
|
1544
1570
|
if (node !== void 0) return node;
|
|
1545
1571
|
}
|
|
@@ -1554,6 +1580,7 @@ function locateRootNode(graph, sidecar) {
|
|
|
1554
1580
|
return void 0;
|
|
1555
1581
|
}
|
|
1556
1582
|
function buildWorkspaceManifest(graph, workspaceNode, sidecarManifest, emitDiagnostic = () => void 0) {
|
|
1583
|
+
var _a;
|
|
1557
1584
|
const out = {};
|
|
1558
1585
|
if (workspaceNode !== void 0) {
|
|
1559
1586
|
out.name = workspaceNode.name;
|
|
@@ -1572,7 +1599,7 @@ function buildWorkspaceManifest(graph, workspaceNode, sidecarManifest, emitDiagn
|
|
|
1572
1599
|
for (const edge of graph.out(workspaceNode.id)) {
|
|
1573
1600
|
const dst = graph.getNode(edge.dst);
|
|
1574
1601
|
if (dst === void 0) continue;
|
|
1575
|
-
const range = edge.attrs
|
|
1602
|
+
const range = (_a = edge.attrs) == null ? void 0 : _a.range;
|
|
1576
1603
|
if (typeof range !== "string") continue;
|
|
1577
1604
|
const target = edge.kind === "dep" ? dependencies : edge.kind === "dev" ? devDependencies : edge.kind === "optional" ? optionalDependencies : edge.kind === "peer" ? peerDependencies : void 0;
|
|
1578
1605
|
if (target === void 0) continue;
|
|
@@ -1601,18 +1628,19 @@ function buildWorkspaceManifest(graph, workspaceNode, sidecarManifest, emitDiagn
|
|
|
1601
1628
|
return out;
|
|
1602
1629
|
}
|
|
1603
1630
|
function buildInnerBlock(graph, node, sidecar) {
|
|
1631
|
+
var _a, _b, _c;
|
|
1604
1632
|
const dependencies = {};
|
|
1605
1633
|
const optionalDependencies = {};
|
|
1606
1634
|
const peerDependencies = {};
|
|
1607
1635
|
for (const edge of graph.out(node.id)) {
|
|
1608
1636
|
const dst = graph.getNode(edge.dst);
|
|
1609
1637
|
if (dst === void 0) continue;
|
|
1610
|
-
const range = edge.attrs
|
|
1638
|
+
const range = (_a = edge.attrs) == null ? void 0 : _a.range;
|
|
1611
1639
|
if (typeof range !== "string") continue;
|
|
1612
1640
|
const target = edge.kind === "dep" || edge.kind === "dev" ? dependencies : edge.kind === "optional" ? optionalDependencies : edge.kind === "peer" ? peerDependencies : void 0;
|
|
1613
1641
|
if (target !== void 0) target[dst.name] = range;
|
|
1614
1642
|
}
|
|
1615
|
-
for (const [key, range] of sidecar
|
|
1643
|
+
for (const [key, range] of (sidecar == null ? void 0 : sidecar.peerDeclarations) ?? []) {
|
|
1616
1644
|
const sep = key.indexOf("|");
|
|
1617
1645
|
if (sep < 0 || key.slice(0, sep) !== node.id) continue;
|
|
1618
1646
|
const peerName = key.slice(sep + 1);
|
|
@@ -1622,12 +1650,13 @@ function buildInnerBlock(graph, node, sidecar) {
|
|
|
1622
1650
|
if (Object.keys(dependencies).length > 0) inner.dependencies = sortRecord(dependencies);
|
|
1623
1651
|
if (Object.keys(optionalDependencies).length > 0) inner.optionalDependencies = sortRecord(optionalDependencies);
|
|
1624
1652
|
if (Object.keys(peerDependencies).length > 0) inner.peerDependencies = sortRecord(peerDependencies);
|
|
1625
|
-
const stashedBin = sidecar
|
|
1653
|
+
const stashedBin = (_c = (_b = sidecar == null ? void 0 : sidecar.nodes.get(node.id)) == null ? void 0 : _b.inner) == null ? void 0 : _c.bin;
|
|
1626
1654
|
if (stashedBin !== void 0) inner.bin = stashedBin;
|
|
1627
1655
|
return inner;
|
|
1628
1656
|
}
|
|
1629
1657
|
function chooseNodeEmitKey(node, sidecar, alreadyEmitted) {
|
|
1630
|
-
|
|
1658
|
+
var _a;
|
|
1659
|
+
const stored = (_a = sidecar == null ? void 0 : sidecar.nodes.get(node.id)) == null ? void 0 : _a.packagesKey;
|
|
1631
1660
|
if (stored !== void 0 && alreadyEmitted[stored] === void 0) {
|
|
1632
1661
|
return stored;
|
|
1633
1662
|
}
|
|
@@ -1645,8 +1674,9 @@ function warnPatchDrop(node, warned, emitDiagnostic) {
|
|
|
1645
1674
|
);
|
|
1646
1675
|
}
|
|
1647
1676
|
function warnResolutionDrop(graph, node, warned, emitDiagnostic) {
|
|
1677
|
+
var _a;
|
|
1648
1678
|
if (warned.has(node.id)) return;
|
|
1649
|
-
const canonical = graph.tarballOf(node.id)
|
|
1679
|
+
const canonical = (_a = graph.tarballOf(node.id)) == null ? void 0 : _a.resolution;
|
|
1650
1680
|
if (canonical === void 0) return;
|
|
1651
1681
|
if (canonical.type === "tarball") return;
|
|
1652
1682
|
if (canonical.type === "unknown" && node.patch !== void 0) return;
|
package/dist/formats/npm-1.js
CHANGED
|
@@ -127,11 +127,12 @@ function tarballKeyInputsOfNode(node) {
|
|
|
127
127
|
var cmpStr = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
128
128
|
var cmpAlias = (a, b) => a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : cmpStr(a, b);
|
|
129
129
|
var cmpEdgeBy = (end) => (a, b) => {
|
|
130
|
+
var _a, _b;
|
|
130
131
|
const c = cmpStr(end === "dst" ? a.dst : a.src, end === "dst" ? b.dst : b.src);
|
|
131
132
|
if (c !== 0) return c;
|
|
132
133
|
const k = cmpStr(a.kind, b.kind);
|
|
133
134
|
if (k !== 0) return k;
|
|
134
|
-
return cmpAlias(a.attrs
|
|
135
|
+
return cmpAlias((_a = a.attrs) == null ? void 0 : _a.alias, (_b = b.attrs) == null ? void 0 : _b.alias);
|
|
135
136
|
};
|
|
136
137
|
function emptyState() {
|
|
137
138
|
return {
|
|
@@ -167,7 +168,10 @@ function removeMatching(arr, pred) {
|
|
|
167
168
|
arr.splice(i, 1);
|
|
168
169
|
return true;
|
|
169
170
|
}
|
|
170
|
-
var tripleKey = (e) =>
|
|
171
|
+
var tripleKey = (e) => {
|
|
172
|
+
var _a;
|
|
173
|
+
return `${e.src}\0${e.kind}\0${e.dst}\0${((_a = e.attrs) == null ? void 0 : _a.alias) ?? ""}`;
|
|
174
|
+
};
|
|
171
175
|
function rebindNodeId(s, oldId, newId, newNode) {
|
|
172
176
|
s.nodes.set(newId, newNode);
|
|
173
177
|
s.nodes.delete(oldId);
|
|
@@ -178,7 +182,10 @@ function rebindNodeId(s, oldId, newId, newNode) {
|
|
|
178
182
|
const peerInc = s.incoming.get(e.dst);
|
|
179
183
|
if (peerInc) {
|
|
180
184
|
const idx = peerInc.findIndex(
|
|
181
|
-
(x) =>
|
|
185
|
+
(x) => {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
return x.src === oldId && x.kind === e.kind && x.dst === e.dst && ((_a = x.attrs) == null ? void 0 : _a.alias) === ((_b = e.attrs) == null ? void 0 : _b.alias);
|
|
188
|
+
}
|
|
182
189
|
);
|
|
183
190
|
if (idx >= 0) peerInc[idx] = e;
|
|
184
191
|
}
|
|
@@ -190,7 +197,10 @@ function rebindNodeId(s, oldId, newId, newNode) {
|
|
|
190
197
|
const peerOut = s.outgoing.get(e.src);
|
|
191
198
|
if (peerOut) {
|
|
192
199
|
const idx = peerOut.findIndex(
|
|
193
|
-
(x) =>
|
|
200
|
+
(x) => {
|
|
201
|
+
var _a, _b;
|
|
202
|
+
return x.src === e.src && x.kind === e.kind && x.dst === oldId && ((_a = x.attrs) == null ? void 0 : _a.alias) === ((_b = e.attrs) == null ? void 0 : _b.alias);
|
|
203
|
+
}
|
|
194
204
|
);
|
|
195
205
|
if (idx >= 0) peerOut[idx] = e;
|
|
196
206
|
}
|
|
@@ -203,12 +213,14 @@ function protocolOf(range) {
|
|
|
203
213
|
return /^[a-z][a-z0-9+.-]*$/i.test(prefix) ? prefix : void 0;
|
|
204
214
|
}
|
|
205
215
|
function isPublishedSelfLink(edge) {
|
|
206
|
-
|
|
216
|
+
var _a;
|
|
217
|
+
const range = (_a = edge.attrs) == null ? void 0 : _a.range;
|
|
207
218
|
if (range === void 0) return false;
|
|
208
219
|
const proto = protocolOf(range);
|
|
209
220
|
return proto === void 0 || proto === "npm";
|
|
210
221
|
}
|
|
211
222
|
function validate(s) {
|
|
223
|
+
var _a, _b, _c, _d, _e;
|
|
212
224
|
for (const d of s.diagnostics) {
|
|
213
225
|
if (d.severity === "error") {
|
|
214
226
|
throw new GraphError("INVARIANT_VIOLATION", `unresolved error diagnostic: ${d.code} \u2014 ${d.message}`);
|
|
@@ -225,7 +237,7 @@ function validate(s) {
|
|
|
225
237
|
}
|
|
226
238
|
const k = tripleKey(e);
|
|
227
239
|
if (seen.has(k)) {
|
|
228
|
-
const aliasSuffix = e.attrs
|
|
240
|
+
const aliasSuffix = ((_a = e.attrs) == null ? void 0 : _a.alias) !== void 0 ? ` (alias=${e.attrs.alias})` : "";
|
|
229
241
|
throw new GraphError("INVARIANT_VIOLATION", `duplicate edge: ${e.src} \u2192${e.kind} ${e.dst}${aliasSuffix}`);
|
|
230
242
|
}
|
|
231
243
|
seen.add(k);
|
|
@@ -235,14 +247,14 @@ function validate(s) {
|
|
|
235
247
|
if (node.workspacePath !== void 0) {
|
|
236
248
|
const inc = s.incoming.get(id) ?? [];
|
|
237
249
|
for (const edge of inc) {
|
|
238
|
-
if (s.nodes.get(edge.src)
|
|
239
|
-
if (s.tarballs.get(stripPeerContextFromNodeId(edge.src))
|
|
250
|
+
if (((_b = s.nodes.get(edge.src)) == null ? void 0 : _b.workspacePath) !== void 0) continue;
|
|
251
|
+
if (((_d = (_c = s.tarballs.get(stripPeerContextFromNodeId(edge.src))) == null ? void 0 : _c.resolution) == null ? void 0 : _d.type) === "directory") continue;
|
|
240
252
|
if (isPublishedSelfLink(edge)) {
|
|
241
253
|
s.diagnostics.push({
|
|
242
254
|
code: "SEAL_PUBLISHED_SELF_LINK",
|
|
243
255
|
subject: id,
|
|
244
256
|
severity: "info",
|
|
245
|
-
message: `published self-link: ${edge.src} \u2192${edge.kind} ${id} (range ${edge.attrs
|
|
257
|
+
message: `published self-link: ${edge.src} \u2192${edge.kind} ${id} (range ${(_e = edge.attrs) == null ? void 0 : _e.range}) \u2014 published dependency resolved to co-located workspace`
|
|
246
258
|
});
|
|
247
259
|
continue;
|
|
248
260
|
}
|
|
@@ -316,9 +328,9 @@ var GraphImpl = class _GraphImpl {
|
|
|
316
328
|
}
|
|
317
329
|
}
|
|
318
330
|
*walk(seeds, opts) {
|
|
319
|
-
const direction = opts
|
|
320
|
-
const kinds = opts
|
|
321
|
-
const maxDepth = opts
|
|
331
|
+
const direction = (opts == null ? void 0 : opts.direction) ?? "out";
|
|
332
|
+
const kinds = opts == null ? void 0 : opts.kinds;
|
|
333
|
+
const maxDepth = (opts == null ? void 0 : opts.maxDepth) ?? Infinity;
|
|
322
334
|
const visited = /* @__PURE__ */ new Set();
|
|
323
335
|
const initial = Array.isArray(seeds) ? seeds : [seeds];
|
|
324
336
|
const stack = [];
|
|
@@ -526,8 +538,11 @@ var GraphImpl = class _GraphImpl {
|
|
|
526
538
|
if (!next.nodes.has(src)) throw new GraphError("PATCH_REJECTED", `addEdge: src ${src} missing`);
|
|
527
539
|
if (!next.nodes.has(dst)) throw new GraphError("PATCH_REJECTED", `addEdge: dst ${dst} missing`);
|
|
528
540
|
const existing = next.outgoing.get(src) ?? [];
|
|
529
|
-
const newAlias = attrs
|
|
530
|
-
if (existing.some((e2) =>
|
|
541
|
+
const newAlias = attrs == null ? void 0 : attrs.alias;
|
|
542
|
+
if (existing.some((e2) => {
|
|
543
|
+
var _a;
|
|
544
|
+
return e2.dst === dst && e2.kind === kind && ((_a = e2.attrs) == null ? void 0 : _a.alias) === newAlias;
|
|
545
|
+
})) {
|
|
531
546
|
const aliasSuffix = newAlias !== void 0 ? ` (alias=${newAlias})` : "";
|
|
532
547
|
throw new GraphError("PATCH_REJECTED", `addEdge: duplicate ${src} \u2192${kind} ${dst}${aliasSuffix}`);
|
|
533
548
|
}
|
|
@@ -537,16 +552,20 @@ var GraphImpl = class _GraphImpl {
|
|
|
537
552
|
applied.push({ kind: "edge-added", subject: { src, dst, kind } });
|
|
538
553
|
},
|
|
539
554
|
removeEdge(src, dst, kind) {
|
|
555
|
+
var _a, _b;
|
|
540
556
|
const outs = next.outgoing.get(src);
|
|
541
557
|
let removedAlias;
|
|
542
|
-
const found = outs
|
|
558
|
+
const found = (outs == null ? void 0 : outs.findIndex((e) => e.dst === dst && e.kind === kind)) ?? -1;
|
|
543
559
|
if (!outs || found < 0) {
|
|
544
560
|
throw new GraphError("PATCH_REJECTED", `removeEdge: ${src} \u2192${kind} ${dst} missing`);
|
|
545
561
|
}
|
|
546
|
-
removedAlias = outs[found]
|
|
562
|
+
removedAlias = (_b = (_a = outs[found]) == null ? void 0 : _a.attrs) == null ? void 0 : _b.alias;
|
|
547
563
|
outs.splice(found, 1);
|
|
548
564
|
const ins = next.incoming.get(dst);
|
|
549
|
-
if (ins) removeMatching(ins, (e) =>
|
|
565
|
+
if (ins) removeMatching(ins, (e) => {
|
|
566
|
+
var _a2;
|
|
567
|
+
return e.src === src && e.kind === kind && ((_a2 = e.attrs) == null ? void 0 : _a2.alias) === removedAlias;
|
|
568
|
+
});
|
|
550
569
|
applied.push({ kind: "edge-removed", subject: { src, dst, kind } });
|
|
551
570
|
},
|
|
552
571
|
replacePeerContext(id, peers) {
|
|
@@ -885,6 +904,7 @@ function extractShaFromFragment(fragment) {
|
|
|
885
904
|
return SHA_FRAG_RE.test(fragment) ? fragment : void 0;
|
|
886
905
|
}
|
|
887
906
|
function hostingProviderOf(url) {
|
|
907
|
+
var _a;
|
|
888
908
|
let host;
|
|
889
909
|
if (url.startsWith("https://") || url.startsWith("http://") || url.startsWith("git://")) {
|
|
890
910
|
const noScheme = url.replace(/^[a-z+]+:\/\//, "");
|
|
@@ -894,7 +914,7 @@ function hostingProviderOf(url) {
|
|
|
894
914
|
} else if (url.startsWith("ssh://")) {
|
|
895
915
|
const noScheme = url.slice("ssh://".length);
|
|
896
916
|
const afterUser = noScheme.includes("@") ? noScheme.split("@").slice(1).join("@") : noScheme;
|
|
897
|
-
host = afterUser.split("/")[0]
|
|
917
|
+
host = (_a = afterUser.split("/")[0]) == null ? void 0 : _a.split(":")[0];
|
|
898
918
|
}
|
|
899
919
|
return host === void 0 ? void 0 : hostingProviderOfHost(host);
|
|
900
920
|
}
|
|
@@ -1202,18 +1222,20 @@ function parse2(input, _options = {}) {
|
|
|
1202
1222
|
}
|
|
1203
1223
|
}
|
|
1204
1224
|
function stringify(graph, options = {}) {
|
|
1225
|
+
var _a, _b;
|
|
1205
1226
|
const sidecar = sidecarByGraph.get(graph);
|
|
1206
1227
|
const emitDiagnostic = (diagnostic) => {
|
|
1207
|
-
|
|
1228
|
+
var _a2;
|
|
1229
|
+
(_a2 = options.onDiagnostic) == null ? void 0 : _a2.call(options, diagnostic);
|
|
1208
1230
|
};
|
|
1209
1231
|
const warnedPeerVirt = /* @__PURE__ */ new Set();
|
|
1210
1232
|
const warnedPatches = /* @__PURE__ */ new Set();
|
|
1211
1233
|
const warnedPeerEdges = /* @__PURE__ */ new Set();
|
|
1212
1234
|
const warnedWorkspaces = /* @__PURE__ */ new Set();
|
|
1213
1235
|
const rootNode = locateRootNode(graph, sidecar);
|
|
1214
|
-
const rootMeta = sidecar
|
|
1215
|
-
const rootName = rootMeta
|
|
1216
|
-
const rootVersion = rootMeta
|
|
1236
|
+
const rootMeta = sidecar == null ? void 0 : sidecar.rootMeta;
|
|
1237
|
+
const rootName = (rootMeta == null ? void 0 : rootMeta.name) ?? (rootNode == null ? void 0 : rootNode.name) ?? "";
|
|
1238
|
+
const rootVersion = (rootMeta == null ? void 0 : rootMeta.version) ?? (rootNode == null ? void 0 : rootNode.version) ?? "0.0.0";
|
|
1217
1239
|
const emittableIds = /* @__PURE__ */ new Set();
|
|
1218
1240
|
for (const node of graph.nodes()) {
|
|
1219
1241
|
warnPatchDrop(node, warnedPatches, emitDiagnostic);
|
|
@@ -1241,7 +1263,7 @@ function stringify(graph, options = {}) {
|
|
|
1241
1263
|
}
|
|
1242
1264
|
for (const node of graph.nodes()) {
|
|
1243
1265
|
for (const edge of graph.out(node.id, "peer")) {
|
|
1244
|
-
const key = `${edge.src}\0${edge.dst}\0${edge.attrs
|
|
1266
|
+
const key = `${edge.src}\0${edge.dst}\0${((_a = edge.attrs) == null ? void 0 : _a.range) ?? ""}`;
|
|
1245
1267
|
if (warnedPeerEdges.has(key)) continue;
|
|
1246
1268
|
warnedPeerEdges.add(key);
|
|
1247
1269
|
const dst = graph.getNode(edge.dst);
|
|
@@ -1249,17 +1271,17 @@ function stringify(graph, options = {}) {
|
|
|
1249
1271
|
code: "NPM_V1_PEER_DROPPED",
|
|
1250
1272
|
severity: "warning",
|
|
1251
1273
|
subject: edge.src,
|
|
1252
|
-
message: dst === void 0 || edge.attrs
|
|
1274
|
+
message: dst === void 0 || ((_b = edge.attrs) == null ? void 0 : _b.range) === void 0 ? `peer edge ${edge.src} -> ${edge.dst} is unsupported in npm-1; dropping on emit` : `peer edge ${edge.src} -> ${dst.name}@${edge.attrs.range} is unsupported in npm-1; dropping on emit`
|
|
1253
1275
|
});
|
|
1254
1276
|
}
|
|
1255
1277
|
}
|
|
1256
|
-
const rootId = rootNode
|
|
1278
|
+
const rootId = (rootNode == null ? void 0 : rootNode.id) ?? `${rootName}@${rootVersion}`;
|
|
1257
1279
|
const dependencies = buildDependenciesTree(graph, sidecar, rootId, emittableIds);
|
|
1258
1280
|
const out = {
|
|
1259
1281
|
name: rootName,
|
|
1260
1282
|
version: rootVersion,
|
|
1261
1283
|
lockfileVersion: 1,
|
|
1262
|
-
requires: rootMeta
|
|
1284
|
+
requires: (rootMeta == null ? void 0 : rootMeta.requires) ?? true
|
|
1263
1285
|
};
|
|
1264
1286
|
if (dependencies !== void 0 && Object.keys(dependencies).length > 0) {
|
|
1265
1287
|
out.dependencies = sortRecord(dependencies);
|
|
@@ -1273,8 +1295,8 @@ function enrich(graph, options = {}) {
|
|
|
1273
1295
|
const sidecar = sidecarByGraph.get(graph);
|
|
1274
1296
|
const diagnostics = [];
|
|
1275
1297
|
for (const node of graph.nodes()) {
|
|
1276
|
-
const nodeSide = sidecar
|
|
1277
|
-
const rawPeers = nodeSide
|
|
1298
|
+
const nodeSide = sidecar == null ? void 0 : sidecar.nodes.get(node.id);
|
|
1299
|
+
const rawPeers = nodeSide == null ? void 0 : nodeSide.peerDependencies;
|
|
1278
1300
|
if (rawPeers === void 0) continue;
|
|
1279
1301
|
for (const [peerName, range] of Object.entries(rawPeers).sort((a, b) => cmpStr2(a[0], b[0]))) {
|
|
1280
1302
|
const outcome = derivePeerCandidates(graph, peerName, range);
|
|
@@ -1441,7 +1463,7 @@ function resolveTreeTarget(name, _installPath, currentDeps, parentScopes) {
|
|
|
1441
1463
|
return void 0;
|
|
1442
1464
|
}
|
|
1443
1465
|
function locateRootNode(graph, sidecar) {
|
|
1444
|
-
if (sidecar
|
|
1466
|
+
if ((sidecar == null ? void 0 : sidecar.rootId) !== void 0) {
|
|
1445
1467
|
const node = graph.getNode(sidecar.rootId);
|
|
1446
1468
|
if (node !== void 0) return node;
|
|
1447
1469
|
}
|
|
@@ -1546,10 +1568,11 @@ function buildLayer(layer, parentPath, graph, sidecar, treeByParent) {
|
|
|
1546
1568
|
return sortRecord(out);
|
|
1547
1569
|
}
|
|
1548
1570
|
function buildEntry(node, installPath, graph, sidecar, treeByParent) {
|
|
1571
|
+
var _a;
|
|
1549
1572
|
const entry = { version: node.version };
|
|
1550
|
-
const nodeSide = sidecar
|
|
1573
|
+
const nodeSide = sidecar == null ? void 0 : sidecar.nodes.get(node.id);
|
|
1551
1574
|
const tarball = graph.tarballOf(node.id);
|
|
1552
|
-
const resolutionStr = tarball
|
|
1575
|
+
const resolutionStr = (tarball == null ? void 0 : tarball.nativeResolution) ?? deriveResolvedFromCanonical(tarball == null ? void 0 : tarball.resolution);
|
|
1553
1576
|
if (resolutionStr !== void 0) {
|
|
1554
1577
|
if (/^(git[+:]|github:)/.test(resolutionStr)) {
|
|
1555
1578
|
entry.version = resolutionStr;
|
|
@@ -1559,22 +1582,22 @@ function buildEntry(node, installPath, graph, sidecar, treeByParent) {
|
|
|
1559
1582
|
entry.resolved = resolutionStr;
|
|
1560
1583
|
}
|
|
1561
1584
|
}
|
|
1562
|
-
if (tarball
|
|
1585
|
+
if ((tarball == null ? void 0 : tarball.integrity) !== void 0 && !/^(git[+:]|github:)/.test(entry.version ?? "")) {
|
|
1563
1586
|
const sri = emitSri(tarball.integrity);
|
|
1564
1587
|
if (sri !== void 0) entry.integrity = sri;
|
|
1565
1588
|
}
|
|
1566
|
-
if (nodeSide
|
|
1567
|
-
if (nodeSide
|
|
1568
|
-
if (nodeSide
|
|
1589
|
+
if ((nodeSide == null ? void 0 : nodeSide.dev) === true) entry.dev = true;
|
|
1590
|
+
if ((nodeSide == null ? void 0 : nodeSide.optional) === true) entry.optional = true;
|
|
1591
|
+
if ((nodeSide == null ? void 0 : nodeSide.inBundle) === true) entry.bundled = true;
|
|
1569
1592
|
const requires = {};
|
|
1570
1593
|
for (const edge of graph.out(node.id)) {
|
|
1571
1594
|
if (edge.kind === "peer") continue;
|
|
1572
|
-
const range = edge.attrs
|
|
1595
|
+
const range = (_a = edge.attrs) == null ? void 0 : _a[NPM_EDGE_RANGE_ATTR];
|
|
1573
1596
|
if (typeof range !== "string") continue;
|
|
1574
1597
|
const dst = graph.getNode(edge.dst);
|
|
1575
1598
|
if (dst === void 0) continue;
|
|
1576
1599
|
const edgeKey = edgeTripleKey(edge.src, edge.kind, edge.dst);
|
|
1577
|
-
const declaredName = sidecar
|
|
1600
|
+
const declaredName = (sidecar == null ? void 0 : sidecar.edgeDeclaredNames.get(edgeKey)) ?? dst.name;
|
|
1578
1601
|
requires[declaredName] = range;
|
|
1579
1602
|
}
|
|
1580
1603
|
if (Object.keys(requires).length > 0) entry.requires = sortRecord(requires);
|
|
@@ -1657,6 +1680,7 @@ function hoistedAtPath(hoistedByName, placements, graph, parentPath, name) {
|
|
|
1657
1680
|
return void 0;
|
|
1658
1681
|
}
|
|
1659
1682
|
function firstConsumerInstallPath(graph, sidecar, id, emittableIds) {
|
|
1683
|
+
var _a;
|
|
1660
1684
|
const node = graph.getNode(id);
|
|
1661
1685
|
if (node === void 0) return void 0;
|
|
1662
1686
|
for (const incoming of graph.in(id)) {
|
|
@@ -1665,7 +1689,7 @@ function firstConsumerInstallPath(graph, sidecar, id, emittableIds) {
|
|
|
1665
1689
|
const consumer = graph.getNode(incoming.src);
|
|
1666
1690
|
if (consumer === void 0) continue;
|
|
1667
1691
|
if (consumer.workspacePath === "") continue;
|
|
1668
|
-
const consumerPaths = sidecar
|
|
1692
|
+
const consumerPaths = ((_a = sidecar == null ? void 0 : sidecar.nodes.get(consumer.id)) == null ? void 0 : _a.installPaths) ?? [];
|
|
1669
1693
|
if (consumerPaths.length === 0) continue;
|
|
1670
1694
|
return `${consumerPaths[0]}/node_modules/${node.name}`;
|
|
1671
1695
|
}
|
|
@@ -1692,8 +1716,9 @@ function warnPatchDrop(node, warned, emitDiagnostic) {
|
|
|
1692
1716
|
);
|
|
1693
1717
|
}
|
|
1694
1718
|
function planManifestEnrich(graph, sidecar, manifests) {
|
|
1719
|
+
var _a;
|
|
1695
1720
|
const rootManifest = manifests[""];
|
|
1696
|
-
const rootNodeId = sidecar
|
|
1721
|
+
const rootNodeId = sidecar == null ? void 0 : sidecar.rootId;
|
|
1697
1722
|
const existingRoot = rootNodeId !== void 0 ? graph.getNode(rootNodeId) : void 0;
|
|
1698
1723
|
const addMemberNodes = [];
|
|
1699
1724
|
const memberNodeReplacements = [];
|
|
@@ -1763,7 +1788,10 @@ function planManifestEnrich(graph, sidecar, manifests) {
|
|
|
1763
1788
|
for (const edge of desired) {
|
|
1764
1789
|
const list = existingByDst.get(edge.dst) ?? [];
|
|
1765
1790
|
const match = list.some(
|
|
1766
|
-
(c) =>
|
|
1791
|
+
(c) => {
|
|
1792
|
+
var _a2, _b, _c, _d;
|
|
1793
|
+
return c.kind === edge.kind && c.dst === edge.dst && (((_a2 = c.attrs) == null ? void 0 : _a2.range) ?? void 0) === ((_b = edge.attrs) == null ? void 0 : _b.range) && (((_c = c.attrs) == null ? void 0 : _c.workspace) ?? void 0) === ((_d = edge.attrs) == null ? void 0 : _d.workspace);
|
|
1794
|
+
}
|
|
1767
1795
|
);
|
|
1768
1796
|
if (!match) addRootEdges.push(edge);
|
|
1769
1797
|
}
|
|
@@ -1771,7 +1799,7 @@ function planManifestEnrich(graph, sidecar, manifests) {
|
|
|
1771
1799
|
for (const node of graph.nodes()) {
|
|
1772
1800
|
for (const edge of graph.out(node.id)) {
|
|
1773
1801
|
if (edge.kind === "peer") continue;
|
|
1774
|
-
if (edge.attrs
|
|
1802
|
+
if (((_a = edge.attrs) == null ? void 0 : _a.workspace) === true) continue;
|
|
1775
1803
|
const dst = graph.getNode(edge.dst);
|
|
1776
1804
|
if (dst === void 0) continue;
|
|
1777
1805
|
if (!memberByName.has(dst.name)) continue;
|
|
@@ -1811,7 +1839,10 @@ function resolveManifestTarget(graph, name, range, memberByName, prospectiveIds)
|
|
|
1811
1839
|
}
|
|
1812
1840
|
const candidates = graph.byName(name);
|
|
1813
1841
|
if (candidates.length === 1) return candidates[0];
|
|
1814
|
-
return candidates.find((id) =>
|
|
1842
|
+
return candidates.find((id) => {
|
|
1843
|
+
var _a;
|
|
1844
|
+
return ((_a = graph.getNode(id)) == null ? void 0 : _a.version) === range;
|
|
1845
|
+
});
|
|
1815
1846
|
}
|
|
1816
1847
|
function isWorkspaceProtocolRange(range) {
|
|
1817
1848
|
return range.startsWith("workspace:");
|