import { type AttributedDiff } from "./attribution.js"; import type { BuildRunResult } from "./build-run.js"; import { diffSnapshotFiles, type HeapDiff } from "./heap-diff.js"; import { extractModuleRegistry } from "./module-registry.js"; export type BuildAttribution = { diff: HeapDiff; attributed: AttributedDiff; /** Modules the registry resolved. Zero means every finding stays unattributed. */ registrySize: number; /** Share of the worker's observed growth the snapshot pair spans, 0 to 1. */ bracketed: number; baselineRssBytes: number; afterRssBytes: number; /** Where the pair was stored, so the finding can be checked by hand. */ baselineFile: string; afterFile: string; }; export type BuildAttributionDeps = { diff: typeof diffSnapshotFiles; registry: typeof extractModuleRegistry; }; /** * Names what a build's worker retained, from the pair the run captured. * * Returns null rather than throwing on every failure path. A build measurement * stands on its curve and its verdict; this is an addition to the report, and * an addition that can fail must not be able to take the report with it. * * The registry is read from `.next/server` *after* the build, never during it: * a half-written chunk can resolve a module id to the wrong source, and naming * the wrong owner confidently is worse than naming none. */ export declare function attributeBuildCapture(result: BuildRunResult, appDir: string, onProgress?: (message: string) => void, deps?: BuildAttributionDeps): Promise;