UNPKG

@builder.io/dev-tools

Version:

Builder.io Visual CMS Devtools

31 lines (30 loc) 1.55 kB
import * as ts from "typescript"; /** * Performs an incremental type-check (no emit) for the given project directory. * It reads tsconfig.json (just like the tsc CLI does) and enforces the `noEmit` flag. * * @param projectDir - The path to the project (where tsconfig.json is located). * @param oldProgram - Optionally, the previous builder program for incremental builds. * @returns An object containing the new builder program and collected diagnostics. */ export interface CheckpointData { program: ts.EmitAndSemanticDiagnosticsBuilderProgram; diagnostics: ts.Diagnostic[]; } export type Checkpoint = CheckpointData | null; export declare function runCheckpoint(projectDir: string, oldProgram?: ts.EmitAndSemanticDiagnosticsBuilderProgram): Checkpoint; export declare function filterDiagnostic(c: ts.Diagnostic): boolean; /** * Given a new list of diagnostics and a baseline list, filter out diagnostics * that were already present in the baseline. */ export declare function filterBaselineDiagnostics(baselineFingerprints: Set<string>, checkpoint: Checkpoint): ts.Diagnostic[]; export declare function createFingerprintSet(checkpoint: Checkpoint): Set<string>; /** * Pretty prints diagnostics as a plain text string. * * @param diagnostics - An array of ts.Diagnostic objects. * @returns A formatted string that describes the diagnostics. */ export declare function prettyPrintDiagnostics(diagnostics: ts.Diagnostic[]): string; export declare function prettyPrintDiagnosticsWithContext(diagnostics: ts.Diagnostic[]): string;