//#region src/diffParser.d.ts interface Change { type: 'normal' | 'del' | 'add'; normal?: boolean; del?: boolean; add?: boolean; ln1?: number; ln2?: number; ln?: number; content: string; } interface ParentRange { start: number; lines: number; } interface Chunk { content: string; changes: Change[]; oldStart: number; oldLines: number; newStart: number; newLines: number; combined?: boolean; parentCount?: number; oldRanges?: ParentRange[]; } type DiffFileType = 'modified' | 'new' | 'deleted' | 'renamed' | 'binary' | 'combined'; interface DiffFileBase { type: DiffFileType; chunks: Chunk[]; deletions: number; additions: number; from: string | undefined; to: string | undefined; oldMode: string | undefined; newMode: string | undefined; index: string[] | undefined; diff: string | undefined; rawDiff: string; } interface DiffFileModified extends DiffFileBase { type: 'modified'; } interface DiffFileNew extends DiffFileBase { type: 'new'; } interface DiffFileDeleted extends DiffFileBase { type: 'deleted'; } interface DiffFileRenamed extends DiffFileBase { type: 'renamed'; similarityIndex: number | undefined; } interface DiffFileBinary extends DiffFileBase { type: 'binary'; } interface DiffFileCombined extends DiffFileBase { type: 'combined'; froms: string[] | undefined; } /** * Parsed diff file metadata and hunks. * * The `type` discriminator indicates the kind of change this diff represents. * Combined diffs (e.g. `diff --cc`) may include multiple parent paths via * `froms`. */ type DiffFile = DiffFileModified | DiffFileNew | DiffFileDeleted | DiffFileRenamed | DiffFileBinary | DiffFileCombined; /** * Parse unified diff text (git, hg, svn) into structured file hunks. * * @example * ```ts * const files = diffParser('@@ -1 +1 @@\\n-old\\n+new'); * ```; */ declare function diffParser(input: string): DiffFile[]; //#endregion export { DiffFile, diffParser };