@antongolub/lockfile 0.0.0-snapshot.44 → 0.0.0-snapshot.45

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.
Files changed (43) hide show
  1. package/dist/{_npm-flat-types-DwOV4BpV.d.ts → _npm-flat-types-5XRp-_Te.d.ts} +1 -1
  2. package/dist/{_pnpm-flat-core-_4KM9kQj.d.ts → _pnpm-flat-core-DtT-PfX-.d.ts} +1 -1
  3. package/dist/{_yarn-berry-core-EKBJ_ohM.d.ts → _yarn-berry-core-nexIf1L1.d.ts} +1 -1
  4. package/dist/complete.d.ts +68 -0
  5. package/dist/complete.js +298 -0
  6. package/dist/formats/bun-text.d.ts +1 -1
  7. package/dist/formats/bun-text.js +6 -0
  8. package/dist/formats/npm-1.d.ts +1 -1
  9. package/dist/formats/npm-1.js +6 -0
  10. package/dist/formats/npm-2.d.ts +2 -2
  11. package/dist/formats/npm-2.js +6 -0
  12. package/dist/formats/npm-3.d.ts +2 -2
  13. package/dist/formats/npm-3.js +6 -0
  14. package/dist/formats/pnpm-v5.d.ts +1 -1
  15. package/dist/formats/pnpm-v5.js +6 -0
  16. package/dist/formats/pnpm-v6.d.ts +2 -2
  17. package/dist/formats/pnpm-v6.js +6 -0
  18. package/dist/formats/pnpm-v9.d.ts +2 -2
  19. package/dist/formats/pnpm-v9.js +6 -0
  20. package/dist/formats/yarn-berry-v4.d.ts +2 -2
  21. package/dist/formats/yarn-berry-v4.js +46 -1
  22. package/dist/formats/yarn-berry-v5.d.ts +2 -2
  23. package/dist/formats/yarn-berry-v5.js +46 -1
  24. package/dist/formats/yarn-berry-v6.d.ts +2 -2
  25. package/dist/formats/yarn-berry-v6.js +46 -1
  26. package/dist/formats/yarn-berry-v7.d.ts +2 -2
  27. package/dist/formats/yarn-berry-v7.js +46 -1
  28. package/dist/formats/yarn-berry-v8.d.ts +2 -2
  29. package/dist/formats/yarn-berry-v8.js +46 -1
  30. package/dist/formats/yarn-berry-v9.d.ts +2 -2
  31. package/dist/formats/yarn-berry-v9.js +46 -1
  32. package/dist/formats/yarn-classic.d.ts +1 -1
  33. package/dist/formats/yarn-classic.js +36 -1
  34. package/dist/{graph-BzsItuAI.d.ts → graph-DbCmOfBk.d.ts} +2 -1
  35. package/dist/index.d.ts +4 -1
  36. package/dist/index.js +1569 -59
  37. package/dist/modify-Qsze2kCh.d.ts +218 -0
  38. package/dist/modify.d.ts +20 -0
  39. package/dist/modify.js +988 -0
  40. package/dist/registry.d.ts +60 -0
  41. package/dist/registry.js +649 -0
  42. package/dist/types-Ci06KZkZ.d.ts +46 -0
  43. package/package.json +13 -1
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic } from './graph-BzsItuAI.js';
1
+ import { D as Diagnostic } from './graph-DbCmOfBk.js';
2
2
 
3
3
  interface NpmFamilyParseOptions {
4
4
  }
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic } from './graph-BzsItuAI.js';
1
+ import { D as Diagnostic } from './graph-DbCmOfBk.js';
2
2
 
3
3
  interface PnpmFamilyParseOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic } from './graph-BzsItuAI.js';
1
+ import { D as Diagnostic } from './graph-DbCmOfBk.js';
2
2
 
