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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/catalogs.js +32 -15
  3. package/cli/commands/export.js +8 -3
  4. package/cli/commands/preview.js +10 -7
  5. package/cli/commands/sync.js +140 -70
  6. package/cli/commands/upgrade.js +333 -135
  7. package/cli/discover.js +134 -28
  8. package/cli/drift.js +1 -1
  9. package/cli/edits.js +8 -17
  10. package/cli/effective.js +119 -4
  11. package/cli/interop.js +7 -15
  12. package/cli/local-merge.js +4 -1
  13. package/cli/plan.js +8 -3
  14. package/cli/preview-views.js +3 -1
  15. package/cli/release-age.js +2 -1
  16. package/cli/respell.js +86 -0
  17. package/cli/select-file.js +5 -2
  18. package/cli/summary.js +42 -6
  19. package/cli/sync/commit-message.js +4 -3
  20. package/cli/sync/config.js +60 -24
  21. package/cli/sync/local-gate.js +19 -9
  22. package/cli/sync/membership.js +93 -31
  23. package/cli/sync/ripples.js +4 -4
  24. package/cli/sync/running-list.js +9 -5
  25. package/cli/ui/walk-screen.js +66 -20
  26. package/cli/validate.js +1 -1
  27. package/cli/version.js +1 -1
  28. package/cli/walk-plan.js +17 -10
  29. package/cli/walk-reducer.js +99 -19
  30. package/index.d.ts +176 -127
  31. package/package.json +6 -6
  32. package/plugin/allowed-versions.js +3 -3
  33. package/plugin/families.js +185 -0
  34. package/plugin/freeze.js +122 -32
  35. package/plugin/second-forms.js +155 -0
  36. package/plugin/synced-catalogs.js +32 -0
  37. package/registry.js +13 -1
  38. package/skills/rolldown-pnpm-config/SKILL.md +13 -3
  39. package/skills/rolldown-pnpm-config/references/catalogs.md +109 -12
  40. package/skills/rolldown-pnpm-config/references/options.md +126 -47
  41. package/skills/rolldown-pnpm-config/references/sync.md +32 -21
  42. package/skills/rolldown-pnpm-config/references/wiring.md +10 -8
  43. package/plugin/overrides-from-catalogs.js +0 -151
package/cli/walk-plan.js CHANGED
@@ -8,8 +8,9 @@ import { versionKeyOf } from "./version-key.js";
8
8
  /**
9
9
  * Build the interactive walk items: for each entry, its candidate list (from
10
10
  * planEntry against the resolved versions), an up-to-date flag (only the keep
11
- * candidate remains), any peer drift resync target, any peer to materialize,
12
- * and any strategy/prerelease incompatibility warning.
11
+ * candidate remains), any peer drift resync target, and any strategy/prerelease incompatibility warning.
12
+ * A workspace entry is a read-only row: `sync` moves it, so it gets only its
13
+ * keep candidate and no peer resync, whatever its versions say.
13
14
  *
14
15
  * @internal
15
16
  */
