import type { TextSpan } from './text'; export interface DiffHunk { aStart: number; aEnd: number; bStart: number; bEnd: number; } export interface TextEdit { offset: number; length: number; replacement: string; } /** Default table size limit of [diffTokens]: 25 million cells (100 MB), about 5000 tokens per side. */ export declare const MAX_DIFF_CELLS = 25000000; export interface DiffTokensOptions { /** Most `(a.length + 1) * (b.length + 1)` table cells to allocate before throwing a RangeError. Defaults to [MAX_DIFF_CELLS]. */ maxCells?: number; } /** * Runs of tokens that differ between two sequences; throws a RangeError when the table would pass `maxCells`. * * The table holds the longest common subsequence of each pair of suffixes, filled bottom-up and * kept flat, so the walk that follows can pick which side to advance in constant time. */ export declare function diffTokens(a: TextSpan[], b: TextSpan[], { maxCells }?: DiffTokensOptions): DiffHunk[]; /** * A word-level diff expressed as character spans over `source`, each safe to apply on its own. * * Applying every edit to `source`, right to left, reproduces `corrected`. An insertion is anchored * on a neighbouring word so no edit is ever zero-length, and a deletion swallows the space before * it so applying one does not leave a double space behind. */ export declare function diffWords(source: string, corrected: string): TextEdit[]; /** Runs of lines that differ, as index ranges over each side's [tokenizeLines] spans (hunks, unlike `diffWords`' ready-to-apply edits, because a line diff is read against both sides, not applied). */ export declare function diffLines(before: string, after: string, options?: DiffTokensOptions): DiffHunk[]; //# sourceMappingURL=diff.d.ts.map