3
3
  interface YarnBerryFamilyParseOptions {
4
4
  workspaceRoot?: string;
@@ -0,0 +1,68 @@
1
+ import { N as NodeId, D as Diagnostic, G as Graph, E as EdgeTriple, a as Node, b as EdgeKind } from './graph-DbCmOfBk.js';
2
+ import { R as RegistryAdapter } from './types-Ci06KZkZ.js';
3
+
4
+ interface CompletionSeed {
5
+ /** NodeIds the modifier added in the just-completed mutate phase. */
6
+ recentlyAdded: Set<NodeId>;
7
+ /** NodeIds the mutate phase orphaned. The completion frontier excludes
8
+ * these — optimize phase collects. */
9
+ recentlyOrphaned: Set<NodeId>;
10
+ }
11
+ interface CompletionResult {
12
+ graph: Graph;
13
+ added: NodeId[];
14
+ wired: EdgeTriple[];
15
+ unresolved: Diagnostic[];
16
+ }
17
+ interface CompletionOptions {
18
+ seed?: CompletionSeed;
19
+ onDiagnostic?: (d: Diagnostic) => void;
20
+ }
21
+ /**
22
+ * Walk graph, query registry for missing transitive deps, wire edges.
23
+ * Monotone-additive: returned graph ⊇ input graph (no removals).
24
+ */
25
+ declare function completeTransitives(graph: Graph, registry: RegistryAdapter, options?: CompletionOptions): Promise<CompletionResult>;
26
+
27
+ /**
28
+ * Walk consumer → root via incoming-edge BFS.
29
+ * Returns nodes in BFS order: consumer first, deeper ancestors last.
30
+ * Cycles tolerated via `seen`.
31
+ */
32
+ declare function ancestorsOf(graph: Graph, consumer: NodeId): Node[];
33
+ /**
34
+ * Find-up resolve per ADR-0023 §5.1.
35
+ *
36
+ * Returns the closest-ancestor satisfying node, or undefined if either
37
+ * (a) no ancestor declares `name` at all → caller may install nested at the
38
+ * consumer's level, or
39
+ * (b) the closest ancestor that declares `name` does so with a conflicting
40
+ * range → "block hoist", caller installs nested fallback (npm-3 style).
41
+ *
42
+ * Tiebreaker:
43
+ * 1. Highest semver-comparable version wins (`semver.rcompare`).
44
+ * 2. On version tie, lowest NodeId lex order wins.
45
+ *
46
+ * `depKind` is part of the §5.1 normative signature but does NOT affect the
47
+ * algorithm body in v1: every dep-kind (dep / dev / optional / peer) follows
48
+ * the same closest-ancestor reuse + block-hoist contract. The parameter is
49
+ * carried verbatim so future kind-filtered hoist policies (e.g. peer-deps
50
+ * needing a stricter find-up, or optional-deps allowed to silently fail
51
+ * differently from regular deps) can branch on it without a signature
52
+ * migration. Per the ADR §5.1 pseudocode body and the v1 normative scope, no
53
+ * kind-specific branch is taken yet.
54
+ */
55
+ declare function resolveFindUp(graph: Graph, consumerId: NodeId, name: string, range: string, depKind: EdgeKind): NodeId | undefined;
56
+
57
+ type CompletionDiagnosticCode = 'COMPLETION_NODE_ADDED' | 'COMPLETION_EDGE_RESOLVED' | 'COMPLETION_UNRESOLVED' | 'COMPLETION_NODE_UNKNOWN' | 'COMPLETION_VERSION_UNKNOWN' | 'COMPLETION_PEER_CONTEXT_INCOMPLETE';
58
+ interface CompletionDiagnostic extends Diagnostic {
59
+ code: CompletionDiagnosticCode;
60
+ }
61
+ declare function completionNodeAdded(nodeId: NodeId): CompletionDiagnostic;
62
+ declare function completionEdgeResolved(triple: EdgeTriple): CompletionDiagnostic;
63
+ declare function completionUnresolved(consumer: NodeId, depName: string, depRange: string): CompletionDiagnostic;
64
+ declare function completionNodeUnknown(nodeId: NodeId): CompletionDiagnostic;
65
+ declare function completionVersionUnknown(nodeId: NodeId): CompletionDiagnostic;
66
+ declare function completionPeerContextIncomplete(nodeId: NodeId, peerName: string, peerRange: string): CompletionDiagnostic;
67
+
68
+ export { type CompletionDiagnostic, type CompletionDiagnosticCode, type CompletionOptions, type CompletionResult, type CompletionSeed, ancestorsOf, completeTransitives, completionEdgeResolved, completionNodeAdded, completionNodeUnknown, completionPeerContextIncomplete, completionUnresolved, completionVersionUnknown, resolveFindUp };
@@ -0,0 +1,298 @@
1
+ import 'crypto';
2
+ import 'buffer';
3
+ import semver from 'semver';
4
+
5
+ // src/main/ts/errors.ts
6
+
7
+ // src/main/ts/graph.ts
8
+ function serializeNodeId(name, version, peerContext, patch) {
9
+ const base = toTarballKey({ name, version});
10
+ if (peerContext.length === 0) return base;
11
+ return base + peerContext.map((p) => `(${p})`).join("");
12
+ }
13
+ function toTarballKey(inputs) {
14
+ const slots = [];
15
+ return slots.length === 0 ? `${inputs.name}@${inputs.version}` : `${inputs.name}@${inputs.version}+${slots.sort(cmpStr).join("+")}`;
16
+ }
17
+ var cmpStr = (a, b) => a < b ? -1 : a > b ? 1 : 0;
18
+ var cmpStr2 = (a, b) => a < b ? -1 : a > b ? 1 : 0;
19
+ function ancestorsOf(graph, consumer) {
20
+ const consumerNode = graph.getNode(consumer);
21
+ if (consumerNode === void 0) return [];
22
+ const result = [consumerNode];
23
+ const seen = /* @__PURE__ */ new Set([consumer]);
24
+ const queue = [consumer];
25
+ while (queue.length > 0) {
26
+ const cur = queue.shift();
27
+ for (const edge of graph.in(cur)) {
28
+ if (seen.has(edge.src)) continue;
29
+ const srcNode = graph.getNode(edge.src);
30
+ if (srcNode === void 0) continue;
31
+ seen.add(edge.src);
32
+ result.push(srcNode);
33
+ queue.push(edge.src);
34
+ }
35
+ }
36
+ return result;
37
+ }
38
+ function resolveFindUp(graph, consumerId, name, range, depKind) {
39
+ const path = ancestorsOf(graph, consumerId);
40
+ for (const ancestor of path) {
41
+ const candidates = [];
42
+ for (const edge of graph.out(ancestor.id)) {
43
+ const dst = graph.getNode(edge.dst);
44
+ if (dst === void 0) continue;
45
+ if (dst.name === name) candidates.push(dst);
46
+ }
47
+ if (candidates.length === 0) continue;
48
+ const satisfying = candidates.filter((c) => safeSatisfies(c.version, range));
49
+ if (satisfying.length === 0) {
50
+ return void 0;
51
+ }
52
+ satisfying.sort((a, b) => {
53
+ const v = semverRcompareSafe(a.version, b.version);
54
+ if (v !== 0) return v;
55
+ return cmpStr2(a.id, b.id);
56
+ });
57
+ return satisfying[0].id;
58
+ }
59
+ return void 0;
60
+ }
61
+ function safeSatisfies(version, range) {
62
+ try {
63
+ return semver.satisfies(version, range);
64
+ } catch {
65
+ return false;
66
+ }
67
+ }
68
+ function semverRcompareSafe(a, b) {
69
+ const va = semver.valid(a);
70
+ const vb = semver.valid(b);
71
+ if (va !== null && vb !== null) return semver.rcompare(a, b);
72
+ return cmpStr2(b, a);
73
+ }
74
+
75
+ // src/main/ts/complete/diagnostics.ts
76
+ function completionNodeAdded(nodeId) {
77
+ return {
78
+ code: "COMPLETION_NODE_ADDED",
79
+ severity: "info",
80
+ subject: nodeId,
81
+ message: `completion added ${nodeId}`
82
+ };
83
+ }
84
+ function completionEdgeResolved(triple) {
85
+ return {
86
+ code: "COMPLETION_EDGE_RESOLVED",
87
+ severity: "info",
88
+ subject: triple,
89
+ message: `wired ${triple.src} \u2192${triple.kind} ${triple.dst} via find-up reuse`
90
+ };
91
+ }
92
+ function completionUnresolved(consumer, depName, depRange) {
93
+ return {
94
+ code: "COMPLETION_UNRESOLVED",
95
+ severity: "warning",
96
+ subject: consumer,
97
+ message: `cannot resolve ${depName}@${depRange} for consumer ${consumer}`
98
+ };
99
+ }
100
+ function completionNodeUnknown(nodeId) {
101
+ return {
102
+ code: "COMPLETION_NODE_UNKNOWN",
103
+ severity: "warning",
104
+ subject: nodeId,
105
+ message: `registry has no packument for ${nodeId}`
106
+ };
107
+ }
108
+ function completionVersionUnknown(nodeId) {
109
+ return {
110
+ code: "COMPLETION_VERSION_UNKNOWN",
111
+ severity: "warning",
112
+ subject: nodeId,
113
+ message: `packument lacks version for ${nodeId}`
114
+ };
115
+ }
116
+ function completionPeerContextIncomplete(nodeId, peerName, peerRange) {
117
+ return {
118
+ code: "COMPLETION_PEER_CONTEXT_INCOMPLETE",
119
+ severity: "warning",
120
+ subject: nodeId,
121
+ message: `peer ${peerName}@${peerRange} unresolved at completion for ${nodeId}`
122
+ };
123
+ }
124
+
125
+ // src/main/ts/complete/tree-complete.ts
126
+ var EMPTY_SEED = {
127
+ recentlyAdded: /* @__PURE__ */ new Set(),
128
+ recentlyOrphaned: /* @__PURE__ */ new Set()
129
+ };
130
+ async function completeTransitives(graph, registry, options = {}) {
131
+ const seed = options.seed ?? EMPTY_SEED;
132
+ const onDiagnostic = options.onDiagnostic;
133
+ const visited = /* @__PURE__ */ new Set();
134
+ const added = [];
135
+ const wired = [];
136
+ const unresolved = [];
137
+ let currentGraph = graph;
138
+ const emit = (d) => {
139
+ unresolved.push(d);
140
+ if (onDiagnostic !== void 0) onDiagnostic(d);
141
+ };
142
+ const emitAndLand = (d) => {
143
+ emit(d);
144
+ currentGraph = currentGraph.mutate((m) => {
145
+ m.diagnostic(d);
146
+ }).graph;
147
+ };
148
+ const frontier = [];
149
+ for (const root of currentGraph.roots()) {
150
+ if (!seed.recentlyOrphaned.has(root)) frontier.push(root);
151
+ }
152
+ for (const id of seed.recentlyAdded) {
153
+ if (!seed.recentlyOrphaned.has(id)) frontier.push(id);
154
+ }
155
+ while (frontier.length > 0) {
156
+ const nodeId = frontier.shift();
157
+ if (visited.has(nodeId)) continue;
158
+ visited.add(nodeId);
159
+ const node = currentGraph.getNode(nodeId);
160
+ if (node === void 0) continue;
161
+ if (node.workspacePath !== void 0) {
162
+ for (const edge of currentGraph.out(nodeId)) {
163
+ if (!visited.has(edge.dst)) frontier.push(edge.dst);
164
+ }
165
+ continue;
166
+ }
167
+ const packument = await registry.packument(node.name);
168
+ if (packument === void 0) {
169
+ for (const edge of currentGraph.out(nodeId)) {
170
+ if (!visited.has(edge.dst)) frontier.push(edge.dst);
171
+ }
172
+ emitAndLand(completionNodeUnknown(nodeId));
173
+ continue;
174
+ }
175
+ const pv = packument.versions[node.version];
176
+ if (pv === void 0) {
177
+ for (const edge of currentGraph.out(nodeId)) {
178
+ if (!visited.has(edge.dst)) frontier.push(edge.dst);
179
+ }
180
+ emitAndLand(completionVersionUnknown(nodeId));
181
+ continue;
182
+ }
183
+ const depBuckets = [
184
+ { deps: pv.dependencies, kind: "dep" },
185
+ { deps: pv.devDependencies, kind: "dev" },
186
+ { deps: pv.optionalDependencies, kind: "optional" },
187
+ { deps: pv.peerDependencies, kind: "peer" }
188
+ ];
189
+ for (const { deps, kind } of depBuckets) {
190
+ if (deps === void 0) continue;
191
+ const depNames = Object.keys(deps).sort(cmpStr3);
192
+ for (const depName of depNames) {
193
+ const depRange = deps[depName];
194
+ if (alreadyWired(currentGraph, nodeId, depName, kind)) continue;
195
+ const targetId = resolveFindUp(currentGraph, nodeId, depName, depRange);
196
+ if (targetId !== void 0) {
197
+ if (kind === "peer") {
198
+ emitAndLand(completionPeerContextIncomplete(nodeId, depName, depRange));
199
+ continue;
200
+ }
201
+ const triple2 = { src: nodeId, dst: targetId, kind };
202
+ const resolvedDiag = completionEdgeResolved(triple2);
203
+ const result2 = currentGraph.mutate((m) => {
204
+ m.addEdge(nodeId, targetId, kind, { range: depRange });
205
+ m.diagnostic(resolvedDiag);
206
+ });
207
+ currentGraph = result2.graph;
208
+ wired.push(triple2);
209
+ emit(resolvedDiag);
210
+ if (!visited.has(targetId)) frontier.push(targetId);
211
+ continue;
212
+ }
213
+ const resolved = await registry.resolve(depName, depRange);
214
+ if (resolved === void 0) {
215
+ if (kind === "peer") {
216
+ emitAndLand(completionPeerContextIncomplete(nodeId, depName, depRange));
217
+ } else {
218
+ emitAndLand(completionUnresolved(nodeId, depName, depRange));
219
+ }
220
+ continue;
221
+ }
222
+ const newId = serializeNodeId(resolved.name, resolved.version, []);
223
+ const newNode = {
224
+ id: newId,
225
+ name: resolved.name,
226
+ version: resolved.version,
227
+ peerContext: []
228
+ };
229
+ const { inputs, payload } = projectPackumentVersion(resolved);
230
+ if (kind === "peer") {
231
+ emitAndLand(completionPeerContextIncomplete(nodeId, depName, depRange));
232
+ continue;
233
+ }
234
+ let alreadyAdded = false;
235
+ const nodeAddedDiag = completionNodeAdded(newId);
236
+ const result = currentGraph.mutate((m) => {
237
+ if (currentGraph.getNode(newId) === void 0) {
238
+ m.addNode(newNode);
239
+ m.setTarball(inputs, payload);
240
+ m.diagnostic(nodeAddedDiag);
241
+ } else {
242
+ alreadyAdded = true;
243
+ }
244
+ m.addEdge(nodeId, newId, kind, { range: depRange });
245
+ });
246
+ currentGraph = result.graph;
247
+ if (!alreadyAdded) {
248
+ added.push(newId);
249
+ emit(nodeAddedDiag);
250
+ }
251
+ const triple = { src: nodeId, dst: newId, kind };
252
+ wired.push(triple);
253
+ if (!visited.has(newId)) frontier.push(newId);
254
+ }
255
+ }
256
+ for (const edge of currentGraph.out(nodeId)) {
257
+ if (!visited.has(edge.dst)) frontier.push(edge.dst);
258
+ }
259
+ }
260
+ return {
261
+ graph: currentGraph,
262
+ added,
263
+ wired,
264
+ unresolved
265
+ };
266
+ }
267
+ function alreadyWired(graph, src, depName, kind) {
268
+ for (const edge of graph.out(src, kind)) {
269
+ const dst = graph.getNode(edge.dst);
270
+ if (dst !== void 0 && dst.name === depName) return true;
271
+ }
272
+ return false;
273
+ }
274
+ function projectPackumentVersion(pv) {
275
+ return {
276
+ inputs: {
277
+ name: pv.name,
278
+ version: pv.version
279
+ // patch is always undefined per §4.2 — completion does not synthesise patches.
280
+ },
281
+ payload: {
282
+ integrity: pv.integrity,
283
+ engines: pv.engines,
284
+ os: pv.os,
285
+ cpu: pv.cpu,
286
+ libc: pv.libc,
287
+ bin: pv.bin,
288
+ bundledDependencies: pv.bundledDependencies,
289
+ deprecated: pv.deprecated,
290
+ resolution: pv.tarball === void 0 ? void 0 : { type: "tarball", url: pv.tarball }
291
+ // license intentionally undefined — not carried on PackumentVersion;
292
+ // recipe-layer enrich may refine later per §4.2 footnote.
293
+ }
294
+ };
295
+ }
296
+ var cmpStr3 = (a, b) => a < b ? -1 : a > b ? 1 : 0;
297
+
298
+ export { ancestorsOf, completeTransitives, completionEdgeResolved, completionNodeAdded, completionNodeUnknown, completionPeerContextIncomplete, completionUnresolved, completionVersionUnknown, resolveFindUp };
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic, G as Graph } from '../graph-BzsItuAI.js';
1
+ import { D as Diagnostic, G as Graph } from '../graph-DbCmOfBk.js';
2
2
 
