//#region src/core/codegen/regex-unroll.d.ts /** * Bounded-repeat unrolling for `.test()` regexes. * * V8's irregexp compiles a counted quantifier (`[0-9a-fA-F]{12}`) into a * backtrack-capable loop carrying a counter register, but compiles the same * atom written out (`[0-9a-fA-F][0-9a-fA-F]…`) into straight-line matching * code. Rewriting one into the other is purely structural — the language the * pattern accepts is unchanged — and is worth a lot on exactly the string * formats everyday schemas lean on: * * z.uuid() 3.1x z.guid() 3.4x z.ksuid() 2.7x * z.xid() 2.2x z.ulid() 2.1x z.base64() 2.1x * z.nanoid() 1.9x z.e164() 1.5x z.iso.date() 1.3x * * Measured on V8 13.x (node 24). The win starts at `{4}` (1.28x) and grows * with the count (2.7x at `{64}`); `{2}`/`{3}` are a wash, which is what * {@link MIN_REPEAT} encodes. * * The rewrite applies only to quantifiers whose atom is a SINGLE CHARACTER * matcher — a character class, an escape, or a literal character. A group's * repeat is left alone: unrolling it would duplicate capture groups and * renumber every backreference after it. Anything the scanner cannot account * for exactly makes the whole transform bail (`null`), leaving the original * pattern in place. * * Callers must keep reporting the ORIGINAL source in issues — the rewritten * regex's `toString()` would otherwise leak into `pattern:` and diverge from * zod. See `emitRegexSourceString`. */ /** * Rewrite bounded repeats of single-character atoms into explicit repetition. * Returns `null` when nothing changed or the pattern could not be scanned * exactly (in which case the caller keeps the original source). */ declare function unrollRepeats(source: string): string | null; //#endregion export { unrollRepeats }; //# sourceMappingURL=regex-unroll.d.ts.map