export type Hunk = { /** Context + removed lines: what the file must contain for the hunk to apply. */ before: string[]; /** Context + added lines: what replaces it. */ after: string[]; /** 1-based line the hunk was generated at, used as the first place to look. */ oldStart: number; }; export type FilePatch = { /** Path relative to the package root. */ path: string; hunks: Hunk[]; }; /** * Parses the subset of unified diff that `git diff --no-index` emits for text * files: file headers, hunk headers, and ` `/`-`/`+` body lines. Anything else * (rename, mode, binary) is unsupported on purpose — patches here are expected * to be small edits to shipped JavaScript. */ export declare function parseUnifiedDiff(patch: string): FilePatch[]; /** * Applies every hunk, or returns `null`. A patch is never partially applied. */ export declare function applyHunks(source: string, hunks: Hunk[]): string | null; export declare function reverse(hunks: Hunk[]): Hunk[];