3
3
  interface BunTextParseOptions {
4
4
  }
@@ -527,6 +527,12 @@ var GraphImpl = class _GraphImpl {
527
527
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
528
528
  }
529
529
  applied.push({ kind: "tarball-removed", subject: key });
530
+ },
531
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
532
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
533
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
534
+ diagnostic(d) {
535
+ next.diagnostics.push(d);
530
536
  }
531
537
  };
532
538
  transaction(m);
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic, G as Graph } from '../graph-BzsItuAI.js';
1
+ import { D as Diagnostic, G as Graph } from '../graph-DbCmOfBk.js';
2
2
 
3
3
  interface Npm1ParseOptions {
4
4
  }
@@ -528,6 +528,12 @@ var GraphImpl = class _GraphImpl {
528
528
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
529
529
  }
530
530
  applied.push({ kind: "tarball-removed", subject: key });
531
+ },
532
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
533
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
534
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
535
+ diagnostic(d) {
536
+ next.diagnostics.push(d);
531
537
  }
532
538
  };
533
539
  transaction(m);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-DwOV4BpV.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-5XRp-_Te.js';
3
3
 
4
4
  interface Npm2ParseOptions extends NpmFamilyParseOptions {
5
5
  }
@@ -530,6 +530,12 @@ var GraphImpl = class _GraphImpl {
530
530
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
531
531
  }
