/** * Diagnostics: how the compiler reports everything it found wrong. * * A diagnostic always carries a JSON path into the author-facing spec, and a * node ID when the failure belongs to a node that already has one. Callers * branch on `code`; `message` is for humans and may be reworded between * releases. */ import type { RenderErrorCode } from './errors.js'; export type DiagnosticSeverity = 'error' | 'warning'; export interface Diagnostic { code: RenderErrorCode; severity: DiagnosticSeverity; message: string; /** JSON path in the author-facing spec, e.g. `blocks[2].items[0].url`. */ path: string; /** Normalized node ID, when the diagnostic belongs to a node. */ nodeId?: string; details?: Record; } export interface DiagnosticInput { code: RenderErrorCode; message: string; path: string; severity?: DiagnosticSeverity; nodeId?: string; details?: Record; } /** Ordered, de-duplicating collector for diagnostics. */ export declare class DiagnosticBag { private readonly items; private readonly seen; add(input: DiagnosticInput): void; get size(): number; get errorCount(): number; get hasErrors(): boolean; list(): Diagnostic[]; errors(): Diagnostic[]; warnings(): Diagnostic[]; } /** Append an index or key to a JSON path. */ export declare function pathKey(base: string, key: string): string; /** Append an array index to a JSON path. */ export declare function pathIndex(base: string, index: number): string; //# sourceMappingURL=diagnostics.d.ts.map