buildrush 0.0.0-stage → 0.1.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -3
  3. package/SECURITY.md +54 -0
  4. package/bin/buildrush.js +6 -0
  5. package/dist/src/adapters.d.ts +23 -0
  6. package/dist/src/adapters.js +171 -0
  7. package/dist/src/adapters.js.map +1 -0
  8. package/dist/src/affected.d.ts +28 -0
  9. package/dist/src/affected.js +59 -0
  10. package/dist/src/affected.js.map +1 -0
  11. package/dist/src/cache.d.ts +94 -0
  12. package/dist/src/cache.js +362 -0
  13. package/dist/src/cache.js.map +1 -0
  14. package/dist/src/cli.d.ts +31 -0
  15. package/dist/src/cli.js +646 -0
  16. package/dist/src/cli.js.map +1 -0
  17. package/dist/src/config.d.ts +82 -0
  18. package/dist/src/config.js +384 -0
  19. package/dist/src/config.js.map +1 -0
  20. package/dist/src/detect.d.ts +12 -0
  21. package/dist/src/detect.js +68 -0
  22. package/dist/src/detect.js.map +1 -0
  23. package/dist/src/doctor.d.ts +6 -0
  24. package/dist/src/doctor.js +95 -0
  25. package/dist/src/doctor.js.map +1 -0
  26. package/dist/src/engine.d.ts +68 -0
  27. package/dist/src/engine.js +652 -0
  28. package/dist/src/engine.js.map +1 -0
  29. package/dist/src/fsindex.d.ts +37 -0
  30. package/dist/src/fsindex.js +128 -0
  31. package/dist/src/fsindex.js.map +1 -0
  32. package/dist/src/fswatch.d.ts +30 -0
  33. package/dist/src/fswatch.js +141 -0
  34. package/dist/src/fswatch.js.map +1 -0
  35. package/dist/src/graph.d.ts +77 -0
  36. package/dist/src/graph.js +486 -0
  37. package/dist/src/graph.js.map +1 -0
  38. package/dist/src/index.d.ts +11 -0
  39. package/dist/src/index.js +9 -0
  40. package/dist/src/index.js.map +1 -0
  41. package/dist/src/project.d.ts +28 -0
  42. package/dist/src/project.js +113 -0
  43. package/dist/src/project.js.map +1 -0
  44. package/dist/src/runner.d.ts +36 -0
  45. package/dist/src/runner.js +174 -0
  46. package/dist/src/runner.js.map +1 -0
  47. package/dist/src/scheduler.d.ts +30 -0
  48. package/dist/src/scheduler.js +143 -0
  49. package/dist/src/scheduler.js.map +1 -0
  50. package/dist/src/testcache.d.ts +60 -0
  51. package/dist/src/testcache.js +93 -0
  52. package/dist/src/testcache.js.map +1 -0
  53. package/dist/src/util/fsx.d.ts +11 -0
  54. package/dist/src/util/fsx.js +61 -0
  55. package/dist/src/util/fsx.js.map +1 -0
  56. package/dist/src/util/glob.d.ts +19 -0
  57. package/dist/src/util/glob.js +193 -0
  58. package/dist/src/util/glob.js.map +1 -0
  59. package/dist/src/util/hash.d.ts +14 -0
  60. package/dist/src/util/hash.js +57 -0
  61. package/dist/src/util/hash.js.map +1 -0
  62. package/dist/src/util/paths.d.ts +17 -0
  63. package/dist/src/util/paths.js +67 -0
  64. package/dist/src/util/paths.js.map +1 -0
  65. package/dist/src/watch.d.ts +101 -0
  66. package/dist/src/watch.js +289 -0
  67. package/dist/src/watch.js.map +1 -0
  68. package/dist/src/workspaces.d.ts +118 -0
  69. package/dist/src/workspaces.js +555 -0
  70. package/dist/src/workspaces.js.map +1 -0
  71. package/package.json +49 -6
