elysia 2.0.0-beta.2 → 2.0.0-beta.20

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 (337) hide show
  1. package/dist/adapter/bun/index.d.ts +18 -2
  2. package/dist/adapter/bun/index.js +467 -110
  3. package/dist/adapter/bun/index.mjs +467 -112
  4. package/dist/adapter/types.d.ts +2 -21
  5. package/dist/adapter/utils.d.ts +14 -3
  6. package/dist/adapter/utils.js +146 -87
  7. package/dist/adapter/utils.mjs +148 -90
  8. package/dist/adapter/web-standard/handler.d.ts +1 -1
  9. package/dist/adapter/web-standard/handler.js +47 -36
  10. package/dist/adapter/web-standard/handler.mjs +48 -37
  11. package/dist/adapter/web-standard/index.js +2 -30
  12. package/dist/adapter/web-standard/index.mjs +2 -30
  13. package/dist/adapter/web-standard/utils.js +5 -18
  14. package/dist/adapter/web-standard/utils.mjs +5 -18
  15. package/dist/base.d.ts +99 -67
  16. package/dist/base.js +678 -510
  17. package/dist/base.mjs +682 -514
  18. package/dist/compile/aot-capture.d.ts +2 -13
  19. package/dist/compile/aot-capture.js +26 -69
  20. package/dist/compile/aot-capture.mjs +28 -67
  21. package/dist/compile/aot-emit.d.ts +9 -7
  22. package/dist/compile/aot-emit.js +42 -19
  23. package/dist/compile/aot-emit.mjs +42 -20
  24. package/dist/compile/aot.d.ts +11 -13
  25. package/dist/compile/aot.js +34 -46
  26. package/dist/compile/aot.mjs +35 -45
  27. package/dist/compile/handler/descriptor.d.ts +9 -12
  28. package/dist/compile/handler/descriptor.js +17 -41
  29. package/dist/compile/handler/descriptor.mjs +18 -39
  30. package/dist/compile/handler/frozen-validator.d.ts +5 -10
  31. package/dist/compile/handler/frozen-validator.js +55 -105
  32. package/dist/compile/handler/frozen-validator.mjs +53 -105
  33. package/dist/compile/handler/index.d.ts +6 -5
  34. package/dist/compile/handler/index.js +148 -109
  35. package/dist/compile/handler/index.mjs +149 -111
  36. package/dist/compile/handler/jit.d.ts +17 -17
  37. package/dist/compile/handler/jit.js +220 -148
  38. package/dist/compile/handler/jit.mjs +222 -151
  39. package/dist/compile/handler/params.d.ts +1 -4
  40. package/dist/compile/handler/params.js +10 -5
  41. package/dist/compile/handler/params.mjs +14 -8
  42. package/dist/compile/handler/reconstruct.d.ts +2 -2
  43. package/dist/compile/handler/reconstruct.js +4 -3
  44. package/dist/compile/handler/reconstruct.mjs +4 -3
  45. package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
  46. package/dist/compile/handler/static-clone-resolver.js +8 -0
  47. package/dist/compile/handler/static-clone-resolver.mjs +7 -0
  48. package/dist/compile/handler/utils.d.ts +22 -11
  49. package/dist/compile/handler/utils.js +159 -253
  50. package/dist/compile/handler/utils.mjs +155 -252
  51. package/dist/compile/jit-probe.d.ts +2 -2
  52. package/dist/compile/jit-probe.js +2 -3
  53. package/dist/compile/jit-probe.mjs +2 -3
  54. package/dist/compile/lexer.d.ts +7 -4
  55. package/dist/compile/lexer.js +268 -6
  56. package/dist/compile/lexer.mjs +268 -4
  57. package/dist/compile/utils.js +7 -4
  58. package/dist/compile/utils.mjs +7 -4
  59. package/dist/compiled.d.ts +0 -1
  60. package/dist/compiled.js +0 -1
  61. package/dist/compiled.mjs +0 -1
  62. package/dist/context.d.ts +14 -4
  63. package/dist/context.js +17 -32
  64. package/dist/context.mjs +19 -34
  65. package/dist/cookie/config.d.ts +1 -0
  66. package/dist/cookie/config.js +9 -9
  67. package/dist/cookie/config.mjs +9 -9
  68. package/dist/cookie/cookie.d.ts +1 -1
  69. package/dist/cookie/cookie.js +8 -10
  70. package/dist/cookie/cookie.mjs +8 -10
  71. package/dist/cookie/crypto.d.ts +8 -7
  72. package/dist/cookie/crypto.js +51 -40
  73. package/dist/cookie/crypto.mjs +51 -41
  74. package/dist/cookie/error.d.ts +1 -2
  75. package/dist/cookie/error.js +6 -4
  76. package/dist/cookie/error.mjs +6 -4
  77. package/dist/cookie/lib.js +7 -2
  78. package/dist/cookie/lib.mjs +7 -2
  79. package/dist/cookie/serialize.js +1 -1
  80. package/dist/cookie/serialize.mjs +1 -1
  81. package/dist/cookie/types.d.ts +10 -0
  82. package/dist/cookie/utils.d.ts +4 -8
  83. package/dist/cookie/utils.js +86 -52
  84. package/dist/cookie/utils.mjs +89 -54
  85. package/dist/error.d.ts +113 -103
  86. package/dist/error.js +181 -117
  87. package/dist/error.mjs +179 -118
  88. package/dist/generation.d.ts +2 -2
  89. package/dist/handler/error.d.ts +26 -15
  90. package/dist/handler/error.js +77 -96
  91. package/dist/handler/error.mjs +74 -97
  92. package/dist/handler/fetch.js +87 -108
  93. package/dist/handler/fetch.mjs +89 -110
  94. package/dist/handler/utils.d.ts +12 -6
  95. package/dist/handler/utils.js +84 -28
  96. package/dist/handler/utils.mjs +80 -28
  97. package/dist/index.d.ts +12 -12
  98. package/dist/index.js +2 -9
  99. package/dist/index.mjs +1 -1
  100. package/dist/memory.js +1 -1
  101. package/dist/memory.mjs +1 -1
  102. package/dist/package.js +1 -1
  103. package/dist/package.mjs +1 -1
  104. package/dist/plugin/aot/bun.d.ts +8 -1
  105. package/dist/plugin/aot/bun.js +16 -9
  106. package/dist/plugin/aot/bun.mjs +17 -10
  107. package/dist/plugin/aot/core.d.ts +47 -60
  108. package/dist/plugin/aot/core.js +172 -109
  109. package/dist/plugin/aot/core.mjs +169 -111
  110. package/dist/plugin/aot/esbuild.js +8 -5
  111. package/dist/plugin/aot/esbuild.mjs +9 -6
  112. package/dist/plugin/aot/hooks.d.ts +6 -17
  113. package/dist/plugin/aot/hooks.js +36 -14
  114. package/dist/plugin/aot/hooks.mjs +37 -16
  115. package/dist/plugin/aot/rspack-loader.d.ts +1 -5
  116. package/dist/plugin/aot/rspack-loader.js +1 -10
  117. package/dist/plugin/aot/rspack-loader.mjs +1 -10
  118. package/dist/plugin/aot/rspack.js +2 -5
  119. package/dist/plugin/aot/rspack.mjs +3 -6
  120. package/dist/plugin/aot/source.d.ts +6 -42
  121. package/dist/plugin/aot/source.js +47 -62
  122. package/dist/plugin/aot/source.mjs +48 -63
  123. package/dist/plugin/aot/treeshake.js +2 -6
  124. package/dist/plugin/aot/treeshake.mjs +2 -6
  125. package/dist/plugin/aot/unplugin.d.ts +1 -4
  126. package/dist/plugin/aot/unplugin.js +4 -13
  127. package/dist/plugin/aot/unplugin.mjs +4 -13
  128. package/dist/plugin/aot/vite.d.ts +2 -6
  129. package/dist/plugin/aot/worker.js +2 -2
  130. package/dist/plugin/aot/worker.mjs +2 -2
  131. package/dist/plugin/auto-head.js +1 -10
  132. package/dist/plugin/auto-head.mjs +1 -10
  133. package/dist/plugin/trace.d.ts +2 -1
  134. package/dist/route-table.d.ts +3 -0
  135. package/dist/route-table.js +16 -11
  136. package/dist/route-table.mjs +16 -11
  137. package/dist/schema-snapshot.d.ts +0 -4
  138. package/dist/schema-snapshot.js +29 -47
  139. package/dist/schema-snapshot.mjs +29 -47
  140. package/dist/sucrose.d.ts +6 -55
  141. package/dist/sucrose.js +103 -731
  142. package/dist/sucrose.mjs +102 -724
  143. package/dist/trace.d.ts +5 -8
  144. package/dist/trace.js +23 -134
  145. package/dist/trace.mjs +24 -135
  146. package/dist/type/bridge-live.d.ts +4 -2
  147. package/dist/type/bridge-live.js +6 -3
  148. package/dist/type/bridge-live.mjs +4 -2
  149. package/dist/type/bridge.d.ts +6 -4
  150. package/dist/type/bridge.js +17 -9
  151. package/dist/type/bridge.mjs +5 -3
  152. package/dist/type/coerce-plan.d.ts +5 -5
  153. package/dist/type/coerce-plan.js +41 -39
  154. package/dist/type/coerce-plan.mjs +43 -39
  155. package/dist/type/coerce.d.ts +2 -6
  156. package/dist/type/coerce.js +18 -75
  157. package/dist/type/coerce.mjs +19 -76
  158. package/dist/type/compat.d.ts +3 -0
  159. package/dist/type/compat.js +23 -14
  160. package/dist/type/compat.mjs +20 -10
  161. package/dist/type/constants.d.ts +1 -1
  162. package/dist/type/elysia/array-buffer.d.ts +4 -1
  163. package/dist/type/elysia/array-buffer.js +17 -17
  164. package/dist/type/elysia/array-buffer.mjs +17 -17
  165. package/dist/type/elysia/array-string.js +2 -40
  166. package/dist/type/elysia/array-string.mjs +2 -39
  167. package/dist/type/elysia/array.js +5 -9
  168. package/dist/type/elysia/array.mjs +5 -9
  169. package/dist/type/elysia/boolean-string.js +2 -3
  170. package/dist/type/elysia/boolean-string.mjs +1 -1
  171. package/dist/type/elysia/boolean.js +3 -12
  172. package/dist/type/elysia/boolean.mjs +3 -11
  173. package/dist/type/elysia/cookie.d.ts +3 -4
  174. package/dist/type/elysia/cookie.js +5 -15
  175. package/dist/type/elysia/cookie.mjs +5 -15
  176. package/dist/type/elysia/date.js +13 -20
  177. package/dist/type/elysia/date.mjs +10 -16
  178. package/dist/type/elysia/file-type.d.ts +11 -4
  179. package/dist/type/elysia/file-type.js +17 -2
  180. package/dist/type/elysia/file-type.mjs +17 -3
  181. package/dist/type/elysia/file.d.ts +1 -3
  182. package/dist/type/elysia/file.js +11 -27
  183. package/dist/type/elysia/file.mjs +11 -12
  184. package/dist/type/elysia/files.js +7 -11
  185. package/dist/type/elysia/files.mjs +7 -10
  186. package/dist/type/elysia/form.js +2 -3
  187. package/dist/type/elysia/form.mjs +3 -3
  188. package/dist/type/elysia/integer-string.d.ts +1 -1
  189. package/dist/type/elysia/integer-string.js +4 -30
  190. package/dist/type/elysia/integer-string.mjs +5 -30
  191. package/dist/type/elysia/integer.js +3 -12
  192. package/dist/type/elysia/integer.mjs +3 -11
  193. package/dist/type/elysia/intersect.js +0 -5
  194. package/dist/type/elysia/intersect.mjs +0 -5
  195. package/dist/type/elysia/json-string.d.ts +7 -0
  196. package/dist/type/elysia/json-string.js +47 -0
  197. package/dist/type/elysia/json-string.mjs +46 -0
  198. package/dist/type/elysia/maybe-empty.js +3 -4
  199. package/dist/type/elysia/maybe-empty.mjs +1 -1
  200. package/dist/type/elysia/nullable.js +2 -3
  201. package/dist/type/elysia/nullable.mjs +1 -1
  202. package/dist/type/elysia/number.d.ts +2 -1
  203. package/dist/type/elysia/number.js +19 -11
  204. package/dist/type/elysia/number.mjs +18 -10
  205. package/dist/type/elysia/numeric-enum.d.ts +1 -1
  206. package/dist/type/elysia/numeric-enum.js +4 -5
  207. package/dist/type/elysia/numeric-enum.mjs +3 -3
  208. package/dist/type/elysia/numeric.d.ts +4 -2
  209. package/dist/type/elysia/numeric.js +20 -17
  210. package/dist/type/elysia/numeric.mjs +19 -16
  211. package/dist/type/elysia/object-string.js +2 -37
  212. package/dist/type/elysia/object-string.mjs +2 -36
  213. package/dist/type/elysia/object.js +5 -9
  214. package/dist/type/elysia/object.mjs +5 -9
  215. package/dist/type/elysia/optional.js +8 -8
  216. package/dist/type/elysia/optional.mjs +7 -7
  217. package/dist/type/elysia/problem.d.ts +20 -0
  218. package/dist/type/elysia/problem.js +25 -0
  219. package/dist/type/elysia/problem.mjs +24 -0
  220. package/dist/type/elysia/string.js +4 -3
  221. package/dist/type/elysia/string.mjs +4 -2
  222. package/dist/type/elysia/uint8-array.d.ts +1 -1
  223. package/dist/type/elysia/uint8-array.js +5 -20
  224. package/dist/type/elysia/uint8-array.mjs +5 -19
  225. package/dist/type/elysia/union-enum.js +7 -8
  226. package/dist/type/elysia/union-enum.mjs +6 -6
  227. package/dist/type/elysia/union.js +0 -5
  228. package/dist/type/elysia/union.mjs +0 -5
  229. package/dist/type/elysia/utils.d.ts +2 -4
  230. package/dist/type/elysia/utils.js +10 -21
  231. package/dist/type/elysia/utils.mjs +7 -15
  232. package/dist/type/exports.d.ts +3 -2
  233. package/dist/type/exports.js +13 -2
  234. package/dist/type/exports.mjs +10 -2
  235. package/dist/type/index.d.ts +10 -2
  236. package/dist/type/index.js +52 -15
  237. package/dist/type/index.mjs +55 -11
  238. package/dist/type/shared.d.ts +3 -9
  239. package/dist/type/shared.js +44 -97
  240. package/dist/type/shared.mjs +43 -97
  241. package/dist/type/sync-require.d.ts +11 -0
  242. package/dist/type/sync-require.js +14 -0
  243. package/dist/type/sync-require.mjs +12 -0
  244. package/dist/type/typebox-system-lite.d.ts +2 -0
  245. package/dist/type/typebox-system-lite.js +34 -0
  246. package/dist/type/typebox-system-lite.mjs +3 -0
  247. package/dist/type/typebox-system-require.d.ts +7 -0
  248. package/dist/type/typebox-system-require.js +24 -0
  249. package/dist/type/typebox-system-require.mjs +23 -0
  250. package/dist/type/typebox-type-live.d.ts +11 -0
  251. package/dist/type/typebox-type-live.js +37 -0
  252. package/dist/type/typebox-type-live.mjs +20 -0
  253. package/dist/type/typebox-type.d.ts +26 -0
  254. package/dist/type/typebox-type.js +135 -0
  255. package/dist/type/typebox-type.mjs +70 -0
  256. package/dist/type/typebox-value-live.d.ts +11 -0
  257. package/dist/type/typebox-value-live.js +31 -0
  258. package/dist/type/typebox-value-live.mjs +13 -0
  259. package/dist/type/typebox-value-ops.d.ts +4 -0
  260. package/dist/type/typebox-value-ops.js +90 -0
  261. package/dist/type/typebox-value-ops.mjs +5 -0
  262. package/dist/type/typebox-value-require.d.ts +8 -0
  263. package/dist/type/typebox-value-require.js +28 -0
  264. package/dist/type/typebox-value-require.mjs +25 -0
  265. package/dist/type/typebox-value.d.ts +35 -0
  266. package/dist/type/typebox-value.js +161 -0
  267. package/dist/type/typebox-value.mjs +74 -0
  268. package/dist/type/utils.js +1 -10
  269. package/dist/type/utils.mjs +1 -10
  270. package/dist/type/validator/clean-safe.d.ts +2 -4
  271. package/dist/type/validator/clean-safe.js +15 -11
  272. package/dist/type/validator/clean-safe.mjs +16 -10
  273. package/dist/type/validator/custom-error.js +12 -16
  274. package/dist/type/validator/custom-error.mjs +11 -14
  275. package/dist/type/validator/default-precompute.d.ts +9 -1
  276. package/dist/type/validator/default-precompute.js +40 -77
  277. package/dist/type/validator/default-precompute.mjs +37 -74
  278. package/dist/type/validator/exact-mirror-live.d.ts +8 -0
  279. package/dist/type/validator/exact-mirror-live.js +22 -0
  280. package/dist/type/validator/exact-mirror-live.mjs +17 -0
  281. package/dist/type/validator/exact-mirror-require.d.ts +4 -0
  282. package/dist/type/validator/exact-mirror-require.js +11 -0
  283. package/dist/type/validator/exact-mirror-require.mjs +9 -0
  284. package/dist/type/validator/exact-mirror.js +8 -8
  285. package/dist/type/validator/exact-mirror.mjs +9 -8
  286. package/dist/type/validator/frozen-check.js +5 -6
  287. package/dist/type/validator/frozen-check.mjs +6 -7
  288. package/dist/type/validator/index.d.ts +1 -0
  289. package/dist/type/validator/index.js +169 -166
  290. package/dist/type/validator/index.mjs +162 -158
  291. package/dist/type/validator/string-codec-aot.d.ts +2 -1
  292. package/dist/type/validator/string-codec-aot.js +8 -2
  293. package/dist/type/validator/string-codec-aot.mjs +7 -2
  294. package/dist/type/validator/validator-cache.d.ts +5 -4
  295. package/dist/type/validator/validator-cache.js +41 -24
  296. package/dist/type/validator/validator-cache.mjs +40 -22
  297. package/dist/types.d.ts +261 -94
  298. package/dist/universal/constants.d.ts +2 -1
  299. package/dist/universal/constants.js +3 -1
  300. package/dist/universal/constants.mjs +2 -1
  301. package/dist/universal/env.js +2 -3
  302. package/dist/universal/env.mjs +2 -3
  303. package/dist/universal/file.d.ts +6 -4
  304. package/dist/universal/file.js +11 -16
  305. package/dist/universal/file.mjs +12 -16
  306. package/dist/universal/index.d.ts +2 -2
  307. package/dist/universal/is-production.d.ts +1 -2
  308. package/dist/universal/is-production.js +1 -3
  309. package/dist/universal/is-production.mjs +2 -3
  310. package/dist/universal/server.d.ts +0 -272
  311. package/dist/utils.d.ts +41 -7
  312. package/dist/utils.js +158 -126
  313. package/dist/utils.mjs +147 -126
  314. package/dist/validator/index.d.ts +1 -1
  315. package/dist/validator/index.js +17 -30
  316. package/dist/validator/index.mjs +18 -31
  317. package/dist/validator/route.js +2 -1
  318. package/dist/validator/route.mjs +2 -1
  319. package/dist/ws/context.d.ts +8 -1
  320. package/dist/ws/context.js +68 -44
  321. package/dist/ws/context.mjs +67 -44
  322. package/dist/ws/parser.js +10 -20
  323. package/dist/ws/parser.mjs +10 -20
  324. package/dist/ws/route.d.ts +2 -2
  325. package/dist/ws/route.js +219 -139
  326. package/dist/ws/route.mjs +223 -143
  327. package/dist/ws/types.d.ts +2 -2
  328. package/package.json +23 -49
  329. package/dist/compile/analysis-cache.d.ts +0 -6
  330. package/dist/compile/analysis-cache.js +0 -12
  331. package/dist/compile/analysis-cache.mjs +0 -11
  332. package/dist/cookie/index.d.ts +0 -7
  333. package/dist/cookie/index.js +0 -13
  334. package/dist/cookie/index.mjs +0 -7
  335. package/dist/handler/index.d.ts +0 -2
  336. package/dist/handler/index.js +0 -5
  337. package/dist/handler/index.mjs +0 -3
