/** * Defensive line-by-line parser for `docker buildx build --progress=rawjson` stdout. * * Line contract: the caller is responsible for buffering subprocess stdout * chunks into newline-delimited lines. This function consumes exactly one * complete line per call and never returns partial parses. * * `RawjsonEnvelope` is a TS-typed structural shape, NOT a Zod schema. * Buildx is the upstream producer and ships new fields between minor * versions; a `.strict()` schema would reject valid output the moment * a buildx upgrade lands. The external-API exemption from typescript- * standards Pitfall 3 applies. Unknown keys are preserved on the * `extra` record so downstream consumers and diagnostics can still see * what was sent. * * Returns `null` only when the line is not parseable as JSON, or is a * JSON value other than a non-array object (e.g. a top-level string, * number, or array — none of which are valid rawjson envelopes). */ export interface RawjsonVertex { readonly digest?: string; readonly name?: string; readonly started?: string; readonly completed?: string; readonly cached?: boolean; readonly error?: string; readonly inputs?: readonly string[]; } export interface RawjsonStatus { readonly id?: string; readonly vertex?: string; readonly name?: string; readonly current?: number; readonly total?: number; readonly started?: string; readonly completed?: string; } export interface RawjsonLog { readonly vertex?: string; readonly stream?: number; readonly data?: string; readonly timestamp?: string; } export interface RawjsonWarning { readonly vertex?: string; readonly level?: string; readonly short?: string; } export interface RawjsonEnvelope { readonly vertexes?: readonly RawjsonVertex[]; readonly statuses?: readonly RawjsonStatus[]; readonly logs?: readonly RawjsonLog[]; readonly warnings?: readonly RawjsonWarning[]; readonly extra: Readonly>; } export declare function parseRawjsonLine(line: string): RawjsonEnvelope | null;