532
532
  applied.push({ kind: "tarball-removed", subject: key });
533
+ },
534
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
535
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
536
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
537
+ diagnostic(d) {
538
+ next.diagnostics.push(d);
533
539
  }
534
540
  };
535
541
  transaction(m);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-DwOV4BpV.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { N as NpmFamilyEnrichOptions, a as NpmFamilyOptimizeOptions, b as NpmFamilyParseOptions, c as NpmFamilyStringifyOptions } from '../_npm-flat-types-5XRp-_Te.js';
3
3
 
4
4
  interface Npm3ParseOptions extends NpmFamilyParseOptions {
5
5
  }
@@ -530,6 +530,12 @@ var GraphImpl = class _GraphImpl {
530
530
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
531
531
  }
532
532
  applied.push({ kind: "tarball-removed", subject: key });
533
+ },
534
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
535
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
536
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
537
+ diagnostic(d) {
538
+ next.diagnostics.push(d);
533
539
  }
534
540
  };
535
541
  transaction(m);
@@ -1,4 +1,4 @@
1
- import { D as Diagnostic, G as Graph } from '../graph-BzsItuAI.js';
1
+ import { D as Diagnostic, G as Graph } from '../graph-DbCmOfBk.js';
2
2
 
3
3
  interface PnpmV5ParseOptions {
4
4
  }
