zod-compiler 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +381 -28
- package/dist/cli/commands/check.d.ts +9 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +150 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +33 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +142 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +33 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +166 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/emitter.d.ts +21 -0
- package/dist/cli/emitter.d.ts.map +1 -0
- package/dist/cli/emitter.js +64 -0
- package/dist/cli/emitter.js.map +1 -0
- package/dist/cli/errors.d.ts +2 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +4 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +181 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/logger.d.ts +18 -0
- package/dist/cli/logger.d.ts.map +1 -0
- package/dist/cli/logger.js +46 -0
- package/dist/cli/logger.js.map +1 -0
- package/dist/core/codegen/context.d.ts +138 -0
- package/dist/core/codegen/context.d.ts.map +1 -0
- package/dist/core/codegen/context.js +213 -0
- package/dist/core/codegen/context.js.map +1 -0
- package/dist/core/codegen/emit-issue.d.ts +74 -0
- package/dist/core/codegen/emit-issue.d.ts.map +1 -0
- package/dist/core/codegen/emit-issue.js +116 -0
- package/dist/core/codegen/emit-issue.js.map +1 -0
- package/dist/core/codegen/emit.d.ts +8 -0
- package/dist/core/codegen/emit.d.ts.map +1 -0
- package/dist/core/codegen/emit.js +16 -0
- package/dist/core/codegen/emit.js.map +1 -0
- package/dist/core/codegen/fast-path.d.ts +17 -0
- package/dist/core/codegen/fast-path.d.ts.map +1 -0
- package/dist/core/codegen/fast-path.js +114 -0
- package/dist/core/codegen/fast-path.js.map +1 -0
- package/dist/core/codegen/index.d.ts +19 -0
- package/dist/core/codegen/index.d.ts.map +1 -0
- package/dist/core/codegen/index.js +54 -0
- package/dist/core/codegen/index.js.map +1 -0
- package/dist/core/codegen/issue-decls.d.ts +37 -0
- package/dist/core/codegen/issue-decls.d.ts.map +1 -0
- package/dist/core/codegen/issue-decls.js +47 -0
- package/dist/core/codegen/issue-decls.js.map +1 -0
- package/dist/core/codegen/schemas/any.d.ts +5 -0
- package/dist/core/codegen/schemas/any.d.ts.map +1 -0
- package/dist/core/codegen/schemas/any.js +7 -0
- package/dist/core/codegen/schemas/any.js.map +1 -0
- package/dist/core/codegen/schemas/array.d.ts +7 -0
- package/dist/core/codegen/schemas/array.d.ts.map +1 -0
- package/dist/core/codegen/schemas/array.js +86 -0
- package/dist/core/codegen/schemas/array.js.map +1 -0
- package/dist/core/codegen/schemas/bigint.d.ts +5 -0
- package/dist/core/codegen/schemas/bigint.d.ts.map +1 -0
- package/dist/core/codegen/schemas/bigint.js +80 -0
- package/dist/core/codegen/schemas/bigint.js.map +1 -0
- package/dist/core/codegen/schemas/boolean.d.ts +5 -0
- package/dist/core/codegen/schemas/boolean.d.ts.map +1 -0
- package/dist/core/codegen/schemas/boolean.js +20 -0
- package/dist/core/codegen/schemas/boolean.js.map +1 -0
- package/dist/core/codegen/schemas/catch.d.ts +7 -0
- package/dist/core/codegen/schemas/catch.d.ts.map +1 -0
- package/dist/core/codegen/schemas/catch.js +26 -0
- package/dist/core/codegen/schemas/catch.js.map +1 -0
- package/dist/core/codegen/schemas/date.d.ts +5 -0
- package/dist/core/codegen/schemas/date.d.ts.map +1 -0
- package/dist/core/codegen/schemas/date.js +79 -0
- package/dist/core/codegen/schemas/date.js.map +1 -0
- package/dist/core/codegen/schemas/default.d.ts +5 -0
- package/dist/core/codegen/schemas/default.d.ts.map +1 -0
- package/dist/core/codegen/schemas/default.js +17 -0
- package/dist/core/codegen/schemas/default.js.map +1 -0
- package/dist/core/codegen/schemas/discriminated-union.d.ts +7 -0
- package/dist/core/codegen/schemas/discriminated-union.d.ts.map +1 -0
- package/dist/core/codegen/schemas/discriminated-union.js +45 -0
- package/dist/core/codegen/schemas/discriminated-union.js.map +1 -0
- package/dist/core/codegen/schemas/effect.d.ts +17 -0
- package/dist/core/codegen/schemas/effect.d.ts.map +1 -0
- package/dist/core/codegen/schemas/effect.js +35 -0
- package/dist/core/codegen/schemas/effect.js.map +1 -0
- package/dist/core/codegen/schemas/enum.d.ts +5 -0
- package/dist/core/codegen/schemas/enum.d.ts.map +1 -0
- package/dist/core/codegen/schemas/enum.js +33 -0
- package/dist/core/codegen/schemas/enum.js.map +1 -0
- package/dist/core/codegen/schemas/fallback.d.ts +4 -0
- package/dist/core/codegen/schemas/fallback.d.ts.map +1 -0
- package/dist/core/codegen/schemas/fallback.js +23 -0
- package/dist/core/codegen/schemas/fallback.js.map +1 -0
- package/dist/core/codegen/schemas/file.d.ts +5 -0
- package/dist/core/codegen/schemas/file.d.ts.map +1 -0
- package/dist/core/codegen/schemas/file.js +78 -0
- package/dist/core/codegen/schemas/file.js.map +1 -0
- package/dist/core/codegen/schemas/intersection.d.ts +7 -0
- package/dist/core/codegen/schemas/intersection.d.ts.map +1 -0
- package/dist/core/codegen/schemas/intersection.js +13 -0
- package/dist/core/codegen/schemas/intersection.js.map +1 -0
- package/dist/core/codegen/schemas/literal.d.ts +5 -0
- package/dist/core/codegen/schemas/literal.d.ts.map +1 -0
- package/dist/core/codegen/schemas/literal.js +31 -0
- package/dist/core/codegen/schemas/literal.js.map +1 -0
- package/dist/core/codegen/schemas/map.d.ts +7 -0
- package/dist/core/codegen/schemas/map.d.ts.map +1 -0
- package/dist/core/codegen/schemas/map.js +46 -0
- package/dist/core/codegen/schemas/map.js.map +1 -0
- package/dist/core/codegen/schemas/nan.d.ts +5 -0
- package/dist/core/codegen/schemas/nan.d.ts.map +1 -0
- package/dist/core/codegen/schemas/nan.js +13 -0
- package/dist/core/codegen/schemas/nan.js.map +1 -0
- package/dist/core/codegen/schemas/never.d.ts +5 -0
- package/dist/core/codegen/schemas/never.d.ts.map +1 -0
- package/dist/core/codegen/schemas/never.js +11 -0
- package/dist/core/codegen/schemas/never.js.map +1 -0
- package/dist/core/codegen/schemas/null.d.ts +5 -0
- package/dist/core/codegen/schemas/null.d.ts.map +1 -0
- package/dist/core/codegen/schemas/null.js +13 -0
- package/dist/core/codegen/schemas/null.js.map +1 -0
- package/dist/core/codegen/schemas/nullable.d.ts +7 -0
- package/dist/core/codegen/schemas/nullable.d.ts.map +1 -0
- package/dist/core/codegen/schemas/nullable.js +15 -0
- package/dist/core/codegen/schemas/nullable.js.map +1 -0
- package/dist/core/codegen/schemas/number.d.ts +5 -0
- package/dist/core/codegen/schemas/number.d.ts.map +1 -0
- package/dist/core/codegen/schemas/number.js +186 -0
- package/dist/core/codegen/schemas/number.js.map +1 -0
- package/dist/core/codegen/schemas/object.d.ts +7 -0
- package/dist/core/codegen/schemas/object.d.ts.map +1 -0
- package/dist/core/codegen/schemas/object.js +65 -0
- package/dist/core/codegen/schemas/object.js.map +1 -0
- package/dist/core/codegen/schemas/optional.d.ts +7 -0
- package/dist/core/codegen/schemas/optional.d.ts.map +1 -0
- package/dist/core/codegen/schemas/optional.js +15 -0
- package/dist/core/codegen/schemas/optional.js.map +1 -0
- package/dist/core/codegen/schemas/pipe.d.ts +7 -0
- package/dist/core/codegen/schemas/pipe.d.ts.map +1 -0
- package/dist/core/codegen/schemas/pipe.js +18 -0
- package/dist/core/codegen/schemas/pipe.js.map +1 -0
- package/dist/core/codegen/schemas/readonly.d.ts +7 -0
- package/dist/core/codegen/schemas/readonly.d.ts.map +1 -0
- package/dist/core/codegen/schemas/readonly.js +7 -0
- package/dist/core/codegen/schemas/readonly.js.map +1 -0
- package/dist/core/codegen/schemas/record.d.ts +7 -0
- package/dist/core/codegen/schemas/record.d.ts.map +1 -0
- package/dist/core/codegen/schemas/record.js +53 -0
- package/dist/core/codegen/schemas/record.js.map +1 -0
- package/dist/core/codegen/schemas/recursive-ref.d.ts +5 -0
- package/dist/core/codegen/schemas/recursive-ref.d.ts.map +1 -0
- package/dist/core/codegen/schemas/recursive-ref.js +24 -0
- package/dist/core/codegen/schemas/recursive-ref.js.map +1 -0
- package/dist/core/codegen/schemas/set.d.ts +7 -0
- package/dist/core/codegen/schemas/set.d.ts.map +1 -0
- package/dist/core/codegen/schemas/set.js +88 -0
- package/dist/core/codegen/schemas/set.js.map +1 -0
- package/dist/core/codegen/schemas/string-bool.d.ts +4 -0
- package/dist/core/codegen/schemas/string-bool.d.ts.map +1 -0
- package/dist/core/codegen/schemas/string-bool.js +39 -0
- package/dist/core/codegen/schemas/string-bool.js.map +1 -0
- package/dist/core/codegen/schemas/string.d.ts +5 -0
- package/dist/core/codegen/schemas/string.d.ts.map +1 -0
- package/dist/core/codegen/schemas/string.js +226 -0
- package/dist/core/codegen/schemas/string.js.map +1 -0
- package/dist/core/codegen/schemas/symbol.d.ts +5 -0
- package/dist/core/codegen/schemas/symbol.d.ts.map +1 -0
- package/dist/core/codegen/schemas/symbol.js +13 -0
- package/dist/core/codegen/schemas/symbol.js.map +1 -0
- package/dist/core/codegen/schemas/template-literal.d.ts +5 -0
- package/dist/core/codegen/schemas/template-literal.d.ts.map +1 -0
- package/dist/core/codegen/schemas/template-literal.js +16 -0
- package/dist/core/codegen/schemas/template-literal.js.map +1 -0
- package/dist/core/codegen/schemas/tuple.d.ts +15 -0
- package/dist/core/codegen/schemas/tuple.d.ts.map +1 -0
- package/dist/core/codegen/schemas/tuple.js +111 -0
- package/dist/core/codegen/schemas/tuple.js.map +1 -0
- package/dist/core/codegen/schemas/undefined.d.ts +5 -0
- package/dist/core/codegen/schemas/undefined.d.ts.map +1 -0
- package/dist/core/codegen/schemas/undefined.js +13 -0
- package/dist/core/codegen/schemas/undefined.js.map +1 -0
- package/dist/core/codegen/schemas/union.d.ts +7 -0
- package/dist/core/codegen/schemas/union.d.ts.map +1 -0
- package/dist/core/codegen/schemas/union.js +95 -0
- package/dist/core/codegen/schemas/union.js.map +1 -0
- package/dist/core/codegen/schemas/unknown.d.ts +5 -0
- package/dist/core/codegen/schemas/unknown.d.ts.map +1 -0
- package/dist/core/codegen/schemas/unknown.js +7 -0
- package/dist/core/codegen/schemas/unknown.js.map +1 -0
- package/dist/core/codegen/schemas/void.d.ts +5 -0
- package/dist/core/codegen/schemas/void.d.ts.map +1 -0
- package/dist/core/codegen/schemas/void.js +13 -0
- package/dist/core/codegen/schemas/void.js.map +1 -0
- package/dist/core/codegen/slow-path.d.ts +5 -0
- package/dist/core/codegen/slow-path.d.ts.map +1 -0
- package/dist/core/codegen/slow-path.js +113 -0
- package/dist/core/codegen/slow-path.js.map +1 -0
- package/dist/core/codegen/well-known-regex.d.ts +27 -0
- package/dist/core/codegen/well-known-regex.d.ts.map +1 -0
- package/dist/core/codegen/well-known-regex.js +51 -0
- package/dist/core/codegen/well-known-regex.js.map +1 -0
- package/dist/core/compile.d.ts +19 -0
- package/dist/core/compile.d.ts.map +1 -0
- package/dist/core/compile.js +37 -0
- package/dist/core/compile.js.map +1 -0
- package/dist/core/diagnostic.d.ts +46 -0
- package/dist/core/diagnostic.d.ts.map +1 -0
- package/dist/core/diagnostic.js +174 -0
- package/dist/core/diagnostic.js.map +1 -0
- package/dist/core/extract/checks.d.ts +35 -0
- package/dist/core/extract/checks.d.ts.map +1 -0
- package/dist/core/extract/checks.js +249 -0
- package/dist/core/extract/checks.js.map +1 -0
- package/dist/core/extract/effects.d.ts +12 -0
- package/dist/core/extract/effects.d.ts.map +1 -0
- package/dist/core/extract/effects.js +204 -0
- package/dist/core/extract/effects.js.map +1 -0
- package/dist/core/extract/extractors/any.d.ts +3 -0
- package/dist/core/extract/extractors/any.d.ts.map +1 -0
- package/dist/core/extract/extractors/any.js +2 -0
- package/dist/core/extract/extractors/any.js.map +1 -0
- package/dist/core/extract/extractors/array.d.ts +4 -0
- package/dist/core/extract/extractors/array.d.ts.map +1 -0
- package/dist/core/extract/extractors/array.js +19 -0
- package/dist/core/extract/extractors/array.js.map +1 -0
- package/dist/core/extract/extractors/bigint.d.ts +4 -0
- package/dist/core/extract/extractors/bigint.d.ts.map +1 -0
- package/dist/core/extract/extractors/bigint.js +70 -0
- package/dist/core/extract/extractors/bigint.js.map +1 -0
- package/dist/core/extract/extractors/boolean.d.ts +3 -0
- package/dist/core/extract/extractors/boolean.d.ts.map +1 -0
- package/dist/core/extract/extractors/boolean.js +5 -0
- package/dist/core/extract/extractors/boolean.js.map +1 -0
- package/dist/core/extract/extractors/catch.d.ts +11 -0
- package/dist/core/extract/extractors/catch.d.ts.map +1 -0
- package/dist/core/extract/extractors/catch.js +20 -0
- package/dist/core/extract/extractors/catch.js.map +1 -0
- package/dist/core/extract/extractors/date.d.ts +4 -0
- package/dist/core/extract/extractors/date.d.ts.map +1 -0
- package/dist/core/extract/extractors/date.js +49 -0
- package/dist/core/extract/extractors/date.js.map +1 -0
- package/dist/core/extract/extractors/default.d.ts +4 -0
- package/dist/core/extract/extractors/default.d.ts.map +1 -0
- package/dist/core/extract/extractors/default.js +11 -0
- package/dist/core/extract/extractors/default.js.map +1 -0
- package/dist/core/extract/extractors/enum.d.ts +3 -0
- package/dist/core/extract/extractors/enum.d.ts.map +1 -0
- package/dist/core/extract/extractors/enum.js +15 -0
- package/dist/core/extract/extractors/enum.js.map +1 -0
- package/dist/core/extract/extractors/file.d.ts +4 -0
- package/dist/core/extract/extractors/file.d.ts.map +1 -0
- package/dist/core/extract/extractors/file.js +24 -0
- package/dist/core/extract/extractors/file.js.map +1 -0
- package/dist/core/extract/extractors/index.d.ts +32 -0
- package/dist/core/extract/extractors/index.d.ts.map +1 -0
- package/dist/core/extract/extractors/index.js +32 -0
- package/dist/core/extract/extractors/index.js.map +1 -0
- package/dist/core/extract/extractors/intersection.d.ts +3 -0
- package/dist/core/extract/extractors/intersection.d.ts.map +1 -0
- package/dist/core/extract/extractors/intersection.js +14 -0
- package/dist/core/extract/extractors/intersection.js.map +1 -0
- package/dist/core/extract/extractors/lazy.d.ts +4 -0
- package/dist/core/extract/extractors/lazy.d.ts.map +1 -0
- package/dist/core/extract/extractors/lazy.js +23 -0
- package/dist/core/extract/extractors/lazy.js.map +1 -0
- package/dist/core/extract/extractors/literal.d.ts +3 -0
- package/dist/core/extract/extractors/literal.d.ts.map +1 -0
- package/dist/core/extract/extractors/literal.js +2 -0
- package/dist/core/extract/extractors/literal.js.map +1 -0
- package/dist/core/extract/extractors/map.d.ts +4 -0
- package/dist/core/extract/extractors/map.d.ts.map +1 -0
- package/dist/core/extract/extractors/map.js +6 -0
- package/dist/core/extract/extractors/map.js.map +1 -0
- package/dist/core/extract/extractors/nan.d.ts +3 -0
- package/dist/core/extract/extractors/nan.d.ts.map +1 -0
- package/dist/core/extract/extractors/nan.js +2 -0
- package/dist/core/extract/extractors/nan.js.map +1 -0
- package/dist/core/extract/extractors/never.d.ts +3 -0
- package/dist/core/extract/extractors/never.d.ts.map +1 -0
- package/dist/core/extract/extractors/never.js +2 -0
- package/dist/core/extract/extractors/never.js.map +1 -0
- package/dist/core/extract/extractors/null.d.ts +3 -0
- package/dist/core/extract/extractors/null.d.ts.map +1 -0
- package/dist/core/extract/extractors/null.js +2 -0
- package/dist/core/extract/extractors/null.js.map +1 -0
- package/dist/core/extract/extractors/nullable.d.ts +3 -0
- package/dist/core/extract/extractors/nullable.d.ts.map +1 -0
- package/dist/core/extract/extractors/nullable.js +5 -0
- package/dist/core/extract/extractors/nullable.js.map +1 -0
- package/dist/core/extract/extractors/number.d.ts +4 -0
- package/dist/core/extract/extractors/number.d.ts.map +1 -0
- package/dist/core/extract/extractors/number.js +38 -0
- package/dist/core/extract/extractors/number.js.map +1 -0
- package/dist/core/extract/extractors/object.d.ts +4 -0
- package/dist/core/extract/extractors/object.d.ts.map +1 -0
- package/dist/core/extract/extractors/object.js +43 -0
- package/dist/core/extract/extractors/object.js.map +1 -0
- package/dist/core/extract/extractors/optional.d.ts +3 -0
- package/dist/core/extract/extractors/optional.d.ts.map +1 -0
- package/dist/core/extract/extractors/optional.js +14 -0
- package/dist/core/extract/extractors/optional.js.map +1 -0
- package/dist/core/extract/extractors/pipe.d.ts +4 -0
- package/dist/core/extract/extractors/pipe.d.ts.map +1 -0
- package/dist/core/extract/extractors/pipe.js +31 -0
- package/dist/core/extract/extractors/pipe.js.map +1 -0
- package/dist/core/extract/extractors/readonly.d.ts +9 -0
- package/dist/core/extract/extractors/readonly.d.ts.map +1 -0
- package/dist/core/extract/extractors/readonly.js +8 -0
- package/dist/core/extract/extractors/readonly.js.map +1 -0
- package/dist/core/extract/extractors/record.d.ts +4 -0
- package/dist/core/extract/extractors/record.d.ts.map +1 -0
- package/dist/core/extract/extractors/record.js +39 -0
- package/dist/core/extract/extractors/record.js.map +1 -0
- package/dist/core/extract/extractors/set.d.ts +4 -0
- package/dist/core/extract/extractors/set.d.ts.map +1 -0
- package/dist/core/extract/extractors/set.js +33 -0
- package/dist/core/extract/extractors/set.js.map +1 -0
- package/dist/core/extract/extractors/string-bool.d.ts +10 -0
- package/dist/core/extract/extractors/string-bool.d.ts.map +1 -0
- package/dist/core/extract/extractors/string-bool.js +92 -0
- package/dist/core/extract/extractors/string-bool.js.map +1 -0
- package/dist/core/extract/extractors/string.d.ts +4 -0
- package/dist/core/extract/extractors/string.d.ts.map +1 -0
- package/dist/core/extract/extractors/string.js +41 -0
- package/dist/core/extract/extractors/string.js.map +1 -0
- package/dist/core/extract/extractors/symbol.d.ts +3 -0
- package/dist/core/extract/extractors/symbol.d.ts.map +1 -0
- package/dist/core/extract/extractors/symbol.js +2 -0
- package/dist/core/extract/extractors/symbol.js.map +1 -0
- package/dist/core/extract/extractors/template-literal.d.ts +4 -0
- package/dist/core/extract/extractors/template-literal.d.ts.map +1 -0
- package/dist/core/extract/extractors/template-literal.js +8 -0
- package/dist/core/extract/extractors/template-literal.js.map +1 -0
- package/dist/core/extract/extractors/tuple.d.ts +4 -0
- package/dist/core/extract/extractors/tuple.d.ts.map +1 -0
- package/dist/core/extract/extractors/tuple.js +6 -0
- package/dist/core/extract/extractors/tuple.js.map +1 -0
- package/dist/core/extract/extractors/undefined.d.ts +3 -0
- package/dist/core/extract/extractors/undefined.d.ts.map +1 -0
- package/dist/core/extract/extractors/undefined.js +2 -0
- package/dist/core/extract/extractors/undefined.js.map +1 -0
- package/dist/core/extract/extractors/union.d.ts +4 -0
- package/dist/core/extract/extractors/union.d.ts.map +1 -0
- package/dist/core/extract/extractors/union.js +44 -0
- package/dist/core/extract/extractors/union.js.map +1 -0
- package/dist/core/extract/extractors/unknown.d.ts +3 -0
- package/dist/core/extract/extractors/unknown.d.ts.map +1 -0
- package/dist/core/extract/extractors/unknown.js +2 -0
- package/dist/core/extract/extractors/unknown.js.map +1 -0
- package/dist/core/extract/extractors/void.d.ts +3 -0
- package/dist/core/extract/extractors/void.d.ts.map +1 -0
- package/dist/core/extract/extractors/void.js +2 -0
- package/dist/core/extract/extractors/void.js.map +1 -0
- package/dist/core/extract/fallback.d.ts +4 -0
- package/dist/core/extract/fallback.d.ts.map +1 -0
- package/dist/core/extract/fallback.js +9 -0
- package/dist/core/extract/fallback.js.map +1 -0
- package/dist/core/extract/index.d.ts +11 -0
- package/dist/core/extract/index.d.ts.map +1 -0
- package/dist/core/extract/index.js +11 -0
- package/dist/core/extract/index.js.map +1 -0
- package/dist/core/extract/registry.d.ts +59 -0
- package/dist/core/extract/registry.d.ts.map +1 -0
- package/dist/core/extract/registry.js +152 -0
- package/dist/core/extract/registry.js.map +1 -0
- package/dist/core/extract/types.d.ts +114 -0
- package/dist/core/extract/types.d.ts.map +1 -0
- package/dist/core/extract/types.js +2 -0
- package/dist/core/extract/types.js.map +1 -0
- package/dist/core/iife.d.ts +38 -0
- package/dist/core/iife.d.ts.map +1 -0
- package/dist/core/iife.js +59 -0
- package/dist/core/iife.js.map +1 -0
- package/dist/core/pipeline.d.ts +26 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +42 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/types.d.ts +352 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/discovery.d.ts +14 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +40 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +4 -674
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -2553
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +24 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +129 -0
- package/dist/loader.js.map +1 -0
- package/dist/static-filter.d.ts +7 -0
- package/dist/static-filter.d.ts.map +1 -0
- package/dist/static-filter.js +396 -0
- package/dist/static-filter.js.map +1 -0
- package/dist/unplugin/bun.d.ts +3 -0
- package/dist/unplugin/bun.d.ts.map +1 -0
- package/dist/unplugin/bun.js +3 -0
- package/dist/unplugin/bun.js.map +1 -0
- package/dist/unplugin/esbuild.d.ts +3 -0
- package/dist/unplugin/esbuild.d.ts.map +1 -0
- package/dist/unplugin/esbuild.js +3 -0
- package/dist/unplugin/esbuild.js.map +1 -0
- package/dist/unplugin/farm.d.ts +3 -0
- package/dist/unplugin/farm.d.ts.map +1 -0
- package/dist/unplugin/farm.js +3 -0
- package/dist/unplugin/farm.js.map +1 -0
- package/dist/unplugin/index.d.ts +4 -0
- package/dist/unplugin/index.d.ts.map +1 -0
- package/dist/unplugin/index.js +102 -0
- package/dist/unplugin/index.js.map +1 -0
- package/dist/unplugin/rolldown.d.ts +3 -0
- package/dist/unplugin/rolldown.d.ts.map +1 -0
- package/dist/unplugin/rolldown.js +3 -0
- package/dist/unplugin/rolldown.js.map +1 -0
- package/dist/unplugin/rollup.d.ts +3 -0
- package/dist/unplugin/rollup.d.ts.map +1 -0
- package/dist/unplugin/rollup.js +3 -0
- package/dist/unplugin/rollup.js.map +1 -0
- package/dist/unplugin/rspack.d.ts +3 -0
- package/dist/unplugin/rspack.d.ts.map +1 -0
- package/dist/unplugin/rspack.js +3 -0
- package/dist/unplugin/rspack.js.map +1 -0
- package/dist/unplugin/transform.d.ts +36 -0
- package/dist/unplugin/transform.d.ts.map +1 -0
- package/dist/unplugin/transform.js +292 -0
- package/dist/unplugin/transform.js.map +1 -0
- package/dist/unplugin/types.d.ts +67 -0
- package/dist/unplugin/types.d.ts.map +1 -0
- package/dist/unplugin/types.js +19 -0
- package/dist/unplugin/types.js.map +1 -0
- package/dist/unplugin/virtual.d.ts +24 -0
- package/dist/unplugin/virtual.d.ts.map +1 -0
- package/dist/unplugin/virtual.js +62 -0
- package/dist/unplugin/virtual.js.map +1 -0
- package/dist/unplugin/vite.d.ts +3 -0
- package/dist/unplugin/vite.d.ts.map +1 -0
- package/dist/unplugin/vite.js +3 -0
- package/dist/unplugin/vite.js.map +1 -0
- package/dist/unplugin/webpack.d.ts +3 -0
- package/dist/unplugin/webpack.d.ts.map +1 -0
- package/dist/unplugin/webpack.js +3 -0
- package/dist/unplugin/webpack.js.map +1 -0
- package/package.json +110 -51
- package/dist/index.mjs +0 -2539
- package/dist/standalone.d.ts +0 -386
- package/dist/standalone.js +0 -540
- package/dist/standalone.mjs +0 -531
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue object emit helpers.
|
|
3
|
+
*
|
|
4
|
+
* Each helper returns a string of the form `_e.push(...)` (or equivalent on a
|
|
5
|
+
* caller-supplied issues variable). Two emit modes:
|
|
6
|
+
*
|
|
7
|
+
* - inline (CLI .compiled.ts): emits the literal `{code:"too_small",...}` object.
|
|
8
|
+
* - lean (unplugin): emits a call like `__zaTS(min,origin,inclusive,input,path)`
|
|
9
|
+
* and registers the helper in `ctx.usedHelpers` so the transform layer can
|
|
10
|
+
* construct the corresponding `import` from `"virtual:zod-compiler/runtime"`.
|
|
11
|
+
*
|
|
12
|
+
* Centralizing all issue emission here means schema codegen files don't carry
|
|
13
|
+
* the inline/lean branching; they just call `tooSmall(g, ...)` etc.
|
|
14
|
+
*
|
|
15
|
+
* Message resolution mirrors Zod, which consults the error map of the
|
|
16
|
+
* INSTANCE that created the issue:
|
|
17
|
+
* - check-created issues (min/max/format/refine): per-check message only
|
|
18
|
+
* (options.message, extracted from `.min(3, "msg")`)
|
|
19
|
+
* - schema-created issues (invalid_type, enum/literal invalid_value, tuple
|
|
20
|
+
* length, invalid_union, invalid_key): schema-level message (g.typeMsg,
|
|
21
|
+
* from `z.string({ error: "msg" })`)
|
|
22
|
+
* Helpers default per the most common call-site kind; size-issue emitters
|
|
23
|
+
* accept `useTypeMsg: true` for node-level uses (tuple), and invalidValue
|
|
24
|
+
* accepts `useTypeMsg: false` for check-level uses (file mime).
|
|
25
|
+
* When no message lands, the __fin finalizer applies the locale default.
|
|
26
|
+
*/
|
|
27
|
+
import type { CodeGenContext } from "./context.js";
|
|
28
|
+
/** Common slim slice of SlowGen + FastGen needed for issue emission. */
|
|
29
|
+
interface IssueGen {
|
|
30
|
+
readonly issues: string;
|
|
31
|
+
readonly input: string;
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly ctx: CodeGenContext;
|
|
34
|
+
readonly typeMsg?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
export declare function tooSmall(g: IssueGen, minimum: string | number, origin: string, inclusive: boolean, options?: {
|
|
37
|
+
exact?: boolean;
|
|
38
|
+
input?: string;
|
|
39
|
+
path?: string;
|
|
40
|
+
message?: string | undefined;
|
|
41
|
+
/** Set for node-level issues (tuple length) where schema error applies. */
|
|
42
|
+
useTypeMsg?: boolean;
|
|
43
|
+
}): string;
|
|
44
|
+
export declare function tooBig(g: IssueGen, maximum: string | number, origin: string, inclusive: boolean, options?: {
|
|
45
|
+
exact?: boolean;
|
|
46
|
+
input?: string;
|
|
47
|
+
path?: string;
|
|
48
|
+
message?: string | undefined;
|
|
49
|
+
/** Set for node-level issues (tuple length) where schema error applies. */
|
|
50
|
+
useTypeMsg?: boolean;
|
|
51
|
+
}): string;
|
|
52
|
+
export declare function invalidType(g: IssueGen, expected: string, options?: {
|
|
53
|
+
input?: string;
|
|
54
|
+
path?: string;
|
|
55
|
+
extra?: string;
|
|
56
|
+
message?: string | undefined;
|
|
57
|
+
}): string;
|
|
58
|
+
export declare function invalidFormat(g: IssueGen, format: string | {
|
|
59
|
+
expr: string;
|
|
60
|
+
}, options?: {
|
|
61
|
+
input?: string;
|
|
62
|
+
path?: string;
|
|
63
|
+
extra?: string;
|
|
64
|
+
message?: string | undefined;
|
|
65
|
+
}): string;
|
|
66
|
+
export declare function invalidValue(g: IssueGen, valuesExpr: string, options?: {
|
|
67
|
+
input?: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
message?: string | undefined;
|
|
70
|
+
/** Set to false for check-level issues (file mime) where schema error does not apply. */
|
|
71
|
+
useTypeMsg?: boolean;
|
|
72
|
+
}): string;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=emit-issue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-issue.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/emit-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,wEAAwE;AACxE,UAAU,QAAQ;IAChB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAyBD,wBAAgB,QAAQ,CACtB,CAAC,EAAE,QAAQ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C;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACxF,MAAM,CAgBR;AAED,wBAAgB,YAAY,CAC1B,CAAC,EAAE,QAAQ,EACX,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GACA,MAAM,CAaR"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue object emit helpers.
|
|
3
|
+
*
|
|
4
|
+
* Each helper returns a string of the form `_e.push(...)` (or equivalent on a
|
|
5
|
+
* caller-supplied issues variable). Two emit modes:
|
|
6
|
+
*
|
|
7
|
+
* - inline (CLI .compiled.ts): emits the literal `{code:"too_small",...}` object.
|
|
8
|
+
* - lean (unplugin): emits a call like `__zaTS(min,origin,inclusive,input,path)`
|
|
9
|
+
* and registers the helper in `ctx.usedHelpers` so the transform layer can
|
|
10
|
+
* construct the corresponding `import` from `"virtual:zod-compiler/runtime"`.
|
|
11
|
+
*
|
|
12
|
+
* Centralizing all issue emission here means schema codegen files don't carry
|
|
13
|
+
* the inline/lean branching; they just call `tooSmall(g, ...)` etc.
|
|
14
|
+
*
|
|
15
|
+
* Message resolution mirrors Zod, which consults the error map of the
|
|
16
|
+
* INSTANCE that created the issue:
|
|
17
|
+
* - check-created issues (min/max/format/refine): per-check message only
|
|
18
|
+
* (options.message, extracted from `.min(3, "msg")`)
|
|
19
|
+
* - schema-created issues (invalid_type, enum/literal invalid_value, tuple
|
|
20
|
+
* length, invalid_union, invalid_key): schema-level message (g.typeMsg,
|
|
21
|
+
* from `z.string({ error: "msg" })`)
|
|
22
|
+
* Helpers default per the most common call-site kind; size-issue emitters
|
|
23
|
+
* accept `useTypeMsg: true` for node-level uses (tuple), and invalidValue
|
|
24
|
+
* accepts `useTypeMsg: false` for check-level uses (file mime).
|
|
25
|
+
* When no message lands, the __fin finalizer applies the locale default.
|
|
26
|
+
*/
|
|
27
|
+
import { escapeString } from "./context.js";
|
|
28
|
+
function pushIssue(g, body) {
|
|
29
|
+
return `${g.issues}.push(${body});`;
|
|
30
|
+
}
|
|
31
|
+
/** Resolve the effective static message for an issue site. */
|
|
32
|
+
function resolveMessage(g, explicit, useTypeMsg) {
|
|
33
|
+
return explicit ?? (useTypeMsg ? g.typeMsg : undefined);
|
|
34
|
+
}
|
|
35
|
+
/** `,message:"..."` fragment for inline object literals ("" when no message). */
|
|
36
|
+
function messageProp(m) {
|
|
37
|
+
return m === undefined ? "" : `,message:${escapeString(m)}`;
|
|
38
|
+
}
|
|
39
|
+
/** `,"..."` trailing argument fragment for lean factory calls ("" when no message). */
|
|
40
|
+
function messageArg(m) {
|
|
41
|
+
return m === undefined ? "" : `,${escapeString(m)}`;
|
|
42
|
+
}
|
|
43
|
+
export function tooSmall(g, minimum, origin, inclusive, options) {
|
|
44
|
+
const input = options?.input ?? g.input;
|
|
45
|
+
const path = options?.path ?? g.path;
|
|
46
|
+
const exact = options?.exact === true;
|
|
47
|
+
const m = resolveMessage(g, options?.message, options?.useTypeMsg === true);
|
|
48
|
+
if (g.ctx.mode === "lean") {
|
|
49
|
+
if (exact) {
|
|
50
|
+
g.ctx.usedHelpers.add("__zaTSx");
|
|
51
|
+
return pushIssue(g, `__zaTSx(${minimum},${escapeString(origin)},${input},${path}${messageArg(m)})`);
|
|
52
|
+
}
|
|
53
|
+
g.ctx.usedHelpers.add("__zaTS");
|
|
54
|
+
return pushIssue(g, `__zaTS(${minimum},${escapeString(origin)},${inclusive},${input},${path}${messageArg(m)})`);
|
|
55
|
+
}
|
|
56
|
+
if (exact) {
|
|
57
|
+
return pushIssue(g, `{code:"too_small",minimum:${minimum},origin:${escapeString(origin)},inclusive:true,exact:true${messageProp(m)},input:${input},path:${path}}`);
|
|
58
|
+
}
|
|
59
|
+
return pushIssue(g, `{code:"too_small",minimum:${minimum},origin:${escapeString(origin)},inclusive:${inclusive}${messageProp(m)},input:${input},path:${path}}`);
|
|
60
|
+
}
|
|
61
|
+
export function tooBig(g, maximum, origin, inclusive, options) {
|
|
62
|
+
const input = options?.input ?? g.input;
|
|
63
|
+
const path = options?.path ?? g.path;
|
|
64
|
+
const exact = options?.exact === true;
|
|
65
|
+
const m = resolveMessage(g, options?.message, options?.useTypeMsg === true);
|
|
66
|
+
if (g.ctx.mode === "lean") {
|
|
67
|
+
if (exact) {
|
|
68
|
+
g.ctx.usedHelpers.add("__zaTBx");
|
|
69
|
+
return pushIssue(g, `__zaTBx(${maximum},${escapeString(origin)},${input},${path}${messageArg(m)})`);
|
|
70
|
+
}
|
|
71
|
+
g.ctx.usedHelpers.add("__zaTB");
|
|
72
|
+
return pushIssue(g, `__zaTB(${maximum},${escapeString(origin)},${inclusive},${input},${path}${messageArg(m)})`);
|
|
73
|
+
}
|
|
74
|
+
if (exact) {
|
|
75
|
+
return pushIssue(g, `{code:"too_big",maximum:${maximum},origin:${escapeString(origin)},inclusive:true,exact:true${messageProp(m)},input:${input},path:${path}}`);
|
|
76
|
+
}
|
|
77
|
+
return pushIssue(g, `{code:"too_big",maximum:${maximum},origin:${escapeString(origin)},inclusive:${inclusive}${messageProp(m)},input:${input},path:${path}}`);
|
|
78
|
+
}
|
|
79
|
+
export function invalidType(g, expected, options) {
|
|
80
|
+
const input = options?.input ?? g.input;
|
|
81
|
+
const path = options?.path ?? g.path;
|
|
82
|
+
// invalid_type is always created by the schema node — schema error applies.
|
|
83
|
+
const m = resolveMessage(g, options?.message, true);
|
|
84
|
+
if (g.ctx.mode === "lean" && !options?.extra) {
|
|
85
|
+
g.ctx.usedHelpers.add("__zaIT");
|
|
86
|
+
return pushIssue(g, `__zaIT(${escapeString(expected)},${input},${path}${messageArg(m)})`);
|
|
87
|
+
}
|
|
88
|
+
const extra = options?.extra ? `,${options.extra}` : "";
|
|
89
|
+
return pushIssue(g, `{code:"invalid_type",expected:${escapeString(expected)}${extra}${messageProp(m)},input:${input},path:${path}}`);
|
|
90
|
+
}
|
|
91
|
+
export function invalidFormat(g, format, options) {
|
|
92
|
+
const input = options?.input ?? g.input;
|
|
93
|
+
const path = options?.path ?? g.path;
|
|
94
|
+
const formatExpr = typeof format === "string" ? escapeString(format) : format.expr;
|
|
95
|
+
// Format issues are created by check instances — schema error never applies.
|
|
96
|
+
const m = options?.message;
|
|
97
|
+
if (g.ctx.mode === "lean") {
|
|
98
|
+
g.ctx.usedHelpers.add("__zaIF");
|
|
99
|
+
const extraArg = options?.extra ? `,{${options.extra}}` : m !== undefined ? ",undefined" : "";
|
|
100
|
+
return pushIssue(g, `__zaIF(${formatExpr},${input},${path}${extraArg}${messageArg(m)})`);
|
|
101
|
+
}
|
|
102
|
+
const extra = options?.extra ? `,${options.extra}` : "";
|
|
103
|
+
return pushIssue(g, `{code:"invalid_format",format:${formatExpr}${extra}${messageProp(m)},input:${input},path:${path}}`);
|
|
104
|
+
}
|
|
105
|
+
export function invalidValue(g, valuesExpr, options) {
|
|
106
|
+
const input = options?.input ?? g.input;
|
|
107
|
+
const path = options?.path ?? g.path;
|
|
108
|
+
// Default: enum/literal invalid_value is created by the schema node.
|
|
109
|
+
const m = resolveMessage(g, options?.message, options?.useTypeMsg !== false);
|
|
110
|
+
if (g.ctx.mode === "lean") {
|
|
111
|
+
g.ctx.usedHelpers.add("__zaIV");
|
|
112
|
+
return pushIssue(g, `__zaIV(${valuesExpr},${input},${path}${messageArg(m)})`);
|
|
113
|
+
}
|
|
114
|
+
return pushIssue(g, `{code:"invalid_value",values:${valuesExpr}${messageProp(m)},input:${input},path:${path}}`);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=emit-issue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-issue.js","sourceRoot":"","sources":["../../../src/core/codegen/emit-issue.ts"],"names":[],"mappings":"AAAA;;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C,CAAC,UAAU,KAAK,SAAS,IAAI,GAAG,CAC3F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tagged template literal that strips newlines and leading whitespace.
|
|
3
|
+
* Allows writing generated code with readable indentation while producing minified output.
|
|
4
|
+
*
|
|
5
|
+
* Used exclusively by Slow Path generators (codegen/schemas/).
|
|
6
|
+
*/
|
|
7
|
+
export declare function emit(strings: TemplateStringsArray, ...values: (string | number | bigint | boolean)[]): string;
|
|
8
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/emit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,IAAI,CAClB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAChD,MAAM,CAOR"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tagged template literal that strips newlines and leading whitespace.
|
|
3
|
+
* Allows writing generated code with readable indentation while producing minified output.
|
|
4
|
+
*
|
|
5
|
+
* Used exclusively by Slow Path generators (codegen/schemas/).
|
|
6
|
+
*/
|
|
7
|
+
export function emit(strings, ...values) {
|
|
8
|
+
let result = "";
|
|
9
|
+
for (let i = 0; i < strings.length; i++) {
|
|
10
|
+
result += (strings[i] ?? "").replace(/\n\s*/g, "");
|
|
11
|
+
if (i < values.length)
|
|
12
|
+
result += String(values[i]);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=emit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../../src/core/codegen/emit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAClB,OAA6B,EAC7B,GAAG,MAA8C;IAEjD,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM;YAAE,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast Path: produces a boolean expression string for eligible schemas.
|
|
3
|
+
* When the expression evaluates to `true` at runtime, the input is valid and
|
|
4
|
+
* safeParse can return success immediately without allocating an issues array.
|
|
5
|
+
*
|
|
6
|
+
* Returns `null` if the schema is not eligible for Fast Path (contains coerce,
|
|
7
|
+
* default, transform, or other non-pure constructs).
|
|
8
|
+
*/
|
|
9
|
+
import type { SchemaIR } from "../types.js";
|
|
10
|
+
import type { CodeGenContext, FastGen } from "./context.js";
|
|
11
|
+
export declare function createFastGen(inputExpr: string, ctx: CodeGenContext): FastGen;
|
|
12
|
+
/**
|
|
13
|
+
* Generate a boolean expression string that validates input against the schema.
|
|
14
|
+
* Returns `null` if the schema (or any nested part) is not eligible for fast checking.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateFast(ir: SchemaIR, g: FastGen): string | null;
|
|
17
|
+
//# sourceMappingURL=fast-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-path.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/fast-path.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAC;AAyF3E,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAU7E;AAID;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKpE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast Path: produces a boolean expression string for eligible schemas.
|
|
3
|
+
* When the expression evaluates to `true` at runtime, the input is valid and
|
|
4
|
+
* safeParse can return success immediately without allocating an issues array.
|
|
5
|
+
*
|
|
6
|
+
* Returns `null` if the schema is not eligible for Fast Path (contains coerce,
|
|
7
|
+
* default, transform, or other non-pure constructs).
|
|
8
|
+
*/
|
|
9
|
+
import { emitRegex, emitTemp } from "./context.js";
|
|
10
|
+
import { fastAny } from "./schemas/any.js";
|
|
11
|
+
import { fastArray } from "./schemas/array.js";
|
|
12
|
+
import { fastBigInt } from "./schemas/bigint.js";
|
|
13
|
+
import { fastBoolean } from "./schemas/boolean.js";
|
|
14
|
+
import { fastCatch } from "./schemas/catch.js";
|
|
15
|
+
import { fastDate } from "./schemas/date.js";
|
|
16
|
+
import { fastDefault } from "./schemas/default.js";
|
|
17
|
+
import { fastDiscriminatedUnion } from "./schemas/discriminated-union.js";
|
|
18
|
+
import { fastEnum } from "./schemas/enum.js";
|
|
19
|
+
import { fastFile } from "./schemas/file.js";
|
|
20
|
+
import { fastIntersection } from "./schemas/intersection.js";
|
|
21
|
+
import { fastLiteral } from "./schemas/literal.js";
|
|
22
|
+
import { fastMap } from "./schemas/map.js";
|
|
23
|
+
import { fastNan } from "./schemas/nan.js";
|
|
24
|
+
import { fastNever } from "./schemas/never.js";
|
|
25
|
+
import { fastNull } from "./schemas/null.js";
|
|
26
|
+
import { fastNullable } from "./schemas/nullable.js";
|
|
27
|
+
import { fastNumber } from "./schemas/number.js";
|
|
28
|
+
import { fastObject } from "./schemas/object.js";
|
|
29
|
+
import { fastOptional } from "./schemas/optional.js";
|
|
30
|
+
import { fastPipe } from "./schemas/pipe.js";
|
|
31
|
+
import { fastReadonly } from "./schemas/readonly.js";
|
|
32
|
+
import { fastRecord } from "./schemas/record.js";
|
|
33
|
+
import { fastRecursiveRef } from "./schemas/recursive-ref.js";
|
|
34
|
+
import { fastSet } from "./schemas/set.js";
|
|
35
|
+
import { fastString } from "./schemas/string.js";
|
|
36
|
+
import { fastSymbol } from "./schemas/symbol.js";
|
|
37
|
+
import { fastTemplateLiteral } from "./schemas/template-literal.js";
|
|
38
|
+
import { fastTuple } from "./schemas/tuple.js";
|
|
39
|
+
import { fastUndefined } from "./schemas/undefined.js";
|
|
40
|
+
import { fastUnion } from "./schemas/union.js";
|
|
41
|
+
import { fastUnknown } from "./schemas/unknown.js";
|
|
42
|
+
import { fastVoid } from "./schemas/void.js";
|
|
43
|
+
// ─── Typed registry ─────────────────────────────────────────────────────────
|
|
44
|
+
// `null` = statically ineligible (the type NEVER has a fast path).
|
|
45
|
+
// Non-null function = may return null at runtime (dynamically ineligible, e.g. when coerce is present).
|
|
46
|
+
const fastRegistry = {
|
|
47
|
+
// Primitives (order follows SchemaIR union in types.ts)
|
|
48
|
+
string: fastString,
|
|
49
|
+
number: fastNumber,
|
|
50
|
+
boolean: fastBoolean,
|
|
51
|
+
bigint: fastBigInt,
|
|
52
|
+
date: fastDate,
|
|
53
|
+
symbol: fastSymbol,
|
|
54
|
+
null: fastNull,
|
|
55
|
+
undefined: fastUndefined,
|
|
56
|
+
void: fastVoid,
|
|
57
|
+
nan: fastNan,
|
|
58
|
+
never: fastNever,
|
|
59
|
+
any: fastAny,
|
|
60
|
+
unknown: fastUnknown,
|
|
61
|
+
literal: fastLiteral,
|
|
62
|
+
enum: fastEnum,
|
|
63
|
+
// Containers
|
|
64
|
+
object: fastObject,
|
|
65
|
+
array: fastArray,
|
|
66
|
+
tuple: fastTuple,
|
|
67
|
+
record: fastRecord,
|
|
68
|
+
set: fastSet,
|
|
69
|
+
map: fastMap,
|
|
70
|
+
file: fastFile,
|
|
71
|
+
// Unions & Intersections
|
|
72
|
+
union: fastUnion,
|
|
73
|
+
discriminatedUnion: fastDiscriminatedUnion,
|
|
74
|
+
intersection: fastIntersection,
|
|
75
|
+
// Modifiers
|
|
76
|
+
optional: fastOptional,
|
|
77
|
+
nullable: fastNullable,
|
|
78
|
+
readonly: fastReadonly,
|
|
79
|
+
default: fastDefault,
|
|
80
|
+
pipe: fastPipe,
|
|
81
|
+
// Effects
|
|
82
|
+
effect: null, // statically ineligible
|
|
83
|
+
// Special
|
|
84
|
+
templateLiteral: fastTemplateLiteral,
|
|
85
|
+
catch: fastCatch,
|
|
86
|
+
fallback: null, // statically ineligible
|
|
87
|
+
recursiveRef: fastRecursiveRef,
|
|
88
|
+
stringBool: null, // statically ineligible — output type (boolean) differs from input (string)
|
|
89
|
+
};
|
|
90
|
+
// ─── Factory ─────────────────────────────────────────────────────────────────
|
|
91
|
+
export function createFastGen(inputExpr, ctx) {
|
|
92
|
+
return {
|
|
93
|
+
input: inputExpr,
|
|
94
|
+
ctx,
|
|
95
|
+
visit(ir, overrides) {
|
|
96
|
+
return generateFast(ir, createFastGen(overrides?.input ?? inputExpr, ctx));
|
|
97
|
+
},
|
|
98
|
+
temp: (prefix) => emitTemp(ctx, prefix),
|
|
99
|
+
regex: (prefix, pattern, flags) => emitRegex(ctx, prefix, pattern, flags),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
// ─── Dispatch ────────────────────────────────────────────────────────────────
|
|
103
|
+
/**
|
|
104
|
+
* Generate a boolean expression string that validates input against the schema.
|
|
105
|
+
* Returns `null` if the schema (or any nested part) is not eligible for fast checking.
|
|
106
|
+
*/
|
|
107
|
+
export function generateFast(ir, g) {
|
|
108
|
+
const gen = fastRegistry[ir.type];
|
|
109
|
+
if (gen === null)
|
|
110
|
+
return null;
|
|
111
|
+
// biome-ignore lint/suspicious/noExplicitAny: registry dispatch requires type erasure at call site
|
|
112
|
+
return gen(ir, g);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=fast-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast-path.js","sourceRoot":"","sources":["../../../src/core/codegen/fast-path.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OA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AAC,EAAY,EAAE,CAAU;IACnD,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC9B,mGAAmG;IACnG,OAAQ,GAAW,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SchemaIR } from "../types.js";
|
|
2
|
+
import type { CodeGenResult, CodegenMode } from "./context.js";
|
|
3
|
+
export type { CodeGenResult } from "./context.js";
|
|
4
|
+
export interface GenerateValidatorOptions {
|
|
5
|
+
refCount?: number;
|
|
6
|
+
/** Codegen output mode. Defaults to "inline". */
|
|
7
|
+
mode?: CodegenMode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Generate optimized validation code from SchemaIR.
|
|
11
|
+
*
|
|
12
|
+
* - `code`: preamble declarations (Sets, RegExps, etc.) — deterministic for the same IR
|
|
13
|
+
* - `functionDef`: full function expression string referencing preamble vars via closure
|
|
14
|
+
* - `usedHelpers`: helper names from "virtual:zod-compiler/runtime" referenced (lean mode only)
|
|
15
|
+
*
|
|
16
|
+
* Usage: `new Function(code + "\nreturn " + functionDef + ";")()`
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateValidator(ir: SchemaIR, name: string, options?: GenerateValidatorOptions): CodeGenResult;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAkB,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI/E,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,GACjC,aAAa,CAgDf"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createFastGen, generateFast } from "./fast-path.js";
|
|
2
|
+
import { createSlowGen, generateSlow } from "./slow-path.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generate optimized validation code from SchemaIR.
|
|
5
|
+
*
|
|
6
|
+
* - `code`: preamble declarations (Sets, RegExps, etc.) — deterministic for the same IR
|
|
7
|
+
* - `functionDef`: full function expression string referencing preamble vars via closure
|
|
8
|
+
* - `usedHelpers`: helper names from "virtual:zod-compiler/runtime" referenced (lean mode only)
|
|
9
|
+
*
|
|
10
|
+
* Usage: `new Function(code + "\nreturn " + functionDef + ";")()`
|
|
11
|
+
*/
|
|
12
|
+
export function generateValidator(ir, name, options) {
|
|
13
|
+
const fnName = `safeParse_${name}`;
|
|
14
|
+
const mode = options?.mode ?? "inline";
|
|
15
|
+
const ctx = {
|
|
16
|
+
preamble: [],
|
|
17
|
+
counter: 0,
|
|
18
|
+
fnName,
|
|
19
|
+
regexCache: new Map(),
|
|
20
|
+
mode,
|
|
21
|
+
usedHelpers: new Set(),
|
|
22
|
+
};
|
|
23
|
+
// Fast Path: generate a boolean expression for eligible schemas
|
|
24
|
+
const fg = createFastGen("input", ctx);
|
|
25
|
+
const fastExpr = generateFast(ir, fg);
|
|
26
|
+
const sg = createSlowGen("_d", "_d", "[]", "_e", ctx);
|
|
27
|
+
const slowCode = generateSlow(ir, sg);
|
|
28
|
+
const code = ["/* zod-compiler */", ...ctx.preamble].join("\n");
|
|
29
|
+
const functionDefParts = [`function ${fnName}(input){`];
|
|
30
|
+
// Prepend fast path guard if eligible
|
|
31
|
+
if (fastExpr !== null && fastExpr !== "true") {
|
|
32
|
+
functionDefParts.push(`if(${fastExpr}){return{success:true,data:input};}`);
|
|
33
|
+
}
|
|
34
|
+
else if (fastExpr === "true") {
|
|
35
|
+
// Schema always succeeds (any/unknown) — skip slow path entirely
|
|
36
|
+
functionDefParts.push(`return{success:true,data:input};`);
|
|
37
|
+
functionDefParts.push(`}`);
|
|
38
|
+
return {
|
|
39
|
+
code,
|
|
40
|
+
functionDef: functionDefParts.join("\n"),
|
|
41
|
+
refCount: options?.refCount ?? 0,
|
|
42
|
+
usedHelpers: ctx.usedHelpers,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
functionDefParts.push(`var _e=[];`, `var _d=input;`, slowCode, `return __fin(_e,_d);`, `}`);
|
|
46
|
+
const functionDef = functionDefParts.join("\n");
|
|
47
|
+
return {
|
|
48
|
+
code,
|
|
49
|
+
functionDef,
|
|
50
|
+
refCount: options?.refCount ?? 0,
|
|
51
|
+
usedHelpers: ctx.usedHelpers,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU7D;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,EAAY,EACZ,IAAY,EACZ,OAAkC;IAElC,MAAM,MAAM,GAAG,aAAa,IAAI,EAAE,CAAC;IACnC,MAAM,IAAI,GAAgB,OAAO,EAAE,IAAI,IAAI,QAAQ,CAAC;IACpD,MAAM,GAAG,GAAmB;QAC1B,QAAQ,EAAE,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,MAAM;QACN,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,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C,CAAC;IAEhD,OAAO;QACL,IAAI;QACJ,WAAW;QACX,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC;QAChC,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue factory function bodies (statement form).
|
|
3
|
+
*
|
|
4
|
+
* These functions produce the same `{code, ...}` shapes that lean-mode
|
|
5
|
+
* generated code would otherwise inline at every check site.
|
|
6
|
+
* Hosted in "virtual:zod-compiler/runtime" and called as `__zaTS(...)` etc.
|
|
7
|
+
*
|
|
8
|
+
* Argument convention (positional, kept short to minimize call-site bytes):
|
|
9
|
+
* __zaTS(minimum, origin, inclusive, input, path, msg?) — too_small
|
|
10
|
+
* __zaTB(maximum, origin, inclusive, input, path, msg?) — too_big
|
|
11
|
+
* __zaIT(expected, input, path, msg?) — invalid_type
|
|
12
|
+
* __zaIF(format, input, path, extra?, msg?) — invalid_format (extra merged into result)
|
|
13
|
+
* __zaIV(values, input, path, msg?) — invalid_value
|
|
14
|
+
*
|
|
15
|
+
* The trailing msg argument carries a static custom error message; when
|
|
16
|
+
* absent, the __fin finalizer applies the configured locale default.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ZA_TS_DECL = "function __zaTS(m,o,i,inp,p,msg){var r={code:\"too_small\",minimum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
19
|
+
export declare const ZA_TS_EXACT_DECL = "function __zaTSx(m,o,inp,p,msg){var r={code:\"too_small\",minimum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
20
|
+
export declare const ZA_TB_DECL = "function __zaTB(m,o,i,inp,p,msg){var r={code:\"too_big\",maximum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
21
|
+
export declare const ZA_TB_EXACT_DECL = "function __zaTBx(m,o,inp,p,msg){var r={code:\"too_big\",maximum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
22
|
+
export declare const ZA_IT_DECL = "function __zaIT(e,inp,p,msg){var r={code:\"invalid_type\",expected:e,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
23
|
+
export declare const ZA_IF_DECL = "function __zaIF(f,inp,p,extra,msg){var r={code:\"invalid_format\",format:f,input:inp,path:p};if(extra)Object.assign(r,extra);if(msg!==undefined)r.message=msg;return r;}";
|
|
24
|
+
export declare const ZA_IV_DECL = "function __zaIV(values,inp,p,msg){var r={code:\"invalid_value\",values:values,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}";
|
|
25
|
+
/** All issue factory declarations indexed by helper name. */
|
|
26
|
+
export declare const ISSUE_DECLS: Readonly<Record<string, string>>;
|
|
27
|
+
/** Helper names emitted by the issue factory call helpers in lean mode. */
|
|
28
|
+
export declare const ISSUE_HELPER_NAMES: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Float-safe remainder — byte-for-byte port of zod's util.floatSafeRemainder.
|
|
31
|
+
* Raw `%` mis-rejects valid multiples of decimal steps (0.3 % 0.1 !== 0);
|
|
32
|
+
* zod scales both operands to integers by their decimal-place count first.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ZA_FSR_DECL = "function __zaFsr(v,s){var vd=((\"\"+v).split(\".\")[1]||\"\").length;var ss=\"\"+s;var sd=(ss.split(\".\")[1]||\"\").length;if(sd===0&&/\\d?e-\\d?/.test(ss)){var m=ss.match(/\\d?e-(\\d?)/);if(m&&m[1]){sd=parseInt(m[1],10);}}var d=vd>sd?vd:sd;var vi=parseInt(v.toFixed(d).replace(\".\",\"\"),10);var si=parseInt(s.toFixed(d).replace(\".\",\"\"),10);return (vi%si)/Math.pow(10,d);}";
|
|
35
|
+
/** Non-issue runtime helper declarations hosted in the virtual module. */
|
|
36
|
+
export declare const RUNTIME_HELPER_DECLS: Readonly<Record<string, string>>;
|
|
37
|
+
//# sourceMappingURL=issue-decls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-decls.d.ts","sourceRoot":"","sources":["../../../src/core/codegen/issue-decls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,UAAU,4JACkI,CAAC;AAE1J,eAAO,MAAM,gBAAgB,yKACyI,CAAC;AAEvK,eAAO,MAAM,UAAU,0JACgI,CAAC;AAExJ,eAAO,MAAM,gBAAgB,uKACuI,CAAC;AAErK,eAAO,MAAM,UAAU,uIAC6G,CAAC;AAErI,eAAO,MAAM,UAAU,6KACmJ,CAAC;AAE3K,eAAO,MAAM,UAAU,gJACsH,CAAC;AAE9I,6DAA6D;AAC7D,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAA6B,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,WAAW,gYACmV,CAAC;AAE5W,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEjE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Issue factory function bodies (statement form).
|
|
3
|
+
*
|
|
4
|
+
* These functions produce the same `{code, ...}` shapes that lean-mode
|
|
5
|
+
* generated code would otherwise inline at every check site.
|
|
6
|
+
* Hosted in "virtual:zod-compiler/runtime" and called as `__zaTS(...)` etc.
|
|
7
|
+
*
|
|
8
|
+
* Argument convention (positional, kept short to minimize call-site bytes):
|
|
9
|
+
* __zaTS(minimum, origin, inclusive, input, path, msg?) — too_small
|
|
10
|
+
* __zaTB(maximum, origin, inclusive, input, path, msg?) — too_big
|
|
11
|
+
* __zaIT(expected, input, path, msg?) — invalid_type
|
|
12
|
+
* __zaIF(format, input, path, extra?, msg?) — invalid_format (extra merged into result)
|
|
13
|
+
* __zaIV(values, input, path, msg?) — invalid_value
|
|
14
|
+
*
|
|
15
|
+
* The trailing msg argument carries a static custom error message; when
|
|
16
|
+
* absent, the __fin finalizer applies the configured locale default.
|
|
17
|
+
*/
|
|
18
|
+
export const ZA_TS_DECL = 'function __zaTS(m,o,i,inp,p,msg){var r={code:"too_small",minimum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
19
|
+
export const ZA_TS_EXACT_DECL = 'function __zaTSx(m,o,inp,p,msg){var r={code:"too_small",minimum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
20
|
+
export const ZA_TB_DECL = 'function __zaTB(m,o,i,inp,p,msg){var r={code:"too_big",maximum:m,origin:o,inclusive:i,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
21
|
+
export const ZA_TB_EXACT_DECL = 'function __zaTBx(m,o,inp,p,msg){var r={code:"too_big",maximum:m,origin:o,inclusive:true,exact:true,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
22
|
+
export const ZA_IT_DECL = 'function __zaIT(e,inp,p,msg){var r={code:"invalid_type",expected:e,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
23
|
+
export const ZA_IF_DECL = 'function __zaIF(f,inp,p,extra,msg){var r={code:"invalid_format",format:f,input:inp,path:p};if(extra)Object.assign(r,extra);if(msg!==undefined)r.message=msg;return r;}';
|
|
24
|
+
export const ZA_IV_DECL = 'function __zaIV(values,inp,p,msg){var r={code:"invalid_value",values:values,input:inp,path:p};if(msg!==undefined)r.message=msg;return r;}';
|
|
25
|
+
/** All issue factory declarations indexed by helper name. */
|
|
26
|
+
export const ISSUE_DECLS = {
|
|
27
|
+
__zaTS: ZA_TS_DECL,
|
|
28
|
+
__zaTSx: ZA_TS_EXACT_DECL,
|
|
29
|
+
__zaTB: ZA_TB_DECL,
|
|
30
|
+
__zaTBx: ZA_TB_EXACT_DECL,
|
|
31
|
+
__zaIT: ZA_IT_DECL,
|
|
32
|
+
__zaIF: ZA_IF_DECL,
|
|
33
|
+
__zaIV: ZA_IV_DECL,
|
|
34
|
+
};
|
|
35
|
+
/** Helper names emitted by the issue factory call helpers in lean mode. */
|
|
36
|
+
export const ISSUE_HELPER_NAMES = Object.keys(ISSUE_DECLS);
|
|
37
|
+
/**
|
|
38
|
+
* Float-safe remainder — byte-for-byte port of zod's util.floatSafeRemainder.
|
|
39
|
+
* Raw `%` mis-rejects valid multiples of decimal steps (0.3 % 0.1 !== 0);
|
|
40
|
+
* zod scales both operands to integers by their decimal-place count first.
|
|
41
|
+
*/
|
|
42
|
+
export const ZA_FSR_DECL = 'function __zaFsr(v,s){var vd=((""+v).split(".")[1]||"").length;var ss=""+s;var sd=(ss.split(".")[1]||"").length;if(sd===0&&/\\d?e-\\d?/.test(ss)){var m=ss.match(/\\d?e-(\\d?)/);if(m&&m[1]){sd=parseInt(m[1],10);}}var d=vd>sd?vd:sd;var vi=parseInt(v.toFixed(d).replace(".",""),10);var si=parseInt(s.toFixed(d).replace(".",""),10);return (vi%si)/Math.pow(10,d);}';
|
|
43
|
+
/** Non-issue runtime helper declarations hosted in the virtual module. */
|
|
44
|
+
export const RUNTIME_HELPER_DECLS = {
|
|
45
|
+
__zaFsr: ZA_FSR_DECL,
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=issue-decls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-decls.js","sourceRoot":"","sources":["../../../src/core/codegen/issue-decls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,UAAU,GACrB,uJAAuJ,CAAC;AAE1J,MAAM,CAAC,MAAM,gBAAgB,GAC3B,oKAAoK,CAAC;AAEvK,MAAM,CAAC,MAAM,UAAU,GACrB,qJAAqJ,CAAC;AAExJ,MAAM,CAAC,MAAM,gBAAgB,GAC3B,kKAAkK,CAAC;AAErK,MAAM,CAAC,MAAM,UAAU,GACrB,kIAAkI,CAAC;AAErI,MAAM,CAAC,MAAM,UAAU,GACrB,wKAAwK,CAAC;AAE3K,MAAM,CAAC,MAAM,UAAU,GACrB,2IAA2I,CAAC;AAE9I,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAqC;IAC3D,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,gBAAgB;IACzB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;CACnB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAsB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,yWAAyW,CAAC;AAE5W,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAqC;IACpE,OAAO,EAAE,WAAW;CACrB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AnyIR } from "../../types.js";
|
|
2
|
+
import type { FastGen, SlowGen } from "../context.js";
|
|
3
|
+
export declare function slowAny(_ir: AnyIR, _g: SlowGen): string;
|
|
4
|
+
export declare function fastAny(_ir: AnyIR, _g: FastGen): string | null;
|
|
5
|
+
//# sourceMappingURL=any.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/any.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEtD,wBAAgB,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,CAEvD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/any.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,OAAO,CAAC,GAAU,EAAE,EAAW;IAC7C,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAU,EAAE,EAAW;IAC7C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ArrayIR, SchemaIR } from "../../types.js";
|
|
2
|
+
import type { FastGen, SlowGen } from "../context.js";
|
|
3
|
+
export declare function slowArray(ir: SchemaIR & {
|
|
4
|
+
type: "array";
|
|
5
|
+
}, g: SlowGen): string;
|
|
6
|
+
export declare function fastArray(ir: ArrayIR, g: FastGen): string | null;
|
|
7
|
+
//# sourceMappingURL=array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/schemas/array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAW,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMtD,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,CA+C9E;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwChE"}
|