/** * A line-oriented diff, used to show what a deploy would change about a * resource: the construct as Checkly currently has it against the construct * the local code would produce. * * Deliberately implemented here rather than taken from a package. The output * is read by people in a terminal, the inputs are a few dozen lines of * generated code, and a diff library would be a new dependency of a CLI that * ships to users for the sake of one screen of code. */ export interface DiffLinesOptions { /** Lines of context around each change. Defaults to 3. */ context?: number; /** Lines per side above which no diff is produced. Defaults to 1500. */ maxLines?: number; /** * Treat the texts as the source of an object literal, one property per * line or indented block: the two sides are never aligned on a line of * only brackets and commas, and within a changed run each property's old * lines are followed by its new ones (see {@link pairProperties}). Off by * default, which is right for a script or any other plain text. */ pairProperties?: boolean; } /** One line of a diff: a hunk boundary (with no text of its own), or a line of either side. */ export interface DiffLine { kind: 'context' | 'add' | 'remove' | 'hunk'; text: string; } /** * The diff of two texts as typed lines, without colour — the caller decides * how to present them. * * Hunk grouping follows `git diff` and GNU `diff -u`, which is the shape a * reader recognises. When two sides can be aligned in more than one minimal * way, which edit script you get is a matter of heuristics, and this one's is * not git's: the result is always a valid diff of the same two texts, listing * every line of either side in that side's order, but it may group its hunks * differently from the diff the same input would get from git. With * `pairProperties` it is not minimal either: the two sides are never aligned * on a line of only brackets and commas (see {@link STRUCTURAL}), and within * a changed run the lines of one property are kept together, old then new * (see {@link pairProperties}), so that several neighbouring properties * changing at once read as one `-`/`+` pair per property rather than as a * block of removals over a block of additions. * * @returns An empty array when the two sides are identical (or differ only by * a trailing newline), `undefined` when they are too large to compare (see * {@link DEFAULT_MAX_LINES} and {@link MAX_CELLS}), and otherwise one `hunk` * line per changed region followed by that region's lines. */ export declare function diffLines(before: string, after: string, options?: DiffLinesOptions): DiffLine[] | undefined;