@pierre/diffs
Version:
27 lines (26 loc) • 1.31 kB
TypeScript
import { FileContents, FileDiffMetadata, ParsedPatch } from "../types.js";
//#region src/utils/parsePatchFiles.d.ts
declare function processPatch(data: string, cacheKeyPrefix?: string, throwOnError?: boolean): ParsedPatch;
interface ProcessFileOptions {
cacheKey?: string;
isGitDiff?: boolean;
oldFile?: FileContents;
newFile?: FileContents;
throwOnError?: boolean;
}
declare function processFile(fileDiffString: string, options?: ProcessFileOptions): FileDiffMetadata | undefined;
/**
* Parses a patch file string into an array of parsed patches.
*
* @param data - The raw patch file content (supports multi-commit patches)
* @param cacheKeyPrefix - Optional prefix for collision-safe cache keys derived
* from the prefix, patch index, and file index. This enables caching of
* rendered diff results in the worker pool.
* @param throwOnError - When true, invalid data throws. When false, invalid data
* is reported with `console.error` and the parser attempts to recover when
* possible. Recovery is best-effort and does not guarantee valid output.
*/
declare function parsePatchFiles(data: string, cacheKeyPrefix?: string, throwOnError?: boolean): ParsedPatch[];
//#endregion
export { parsePatchFiles, processFile, processPatch };
//# sourceMappingURL=parsePatchFiles.d.ts.map