dry-ts
Version:
Find candidate duplicate TypeScript code by comparing normalized AST structure.
20 lines (19 loc) • 758 B
TypeScript
export type RegionSource = "hunk" | "untracked" | "listed";
export interface ChangedRange {
readonly start: number;
readonly end: number;
readonly source: RegionSource;
}
export declare class ChangedRegions {
private readonly rangesByFile;
addRange(file: string, start: number, end: number, source: RegionSource): void;
addWholeFile(file: string, source: RegionSource): void;
intersectsLocation(file: string, startLine: number, endLine: number): boolean;
entries(): Array<{
file: string;
ranges: readonly ChangedRange[];
}>;
describe(): string;
}
export declare function canonicalPath(root: string, filePath: string): string;
export declare function parseUnifiedDiff(diffText: string): ChangedRegions;