git-json-resolver
Version:
A rules-based JSON conflict resolver that parses Git conflict markers, reconstructs ours/theirs, and merges with deterministic strategies — beyond line-based merges.
37 lines (36 loc) • 1.35 kB
TypeScript
/** Escape sequence for literal dots in field names */
export declare const ESCAPED_DOT = "\0";
/** Escape sequence for literal slashes in field names */
export declare const ESCAPED_SLASH = "\u0001";
/**
* Matcher abstraction + adapters for micromatch/picomatch (optional).
*
* Default matcher understands:
* - `*` → matches any single field segment
* - `**` → matches any number of nested field segments
* - Prefix/suffix like `prefix-*`, `*-suffix`
* - Backslash escaping (micromatch-style): `a\/b` → literal slash, `\*` → literal asterisk
*
* Micromatch/Picomatch can be loaded at runtime as optional peers.
*/
export interface Matcher {
/**
* Returns true if `str` matches at least one of the provided glob `patterns`.
*/
isMatch: (str: string, patterns: string[]) => boolean;
}
/**
* Minimal homegrown matcher (default).
* Supports:
* - `*` → matches any single field segment
* - `**` → matches any number of nested field segments
* - Literal prefix/suffix like `prefix-*`, `*-suffix`
* - Backslash escaping for `*` and `.`
*/
export declare const basicMatcher: Matcher;
/**
* Attempts to load a named matcher adapter.
* @param name `"micromatch" | "picomatch"`
* @returns A Matcher implementation.
*/
export declare const loadMatcher: (name: "micromatch" | "picomatch") => Promise<Matcher>;