/** * canonicalizeConfig — produce a deterministic, pure string representation * of a {@link CodegenConfig}. * * The output is designed to be hashed (e.g., SHA-256 by the Vite plugin) to * form `CompilationCache` keys. Two configs that are structurally equal — * regardless of key insertion order — MUST produce identical output. Two * configs that differ in any meaningful field MUST produce different output. * * Semantics: * - Object keys are sorted lexicographically at every nesting level. * - Arrays preserve their source order (arrays carry ordering semantics). * - `undefined` fields are omitted (matching `JSON.stringify`). * - `null` is preserved distinctly from `undefined`. * - Numbers, booleans, and strings are serialized via `JSON.stringify`. * - Special values that don't serialize (e.g., `$ZodType` instances on * `schemaLite`) are replaced by a stable sentinel so two references to * the same schema don't produce divergent outputs. * * This function is pure, synchronous, has no I/O, and has zero runtime * dependencies — safe to call from both Node and browser contexts. */ import type { CodegenConfig } from './config-types.js'; /** * Serialize a {@link CodegenConfig} to a canonical string suitable for * hashing into a cache key. * * @param config - The codegen configuration to serialize. * @returns A deterministic JSON string representation of the config with keys sorted lexicographically. * * @example * ```ts * const key = canonicalizeConfig({ schemaImportPath: './schema', exportName: 'UserSchema' }); * const hash = crypto.createHash('sha256').update(key).digest('hex'); * ``` * * @category Configuration */ export declare function canonicalizeConfig(config: CodegenConfig): string; //# sourceMappingURL=canonicalize-config.d.ts.map