@@ -530,6 +530,12 @@ var GraphImpl = class _GraphImpl {
530
530
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
531
531
  }
532
532
  applied.push({ kind: "tarball-removed", subject: key });
533
+ },
534
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
535
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
536
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
537
+ diagnostic(d) {
538
+ next.diagnostics.push(d);
533
539
  }
534
540
  };
535
541
  transaction(m);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-_4KM9kQj.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-DtT-PfX-.js';
3
3
 
4
4
  interface PnpmV6ParseOptions extends PnpmFamilyParseOptions {
5
5
  }
@@ -566,6 +566,12 @@ var GraphImpl = class _GraphImpl {
566
566
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
567
567
  }
568
568
  applied.push({ kind: "tarball-removed", subject: key });
569
+ },
570
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
571
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
572
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
573
+ diagnostic(d) {
574
+ next.diagnostics.push(d);
569
575
  }
570
576
  };
571
577
  transaction(m);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-_4KM9kQj.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { P as PnpmFamilyEnrichOptions, a as PnpmManifest, b as PnpmFamilyOptimizeOptions, c as PnpmFamilyParseOptions, d as PnpmSettings, e as PnpmFamilyStringifyOptions } from '../_pnpm-flat-core-DtT-PfX-.js';
3
3
 
4
4
  interface PnpmV9ParseOptions extends PnpmFamilyParseOptions {
5
5
  }
