rolldown-pnpm-config 2.4.2 → 2.4.4
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/bin/rolldown-pnpm-config.js +9 -2
- package/cli/commands/upgrade.js +191 -141
- package/cli/interop.js +1 -1
- package/cli/main.js +12 -4
- package/cli/release-age.js +4 -24
- package/cli/resolve.js +67 -33
- package/cli/ui/preview-screen.js +1 -0
- package/cli/ui/progress-view.js +1 -0
- package/cli/ui/walk-screen.js +1 -0
- package/cli/version.js +1 -1
- package/cli/workspace-resolve.js +47 -54
- package/package.json +10 -9
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { main } from "../cli/main.js";
|
|
3
|
-
|
|
4
2
|
// src/cli/bin.ts
|
|
3
|
+
if (import.meta.url.endsWith(".ts")) {
|
|
4
|
+
const { register } = await import([
|
|
5
|
+
"tsx",
|
|
6
|
+
"esm",
|
|
7
|
+
"api"
|
|
8
|
+
].join("/"));
|
|
9
|
+
register();
|
|
10
|
+
}
|
|
11
|
+
const { main } = await import("../cli/main.js");
|
|
5
12
|
main();
|
|
6
13
|
|
|
7
14
|
export { };
|
package/cli/commands/upgrade.js
CHANGED
|
@@ -7,7 +7,7 @@ import { buildInteropEdits, interopEntryChanged, makePeerFetcher, runInterop } f
|
|
|
7
7
|
import { buildGroupModel, computeGroupPeers } from "../interop-live.js";
|
|
8
8
|
import { derivePeerRange } from "../peer-range.js";
|
|
9
9
|
import { defaultPick, planEntry } from "../plan.js";
|
|
10
|
-
import {
|
|
10
|
+
import { readConfigReleaseAge } from "../release-age.js";
|
|
11
11
|
import { failureDoc, warningDoc } from "../render/report.js";
|
|
12
12
|
import { RegistryResolver } from "../resolve.js";
|
|
13
13
|
import { applyEdits } from "../rewrite.js";
|
|
@@ -94,9 +94,7 @@ function readCatalogSource(file) {
|
|
|
94
94
|
function computeGate(source, file, resolver) {
|
|
95
95
|
return Effect.gen(function* () {
|
|
96
96
|
const { config } = yield* Effect.try(() => evaluatePluginConfig(source, file)).pipe(Effect.orElseSucceed(() => ({ config: null })));
|
|
97
|
-
const
|
|
98
|
-
const [age, exc] = yield* Effect.all([resolver.pnpmConfig("minimumReleaseAge").pipe(Effect.orElseSucceed(() => null)), resolver.pnpmConfig("minimumReleaseAgeExclude").pipe(Effect.orElseSucceed(() => null))], { concurrency: "unbounded" });
|
|
99
|
-
const contributions = [cfg, parsePnpmGate(age, exc)].filter((g) => g !== null);
|
|
97
|
+
const contributions = [readConfigReleaseAge(config), yield* resolver.pnpmReleaseAge().pipe(Effect.orElseSucceed(() => null))].filter((g) => g !== null);
|
|
100
98
|
return ReleaseAgeGate.combine(...contributions);
|
|
101
99
|
});
|
|
102
100
|
}
|
|
@@ -196,8 +194,9 @@ function resolveProgress(report) {
|
|
|
196
194
|
* materialize its managed peer offline from the current range.
|
|
197
195
|
*
|
|
198
196
|
* This path runs UNATTENDED (`--yes`, i.e. CI), so it fails hard rather than
|
|
199
|
-
* degrading: any peer-strategy warning,
|
|
200
|
-
* version satisfies,
|
|
197
|
+
* degrading: any peer-strategy warning, any planned edit no published
|
|
198
|
+
* version satisfies, or a malformed pending changeset read while resolving a
|
|
199
|
+
* workspace-sourced entry, aborts the run and writes NOTHING. A warning that scrolls
|
|
201
200
|
* past unread in a CI log is a bad range in a published artifact. The
|
|
202
201
|
* interactive path is deliberately more forgiving (see `upgradeCommand`).
|
|
203
202
|
*
|
|
@@ -209,6 +208,11 @@ function runUpgrade(opts) {
|
|
|
209
208
|
const gate = yield* computeGate(source, opts.file, opts.resolver);
|
|
210
209
|
const versionsByPkg = yield* resolveGatedVersions(entries, opts.resolver, gate, yield* Clock.currentTimeMillis, opts.onProgress, opts.workspaceResolver);
|
|
211
210
|
if (versionsByPkg.unresolved.length > 0) return yield* Effect.fail(new UpgradeError({ message: unresolvedMessage(versionsByPkg.unresolved) }));
|
|
211
|
+
const skippedChangesets = opts.workspaceResolver?.skippedChangesets() ?? [];
|
|
212
|
+
if (skippedChangesets.length > 0) return yield* Effect.fail(new UpgradeError({
|
|
213
|
+
message: skippedChangesetsMessage(skippedChangesets),
|
|
214
|
+
kind: "changeset"
|
|
215
|
+
}));
|
|
212
216
|
const edits = [];
|
|
213
217
|
const interopEdits = [];
|
|
214
218
|
const warnings = [];
|
|
@@ -472,7 +476,8 @@ function checkJsonOutcome(result) {
|
|
|
472
476
|
* real apply; `changed` uses the same row object as check's `drift`. A failure
|
|
473
477
|
* emits an error document on stdout and is returned as `failure`, which the
|
|
474
478
|
* command fails with (non-zero exit, human message on stderr); `error.kind` is
|
|
475
|
-
* `"peer-strategy"` for a peer-strategy refusal
|
|
479
|
+
* `"peer-strategy"` for a peer-strategy refusal, `"changeset"` for a run that
|
|
480
|
+
* resolved past a malformed pending changeset, and `"resolution"` otherwise.
|
|
476
481
|
*
|
|
477
482
|
* @internal
|
|
478
483
|
*/
|
|
@@ -536,6 +541,48 @@ function resolveTargetFile(fileOpt) {
|
|
|
536
541
|
return picked.file;
|
|
537
542
|
});
|
|
538
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* The report for pending changesets the workspace resolver skipped: one line
|
|
546
|
+
* per file with why it would not parse. A skipped file's bumps are dropped,
|
|
547
|
+
* so the workspace packages it names resolve to their current version.
|
|
548
|
+
*
|
|
549
|
+
* @internal
|
|
550
|
+
*/
|
|
551
|
+
function skippedChangesetsMessage(skipped) {
|
|
552
|
+
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");
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Collects the workspace resolvers one upgrade run builds, so the run reports
|
|
556
|
+
* every pending changeset they skipped exactly once, whichever path it took.
|
|
557
|
+
* `report` is the run's finalizer: a warning on stderr, unless `silence` was
|
|
558
|
+
* called because the run already failed with that list (`runUpgrade`).
|
|
559
|
+
*/
|
|
560
|
+
function skippedChangesetsTracker() {
|
|
561
|
+
const resolvers = [];
|
|
562
|
+
let silenced = false;
|
|
563
|
+
const collect = () => {
|
|
564
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
565
|
+
for (const r of resolvers) for (const s of r.skippedChangesets()) byFile.set(s.file, s);
|
|
566
|
+
return [...byFile.values()];
|
|
567
|
+
};
|
|
568
|
+
return {
|
|
569
|
+
track: (resolver) => {
|
|
570
|
+
resolvers.push(resolver);
|
|
571
|
+
return resolver;
|
|
572
|
+
},
|
|
573
|
+
silence: () => {
|
|
574
|
+
silenced = true;
|
|
575
|
+
},
|
|
576
|
+
report: Effect.suspend(() => {
|
|
577
|
+
const skipped = silenced ? [] : collect();
|
|
578
|
+
return skipped.length > 0 ? Doc.print(warningDoc(skippedChangesetsMessage(skipped)), { stream: "stderr" }) : Effect.void;
|
|
579
|
+
})
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
/** Whether a run failed on a malformed pending changeset, which its failure report already lists. */
|
|
583
|
+
function isChangesetFailure(error) {
|
|
584
|
+
return (error instanceof UpgradeError || error instanceof CheckFailedError) && error.kind === "changeset";
|
|
585
|
+
}
|
|
539
586
|
/** Print the unresolved-packages warning to stderr, when there is one. */
|
|
540
587
|
function warnUnresolved(unresolved) {
|
|
541
588
|
return unresolved.length > 0 ? Doc.print(warningDoc(unresolvedMessage(unresolved)), { stream: "stderr" }) : Effect.void;
|
|
@@ -620,144 +667,147 @@ const upgradeCommand = Command.make("upgrade", {
|
|
|
620
667
|
full: fullFlag,
|
|
621
668
|
check: checkFlag,
|
|
622
669
|
format: formatFlag
|
|
623
|
-
}, ({ file: fileOpt, yes, dryRun, catalog, preview, full, check, format }) =>
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const resolver = yield* RegistryResolver;
|
|
633
|
-
const workspaceOf = (file) => makeWorkspaceResolver(findWorkspaceRoot(dirname(file)));
|
|
634
|
-
const nonInteractive = (forceDryRun) => resolveTargetFile(fileOpt).pipe(Effect.flatMap((file) => runUpgrade({
|
|
635
|
-
file,
|
|
636
|
-
resolver,
|
|
637
|
-
workspaceResolver: workspaceOf(file),
|
|
638
|
-
dryRun: forceDryRun || dryRun
|
|
639
|
-
})), Effect.result);
|
|
640
|
-
if (check) {
|
|
641
|
-
const result = yield* nonInteractive(true);
|
|
642
|
-
const json = checkJsonOutcome(result);
|
|
643
|
-
const failure = json.failure;
|
|
644
|
-
if (failure !== void 0) {
|
|
645
|
-
if (format === "json") yield* CliFormat.print("json", {
|
|
646
|
-
doc: () => failure[CliDoc](),
|
|
647
|
-
json: () => json.data
|
|
648
|
-
}, ONE_LINE);
|
|
649
|
-
return yield* Effect.fail(failure);
|
|
650
|
-
}
|
|
651
|
-
const outcome = checkOutcome(Result.isSuccess(result) ? result.success.changed : []);
|
|
652
|
-
yield* CliFormat.print(format, {
|
|
653
|
-
doc: () => outcome.doc,
|
|
654
|
-
json: () => json.data
|
|
655
|
-
}, ONE_LINE);
|
|
656
|
-
return yield* CliExit.set(outcome.exitCode);
|
|
657
|
-
}
|
|
658
|
-
if (format === "json") {
|
|
659
|
-
const o = upgradeJsonOutcome(yield* nonInteractive(false), dryRun);
|
|
660
|
-
yield* CliFormat.print("json", {
|
|
661
|
-
doc: () => [],
|
|
662
|
-
json: () => o.data
|
|
663
|
-
}, ONE_LINE);
|
|
664
|
-
if (o.failure !== void 0) return yield* Effect.fail(o.failure);
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
const file = yield* resolveTargetFile(fileOpt);
|
|
668
|
-
const workspaceResolver = workspaceOf(file);
|
|
669
|
-
if (preview) {
|
|
670
|
-
const { doc, unresolved } = yield* runUpgradePreview({
|
|
671
|
-
file,
|
|
672
|
-
resolver,
|
|
673
|
-
full,
|
|
674
|
-
workspaceResolver
|
|
670
|
+
}, ({ file: fileOpt, yes, dryRun, catalog, preview, full, check, format }) => {
|
|
671
|
+
const skippedChangesets = skippedChangesetsTracker();
|
|
672
|
+
return Effect.gen(function* () {
|
|
673
|
+
const jsonRejection = validateFormatMode({
|
|
674
|
+
format,
|
|
675
|
+
check,
|
|
676
|
+
yes,
|
|
677
|
+
dryRun,
|
|
678
|
+
preview
|
|
675
679
|
});
|
|
676
|
-
yield*
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
const result = yield* withProgress((report) => runUpgrade({
|
|
680
|
+
if (jsonRejection !== null) return yield* Effect.fail(jsonRejection);
|
|
681
|
+
const resolver = yield* RegistryResolver;
|
|
682
|
+
const workspaceOf = (file) => skippedChangesets.track(makeWorkspaceResolver(findWorkspaceRoot(dirname(file))));
|
|
683
|
+
const nonInteractive = (forceDryRun) => resolveTargetFile(fileOpt).pipe(Effect.flatMap((file) => runUpgrade({
|
|
681
684
|
file,
|
|
682
685
|
resolver,
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
|
|
686
|
+
workspaceResolver: workspaceOf(file),
|
|
687
|
+
dryRun: forceDryRun || dryRun
|
|
688
|
+
})), Effect.result);
|
|
689
|
+
if (check) {
|
|
690
|
+
const result = yield* nonInteractive(true);
|
|
691
|
+
const json = checkJsonOutcome(result);
|
|
692
|
+
const failure = json.failure;
|
|
693
|
+
if (failure !== void 0) {
|
|
694
|
+
if (format === "json") yield* CliFormat.print("json", {
|
|
695
|
+
doc: () => failure[CliDoc](),
|
|
696
|
+
json: () => json.data
|
|
697
|
+
}, ONE_LINE);
|
|
698
|
+
return yield* Effect.fail(failure);
|
|
699
|
+
}
|
|
700
|
+
const outcome = checkOutcome(Result.isSuccess(result) ? result.success.changed : []);
|
|
701
|
+
yield* CliFormat.print(format, {
|
|
702
|
+
doc: () => outcome.doc,
|
|
703
|
+
json: () => json.data
|
|
704
|
+
}, ONE_LINE);
|
|
705
|
+
return yield* CliExit.set(outcome.exitCode);
|
|
691
706
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
const note = dryRun ? "(dry run — nothing written)" : "(not interactive — run with --yes to apply, or in a terminal to choose)";
|
|
701
|
-
yield* Doc.print([
|
|
702
|
-
...summaryDoc(projectDecisions(items, full)),
|
|
703
|
-
Doc.line(""),
|
|
704
|
-
Doc.line(Doc.text(note, "muted"))
|
|
705
|
-
]);
|
|
706
|
-
return yield* warnUnresolved(versions.unresolved);
|
|
707
|
-
}
|
|
708
|
-
const { versions, items, interopByCatalog, interopModels } = yield* withProgress((report) => resolveForWalk(entries, resolver, gate, workspaceResolver, report));
|
|
709
|
-
if (items.length === 0) {
|
|
710
|
-
yield* warnUnresolved(versions.unresolved);
|
|
711
|
-
return yield* CliMessage.info(nothingToUpgradeMessage(0));
|
|
712
|
-
}
|
|
713
|
-
const picked = yield* CliUi.run(walkScreen({
|
|
714
|
-
items,
|
|
715
|
-
dryRun,
|
|
716
|
-
unresolved: versions.unresolved,
|
|
717
|
-
interopModels
|
|
718
|
-
})).pipe(Effect.map(Option.some), Effect.catchTag("Cancelled", (cancel) => cancel.reason === "escape" ? Effect.succeed(Option.none()) : Effect.fail(cancel)));
|
|
719
|
-
if (Option.isNone(picked)) return yield* CliMessage.info("cancelled; nothing written");
|
|
720
|
-
const decisions = picked.value;
|
|
721
|
-
const nonInteropDecisions = decisions.filter((d) => d.item.entry.strategy !== "interop");
|
|
722
|
-
const interopEdits = [];
|
|
723
|
-
const allConflicts = [];
|
|
724
|
-
let interopChanged = 0;
|
|
725
|
-
for (const [catalog, group] of interopByCatalog) {
|
|
726
|
-
const model = interopModels.get(catalog);
|
|
727
|
-
if (model === void 0) continue;
|
|
728
|
-
const selected = /* @__PURE__ */ new Map();
|
|
729
|
-
for (const e of group) {
|
|
730
|
-
const d = decisions.find((dd) => dd.item.entry.catalog === catalog && dd.item.entry.pkg === e.pkg);
|
|
731
|
-
selected.set(e.pkg, d ? d.chosen.version : bareVersion(e.currentRange));
|
|
707
|
+
if (format === "json") {
|
|
708
|
+
const o = upgradeJsonOutcome(yield* nonInteractive(false), dryRun);
|
|
709
|
+
yield* CliFormat.print("json", {
|
|
710
|
+
doc: () => [],
|
|
711
|
+
json: () => o.data
|
|
712
|
+
}, ONE_LINE);
|
|
713
|
+
if (o.failure !== void 0) return yield* Effect.fail(o.failure);
|
|
714
|
+
return;
|
|
732
715
|
}
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
for (const e of group) {
|
|
745
|
-
const version = selected.get(e.pkg);
|
|
746
|
-
if (version === void 0) continue;
|
|
747
|
-
const rangeChanged = `${e.operator}${version}` !== e.currentRange;
|
|
748
|
-
const newPeer = peer.get(e.pkg);
|
|
749
|
-
const peerChanged = newPeer !== void 0 && (e.peer ? newPeer !== e.peer.value : true);
|
|
750
|
-
if (rangeChanged || peerChanged) interopChanged++;
|
|
716
|
+
const file = yield* resolveTargetFile(fileOpt);
|
|
717
|
+
const workspaceResolver = workspaceOf(file);
|
|
718
|
+
if (preview) {
|
|
719
|
+
const { doc, unresolved } = yield* runUpgradePreview({
|
|
720
|
+
file,
|
|
721
|
+
resolver,
|
|
722
|
+
full,
|
|
723
|
+
workspaceResolver
|
|
724
|
+
});
|
|
725
|
+
yield* Doc.print(doc);
|
|
726
|
+
return yield* warnUnresolved(unresolved);
|
|
751
727
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
728
|
+
if (yes) {
|
|
729
|
+
const result = yield* withProgress((report) => runUpgrade({
|
|
730
|
+
file,
|
|
731
|
+
resolver,
|
|
732
|
+
dryRun,
|
|
733
|
+
workspaceResolver,
|
|
734
|
+
onProgress: resolveProgress(report)
|
|
735
|
+
}));
|
|
736
|
+
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}.`);
|
|
737
|
+
if (result.conflicts.length > 0) {
|
|
738
|
+
const lines = result.conflicts.map((c) => ` ${c.pkg} (kept ${c.ceiling}) blocked by ${c.blockedBy}`);
|
|
739
|
+
yield* Doc.print(warningDoc(["Interop conflicts (left at your pick):", ...lines].join("\n")), { stream: "stderr" });
|
|
740
|
+
}
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
const { source, entries: discovered } = yield* readCatalogSource(file);
|
|
744
|
+
const entries = filterEntriesByCatalog(discovered, Option.getOrUndefined(catalog));
|
|
745
|
+
const gate = yield* computeGate(source, file, resolver);
|
|
746
|
+
if (!(yield* CliInteractive)) {
|
|
747
|
+
const versions = yield* resolveGatedVersions(entries, resolver, gate, yield* Clock.currentTimeMillis, void 0, workspaceResolver);
|
|
748
|
+
const items = yield* buildWalkItems(entries, versions.gated).pipe(Effect.mapError((e) => new UpgradeError({ message: e.message })));
|
|
749
|
+
const note = dryRun ? "(dry run — nothing written)" : "(not interactive — run with --yes to apply, or in a terminal to choose)";
|
|
750
|
+
yield* Doc.print([
|
|
751
|
+
...summaryDoc(projectDecisions(items, full)),
|
|
752
|
+
Doc.line(""),
|
|
753
|
+
Doc.line(Doc.text(note, "muted"))
|
|
754
|
+
]);
|
|
755
|
+
return yield* warnUnresolved(versions.unresolved);
|
|
756
|
+
}
|
|
757
|
+
const { versions, items, interopByCatalog, interopModels } = yield* withProgress((report) => resolveForWalk(entries, resolver, gate, workspaceResolver, report));
|
|
758
|
+
if (items.length === 0) {
|
|
759
|
+
yield* warnUnresolved(versions.unresolved);
|
|
760
|
+
return yield* CliMessage.info(nothingToUpgradeMessage(0));
|
|
761
|
+
}
|
|
762
|
+
const picked = yield* CliUi.run(walkScreen({
|
|
763
|
+
items,
|
|
764
|
+
dryRun,
|
|
765
|
+
unresolved: versions.unresolved,
|
|
766
|
+
interopModels
|
|
767
|
+
})).pipe(Effect.map(Option.some), Effect.catchTag("Cancelled", (cancel) => cancel.reason === "escape" ? Effect.succeed(Option.none()) : Effect.fail(cancel)));
|
|
768
|
+
if (Option.isNone(picked)) return yield* CliMessage.info("cancelled; nothing written");
|
|
769
|
+
const decisions = picked.value;
|
|
770
|
+
const nonInteropDecisions = decisions.filter((d) => d.item.entry.strategy !== "interop");
|
|
771
|
+
const interopEdits = [];
|
|
772
|
+
const allConflicts = [];
|
|
773
|
+
let interopChanged = 0;
|
|
774
|
+
for (const [catalog, group] of interopByCatalog) {
|
|
775
|
+
const model = interopModels.get(catalog);
|
|
776
|
+
if (model === void 0) continue;
|
|
777
|
+
const selected = /* @__PURE__ */ new Map();
|
|
778
|
+
for (const e of group) {
|
|
779
|
+
const d = decisions.find((dd) => dd.item.entry.catalog === catalog && dd.item.entry.pkg === e.pkg);
|
|
780
|
+
selected.set(e.pkg, d ? d.chosen.version : bareVersion(e.currentRange));
|
|
781
|
+
}
|
|
782
|
+
const { peer, conflict } = computeGroupPeers(model, selected);
|
|
783
|
+
interopEdits.push(...buildInteropEdits(group, {
|
|
784
|
+
resolved: selected,
|
|
785
|
+
peers: peer,
|
|
786
|
+
conflicts: []
|
|
787
|
+
}));
|
|
788
|
+
for (const [pkg, blockedBy] of conflict) allConflicts.push({
|
|
789
|
+
pkg,
|
|
790
|
+
ceiling: selected.get(pkg) ?? "",
|
|
791
|
+
blockedBy
|
|
792
|
+
});
|
|
793
|
+
for (const e of group) {
|
|
794
|
+
const version = selected.get(e.pkg);
|
|
795
|
+
if (version === void 0) continue;
|
|
796
|
+
const rangeChanged = `${e.operator}${version}` !== e.currentRange;
|
|
797
|
+
const newPeer = peer.get(e.pkg);
|
|
798
|
+
const peerChanged = newPeer !== void 0 && (e.peer ? newPeer !== e.peer.value : true);
|
|
799
|
+
if (rangeChanged || peerChanged) interopChanged++;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
const planned = buildEdits(nonInteropDecisions);
|
|
803
|
+
const { accepted, rejected } = yield* validateEdits(planned, versions.raw);
|
|
804
|
+
const acceptedPkgs = new Set(accepted.map((e) => e.pkg));
|
|
805
|
+
yield* Doc.print(summaryDoc(decisions, { conflicts: allConflicts }, rejected));
|
|
806
|
+
if (!dryRun) yield* applyInteropAndDecisions(file, source, accepted, interopEdits);
|
|
807
|
+
const changed = countChangedDecisions(nonInteropDecisions.filter((d) => acceptedPkgs.has(d.item.entry.pkg))) + interopChanged;
|
|
808
|
+
yield* dryRun ? CliMessage.info(`Dry run — no changes written. ${Fmt.plural(changed, "change")} would be applied.`) : CliMessage.success(`Applied ${Fmt.plural(changed, "change")}.`);
|
|
809
|
+
yield* warnUnresolved(versions.unresolved);
|
|
810
|
+
}).pipe(Effect.tapError((error) => isChangesetFailure(error) ? Effect.sync(skippedChangesets.silence) : Effect.void), Effect.ensuring(skippedChangesets.report));
|
|
811
|
+
}).pipe(Command.withDescription("Upgrade catalog versions in a config file"));
|
|
762
812
|
|
|
763
|
-
export { CHECK_FAILED_LABEL, CheckFailedError, UpgradeError, UpgradeUsageError, applyInteropAndDecisions, checkJsonOutcome, checkOutcome, computeGate, countChangedDecisions, nothingToUpgradeMessage, projectDecisions, readCatalogSource, resolveGatedVersions, resolveProgress, resolveTargetFile, runUpgrade, runUpgradePreview, unresolvedMessage, upgradeCommand, upgradeJsonOutcome, validateFormatMode };
|
|
813
|
+
export { CHECK_FAILED_LABEL, CheckFailedError, UpgradeError, UpgradeUsageError, applyInteropAndDecisions, checkJsonOutcome, checkOutcome, computeGate, countChangedDecisions, nothingToUpgradeMessage, projectDecisions, readCatalogSource, resolveGatedVersions, resolveProgress, resolveTargetFile, runUpgrade, runUpgradePreview, skippedChangesetsMessage, unresolvedMessage, upgradeCommand, upgradeJsonOutcome, validateFormatMode };
|
package/cli/interop.js
CHANGED
|
@@ -153,7 +153,7 @@ function resolveGroup(members, fetchPeer) {
|
|
|
153
153
|
* peerDeps (the member resolves at its ceiling).
|
|
154
154
|
*
|
|
155
155
|
* Phase 1 now prefetches only the ceiling version of each member (one
|
|
156
|
-
*
|
|
156
|
+
* registry read per member) instead of every candidate version ≤ ceiling.
|
|
157
157
|
* `resolveGroup` / `violations` fetch lower versions on-demand via the shared
|
|
158
158
|
* `fetchPeer` Effectful memoized lookup — they are only consulted when a
|
|
159
159
|
* downgrade search probes them, which for real-world interop groups (where most
|
package/cli/main.js
CHANGED
|
@@ -15,9 +15,11 @@ import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
|
15
15
|
* platform's `Stdio` (in `NodeServices.layer`) answers it, which is where the
|
|
16
16
|
* kit reads it from when `env.stderrIsTerminal` is omitted.
|
|
17
17
|
*
|
|
18
|
-
* The registry resolver
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The registry resolver is provided here, at the edge, so a test drives the
|
|
19
|
+
* same command tree against a stub resolver. It spawns `pnpm view` through the
|
|
20
|
+
* platform's `ChildProcessSpawner`, reads pnpm's settings from
|
|
21
|
+
* `process.cwd()` / `process.env` / `process.platform`, and takes `FileSystem`
|
|
22
|
+
* and `Path` from `NodeServices.layer`, provided by `main`.
|
|
21
23
|
*
|
|
22
24
|
* `CliRuntime.main` builds the audience, terminal and theme from `env`,
|
|
23
25
|
* decides whether the run may prompt, reports every failure on stderr for the
|
|
@@ -27,7 +29,13 @@ import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
|
27
29
|
* @internal
|
|
28
30
|
*/
|
|
29
31
|
function main() {
|
|
30
|
-
const
|
|
32
|
+
const cwd = process.cwd();
|
|
33
|
+
const resolverLayer = RegistryResolverLive({
|
|
34
|
+
cwd,
|
|
35
|
+
env: process.env,
|
|
36
|
+
platform: process.platform
|
|
37
|
+
});
|
|
38
|
+
const program = CliAudience.run(rootCommand, { version: CLI_VERSION }).pipe(Effect.provideService(WorkingDirectory, cwd), Effect.provide(resolverLayer));
|
|
31
39
|
NodeRuntime.runMain(CliRuntime.main(program, {
|
|
32
40
|
platform: NodeServices.layer,
|
|
33
41
|
helpOnUsageError: "stderr",
|
package/cli/release-age.js
CHANGED
|
@@ -2,11 +2,12 @@ import { isWrappedField } from "../plugin/freeze.js";
|
|
|
2
2
|
|
|
3
3
|
// src/cli/release-age.ts
|
|
4
4
|
/**
|
|
5
|
-
* Read a release-age gate from config and
|
|
5
|
+
* Read a release-age gate from config and combine it with
|
|
6
6
|
* {@link @effected/npm#ReleaseAgeGate.combine}. The gate model itself
|
|
7
7
|
* (`ReleaseAgeGate`, `PartialReleaseAgeGate`, the age filter, and the
|
|
8
8
|
* `@pnpm/matcher` exclude semantics) lives in `@effected/npm`; this module
|
|
9
|
-
* only turns
|
|
9
|
+
* only turns a plugin config into a partial contribution (pnpm's own settings
|
|
10
|
+
* are read by `RegistryResolver.pnpmReleaseAge`, through `PnpmSettings`).
|
|
10
11
|
*/
|
|
11
12
|
/** Unwrap a managed field that may be a bare value or a `{ value, enforcement }` FieldInput. */
|
|
12
13
|
const fieldValue = (raw) => isWrappedField(raw) ? raw.value : raw;
|
|
@@ -20,26 +21,5 @@ function readConfigReleaseAge(config) {
|
|
|
20
21
|
if (Array.isArray(exc)) out.exclude = exc.filter((x) => typeof x === "string");
|
|
21
22
|
return out.ageMinutes === void 0 && out.exclude === void 0 ? null : out;
|
|
22
23
|
}
|
|
23
|
-
/** Parse `pnpm config get minimumReleaseAge[Exclude]` stdout into a PartialReleaseAgeGate. @internal */
|
|
24
|
-
function parsePnpmGate(age, exclude) {
|
|
25
|
-
const out = {};
|
|
26
|
-
const trimmedAge = age?.trim();
|
|
27
|
-
if (trimmedAge && trimmedAge !== "undefined") {
|
|
28
|
-
const n = Number.parseInt(trimmedAge, 10);
|
|
29
|
-
if (Number.isFinite(n)) out.ageMinutes = n;
|
|
30
|
-
}
|
|
31
|
-
const trimmedExc = exclude?.trim();
|
|
32
|
-
if (trimmedExc && trimmedExc !== "undefined") {
|
|
33
|
-
let list = [];
|
|
34
|
-
try {
|
|
35
|
-
const json = JSON.parse(trimmedExc);
|
|
36
|
-
list = Array.isArray(json) ? json.map(String) : [String(json)];
|
|
37
|
-
} catch {
|
|
38
|
-
list = trimmedExc.split(/[\s,]+/).filter(Boolean);
|
|
39
|
-
}
|
|
40
|
-
if (list.length) out.exclude = list;
|
|
41
|
-
}
|
|
42
|
-
return out.ageMinutes === void 0 && out.exclude === void 0 ? null : out;
|
|
43
|
-
}
|
|
44
24
|
|
|
45
|
-
export {
|
|
25
|
+
export { readConfigReleaseAge };
|
package/cli/resolve.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Context, Data, Effect, Layer, Predicate } from "effect";
|
|
1
|
+
import { Context, Data, Effect, FileSystem, Layer, Option, Path, Predicate } from "effect";
|
|
2
2
|
import { Fmt } from "@effected/cli-kit";
|
|
3
|
+
import { PnpmSettings } from "@effected/workspaces";
|
|
3
4
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
5
|
|
|
5
6
|
// src/cli/resolve.ts
|
|
@@ -11,14 +12,31 @@ const Spawner = ChildProcessSpawner.ChildProcessSpawner;
|
|
|
11
12
|
*/
|
|
12
13
|
var ResolveError = class extends Data.TaggedError("ResolveError") {};
|
|
13
14
|
/**
|
|
14
|
-
* Resolves the published versions of a package from the registry
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Resolves the published versions of a package from the registry, and the
|
|
16
|
+
* release-age gate pnpm itself would apply. The Live implementation shells out
|
|
17
|
+
* to `pnpm view` for registry reads, reusing the user's .npmrc, scoped
|
|
18
|
+
* registries, auth tokens, proxy and TLS settings, and reads pnpm's own
|
|
19
|
+
* settings through `@effected/workspaces`' `PnpmSettings`.
|
|
17
20
|
*
|
|
18
21
|
* @internal
|
|
19
22
|
*/
|
|
20
23
|
var RegistryResolver = class extends Context.Service()("RegistryResolver") {};
|
|
21
24
|
/**
|
|
25
|
+
* Turn pnpm's effective settings into this resolver's partial gate contribution.
|
|
26
|
+
* `minimumReleaseAge` unset is absent (not an open gate); an empty exclude list
|
|
27
|
+
* contributes nothing.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
function pnpmGateOf(settings) {
|
|
32
|
+
const out = {};
|
|
33
|
+
const age = settings.minimumReleaseAge;
|
|
34
|
+
if (Option.isSome(age)) out.ageMinutes = age.value;
|
|
35
|
+
const exclude = settings.minimumReleaseAgeExclude;
|
|
36
|
+
if (exclude.length > 0) out.exclude = [...exclude];
|
|
37
|
+
return out.ageMinutes === void 0 && out.exclude === void 0 ? null : out;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
22
40
|
* Drop pnpm's own notice lines from captured stdout. pnpm prints e.g.
|
|
23
41
|
* `[WARN] This project is configured to use 12.5.0… Your current pnpm is v12.4.2`
|
|
24
42
|
* (a `packageManager` mismatch) to STDOUT ahead of the `--json` payload, which
|
|
@@ -30,7 +48,7 @@ var RegistryResolver = class extends Context.Service()("RegistryResolver") {};
|
|
|
30
48
|
function stripPnpmNotices(stdout) {
|
|
31
49
|
return stdout.replace(/^[ \t]*(?:\[WARN\]|\[ERR\]|WARN\b|ERR_PNPM_\w+)[^\n]*\n?/gm, "");
|
|
32
50
|
}
|
|
33
|
-
/** Parse `pnpm view ... versions --json` stdout: a JSON array, or a single JSON string. */
|
|
51
|
+
/** Parse `pnpm view ... versions --json` stdout: a JSON array, or a single JSON string. @internal */
|
|
34
52
|
function parseVersions(pkg, stdout) {
|
|
35
53
|
return Effect.try({
|
|
36
54
|
try: () => {
|
|
@@ -72,35 +90,51 @@ function parsePeerDeps(pkg, stdout) {
|
|
|
72
90
|
return parseStringRecord(pkg, trimmed, "peerDependencies");
|
|
73
91
|
}
|
|
74
92
|
/**
|
|
75
|
-
* Live RegistryResolver
|
|
93
|
+
* Live RegistryResolver: registry reads through `pnpm view`, the release-age
|
|
94
|
+
* gate through `PnpmSettings`.
|
|
95
|
+
*
|
|
96
|
+
* Registry reads stay on `pnpm view` rather than `@effected/npm`'s
|
|
97
|
+
* `NpmRegistry` until the kit honours npmrc `proxy`/`https-proxy`,
|
|
98
|
+
* `cafile`/`ca` and `strict-ssl` (spencerbeggs/effected#1307, tracked locally
|
|
99
|
+
* in #295): over plain `fetch`, a user behind a corporate proxy or an
|
|
100
|
+
* internal CA would fail every lookup that `pnpm view` answers.
|
|
101
|
+
*
|
|
102
|
+
* `PnpmSettings` loads lazily and once (`Effect.cached`), so a malformed
|
|
103
|
+
* `pnpm-workspace.yaml` fails only `pnpmReleaseAge`, typed, and never layer
|
|
104
|
+
* construction.
|
|
76
105
|
*
|
|
77
106
|
* @internal
|
|
78
107
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
function RegistryResolverLive(options) {
|
|
109
|
+
return Layer.effect(RegistryResolver, Effect.gen(function* () {
|
|
110
|
+
const spawner = yield* Spawner;
|
|
111
|
+
const fs = yield* FileSystem.FileSystem;
|
|
112
|
+
const path = yield* Path.Path;
|
|
113
|
+
const pnpmSettings = yield* Effect.cached(PnpmSettings.load({
|
|
114
|
+
cwd: options.cwd,
|
|
115
|
+
env: options.env,
|
|
116
|
+
platform: options.platform
|
|
117
|
+
}).pipe(Effect.provideService(FileSystem.FileSystem, fs), Effect.provideService(Path.Path, path)));
|
|
118
|
+
/** `pnpm view <spec> <field> --json` stdout, with a spawn failure typed against `pkg`. */
|
|
119
|
+
const pnpmView = (pkg, spec, field) => spawner.string(ChildProcess.make("pnpm", [
|
|
120
|
+
"view",
|
|
121
|
+
spec,
|
|
122
|
+
field,
|
|
123
|
+
"--json"
|
|
124
|
+
])).pipe(Effect.map(stripPnpmNotices), Effect.mapError((e) => new ResolveError({
|
|
125
|
+
pkg,
|
|
126
|
+
message: Fmt.errorText(e)
|
|
127
|
+
})));
|
|
128
|
+
return {
|
|
129
|
+
versions: (pkg) => pnpmView(pkg, pkg, "versions").pipe(Effect.flatMap((out) => parseVersions(pkg, out))),
|
|
130
|
+
times: (pkg) => pnpmView(pkg, pkg, "time").pipe(Effect.flatMap((out) => parseTimes(pkg, out))),
|
|
131
|
+
peerDependencies: (pkg, version) => pnpmView(pkg, `${pkg}@${version}`, "peerDependencies").pipe(Effect.flatMap((out) => parsePeerDeps(pkg, out))),
|
|
132
|
+
pnpmReleaseAge: () => pnpmSettings.pipe(Effect.map(pnpmGateOf), Effect.mapError((e) => new ResolveError({
|
|
133
|
+
pkg: "pnpm-workspace.yaml",
|
|
134
|
+
message: Fmt.errorText(e)
|
|
135
|
+
})))
|
|
136
|
+
};
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
105
139
|
|
|
106
|
-
export { RegistryResolver, RegistryResolverLive, ResolveError, parsePeerDeps, parseTimes, parseVersions, stripPnpmNotices };
|
|
140
|
+
export { RegistryResolver, RegistryResolverLive, ResolveError, parsePeerDeps, parseTimes, parseVersions, pnpmGateOf, stripPnpmNotices };
|
package/cli/ui/preview-screen.js
CHANGED
package/cli/ui/progress-view.js
CHANGED
package/cli/ui/walk-screen.js
CHANGED
|
@@ -8,6 +8,7 @@ import { useRef, useState } from "react";
|
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
// src/cli/ui/walk-screen.tsx
|
|
11
|
+
/** @jsxRuntime automatic */
|
|
11
12
|
/** The table's keys: arrows (or vim keys) to move and pick, Enter to finish. Esc and Ctrl-C are the host's. */
|
|
12
13
|
function walkKeys(dryRun) {
|
|
13
14
|
return KeyTable.make([
|
package/cli/version.js
CHANGED
package/cli/workspace-resolve.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { parseVersion } from "../semver-util.js";
|
|
2
2
|
import { ResolveError } from "./resolve.js";
|
|
3
|
-
import { Effect,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { descendSync } from "@effected/walker";
|
|
7
|
-
import { nodeWalkerSyncOps } from "@effected/walker/node-sync";
|
|
8
|
-
import { readFileSync } from "node:fs";
|
|
3
|
+
import { Effect, Result } from "effect";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { Fmt } from "@effected/cli-kit";
|
|
9
6
|
import { findWorkspaceRootSync, getWorkspacePackagesSync } from "@effected/workspaces";
|
|
10
7
|
import { nodeSyncOps } from "@effected/workspaces/node-sync";
|
|
8
|
+
import { PendingChangesets } from "@effected/changesets";
|
|
11
9
|
|
|
12
10
|
// src/cli/workspace-resolve.ts
|
|
11
|
+
/** Bump strength, weakest to strongest, for strongest-bump-per-package. */
|
|
13
12
|
const BUMP_ORDER = {
|
|
14
13
|
patch: 0,
|
|
15
14
|
minor: 1,
|
|
16
15
|
major: 2
|
|
17
16
|
};
|
|
18
|
-
/** The changeset files of `.changeset/`: top-level `.md` FILES, no dotfiles, sorted. */
|
|
19
|
-
const CHANGESET_FILES = Result.getOrThrow(GlobPattern.compileResult("*.md", GlobPatternOptions.make({ dot: false })));
|
|
20
|
-
/** Matches one changeset frontmatter line: `"@scope/name": minor` (quotes optional). */
|
|
21
|
-
const FRONTMATTER_LINE_RE = /^\s*["']?([^"':\s]+)["']?\s*:\s*(major|minor|patch)\s*$/;
|
|
22
17
|
/**
|
|
23
18
|
* Read every workspace package manifest under `rootDir` with a usable name and
|
|
24
19
|
* version, honoring the workspace's own `pnpm-workspace.yaml` `packages:`
|
|
@@ -58,43 +53,39 @@ function readManifests(rootDir) {
|
|
|
58
53
|
return out;
|
|
59
54
|
}
|
|
60
55
|
/**
|
|
61
|
-
* Read the pending changeset bumps
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
56
|
+
* Read the pending changeset bumps under `<rootDir>/.changeset/` through
|
|
57
|
+
* `@effected/changesets`' `PendingChangesets.readSettledSync` (which skips
|
|
58
|
+
* readmes, agent context files, dotfiles and non-`.md` files, and also reads
|
|
59
|
+
* the `pre/` changesets a pre-release keeps): package name → strongest bump.
|
|
60
|
+
* A `none` release is no bump. Total: an absent `.changeset/` lists nothing,
|
|
61
|
+
* an unlistable directory degrades to no bumps (current versions), and a
|
|
62
|
+
* malformed changeset drops only its own bumps and is returned in `skipped`
|
|
63
|
+
* for the caller to report, never a failure.
|
|
65
64
|
*/
|
|
66
65
|
function readPendingBumps(rootDir) {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const fences = [];
|
|
82
|
-
for (let i = 0; i < lines.length && fences.length < 2; i++) if (lines[i]?.trim() === "---") fences.push(i);
|
|
83
|
-
const [open, close] = fences;
|
|
84
|
-
if (open === void 0 || close === void 0) continue;
|
|
85
|
-
for (const line of lines.slice(open + 1, close)) {
|
|
86
|
-
const m = FRONTMATTER_LINE_RE.exec(line);
|
|
87
|
-
if (!m) continue;
|
|
88
|
-
const [, pkg, bump] = m;
|
|
89
|
-
const prev = out.get(pkg);
|
|
90
|
-
if (prev === void 0 || BUMP_ORDER[bump] > BUMP_ORDER[prev]) out.set(pkg, bump);
|
|
91
|
-
}
|
|
66
|
+
const bumps = /* @__PURE__ */ new Map();
|
|
67
|
+
const pending = PendingChangesets.readSettledSync(rootDir);
|
|
68
|
+
if (Result.isFailure(pending)) return {
|
|
69
|
+
bumps,
|
|
70
|
+
skipped: []
|
|
71
|
+
};
|
|
72
|
+
const skipped = pending.success.failures.map((f) => ({
|
|
73
|
+
file: `.changeset/${f.file}`,
|
|
74
|
+
message: Fmt.errorText(f.error)
|
|
75
|
+
}));
|
|
76
|
+
for (const changeset of pending.success.changesets) for (const [pkg, release] of changeset.releases) {
|
|
77
|
+
if (release === "none") continue;
|
|
78
|
+
const prev = bumps.get(pkg);
|
|
79
|
+
if (prev === void 0 || BUMP_ORDER[release] > BUMP_ORDER[prev]) bumps.set(pkg, release);
|
|
92
80
|
}
|
|
93
|
-
return
|
|
81
|
+
return {
|
|
82
|
+
bumps,
|
|
83
|
+
skipped
|
|
84
|
+
};
|
|
94
85
|
}
|
|
95
86
|
/** Apply the strongest pending bump for each package already present in `versions`. */
|
|
96
87
|
function applyPendingBumps(rootDir, versions) {
|
|
97
|
-
const bumps = readPendingBumps(rootDir);
|
|
88
|
+
const { bumps, skipped } = readPendingBumps(rootDir);
|
|
98
89
|
for (const [pkg, bump] of bumps) {
|
|
99
90
|
const current = versions.get(pkg);
|
|
100
91
|
if (current === void 0) continue;
|
|
@@ -102,19 +93,20 @@ function applyPendingBumps(rootDir, versions) {
|
|
|
102
93
|
if (parsed === null) continue;
|
|
103
94
|
versions.set(pkg, parsed.bump[bump]().toString());
|
|
104
95
|
}
|
|
96
|
+
return skipped;
|
|
105
97
|
}
|
|
106
98
|
/**
|
|
107
|
-
*
|
|
108
|
-
* manifest version overlaid with the bump implied by any pending changeset.
|
|
109
|
-
* Absent or unreadable `.changeset/` degrades to current versions.
|
|
99
|
+
* {@link readWorkspaceVersions}, plus the pending changesets it skipped.
|
|
110
100
|
*
|
|
111
101
|
* @internal
|
|
112
102
|
*/
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
for (const [name, manifest] of manifests)
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
function readWorkspaceState(rootDir, manifests = readManifests(rootDir)) {
|
|
104
|
+
const versions = /* @__PURE__ */ new Map();
|
|
105
|
+
for (const [name, manifest] of manifests) versions.set(name, manifest.version);
|
|
106
|
+
return {
|
|
107
|
+
versions,
|
|
108
|
+
skipped: applyPendingBumps(rootDir, versions)
|
|
109
|
+
};
|
|
118
110
|
}
|
|
119
111
|
/**
|
|
120
112
|
* The plain (layer-less) workspace resolver value, for callers that route
|
|
@@ -126,16 +118,17 @@ function readWorkspaceVersions(rootDir, manifests = readManifests(rootDir)) {
|
|
|
126
118
|
*/
|
|
127
119
|
function makeWorkspaceResolver(rootDir) {
|
|
128
120
|
let manifests;
|
|
129
|
-
let
|
|
121
|
+
let state;
|
|
130
122
|
const load = () => {
|
|
131
123
|
manifests ??= readManifests(rootDir);
|
|
132
|
-
|
|
124
|
+
state ??= readWorkspaceState(rootDir, manifests);
|
|
133
125
|
return {
|
|
134
126
|
manifests,
|
|
135
|
-
versions
|
|
127
|
+
versions: state.versions
|
|
136
128
|
};
|
|
137
129
|
};
|
|
138
130
|
return {
|
|
131
|
+
skippedChangesets: () => state?.skipped ?? [],
|
|
139
132
|
versions: (pkg) => {
|
|
140
133
|
const v = load().versions.get(pkg);
|
|
141
134
|
return v === void 0 ? Effect.fail(new ResolveError({
|
|
@@ -145,7 +138,7 @@ function makeWorkspaceResolver(rootDir) {
|
|
|
145
138
|
},
|
|
146
139
|
times: () => Effect.succeed({}),
|
|
147
140
|
peerDependencies: (pkg) => Effect.succeed(load().manifests.get(pkg)?.peerDependencies ?? {}),
|
|
148
|
-
|
|
141
|
+
pnpmReleaseAge: () => Effect.succeed(null)
|
|
149
142
|
};
|
|
150
143
|
}
|
|
151
144
|
/**
|
|
@@ -164,4 +157,4 @@ function findWorkspaceRoot(startDir) {
|
|
|
164
157
|
}) ?? resolve(startDir);
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
export { findWorkspaceRoot, makeWorkspaceResolver, readManifests,
|
|
160
|
+
export { findWorkspaceRoot, makeWorkspaceResolver, readManifests, readWorkspaceState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rolldown-pnpm-config",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A dogfooding example of our plugin",
|
|
6
6
|
"repository": {
|
|
@@ -36,22 +36,23 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@effect/platform-node": "~4.1.2",
|
|
39
|
-
"@effected/
|
|
39
|
+
"@effected/changesets": "^0.2.0",
|
|
40
|
+
"@effected/cli-kit": "^0.27.1",
|
|
40
41
|
"@effected/env": "^0.11.0",
|
|
41
|
-
"@effected/files": "^0.
|
|
42
|
-
"@effected/glob": "^0.
|
|
43
|
-
"@effected/npm": "^0.
|
|
42
|
+
"@effected/files": "^0.2.0",
|
|
43
|
+
"@effected/glob": "^0.20.0",
|
|
44
|
+
"@effected/npm": "^0.32.0",
|
|
44
45
|
"@effected/semver": "^0.22.0",
|
|
45
|
-
"@effected/walker": "^0.
|
|
46
|
-
"@effected/workspaces": "^0.
|
|
46
|
+
"@effected/walker": "^0.26.0",
|
|
47
|
+
"@effected/workspaces": "^0.44.1",
|
|
47
48
|
"@effected/yaml": "^0.29.0",
|
|
48
49
|
"effect": "~4.1.2",
|
|
49
50
|
"ink": "^8.0.0",
|
|
50
|
-
"oxc-parser": "^0.
|
|
51
|
+
"oxc-parser": "^0.158.0",
|
|
51
52
|
"react": "^19.3.1"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
|
-
"rolldown": "^1.2.
|
|
55
|
+
"rolldown": "^1.2.16"
|
|
55
56
|
},
|
|
56
57
|
"peerDependenciesMeta": {
|
|
57
58
|
"rolldown": {
|