@@ -0,0 +1,101 @@
1
+ import { FileEntry } from './fsindex.js';
2
+ import { Project } from './project.js';
3
+ import { RunOptions, RunReport, TaskReport } from './engine.js';
4
+ import { WatcherFactory, WatchMode } from './fswatch.js';
5
+ export interface WatchChanges {
6
+ added: string[];
7
+ modified: string[];
8
+ removed: string[];
9
+ }
10
+ /** Why a cycle started. `reconcile`/`error` mean the watcher did not (or could not) report it. */
11
+ export type CycleTrigger = 'initial' | 'change' | 'reconcile' | 'error';
12
+ export interface WatchCycle {
13
+ n: number;
14
+ trigger: CycleTrigger;
15
+ /** Source-file changes (task outputs excluded) found by content-digest reconciliation. */
16
+ changed: WatchChanges;
17
+ /** Null when no run happened (config reload failed, or the engine threw). */
18
+ report: RunReport | null;
19
+ /** A newer change arrived mid-run: the run was cancelled and its results were not published. */
20
+ superseded: boolean;
21
+ configReloaded: boolean;
22
+ error: string | null;
23
+ /** Time spent reconciling the file index before the run. */
24
+ scanMs: number;
25
+ /** Wall time of the whole cycle (reconcile + run). */
26
+ durationMs: number;
27
+ }
28
+ export interface WatchStats {
29
+ /** Raw watcher events that reached the session (after the watcher's own ignore filter). */
30
+ events: number;
31
+ /** Events dropped by the session's filter (ignored dirs, task outputs). */
32
+ ignoredEvents: number;
33
+ watcherErrors: number;
34
+ /** Index reconciliation scans performed (including no-op ones). */
35
+ scans: number;
36
+ /** Scans that found no source change and therefore started no cycle. */
37
+ noopScans: number;
38
+ cycles: number;
39
+ }
40
+ export interface WatchOptions {
41
+ tasks: string[];
42
+ run?: Omit<RunOptions, 'signal' | 'onTaskDone'>;
43
+ /** Quiet window for coalescing bursts; the first event after idle is never delayed. Default 50. */
44
+ debounceMs?: number;
45
+ /** Periodic full reconciliation, so dropped events cannot cause stale results. Default 30000. */
46
+ reconcileMs?: number;
47
+ /** Reconciliation period once the watcher has reported an error (degraded to polling). Default 2000. */
48
+ degradedReconcileMs?: number;
49
+ /** Graceful shutdown: aborts in-flight work, closes watchers, resolves `done`. */
50
+ signal?: AbortSignal;
51
+ watcherFactory?: WatcherFactory;
52
+ watchMode?: WatchMode;
53
+ onCycleStart?: (info: {
54
+ n: number;
55
+ trigger: CycleTrigger;
56
+ changed: WatchChanges;
57
+ }) => void;
58
+ onTaskDone?: (r: TaskReport) => void;
59
+ onCycle?: (c: WatchCycle) => void;
60
+ onNotice?: (msg: string) => void;
61
+ }
62
+ export interface WatchSession {
63
+ readonly stats: Readonly<WatchStats>;
64
+ readonly mode: WatchMode | 'custom';
65
+ readonly project: Project;
66
+ /** Resolves when the session has fully stopped. Rejects only on an unexpected internal error. */
67
+ readonly done: Promise<void>;
68
+ stop(): Promise<void>;
69
+ }
70
+ /**
71
+ * Leading + trailing debounce. When idle the first trigger fires immediately (zero added
72
+ * latency); triggers inside the quiet window coalesce into one trailing fire after the window.
73
+ */
74
+ export declare class Debouncer {
75
+ private quietMs;
76
+ private fire;
77
+ private timer;
78
+ private pending;
79
+ constructor(quietMs: number, fire: () => void);
80
+ trigger(): void;
81
+ private expire;
82
+ cancel(): void;
83
+ }
84
+ /**
85
+ * Paths whose events must never start work: ignored directories (.git, node_modules, .buildrush,
86
+ * config `ignore`) anywhere along the path, and files matching any task's declared outputs (so
87
+ * BuildRush's own writes cannot retrigger it).
88
+ */
89
+ export declare function makeEventFilter(project: Project): (rel: string) => boolean;
90
+ export declare function diffFiles(before: Map<string, FileEntry>, after: Map<string, FileEntry>): WatchChanges;
91
+ /**
92
+ * Start watching. The Project (config, file index, graph) stays in memory for the whole session;
93
+ * nothing is re-opened per change except when buildrush.json / package.json themselves change.
94
+ *
95
+ * Correctness model: watcher events are only a wake-up hint. What changed is always determined by
96
+ * reconciling the FileIndex (content digests) against the previous cycle's snapshot, so a missed,
97
+ * duplicated or spurious event can delay or waste work but never produce a stale result. A
98
+ * periodic reconciliation (and an immediate forced one after any watcher error) bounds the delay
99
+ * for dropped events.
100
+ */
101
+ export declare function startWatch(initial: Project, opts: WatchOptions): Promise<WatchSession>;
@@ -0,0 +1,289 @@
1
+ import * as path from 'node:path';
2
+ import { CONFIG_FILE } from './config.js';
3
+ import { FileIndex } from './fsindex.js';
4
+ import { Project } from './project.js';
5
+ import { runTasks } from './engine.js';
6
+ import { createFsWatcher, whenArmed } from './fswatch.js';
7
+ /**
8
+ * Leading + trailing debounce. When idle the first trigger fires immediately (zero added
9
+ * latency); triggers inside the quiet window coalesce into one trailing fire after the window.
10
+ */
11
+ export class Debouncer {
12
+ quietMs;
13
+ fire;
14
+ timer = null;
15
+ pending = false;
16
+ constructor(quietMs, fire) {
17
+ this.quietMs = quietMs;
18
+ this.fire = fire;
19
+ }
20
+ trigger() {
21
+ if (this.timer === null) {
22
+ this.fire();
23
+ this.timer = setTimeout(this.expire, this.quietMs);
24
+ }
25
+ else {
26
+ this.pending = true;
27
+ clearTimeout(this.timer);
28
+ this.timer = setTimeout(this.expire, this.quietMs);
29
+ }
30
+ }
31
+ expire = () => {
32
+ this.timer = null;
33
+ if (this.pending) {
34
+ this.pending = false;
35
+ this.fire();
36
+ this.timer = setTimeout(this.expire, this.quietMs);
37
+ }
38
+ };
39
+ cancel() {
40
+ if (this.timer)
41
+ clearTimeout(this.timer);
42
+ this.timer = null;
43
+ this.pending = false;
44
+ }
45
+ }
46
+ /**
47
+ * Paths whose events must never start work: ignored directories (.git, node_modules, .buildrush,
48
+ * config `ignore`) anywhere along the path, and files matching any task's declared outputs (so
49
+ * BuildRush's own writes cannot retrigger it).
50
+ */
51
+ export function makeEventFilter(project) {
52
+ const isOutput = project.outputMatcher();
53
+ return (rel) => {
54
+ const segs = rel.split('/').filter(Boolean);
55
+ let prefix = '';
56
+ for (const s of segs) {
57
+ prefix = prefix ? `${prefix}/${s}` : s;
58
+ if (project.index.isIgnored(prefix, true))
59
+ return true;
60
+ }
61
+ return project.index.isIgnored(rel, false) || isOutput(rel);
62
+ };
63
+ }
64
+ export function diffFiles(before, after) {
65
+ const d = { added: [], modified: [], removed: [] };
66
+ for (const [rel, e] of after) {
67
+ const o = before.get(rel);
68
+ if (!o)
69
+ d.added.push(rel);
70
+ else if (o.digest !== e.digest)
71
+ d.modified.push(rel);
72
+ }
73
+ for (const rel of before.keys())
74
+ if (!after.has(rel))
75
+ d.removed.push(rel);
76
+ d.added.sort();
77
+ d.modified.sort();
78
+ d.removed.sort();
79
+ return d;
80
+ }
81
+ const countChanges = (c) => c.added.length + c.modified.length + c.removed.length;
82
+ const withoutOutputs = (c, isOutput) => ({
83
+ added: c.added.filter((f) => !isOutput(f)),
84
+ modified: c.modified.filter((f) => !isOutput(f)),
85
+ removed: c.removed.filter((f) => !isOutput(f)),
86
+ });
87
+ /**
88
+ * Start watching. The Project (config, file index, graph) stays in memory for the whole session;
89
+ * nothing is re-opened per change except when buildrush.json / package.json themselves change.
90
+ *
91
+ * Correctness model: watcher events are only a wake-up hint. What changed is always determined by
92
+ * reconciling the FileIndex (content digests) against the previous cycle's snapshot, so a missed,
93
+ * duplicated or spurious event can delay or waste work but never produce a stale result. A
94
+ * periodic reconciliation (and an immediate forced one after any watcher error) bounds the delay
95
+ * for dropped events.
96
+ */
97
+ export async function startWatch(initial, opts) {
98
+ let project = initial;
99
+ let filter = makeEventFilter(project);
100
+ let snapshot = new Map(project.index.files);
101
+ let stopped = false;
102
+ let degraded = false;
103
+ let handle = null;
104
+ let runCtl = null;
105
+ let superseded = false;
106
+ let verifying = false;
107
+ let verifyAgain = false;
108
+ let wake = null;
109
+ let reconcileTimer = null;
110
+ const reasons = new Set();
111
+ const stats = { events: 0, ignoredEvents: 0, watcherErrors: 0, scans: 0, noopScans: 0, cycles: 0 };
112
+ const stopCtl = new AbortController();
113
+ const notice = (m) => opts.onNotice?.(m);
114
+ /**
115
+ * While a run is in flight, check (without touching the shared index the engine is using)
116
+ * whether a source file really changed; if so, cancel the now-obsolete run.
117
+ */
118
+ const verify = async () => {
119
+ if (verifying) {
120
+ verifyAgain = true;
121
+ return;
122
+ }
123
+ verifying = true;
124
+ try {
125
+ do {
126
+ verifyAgain = false;
127
+ const ctl = runCtl;
128
+ if (!ctl || ctl.signal.aborted)
129
+ break;
130
+ const probe = new FileIndex(project.root, project.config.ignore, path.join(project.stateDir, 'watch-probe-unused.json'));
131
+ probe.files = new Map(snapshot);
132
+ await probe.scan();
133
+ stats.scans++;
134
+ const isOutput = project.outputMatcher();
135
+ if (runCtl === ctl && !ctl.signal.aborted && countChanges(withoutOutputs(diffFiles(snapshot, probe.files), isOutput)) > 0) {
136
+ superseded = true;
137
+ ctl.abort();
138
+ }
139
+ } while (verifyAgain && !stopped);
140
+ }
141
+ catch {
142
+ /* the post-run reconciliation scan is authoritative */
143
+ }
144
+ finally {
145
+ verifying = false;
146
+ }
147
+ };
148
+ const request = (reason) => {
149
+ if (stopped)
150
+ return;
151
+ reasons.add(reason);
152
+ wake?.();
153
+ if (runCtl)
154
+ void verify();
155
+ };
156
+ const debouncer = new Debouncer(opts.debounceMs ?? 50, () => request('change'));
157
+ const onEvent = (rel) => {
158
+ if (stopped)
159
+ return;
160
+ if (rel !== null && filter(rel)) {
161
+ stats.ignoredEvents++;
162
+ return;
163
+ }
164
+ stats.events++;
165
+ debouncer.trigger();
166
+ };
167
+ const onError = (e) => {
168
+ if (stopped)
169
+ return;
170
+ stats.watcherErrors++;
171
+ if (!degraded)
172
+ notice(`watcher error (${e.message}); events may have been lost, falling back to periodic full reconciliation`);
173
+ degraded = true;
174
+ request('error');
175
+ };
176
+ const scheduleReconcile = () => {
177
+ if (stopped)
178
+ return;
179
+ const ms = degraded ? (opts.degradedReconcileMs ?? 2000) : (opts.reconcileMs ?? 30_000);
180
+ reconcileTimer = setTimeout(() => { request('reconcile'); scheduleReconcile(); }, ms);
181
+ };
182
+ const cycle = async (first) => {
183
+ const t0 = Date.now();
184
+ const trigger = first;
185
+ let configReloaded = false;
186
+ let error = null;
187
+ // Reconcile: content digests decide what changed; events never do. Forced rehash after errors.
188
+ await project.index.scan({ force: trigger === 'error' });
189
+ stats.scans++;
190
+ const scanMs = Date.now() - t0;
191
+ const isOutput = project.outputMatcher();
192
+ const changed = withoutOutputs(diffFiles(snapshot, project.index.files), isOutput);
193
+ snapshot = new Map(project.index.files);
194
+ if (trigger !== 'initial' && countChanges(changed) === 0) {
195
+ stats.noopScans++;
196
+ return;
197
+ }
198
+ const touched = [...changed.added, ...changed.modified, ...changed.removed];
199
+ if (touched.some((f) => f === CONFIG_FILE || f === 'package.json' || f.endsWith('/package.json'))) {
200
+ try {
201
+ project = await Project.open(project.root);
202
+ filter = makeEventFilter(project);
203
+ snapshot = new Map(project.index.files);
204
+ configReloaded = true;
205
+ }
206
+ catch (e) {
207
+ error = `configuration reload failed, waiting for the next change: ${e.message}`;
208
+ }
209
+ }
210
+ const n = ++stats.cycles;
211
+ opts.onCycleStart?.({ n, trigger, changed });
212
+ let report = null;
213
+ const ctl = new AbortController();
214
+ const onStop = () => ctl.abort();
215
+ if (stopCtl.signal.aborted)
216
+ ctl.abort();
217
+ else
218
+ stopCtl.signal.addEventListener('abort', onStop, { once: true });
219
+ superseded = false;
220
+ if (!error) {
221
+ runCtl = ctl;
222
+ try {
223
+ // The engine's graph is memoised on the Project; rebuild it from the refreshed index.
224
+ if (opts.run?.affected)
225
+ await project.graph({ fresh: true });
226
+ report = await runTasks(project, opts.tasks, { ...opts.run, signal: ctl.signal, onTaskDone: opts.onTaskDone });
227
+ }
228
+ catch (e) {
229
+ error = e.message;
230
+ }
231
+ finally {
232
+ runCtl = null;
233
+ stopCtl.signal.removeEventListener('abort', onStop);
234
+ }
235
+ }
236
+ opts.onCycle?.({ n, trigger, changed, report, superseded, configReloaded, error, scanMs, durationMs: Date.now() - t0 });
237
+ };
238
+ const rank = ['error', 'change', 'reconcile'];
239
+ const loop = async () => {
240
+ await cycle('initial');
241
+ while (!stopped) {
242
+ if (reasons.size === 0)
243
+ await new Promise((resolve) => { wake = resolve; });
244
+ wake = null;
245
+ if (stopped)
246
+ break;
247
+ const trigger = rank.find((r) => reasons.has(r)) ?? 'change';
248
+ reasons.clear();
249
+ await cycle(trigger);
250
+ }
251
+ };
252
+ const factory = opts.watcherFactory ?? createFsWatcher;
253
+ handle = await factory({ root: project.root, isIgnored: (rel) => filter(rel), onEvent, onError, mode: opts.watchMode });
254
+ await whenArmed(handle);
255
+ scheduleReconcile();
256
+ const stop = async () => {
257
+ if (!stopped) {
258
+ stopped = true;
259
+ stopCtl.abort();
260
+ if (reconcileTimer)
261
+ clearTimeout(reconcileTimer);
262
+ debouncer.cancel();
263
+ handle?.close();
264
+ wake?.();
265
+ }
266
+ await done.catch(() => undefined);
267
+ };
268
+ const done = loop().finally(() => {
269
+ stopped = true;
270
+ if (reconcileTimer)
271
+ clearTimeout(reconcileTimer);
272
+ debouncer.cancel();
273
+ handle?.close();
274
+ });
275
+ if (opts.signal) {
276
+ if (opts.signal.aborted)
277
+ void stop();
278
+ else
279
+ opts.signal.addEventListener('abort', () => void stop(), { once: true });
280
+ }
281
+ return {
282
+ stats,
283
+ mode: handle.mode,
284
+ get project() { return project; },
285
+ done,
286
+ stop,
287
+ };
288
+ }
289
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/watch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAyB,QAAQ,EAAc,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,eAAe,EAA4C,SAAS,EAAE,MAAM,cAAc,CAAC;AAqEpG;;;GAGG;AACH,MAAM,OAAO,SAAS;IAIA,OAAO;IAAkB,IAAI;IAHzC,KAAK,GAA0B,IAAI,CAAC;IACpC,OAAO,GAAG,KAAK,CAAC;IAExB,YAAoB,OAAe,EAAU,IAAgB;uBAAzC,OAAO;oBAAkB,IAAI;IAAe,CAAC;IAEjE,OAAO;QACL,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAEO,MAAM,GAAG,GAAS,EAAE;QAC1B,IAAI,CAA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AAC;QACjC,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { Config } from './config.js';
2
+ import type { DepGraph } from './graph.js';
3
+ /**
4
+ * Workspace (monorepo) support: detection of npm/yarn/bun (`package.json` "workspaces") and pnpm
5
+ * (`pnpm-workspace.yaml`) layouts, package discovery, per-package task expansion and
6
+ * package-level change impact. Everything here is dependency-free and never follows symlinks.
7
+ */
8
+ export interface WorkspacePackage {
9
+ name: string;
10
+ version: string | null;
11
+ /** Project-relative POSIX directory. */
12
+ dir: string;
13
+ /** Project-relative POSIX path of the package.json. */
14
+ manifest: string;
15
+ /** dependencies + devDependencies + optionalDependencies, name -> declared range. */
16
+ dependencies: Record<string, string>;
17
+ /** Names of OTHER workspace packages this package depends on (sorted). */
18
+ workspaceDeps: string[];
19
+ /** Entry-point fields used to map imports of this package onto its sources. */
20
+ entry: {
21
+ main: string | null;
22
+ module: string | null;
23
+ types: string | null;
24
+ source: string | null;
25
+ exports: unknown;
26
+ };
27
+ }
28
+ export type WorkspaceManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
29
+ /** Files at the workspace root whose content can change every package's build. */
30
+ export declare const ROOT_SHARED: string[];
31
+ export declare class Workspace {
32
+ readonly manager: WorkspaceManager;
33
+ /** Where the package globs came from. */
34
+ readonly source: string;
35
+ readonly patterns: string[];
36
+ readonly packages: WorkspacePackage[];
37
+ readonly warnings: string[];
38
+ private readonly byName;
39
+ constructor(manager: WorkspaceManager,
40
+ /** Where the package globs came from. */
41
+ source: string, patterns: string[], packages: WorkspacePackage[], warnings: string[]);
42
+ get(name: string): WorkspacePackage | undefined;
43
+ /** The package whose directory contains `file` (innermost wins), or null. */
44
+ packageOfFile(file: string): WorkspacePackage | null;
45
+ /** Direct dependents (packages that declare `name` as a dependency). */
46
+ dependentsOf(name: string): string[];
47
+ transitiveDeps(name: string): string[];
48
+ /** Package dependency cycle as a path (a -> b -> a), or null. */
49
+ findCycle(): string[] | null;
50
+ summary(): {
51
+ manager: WorkspaceManager;
52
+ source: string;
53
+ patterns: string[];
54
+ warnings: string[];
55
+ packages: {
56
+ name: string;
57
+ version: string | null;
58
+ dir: string;
59
+ dependsOn: string[];
60
+ dependents: string[];
61
+ }[];
62
+ };
63
+ }
64
+ /**
65
+ * Extract the `packages:` list from a pnpm-workspace.yaml. Supports block lists and single-line flow
66
+ * lists (`packages: ['a', 'b']`), quotes and comments. Anything fancier (anchors, multi-line flow
67
+ * sequences) is NOT supported; use the `workspaces` key in buildrush.json for those.
68
+ */
69
+ export declare function parsePnpmWorkspaceYaml(text: string): string[];
70
+ /**
71
+ * Detect the workspace layout at `root` and resolve its packages.
72
+ * `override`: false disables detection, an array supplies the package globs explicitly.
73
+ * Returns null when the project is not a workspace.
74
+ */
75
+ export declare function discoverWorkspaces(root: string, override?: false | string[] | null): Promise<Workspace | null>;
76
+ export declare const instanceId: (pkg: string, task: string) => string;
77
+ /**
78
+ * Replace every `scope: "packages"` task template in `config.tasks` with one instance per package
79
+ * (id `<package>:<task>`) and resolve `dependsOn`:
80
+ * "x" same package's x if x is a package task, else the root task x
81
+ * "^x" x in the package's workspace dependencies (skipping through packages that do not run x)
82
+ * A root task depending on a package task template depends on all its instances.
83
+ * Returns template name -> instance ids. Throws ConfigError on invalid combinations.
84
+ */
85
+ export declare function expandWorkspaceTasks(config: Config, ws: Workspace | null): Record<string, string[]>;
86
+ /**
87
+ * After adapters have filled in commands, inputs and outputs (relative to the package), make the
88
+ * globs project-relative and add what a package task implicitly depends on:
89
+ * - the package's own package.json and every root-shared file (lockfiles, root package.json, ...),
90
+ * - unless the task declared `inputs` itself: the sources of every transitive workspace dependency.
91
+ * An adapter that could not bound its inputs (null) keeps hashing the whole project.
92
+ */
93
+ export declare function finalizePackageTasks(config: Config): void;
94
+ /**
95
+ * Candidate files (package-relative, extensionless or not) that an import of `<pkg>/<sub>` can land
96
+ * on, per package.json "exports" / "main" / "module" / "types". Published entries usually point at
97
+ * build output (dist/index.js); each is also tried with the output directory mapped to src/.
98
+ * `declared` are entries the manifest names; `fallback` are conventional guesses.
99
+ */
100
+ export declare function entryCandidates(pkg: WorkspacePackage, sub: string): {
101
+ declared: string[];
102
+ fallback: string[];
103
+ };
104
+ export interface PackageSelection {
105
+ mode: 'affected' | 'all';
106
+ /** Why every package was selected (mode "all"). */
107
+ reason: string | null;
108
+ affected: string[];
109
+ skipped: string[];
110
+ /** affected package -> why it is affected. */
111
+ why: Record<string, string>;
112
+ }
113
+ /**
114
+ * Packages whose tasks may be affected by `changed`: packages containing changed files or modules
115
+ * reached from them through imports, plus everything that (transitively) depends on those, through
116
+ * package.json dependencies or observed cross-package imports. Unboundable changes select all.
117
+ */
118
+ export declare function selectPackages(ws: Workspace, graph: DepGraph, prev: DepGraph | null, changed: string[]): PackageSelection;