rolldown-pnpm-config 3.2.1 → 4.0.0
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/README.md +1 -1
- package/catalogs.js +32 -15
- package/cli/commands/export.js +8 -3
- package/cli/commands/preview.js +10 -7
- package/cli/commands/sync.js +140 -70
- package/cli/commands/upgrade.js +333 -135
- package/cli/discover.js +134 -28
- package/cli/drift.js +1 -1
- package/cli/edits.js +8 -17
- package/cli/effective.js +119 -4
- package/cli/interop.js +7 -15
- package/cli/local-merge.js +4 -1
- package/cli/plan.js +8 -3
- package/cli/preview-views.js +3 -1
- package/cli/release-age.js +2 -1
- package/cli/respell.js +86 -0
- package/cli/select-file.js +5 -2
- package/cli/summary.js +42 -6
- package/cli/sync/commit-message.js +4 -3
- package/cli/sync/config.js +60 -24
- package/cli/sync/local-gate.js +19 -9
- package/cli/sync/membership.js +93 -31
- package/cli/sync/ripples.js +4 -4
- package/cli/sync/running-list.js +9 -5
- package/cli/ui/walk-screen.js +66 -20
- package/cli/validate.js +1 -1
- package/cli/version.js +1 -1
- package/cli/walk-plan.js +17 -10
- package/cli/walk-reducer.js +99 -19
- package/index.d.ts +176 -127
- package/package.json +6 -6
- package/plugin/allowed-versions.js +3 -3
- package/plugin/families.js +185 -0
- package/plugin/freeze.js +122 -32
- package/plugin/second-forms.js +155 -0
- package/plugin/synced-catalogs.js +32 -0
- package/registry.js +13 -1
- package/skills/rolldown-pnpm-config/SKILL.md +13 -3
- package/skills/rolldown-pnpm-config/references/catalogs.md +109 -12
- package/skills/rolldown-pnpm-config/references/options.md +126 -47
- package/skills/rolldown-pnpm-config/references/sync.md +32 -21
- package/skills/rolldown-pnpm-config/references/wiring.md +10 -8
- package/plugin/overrides-from-catalogs.js +0 -151
package/cli/commands/upgrade.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dirname } from "node:path";
|
|
2
1
|
import { CliDoc, CliExit, CliFormat, CliInteractive, CliMessage, Doc, Fmt } from "@effected/cli-kit";
|
|
3
2
|
import { CliUi } from "@effected/cli-kit/ui";
|
|
4
3
|
import { AtomicFile } from "@effected/files";
|
|
@@ -24,7 +23,6 @@ import { walkScreen, withProgress } from "../ui/screens.js";
|
|
|
24
23
|
import { validateEdits } from "../validate.js";
|
|
25
24
|
import { versionKeyOf } from "../version-key.js";
|
|
26
25
|
import { buildWalkItems } from "../walk-plan.js";
|
|
27
|
-
import { findWorkspaceRoot, makeWorkspaceResolver } from "../workspace-resolve.js";
|
|
28
26
|
|
|
29
27
|
// src/cli/commands/upgrade.ts
|
|
30
28
|
/**
|
|
@@ -85,33 +83,40 @@ function writeSource(file, next) {
|
|
|
85
83
|
}
|
|
86
84
|
/**
|
|
87
85
|
* Read a config file and statically discover its catalog entries. With
|
|
88
|
-
* `catalog`, the entries and skipped names are scoped to that
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
86
|
+
* `catalog`, the entries and skipped names are scoped to that catalog (or to
|
|
87
|
+
* each of a list of them, as `sync` passes its pairs' catalogs), and a name
|
|
88
|
+
* the config does not declare fails (`kind: "catalog"`) rather than silently
|
|
89
|
+
* matching nothing. Every `upgrade` mode reads through here, so `--catalog`
|
|
90
|
+
* scopes them all alike.
|
|
92
91
|
*
|
|
93
92
|
* @internal
|
|
94
93
|
*/
|
|
95
94
|
function readCatalogSource(file, catalog) {
|
|
96
95
|
return Effect.gen(function* () {
|
|
97
96
|
const { text: source } = yield* AtomicFile.readText(file).pipe(Effect.mapError(() => new UpgradeError({ message: `Cannot read ${file}` })));
|
|
98
|
-
const { entries, skipped, skippedRefs, catalogs } = yield* Effect.try({
|
|
97
|
+
const { entries, skipped, skippedRefs, catalogs, families, unreadFamilies } = yield* Effect.try({
|
|
99
98
|
try: () => discoverCatalogEntries(source, file),
|
|
100
99
|
catch: (e) => new UpgradeError({ message: Fmt.describe(e) })
|
|
101
100
|
});
|
|
102
101
|
if (catalog === void 0) return {
|
|
103
102
|
source,
|
|
104
103
|
entries,
|
|
105
|
-
skipped
|
|
104
|
+
skipped,
|
|
105
|
+
families,
|
|
106
|
+
unreadFamilies
|
|
106
107
|
};
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
const scope = typeof catalog === "string" ? [catalog] : catalog;
|
|
109
|
+
const unknown = scope.find((name) => !catalogs.includes(name));
|
|
110
|
+
if (unknown !== void 0) return yield* Effect.fail(new UpgradeError({
|
|
111
|
+
message: unknownCatalogMessage(unknown, catalogs),
|
|
109
112
|
kind: "catalog"
|
|
110
113
|
}));
|
|
111
114
|
return {
|
|
112
115
|
source,
|
|
113
|
-
entries: filterEntriesByCatalog(entries,
|
|
114
|
-
skipped: skippedRefs.filter((r) => r.catalog
|
|
116
|
+
entries: filterEntriesByCatalog(entries, scope),
|
|
117
|
+
skipped: skippedRefs.filter((r) => scope.includes(r.catalog)).map((r) => `${r.catalog}.${r.pkg}`),
|
|
118
|
+
families,
|
|
119
|
+
unreadFamilies
|
|
115
120
|
};
|
|
116
121
|
});
|
|
117
122
|
}
|
|
@@ -123,6 +128,46 @@ function readCatalogSource(file, catalog) {
|
|
|
123
128
|
function unknownCatalogMessage(catalog, declared) {
|
|
124
129
|
return `No catalog named "${catalog}" in the config (${declared.length === 0 ? "it declares no catalogs" : `declared: ${declared.join(", ")}`})`;
|
|
125
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The message for a `--family` that names no family the config declares.
|
|
133
|
+
*
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
function unknownFamilyMessage(unknown, declared) {
|
|
137
|
+
return `No family named ${unknown.map((n) => `"${n}"`).join(", ")} in the config (${declared.length === 0 ? "it declares no families" : `declared: ${declared.join(", ")}`})`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The message for `--family` over a config whose `families` could not be
|
|
141
|
+
* read statically in some catalog: which members a name covers, or whether
|
|
142
|
+
* it exists at all, is unknown there, so no `--family` is applied.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
function unreadFamiliesMessage(unread) {
|
|
147
|
+
return `Cannot apply --family: could not read families statically in catalog ${unread.map((c) => `"${c}"`).join(", ")}; write each family, its members and its exclude as literal lists`;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Split discovered entries into what a non-interactive run moves and the
|
|
151
|
+
* locked family members it only reports. A run owns one source: `upgrade`
|
|
152
|
+
* owns npm entries and `sync` owns workspace ones, so an entry of the other
|
|
153
|
+
* source is neither moved nor reported. A family member moves only when
|
|
154
|
+
* `families` names its family.
|
|
155
|
+
*
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
function partitionEntries(entries, owns, families = []) {
|
|
159
|
+
const moving = [];
|
|
160
|
+
const locked = [];
|
|
161
|
+
for (const e of entries) {
|
|
162
|
+
if ((e.source ?? "npm") !== owns) continue;
|
|
163
|
+
if (e.family !== void 0 && !families.includes(e.family)) locked.push(e);
|
|
164
|
+
else moving.push(e);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
moving,
|
|
168
|
+
locked
|
|
169
|
+
};
|
|
170
|
+
}
|
|
126
171
|
/** Combine the config-declared and pnpm-resolved release-age gates (strictest of both). @internal */
|
|
127
172
|
function computeGate(source, file, resolver) {
|
|
128
173
|
return Effect.gen(function* () {
|
|
@@ -238,8 +283,8 @@ function resolveProgress(report) {
|
|
|
238
283
|
* recomputed peer literal), and write the file. Never selects a major bump.
|
|
239
284
|
*
|
|
240
285
|
* A package whose version list gates to empty (fetch failure / fully age-gated)
|
|
241
|
-
* is treated as a skip, except that a strategy entry can still resync
|
|
242
|
-
*
|
|
286
|
+
* is treated as a skip, except that a strategy entry can still resync its
|
|
287
|
+
* managed peer offline from the current range.
|
|
243
288
|
*
|
|
244
289
|
* This path runs UNATTENDED (`--yes`, i.e. CI), so it fails hard rather than
|
|
245
290
|
* degrading: any peer-strategy warning, any planned edit no published
|
|
@@ -248,13 +293,21 @@ function resolveProgress(report) {
|
|
|
248
293
|
* past unread in a CI log is a bad range in a published artifact. The
|
|
249
294
|
* interactive path is deliberately more forgiving (see `upgradeCommand`).
|
|
250
295
|
*
|
|
296
|
+
* The run moves only the entries it owns (`owns`, npm by default; `sync`
|
|
297
|
+
* passes `"workspace"`), and never a locked family member unless `families`
|
|
298
|
+
* names its family. A locked member with a newer version is returned in
|
|
299
|
+
* `locked`, which is informational: it never fails `--check`.
|
|
300
|
+
*
|
|
251
301
|
* @internal
|
|
252
302
|
*/
|
|
253
303
|
function runUpgrade(opts) {
|
|
254
304
|
return Effect.gen(function* () {
|
|
255
|
-
const
|
|
305
|
+
const read = yield* readCatalogSource(opts.file, opts.catalog);
|
|
306
|
+
const { source, skipped } = read;
|
|
307
|
+
const owns = opts.owns ?? "npm";
|
|
308
|
+
const { moving: entries, locked: lockedEntries } = partitionEntries(read.entries, owns, opts.families);
|
|
256
309
|
const gate = yield* computeGate(source, opts.file, opts.resolver);
|
|
257
|
-
const versionsByPkg = yield* resolveGatedVersions(entries, opts.resolver, gate, yield* Clock.currentTimeMillis, opts.onProgress, opts.workspaceResolver);
|
|
310
|
+
const versionsByPkg = yield* resolveGatedVersions([...entries, ...lockedEntries], opts.resolver, gate, yield* Clock.currentTimeMillis, opts.onProgress, opts.workspaceResolver);
|
|
258
311
|
if (versionsByPkg.unresolved.length > 0) return yield* Effect.fail(new UpgradeError({ message: unresolvedMessage(versionsByPkg.unresolved, versionsByPkg.causes) }));
|
|
259
312
|
const skippedChangesets = opts.workspaceResolver?.skippedChangesets() ?? [];
|
|
260
313
|
if (skippedChangesets.length > 0) return yield* Effect.fail(new UpgradeError({
|
|
@@ -266,37 +319,52 @@ function runUpgrade(opts) {
|
|
|
266
319
|
const warnings = [];
|
|
267
320
|
const changedSpans = /* @__PURE__ */ new Set();
|
|
268
321
|
const changedPkgs = /* @__PURE__ */ new Map();
|
|
322
|
+
const rowOf = (entry, to) => ({
|
|
323
|
+
name: `${entry.catalog}.${entry.pkg}`,
|
|
324
|
+
catalog: entry.catalog,
|
|
325
|
+
pkg: entry.pkg,
|
|
326
|
+
from: entry.currentRange,
|
|
327
|
+
...to !== void 0 ? { to } : {},
|
|
328
|
+
source: entry.source ?? "npm",
|
|
329
|
+
...entry.family !== void 0 ? { family: entry.family } : {}
|
|
330
|
+
});
|
|
269
331
|
const markChanged = (entry, to) => {
|
|
270
332
|
changedSpans.add(entry.rangeSpan[0]);
|
|
271
|
-
const
|
|
272
|
-
changedPkgs.set(name,
|
|
273
|
-
name,
|
|
274
|
-
catalog: entry.catalog,
|
|
275
|
-
pkg: entry.pkg,
|
|
276
|
-
from: entry.currentRange,
|
|
277
|
-
...to !== void 0 ? { to } : {},
|
|
278
|
-
source: entry.source ?? "registry"
|
|
279
|
-
});
|
|
333
|
+
const row = rowOf(entry, to);
|
|
334
|
+
changedPkgs.set(row.name, row);
|
|
280
335
|
};
|
|
336
|
+
const locked = [];
|
|
337
|
+
for (const entry of lockedEntries) {
|
|
338
|
+
const versions = versionsByPkg.gated.get(versionKeyOf(entry)) ?? [];
|
|
339
|
+
const candidates = yield* planEntry(entry, versions).pipe(Effect.orElseSucceed(() => []));
|
|
340
|
+
const pick = defaultPick(entry, candidates);
|
|
341
|
+
if (pick) locked.push(rowOf(entry, pick.range));
|
|
342
|
+
}
|
|
281
343
|
for (const entry of entries) {
|
|
282
344
|
if (entry.strategy === "interop") continue;
|
|
283
345
|
const versions = versionsByPkg.gated.get(versionKeyOf(entry)) ?? [];
|
|
284
346
|
const { range, setPeer } = entryEdits(entry);
|
|
285
347
|
const derived = entry.strategy ? yield* derivePeerRange(entry.currentRange, entry.strategy).pipe(Effect.orElseSucceed(() => null)) : null;
|
|
286
348
|
if (derived?.warning) warnings.push(`${entry.pkg}: ${derived.warning.message}`);
|
|
287
|
-
const peerOnly = derived === null
|
|
349
|
+
const peerOnly = derived === null || setPeer === void 0 || derived.range === entry.peer?.value ? null : derived.range;
|
|
288
350
|
const candidates = versions.length === 0 ? [] : yield* planEntry(entry, versions).pipe(Effect.orElseSucceed(() => []));
|
|
289
351
|
const pick = defaultPick(entry, candidates);
|
|
290
352
|
if (pick) {
|
|
291
353
|
edits.push(range(pick.range));
|
|
292
354
|
markChanged(entry, pick.range);
|
|
293
|
-
if (pick.peerRange) edits.push(setPeer(pick.peerRange));
|
|
294
|
-
} else if (peerOnly !== null) {
|
|
355
|
+
if (pick.peerRange && setPeer) edits.push(setPeer(pick.peerRange));
|
|
356
|
+
} else if (peerOnly !== null && setPeer) {
|
|
295
357
|
edits.push(setPeer(peerOnly));
|
|
296
358
|
markChanged(entry);
|
|
297
359
|
} else if (versions.length === 0) skipped.push(`${entry.catalog}.${entry.pkg}`);
|
|
298
360
|
}
|
|
299
|
-
const
|
|
361
|
+
const foreign = read.entries.filter((e) => e.strategy === "interop" && (e.source ?? "npm") !== owns);
|
|
362
|
+
const pinned = /* @__PURE__ */ new Set([...lockedEntries, ...foreign]);
|
|
363
|
+
const interopEntries = [
|
|
364
|
+
...entries,
|
|
365
|
+
...lockedEntries,
|
|
366
|
+
...foreign
|
|
367
|
+
].filter((e) => e.strategy === "interop");
|
|
300
368
|
const conflicts = [];
|
|
301
369
|
const byCatalog = /* @__PURE__ */ new Map();
|
|
302
370
|
for (const e of interopEntries) {
|
|
@@ -307,18 +375,27 @@ function runUpgrade(opts) {
|
|
|
307
375
|
for (const [, group] of byCatalog) {
|
|
308
376
|
const members = [];
|
|
309
377
|
for (const e of group) {
|
|
378
|
+
const current = bareVersion(e.currentRange);
|
|
379
|
+
if (pinned.has(e)) {
|
|
380
|
+
members.push({
|
|
381
|
+
pkg: e.pkg,
|
|
382
|
+
ceiling: current,
|
|
383
|
+
candidates: [current]
|
|
384
|
+
});
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
310
387
|
const versions = versionsByPkg.gated.get(versionKeyOf(e)) ?? [];
|
|
311
|
-
const
|
|
312
|
-
const ceiling = inRange ? inRange.version : bareVersion(e.currentRange);
|
|
388
|
+
const cands = yield* planEntry(e, versions).pipe(Effect.orElseSucceed(() => []));
|
|
313
389
|
members.push({
|
|
314
390
|
pkg: e.pkg,
|
|
315
|
-
ceiling,
|
|
391
|
+
ceiling: defaultPick(e, cands)?.version ?? current,
|
|
316
392
|
candidates: versions
|
|
317
393
|
});
|
|
318
394
|
}
|
|
319
395
|
const result = yield* runInterop(members, opts.resolver);
|
|
320
|
-
|
|
321
|
-
|
|
396
|
+
const moving = group.filter((e) => !pinned.has(e));
|
|
397
|
+
interopEdits.push(...buildInteropEdits(moving, result));
|
|
398
|
+
for (const e of moving) {
|
|
322
399
|
if (!interopEntryChanged(e, result)) continue;
|
|
323
400
|
const next = result.resolved.get(e.pkg);
|
|
324
401
|
const nextRange = next === void 0 ? void 0 : `${e.operator}${next}`;
|
|
@@ -342,13 +419,14 @@ function runUpgrade(opts) {
|
|
|
342
419
|
skipped,
|
|
343
420
|
conflicts,
|
|
344
421
|
rejected,
|
|
345
|
-
changed: [...changedPkgs.values()]
|
|
422
|
+
changed: [...changedPkgs.values()],
|
|
423
|
+
locked
|
|
346
424
|
};
|
|
347
425
|
});
|
|
348
426
|
}
|
|
349
|
-
/** Count the decisions that actually change the file (a bump
|
|
427
|
+
/** Count the decisions that actually change the file (a bump or a peer resync). @internal */
|
|
350
428
|
function countChangedDecisions(decisions) {
|
|
351
|
-
return decisions.filter((d) => d.chosen.kind !== "keep" || d.item.entry.peer !== void 0 && d.item.driftPeer !== null
|
|
429
|
+
return decisions.filter((d) => d.chosen.kind !== "keep" || d.item.entry.peer !== void 0 && d.item.driftPeer !== null).length;
|
|
352
430
|
}
|
|
353
431
|
/**
|
|
354
432
|
* Apply the interactive result: the (already validated) non-interop edits plus
|
|
@@ -410,7 +488,7 @@ function projectDecisions(items, full) {
|
|
|
410
488
|
});
|
|
411
489
|
continue;
|
|
412
490
|
}
|
|
413
|
-
if (i.driftPeer !== null
|
|
491
|
+
if (i.driftPeer !== null) {
|
|
414
492
|
const keep = i.candidates.find((c) => c.kind === "keep");
|
|
415
493
|
if (keep) {
|
|
416
494
|
out.push({
|
|
@@ -431,6 +509,83 @@ function projectDecisions(items, full) {
|
|
|
431
509
|
return out;
|
|
432
510
|
}
|
|
433
511
|
/**
|
|
512
|
+
* Project every evaluated entry for `--preview` and the non-interactive
|
|
513
|
+
* `--dry-run`: the rows the projection shows, and a scope counting what the
|
|
514
|
+
* display filter left out, so the summary tallies the whole catalog. Under
|
|
515
|
+
* `full` the workspace rows and the locked family rows join the table as the
|
|
516
|
+
* dialog shows them.
|
|
517
|
+
*
|
|
518
|
+
* @internal
|
|
519
|
+
*/
|
|
520
|
+
function projectPreview(items, families, full) {
|
|
521
|
+
const decisions = [];
|
|
522
|
+
const locked = /* @__PURE__ */ new Map();
|
|
523
|
+
let hiddenUpToDate = 0;
|
|
524
|
+
let hiddenWorkspace = 0;
|
|
525
|
+
for (const item of items) {
|
|
526
|
+
const { entry } = item;
|
|
527
|
+
if (item.readOnly === true) {
|
|
528
|
+
const keep = item.candidates.find((c) => c.kind === "keep");
|
|
529
|
+
if (full && keep) decisions.push({
|
|
530
|
+
item,
|
|
531
|
+
chosen: keep
|
|
532
|
+
});
|
|
533
|
+
else hiddenWorkspace++;
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
if (entry.family !== void 0 && !families.includes(entry.family)) {
|
|
537
|
+
const key = `${entry.catalog}\0${entry.family}`;
|
|
538
|
+
const seen = locked.get(key);
|
|
539
|
+
const newer = item.upToDate ? 0 : 1;
|
|
540
|
+
locked.set(key, seen === void 0 ? {
|
|
541
|
+
catalog: entry.catalog,
|
|
542
|
+
family: entry.family,
|
|
543
|
+
members: 1,
|
|
544
|
+
newer
|
|
545
|
+
} : {
|
|
546
|
+
...seen,
|
|
547
|
+
members: seen.members + 1,
|
|
548
|
+
newer: seen.newer + newer
|
|
549
|
+
});
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
const projected = projectDecisions([item], full);
|
|
553
|
+
if (projected.length === 0) hiddenUpToDate++;
|
|
554
|
+
else decisions.push(...projected);
|
|
555
|
+
}
|
|
556
|
+
const rows = [...locked.values()];
|
|
557
|
+
return {
|
|
558
|
+
decisions,
|
|
559
|
+
scope: {
|
|
560
|
+
hidden: {
|
|
561
|
+
upToDate: hiddenUpToDate,
|
|
562
|
+
workspace: hiddenWorkspace,
|
|
563
|
+
families: full ? 0 : rows.length,
|
|
564
|
+
members: full ? 0 : rows.reduce((n, r) => n + r.members, 0)
|
|
565
|
+
},
|
|
566
|
+
locked: full ? rows : []
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* The preview document of a catalog source: every entry is evaluated (the
|
|
572
|
+
* registry-owned ones, locked family members included, resolved), then
|
|
573
|
+
* {@link projectPreview} decides what shows.
|
|
574
|
+
*
|
|
575
|
+
* @internal
|
|
576
|
+
*/
|
|
577
|
+
function previewOf(entries, families, resolver, gate, full) {
|
|
578
|
+
return Effect.gen(function* () {
|
|
579
|
+
const { moving, locked } = partitionEntries(entries, "npm", families);
|
|
580
|
+
const versions = yield* resolveGatedVersions([...moving, ...locked], resolver, gate, yield* Clock.currentTimeMillis);
|
|
581
|
+
const { decisions, scope } = projectPreview(yield* buildWalkItems(entries, versions.gated).pipe(Effect.mapError((e) => new UpgradeError({ message: e.message }))), families, full);
|
|
582
|
+
return {
|
|
583
|
+
doc: summaryDoc(decisions, void 0, void 0, scope),
|
|
584
|
+
versions
|
|
585
|
+
};
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
434
589
|
* Build the `--preview` projection without writing: the summary document, and
|
|
435
590
|
* the packages the registry could not resolve (which render as up to date and
|
|
436
591
|
* would otherwise be invisible in the projection).
|
|
@@ -439,12 +594,11 @@ function projectDecisions(items, full) {
|
|
|
439
594
|
*/
|
|
440
595
|
function runUpgradePreview(opts) {
|
|
441
596
|
return Effect.gen(function* () {
|
|
442
|
-
const
|
|
443
|
-
const gate = yield* computeGate(source, opts.file, opts.resolver);
|
|
444
|
-
const versions = yield*
|
|
445
|
-
const items = yield* buildWalkItems(entries, versions.gated).pipe(Effect.mapError((e) => new UpgradeError({ message: e.message })));
|
|
597
|
+
const read = yield* readCatalogSource(opts.file, opts.catalog);
|
|
598
|
+
const gate = yield* computeGate(read.source, opts.file, opts.resolver);
|
|
599
|
+
const { doc, versions } = yield* previewOf(read.entries, opts.families ?? [], opts.resolver, gate, opts.full);
|
|
446
600
|
return {
|
|
447
|
-
doc
|
|
601
|
+
doc,
|
|
448
602
|
unresolved: versions.unresolved,
|
|
449
603
|
causes: versions.causes
|
|
450
604
|
};
|
|
@@ -460,10 +614,11 @@ function runUpgradePreview(opts) {
|
|
|
460
614
|
*
|
|
461
615
|
* @internal
|
|
462
616
|
*/
|
|
463
|
-
function checkOutcome(changed) {
|
|
617
|
+
function checkOutcome(changed, locked = []) {
|
|
618
|
+
const info = lockedDoc(locked);
|
|
464
619
|
if (changed.length === 0) return {
|
|
465
620
|
exitCode: 0,
|
|
466
|
-
doc: [Doc.line("Catalogs are in sync.")]
|
|
621
|
+
doc: [Doc.line("Catalogs are in sync."), ...info]
|
|
467
622
|
};
|
|
468
623
|
return {
|
|
469
624
|
exitCode: 1,
|
|
@@ -474,10 +629,31 @@ function checkOutcome(changed) {
|
|
|
474
629
|
"Run ",
|
|
475
630
|
Doc.code("rolldown-pnpm-config upgrade --yes"),
|
|
476
631
|
" to apply."
|
|
477
|
-
])
|
|
632
|
+
]),
|
|
633
|
+
...info
|
|
478
634
|
]
|
|
479
635
|
};
|
|
480
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* The informational block for locked family members with a newer version:
|
|
639
|
+
* never drift, so it never moves the exit code. Names the `--family` flag
|
|
640
|
+
* that would move each family.
|
|
641
|
+
*
|
|
642
|
+
* @internal
|
|
643
|
+
*/
|
|
644
|
+
function lockedDoc(locked) {
|
|
645
|
+
if (locked.length === 0) return [];
|
|
646
|
+
const families = [...new Set(locked.flatMap((r) => r.family === void 0 ? [] : [r.family]))];
|
|
647
|
+
return [
|
|
648
|
+
Doc.line(`Locked family members with a newer version (not drift): ${locked.length}`),
|
|
649
|
+
Doc.lines(locked.map((r) => ` ${r.name} ${r.from} -> ${r.to ?? r.from} (family ${r.family})`), { wrap: false }),
|
|
650
|
+
Doc.line([
|
|
651
|
+
"Run ",
|
|
652
|
+
Doc.code(`rolldown-pnpm-config upgrade --yes ${families.map((f) => `--family ${f}`).join(" ")}`),
|
|
653
|
+
" to move them."
|
|
654
|
+
])
|
|
655
|
+
];
|
|
656
|
+
}
|
|
481
657
|
/** Project a drift row to its stable `--json` object: catalog/pkg/from/to?/source, camelCase, `to` omitted (never null) when unknown. */
|
|
482
658
|
function driftRowJson(row) {
|
|
483
659
|
return {
|
|
@@ -485,9 +661,14 @@ function driftRowJson(row) {
|
|
|
485
661
|
pkg: row.pkg,
|
|
486
662
|
from: row.from,
|
|
487
663
|
...row.to !== void 0 ? { to: row.to } : {},
|
|
488
|
-
source: row.source
|
|
664
|
+
source: row.source,
|
|
665
|
+
...row.family !== void 0 ? { family: row.family } : {}
|
|
489
666
|
};
|
|
490
667
|
}
|
|
668
|
+
/** The `locked` key of a JSON document: present only when a locked member has a newer version. */
|
|
669
|
+
function lockedJson(locked) {
|
|
670
|
+
return locked.length === 0 ? {} : { locked: locked.map(driftRowJson) };
|
|
671
|
+
}
|
|
491
672
|
/**
|
|
492
673
|
* The `--check --format json` outcome. stdout carries exactly one JSON
|
|
493
674
|
* document (`data`, printed by `CliFormat.print` on one line) in EVERY case —
|
|
@@ -523,7 +704,8 @@ function checkJsonOutcome(result) {
|
|
|
523
704
|
data: {
|
|
524
705
|
command: "check",
|
|
525
706
|
inSync: changed.length === 0,
|
|
526
|
-
drift: changed.map(driftRowJson)
|
|
707
|
+
drift: changed.map(driftRowJson),
|
|
708
|
+
...lockedJson(result.success.locked)
|
|
527
709
|
}
|
|
528
710
|
};
|
|
529
711
|
}
|
|
@@ -565,7 +747,8 @@ function upgradeJsonOutcome(result, dryRun) {
|
|
|
565
747
|
pkg: c.pkg,
|
|
566
748
|
ceiling: c.ceiling,
|
|
567
749
|
blockedBy: c.blockedBy
|
|
568
|
-
}))
|
|
750
|
+
})),
|
|
751
|
+
...lockedJson(r.locked)
|
|
569
752
|
} };
|
|
570
753
|
}
|
|
571
754
|
/**
|
|
@@ -609,38 +792,6 @@ function resolveTargetFile(fileOpt) {
|
|
|
609
792
|
function skippedChangesetsMessage(skipped) {
|
|
610
793
|
return [skipped.length === 1 ? "Skipped 1 malformed changeset; the workspace packages it names resolve to their current version, not their next:" : `Skipped ${skipped.length} malformed changesets; the workspace packages they name resolve to their current version, not their next:`, ...skipped.map((s) => ` ${s.file}: ${s.message}`)].join("\n");
|
|
611
794
|
}
|
|
612
|
-
/**
|
|
613
|
-
* Collects the workspace resolvers one upgrade run builds, so the run reports
|
|
614
|
-
* every pending changeset they skipped exactly once, whichever path it took.
|
|
615
|
-
* `report` is the run's finalizer: a warning on stderr, unless `silence` was
|
|
616
|
-
* called because the run already failed with that list (`runUpgrade`).
|
|
617
|
-
*/
|
|
618
|
-
function skippedChangesetsTracker() {
|
|
619
|
-
const resolvers = [];
|
|
620
|
-
let silenced = false;
|
|
621
|
-
const collect = () => {
|
|
622
|
-
const byFile = /* @__PURE__ */ new Map();
|
|
623
|
-
for (const r of resolvers) for (const s of r.skippedChangesets()) byFile.set(s.file, s);
|
|
624
|
-
return [...byFile.values()];
|
|
625
|
-
};
|
|
626
|
-
return {
|
|
627
|
-
track: (resolver) => {
|
|
628
|
-
resolvers.push(resolver);
|
|
629
|
-
return resolver;
|
|
630
|
-
},
|
|
631
|
-
silence: () => {
|
|
632
|
-
silenced = true;
|
|
633
|
-
},
|
|
634
|
-
report: Effect.suspend(() => {
|
|
635
|
-
const skipped = silenced ? [] : collect();
|
|
636
|
-
return skipped.length > 0 ? Doc.print(warningDoc(skippedChangesetsMessage(skipped)), { stream: "stderr" }) : Effect.void;
|
|
637
|
-
})
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
/** Whether a run failed on a malformed pending changeset, which its failure report already lists. */
|
|
641
|
-
function isChangesetFailure(error) {
|
|
642
|
-
return (error instanceof UpgradeError || error instanceof CheckFailedError) && error.kind === "changeset";
|
|
643
|
-
}
|
|
644
795
|
/** Print the unresolved-packages warning to stderr, when there is one. */
|
|
645
796
|
function warnUnresolved(unresolved, causes) {
|
|
646
797
|
return unresolved.length > 0 ? Doc.print(warningDoc(unresolvedMessage(unresolved, causes)), { stream: "stderr" }) : Effect.void;
|
|
@@ -652,13 +803,22 @@ function warnUnresolved(unresolved, causes) {
|
|
|
652
803
|
* moved ahead of the walk). Interactively the live table IS the reconcile;
|
|
653
804
|
* `--yes`/CI keeps the auto-reconcile (`runUpgrade`). Each phase reports
|
|
654
805
|
* progress, which an interactive run draws as a live view.
|
|
806
|
+
*
|
|
807
|
+
* A workspace interop entry is a read-only row, but it stays in its catalog's
|
|
808
|
+
* group, pinned at its current version (`pinned`), so an npm pick whose peer
|
|
809
|
+
* it does not satisfy shows as a conflict, as `runUpgrade` reports it.
|
|
810
|
+
*
|
|
811
|
+
* @internal
|
|
655
812
|
*/
|
|
656
|
-
function resolveForWalk(entries, resolver, gate,
|
|
813
|
+
function resolveForWalk(entries, resolver, gate, report) {
|
|
657
814
|
return Effect.gen(function* () {
|
|
658
|
-
const
|
|
815
|
+
const { moving, locked } = partitionEntries(entries, "npm");
|
|
816
|
+
const owned = [...moving, ...locked];
|
|
817
|
+
const versions = yield* resolveGatedVersions(owned, resolver, gate, yield* Clock.currentTimeMillis, resolveProgress(report));
|
|
659
818
|
const items = yield* buildWalkItems(entries, versions.gated).pipe(Effect.mapError((e) => new UpgradeError({ message: e.message })));
|
|
819
|
+
const pinned = new Set(entries.filter((e) => e.strategy === "interop" && e.source === "workspace"));
|
|
660
820
|
const interopByCatalog = /* @__PURE__ */ new Map();
|
|
661
|
-
for (const e of
|
|
821
|
+
for (const e of [...owned, ...pinned]) {
|
|
662
822
|
if (e.strategy !== "interop") continue;
|
|
663
823
|
const list = interopByCatalog.get(e.catalog) ?? [];
|
|
664
824
|
list.push(e);
|
|
@@ -675,7 +835,7 @@ function resolveForWalk(entries, resolver, gate, workspaceResolver, report) {
|
|
|
675
835
|
for (const [catalog, group] of interopByCatalog) {
|
|
676
836
|
const candByPkg = /* @__PURE__ */ new Map();
|
|
677
837
|
for (const e of group) {
|
|
678
|
-
const it = items.find((i) => i.entry.catalog === catalog && i.entry.pkg === e.pkg);
|
|
838
|
+
const it = pinned.has(e) ? void 0 : items.find((i) => i.entry.catalog === catalog && i.entry.pkg === e.pkg);
|
|
679
839
|
candByPkg.set(e.pkg, it ? it.candidates.map((c) => c.version) : [bareVersion(e.currentRange)]);
|
|
680
840
|
}
|
|
681
841
|
interopModels.set(catalog, yield* buildGroupModel(candByPkg, fetchPeer));
|
|
@@ -693,10 +853,76 @@ function resolveForWalk(entries, resolver, gate, workspaceResolver, report) {
|
|
|
693
853
|
versions,
|
|
694
854
|
items,
|
|
695
855
|
interopByCatalog,
|
|
696
|
-
interopModels
|
|
856
|
+
interopModels,
|
|
857
|
+
pinned
|
|
697
858
|
};
|
|
698
859
|
});
|
|
699
860
|
}
|
|
861
|
+
/**
|
|
862
|
+
* The interactive interop write: the user's final picks and the live-derived
|
|
863
|
+
* peer floors, written as picked (no auto-downgrade; the live table already
|
|
864
|
+
* surfaced any conflict). A `pinned` member is read in at its current version
|
|
865
|
+
* so its dependents' peers and conflicts count it, but gets no edit and is
|
|
866
|
+
* never counted as a change.
|
|
867
|
+
*
|
|
868
|
+
* @internal
|
|
869
|
+
*/
|
|
870
|
+
function walkInteropEdits(interopByCatalog, interopModels, decisions, pinned) {
|
|
871
|
+
const edits = [];
|
|
872
|
+
const conflicts = [];
|
|
873
|
+
let changed = 0;
|
|
874
|
+
for (const [catalog, group] of interopByCatalog) {
|
|
875
|
+
const model = interopModels.get(catalog);
|
|
876
|
+
if (model === void 0) continue;
|
|
877
|
+
const selected = /* @__PURE__ */ new Map();
|
|
878
|
+
for (const e of group) {
|
|
879
|
+
const d = decisions.find((dd) => dd.item.entry.catalog === catalog && dd.item.entry.pkg === e.pkg);
|
|
880
|
+
selected.set(e.pkg, d ? d.chosen.version : bareVersion(e.currentRange));
|
|
881
|
+
}
|
|
882
|
+
const { peer, conflict } = computeGroupPeers(model, selected);
|
|
883
|
+
const moving = group.filter((e) => !pinned.has(e));
|
|
884
|
+
edits.push(...buildInteropEdits(moving, {
|
|
885
|
+
resolved: selected,
|
|
886
|
+
peers: peer,
|
|
887
|
+
conflicts: []
|
|
888
|
+
}));
|
|
889
|
+
for (const [pkg, blockedBy] of conflict) conflicts.push({
|
|
890
|
+
pkg,
|
|
891
|
+
ceiling: selected.get(pkg) ?? "",
|
|
892
|
+
blockedBy
|
|
893
|
+
});
|
|
894
|
+
for (const e of moving) {
|
|
895
|
+
const version = selected.get(e.pkg);
|
|
896
|
+
if (version === void 0) continue;
|
|
897
|
+
const rangeChanged = `${e.operator}${version}` !== e.currentRange;
|
|
898
|
+
const newPeer = peer.get(e.pkg);
|
|
899
|
+
const peerChanged = newPeer !== void 0 && (e.peer ? newPeer !== e.peer.value : true);
|
|
900
|
+
if (rangeChanged || peerChanged) changed++;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return {
|
|
904
|
+
edits,
|
|
905
|
+
conflicts,
|
|
906
|
+
changed
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Fail with a usage error (exit 64) when `--family` names a family the config
|
|
911
|
+
* does not declare, listing the declared names, or when any catalog's
|
|
912
|
+
* `families` could not be read statically. A config that cannot be found
|
|
913
|
+
* or read is left to the run itself, whose report (a JSON document under
|
|
914
|
+
* `--format json`) covers it.
|
|
915
|
+
*/
|
|
916
|
+
function validateFamilies(fileOpt, names) {
|
|
917
|
+
if (names.length === 0) return Effect.void;
|
|
918
|
+
return resolveTargetFile(fileOpt).pipe(Effect.flatMap((file) => readCatalogSource(file)), Effect.option, Effect.flatMap((read) => {
|
|
919
|
+
if (Option.isNone(read)) return Effect.void;
|
|
920
|
+
const { families: declared, unreadFamilies } = read.value;
|
|
921
|
+
if (unreadFamilies.length > 0) return Effect.fail(new UpgradeUsageError({ message: unreadFamiliesMessage(unreadFamilies) }));
|
|
922
|
+
const unknown = names.filter((n) => !declared.includes(n));
|
|
923
|
+
return unknown.length === 0 ? Effect.void : Effect.fail(new UpgradeUsageError({ message: unknownFamilyMessage(unknown, declared) }));
|
|
924
|
+
}));
|
|
925
|
+
}
|
|
700
926
|
const fileArg = Argument.File("file").pipe(Argument.withDescription("The config file to upgrade (autodetected in the current directory when omitted)"), Argument.optional);
|
|
701
927
|
const yesFlag = Flag.Boolean("yes").pipe(Flag.withAlias("y"), Flag.withDescription("Apply the latest in-range version of every entry without asking (never a major)"), Flag.withDefault(false));
|
|
702
928
|
const dryRunFlag = Flag.Boolean("dry-run").pipe(Flag.withDescription("Run the whole flow and report what would change, but write nothing"), Flag.withDefault(false));
|
|
@@ -704,6 +930,7 @@ const catalogOption = Flag.String("catalog").pipe(Flag.withDescription("Only upg
|
|
|
704
930
|
const previewFlag = Flag.Boolean("preview").pipe(Flag.withDescription("Print the default picks as a summary and exit"), Flag.withDefault(false));
|
|
705
931
|
const fullFlag = Flag.Boolean("full").pipe(Flag.withDescription("Include up-to-date packages in a printed summary"), Flag.withDefault(false));
|
|
706
932
|
const checkFlag = Flag.Boolean("check").pipe(Flag.withDescription("Exit 1 when --yes would change anything (a drift gate; never writes)"), Flag.withDefault(false));
|
|
933
|
+
const familyOption = Flag.String("family").pipe(Flag.withDescription("Also move the members of this locked family (repeatable), each to its newest version within its breaking line (the major from 1.0, the minor for 0.x)"), Flag.atLeast(0));
|
|
707
934
|
const formatFlag = CliFormat.flag(["auto", "json"], { description: "Output format: auto (for whoever is reading) or json (one JSON document on stdout, with --check, --yes or --dry-run)" });
|
|
708
935
|
/** JSON mode writes one single-line document, so a bash gate can pipe it straight into jq. */
|
|
709
936
|
const ONE_LINE = { indent: 0 };
|
|
@@ -723,11 +950,15 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
723
950
|
preview: previewFlag,
|
|
724
951
|
full: fullFlag,
|
|
725
952
|
check: checkFlag,
|
|
726
|
-
format: formatFlag
|
|
727
|
-
|
|
728
|
-
|
|
953
|
+
format: formatFlag,
|
|
954
|
+
family: familyOption
|
|
955
|
+
}, ({ file: fileOpt, yes, dryRun, catalog, preview, full, check, format, family }) => {
|
|
729
956
|
const catalogName = Option.getOrUndefined(catalog);
|
|
730
|
-
const
|
|
957
|
+
const families = [...family];
|
|
958
|
+
const scope = {
|
|
959
|
+
...catalogName === void 0 ? {} : { catalog: catalogName },
|
|
960
|
+
...families.length === 0 ? {} : { families }
|
|
961
|
+
};
|
|
731
962
|
return Effect.gen(function* () {
|
|
732
963
|
const jsonRejection = validateFormatMode({
|
|
733
964
|
format,
|
|
@@ -737,12 +968,11 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
737
968
|
preview
|
|
738
969
|
});
|
|
739
970
|
if (jsonRejection !== null) return yield* Effect.fail(jsonRejection);
|
|
971
|
+
yield* validateFamilies(fileOpt, families);
|
|
740
972
|
const resolver = yield* RegistryResolver;
|
|
741
|
-
const workspaceOf = (file) => skippedChangesets.track(makeWorkspaceResolver(findWorkspaceRoot(dirname(file))));
|
|
742
973
|
const nonInteractive = (forceDryRun) => resolveTargetFile(fileOpt).pipe(Effect.flatMap((file) => runUpgrade({
|
|
743
974
|
file,
|
|
744
975
|
resolver,
|
|
745
|
-
workspaceResolver: workspaceOf(file),
|
|
746
976
|
dryRun: forceDryRun || dryRun,
|
|
747
977
|
...scope
|
|
748
978
|
})), Effect.result);
|
|
@@ -757,7 +987,7 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
757
987
|
}, ONE_LINE);
|
|
758
988
|
return yield* Effect.fail(failure);
|
|
759
989
|
}
|
|
760
|
-
const outcome =
|
|
990
|
+
const outcome = Result.isSuccess(result) ? checkOutcome(result.success.changed, result.success.locked) : checkOutcome([]);
|
|
761
991
|
yield* CliFormat.print(format, {
|
|
762
992
|
doc: () => outcome.doc,
|
|
763
993
|
json: () => json.data
|
|
@@ -774,13 +1004,11 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
774
1004
|
return;
|
|
775
1005
|
}
|
|
776
1006
|
const file = yield* resolveTargetFile(fileOpt);
|
|
777
|
-
const workspaceResolver = workspaceOf(file);
|
|
778
1007
|
if (preview) {
|
|
779
1008
|
const { doc, unresolved, causes } = yield* runUpgradePreview({
|
|
780
1009
|
file,
|
|
781
1010
|
resolver,
|
|
782
1011
|
full,
|
|
783
|
-
workspaceResolver,
|
|
784
1012
|
...scope
|
|
785
1013
|
});
|
|
786
1014
|
yield* Doc.print(doc);
|
|
@@ -791,11 +1019,11 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
791
1019
|
file,
|
|
792
1020
|
resolver,
|
|
793
1021
|
dryRun,
|
|
794
|
-
workspaceResolver,
|
|
795
1022
|
onProgress: resolveProgress(report),
|
|
796
1023
|
...scope
|
|
797
1024
|
}));
|
|
798
1025
|
yield* dryRun ? CliMessage.info(`Dry run — no changes written. ${Fmt.plural(result.updated, "package")} would be updated; skipped ${result.skipped.length}.`) : CliMessage.success(`Updated ${Fmt.plural(result.updated, "package")}; skipped ${result.skipped.length}.`);
|
|
1026
|
+
if (result.locked.length > 0) yield* Doc.print(lockedDoc(result.locked));
|
|
799
1027
|
if (result.conflicts.length > 0) {
|
|
800
1028
|
const lines = result.conflicts.map((c) => ` ${c.pkg} (kept ${c.ceiling}) blocked by ${c.blockedBy}`);
|
|
801
1029
|
yield* Doc.print(warningDoc(["Interop conflicts (left at your pick):", ...lines].join("\n")), { stream: "stderr" });
|
|
@@ -805,17 +1033,16 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
805
1033
|
const { source, entries } = yield* readCatalogSource(file, catalogName);
|
|
806
1034
|
const gate = yield* computeGate(source, file, resolver);
|
|
807
1035
|
if (!(yield* CliInteractive)) {
|
|
808
|
-
const versions = yield*
|
|
809
|
-
const items = yield* buildWalkItems(entries, versions.gated).pipe(Effect.mapError((e) => new UpgradeError({ message: e.message })));
|
|
1036
|
+
const { doc: projection, versions } = yield* previewOf(entries, families, resolver, gate, full);
|
|
810
1037
|
const note = dryRun ? "(dry run — nothing written)" : "(not interactive — run with --yes to apply, or in a terminal to choose)";
|
|
811
1038
|
yield* Doc.print([
|
|
812
|
-
...
|
|
1039
|
+
...projection,
|
|
813
1040
|
Doc.line(""),
|
|
814
1041
|
Doc.line(Doc.text(note, "muted"))
|
|
815
1042
|
]);
|
|
816
1043
|
return yield* warnUnresolved(versions.unresolved, versions.causes);
|
|
817
1044
|
}
|
|
818
|
-
const { versions, items, interopByCatalog, interopModels } = yield* withProgress((report) => resolveForWalk(entries, resolver, gate,
|
|
1045
|
+
const { versions, items, interopByCatalog, interopModels, pinned } = yield* withProgress((report) => resolveForWalk(entries, resolver, gate, report));
|
|
819
1046
|
if (items.length === 0) {
|
|
820
1047
|
yield* warnUnresolved(versions.unresolved, versions.causes);
|
|
821
1048
|
return yield* CliMessage.info(nothingToUpgradeMessage(0));
|
|
@@ -824,42 +1051,13 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
824
1051
|
items,
|
|
825
1052
|
dryRun,
|
|
826
1053
|
unresolved: versions.unresolved,
|
|
827
|
-
interopModels
|
|
1054
|
+
interopModels,
|
|
1055
|
+
open: families
|
|
828
1056
|
})).pipe(Effect.map(Option.some), Effect.catchTag("Cancelled", (cancel) => cancel.reason === "escape" ? Effect.succeed(Option.none()) : Effect.fail(cancel)));
|
|
829
1057
|
if (Option.isNone(picked)) return yield* CliMessage.info("cancelled; nothing written");
|
|
830
|
-
const decisions = picked.value;
|
|
1058
|
+
const decisions = picked.value.filter((d) => d.item.readOnly !== true);
|
|
831
1059
|
const nonInteropDecisions = decisions.filter((d) => d.item.entry.strategy !== "interop");
|
|
832
|
-
const interopEdits =
|
|
833
|
-
const allConflicts = [];
|
|
834
|
-
let interopChanged = 0;
|
|
835
|
-
for (const [catalog, group] of interopByCatalog) {
|
|
836
|
-
const model = interopModels.get(catalog);
|
|
837
|
-
if (model === void 0) continue;
|
|
838
|
-
const selected = /* @__PURE__ */ new Map();
|
|
839
|
-
for (const e of group) {
|
|
840
|
-
const d = decisions.find((dd) => dd.item.entry.catalog === catalog && dd.item.entry.pkg === e.pkg);
|
|
841
|
-
selected.set(e.pkg, d ? d.chosen.version : bareVersion(e.currentRange));
|
|
842
|
-
}
|
|
843
|
-
const { peer, conflict } = computeGroupPeers(model, selected);
|
|
844
|
-
interopEdits.push(...buildInteropEdits(group, {
|
|
845
|
-
resolved: selected,
|
|
846
|
-
peers: peer,
|
|
847
|
-
conflicts: []
|
|
848
|
-
}));
|
|
849
|
-
for (const [pkg, blockedBy] of conflict) allConflicts.push({
|
|
850
|
-
pkg,
|
|
851
|
-
ceiling: selected.get(pkg) ?? "",
|
|
852
|
-
blockedBy
|
|
853
|
-
});
|
|
854
|
-
for (const e of group) {
|
|
855
|
-
const version = selected.get(e.pkg);
|
|
856
|
-
if (version === void 0) continue;
|
|
857
|
-
const rangeChanged = `${e.operator}${version}` !== e.currentRange;
|
|
858
|
-
const newPeer = peer.get(e.pkg);
|
|
859
|
-
const peerChanged = newPeer !== void 0 && (e.peer ? newPeer !== e.peer.value : true);
|
|
860
|
-
if (rangeChanged || peerChanged) interopChanged++;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
1060
|
+
const { edits: interopEdits, conflicts: allConflicts, changed: interopChanged } = walkInteropEdits(interopByCatalog, interopModels, decisions, pinned);
|
|
863
1061
|
const planned = buildEdits(nonInteropDecisions);
|
|
864
1062
|
const { accepted, rejected } = yield* validateEdits(planned, versions.raw);
|
|
865
1063
|
const acceptedPkgs = new Set(accepted.map((e) => e.pkg));
|
|
@@ -868,7 +1066,7 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
868
1066
|
const changed = countChangedDecisions(nonInteropDecisions.filter((d) => acceptedPkgs.has(d.item.entry.pkg))) + interopChanged;
|
|
869
1067
|
yield* dryRun ? CliMessage.info(`Dry run — no changes written. ${Fmt.plural(changed, "change")} would be applied.`) : CliMessage.success(`Applied ${Fmt.plural(changed, "change")}.`);
|
|
870
1068
|
yield* warnUnresolved(versions.unresolved, versions.causes);
|
|
871
|
-
})
|
|
1069
|
+
});
|
|
872
1070
|
}).pipe(Command.withDescription("Upgrade catalog versions in a config file"));
|
|
873
1071
|
|
|
874
|
-
export { CHECK_FAILED_LABEL, CheckFailedError, UpgradeError, UpgradeUsageError, applyInteropAndDecisions, checkJsonOutcome, checkOutcome, computeGate, countChangedDecisions, nothingToUpgradeMessage, projectDecisions, readCatalogSource, resolveGatedVersions, resolveProgress, resolveTargetFile, runUpgrade, runUpgradePreview, skippedChangesetsMessage, unknownCatalogMessage, unresolvedMessage, upgradeCommand, upgradeJsonOutcome, validateFormatMode };
|
|
1072
|
+
export { CHECK_FAILED_LABEL, CheckFailedError, UpgradeError, UpgradeUsageError, applyInteropAndDecisions, checkJsonOutcome, checkOutcome, computeGate, countChangedDecisions, lockedDoc, nothingToUpgradeMessage, partitionEntries, projectDecisions, projectPreview, readCatalogSource, resolveForWalk, resolveGatedVersions, resolveProgress, resolveTargetFile, runUpgrade, runUpgradePreview, skippedChangesetsMessage, unknownCatalogMessage, unknownFamilyMessage, unreadFamiliesMessage, unresolvedMessage, upgradeCommand, upgradeJsonOutcome, validateFormatMode, walkInteropEdits };
|