import { DiscoveredSchema } from "./types.js"; import { CodeGenResult, CodegenMode } from "./codegen/context.js"; import { RefEntry } from "./extract/types.js"; //#region src/core/pipeline.d.ts /** Result of compiling a single discovered schema through extract → generate pipeline. */ interface CompiledSchemaInfo { exportName: string; codegenResult: CodeGenResult; refEntries: RefEntry[]; } /** Module-scope declarations produced by file-level schema and constant dedup. */ interface SharedSchemaBlock { /** Shared constants and `__zcSw_N` functions. Empty string when nothing repeats. */ code: string; /** Runtime helper names referenced by the shared block (lean mode imports). */ usedHelpers: Set; } /** Output of {@link compileSchemas}: per-schema validators plus the file's shared block. */ interface CompileSchemasResult { schemas: CompiledSchemaInfo[]; shared: SharedSchemaBlock; } interface CompileSchemasOptions { /** "inline" for CLI .compiled.ts; "lean" for unplugin (imports from virtual:zod-compiler/runtime). */ mode: CodegenMode; /** * Compact output (`output: "compact"`). Drop the compiled slow walk for * mutation-free, total-fast-path schemas and delegate their cold error path * to the retained Zod schema. Disables slow-walk sharing (delegated schemas * never emit a walk to share); delegated validators read the retained schema * through the `__zs` binding rather than through `__rf[]`. */ compact?: boolean | undefined; /** When provided, per-schema failures call this and continue. Otherwise the first error throws. */ onError?: (exportName: string, error: Error) => void; } /** * Run the extract → generate pipeline for each discovered schema. * Shared by CLI generate and unplugin transform. * * Pass 1 extracts every schema's IR and plans repeated slow walks. Pass 2 * generates each validator, calling shared `__zcSw_N` functions instead of * re-inlining them. Exact constant initializers reported during generation are * then pooled when at least two validators use them. Files with no repetition * keep their original local declarations. */ declare function compileSchemas(schemas: DiscoveredSchema[], options: CompileSchemasOptions): CompileSchemasResult; /** * Aggregate `usedHelpers` across multiple compiled schemas (typically all schemas in one file). * Used by the unplugin transform to construct a single import statement per file. */ declare function aggregateUsedHelpers(schemas: CompiledSchemaInfo[]): Set; //#endregion export { CompileSchemasOptions, CompileSchemasResult, CompiledSchemaInfo, SharedSchemaBlock, aggregateUsedHelpers, compileSchemas }; //# sourceMappingURL=pipeline.d.ts.map