import { SchemaIR } from "../types.js"; import { CodeGenContext } from "./context.js"; //#region src/core/codegen/build-path.d.ts /** Does `ir`, taken as a whole schema, produce a value that is not its input? */ declare function rebuildsOutput(ir: SchemaIR): boolean; /** * Does a PASSING fast check prove that the parse returns its own input? * * This is the contract behind every by-reference shortcut: `safeParse`'s * `if(fc(input)) return {success:true,data:input}` and, through `fc` in * `__zcMkv`, `parse()` / `parseAsync()` / `~standard.validate()`. It is strictly * stronger than "the fast check is sound", and two things break it: * * 1. The schema REBUILDS its output. A stripping object is the common case, and * it is why `z.object({ a: z.number().catch(0) })` — a strip object the * build pass declines because of the `.catch()` — used to answer * `parse({a: 1, b: 2})` with the UNSTRIPPED input while its own `safeParse` * correctly returned `{a: 1}`. * * 2. A plain `z.union()` with a MUTATING option. The fast form is an `||` chain, * which reports that SOME option accepts the input; zod returns the value * produced by the FIRST option that succeeds. Those differ as soon as an * earlier option would have claimed the input and rewritten it — * `z.union([z.string().catch("c"), z.number()])` answers `"c"` for every * input, catch being infallible, while the chain matches `1` against the * number arm and hands back `1`. A DISCRIMINATED union is exempt: its * dispatch selects exactly one option, so which arm zod runs is never in * doubt (and a rewriting object option is caught by (1) anyway). * * Withheld here rather than in `fastUnion` on purpose: the `||` chain is still a * correct VERDICT, which is all a nested conjunct or a `.is()` guard needs, so * declining to emit it would cost every union-of-objects its fast path (and the * size-gated `__fo_` split) to fix a shortcut that only the root takes. */ declare function fastResultIsInput(ir: SchemaIR): boolean; /** * Does anything STRICTLY BELOW `ir` hand back a container needing a `__proto__` * scrub? * * The root's by-reference shortcut can filter the value it returns * (`data: __zcPs(input)`), but that only reaches the OUTER container — a nested * one is never touched, because the shortcut does not walk. So a schema with a * scrub-needing descendant keeps the eager slow walk, which scrubs at every * level. Only the root's own scrub is shortcut-compatible. */ declare function nestedNeedsProtoScrub(ir: SchemaIR): boolean; /** * Host the whole schema as `function NAME(input){…}` returning the built value * or the FAIL sentinel. Returns the function name, or null when the schema is * not expressible as a single build pass. */ declare function generateBuild(ir: SchemaIR, ctx: CodeGenContext): string | null; //#endregion export { fastResultIsInput, generateBuild, nestedNeedsProtoScrub, rebuildsOutput }; //# sourceMappingURL=build-path.d.ts.map