zod-compiler 1.23.0 → 1.23.2

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.
Files changed (494) hide show
  1. package/README.md +9 -6
  2. package/dist/cli/commands/check.d.ts +10 -7
  3. package/dist/cli/commands/check.d.ts.map +1 -1
  4. package/dist/cli/commands/check.js +125 -148
  5. package/dist/cli/commands/check.js.map +1 -1
  6. package/dist/cli/commands/generate.d.ts +22 -19
  7. package/dist/cli/commands/generate.d.ts.map +1 -1
  8. package/dist/cli/commands/generate.js +102 -133
  9. package/dist/cli/commands/generate.js.map +1 -1
  10. package/dist/cli/commands/watch.d.ts +17 -15
  11. package/dist/cli/commands/watch.d.ts.map +1 -1
  12. package/dist/cli/commands/watch.js +126 -154
  13. package/dist/cli/commands/watch.js.map +1 -1
  14. package/dist/cli/emitter.d.ts +19 -16
  15. package/dist/cli/emitter.d.ts.map +1 -1
  16. package/dist/cli/emitter.js +55 -71
  17. package/dist/cli/emitter.js.map +1 -1
  18. package/dist/cli/errors.d.ts +4 -1
  19. package/dist/cli/errors.d.ts.map +1 -1
  20. package/dist/cli/errors.js +6 -2
  21. package/dist/cli/errors.js.map +1 -1
  22. package/dist/cli/index.d.ts +1 -3
  23. package/dist/cli/index.js +147 -160
  24. package/dist/cli/index.js.map +1 -1
  25. package/dist/cli/logger.d.ts +18 -15
  26. package/dist/cli/logger.d.ts.map +1 -1
  27. package/dist/cli/logger.js +38 -37
  28. package/dist/cli/logger.js.map +1 -1
  29. package/dist/core/codegen/build-path.d.ts +7 -41
  30. package/dist/core/codegen/build-path.d.ts.map +1 -1
  31. package/dist/core/codegen/build-path.js +481 -570
  32. package/dist/core/codegen/build-path.js.map +1 -1
  33. package/dist/core/codegen/context.d.ts +256 -253
  34. package/dist/core/codegen/context.d.ts.map +1 -1
  35. package/dist/core/codegen/context.js +363 -437
  36. package/dist/core/codegen/context.js.map +1 -1
  37. package/dist/core/codegen/dedupe.d.ts +22 -56
  38. package/dist/core/codegen/dedupe.d.ts.map +1 -1
  39. package/dist/core/codegen/dedupe.js +150 -242
  40. package/dist/core/codegen/dedupe.js.map +1 -1
  41. package/dist/core/codegen/emit-issue.d.ts +44 -68
  42. package/dist/core/codegen/emit-issue.d.ts.map +1 -1
  43. package/dist/core/codegen/emit-issue.js +76 -108
  44. package/dist/core/codegen/emit-issue.js.map +1 -1
  45. package/dist/core/codegen/emit.d.ts +4 -1
  46. package/dist/core/codegen/emit.d.ts.map +1 -1
  47. package/dist/core/codegen/emit.js +16 -13
  48. package/dist/core/codegen/emit.js.map +1 -1
  49. package/dist/core/codegen/fast-path.d.ts +7 -12
  50. package/dist/core/codegen/fast-path.d.ts.map +1 -1
  51. package/dist/core/codegen/fast-path.js +116 -145
  52. package/dist/core/codegen/fast-path.js.map +1 -1
  53. package/dist/core/codegen/fast-size.d.ts +12 -26
  54. package/dist/core/codegen/fast-size.d.ts.map +1 -1
  55. package/dist/core/codegen/fast-size.js +169 -244
  56. package/dist/core/codegen/fast-size.js.map +1 -1
  57. package/dist/core/codegen/index.d.ts +25 -23
  58. package/dist/core/codegen/index.d.ts.map +1 -1
  59. package/dist/core/codegen/index.js +239 -405
  60. package/dist/core/codegen/index.js.map +1 -1
  61. package/dist/core/codegen/issue-decls.d.ts +15 -12
  62. package/dist/core/codegen/issue-decls.d.ts.map +1 -1
  63. package/dist/core/codegen/issue-decls.js +131 -162
  64. package/dist/core/codegen/issue-decls.js.map +1 -1
  65. package/dist/core/codegen/regex-unroll.d.ts +4 -1
  66. package/dist/core/codegen/regex-unroll.d.ts.map +1 -1
  67. package/dist/core/codegen/regex-unroll.js +173 -197
  68. package/dist/core/codegen/regex-unroll.js.map +1 -1
  69. package/dist/core/codegen/schemas/any.d.ts +7 -4
  70. package/dist/core/codegen/schemas/any.d.ts.map +1 -1
  71. package/dist/core/codegen/schemas/any.js +8 -4
  72. package/dist/core/codegen/schemas/any.js.map +1 -1
  73. package/dist/core/codegen/schemas/array.d.ts +8 -5
  74. package/dist/core/codegen/schemas/array.d.ts.map +1 -1
  75. package/dist/core/codegen/schemas/array.js +77 -95
  76. package/dist/core/codegen/schemas/array.js.map +1 -1
  77. package/dist/core/codegen/schemas/bigint.d.ts +7 -4
  78. package/dist/core/codegen/schemas/bigint.d.ts.map +1 -1
  79. package/dist/core/codegen/schemas/bigint.js +44 -56
  80. package/dist/core/codegen/schemas/bigint.js.map +1 -1
  81. package/dist/core/codegen/schemas/boolean.d.ts +7 -4
  82. package/dist/core/codegen/schemas/boolean.d.ts.map +1 -1
  83. package/dist/core/codegen/schemas/boolean.js +12 -11
  84. package/dist/core/codegen/schemas/boolean.js.map +1 -1
  85. package/dist/core/codegen/schemas/catch.d.ts +8 -5
  86. package/dist/core/codegen/schemas/catch.d.ts.map +1 -1
  87. package/dist/core/codegen/schemas/catch.js +23 -23
  88. package/dist/core/codegen/schemas/catch.js.map +1 -1
  89. package/dist/core/codegen/schemas/date.d.ts +7 -4
  90. package/dist/core/codegen/schemas/date.d.ts.map +1 -1
  91. package/dist/core/codegen/schemas/date.js +49 -68
  92. package/dist/core/codegen/schemas/date.js.map +1 -1
  93. package/dist/core/codegen/schemas/default.d.ts +9 -6
  94. package/dist/core/codegen/schemas/default.d.ts.map +1 -1
  95. package/dist/core/codegen/schemas/default.js +29 -27
  96. package/dist/core/codegen/schemas/default.js.map +1 -1
  97. package/dist/core/codegen/schemas/discriminated-union.d.ts +12 -10
  98. package/dist/core/codegen/schemas/discriminated-union.d.ts.map +1 -1
  99. package/dist/core/codegen/schemas/discriminated-union.js +153 -178
  100. package/dist/core/codegen/schemas/discriminated-union.js.map +1 -1
  101. package/dist/core/codegen/schemas/effect.d.ts +9 -6
  102. package/dist/core/codegen/schemas/effect.d.ts.map +1 -1
  103. package/dist/core/codegen/schemas/effect.js +54 -67
  104. package/dist/core/codegen/schemas/effect.js.map +1 -1
  105. package/dist/core/codegen/schemas/enum.d.ts +7 -4
  106. package/dist/core/codegen/schemas/enum.d.ts.map +1 -1
  107. package/dist/core/codegen/schemas/enum.js +15 -21
  108. package/dist/core/codegen/schemas/enum.js.map +1 -1
  109. package/dist/core/codegen/schemas/fallback.d.ts +6 -3
  110. package/dist/core/codegen/schemas/fallback.d.ts.map +1 -1
  111. package/dist/core/codegen/schemas/fallback.js +14 -13
  112. package/dist/core/codegen/schemas/fallback.js.map +1 -1
  113. package/dist/core/codegen/schemas/file.d.ts +7 -4
  114. package/dist/core/codegen/schemas/file.d.ts.map +1 -1
  115. package/dist/core/codegen/schemas/file.js +51 -57
  116. package/dist/core/codegen/schemas/file.js.map +1 -1
  117. package/dist/core/codegen/schemas/intersection.d.ts +8 -5
  118. package/dist/core/codegen/schemas/intersection.d.ts.map +1 -1
  119. package/dist/core/codegen/schemas/intersection.js +16 -13
  120. package/dist/core/codegen/schemas/intersection.js.map +1 -1
  121. package/dist/core/codegen/schemas/literal.d.ts +7 -4
  122. package/dist/core/codegen/schemas/literal.d.ts.map +1 -1
  123. package/dist/core/codegen/schemas/literal.js +20 -23
  124. package/dist/core/codegen/schemas/literal.js.map +1 -1
  125. package/dist/core/codegen/schemas/map.d.ts +8 -5
  126. package/dist/core/codegen/schemas/map.d.ts.map +1 -1
  127. package/dist/core/codegen/schemas/map.js +61 -67
  128. package/dist/core/codegen/schemas/map.js.map +1 -1
  129. package/dist/core/codegen/schemas/nan.d.ts +7 -4
  130. package/dist/core/codegen/schemas/nan.d.ts.map +1 -1
  131. package/dist/core/codegen/schemas/nan.js +8 -4
  132. package/dist/core/codegen/schemas/nan.js.map +1 -1
  133. package/dist/core/codegen/schemas/never.d.ts +7 -4
  134. package/dist/core/codegen/schemas/never.d.ts.map +1 -1
  135. package/dist/core/codegen/schemas/never.js +8 -4
  136. package/dist/core/codegen/schemas/never.js.map +1 -1
  137. package/dist/core/codegen/schemas/null.d.ts +7 -4
  138. package/dist/core/codegen/schemas/null.d.ts.map +1 -1
  139. package/dist/core/codegen/schemas/null.js +8 -4
  140. package/dist/core/codegen/schemas/null.js.map +1 -1
  141. package/dist/core/codegen/schemas/nullable.d.ts +8 -5
  142. package/dist/core/codegen/schemas/nullable.d.ts.map +1 -1
  143. package/dist/core/codegen/schemas/nullable.js +8 -5
  144. package/dist/core/codegen/schemas/nullable.js.map +1 -1
  145. package/dist/core/codegen/schemas/number.d.ts +7 -4
  146. package/dist/core/codegen/schemas/number.d.ts.map +1 -1
  147. package/dist/core/codegen/schemas/number.js +120 -176
  148. package/dist/core/codegen/schemas/number.js.map +1 -1
  149. package/dist/core/codegen/schemas/object.d.ts +8 -5
  150. package/dist/core/codegen/schemas/object.d.ts.map +1 -1
  151. package/dist/core/codegen/schemas/object.js +144 -231
  152. package/dist/core/codegen/schemas/object.js.map +1 -1
  153. package/dist/core/codegen/schemas/optional.d.ts +9 -6
  154. package/dist/core/codegen/schemas/optional.d.ts.map +1 -1
  155. package/dist/core/codegen/schemas/optional.js +23 -31
  156. package/dist/core/codegen/schemas/optional.js.map +1 -1
  157. package/dist/core/codegen/schemas/pipe.d.ts +8 -5
  158. package/dist/core/codegen/schemas/pipe.d.ts.map +1 -1
  159. package/dist/core/codegen/schemas/pipe.js +20 -27
  160. package/dist/core/codegen/schemas/pipe.js.map +1 -1
  161. package/dist/core/codegen/schemas/readonly.d.ts +8 -5
  162. package/dist/core/codegen/schemas/readonly.d.ts.map +1 -1
  163. package/dist/core/codegen/schemas/readonly.js +8 -5
  164. package/dist/core/codegen/schemas/readonly.js.map +1 -1
  165. package/dist/core/codegen/schemas/record.d.ts +8 -5
  166. package/dist/core/codegen/schemas/record.d.ts.map +1 -1
  167. package/dist/core/codegen/schemas/record.js +52 -65
  168. package/dist/core/codegen/schemas/record.js.map +1 -1
  169. package/dist/core/codegen/schemas/recursive-ref.d.ts +9 -6
  170. package/dist/core/codegen/schemas/recursive-ref.d.ts.map +1 -1
  171. package/dist/core/codegen/schemas/recursive-ref.js +44 -44
  172. package/dist/core/codegen/schemas/recursive-ref.js.map +1 -1
  173. package/dist/core/codegen/schemas/set.d.ts +8 -5
  174. package/dist/core/codegen/schemas/set.d.ts.map +1 -1
  175. package/dist/core/codegen/schemas/set.js +61 -73
  176. package/dist/core/codegen/schemas/set.js.map +1 -1
  177. package/dist/core/codegen/schemas/string-bool.d.ts +6 -3
  178. package/dist/core/codegen/schemas/string-bool.d.ts.map +1 -1
  179. package/dist/core/codegen/schemas/string-bool.js +22 -23
  180. package/dist/core/codegen/schemas/string-bool.js.map +1 -1
  181. package/dist/core/codegen/schemas/string.d.ts +8 -5
  182. package/dist/core/codegen/schemas/string.d.ts.map +1 -1
  183. package/dist/core/codegen/schemas/string.js +168 -207
  184. package/dist/core/codegen/schemas/string.js.map +1 -1
  185. package/dist/core/codegen/schemas/symbol.d.ts +7 -4
  186. package/dist/core/codegen/schemas/symbol.d.ts.map +1 -1
  187. package/dist/core/codegen/schemas/symbol.js +8 -4
  188. package/dist/core/codegen/schemas/symbol.js.map +1 -1
  189. package/dist/core/codegen/schemas/template-literal.d.ts +7 -4
  190. package/dist/core/codegen/schemas/template-literal.d.ts.map +1 -1
  191. package/dist/core/codegen/schemas/template-literal.js +12 -13
  192. package/dist/core/codegen/schemas/template-literal.js.map +1 -1
  193. package/dist/core/codegen/schemas/tuple.d.ts +8 -5
  194. package/dist/core/codegen/schemas/tuple.d.ts.map +1 -1
  195. package/dist/core/codegen/schemas/tuple.js +84 -94
  196. package/dist/core/codegen/schemas/tuple.js.map +1 -1
  197. package/dist/core/codegen/schemas/undefined.d.ts +7 -4
  198. package/dist/core/codegen/schemas/undefined.d.ts.map +1 -1
  199. package/dist/core/codegen/schemas/undefined.js +8 -4
  200. package/dist/core/codegen/schemas/undefined.js.map +1 -1
  201. package/dist/core/codegen/schemas/union.d.ts +8 -5
  202. package/dist/core/codegen/schemas/union.d.ts.map +1 -1
  203. package/dist/core/codegen/schemas/union.js +49 -69
  204. package/dist/core/codegen/schemas/union.js.map +1 -1
  205. package/dist/core/codegen/schemas/unknown.d.ts +7 -4
  206. package/dist/core/codegen/schemas/unknown.d.ts.map +1 -1
  207. package/dist/core/codegen/schemas/unknown.js +8 -4
  208. package/dist/core/codegen/schemas/unknown.js.map +1 -1
  209. package/dist/core/codegen/schemas/void.d.ts +7 -4
  210. package/dist/core/codegen/schemas/void.d.ts.map +1 -1
  211. package/dist/core/codegen/schemas/void.js +8 -4
  212. package/dist/core/codegen/schemas/void.js.map +1 -1
  213. package/dist/core/codegen/slow-path.d.ts +7 -4
  214. package/dist/core/codegen/slow-path.d.ts.map +1 -1
  215. package/dist/core/codegen/slow-path.js +71 -96
  216. package/dist/core/codegen/slow-path.js.map +1 -1
  217. package/dist/core/codegen/well-known-regex.d.ts +22 -19
  218. package/dist/core/codegen/well-known-regex.d.ts.map +1 -1
  219. package/dist/core/codegen/well-known-regex.js +127 -96
  220. package/dist/core/codegen/well-known-regex.js.map +1 -1
  221. package/dist/core/compile.d.ts +7 -4
  222. package/dist/core/compile.d.ts.map +1 -1
  223. package/dist/core/compile.js +48 -48
  224. package/dist/core/compile.js.map +1 -1
  225. package/dist/core/diagnostic.d.ts +38 -39
  226. package/dist/core/diagnostic.d.ts.map +1 -1
  227. package/dist/core/diagnostic.js +140 -164
  228. package/dist/core/diagnostic.js.map +1 -1
  229. package/dist/core/extract/checks.d.ts +18 -15
  230. package/dist/core/extract/checks.d.ts.map +1 -1
  231. package/dist/core/extract/checks.js +318 -311
  232. package/dist/core/extract/checks.js.map +1 -1
  233. package/dist/core/extract/effects.d.ts +13 -10
  234. package/dist/core/extract/effects.d.ts.map +1 -1
  235. package/dist/core/extract/effects.js +153 -222
  236. package/dist/core/extract/effects.js.map +1 -1
  237. package/dist/core/extract/extractors/any.d.ts +5 -2
  238. package/dist/core/extract/extractors/any.d.ts.map +1 -1
  239. package/dist/core/extract/extractors/any.js +5 -1
  240. package/dist/core/extract/extractors/any.js.map +1 -1
  241. package/dist/core/extract/extractors/array.d.ts +6 -3
  242. package/dist/core/extract/extractors/array.d.ts.map +1 -1
  243. package/dist/core/extract/extractors/array.js +25 -20
  244. package/dist/core/extract/extractors/array.js.map +1 -1
  245. package/dist/core/extract/extractors/bigint.d.ts +6 -3
  246. package/dist/core/extract/extractors/bigint.d.ts.map +1 -1
  247. package/dist/core/extract/extractors/bigint.js +66 -64
  248. package/dist/core/extract/extractors/bigint.js.map +1 -1
  249. package/dist/core/extract/extractors/boolean.d.ts +5 -2
  250. package/dist/core/extract/extractors/boolean.d.ts.map +1 -1
  251. package/dist/core/extract/extractors/boolean.js +7 -3
  252. package/dist/core/extract/extractors/boolean.js.map +1 -1
  253. package/dist/core/extract/extractors/catch.d.ts +6 -3
  254. package/dist/core/extract/extractors/catch.d.ts.map +1 -1
  255. package/dist/core/extract/extractors/catch.js +26 -17
  256. package/dist/core/extract/extractors/catch.js.map +1 -1
  257. package/dist/core/extract/extractors/date.d.ts +6 -3
  258. package/dist/core/extract/extractors/date.d.ts.map +1 -1
  259. package/dist/core/extract/extractors/date.js +42 -46
  260. package/dist/core/extract/extractors/date.js.map +1 -1
  261. package/dist/core/extract/extractors/default.d.ts +6 -3
  262. package/dist/core/extract/extractors/default.d.ts.map +1 -1
  263. package/dist/core/extract/extractors/default.js +20 -14
  264. package/dist/core/extract/extractors/default.js.map +1 -1
  265. package/dist/core/extract/extractors/enum.d.ts +5 -2
  266. package/dist/core/extract/extractors/enum.d.ts.map +1 -1
  267. package/dist/core/extract/extractors/enum.js +12 -13
  268. package/dist/core/extract/extractors/enum.js.map +1 -1
  269. package/dist/core/extract/extractors/file.d.ts +6 -3
  270. package/dist/core/extract/extractors/file.d.ts.map +1 -1
  271. package/dist/core/extract/extractors/file.js +34 -28
  272. package/dist/core/extract/extractors/file.js.map +1 -1
  273. package/dist/core/extract/extractors/intersection.d.ts +5 -2
  274. package/dist/core/extract/extractors/intersection.d.ts.map +1 -1
  275. package/dist/core/extract/extractors/intersection.js +13 -11
  276. package/dist/core/extract/extractors/intersection.js.map +1 -1
  277. package/dist/core/extract/extractors/lazy.d.ts +6 -3
  278. package/dist/core/extract/extractors/lazy.d.ts.map +1 -1
  279. package/dist/core/extract/extractors/lazy.js +21 -30
  280. package/dist/core/extract/extractors/lazy.js.map +1 -1
  281. package/dist/core/extract/extractors/literal.d.ts +5 -2
  282. package/dist/core/extract/extractors/literal.d.ts.map +1 -1
  283. package/dist/core/extract/extractors/literal.js +8 -1
  284. package/dist/core/extract/extractors/literal.js.map +1 -1
  285. package/dist/core/extract/extractors/map.d.ts +6 -3
  286. package/dist/core/extract/extractors/map.d.ts.map +1 -1
  287. package/dist/core/extract/extractors/map.js +10 -4
  288. package/dist/core/extract/extractors/map.js.map +1 -1
  289. package/dist/core/extract/extractors/nan.d.ts +5 -2
  290. package/dist/core/extract/extractors/nan.d.ts.map +1 -1
  291. package/dist/core/extract/extractors/nan.js +5 -1
  292. package/dist/core/extract/extractors/nan.js.map +1 -1
  293. package/dist/core/extract/extractors/never.d.ts +5 -2
  294. package/dist/core/extract/extractors/never.d.ts.map +1 -1
  295. package/dist/core/extract/extractors/never.js +5 -1
  296. package/dist/core/extract/extractors/never.js.map +1 -1
  297. package/dist/core/extract/extractors/null.d.ts +5 -2
  298. package/dist/core/extract/extractors/null.d.ts.map +1 -1
  299. package/dist/core/extract/extractors/null.js +5 -1
  300. package/dist/core/extract/extractors/null.js.map +1 -1
  301. package/dist/core/extract/extractors/nullable.d.ts +5 -2
  302. package/dist/core/extract/extractors/nullable.d.ts.map +1 -1
  303. package/dist/core/extract/extractors/nullable.js +7 -3
  304. package/dist/core/extract/extractors/nullable.js.map +1 -1
  305. package/dist/core/extract/extractors/number.d.ts +6 -3
  306. package/dist/core/extract/extractors/number.d.ts.map +1 -1
  307. package/dist/core/extract/extractors/number.js +35 -35
  308. package/dist/core/extract/extractors/number.js.map +1 -1
  309. package/dist/core/extract/extractors/object.d.ts +6 -3
  310. package/dist/core/extract/extractors/object.d.ts.map +1 -1
  311. package/dist/core/extract/extractors/object.js +49 -76
  312. package/dist/core/extract/extractors/object.js.map +1 -1
  313. package/dist/core/extract/extractors/optional.d.ts +5 -2
  314. package/dist/core/extract/extractors/optional.d.ts.map +1 -1
  315. package/dist/core/extract/extractors/optional.js +10 -12
  316. package/dist/core/extract/extractors/optional.js.map +1 -1
  317. package/dist/core/extract/extractors/pipe.d.ts +6 -3
  318. package/dist/core/extract/extractors/pipe.d.ts.map +1 -1
  319. package/dist/core/extract/extractors/pipe.js +40 -41
  320. package/dist/core/extract/extractors/pipe.js.map +1 -1
  321. package/dist/core/extract/extractors/readonly.d.ts +5 -2
  322. package/dist/core/extract/extractors/readonly.d.ts.map +1 -1
  323. package/dist/core/extract/extractors/readonly.js +10 -6
  324. package/dist/core/extract/extractors/readonly.js.map +1 -1
  325. package/dist/core/extract/extractors/record.d.ts +6 -3
  326. package/dist/core/extract/extractors/record.d.ts.map +1 -1
  327. package/dist/core/extract/extractors/record.js +24 -35
  328. package/dist/core/extract/extractors/record.js.map +1 -1
  329. package/dist/core/extract/extractors/set.d.ts +6 -3
  330. package/dist/core/extract/extractors/set.d.ts.map +1 -1
  331. package/dist/core/extract/extractors/set.js +36 -30
  332. package/dist/core/extract/extractors/set.js.map +1 -1
  333. package/dist/core/extract/extractors/string-bool.d.ts +7 -4
  334. package/dist/core/extract/extractors/string-bool.d.ts.map +1 -1
  335. package/dist/core/extract/extractors/string-bool.js +66 -84
  336. package/dist/core/extract/extractors/string-bool.js.map +1 -1
  337. package/dist/core/extract/extractors/string.d.ts +6 -3
  338. package/dist/core/extract/extractors/string.d.ts.map +1 -1
  339. package/dist/core/extract/extractors/string.js +34 -37
  340. package/dist/core/extract/extractors/string.js.map +1 -1
  341. package/dist/core/extract/extractors/symbol.d.ts +5 -2
  342. package/dist/core/extract/extractors/symbol.d.ts.map +1 -1
  343. package/dist/core/extract/extractors/symbol.js +5 -1
  344. package/dist/core/extract/extractors/symbol.js.map +1 -1
  345. package/dist/core/extract/extractors/template-literal.d.ts +6 -3
  346. package/dist/core/extract/extractors/template-literal.d.ts.map +1 -1
  347. package/dist/core/extract/extractors/template-literal.js +11 -6
  348. package/dist/core/extract/extractors/template-literal.js.map +1 -1
  349. package/dist/core/extract/extractors/tuple.d.ts +6 -3
  350. package/dist/core/extract/extractors/tuple.d.ts.map +1 -1
  351. package/dist/core/extract/extractors/tuple.js +10 -4
  352. package/dist/core/extract/extractors/tuple.js.map +1 -1
  353. package/dist/core/extract/extractors/undefined.d.ts +5 -2
  354. package/dist/core/extract/extractors/undefined.d.ts.map +1 -1
  355. package/dist/core/extract/extractors/undefined.js +5 -1
  356. package/dist/core/extract/extractors/undefined.js.map +1 -1
  357. package/dist/core/extract/extractors/union.d.ts +6 -3
  358. package/dist/core/extract/extractors/union.d.ts.map +1 -1
  359. package/dist/core/extract/extractors/union.js +38 -64
  360. package/dist/core/extract/extractors/union.js.map +1 -1
  361. package/dist/core/extract/extractors/unknown.d.ts +5 -2
  362. package/dist/core/extract/extractors/unknown.d.ts.map +1 -1
  363. package/dist/core/extract/extractors/unknown.js +5 -1
  364. package/dist/core/extract/extractors/unknown.js.map +1 -1
  365. package/dist/core/extract/extractors/void.d.ts +5 -2
  366. package/dist/core/extract/extractors/void.d.ts.map +1 -1
  367. package/dist/core/extract/extractors/void.js +5 -1
  368. package/dist/core/extract/extractors/void.js.map +1 -1
  369. package/dist/core/extract/fallback.d.ts +6 -3
  370. package/dist/core/extract/fallback.d.ts.map +1 -1
  371. package/dist/core/extract/fallback.js +21 -7
  372. package/dist/core/extract/fallback.js.map +1 -1
  373. package/dist/core/extract/index.d.ts +6 -4
  374. package/dist/core/extract/index.d.ts.map +1 -1
  375. package/dist/core/extract/index.js +15 -15
  376. package/dist/core/extract/index.js.map +1 -1
  377. package/dist/core/extract/registry.d.ts +39 -36
  378. package/dist/core/extract/registry.d.ts.map +1 -1
  379. package/dist/core/extract/registry.js +96 -123
  380. package/dist/core/extract/registry.js.map +1 -1
  381. package/dist/core/extract/types.d.ts +124 -120
  382. package/dist/core/extract/types.d.ts.map +1 -1
  383. package/dist/core/extract/types.js +0 -1
  384. package/dist/core/iife.d.ts +14 -15
  385. package/dist/core/iife.d.ts.map +1 -1
  386. package/dist/core/iife.js +182 -206
  387. package/dist/core/iife.js.map +1 -1
  388. package/dist/core/pipeline.d.ts +33 -30
  389. package/dist/core/pipeline.d.ts.map +1 -1
  390. package/dist/core/pipeline.js +67 -74
  391. package/dist/core/pipeline.js.map +1 -1
  392. package/dist/core/types.d.ts +430 -427
  393. package/dist/core/types.d.ts.map +1 -1
  394. package/dist/core/types.js +0 -5
  395. package/dist/discovery.d.ts +8 -5
  396. package/dist/discovery.d.ts.map +1 -1
  397. package/dist/discovery.js +31 -32
  398. package/dist/discovery.js.map +1 -1
  399. package/dist/index.d.ts +4 -4
  400. package/dist/index.js +2 -2
  401. package/dist/jit.d.ts +15 -42
  402. package/dist/jit.d.ts.map +1 -1
  403. package/dist/jit.js +187 -216
  404. package/dist/jit.js.map +1 -1
  405. package/dist/loader.d.ts +14 -11
  406. package/dist/loader.d.ts.map +1 -1
  407. package/dist/loader.js +226 -258
  408. package/dist/loader.js.map +1 -1
  409. package/dist/static-filter.d.ts +4 -1
  410. package/dist/static-filter.d.ts.map +1 -1
  411. package/dist/static-filter.js +240 -367
  412. package/dist/static-filter.js.map +1 -1
  413. package/dist/swc.d.ts +38 -35
  414. package/dist/swc.d.ts.map +1 -1
  415. package/dist/swc.js +83 -76
  416. package/dist/swc.js.map +1 -1
  417. package/dist/unplugin/bun.d.ts +5 -2
  418. package/dist/unplugin/bun.d.ts.map +1 -1
  419. package/dist/unplugin/bun.js +5 -1
  420. package/dist/unplugin/bun.js.map +1 -1
  421. package/dist/unplugin/dep-graph.d.ts +10 -7
  422. package/dist/unplugin/dep-graph.d.ts.map +1 -1
  423. package/dist/unplugin/dep-graph.js +216 -252
  424. package/dist/unplugin/dep-graph.js.map +1 -1
  425. package/dist/unplugin/disk-cache.d.ts +121 -92
  426. package/dist/unplugin/disk-cache.d.ts.map +1 -1
  427. package/dist/unplugin/disk-cache.js +425 -444
  428. package/dist/unplugin/disk-cache.js.map +1 -1
  429. package/dist/unplugin/edits.d.ts +15 -12
  430. package/dist/unplugin/edits.d.ts.map +1 -1
  431. package/dist/unplugin/edits.js +24 -37
  432. package/dist/unplugin/edits.js.map +1 -1
  433. package/dist/unplugin/esbuild.d.ts +5 -2
  434. package/dist/unplugin/esbuild.d.ts.map +1 -1
  435. package/dist/unplugin/esbuild.js +5 -1
  436. package/dist/unplugin/esbuild.js.map +1 -1
  437. package/dist/unplugin/farm.d.ts +5 -2
  438. package/dist/unplugin/farm.d.ts.map +1 -1
  439. package/dist/unplugin/farm.js +5 -1
  440. package/dist/unplugin/farm.js.map +1 -1
  441. package/dist/unplugin/hoist-compile.d.ts +14 -42
  442. package/dist/unplugin/hoist-compile.d.ts.map +1 -1
  443. package/dist/unplugin/hoist-compile.js +67 -112
  444. package/dist/unplugin/hoist-compile.js.map +1 -1
  445. package/dist/unplugin/hoist.d.ts +56 -54
  446. package/dist/unplugin/hoist.d.ts.map +1 -1
  447. package/dist/unplugin/hoist.js +945 -1170
  448. package/dist/unplugin/hoist.js.map +1 -1
  449. package/dist/unplugin/index.d.ts +5 -3
  450. package/dist/unplugin/index.d.ts.map +1 -1
  451. package/dist/unplugin/index.js +175 -250
  452. package/dist/unplugin/index.js.map +1 -1
  453. package/dist/unplugin/rolldown.d.ts +5 -2
  454. package/dist/unplugin/rolldown.d.ts.map +1 -1
  455. package/dist/unplugin/rolldown.js +5 -1
  456. package/dist/unplugin/rolldown.js.map +1 -1
  457. package/dist/unplugin/rollup.d.ts +5 -2
  458. package/dist/unplugin/rollup.d.ts.map +1 -1
  459. package/dist/unplugin/rollup.js +5 -1
  460. package/dist/unplugin/rollup.js.map +1 -1
  461. package/dist/unplugin/rsbuild.d.ts +6 -3
  462. package/dist/unplugin/rsbuild.d.ts.map +1 -1
  463. package/dist/unplugin/rsbuild.js +15 -11
  464. package/dist/unplugin/rsbuild.js.map +1 -1
  465. package/dist/unplugin/rspack.d.ts +5 -2
  466. package/dist/unplugin/rspack.d.ts.map +1 -1
  467. package/dist/unplugin/rspack.js +5 -1
  468. package/dist/unplugin/rspack.js.map +1 -1
  469. package/dist/unplugin/transform.d.ts +30 -27
  470. package/dist/unplugin/transform.d.ts.map +1 -1
  471. package/dist/unplugin/transform.js +433 -620
  472. package/dist/unplugin/transform.js.map +1 -1
  473. package/dist/unplugin/types.d.ts +189 -184
  474. package/dist/unplugin/types.d.ts.map +1 -1
  475. package/dist/unplugin/types.js +22 -18
  476. package/dist/unplugin/types.js.map +1 -1
  477. package/dist/unplugin/virtual.d.ts +11 -8
  478. package/dist/unplugin/virtual.d.ts.map +1 -1
  479. package/dist/unplugin/virtual.js +65 -83
  480. package/dist/unplugin/virtual.js.map +1 -1
  481. package/dist/unplugin/vite.d.ts +5 -2
  482. package/dist/unplugin/vite.d.ts.map +1 -1
  483. package/dist/unplugin/vite.js +5 -1
  484. package/dist/unplugin/vite.js.map +1 -1
  485. package/dist/unplugin/webpack.d.ts +5 -2
  486. package/dist/unplugin/webpack.d.ts.map +1 -1
  487. package/dist/unplugin/webpack.js +5 -1
  488. package/dist/unplugin/webpack.js.map +1 -1
  489. package/package.json +23 -14
  490. package/dist/cli/index.d.ts.map +0 -1
  491. package/dist/core/extract/types.js.map +0 -1
  492. package/dist/core/types.js.map +0 -1
  493. package/dist/index.d.ts.map +0 -1
  494. package/dist/index.js.map +0 -1