@@ -566,6 +566,12 @@ var GraphImpl = class _GraphImpl {
566
566
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
567
567
  }
568
568
  applied.push({ kind: "tarball-removed", subject: key });
569
+ },
570
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
571
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
572
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
573
+ diagnostic(d) {
574
+ next.diagnostics.push(d);
569
575
  }
570
576
  };
571
577
  transaction(m);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-EKBJ_ohM.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-nexIf1L1.js';
3
3
 
4
4
  interface YarnBerryParseOptions extends YarnBerryFamilyParseOptions {
5
5
  }
@@ -578,6 +578,12 @@ var GraphImpl = class _GraphImpl {
578
578
  throw new GraphError("PATCH_REJECTED", `removeTarball: ${key} missing`);
579
579
  }
580
580
  applied.push({ kind: "tarball-removed", subject: key });
581
+ },
582
+ // ADR-0023 §8.6 — write-side diagnostic emit. Append to the staged
583
+ // diagnostics list; the resulting Graph.diagnostics() surfaces it
584
+ // once mutate() settles. Same append semantics as Builder.diagnostic.
585
+ diagnostic(d) {
586
+ next.diagnostics.push(d);
581
587
  }
582
588
  };
583
589
  transaction(m);
@@ -1473,7 +1479,8 @@ function parseFamily(input, options, config) {
1473
1479
  if (rawConditions.size > 0) sidecar.conditions = rawConditions;
1474
1480
  if (metadata !== void 0) sidecar.metadata = metadata;
1475
1481
  rememberSidecar(graph, sidecar);
1476
- return { graph, sidecar };
1482
+ const wrappedGraph = withSidecarPropagation(graph, sidecar);
1483
+ return { graph: wrappedGraph, sidecar };
1477
1484
  } catch (error) {
1478
1485
  if (error instanceof GraphError) {
1479
1486
  throw new LockfileError({
@@ -1706,6 +1713,44 @@ function rememberSidecar(graph, sidecar) {
1706
1713
  if (isEmptySidecar(sidecar)) return;
1707
1714
  sidecarByGraph.set(graph, sidecar);
1708
1715
  }
1716
+ function withSidecarPropagation(graph, sidecar) {
1717
+ const proxy = {
1718
+ getNode: (...args) => graph.getNode(...args),
1719
+ nodes: () => graph.nodes(),
1720
+ byName: (...args) => graph.byName(...args),
1721
+ roots: () => graph.roots(),
1722
+ out: (...args) => graph.out(...args),
1723
+ in: (...args) => graph.in(...args),
1724
+ walk: (...args) => graph.walk(...args),
1725
+ topoSort: () => graph.topoSort(),
1726
+ subgraph: (...args) => graph.subgraph(...args),
1727
+ diff: (...args) => graph.diff(...args),
1728
+ tarball: (...args) => graph.tarball(...args),
1729
+ tarballOf: (...args) => graph.tarballOf(...args),
1730
+ tarballs: () => graph.tarballs(),
1731
+ diagnostics: () => graph.diagnostics(),
1732
+ layoutHints: () => graph.layoutHints(),
1733
+ mutate(transaction) {
1734
+ const result = graph.mutate(transaction);
1735
+ if (!isEmptySidecar(sidecar)) {
1736
+ for (const rec of result.applied) {
1737
+ if (rec.kind === "node-replaced" || rec.kind === "peer-context-replaced") ;
1738
+ }
1739
+ const nextNodes = /* @__PURE__ */ new Map();
1740
+ const nextSidecar = remapSidecar(sidecar, nextNodes, result.graph);
1741
+ const effectiveSidecar = isEmptySidecar(nextSidecar) && sidecar.metadata !== void 0 ? { metadata: sidecar.metadata } : nextSidecar;
1742
+ rememberSidecar(result.graph, effectiveSidecar);
1743
+ return {
1744
+ ...result,
1745
+ graph: withSidecarPropagation(result.graph, effectiveSidecar)
1746
+ };
1747
+ }
1748
+ return result;
1749
+ }
1750
+ };
1751
+ sidecarByGraph.set(proxy, sidecar);
1752
+ return proxy;
1753
+ }
1709
1754
  function rawPeerDependenciesBlockOfNode(graph, nodeId) {
1710
1755
  const peerDependencies = sidecarByGraph.get(graph)?.peerDependencies?.get(nodeId);
1711
1756
  return peerDependencies === void 0 ? void 0 : coerceSymlMap(peerDependencies);
@@ -1,5 +1,5 @@
1
- import { G as Graph, D as Diagnostic } from '../graph-BzsItuAI.js';
2
- import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-EKBJ_ohM.js';
1
+ import { G as Graph, D as Diagnostic } from '../graph-DbCmOfBk.js';
2
+ import { Y as YarnBerryFamilyEnrichOptions, a as YarnBerryFamilyOptimizeOptions, b as YarnBerryFamilyParseOptions, c as YarnBerryFamilyStringifyOptions } from '../_yarn-berry-core-nexIf1L1.js';
3
3
 
4
4
  interface YarnBerryParseOptions extends YarnBerryFamilyParseOptions {
5
5
  }