import { BaseCompiler } from '../core/base-compiler'; import { CompilerConfig } from '../core/config'; /** One `mag_assets/patterns/.yml` as authored. */ export interface PatternSource { /** Stored unanchored — this compiler is what adds `^(?:…)$`. */ pattern: string; /** i18n key shown when this rule is the only one a Field declares. */ message: string; /** A value the expression accepts. Checked here, never emitted. */ example?: string; /** Narrowed to `i`; see `sanitizeFlags`. */ flags?: string; } /** What a Field's compiled config carries once `FieldCompiler` inlines it. */ export interface CompiledPattern { name: string; expression: string; flags?: string; message: string; } /** * `g` makes a RegExp carry `lastIndex` between `.test()` calls, so one value * alternates valid and invalid on repeated keystrokes; `m` reverses what the * anchors below establish. Neither is a preference (libs/one ADR 0017). */ export declare function sanitizeFlags(flags: string | undefined): string | undefined; /** * `.test()` matches anywhere in a value, so an unanchored `[0-9]{4}` passes * `abc1234xyz`. The non-capturing group is what keeps a pattern's own * alternation inside its own bounds — without it `a|b` would anchor only `a`. * * Anchors an author wrote anyway are stripped first, so the result stays one * pair rather than nesting. A trailing `\$` is an escaped dollar and is left * alone; a trailing `\\$` is a literal backslash followed by the anchor. */ export declare function anchorExpression(source: string): string; export declare class PatternsCompiler extends BaseCompiler { private watcher; constructor(config: CompilerConfig); compile(): Promise; watch(): Promise; private processFile; private findYAMLFiles; private isYAMLFile; } //# sourceMappingURL=patterns-compiler.d.ts.map