diff-native
Version:
High-performance text diffing library built with Rust and WebAssembly
105 lines (100 loc) • 6.3 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
export function diffChars(old_str: string, new_str: string, options: any): any;
export function diffCss(old_str: string, new_str: string, opts: any): any;
export function canonicalize(js_val: any): any;
export function diffJson(old_val: any, new_val: any, opts: any): any;
export function diffLines(old_str: string, new_str: string, js_opts: any): any;
export function diffTrimmedLines(old_str: string, new_str: string, callback_or_opts: any): any;
export function diffSentences(old_str: string, new_str: string, opts: any): any;
export function diffWords(old: string, new_: string, opts: any): any;
export function diffWordsWithSpace(old: string, new_: string, opts: any): any;
export function applyPatch(source: string, uni_diff: any, opts: any): any;
export function applyPatches(uni_diff: string, cb: Function): void;
export function structuredPatch(old_file_name: string, new_file_name: string, old_str: string, new_str: string, old_header: string | null | undefined, new_header: string | null | undefined, opts: any): any;
export function formatPatch(val: any): string;
export function createTwoFilesPatch(old_file: string, new_file: string, old_str: string, new_str: string, old_header: string | null | undefined, new_header: string | null | undefined, opts: any): string;
export function createPatch(file_name: string, old_str: string, new_str: string, old_header: string | null | undefined, new_header: string | null | undefined, opts: any): string;
export function isUnix(v: any): boolean;
export function isWin(v: any): boolean;
export function winToUnix(v: any): any;
export function unixToWin(v: any): any;
export function parsePatch(uni_diff: string): any;
export function reversePatch(val: any): any;
export function convertChangesToXML(changes_js: any): string;
export function set_panic_hook(): void;
export class lineDiff {
private constructor();
free(): void;
static tokenize(value: string, opts: any): any;
}
export class sentenceDiff {
private constructor();
free(): void;
static tokenize(text: string): any;
}
export class wordDiff {
private constructor();
free(): void;
static tokenize(text: string): any;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly diffChars: (a: number, b: number, c: number, d: number, e: any) => any;
readonly diffCss: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly canonicalize: (a: any) => [number, number, number];
readonly diffJson: (a: any, b: any, c: any) => [number, number, number];
readonly diffLines: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly diffTrimmedLines: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly __wbg_linediff_free: (a: number, b: number) => void;
readonly linediff_tokenize: (a: number, b: number, c: any) => [number, number, number];
readonly diffSentences: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly sentencediff_tokenize: (a: number, b: number) => [number, number, number];
readonly diffWords: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly diffWordsWithSpace: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
readonly worddiff_tokenize: (a: number, b: number) => [number, number, number];
readonly applyPatch: (a: number, b: number, c: any, d: any) => [number, number, number];
readonly applyPatches: (a: number, b: number, c: any) => void;
readonly structuredPatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: any) => [number, number, number];
readonly formatPatch: (a: any) => [number, number, number, number];
readonly createTwoFilesPatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: any) => [number, number, number, number];
readonly createPatch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: any) => [number, number, number, number];
readonly isUnix: (a: any) => [number, number, number];
readonly isWin: (a: any) => [number, number, number];
readonly winToUnix: (a: any) => [number, number, number];
readonly unixToWin: (a: any) => [number, number, number];
readonly parsePatch: (a: number, b: number) => [number, number, number];
readonly reversePatch: (a: any) => [number, number, number];
readonly convertChangesToXML: (a: any) => [number, number, number, number];
readonly set_panic_hook: () => void;
readonly __wbg_worddiff_free: (a: number, b: number) => void;
readonly __wbg_sentencediff_free: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __externref_table_alloc: () => number;
readonly __wbindgen_export_4: WebAssembly.Table;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __externref_table_dealloc: (a: number) => void;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;