@@ -0,0 +1,161 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_type_sync_require = require('./sync-require.js');
3
+ const require_type_typebox_type = require('./typebox-type.js');
4
+ const require_type_typebox_value_require = require('./typebox-value-require.js');
5
+
6
+ //#region src/type/typebox-value.ts
7
+ let loaded = false;
8
+ /**
9
+ * Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
10
+ */
11
+ function load() {
12
+ if (loaded) return;
13
+ require_type_typebox_type.loadTypeNamespace();
14
+ injectTypebox(resolveNamespaces());
15
+ }
16
+ function preloadTypebox() {
17
+ if (loaded || !require_type_typebox_type.isTypeUsed()) return;
18
+ return require_type_typebox_value_require.importTypebox()?.then(([typeSide, valueSide]) => {
19
+ if (loaded) return;
20
+ if (!require_type_typebox_type.isTypeNamespaceLoaded()) require_type_typebox_type.injectTypeboxType(typeSide);
21
+ injectTypebox(valueSide);
22
+ }, () => {});
23
+ }
24
+ function resolveNamespaces() {
25
+ const bundled = require_type_typebox_value_require.requireTypebox();
26
+ if (bundled) return bundled;
27
+ const req = require_type_sync_require.syncRequire({}, require("url").pathToFileURL(__filename).href);
28
+ if (!req) throw new Error("TypeBox couldn't be loaded: runtime has no synchronous module loader. Try building with the AOT plugin or register it with setupTypebox()");
29
+ return {
30
+ value: req("typebox/value"),
31
+ schema: req("typebox/schema"),
32
+ compile: req("typebox/compile")
33
+ };
34
+ }
35
+ function stub(get) {
36
+ return function(...args) {
37
+ load();
38
+ return get()(...args);
39
+ };
40
+ }
41
+ let Check = stub(() => Check);
42
+ let Clean = stub(() => Clean);
43
+ let Clone = stub(() => Clone);
44
+ let Create = stub(() => Create);
45
+ let Decode = stub(() => Decode);
46
+ let DecodeUnsafe = stub(() => DecodeUnsafe);
47
+ let Default = stub(() => Default);
48
+ let Encode = stub(() => Encode);
49
+ let EncodeUnsafe = stub(() => EncodeUnsafe);
50
+ let Errors = stub(() => Errors);
51
+ let HasCodec = stub(() => HasCodec);
52
+ let SchemaCompile = stub(() => SchemaCompile);
53
+ let Build = stub(() => Build);
54
+ let Compile = stub(() => Compile);
55
+ function injectTypebox(typebox) {
56
+ loaded = true;
57
+ require_type_typebox_type.loadTypeNamespace();
58
+ Check = typebox.value.Check;
59
+ Clean = typebox.value.Clean;
60
+ Clone = typebox.value.Clone;
61
+ Create = typebox.value.Create;
62
+ Decode = typebox.value.Decode;
63
+ DecodeUnsafe = typebox.value.DecodeUnsafe;
64
+ Default = typebox.value.Default;
65
+ Encode = typebox.value.Encode;
66
+ EncodeUnsafe = typebox.value.EncodeUnsafe;
67
+ Errors = typebox.value.Errors;
68
+ HasCodec = typebox.value.HasCodec;
69
+ SchemaCompile = typebox.schema.Compile;
70
+ Build = typebox.schema.Build;
71
+ Compile = typebox.compile.Compile;
72
+ }
73
+
74
+ //#endregion
75
+ Object.defineProperty(exports, 'Build', {
76
+ enumerable: true,
77
+ get: function () {
78
+ return Build;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, 'Check', {
82
+ enumerable: true,
83
+ get: function () {
84
+ return Check;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, 'Clean', {
88
+ enumerable: true,
89
+ get: function () {
90
+ return Clean;
91
+ }
92
+ });
93
+ Object.defineProperty(exports, 'Clone', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return Clone;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, 'Compile', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return Compile;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'Create', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return Create;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, 'Decode', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return Decode;
115
+ }
116
+ });
117
+ Object.defineProperty(exports, 'DecodeUnsafe', {
118
+ enumerable: true,
119
+ get: function () {
120
+ return DecodeUnsafe;
121
+ }
122
+ });
123
+ Object.defineProperty(exports, 'Default', {
124
+ enumerable: true,
125
+ get: function () {
126
+ return Default;
127
+ }
128
+ });
129
+ Object.defineProperty(exports, 'Encode', {
130
+ enumerable: true,
131
+ get: function () {
132
+ return Encode;
133
+ }
134
+ });
135
+ Object.defineProperty(exports, 'EncodeUnsafe', {
136
+ enumerable: true,
137
+ get: function () {
138
+ return EncodeUnsafe;
139
+ }
140
+ });
141
+ Object.defineProperty(exports, 'Errors', {
142
+ enumerable: true,
143
+ get: function () {
144
+ return Errors;
145
+ }
146
+ });
147
+ Object.defineProperty(exports, 'HasCodec', {
148
+ enumerable: true,
149
+ get: function () {
150
+ return HasCodec;
151
+ }
152
+ });
153
+ Object.defineProperty(exports, 'SchemaCompile', {
154
+ enumerable: true,
155
+ get: function () {
156
+ return SchemaCompile;
157
+ }
158
+ });
159
+ exports.injectTypebox = injectTypebox;
160
+ exports.preloadTypebox = preloadTypebox;
161
+ exports.warmTypebox = load;
@@ -0,0 +1,74 @@
1
+ import { syncRequire } from "./sync-require.mjs";
2
+ import { injectTypeboxType, isTypeNamespaceLoaded, isTypeUsed, loadTypeNamespace } from "./typebox-type.mjs";
3
+ import { importTypebox, requireTypebox } from "./typebox-value-require.mjs";
4
+
5
+ //#region src/type/typebox-value.ts
6
+ let loaded = false;
7
+ /**
8
+ * Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
9
+ */
10
+ function load() {
11
+ if (loaded) return;
12
+ loadTypeNamespace();
13
+ injectTypebox(resolveNamespaces());
14
+ }
15
+ function preloadTypebox() {
16
+ if (loaded || !isTypeUsed()) return;
17
+ return importTypebox()?.then(([typeSide, valueSide]) => {
18
+ if (loaded) return;
19
+ if (!isTypeNamespaceLoaded()) injectTypeboxType(typeSide);
20
+ injectTypebox(valueSide);
21
+ }, () => {});
22
+ }
23
+ function resolveNamespaces() {
24
+ const bundled = requireTypebox();
25
+ if (bundled) return bundled;
26
+ const req = syncRequire(import.meta, import.meta.url);
27
+ if (!req) throw new Error("TypeBox couldn't be loaded: runtime has no synchronous module loader. Try building with the AOT plugin or register it with setupTypebox()");
28
+ return {
29
+ value: req("typebox/value"),
30
+ schema: req("typebox/schema"),
31
+ compile: req("typebox/compile")
32
+ };
33
+ }
34
+ function stub(get) {
35
+ return function(...args) {
36
+ load();
37
+ return get()(...args);
38
+ };
39
+ }
40
+ let Check = stub(() => Check);
41
+ let Clean = stub(() => Clean);
42
+ let Clone = stub(() => Clone);
43
+ let Create = stub(() => Create);
44
+ let Decode = stub(() => Decode);
45
+ let DecodeUnsafe = stub(() => DecodeUnsafe);
46
+ let Default = stub(() => Default);
47
+ let Encode = stub(() => Encode);
48
+ let EncodeUnsafe = stub(() => EncodeUnsafe);
49
+ let Errors = stub(() => Errors);
50
+ let HasCodec = stub(() => HasCodec);
51
+ let SchemaCompile = stub(() => SchemaCompile);
52
+ let Build = stub(() => Build);
53
+ let Compile = stub(() => Compile);
54
+ function injectTypebox(typebox) {
55
+ loaded = true;
56
+ loadTypeNamespace();
57
+ Check = typebox.value.Check;
58
+ Clean = typebox.value.Clean;
59
+ Clone = typebox.value.Clone;
60
+ Create = typebox.value.Create;
61
+ Decode = typebox.value.Decode;
62
+ DecodeUnsafe = typebox.value.DecodeUnsafe;
63
+ Default = typebox.value.Default;
64
+ Encode = typebox.value.Encode;
65
+ EncodeUnsafe = typebox.value.EncodeUnsafe;
66
+ Errors = typebox.value.Errors;
67
+ HasCodec = typebox.value.HasCodec;
68
+ SchemaCompile = typebox.schema.Compile;
69
+ Build = typebox.schema.Build;
70
+ Compile = typebox.compile.Compile;
71
+ }
72
+
73
+ //#endregion
74
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, injectTypebox, preloadTypebox, load as warmTypebox };
@@ -5,18 +5,9 @@ const require_type_validator_clean_safe = require('./validator/clean-safe.js');
5
5
  //#region src/type/utils.ts
6
6
  const prunePrimitive = (node) => "~elyTyp" in node && require_type_constants.primitiveElysiaTypes.has(node["~elyTyp"]);
7
7
  const refTarget = (node) => node.$ref && node.$defs ? node.$defs[node.$ref] : void 0;
8
- const typeSets = /* @__PURE__ */ new WeakMap();
9
- function typeSetOf(types) {
10
- let set = typeSets.get(types);
11
- if (set === void 0) {
12
- set = new Set(types);
13
- typeSets.set(types, set);
14
- }
15
- return set;
16
- }
17
8
  function hasTypes(types, schema) {
18
9
  if ("~standard" in schema) return false;
19
- const set = typeSetOf(types);
10
+ const set = new Set(types);
20
11
  const seen = /* @__PURE__ */ new WeakSet();
21
12
  const wantsFiles = set.has(require_type_constants.ELYSIA_TYPES.Files);
22
13
  const test = (node) => {
@@ -4,18 +4,9 @@ import { schemaSome } from "./validator/clean-safe.mjs";
4
4
  //#region src/type/utils.ts
5
5
  const prunePrimitive = (node) => "~elyTyp" in node && primitiveElysiaTypes.has(node["~elyTyp"]);
6
6
  const refTarget = (node) => node.$ref && node.$defs ? node.$defs[node.$ref] : void 0;
7
- const typeSets = /* @__PURE__ */ new WeakMap();
8
- function typeSetOf(types) {
9
- let set = typeSets.get(types);
10
- if (set === void 0) {
11
- set = new Set(types);
12
- typeSets.set(types, set);
13
- }
14
- return set;
15
- }
16
7
  function hasTypes(types, schema) {
17
8
  if ("~standard" in schema) return false;
18
- const set = typeSetOf(types);
9
+ const set = new Set(types);
19
10
  const seen = /* @__PURE__ */ new WeakSet();
20
11
  const wantsFiles = set.has(ELYSIA_TYPES.Files);
21
12
  const test = (node) => {
@@ -1,8 +1,6 @@
1
1
  //#region src/type/validator/clean-safe.d.ts
2
- declare function schemaSome(schema: any, test: (node: any) => boolean, seen?: WeakSet<object>, prune?: (node: any) => boolean): boolean;
2
+ declare function schemaSome(schema: any, test: (node: any) => boolean, seen?: WeakSet<object>, prune?: (node: any) => boolean, conditional?: boolean): boolean;
3
3
  declare const schemaHasDangerousProperties: (schema: any) => boolean;
4
- declare const schemaContainsRef: (node: any, seen?: WeakSet<WeakKey>) => boolean;
5
- declare function isCleanSafeNode(node: any, visiting: WeakSet<object>, clean: WeakSet<object>): boolean;
6
4
  declare function isFullyClosedObject(schema: any): boolean;
7
5
  //#endregion
8
- export { isCleanSafeNode, isFullyClosedObject, schemaContainsRef, schemaHasDangerousProperties, schemaSome };
6
+ export { isFullyClosedObject, schemaHasDangerousProperties, schemaSome };
@@ -2,19 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_constants = require('../../constants.js');
3
3
 
4
4
  //#region src/type/validator/clean-safe.ts
5
- function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune) {
5
+ function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune, conditional = false) {
6
6
  if (!schema || typeof schema !== "object" || seen.has(schema)) return false;
7
7
  seen.add(schema);
8
8
  if (test(schema)) return true;
9
9
  if (prune && prune(schema)) return false;
10
10
  const props = schema.properties;
11
11
  if (props) {
12
- for (const k in props) if (Object.hasOwn(props, k) && schemaSome(props[k], test, seen, prune)) return true;
12
+ for (const k in props) if ((conditional || Object.hasOwn(props, k)) && schemaSome(props[k], test, seen, prune, conditional)) return true;
13
13
  }
14
14
  const items = schema.items;
15
15
  if (Array.isArray(items)) {
16
- for (const it of items) if (schemaSome(it, test, seen, prune)) return true;
17
- } else if (items && schemaSome(items, test, seen, prune)) return true;
16
+ for (const it of items) if (schemaSome(it, test, seen, prune, conditional)) return true;
17
+ } else if (items && schemaSome(items, test, seen, prune, conditional)) return true;
18
18
  for (const k of [
19
19
  "anyOf",
20
20
  "allOf",
@@ -22,14 +22,21 @@ function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune) {
22
22
  ]) {
23
23
  const arr = schema[k];
24
24
  if (Array.isArray(arr)) {
25
- for (const x of arr) if (schemaSome(x, test, seen, prune)) return true;
25
+ for (const x of arr) if (schemaSome(x, test, seen, prune, conditional)) return true;
26
26
  }
27
27
  }
28
- if (schema.additionalProperties && typeof schema.additionalProperties === "object" && schemaSome(schema.additionalProperties, test, seen, prune)) return true;
29
- if (schema.not && schemaSome(schema.not, test, seen, prune)) return true;
28
+ if (schema.additionalProperties && typeof schema.additionalProperties === "object" && schemaSome(schema.additionalProperties, test, seen, prune, conditional)) return true;
29
+ if (schema.not && schemaSome(schema.not, test, seen, prune, conditional)) return true;
30
+ if (conditional) {
31
+ for (const k of [
32
+ "if",
33
+ "then",
34
+ "else"
35
+ ]) if (schema[k] && schemaSome(schema[k], test, seen, prune, true)) return true;
36
+ }
30
37
  const pp = schema.patternProperties;
31
38
  if (pp) {
32
- for (const k in pp) if (schemaSome(pp[k], test, seen, prune)) return true;
39
+ for (const k in pp) if (schemaSome(pp[k], test, seen, prune, conditional)) return true;
33
40
  }
34
41
  return false;
35
42
  }
@@ -39,7 +46,6 @@ const schemaHasDangerousProperties = (schema) => schemaSome(schema, (node) => {
39
46
  for (const key of require_constants.dangerousKeys) if (Object.hasOwn(properties, key)) return true;
40
47
  return false;
41
48
  });
42
- const schemaContainsRef = (node, seen = /* @__PURE__ */ new WeakSet()) => schemaSome(node, (n) => !!n.$ref, seen);
43
49
  function isCleanSafeNode(node, visiting, clean) {
44
50
  if (!node || typeof node !== "object") return true;
45
51
  if (clean.has(node)) return true;
@@ -75,8 +81,6 @@ function isFullyClosedObject(schema) {
75
81
  }
76
82
 
77
83
  //#endregion
78
- exports.isCleanSafeNode = isCleanSafeNode;
79
84
  exports.isFullyClosedObject = isFullyClosedObject;
80
- exports.schemaContainsRef = schemaContainsRef;
81
85
  exports.schemaHasDangerousProperties = schemaHasDangerousProperties;
82
86
  exports.schemaSome = schemaSome;
@@ -1,19 +1,19 @@
1
1
  import { dangerousKeys } from "../../constants.mjs";
2
2
 
3
3
  //#region src/type/validator/clean-safe.ts
4
- function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune) {
4
+ function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune, conditional = false) {
5
5
  if (!schema || typeof schema !== "object" || seen.has(schema)) return false;
6
6
  seen.add(schema);
7
7
  if (test(schema)) return true;
8
8
  if (prune && prune(schema)) return false;
9
9
  const props = schema.properties;
10
10
  if (props) {
11
- for (const k in props) if (Object.hasOwn(props, k) && schemaSome(props[k], test, seen, prune)) return true;
11
+ for (const k in props) if ((conditional || Object.hasOwn(props, k)) && schemaSome(props[k], test, seen, prune, conditional)) return true;
12
12
  }
13
13
  const items = schema.items;
14
14
  if (Array.isArray(items)) {
15
- for (const it of items) if (schemaSome(it, test, seen, prune)) return true;
16
- } else if (items && schemaSome(items, test, seen, prune)) return true;
15
+ for (const it of items) if (schemaSome(it, test, seen, prune, conditional)) return true;
16
+ } else if (items && schemaSome(items, test, seen, prune, conditional)) return true;
17
17
  for (const k of [
18
18
  "anyOf",
19
19
  "allOf",
@@ -21,14 +21,21 @@ function schemaSome(schema, test, seen = /* @__PURE__ */ new WeakSet(), prune) {
21
21
  ]) {
22
22
  const arr = schema[k];
23
23
  if (Array.isArray(arr)) {
24
- for (const x of arr) if (schemaSome(x, test, seen, prune)) return true;
24
+ for (const x of arr) if (schemaSome(x, test, seen, prune, conditional)) return true;
25
25
  }
26
26
  }
27
- if (schema.additionalProperties && typeof schema.additionalProperties === "object" && schemaSome(schema.additionalProperties, test, seen, prune)) return true;
28
- if (schema.not && schemaSome(schema.not, test, seen, prune)) return true;
27
+ if (schema.additionalProperties && typeof schema.additionalProperties === "object" && schemaSome(schema.additionalProperties, test, seen, prune, conditional)) return true;
28
+ if (schema.not && schemaSome(schema.not, test, seen, prune, conditional)) return true;
29
+ if (conditional) {
30
+ for (const k of [
31
+ "if",
32
+ "then",
33
+ "else"
34
+ ]) if (schema[k] && schemaSome(schema[k], test, seen, prune, true)) return true;
35
+ }
29
36
  const pp = schema.patternProperties;
30
37
  if (pp) {
31
- for (const k in pp) if (schemaSome(pp[k], test, seen, prune)) return true;
38
+ for (const k in pp) if (schemaSome(pp[k], test, seen, prune, conditional)) return true;
32
39
  }
33
40
  return false;
34
41
  }
@@ -38,7 +45,6 @@ const schemaHasDangerousProperties = (schema) => schemaSome(schema, (node) => {
38
45
  for (const key of dangerousKeys) if (Object.hasOwn(properties, key)) return true;
39
46
  return false;
40
47
  });
41
- const schemaContainsRef = (node, seen = /* @__PURE__ */ new WeakSet()) => schemaSome(node, (n) => !!n.$ref, seen);
42
48
  function isCleanSafeNode(node, visiting, clean) {
43
49
  if (!node || typeof node !== "object") return true;
44
50
  if (clean.has(node)) return true;
@@ -74,4 +80,4 @@ function isFullyClosedObject(schema) {
74
80
  }
75
81
 
76
82
  //#endregion
77
- export { isCleanSafeNode, isFullyClosedObject, schemaContainsRef, schemaHasDangerousProperties, schemaSome };
83
+ export { isFullyClosedObject, schemaHasDangerousProperties, schemaSome };
@@ -1,10 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
2
  const require_utils = require('../../utils.js');
4
3
  const require_error = require('../../error.js');
5
4
  const require_compile_aot = require('../../compile/aot.js');
5
+ const require_type_typebox_value = require('../typebox-value.js');
6
6
  const require_type_validator_frozen_check = require('./frozen-check.js');
7
- let typebox_schema = require("typebox/schema");
8
7
 
9
8
  //#region src/type/validator/custom-error.ts
10
9
  function encodePointer(segments) {
@@ -50,18 +49,17 @@ const literalOf = (propSchema) => {
50
49
  if ("const" in propSchema) return { value: propSchema.const };
51
50
  if (Array.isArray(propSchema.enum) && propSchema.enum.length === 1) return { value: propSchema.enum[0] };
52
51
  };
53
- function computeDiscriminators(branches) {
52
+ const findDiscriminators = (branches) => {
54
53
  let candidates;
55
54
  for (const branch of branches) {
56
- if (!branch || !branch.properties) return;
55
+ if (!branch?.properties) return null;
57
56
  const keys = /* @__PURE__ */ new Set();
58
57
  for (const k in branch.properties) if (literalOf(branch.properties[k])) keys.add(k);
59
- if (!keys.size) return;
60
58
  if (!candidates) candidates = keys;
61
59
  else for (const c of [...candidates]) if (!keys.has(c)) candidates.delete(c);
62
- if (!candidates.size) return;
60
+ if (!candidates.size) return null;
63
61
  }
64
- if (!candidates || !candidates.size) return;
62
+ if (!candidates) return null;
65
63
  const perBranch = branches.map(require_utils.nullObject);
66
64
  let hasDisambiguating = false;
67
65
  for (const key of candidates) {
@@ -73,8 +71,8 @@ function computeDiscriminators(branches) {
73
71
  }
74
72
  if (new Set(seenValues).size === branches.length) hasDisambiguating = true;
75
73
  }
76
- return hasDisambiguating ? perBranch : void 0;
77
- }
74
+ return hasDisambiguating ? perBranch : null;
75
+ };
78
76
  function buildFindCustomError(schema, frozen) {
79
77
  const nodes = collectCustomErrorNodes(schema, [], [], /* @__PURE__ */ new WeakSet());
80
78
  if (!nodes.length) return;
@@ -85,7 +83,7 @@ function buildFindCustomError(schema, frozen) {
85
83
  const cached = unionCheckCache.get(node);
86
84
  if (cached) return cached;
87
85
  try {
88
- const uc = (0, typebox_schema.Compile)(node);
86
+ const uc = require_type_typebox_value.SchemaCompile(node);
89
87
  const fn = (v) => uc.Check(v);
90
88
  unionCheckCache.set(node, fn);
91
89
  return fn;
@@ -94,10 +92,8 @@ function buildFindCustomError(schema, frozen) {
94
92
  }
95
93
  };
96
94
  const discriminatorsOf = (node, branches) => {
97
- if (discriminatorCache.has(node)) return discriminatorCache.get(node) ?? void 0;
98
- const d = computeDiscriminators(branches) ?? null;
99
- discriminatorCache.set(node, d);
100
- return d ?? void 0;
95
+ if (!discriminatorCache.has(node)) discriminatorCache.set(node, findDiscriminators(branches));
96
+ return discriminatorCache.get(node) ?? void 0;
101
97
  };
102
98
  const checks = [];
103
99
  for (const { path, node, each, segments, union } of nodes) {
@@ -107,7 +103,7 @@ function buildFindCustomError(schema, frozen) {
107
103
  check = fe.c(fe.e ? require_compile_aot.reconstruct().collectExternals(node) : require_compile_aot.EMPTY_EXTERNALS);
108
104
  } catch {}
109
105
  else try {
110
- const c = (0, typebox_schema.Compile)(node);
106
+ const c = require_type_typebox_value.SchemaCompile(node);
111
107
  check = (v) => c.Check(v);
112
108
  } catch {}
113
109
  if (!check) continue;
@@ -176,7 +172,7 @@ function captureCustomErrors(schema) {
176
172
  for (const { path, node, union, each } of ceNodes) {
177
173
  if (union || each) continue;
178
174
  try {
179
- const cf = require_type_validator_frozen_check.buildFrozenCheck((0, typebox_schema.Build)(node), node);
175
+ const cf = require_type_validator_frozen_check.buildFrozenCheck(require_type_typebox_value.Build(node), node);
180
176
  if (cf) entries.push({
181
177
  path,
182
178
  ...cf
@@ -1,8 +1,8 @@
1
1
  import { nullObject } from "../../utils.mjs";
2
2
  import { subValueAt } from "../../error.mjs";
3
3
  import { EMPTY_EXTERNALS, reconstruct } from "../../compile/aot.mjs";
4
+ import { Build, SchemaCompile } from "../typebox-value.mjs";
4
5
  import { buildFrozenCheck } from "./frozen-check.mjs";
5
- import { Build, Compile } from "typebox/schema";
6
6
 
7
7
  //#region src/type/validator/custom-error.ts
8
8
  function encodePointer(segments) {
@@ -48,18 +48,17 @@ const literalOf = (propSchema) => {
48
48
  if ("const" in propSchema) return { value: propSchema.const };
49
49
  if (Array.isArray(propSchema.enum) && propSchema.enum.length === 1) return { value: propSchema.enum[0] };
50
50
  };
51
- function computeDiscriminators(branches) {
51
+ const findDiscriminators = (branches) => {
52
52
  let candidates;
53
53
  for (const branch of branches) {
54
- if (!branch || !branch.properties) return;
54
+ if (!branch?.properties) return null;
55
55
  const keys = /* @__PURE__ */ new Set();
56
56
  for (const k in branch.properties) if (literalOf(branch.properties[k])) keys.add(k);
57
- if (!keys.size) return;
58
57
  if (!candidates) candidates = keys;
59
58
  else for (const c of [...candidates]) if (!keys.has(c)) candidates.delete(c);
60
- if (!candidates.size) return;
59
+ if (!candidates.size) return null;
61
60
  }
62
- if (!candidates || !candidates.size) return;
61
+ if (!candidates) return null;
63
62
  const perBranch = branches.map(nullObject);
64
63
  let hasDisambiguating = false;
65
64
  for (const key of candidates) {
@@ -71,8 +70,8 @@ function computeDiscriminators(branches) {
71
70
  }
72
71
  if (new Set(seenValues).size === branches.length) hasDisambiguating = true;
73
72
  }
74
- return hasDisambiguating ? perBranch : void 0;
75
- }
73
+ return hasDisambiguating ? perBranch : null;
74
+ };
76
75
  function buildFindCustomError(schema, frozen) {
77
76
  const nodes = collectCustomErrorNodes(schema, [], [], /* @__PURE__ */ new WeakSet());
78
77
  if (!nodes.length) return;
@@ -83,7 +82,7 @@ function buildFindCustomError(schema, frozen) {
83
82
  const cached = unionCheckCache.get(node);
84
83
  if (cached) return cached;
85
84
  try {
86
- const uc = Compile(node);
85
+ const uc = SchemaCompile(node);
87
86
  const fn = (v) => uc.Check(v);
88
87
  unionCheckCache.set(node, fn);
89
88
  return fn;
@@ -92,10 +91,8 @@ function buildFindCustomError(schema, frozen) {
92
91
  }
93
92
  };
94
93
  const discriminatorsOf = (node, branches) => {
95
- if (discriminatorCache.has(node)) return discriminatorCache.get(node) ?? void 0;
96
- const d = computeDiscriminators(branches) ?? null;
97
- discriminatorCache.set(node, d);
98
- return d ?? void 0;
94
+ if (!discriminatorCache.has(node)) discriminatorCache.set(node, findDiscriminators(branches));
95
+ return discriminatorCache.get(node) ?? void 0;
99
96
  };
100
97
  const checks = [];
101
98
  for (const { path, node, each, segments, union } of nodes) {
@@ -105,7 +102,7 @@ function buildFindCustomError(schema, frozen) {
105
102
  check = fe.c(fe.e ? reconstruct().collectExternals(node) : EMPTY_EXTERNALS);
106
103
  } catch {}
107
104
  else try {
108
- const c = Compile(node);
105
+ const c = SchemaCompile(node);
109
106
  check = (v) => c.Check(v);
110
107
  } catch {}
111
108
  if (!check) continue;
@@ -7,6 +7,14 @@ declare function applyPrecomputed(defaults: Record<string, unknown>, value: Reco
7
7
  declare function isEmittable(v: unknown, seen: Set<unknown>, top?: boolean): boolean;
8
8
  declare function buildDefaultClonerSource(value: unknown): string | undefined;
9
9
  declare function buildObjectDefaultMergeSource(defaults: Record<string, unknown>): string | undefined;
10
+ /**
11
+ * How many emitted default-precompute sources have failed to compile.
12
+ *
13
+ * Build-time only. A non-zero count means codegen emitted source that
14
+ * `Function()` rejected, so those routes silently fell back to the interpreted
15
+ * default path — always a bug in this module, never a user error.
16
+ */
17
+ declare const precomputeCompileFailures: () => number;
10
18
  declare function createDefaultCloner(value: unknown): DefaultCloner | undefined;
11
19
  declare function createObjectDefaultMerger(defaults: Record<string, unknown>): ObjectDefaultMerger | undefined;
12
20
  declare function createMergerFromSource(source: string): ((value: any) => any) | undefined;
@@ -23,4 +31,4 @@ declare function verifyPreallocatableDefault(schema: TSchema, validate?: boolean
23
31
  ms: string | undefined;
24
32
  } | undefined;
25
33
  //#endregion
26
- export { DefaultProbeImpl, applyPrecomputed, buildDefaultClonerSource, buildObjectDefaultMergeSource, canonical, createDefaultCloner, createMergerFromSource, createObjectDefaultMerger, isEmittable, setDefaultProbeImpl, verifyPreallocatableDefault };
34
+ export { DefaultProbeImpl, applyPrecomputed, buildDefaultClonerSource, buildObjectDefaultMergeSource, canonical, createDefaultCloner, createMergerFromSource, createObjectDefaultMerger, isEmittable, precomputeCompileFailures, setDefaultProbeImpl, verifyPreallocatableDefault };