@@ -1,201 +1,202 @@
1
- import type { BigIntCheckIR, CheckIR, DateCheckIR, SchemaIR, SetCheckIR } from "../types.js";
2
- import type { SharedSchemaPlan } from "./dedupe.js";
1
+ import { BigIntCheckIR, CheckIR, DateCheckIR, SchemaIR, SetCheckIR } from "../types.js";
2
+ import { SharedSchemaPlan } from "./dedupe.js";
3
+ //#region src/core/codegen/context.d.ts
3
4
  /** Codegen output mode. "inline" emits self-contained code (CLI .compiled.ts). "lean" emits references to imports from "virtual:zod-compiler/runtime" (unplugin). */
4
- export type CodegenMode = "inline" | "lean";
5
- export interface CodeGenResult {
6
- code: string;
7
- functionDef: string;
8
- /** Number of fallback schemas referenced by __rf[N] in the generated code. 0 = no fallbacks. */
9
- refCount: number;
10
- /**
11
- * Helper names referenced by this schema in lean mode (e.g. "__zcTS", "__zcReEmail").
12
- * Used by the unplugin transform to construct the `import { ... } from "virtual:zod-compiler/runtime"` line.
13
- * Always empty in inline mode.
14
- */
15
- usedHelpers: Set<string>;
16
- /**
17
- * Name of the hosted fast-check boolean function in the preamble (null when
18
- * the schema has no Fast Path). generateIIFE passes it to __zcMkv so parse()
19
- * and parseAsync() can return valid input without allocating an
20
- * intermediate SafeParseResult.
21
- */
22
- fastFnName: string | null;
23
- /**
24
- * True when `fastFnName` is a TOTAL predicate: `fc(input) === true` iff the
25
- * schema accepts `input` (mutation-free schemas, where a fast-check failure
26
- * can never become a slow-path success). generateIIFE installs it as the
27
- * zero-allocation `.is()` guard. False for partial fast paths
28
- * (default/catch/coerce — `fc` only shortcuts present-and-valid input, so a
29
- * `false` result does NOT imply rejection) and for schemas with no fast path;
30
- * `.is()` then derives from `safeParse(input).success`.
31
- */
32
- fastTotal: boolean;
33
- /**
34
- * Hosted predicate installed as `.is()`, when it differs from `fastFnName`.
35
- * A schema that rebuilds its output has no by-reference shortcut (so
36
- * `fastFnName` is null) yet still has an exact acceptance predicate, because
37
- * stripping reshapes the payload and never the verdict.
38
- */
39
- isFnName?: string | null;
40
- /**
41
- * Compact mode only: the `__rf[N]` index this validator delegates its cold
42
- * error path to (the schema itself, captured as a fresh root RefEntry). When
43
- * set, the pipeline appends a `{ schema, accessPath: "" }` entry at this index
44
- * so `generateIIFE` materializes `__rf[N]` as the original Zod schema. Absent
45
- * for every non-compact (fully compiled) validator.
46
- */
47
- rootDelegateRefIndex?: number;
5
+ type CodegenMode = "inline" | "lean";
6
+ interface CodeGenResult {
7
+ code: string;
8
+ functionDef: string;
9
+ /** Number of fallback schemas referenced by __rf[N] in the generated code. 0 = no fallbacks. */
10
+ refCount: number;
11
+ /**
12
+ * Helper names referenced by this schema in lean mode (e.g. "__zcTS", "__zcReEmail").
13
+ * Used by the unplugin transform to construct the `import { ... } from "virtual:zod-compiler/runtime"` line.
14
+ * Always empty in inline mode.
15
+ */
16
+ usedHelpers: Set<string>;
17
+ /**
18
+ * Name of the hosted fast-check boolean function in the preamble (null when
19
+ * the schema has no Fast Path). generateIIFE passes it to __zcMkv so parse()
20
+ * and parseAsync() can return valid input without allocating an
21
+ * intermediate SafeParseResult.
22
+ */
23
+ fastFnName: string | null;
24
+ /**
25
+ * True when `fastFnName` is a TOTAL predicate: `fc(input) === true` iff the
26
+ * schema accepts `input` (mutation-free schemas, where a fast-check failure
27
+ * can never become a slow-path success). generateIIFE installs it as the
28
+ * zero-allocation `.is()` guard. False for partial fast paths
29
+ * (default/catch — `fc` only shortcuts present-and-valid input, so a `false`
30
+ * result does NOT imply rejection) and for schemas with no fast path, such as
31
+ * coercion; `.is()` then derives from `safeParse(input).success`.
32
+ */
33
+ fastTotal: boolean;
34
+ /**
35
+ * Hosted predicate installed as `.is()`, when it differs from `fastFnName`.
36
+ * A schema that rebuilds its output has no by-reference shortcut (so
37
+ * `fastFnName` is null) yet still has an exact acceptance predicate, because
38
+ * stripping reshapes the payload and never the verdict.
39
+ */
40
+ isFnName?: string | null;
41
+ /**
42
+ * Compact mode only: the `__rf[N]` index this validator delegates its cold
43
+ * error path to (the schema itself, captured as a fresh root RefEntry). When
44
+ * set, the pipeline appends a `{ schema, accessPath: "" }` entry at this index
45
+ * so `generateIIFE` materializes `__rf[N]` as the original Zod schema. Absent
46
+ * for every non-compact (fully compiled) validator.
47
+ */
48
+ rootDelegateRefIndex?: number;
48
49
  }
49
50
  /** Hosted-validator names for one recursion target (see CodeGenContext.recTargets). */
50
- export interface RecTargetGen {
51
- /** True for the root target (refId 0) — reuses the schema's own functions. */
52
- isRoot: boolean;
53
- /**
54
- * safeParse-shaped slow validator name: `safeParse_<name>` for the root,
55
- * `__rsp_N` for a non-root target. `slowRecursiveRef` calls this.
56
- */
57
- slowName: string;
58
- /**
59
- * Boolean fast-check name (`__fcr_N`). Allocated lazily for the root (mirrors
60
- * recFastName), eagerly for non-root targets. Absent until the fast path
61
- * reaches a ref to this target.
62
- */
63
- fastName?: string;
64
- /** Inner IR hosted as the standalone validator body (non-root targets only). */
65
- inner?: SchemaIR;
51
+ interface RecTargetGen {
52
+ /** True for the root target (refId 0) — reuses the schema's own functions. */
53
+ isRoot: boolean;
54
+ /**
55
+ * safeParse-shaped slow validator name: `safeParse_<name>` for the root,
56
+ * `__rsp_N` for a non-root target. `slowRecursiveRef` calls this.
57
+ */
58
+ slowName: string;
59
+ /**
60
+ * Boolean fast-check name (`__fcr_N`). Allocated lazily for the root (mirrors
61
+ * recFastName), eagerly for non-root targets. Absent until the fast path
62
+ * reaches a ref to this target.
63
+ */
64
+ fastName?: string;
65
+ /** Inner IR hosted as the standalone validator body (non-root targets only). */
66
+ inner?: SchemaIR;
66
67
  }
67
68
  /** Shared mutable state for code generation. Fast and slow paths share the same instance. */
68
- export interface CodeGenContext {
69
- preamble: string[];
70
- counter: number;
71
- fnName: string;
72
- /** Deduplicates regex patterns: same pattern string → same preamble variable name. */
73
- regexCache: Map<string, string>;
74
- /** Codegen output mode. */
75
- mode: CodegenMode;
76
- /** Names of helpers from "virtual:zod-compiler/runtime" referenced in this schema (lean mode only). */
77
- usedHelpers: Set<string>;
78
- /**
79
- * Name of the fast-path boolean helper for the ROOT recursion target
80
- * (refId 0), allocated on first fastRecursiveRef visit. generateValidator
81
- * wraps the root fast expression as `function <name>(input){return <expr>;}`
82
- * so recursive refs can call it. undefined = root has no recursion on the
83
- * fast path.
84
- */
85
- recFastName?: string;
86
- /**
87
- * Hosted-validator name table for recursion targets, keyed by refId. Entry 0
88
- * is the root (the schema's own `safeParse_<name>` / `recFastName`); entries
89
- * ≥ 1 are non-root targets hosted as standalone `__rsp_N` (slow) / `__fcr_N`
90
- * (fast) helpers. `recursiveRef`/`recursionTarget` generators look up the
91
- * call target here. Undefined when not generating a full validator (e.g. unit
92
- * tests calling a single generator) — treated as root-only.
93
- */
94
- recTargets?: Map<number, RecTargetGen>;
95
- /** Dedup cache for hosted zero-capture effect functions: source text → preamble var. */
96
- effectFnCache?: Map<string, string>;
97
- /** Dedup cache for constant preamble declarations: initializer text → preamble var. */
98
- valueCache?: Map<string, string>;
99
- /** Name of the build path's FAIL sentinel, declared once per validator. */
100
- buildFailName?: string;
101
- /** Hosted build-function name per recursion target refId, so back-edges resolve. */
102
- buildRecNames?: Map<number, string>;
103
- /**
104
- * Set by the build path when it emitted a `.default()` substitution. Such a
105
- * schema ACCEPTS an input its fast expression rejects — `fastDefault` demands a
106
- * present value, since the fast path's contract is `data === input` and a
107
- * substituted default is not the input — so the expression is no longer an
108
- * exact acceptance predicate and must not be installed as `.is()`. Stripping,
109
- * by contrast, reshapes only the payload, which is why a build-path schema
110
- * otherwise still hands its predicate over.
111
- */
112
- buildSubstitutesValue?: boolean;
113
- /** Memo for estimateFastCost (size-gated fast-check extraction). Lazily created. */
114
- fastSizeCache?: WeakMap<SchemaIR, number>;
115
- /** Memo for estimateRuntimeCost (cheapest-first check ordering). Lazily created. */
116
- fastRuntimeCostCache?: WeakMap<SchemaIR, number>;
117
- /**
118
- * File-level shared slow-walk plan. Set only when generating a mutation-free
119
- * schema (so shared walks stay on the deferred cold path); the slow-path
120
- * visit() consults it to replace a repeated sub-IR with a `__zcSw_N` call.
121
- */
122
- sharedSchemas?: SharedSchemaPlan;
69
+ interface CodeGenContext {
70
+ preamble: string[];
71
+ counter: number;
72
+ fnName: string;
73
+ /** Deduplicates regex patterns: same pattern string → same preamble variable name. */
74
+ regexCache: Map<string, string>;
75
+ /** Codegen output mode. */
76
+ mode: CodegenMode;
77
+ /** Names of helpers from "virtual:zod-compiler/runtime" referenced in this schema (lean mode only). */
78
+ usedHelpers: Set<string>;
79
+ /**
80
+ * Name of the fast-path boolean helper for the ROOT recursion target
81
+ * (refId 0), allocated on first fastRecursiveRef visit. generateValidator
82
+ * wraps the root fast expression as `function <name>(input){return <expr>;}`
83
+ * so recursive refs can call it. undefined = root has no recursion on the
84
+ * fast path.
85
+ */
86
+ recFastName?: string;
87
+ /**
88
+ * Hosted-validator name table for recursion targets, keyed by refId. Entry 0
89
+ * is the root (the schema's own `safeParse_<name>` / `recFastName`); entries
90
+ * ≥ 1 are non-root targets hosted as standalone `__rsp_N` (slow) / `__fcr_N`
91
+ * (fast) helpers. `recursiveRef`/`recursionTarget` generators look up the
92
+ * call target here. Undefined when not generating a full validator (e.g. unit
93
+ * tests calling a single generator) — treated as root-only.
94
+ */
95
+ recTargets?: Map<number, RecTargetGen>;
96
+ /** Dedup cache for hosted zero-capture effect functions: source text → preamble var. */
97
+ effectFnCache?: Map<string, string>;
98
+ /** Dedup cache for constant preamble declarations: initializer text → preamble var. */
99
+ valueCache?: Map<string, string>;
100
+ /** Name of the build path's FAIL sentinel, declared once per validator. */
101
+ buildFailName?: string;
102
+ /** Hosted build-function name per recursion target refId, so back-edges resolve. */
103
+ buildRecNames?: Map<number, string>;
104
+ /**
105
+ * Set by the build path when it emitted a `.default()` substitution. Such a
106
+ * schema ACCEPTS an input its fast expression rejects — `fastDefault` demands a
107
+ * present value, since the fast path's contract is `data === input` and a
108
+ * substituted default is not the input — so the expression is no longer an
109
+ * exact acceptance predicate and must not be installed as `.is()`. Stripping,
110
+ * by contrast, reshapes only the payload, which is why a build-path schema
111
+ * otherwise still hands its predicate over.
112
+ */
113
+ buildSubstitutesValue?: boolean;
114
+ /** Memo for estimateFastCost (size-gated fast-check extraction). Lazily created. */
115
+ fastSizeCache?: WeakMap<SchemaIR, number>;
116
+ /** Memo for estimateRuntimeCost (cheapest-first check ordering). Lazily created. */
117
+ fastRuntimeCostCache?: WeakMap<SchemaIR, number>;
118
+ /**
119
+ * File-level shared slow-walk plan. Set only when generating a mutation-free
120
+ * schema (so shared walks stay on the deferred cold path); the slow-path
121
+ * visit() consults it to replace a repeated sub-IR with a `__zcSw_N` call.
122
+ */
123
+ sharedSchemas?: SharedSchemaPlan;
123
124
  }
124
125
  /** Context object for slow-path (error-collecting) generator functions. */
125
- export interface SlowGen {
126
- readonly input: string;
127
- readonly output: string;
128
- readonly path: string;
129
- readonly issues: string;
130
- readonly ctx: CodeGenContext;
131
- /**
132
- * Schema-level static error message of the node being generated
133
- * (z.string({ error: "..." })). Default message for issues this node emits
134
- * when the individual check has no message of its own. Set by generateSlow()
135
- * from ir.typeMessage; never inherited by child nodes.
136
- */
137
- readonly typeMsg?: string | undefined;
138
- /**
139
- * Name of a boolean variable that this node sets to `true` when it aborts in
140
- * the zod sense (`payload.aborted`) — currently only a pipe/codec whose `in`
141
- * step fails (zod's `handlePipeResult` sets `left.aborted = true`). A `union`
142
- * allocates one per option and reads it during pruning so a pipe option whose
143
- * `in` failed counts as aborted even when its only issue is a non-aborting
144
- * `custom`/check-level code. Undefined when the node is not inside an
145
- * abort-tracking option, in which case the abort is a no-op.
146
- *
147
- * Unlike input/output/path/issues, this is NOT inherited by `visit()`: it is
148
- * cleared at every boundary unless a node explicitly forwards it (the
149
- * pass-through wrappers optional/nullable/readonly do), mirroring how zod
150
- * propagates `payload.aborted` through transparent wrappers but not across
151
- * container boundaries.
152
- */
153
- readonly aborted?: string | undefined;
154
- /**
155
- * Recursively generate validation for a child IR node.
156
- * input/output/path/issues are inherited from parent unless overridden;
157
- * `aborted` is the exception — it is only set when explicitly passed (see the
158
- * `aborted` field doc), so it never leaks into container children.
159
- * Union generators use `{ issues }` to redirect child errors to temporary arrays.
160
- * Container generators use `{ input, output, path }` for element traversal.
161
- */
162
- visit(ir: SchemaIR, overrides?: {
163
- input?: string;
164
- output?: string;
165
- path?: string;
166
- issues?: string;
167
- aborted?: string | undefined;
168
- }): string;
169
- /** Generate a unique temp variable name: `__${prefix}_${counter++}` */
170
- temp(prefix: string): string;
171
- /** Add a regex to preamble and return the variable name. */
172
- regex(prefix: string, pattern: string, flags?: string): string;
173
- /** Add a Set to preamble and return the variable name. */
174
- set(prefix: string, values: readonly unknown[]): string;
126
+ interface SlowGen {
127
+ readonly input: string;
128
+ readonly output: string;
129
+ readonly path: string;
130
+ readonly issues: string;
131
+ readonly ctx: CodeGenContext;
132
+ /**
133
+ * Schema-level static error message of the node being generated
134
+ * (z.string({ error: "..." })). Default message for issues this node emits
135
+ * when the individual check has no message of its own. Set by generateSlow()
136
+ * from ir.typeMessage; never inherited by child nodes.
137
+ */
138
+ readonly typeMsg?: string | undefined;
139
+ /**
140
+ * Name of a boolean variable that this node sets to `true` when it aborts in
141
+ * the zod sense (`payload.aborted`) — currently only a pipe/codec whose `in`
142
+ * step fails (zod's `handlePipeResult` sets `left.aborted = true`). A `union`
143
+ * allocates one per option and reads it during pruning so a pipe option whose
144
+ * `in` failed counts as aborted even when its only issue is a non-aborting
145
+ * `custom`/check-level code. Undefined when the node is not inside an
146
+ * abort-tracking option, in which case the abort is a no-op.
147
+ *
148
+ * Unlike input/output/path/issues, this is NOT inherited by `visit()`: it is
149
+ * cleared at every boundary unless a node explicitly forwards it (the
150
+ * pass-through wrappers optional/nullable/readonly do), mirroring how zod
151
+ * propagates `payload.aborted` through transparent wrappers but not across
152
+ * container boundaries.
153
+ */
154
+ readonly aborted?: string | undefined;
155
+ /**
156
+ * Recursively generate validation for a child IR node.
157
+ * input/output/path/issues are inherited from parent unless overridden;
158
+ * `aborted` is the exception — it is only set when explicitly passed (see the
159
+ * `aborted` field doc), so it never leaks into container children.
160
+ * Union generators use `{ issues }` to redirect child errors to temporary arrays.
161
+ * Container generators use `{ input, output, path }` for element traversal.
162
+ */
163
+ visit(ir: SchemaIR, overrides?: {
164
+ input?: string;
165
+ output?: string;
166
+ path?: string;
167
+ issues?: string;
168
+ aborted?: string | undefined;
169
+ }): string;
170
+ /** Generate a unique temp variable name: `__${prefix}_${counter++}` */
171
+ temp(prefix: string): string;
172
+ /** Add a regex to preamble and return the variable name. */
173
+ regex(prefix: string, pattern: string, flags?: string): string;
174
+ /** Add a Set to preamble and return the variable name. */
175
+ set(prefix: string, values: readonly unknown[]): string;
175
176
  }
176
177
  /** Slow-path generator function signature — registered in slowRegistry. */
177
- export type SlowGenerator<T extends SchemaIR = SchemaIR> = (ir: T, g: SlowGen) => string;
178
+ type SlowGenerator<T extends SchemaIR = SchemaIR> = (ir: T, g: SlowGen) => string;
178
179
  /**
179
180
  * Per-emitted-function size accumulator for size-gated fast-check extraction.
180
181
  * Shared by every node inlined into the same function; a fresh instance starts
181
182
  * each hosted helper (and the root). See fast-size.ts / generateFast.
182
183
  */
183
- export interface FastScope {
184
- used: number;
185
- /**
186
- * `var` temps that the function this scope is assembling must declare, in
187
- * allocation order. Populated by {@link FastGen.local}; every site that
188
- * materializes a function body from a fresh scope emits
189
- * {@link declareFastTemps} at the top of that body.
190
- *
191
- * Function-scoped (never module-scoped) is load-bearing: a recursive
192
- * validator re-enters itself while an outer frame still holds a live temp,
193
- * and each invocation needs its own binding.
194
- */
195
- temps: string[];
184
+ interface FastScope {
185
+ used: number;
186
+ /**
187
+ * `var` temps that the function this scope is assembling must declare, in
188
+ * allocation order. Populated by {@link FastGen.local}; every site that
189
+ * materializes a function body from a fresh scope emits
190
+ * {@link declareFastTemps} at the top of that body.
191
+ *
192
+ * Function-scoped (never module-scoped) is load-bearing: a recursive
193
+ * validator re-enters itself while an outer frame still holds a live temp,
194
+ * and each invocation needs its own binding.
195
+ */
196
+ temps: string[];
196
197
  }
197
198
  /** `var a,b;` declaration for a scope's temps, or "" when it allocated none. */
198
- export declare function declareFastTemps(scope: FastScope): string;
199
+ declare function declareFastTemps(scope: FastScope): string;
199
200
  /**
200
201
  * Fast check for a wrapper that compares its input against a sentinel and
201
202
  * otherwise delegates to an inner schema — `optional` (`===undefined`),
@@ -215,59 +216,59 @@ export declare function declareFastTemps(scope: FastScope): string;
215
216
  * element variable, a record value) is already a single load, so it keeps the
216
217
  * shorter form and byte-identical output.
217
218
  */
218
- export declare function fastSentinelWrapper(g: FastGen, innerIR: SchemaIR, sentinel: string, joiner: "&&" | "||"): string | null;
219
+ declare function fastSentinelWrapper(g: FastGen, innerIR: SchemaIR, sentinel: string, joiner: "&&" | "||"): string | null;
219
220
  /** Context object for fast-path (boolean expression) generator functions. */
220
- export interface FastGen {
221
- readonly input: string;
222
- readonly ctx: CodeGenContext;
223
- /**
224
- * Whether the CURRENT node may be hoisted into its own boolean helper when it
225
- * (with the already-emitted siblings) would overflow the function size cap.
226
- * False for the root and for a helper's own top node — those are already their
227
- * own function — but their children are extractable. See generateFast.
228
- */
229
- readonly extractable: boolean;
230
- /** Accumulated size (≈ chars) of the function currently being assembled. */
231
- readonly scope: FastScope;
232
- /**
233
- * Set on the gen for a discriminated-union option only: the discriminator
234
- * key. Signals `fastObject` to omit its type-guard and skip re-checking that
235
- * property (the switch already matched its value). Never propagated to child
236
- * nodes — nested objects keep their own guard.
237
- */
238
- readonly discSkipKey?: string | undefined;
239
- /**
240
- * Recursively generate fast-check expression for a child IR node.
241
- * Returns null if any child is ineligible for fast path.
242
- */
243
- visit(ir: SchemaIR, overrides?: {
244
- input?: string;
245
- discSkipKey?: string;
246
- }): string | null;
247
- /**
248
- * A FastGen for emitting a SEPARATE function body (a hand-built preamble
249
- * helper such as a discriminated-union switch or an array-element loop). It
250
- * carries a FRESH size accumulator, so the helper's own content is size-gated
251
- * against the cap independently of the caller — without this, a helper's body
252
- * accrues to the caller's scope while the helper itself grows unbounded.
253
- */
254
- scoped(input: string): FastGen;
255
- /** Generate a unique temp variable name. */
256
- temp(prefix: string): string;
257
- /**
258
- * Allocate a unique name AND record it on this scope so the enclosing
259
- * emitted function declares it as a `var` (see {@link FastScope.temps}).
260
- * Use for a value bound inside an expression — `(t=x["k"])===undefined` —
261
- * where `temp()` alone would leave the name undeclared.
262
- */
263
- local(prefix: string): string;
264
- /** Add a regex to preamble and return the variable name. */
265
- regex(prefix: string, pattern: string, flags?: string): string;
221
+ interface FastGen {
222
+ readonly input: string;
223
+ readonly ctx: CodeGenContext;
224
+ /**
225
+ * Whether the CURRENT node may be hoisted into its own boolean helper when it
226
+ * (with the already-emitted siblings) would overflow the function size cap.
227
+ * False for the root and for a helper's own top node — those are already their
228
+ * own function — but their children are extractable. See generateFast.
229
+ */
230
+ readonly extractable: boolean;
231
+ /** Accumulated size (≈ chars) of the function currently being assembled. */
232
+ readonly scope: FastScope;
233
+ /**
234
+ * Set on the gen for a discriminated-union option only: the discriminator
235
+ * key. Signals `fastObject` to omit its type-guard and skip re-checking that
236
+ * property (the switch already matched its value). Never propagated to child
237
+ * nodes — nested objects keep their own guard.
238
+ */
239
+ readonly discSkipKey?: string | undefined;
240
+ /**
241
+ * Recursively generate fast-check expression for a child IR node.
242
+ * Returns null if any child is ineligible for fast path.
243
+ */
244
+ visit(ir: SchemaIR, overrides?: {
245
+ input?: string;
246
+ discSkipKey?: string;
247
+ }): string | null;
248
+ /**
249
+ * A FastGen for emitting a SEPARATE function body (a hand-built preamble
250
+ * helper such as a discriminated-union switch or an array-element loop). It
251
+ * carries a FRESH size accumulator, so the helper's own content is size-gated
252
+ * against the cap independently of the caller — without this, a helper's body
253
+ * accrues to the caller's scope while the helper itself grows unbounded.
254
+ */
255
+ scoped(input: string): FastGen;
256
+ /** Generate a unique temp variable name. */
257
+ temp(prefix: string): string;
258
+ /**
259
+ * Allocate a unique name AND record it on this scope so the enclosing
260
+ * emitted function declares it as a `var` (see {@link FastScope.temps}).
261
+ * Use for a value bound inside an expression — `(t=x["k"])===undefined` —
262
+ * where `temp()` alone would leave the name undeclared.
263
+ */
264
+ local(prefix: string): string;
265
+ /** Add a regex to preamble and return the variable name. */
266
+ regex(prefix: string, pattern: string, flags?: string): string;
266
267
  }
267
268
  /** Fast-path generator function signature — registered in fastRegistry. */
268
- export type FastGenerator<T extends SchemaIR = SchemaIR> = (ir: T, g: FastGen) => string | null;
269
+ type FastGenerator<T extends SchemaIR = SchemaIR> = (ir: T, g: FastGen) => string | null;
269
270
  /** Allocate a fresh `__${prefix}_${n}` identifier and bump the shared counter. */
270
- export declare function emitTemp(ctx: CodeGenContext, prefix: string): string;
271
+ declare function emitTemp(ctx: CodeGenContext, prefix: string): string;
271
272
  /**
272
273
  * Host a zero-capture effect function (refine predicate, transform,
273
274
  * overwrite) in the preamble and return its variable name. The inline
@@ -280,7 +281,7 @@ export declare function emitTemp(ctx: CodeGenContext, prefix: string): string;
280
281
  * a single preamble binding is semantically identical. Deduped per schema
281
282
  * by source text.
282
283
  */
283
- export declare function emitEffectFn(ctx: CodeGenContext, source: string): string;
284
+ declare function emitEffectFn(ctx: CodeGenContext, source: string): string;
284
285
  /**
285
286
  * Callable expression for a user callback — a refine predicate or a transform.
286
287
  *
@@ -291,9 +292,9 @@ export declare function emitEffectFn(ctx: CodeGenContext, source: string): strin
291
292
  * re-read per call, for the same reason call-invoked helpers are (a per-call
292
293
  * array element load is not a foldable callee).
293
294
  */
294
- export declare function emitEffectCallable(ctx: CodeGenContext, effect: {
295
- refIndex?: number | undefined;
296
- source?: string | undefined;
295
+ declare function emitEffectCallable(ctx: CodeGenContext, effect: {
296
+ refIndex?: number | undefined;
297
+ source?: string | undefined;
297
298
  }): string;
298
299
  /**
299
300
  * Pristine fallback delegate: declare `var __rfp_N=__rf[N].safeParse.bind(__rf[N]);`
@@ -312,14 +313,14 @@ export declare function emitEffectCallable(ctx: CodeGenContext, effect: {
312
313
  * compiled validator (whose own delegates were captured even earlier), never
313
314
  * a cycle.
314
315
  */
315
- export declare function emitRfDelegate(ctx: CodeGenContext, refIndex: number): string;
316
+ declare function emitRfDelegate(ctx: CodeGenContext, refIndex: number): string;
316
317
  /**
317
318
  * Resolve a regex pattern to a runtime variable name.
318
319
  * Lean mode short-circuits well-known patterns to virtual-module names so the
319
320
  * bundler can dedup across files; everything else is cached + declared in the
320
321
  * per-IIFE preamble exactly once per pattern.
321
322
  */
322
- export declare function emitRegex(ctx: CodeGenContext, prefix: string, pattern: string, flags?: string): string;
323
+ declare function emitRegex(ctx: CodeGenContext, prefix: string, pattern: string, flags?: string): string;
323
324
  /**
324
325
  * Resolve the ORIGINAL `/source/flags` pattern string of a regex for issue
325
326
  * reporting. Only needed when emitRegex swapped in a faster equivalent test
@@ -327,7 +328,7 @@ export declare function emitRegex(ctx: CodeGenContext, prefix: string, pattern:
327
328
  * references the shared `<name>Src` virtual export so the original pattern
328
329
  * stays a single bundle-wide string; inline mode declares it once per IIFE.
329
330
  */
330
- export declare function emitRegexSourceString(ctx: CodeGenContext, pattern: string): string;
331
+ declare function emitRegexSourceString(ctx: CodeGenContext, pattern: string): string;
331
332
  /**
332
333
  * Declare a constant value in the preamble and return its variable name,
333
334
  * reusing an earlier declaration of the SAME initializer.
@@ -339,9 +340,9 @@ export declare function emitRegexSourceString(ctx: CodeGenContext, pattern: stri
339
340
  * 20-value enum schema's generated bytes, 16% for an object with two identical
340
341
  * enums. Keyed by initializer text, so only identical payloads collapse.
341
342
  */
342
- export declare function emitConstant(ctx: CodeGenContext, prefix: string, initializer: string): string;
343
+ declare function emitConstant(ctx: CodeGenContext, prefix: string, initializer: string): string;
343
344
  /** Declare a `new Set([...])` in the preamble and return its variable name. */
344
- export declare function emitSet(ctx: CodeGenContext, prefix: string, values: readonly unknown[]): string;
345
+ declare function emitSet(ctx: CodeGenContext, prefix: string, values: readonly unknown[]): string;
345
346
  /**
346
347
  * Shape-key count at or below which the unknown-key pass compares with an
347
348
  * inline `===` chain rather than a hashed lookup.
@@ -361,7 +362,7 @@ export declare function emitSet(ctx: CodeGenContext, prefix: string, values: rea
361
362
  * only loses past ~96, where `Set.has` (not the table, which never wins at any
362
363
  * size) takes over. 64 sits below that crossover and above any realistic shape.
363
364
  */
364
- export declare const KEY_MEMBERSHIP_INLINE_THRESHOLD = 64;
365
+ declare const KEY_MEMBERSHIP_INLINE_THRESHOLD = 64;
365
366
  /**
366
367
  * Boolean membership test for one key variable against a fixed key list.
367
368
  * Empty list recognizes nothing.
@@ -371,7 +372,7 @@ export declare const KEY_MEMBERSHIP_INLINE_THRESHOLD = 64;
371
372
  * by an object literal, so that key would silently read as unknown), which the
372
373
  * Set has no trouble with.
373
374
  */
374
- export declare function keyMembershipTest(ctx: CodeGenContext, keys: readonly string[], keyVar: string): string;
375
+ declare function keyMembershipTest(ctx: CodeGenContext, keys: readonly string[], keyVar: string): string;
375
376
  /**
376
377
  * Enum values at or below this count use inline === checks instead of Set.has().
377
378
  * Measured on V8: for ≤5 values, an === chain beats Set.has by up to ~3x with
@@ -379,21 +380,21 @@ export declare function keyMembershipTest(ctx: CodeGenContext, keys: readonly st
379
380
  * successful comparison, making subsequent arms pointer-equality — and is no
380
381
  * worse than Set.has even with adversarial shared-prefix values.
381
382
  */
382
- export declare const ENUM_INLINE_THRESHOLD = 5;
383
- export declare function escapeString(s: string | number): string;
383
+ declare const ENUM_INLINE_THRESHOLD = 5;
384
+ declare function escapeString(s: string | number): string;
384
385
  /**
385
386
  * JS source for a primitive literal value (literal schemas, discriminator
386
387
  * case labels). JSON.stringify covers string/number/boolean/null; bigint
387
388
  * needs the `n` suffix (JSON.stringify throws and String(5n) renders a
388
389
  * number literal that never strict-equals a bigint); undefined isn't JSON.
389
390
  */
390
- export declare function literalToJs(v: string | number | boolean | null | bigint | undefined): string;
391
+ declare function literalToJs(v: string | number | boolean | null | bigint | undefined): string;
391
392
  /**
392
393
  * Reference a shared runtime helper (e.g. __zcFsr) from generated code.
393
394
  * Lean mode: registers it for the `virtual:zod-compiler/runtime` import.
394
395
  * Inline mode: declares it once in the per-IIFE preamble.
395
396
  */
396
- export declare function emitRuntimeHelper(ctx: CodeGenContext, name: string, decl: string): string;
397
+ declare function emitRuntimeHelper(ctx: CodeGenContext, name: string, decl: string): string;
397
398
  /**
398
399
  * Extend a path expression with one or more scalar segment expressions
399
400
  * (escaped string literals, numeric literals, or loop-variable names).
@@ -405,11 +406,11 @@ export declare function emitRuntimeHelper(ctx: CodeGenContext, name: string, dec
405
406
  * (`["data"].concat("items").concat(__i_7)`). Opaque expressions fall back
406
407
  * to .concat().
407
408
  */
408
- export declare function extendPath(parentPath: string, segExpr: string): string;
409
+ declare function extendPath(parentPath: string, segExpr: string): string;
409
410
  /** Extend a path expression with a static string key. */
410
- export declare function extendStaticPath(parentPath: string, key: string): string;
411
+ declare function extendStaticPath(parentPath: string, key: string): string;
411
412
  /** Extend a path expression with a numeric index. */
412
- export declare function extendStaticPathIndex(parentPath: string, index: number): string;
413
+ declare function extendStaticPathIndex(parentPath: string, index: number): string;
413
414
  /**
414
415
  * Check if a SchemaIR tree produces output that is not the input itself —
415
416
  * either value-mutating operations (coerce, default, catch, overwrite) that
@@ -419,7 +420,7 @@ export declare function extendStaticPathIndex(parentPath: string, index: number)
419
420
  * input), by generateValidator to keep such schemas off the by-reference fast
420
421
  * path, and by the shared-walk dedup + intersection extractor to exclude them.
421
422
  */
422
- export declare function hasMutation(ir: SchemaIR): boolean;
423
+ declare function hasMutation(ir: SchemaIR): boolean;
423
424
  /**
424
425
  * Is a defaulted property's key guaranteed to appear in the stripped output?
425
426
  *
@@ -433,7 +434,7 @@ export declare function hasMutation(ir: SchemaIR): boolean;
433
434
  * branch runs only when `input[key] !== undefined`, which implies `key in input`
434
435
  * — so zod's presence test keeps the key whatever the inner produced.
435
436
  */
436
- export declare function outputAlwaysDefined(ir: SchemaIR): boolean;
437
+ declare function outputAlwaysDefined(ir: SchemaIR): boolean;
437
438
  /**
438
439
  * Does this schema reject `undefined` outright?
439
440
  *
@@ -442,10 +443,12 @@ export declare function outputAlwaysDefined(ir: SchemaIR): boolean;
442
443
  * `optin: "optional"` and accepts a shorter array. Conservative: anything that
443
444
  * might accept, produce, or default to `undefined` answers false.
444
445
  */
445
- export declare function rejectsUndefined(ir: SchemaIR): boolean;
446
+ declare function rejectsUndefined(ir: SchemaIR): boolean;
446
447
  /**
447
448
  * Sort comparator for CheckIR: cheapest/most-discriminating checks first.
448
449
  * Used by fast-path generators after filtering out refine_effect entries.
449
450
  */
450
- export declare function checkPriority(a: CheckIR | BigIntCheckIR | DateCheckIR | SetCheckIR, b: CheckIR | BigIntCheckIR | DateCheckIR | SetCheckIR): number;
451
+ declare function checkPriority(a: CheckIR | BigIntCheckIR | DateCheckIR | SetCheckIR, b: CheckIR | BigIntCheckIR | DateCheckIR | SetCheckIR): number;
452
+ //#endregion
453
+ export { CodeGenContext, CodeGenResult, CodegenMode, ENUM_INLINE_THRESHOLD, FastGen, FastGenerator, FastScope, KEY_MEMBERSHIP_INLINE_THRESHOLD, RecTargetGen, SlowGen, SlowGenerator, checkPriority, declareFastTemps, emitConstant, emitEffectCallable, emitEffectFn, emitRegex, emitRegexSourceString, emitRfDelegate, emitRuntimeHelper, emitSet, emitTemp, escapeString, extendPath, extendStaticPath, extendStaticPathIndex, fastSentinelWrapper, hasMutation, keyMembershipTest, literalToJs, outputAlwaysDefined, rejectsUndefined };
451
454
  //# sourceMappingURL=context.d.ts.map