@@ -17,23 +18,29 @@ function buildWalkItems(entries, versionsByPkg) {
17
18
  return Effect.gen(function* () {
18
19
  const items = [];
19
20
  for (const entry of entries) {
21
+ if (entry.source === "workspace") {
22
+ const [keep] = yield* planEntry(entry, []);
23
+ items.push({
24
+ entry,
25
+ candidates: [keep],
26
+ upToDate: true,
27
+ driftPeer: null,
28
+ peerWarning: null,
29
+ readOnly: true
30
+ });
31
+ continue;
32
+ }
20
33
  const versions = versionsByPkg.get(versionKeyOf(entry)) ?? [];
21
34
  const candidates = yield* planEntry(entry, [...versions]);
22
35
  const driftPeer = yield* detectPeerDrift(entry);
23
36
  let peerWarning = null;
24
- let materializePeer = null;
25
- if (entry.strategy && entry.strategy !== "interop") {
26
- const derived = yield* derivePeerRange(entry.currentRange, entry.strategy);
27
- peerWarning = derived.warning;
28
- if (!entry.peer) materializePeer = derived.range;
29
- }
30
- const upToDate = candidates.length === 1 && driftPeer === null && materializePeer === null;
37
+ if (entry.strategy && entry.strategy !== "interop") peerWarning = (yield* derivePeerRange(entry.currentRange, entry.strategy)).warning;
38
+ const upToDate = candidates.length === 1 && driftPeer === null;
31
39
  items.push({
32
40
  entry,
33
41
  candidates,
34
42
  upToDate,
35
43
  driftPeer,
36
- materializePeer,
37
44
  peerWarning
38
45
  });
39
46
  }
@@ -1,6 +1,17 @@
1
1
  import { Fmt } from "@effected/cli-kit";
2
2
 
3
3
  // src/cli/walk-reducer.ts
4
+ /** The note on a workspace row, which `upgrade` shows as context and `sync` moves. @internal */
5
+ const WORKSPACE_ROW_NOTE = "(workspace; sync moves it)";
6
+ /**
7
+ * The detail of a locked family's row: how many members it holds and how many
8
+ * have a newer version on offer. The dialog and `--preview --full` both print it.
9
+ *
10
+ * @internal
11
+ */
12
+ function familyDetail(memberCount, newer) {
13
+ return `${Fmt.plural(memberCount, "member")}, locked${newer > 0 ? `, ${newer} newer` : ""}`;
14
+ }
4
15
  const ORDER = {
5
16
  keep: 0,
6
17
  "in-range": 1,
@@ -48,27 +59,82 @@ function displayCandidates(item) {
48
59
  return [...item.candidates].sort((a, b) => ORDER[a.kind] - ORDER[b.kind]);
49
60
  }
50
61
  /**
62
+ * The table's rows in display order. Items keep their order, except that a
63
+ * family's members gather under one group header placed where its first
64
+ * member was; the members are listed only while the group is open.
65
+ *
66
+ * @internal
67
+ */
68
+ function tableRows(items, open) {
69
+ const rows = [];
70
+ const grouped = /* @__PURE__ */ new Set();
71
+ items.forEach((item, index) => {
72
+ const family = item.entry.family;
73
+ if (family === void 0) {
74
+ rows.push({
75
+ kind: "item",
76
+ index
77
+ });
78
+ return;
79
+ }
80
+ if (grouped.has(family)) return;
81
+ grouped.add(family);
82
+ const members = items.flatMap((it, i) => it.entry.family === family ? [i] : []);
83
+ rows.push({
84
+ kind: "group",
85
+ family,
86
+ catalog: item.entry.catalog,
87
+ members
88
+ });
89
+ if (open.includes(family)) for (const i of members) rows.push({
90
+ kind: "item",
91
+ index: i
92
+ });
93
+ });
94
+ return rows;
95
+ }
96
+ /** Whether the cursor may rest on a row: a group header, or any item but a read-only one. */
97
+ function navigable(row, items) {
98
+ return row.kind === "group" || items[row.index]?.readOnly !== true;
99
+ }
100
+ /** Whether a row has something to apply: an item not up to date, or a group with such a member. */
101
+ function actionable(row, items) {
102
+ return (row.kind === "group" ? row.members : [row.index]).some((i) => items[i] !== void 0 && !items[i].upToDate && items[i].readOnly !== true);
103
+ }
104
+ /**
51
105
  * Initialize the table: keep selected on every row (so the default state applies
52
106
  * nothing), and the cursor on the first actionable row. Since every discovered
53
107
  * row is shown — up-to-date rows included, as context — the cursor skips past any
54
108
  * leading inert keep-only rows to land where the user can act; it falls back to
55
- * row 0 when nothing is actionable.
109
+ * the first row it may rest on (never a read-only one), then to row 0.
110
+ * `open` names the family groups to show opened (`upgrade --family`).
56
111
  *
57
112
  * @internal
58
113
  */
59
- function initTable(items) {
60
- const first = items.findIndex((i) => !i.upToDate);
114
+ function initTable(items, open = []) {
115
+ const rows = tableRows(items, open);
116
+ const first = rows.findIndex((r) => actionable(r, items));
117
+ const resting = rows.findIndex((r) => navigable(r, items));
61
118
  return {
62
- cursor: first === -1 ? 0 : first,
119
+ cursor: first !== -1 ? first : resting !== -1 ? resting : 0,
63
120
  picks: items.map(() => 0),
121
+ open: [...open],
64
122
  done: false
65
123
  };
66
124
  }
67
125
  const clamp = (n, max) => n < 0 ? 0 : Math.min(n, max);
126
+ /** The next row from `from` in direction `step` the cursor may rest on, or `from` when there is none. */
127
+ function moveCursor(rows, items, from, step) {
128
+ for (let i = from + step; i >= 0 && i < rows.length; i += step) if (navigable(rows[i], items)) return i;
129
+ return from;
130
+ }
68
131
  /**
69
- * Advance the table by a key. up/down move between rows; left/right move the
70
- * radio selection within the row under the cursor; submit applies. Both axes
71
- * clamp at their ends rather than wrapping.
132
+ * Advance the table by a key. up/down move between the rows the cursor may
133
+ * rest on, skipping read-only ones; left/right move the radio selection
134
+ * within the item under the cursor, and on a group header close and open
135
+ * it, as `toggle` does. Closing a group resets its members to keep, so a
136
+ * hidden row never applies a change. Both axes clamp at their ends rather
137
+ * than wrapping.
72
138
  *
73
139
  * @internal
74
140
  */
@@ -79,18 +145,33 @@ function tableStep(state, items, key) {
79
145
  done: true
80
146
  };
81
147
  if (items.length === 0) return state;
82
- if (key === "up") return {
83
- ...state,
84
- cursor: clamp(state.cursor - 1, items.length - 1)
85
- };
86
- if (key === "down") return {
148
+ const rows = tableRows(items, state.open);
149
+ if (key === "up" || key === "down") return {
87
150
  ...state,
88
- cursor: clamp(state.cursor + 1, items.length - 1)
151
+ cursor: moveCursor(rows, items, state.cursor, key === "down" ? 1 : -1)
89
152
  };
90
- const count = displayCandidates(items[state.cursor]).length;
153
+ const row = rows[state.cursor];
154
+ if (row === void 0) return state;
155
+ if (row.kind === "group") {
156
+ const isOpen = state.open.includes(row.family);
157
+ const wantOpen = key === "toggle" ? !isOpen : key === "right";
158
+ if (wantOpen === isOpen) return state;
159
+ if (wantOpen) return {
160
+ ...state,
161
+ open: [...state.open, row.family]
162
+ };
163
+ const picks = state.picks.map((p, i) => row.members.includes(i) ? 0 : p);
164
+ return {
165
+ ...state,
166
+ open: state.open.filter((f) => f !== row.family),
167
+ picks
168
+ };
169
+ }
170
+ if (key === "toggle" || items[row.index]?.readOnly === true) return state;
171
+ const count = displayCandidates(items[row.index]).length;
91
172
  const delta = key === "right" ? 1 : -1;
92
173
  const picks = [...state.picks];
93
- picks[state.cursor] = clamp(picks[state.cursor] + delta, count - 1);
174
+ picks[row.index] = clamp(picks[row.index] + delta, count - 1);
94
175
  return {
95
176
  ...state,
96
177
  picks
@@ -110,8 +191,8 @@ function tableDecisions(state, items) {
110
191
  /**
111
192
  * The peer range that would be written for a row's currently chosen candidate.
112
193
  * Non-keep candidates carry their own recomputed `peerRange`; keep reuses
113
- * whichever peer source the item already resolved (a drift resync, a
114
- * materialize target, or the entry's existing literal), falling back to an
194
+ * whichever peer source the item already resolved (a drift resync or the
195
+ * entry's existing literal), falling back to an
115
196
  * em dash placeholder when none applies.
116
197
  *
117
198
  * @internal
@@ -119,7 +200,6 @@ function tableDecisions(state, items) {
119
200
  function peerFor(item, chosen) {
120
201
  if (chosen.kind !== "keep") return chosen.peerRange ?? "—";
121
202
  if (item.driftPeer) return item.driftPeer;
122
- if (item.materializePeer) return item.materializePeer;
123
203
  return item.entry.peer?.value ?? "—";
124
204
  }
125
205
  /**
@@ -138,4 +218,4 @@ function cellTone(candidate, selected) {
138
218
  return candidate.isMajor ? "changed" : "added";
139
219
  }
140
220
 
141
- export { MAJOR_SUFFIX, cellTone, displayCandidates, initTable, peerFor, tableDecisions, tableLayout, tableStep };
221
+ export { MAJOR_SUFFIX, WORKSPACE_ROW_NOTE, cellTone, displayCandidates, familyDetail, initTable, peerFor, tableDecisions, tableLayout, tableRows, tableStep };
package/index.d.ts CHANGED
@@ -1,44 +1,61 @@
1
1
  import { PnpmSettingType } from "@effected/pnpm/settings";
2
2
  import "effect";
3
3
  import { Plugin } from "rolldown";
4
+ import "@effected/pnpm";
4
5
  /**
5
- * How the `upgrade` CLI recomputes a materialized peer range when the package
6
- * range is bumped. CLI-only metadata; the runtime ignores it.
6
+ * How the `upgrade` CLI recomputes a derived peer from an entry's
7
+ * `dependency` when the dependency moves. CLI-only metadata; the runtime
8
+ * ignores it.
7
9
  *
8
10
  * @public
9
11
  */
10
12
  type PeerStrategy = "lock" | "lock-minor" | "interop";
11
13
  /**
12
- * Where a catalog entry's `range` is resolved from by the `upgrade` CLI.
13
- * `"registry"` (the default when omitted) queries published versions;
14
- * `"workspace"` reads the local workspace's NEXT release versions (current
15
- * manifest versions overlaid with pending changeset bumps). Orthogonal to
16
- * `strategy`, which governs how `peer` is derived from `range` — collapsing
17
- * the two would drop peer materialization entirely. CLI-only metadata; the
18
- * runtime ignores it.
14
+ * Where a catalog entry's next `dependency` comes from. `"npm"` (the default
15
+ * when omitted) queries the registry's published versions; `"workspace"`
16
+ * reads the local workspace's next release versions (current manifest
17
+ * versions overlaid with pending changeset bumps), for a package that lives
18
+ * in this monorepo. It sits on the entry, not on `dependency` or `peer`,
19
+ * because both name the same package. CLI-only metadata; the runtime ignores
20
+ * it.
19
21
  *
20
22
  * @public
21
23
  */
22
- type VersionSource = "registry" | "workspace";
24
+ type VersionSource = "workspace" | "npm";
23
25
  /**
24
- * A package's version: a bare range, or an object carrying a materialized peer
25
- * range (`peer`), optional CLI recompute `strategy`, optional CLI version
26
- * `source`, and an optional `exact` escape for a catalog that opts into the
27
- * exact variant.
26
+ * A catalog entry, named by what it writes. A bare string is the entry's
27
+ * `dependency`, sourced from npm, with no peer.
28
+ *
29
+ * @remarks
30
+ * The object form names its two outputs: `dependency`, served under
31
+ * `catalog:<name>`, and `peer`, served under `catalog:<name>:peers`. The keys
32
+ * an earlier release read (`range`, a top-level `strategy`, and
33
+ * `source: "registry"`) fail the build with the key to write instead: a key
34
+ * the build ignored would ship an entry the author did not write.
28
35
  *
29
36
  * @public
30
37
  */
31
38
  type CatalogPackageSpec = string | {
32
- readonly range: string;
33
- readonly peer?: string;
34
- readonly strategy?: PeerStrategy;
39
+ /** Any specifier pnpm accepts as a catalog value: an exact version, a `^` or `~` range, or a wider range. */
40
+ readonly dependency: string;
41
+ /**
42
+ * The entry's value in `<name>:peers`, absent to leave the entry out of
43
+ * that catalog. A bare string is a hand-set value nothing derives;
44
+ * `{ value, strategy }` is a value `upgrade` derives from `dependency` by
45
+ * `strategy` on every move.
46
+ */
47
+ readonly peer?: string | {
48
+ readonly value: string;
49
+ readonly strategy?: PeerStrategy;
50
+ };
51
+ /** Where `upgrade` and `sync` read the next `dependency` from; defaults to `"npm"`. */
35
52
  readonly source?: VersionSource;
36
53
  /**
37
- * The entry's value in the `<name>:exact` catalog, for a range that names
38
- * no single version (`">=1.2.0 <2.0.0"`), or `false` to leave the entry
39
- * out of that catalog. Only valid when the declaration sets
40
- * `exact: true`, and a plain version is rejected on a range the exact
41
- * value already derives from, since `upgrade` rewrites `range` and
54
+ * The entry's value in the `<name>:exact` catalog, for a dependency that
55
+ * names no single version (`">=1.2.0 <2.0.0"`), or `false` to leave the
56
+ * entry out of that catalog. Only valid when the declaration sets
57
+ * `exact: true`, and a plain version is rejected on a dependency the exact
58
+ * value already derives from, since `upgrade` rewrites `dependency` and
42
59
  * would leave a hand-written value stale.
43
60
  */
44
61
  readonly exact?: string | false;
@@ -49,18 +66,56 @@ type CatalogPackageSpec = string | {
49
66
  * @public
50
67
  */
51
68
  interface CatalogDeclaration {
52
- /** Map of package name to version spec or range object. */
69
+ /** Map of package name to a dependency string or an entry object. */
53
70
  readonly packages: Record<string, CatalogPackageSpec>;
54
71
  /**
55
- * Also emit `<name>:exact`, holding each entry's range with its operator
56
- * stripped (`^0.34.0` becomes `0.34.0`), so a dependent writing
72
+ * Also emit `<name>:exact`, holding each entry's dependency with its
73
+ * operator stripped (`^0.34.0` becomes `0.34.0`), so a dependent writing
57
74
  * `catalog:<name>:exact` publishes an exact version that still follows the
58
75
  * catalog. Only a single comparator (`^`, `~`, `>=`, `=` or none) on one
59
- * version derives; any other range fails the build unless its entry sets
60
- * `exact` (a value only where `upgrade` never rewrites the range). Where `overridesFromCatalogs` pins a member, the exact catalog
61
- * names the pinned version.
76
+ * version derives; any other dependency fails the build unless its entry
77
+ * sets `exact` (a value only where `upgrade` never rewrites the
78
+ * dependency).
62
79
  */
63
80
  readonly exact?: boolean;
81
+ /**
82
+ * Locked release families over this catalog's entries. A member must be an
83
+ * exact version, `upgrade` moves it only when asked, and each owner glob
84
+ * pins the member on its regular dependency edges through `overrides`.
85
+ */
86
+ readonly families?: readonly CatalogFamily[];
87
+ }
88
+ /**
89
+ * A locked release family: catalog entries that move together, only when
90
+ * asked, each pinned to its exact version on the dependency edges of the
91
+ * family's owners.
92
+ *
93
+ * @remarks
94
+ * `members` and `exclude` take exact names or globs over the same catalog's
95
+ * entries, and `exclude` wins. An exact name that is no entry, or a glob that
96
+ * matches none, fails the build, so a typo cannot silently shrink the family.
97
+ * After expansion a package belongs to at most one family in a config. Every
98
+ * member's `dependency` must be one exact version and its `source` must not
99
+ * be `"workspace"`: a locked entry is one `sync` never moves.
100
+ *
101
+ * Each owner glob emits one `overrides` entry per member,
102
+ * `"<owner>><member>": "<version>"`. pnpm applies such an override to a
103
+ * regular dependency edge only; it never changes what a peer edge resolves,
104
+ * so a member an owner reaches through a peer is fixed by the consumer's own
105
+ * `catalog:` dependency, which the exact rule already pins. No override ever
106
+ * pins a member graph-wide.
107
+ *
108
+ * @public
109
+ */
110
+ interface CatalogFamily {
111
+ /** The family's name, unique across every catalog in the config; `upgrade --family` selects by it. */
112
+ readonly name: string;
113
+ /** Exact entry names or globs over this catalog's entries (`effect`, `@effect/*`). */
114
+ readonly members: readonly string[];
115
+ /** Exact entry names or globs removed from `members`; wins over `members`. */
116
+ readonly exclude?: readonly string[];
117
+ /** Package-name globs (`@effected/*`) whose regular dependency edges into the members are pinned. */
118
+ readonly owners?: readonly string[];
64
119
  }
65
120
  /**
66
121
  * A directive that derives `peerDependencyRules.allowedVersions` rules from a
@@ -87,66 +142,6 @@ interface AllowedVersionsFromCatalogs {
87
142
  */
88
143
  readonly prefix?: string | null;
89
144
  }
90
- /**
91
- * A directive that derives pnpm `overrides` from a catalog, so every member of
92
- * a release family resolves to the catalog's exact version everywhere in a
93
- * consumer's graph: direct requests, transitive requests from other packages,
94
- * and peer edges alike. A catalog range alone cannot do that, since a caret
95
- * admits a newer member and a catalog never reaches a dependency's own
96
- * dependencies. For each member whose range is a simple operator on a plain
97
- * `X.Y.Z` version, an entry `"<name>@<selector>": "<X.Y.Z>"` is emitted.
98
- *
99
- * @remarks
100
- * Under the default `scope: "line"` the selector is the member's release line,
101
- * `^X.0.0` (`^0.Y.0` on a 0.x line, `~0.0.0` on 0.0.x), so a request for a *different* major
102
- * (or a prerelease, which no caret line admits) is left alone. Prerelease and
103
- * compound-range members are skipped rather than widened. An override entry
104
- * authored by hand wins over a derived one on the same selector, and the
105
- * consumer's own `overrides` still win over the plugin's at install time.
106
- *
107
- * Every pinned member's catalog value is frozen to the version its override
108
- * names, so the catalog and the override always agree. pnpm never matches an
109
- * override against a `catalog:` specifier, so a catalog left at `~X.Y.Z`
110
- * would let a dependent writing `catalog:` resolve a newer patch than the
111
- * override pins everywhere else, and the graph would carry two copies. Only
112
- * the frozen output changes (the pnpmfile's `base`, `export`, `preview`): the
113
- * authored range stays what `upgrade` reads and rewrites, the `:peers`
114
- * catalog keeps its peer range, and an opted-in `:exact` catalog names the
115
- * pinned version. When a hand-authored override wins on the
116
- * selector, the catalog takes its value if that is an exact version and keeps
117
- * the authored range otherwise.
118
- *
119
- * `include` and `exclude` select which members are pinned, so one catalog can
120
- * hold both a release family that is pinned graph-wide and packages that are
121
- * not. Each entry is an exact package name or a glob pattern (`@effect/*`),
122
- * matched with `effect/Glob` against the whole name; `*` stays within the
123
- * scope or the bare name. A member matched by both lists is excluded. Every
124
- * entry must match at least one member, and an empty `include` is rejected,
125
- * so a typo throws instead of silently widening or narrowing the pin set.
126
- *
127
- * @public
128
- */
129
- interface OverridesFromCatalogs {
130
- /** The catalog whose members are pinned. */
131
- readonly catalog: string;
132
- /**
133
- * Members to pin, as exact names or glob patterns (`effect`, `@effect/*`);
134
- * the rest are skipped. Omitted, every member is a candidate.
135
- */
136
- readonly include?: readonly string[];
137
- /**
138
- * Members left out, as exact names or glob patterns, e.g. a tool that rides
139
- * the catalog but is not part of the release family. Wins over `include`.
140
- */
141
- readonly exclude?: readonly string[];
142
- /**
143
- * How each selector is scoped. `"line"` (the default) qualifies the package
144
- * name with its caret line, so only requests on that line are pinned;
145
- * `"any"` emits the bare package name, which pins every request regardless
146
- * of the line it asked for.
147
- */
148
- readonly scope?: "line" | "any";
149
- }
150
145
  /**
151
146
  * How a field's divergences are enforced: silent, console warning, or a thrown
152
147
  * error that fails the install. Part of the public authoring API via
@@ -181,40 +176,54 @@ interface LocalDirective<T> {
181
176
  readonly strategy?: "union" | "difference" | "merge" | "rewrite";
182
177
  }
183
178
  /**
184
- * The `sync` block: how `rolldown-pnpm-config sync` keeps one of the plugin's
185
- * own catalogs in step with the workspace packages it ships beside (the
186
- * members), moving each member's catalog entry to the version that member's
187
- * next release will publish. Read statically by the CLI; the build and the
188
- * shipped pnpmfile ignore it.
179
+ * Which workspace packages one sync pair owns.
189
180
  *
190
181
  * @public
191
182
  */
192
- interface SyncConfig {
193
- /** The catalog that names the members; sync moves its entries to the members' next release versions. */
183
+ interface SyncMembers {
184
+ /**
185
+ * Glob over package names selecting the members, e.g. `"@effected/*"`.
186
+ * Must be non-empty and match at least one workspace package, or the
187
+ * membership check fails rather than passing on an empty set.
188
+ */
189
+ readonly scope: string;
190
+ /**
191
+ * Globs over workspace-relative package paths (e.g. `"packages/*"`), not
192
+ * package names, narrowing which workspace packages are discovered. Omitted,
193
+ * every workspace package in the scope is considered.
194
+ */
195
+ readonly packages?: readonly string[];
196
+ /** Package names or globs over package names left out of the scope. */
197
+ readonly exclude?: readonly string[];
198
+ }
199
+ /**
200
+ * One sync pair: a catalog and the workspace packages whose entries in it
201
+ * `sync` moves to their next release versions.
202
+ *
203
+ * @public
204
+ */
205
+ interface SyncPairConfig {
206
+ /** The catalog that names the members; `"default"` names the default catalog. */
194
207
  readonly catalog: string;
195
- /** Which workspace packages are synced. */
196
- readonly members: {
197
- /**
198
- * Glob over package names selecting the members, e.g. `"@effected/*"`.
199
- * Must be non-empty and match at least one workspace package, or the
200
- * membership check fails rather than passing on an empty set.
201
- */
202
- readonly scope: string;
203
- /**
204
- * Globs over workspace-relative package paths (e.g. `"packages/*"`), not
205
- * package names, narrowing which workspace packages are discovered. Omitted,
206
- * every workspace package in the scope is considered.
207
- */
208
- readonly packages?: readonly string[];
209
- /** Package names or globs over package names left out of the scope. */
210
- readonly exclude?: readonly string[];
211
- };
208
+ /** Which workspace packages are synced into `catalog`. */
209
+ readonly members: SyncMembers;
210
+ }
211
+ /**
212
+ * The settings every sync pair shares: one running list, one commit message,
213
+ * one floors switch and one `--local` check.
214
+ *
215
+ * @public
216
+ */
217
+ interface SyncShared {
212
218
  /** The running-list changeset (default `.changeset/catalog-sync.md`, bump `patch`). */
213
219
  readonly changeset?: {
214
220
  readonly path?: string;
215
221
  readonly bump?: "patch" | "minor";
216
222
  };
217
- /** The commit message (scope defaults to the catalog name; file `.changeset/catalog-sync.commit.txt`). */
223
+ /**
224
+ * The commit message (file `.changeset/catalog-sync.commit.txt`). The scope
225
+ * defaults to the catalog name with one pair, and is required with more.
226
+ */
218
227
  readonly commit?: {
219
228
  readonly scope?: string;
220
229
  readonly messagePath?: string;
@@ -229,13 +238,40 @@ interface SyncConfig {
229
238
  /**
230
239
  * The `--local` check: the built pnpmfile (default `dist/prod/npm/pkg/pnpmfile.mjs`)
231
240
  * and the catalogs to compare with `pnpm-workspace.yaml` (default: every
232
- * served catalog except the sync catalog and its `:peers` twin).
241
+ * served catalog except each synced catalog and its `:peers` and `:exact`
242
+ * twins).
233
243
  */
234
244
  readonly local?: {
235
245
  readonly pnpmfile?: string;
236
246
  readonly catalogs?: readonly string[];
237
247
  };
238
248
  }
249
+ /**
250
+ * The `sync` block: how `rolldown-pnpm-config sync` keeps the plugin's own
251
+ * catalogs in step with the workspace packages it ships beside (the members),
252
+ * moving each member's `source: "workspace"` entry to the version that
253
+ * member's next release will publish. Read statically by the CLI, and by the
254
+ * build only to refuse a workspace entry no pair owns; never shipped.
255
+ *
256
+ * @remarks
257
+ * `catalogs` lists the pairs. `catalog` with `members` is shorthand for a
258
+ * one-pair list, and setting both forms fails. A package matching two pairs'
259
+ * scopes fails the membership check.
260
+ *
261
+ * @public
262
+ */
263
+ type SyncConfig = SyncShared & ({
264
+ /** The sync pairs, one per catalog. */
265
+ readonly catalogs: readonly [SyncPairConfig, ...SyncPairConfig[]];
266
+ readonly catalog?: never;
267
+ readonly members?: never;
268
+ } | {
269
+ /** Shorthand for a one-pair `catalogs`: the catalog that names the members. */
270
+ readonly catalog: string;
271
+ /** Shorthand for a one-pair `catalogs`: which workspace packages are synced. */
272
+ readonly members: SyncMembers;
273
+ readonly catalogs?: never;
274
+ });
239
275
  /**
240
276
  * The declarative plugin configuration.
241
277
  *
@@ -250,7 +286,11 @@ interface PluginConfig {
250
286
  * @public
251
287
  */
252
288
  readonly name: string;
253
- /** The catalogs to inject into pnpm config, keyed by catalog name. */
289
+ /**
290
+ * The catalogs to inject into pnpm config, keyed by catalog name. Each entry
291
+ * is a dependency string or `{ dependency, peer, source, exact }`; `range`,
292
+ * an entry-level `strategy` and `source: "registry"` fail the build.
293
+ */
254
294
  readonly catalogs: Record<string, CatalogDeclaration>;
255
295
  /**
256
296
  * Configuration for `rolldown-pnpm-config sync`. Read statically by the CLI;
@@ -272,7 +312,7 @@ interface PluginConfig {
272
312
  * folder detection is independent and unaffected.
273
313
  */
274
314
  readonly localPatchesDir?: string;
275
- } & { readonly [K in Exclude<keyof PluginConfig, "name" | "local" | "overridesFromCatalogs" | "sync">]?: PluginConfig[K] | LocalDirective<PluginConfig[K]>; };
315
+ } & { readonly [K in Exclude<keyof PluginConfig, "name" | "local" | "sync">]?: PluginConfig[K] | LocalDirective<PluginConfig[K]>; };
276
316
  /** Per-package manifest overrides merged into the dependency graph. */
277
317
  readonly packageExtensions?: FieldInput<PnpmSettingType<"packageExtensions">>;
278
318
  /** Deprecated versions explicitly allowed, keyed by package. */
@@ -311,16 +351,15 @@ interface PluginConfig {
311
351
  * are the consumer's when set.
312
352
  */
313
353
  readonly audit?: FieldInput<PnpmSettingType<"audit">>;
314
- /** Security version overrides, keyed by package selector. */
315
- readonly overrides?: FieldInput<Record<string, string>>;
316
354
  /**
317
- * Derive `overrides` from a catalog (or several), pinning every member of a
318
- * release family to its exact catalog version across the whole consumer
319
- * graph. Resolved and merged under `overrides` at build time, so the
320
- * pnpmfile, `export` and `preview` all carry the result; an authored
321
- * `overrides` entry wins on a selector clash. Not a pnpm field itself.
355
+ * Security version overrides, keyed by package selector. Also accepts pnpm
356
+ * 12's nested form, `{ rules, unused? }`: `rules` ships as `overrides` and
357
+ * `unused` as `warnUnusedOverrides`. A catalog family's owner-scoped pins
358
+ * merge in beneath these, and an authored selector wins on a clash.
322
359
  */
323
- readonly overridesFromCatalogs?: OverridesFromCatalogs | readonly OverridesFromCatalogs[];
360
+ readonly overrides?: FieldInput<PnpmSettingType<"overrides">>;
361
+ /** Whether pnpm warns about overrides no dependency matches; also written as `overrides.unused`. */
362
+ readonly warnUnusedOverrides?: FieldInput<PnpmSettingType<"warnUnusedOverrides">>;
324
363
  /** Peer dependency rules: allowed versions plus ignore/allow-any lists. */
325
364
  readonly peerDependencyRules?: FieldInput<{
326
365
  readonly allowedVersions?: Record<string, string>;
@@ -352,8 +391,14 @@ interface PluginConfig {
352
391
  * the managed one; the other keys are the consumer's when set.
353
392
  */
354
393
  readonly update?: FieldInput<PnpmSettingType<"update">>;
355
- /** Default version catalog entries merged as a single `default` catalog. */
356
- readonly catalog?: FieldInput<PnpmSettingType<"catalog">>;
394
+ /**
395
+ * The default version catalog. Ships as `catalogs.default`, checked for
396
+ * divergence and discovered by `upgrade`: pnpm 12's nested form with
397
+ * `entries`, `mode`, `defaultSaveTarget` and `unused` keys is also
398
+ * accepted. It takes no `{ value, enforcement }` wrapper, and `:exact`,
399
+ * `:peers` and `families` need `catalogs.default`.
400
+ */
401
+ readonly catalog?: PnpmSettingType<"catalog">;
357
402
  /** Whether any resolution fails when a package violates minimum-release-age. */
358
403
  readonly minimumReleaseAgeStrict?: FieldInput<PnpmSettingType<"minimumReleaseAgeStrict">>;
359
404
  /** Whether to skip the release-age check when publish-time metadata is absent. */
@@ -477,6 +522,10 @@ interface PluginConfig {
477
522
  readonly nodeDownloadMirrors?: FieldInput<PnpmSettingType<"nodeDownloadMirrors">>;
478
523
  /** Controls how dependencies are resolved against entries defined in the catalogs field. */
479
524
  readonly catalogMode?: FieldInput<PnpmSettingType<"catalogMode">>;
525
+ /** Whether pnpm prunes catalog entries no project uses; also written as `catalog.unused`. */
526
+ readonly catalogPrune?: FieldInput<PnpmSettingType<"catalogPrune">>;
527
+ /** The catalog a newly saved dependency goes into; also written as `catalog.defaultSaveTarget`. */
528
+ readonly saveCatalogName?: FieldInput<PnpmSettingType<"saveCatalogName">>;
480
529
  /** Whether pnpm removes catalog entries that are not used by any project in the workspace. */
481
530
  readonly cleanupUnusedCatalogs?: FieldInput<PnpmSettingType<"cleanupUnusedCatalogs">>;
482
531
  /** Whether workspace packages are linked from the workspace, not downloaded from the registry. */
@@ -553,5 +602,5 @@ interface PluginConfig {
553
602
  * @public
554
603
  */
555
604
  export declare function PnpmConfigPlugin(config: PluginConfig): Plugin;
556
- export type { AllowedVersionsFromCatalogs, CatalogDeclaration, CatalogPackageSpec, Enforcement, FieldInput, LocalDirective, OverridesFromCatalogs, PeerStrategy, PluginConfig, SyncConfig, VersionSource };
605
+ export type { AllowedVersionsFromCatalogs, CatalogDeclaration, CatalogFamily, CatalogPackageSpec, Enforcement, FieldInput, LocalDirective, PeerStrategy, PluginConfig, SyncConfig, SyncMembers, SyncPairConfig, SyncShared, VersionSource };
557
606
  //# sourceMappingURL=index.d.ts.map