elysia 2.0.0-beta.2 → 2.0.0-beta.21

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 (339) 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 +17 -19
  25. package/dist/compile/aot.js +41 -51
  26. package/dist/compile/aot.mjs +39 -49
  27. package/dist/compile/handler/descriptor.d.ts +9 -12
  28. package/dist/compile/handler/descriptor.js +19 -44
  29. package/dist/compile/handler/descriptor.mjs +20 -42
  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 +7 -5
  34. package/dist/compile/handler/index.js +270 -111
  35. package/dist/compile/handler/index.mjs +270 -113
  36. package/dist/compile/handler/jit.d.ts +19 -17
  37. package/dist/compile/handler/jit.js +222 -149
  38. package/dist/compile/handler/jit.mjs +224 -152
  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 +6 -4
  44. package/dist/compile/handler/reconstruct.mjs +6 -4
  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 +7 -2
  66. package/dist/cookie/config.js +76 -16
  67. package/dist/cookie/config.mjs +77 -18
  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 +52 -60
  108. package/dist/plugin/aot/core.js +208 -109
  109. package/dist/plugin/aot/core.mjs +205 -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 +71 -71
  122. package/dist/plugin/aot/source.mjs +72 -72
  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 +32 -49
  139. package/dist/schema-snapshot.mjs +32 -49
  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 +3 -7
  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/elysia/array-buffer.d.ts +4 -1
  162. package/dist/type/elysia/array-buffer.js +17 -17
  163. package/dist/type/elysia/array-buffer.mjs +17 -17
  164. package/dist/type/elysia/array-string.js +2 -40
  165. package/dist/type/elysia/array-string.mjs +2 -39
  166. package/dist/type/elysia/array.js +5 -9
  167. package/dist/type/elysia/array.mjs +5 -9
  168. package/dist/type/elysia/boolean-string.js +2 -3
  169. package/dist/type/elysia/boolean-string.mjs +1 -1
  170. package/dist/type/elysia/boolean.js +3 -12
  171. package/dist/type/elysia/boolean.mjs +3 -11
  172. package/dist/type/elysia/cookie.d.ts +3 -4
  173. package/dist/type/elysia/cookie.js +5 -15
  174. package/dist/type/elysia/cookie.mjs +5 -15
  175. package/dist/type/elysia/date.js +13 -20
  176. package/dist/type/elysia/date.mjs +10 -16
  177. package/dist/type/elysia/file-type.d.ts +11 -4
  178. package/dist/type/elysia/file-type.js +17 -2
  179. package/dist/type/elysia/file-type.mjs +17 -3
  180. package/dist/type/elysia/file.d.ts +1 -3
  181. package/dist/type/elysia/file.js +11 -27
  182. package/dist/type/elysia/file.mjs +11 -12
  183. package/dist/type/elysia/files.js +7 -11
  184. package/dist/type/elysia/files.mjs +7 -10
  185. package/dist/type/elysia/form.js +2 -3
  186. package/dist/type/elysia/form.mjs +3 -3
  187. package/dist/type/elysia/integer-string.d.ts +1 -1
  188. package/dist/type/elysia/integer-string.js +4 -30
  189. package/dist/type/elysia/integer-string.mjs +5 -30
  190. package/dist/type/elysia/integer.js +3 -12
  191. package/dist/type/elysia/integer.mjs +3 -11
  192. package/dist/type/elysia/intersect.js +0 -5
  193. package/dist/type/elysia/intersect.mjs +0 -5
  194. package/dist/type/elysia/json-string.d.ts +7 -0
  195. package/dist/type/elysia/json-string.js +47 -0
  196. package/dist/type/elysia/json-string.mjs +46 -0
  197. package/dist/type/elysia/keep-config.d.ts +14 -0
  198. package/dist/type/elysia/keep-config.js +62 -0
  199. package/dist/type/elysia/keep-config.mjs +53 -0
  200. package/dist/type/elysia/maybe-empty.js +3 -4
  201. package/dist/type/elysia/maybe-empty.mjs +1 -1
  202. package/dist/type/elysia/nullable.js +2 -3
  203. package/dist/type/elysia/nullable.mjs +1 -1
  204. package/dist/type/elysia/number.d.ts +2 -1
  205. package/dist/type/elysia/number.js +19 -11
  206. package/dist/type/elysia/number.mjs +18 -10
  207. package/dist/type/elysia/numeric-enum.d.ts +1 -1
  208. package/dist/type/elysia/numeric-enum.js +4 -5
  209. package/dist/type/elysia/numeric-enum.mjs +3 -3
  210. package/dist/type/elysia/numeric.d.ts +4 -2
  211. package/dist/type/elysia/numeric.js +20 -17
  212. package/dist/type/elysia/numeric.mjs +19 -16
  213. package/dist/type/elysia/object-string.js +2 -37
  214. package/dist/type/elysia/object-string.mjs +2 -36
  215. package/dist/type/elysia/object.js +5 -9
  216. package/dist/type/elysia/object.mjs +5 -9
  217. package/dist/type/elysia/optional.js +8 -8
  218. package/dist/type/elysia/optional.mjs +7 -7
  219. package/dist/type/elysia/problem.d.ts +20 -0
  220. package/dist/type/elysia/problem.js +25 -0
  221. package/dist/type/elysia/problem.mjs +24 -0
  222. package/dist/type/elysia/string.js +4 -3
  223. package/dist/type/elysia/string.mjs +4 -2
  224. package/dist/type/elysia/uint8-array.d.ts +1 -1
  225. package/dist/type/elysia/uint8-array.js +5 -20
  226. package/dist/type/elysia/uint8-array.mjs +5 -19
  227. package/dist/type/elysia/union-enum.js +7 -8
  228. package/dist/type/elysia/union-enum.mjs +6 -6
  229. package/dist/type/elysia/union.js +0 -5
  230. package/dist/type/elysia/union.mjs +0 -5
  231. package/dist/type/elysia/utils.d.ts +2 -4
  232. package/dist/type/elysia/utils.js +10 -21
  233. package/dist/type/elysia/utils.mjs +7 -15
  234. package/dist/type/exports.d.ts +4 -2
  235. package/dist/type/exports.js +23 -2
  236. package/dist/type/exports.mjs +11 -2
  237. package/dist/type/index.d.ts +10 -2
  238. package/dist/type/index.js +62 -15
  239. package/dist/type/index.mjs +65 -11
  240. package/dist/type/shared.d.ts +3 -9
  241. package/dist/type/shared.js +44 -97
  242. package/dist/type/shared.mjs +43 -97
  243. package/dist/type/sync-require.d.ts +11 -0
  244. package/dist/type/sync-require.js +14 -0
  245. package/dist/type/sync-require.mjs +12 -0
  246. package/dist/type/typebox-system-lite.d.ts +2 -0
  247. package/dist/type/typebox-system-lite.js +34 -0
  248. package/dist/type/typebox-system-lite.mjs +3 -0
  249. package/dist/type/typebox-system-require.d.ts +7 -0
  250. package/dist/type/typebox-system-require.js +24 -0
  251. package/dist/type/typebox-system-require.mjs +23 -0
  252. package/dist/type/typebox-type-live.d.ts +11 -0
  253. package/dist/type/typebox-type-live.js +45 -0
  254. package/dist/type/typebox-type-live.mjs +20 -0
  255. package/dist/type/typebox-type.d.ts +34 -0
  256. package/dist/type/typebox-type.js +199 -0
  257. package/dist/type/typebox-type.mjs +86 -0
  258. package/dist/type/typebox-value-live.d.ts +11 -0
  259. package/dist/type/typebox-value-live.js +31 -0
  260. package/dist/type/typebox-value-live.mjs +13 -0
  261. package/dist/type/typebox-value-ops.d.ts +4 -0
  262. package/dist/type/typebox-value-ops.js +90 -0
  263. package/dist/type/typebox-value-ops.mjs +5 -0
  264. package/dist/type/typebox-value-require.d.ts +8 -0
  265. package/dist/type/typebox-value-require.js +28 -0
  266. package/dist/type/typebox-value-require.mjs +25 -0
  267. package/dist/type/typebox-value.d.ts +35 -0
  268. package/dist/type/typebox-value.js +161 -0
  269. package/dist/type/typebox-value.mjs +74 -0
  270. package/dist/type/utils.js +1 -10
  271. package/dist/type/utils.mjs +1 -10
  272. package/dist/type/validator/clean-safe.d.ts +2 -4
  273. package/dist/type/validator/clean-safe.js +15 -11
  274. package/dist/type/validator/clean-safe.mjs +16 -10
  275. package/dist/type/validator/custom-error.js +12 -16
  276. package/dist/type/validator/custom-error.mjs +11 -14
  277. package/dist/type/validator/default-precompute.d.ts +9 -1
  278. package/dist/type/validator/default-precompute.js +40 -77
  279. package/dist/type/validator/default-precompute.mjs +37 -74
  280. package/dist/type/validator/exact-mirror-live.d.ts +8 -0
  281. package/dist/type/validator/exact-mirror-live.js +22 -0
  282. package/dist/type/validator/exact-mirror-live.mjs +17 -0
  283. package/dist/type/validator/exact-mirror-require.d.ts +4 -0
  284. package/dist/type/validator/exact-mirror-require.js +11 -0
  285. package/dist/type/validator/exact-mirror-require.mjs +9 -0
  286. package/dist/type/validator/exact-mirror.js +8 -8
  287. package/dist/type/validator/exact-mirror.mjs +9 -8
  288. package/dist/type/validator/frozen-check.js +5 -6
  289. package/dist/type/validator/frozen-check.mjs +6 -7
  290. package/dist/type/validator/index.d.ts +1 -0
  291. package/dist/type/validator/index.js +169 -166
  292. package/dist/type/validator/index.mjs +162 -158
  293. package/dist/type/validator/string-codec-aot.d.ts +2 -1
  294. package/dist/type/validator/string-codec-aot.js +8 -2
  295. package/dist/type/validator/string-codec-aot.mjs +7 -2
  296. package/dist/type/validator/validator-cache.d.ts +5 -4
  297. package/dist/type/validator/validator-cache.js +41 -24
  298. package/dist/type/validator/validator-cache.mjs +40 -22
  299. package/dist/types.d.ts +263 -95
  300. package/dist/universal/constants.d.ts +2 -1
  301. package/dist/universal/constants.js +3 -1
  302. package/dist/universal/constants.mjs +2 -1
  303. package/dist/universal/env.js +2 -3
  304. package/dist/universal/env.mjs +2 -3
  305. package/dist/universal/file.d.ts +6 -4
  306. package/dist/universal/file.js +11 -16
  307. package/dist/universal/file.mjs +12 -16
  308. package/dist/universal/index.d.ts +2 -2
  309. package/dist/universal/is-production.d.ts +1 -2
  310. package/dist/universal/is-production.js +1 -3
  311. package/dist/universal/is-production.mjs +2 -3
  312. package/dist/universal/server.d.ts +0 -272
  313. package/dist/utils.d.ts +43 -7
  314. package/dist/utils.js +181 -126
  315. package/dist/utils.mjs +168 -126
  316. package/dist/validator/index.d.ts +1 -1
  317. package/dist/validator/index.js +17 -30
  318. package/dist/validator/index.mjs +18 -31
  319. package/dist/validator/route.js +2 -1
  320. package/dist/validator/route.mjs +2 -1
  321. package/dist/ws/context.d.ts +8 -1
  322. package/dist/ws/context.js +68 -44
  323. package/dist/ws/context.mjs +67 -44
  324. package/dist/ws/parser.js +10 -20
  325. package/dist/ws/parser.mjs +10 -20
  326. package/dist/ws/route.d.ts +2 -2
  327. package/dist/ws/route.js +249 -141
  328. package/dist/ws/route.mjs +254 -146
  329. package/dist/ws/types.d.ts +2 -2
  330. package/package.json +23 -49
  331. package/dist/compile/analysis-cache.d.ts +0 -6
  332. package/dist/compile/analysis-cache.js +0 -12
  333. package/dist/compile/analysis-cache.mjs +0 -11
  334. package/dist/cookie/index.d.ts +0 -7
  335. package/dist/cookie/index.js +0 -13
  336. package/dist/cookie/index.mjs +0 -7
  337. package/dist/handler/index.d.ts +0 -2
  338. package/dist/handler/index.js +0 -5
  339. package/dist/handler/index.mjs +0 -3
package/dist/trace.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Prettify, RouteSchema, SingletonBase } from "./types.js";
1
+ import { TraceEvent } from "./constants.js";
2
2
  import { Context } from "./context.js";
3
+ import { Prettify, RouteSchema, SingletonBase } from "./types.js";
3
4
 
4
5
  //#region src/trace.d.ts
5
- type TraceEvent = 'request' | 'parse' | 'transform' | 'beforeHandle' | 'handle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error';
6
6
  declare function unionTracePhases(handlers: readonly Function[] | undefined): Set<TraceEvent> | null;
7
7
  interface TraceStream {
8
8
  id: number;
@@ -87,9 +87,8 @@ type TraceHandler<in out Route extends RouteSchema = {}, in out Singleton extend
87
87
  }> = {
88
88
  (lifecycle: Prettify<{
89
89
  /**
90
- * Per-request id. Sourced from `crypto.randomUUIDv7()` when
91
- * the runtime supports it (Bun ≥ 1.1.40), otherwise
92
- * `crypto.randomUUID()`. Useful for log correlation.
90
+ * Per-request id. Sourced from `Bun.randomUUIDv7()` on Bun,
91
+ * otherwise `crypto.randomUUID()`. Useful for log correlation.
93
92
  */
94
93
  id: string;
95
94
  context: Context<Route, Singleton>;
@@ -111,7 +110,6 @@ declare class TraceRecorder {
111
110
  callbacksBegin?: Function[];
112
111
  callbacksEnd?: Function[];
113
112
  callbacksChild?: Function[];
114
- pendingPromise?: Promise<TraceProcess<'begin'>>;
115
113
  pendingResolve?: (result: TraceProcess<'begin'>) => void;
116
114
  endPromise?: Promise<number>;
117
115
  endResolve?: (end: number) => void;
@@ -122,7 +120,6 @@ declare class TraceRecorder {
122
120
  childBegin?: (process: TraceStream) => (error?: Error | null) => void;
123
121
  listen(): (callback?: Function) => Promise<TraceProcess<"begin">>;
124
122
  begin(process: TraceStream): this;
125
- get resolveChild(): this;
126
123
  shift(): ((process: TraceStream) => (error?: Error | null) => void) | undefined;
127
124
  resolve(error?: Error | null, at?: number): void;
128
125
  }
@@ -147,4 +144,4 @@ interface TraceCapability {
147
144
  readonly unionTracePhases: typeof unionTracePhases;
148
145
  }
149
146
  //#endregion
150
- export { TraceCapability, TraceEndDetail, TraceEvent, TraceHandler, TraceListener, TraceProcess, TraceStream, createTracer, unionTracePhases };
147
+ export { TraceCapability, TraceEndDetail, type TraceEvent, TraceHandler, TraceListener, TraceProcess, TraceStream, createTracer, unionTracePhases };
package/dist/trace.js CHANGED
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_constants = require('./constants.js');
3
- const require_compile_lexer = require('./compile/lexer.js');
4
3
  const require_sucrose = require('./sucrose.js');
5
4
 
6
5
  //#region src/trace.ts
@@ -15,126 +14,19 @@ const phaseGetter = {
15
14
  onAfterResponse: "afterResponse",
16
15
  onError: "error"
17
16
  };
18
- function phasesFromDestructure(group) {
19
- let parameters;
20
- try {
21
- ({parameters} = require_sucrose.retrieveRootparameters(group));
22
- } catch {
23
- return null;
24
- }
25
- const out = /* @__PURE__ */ new Set();
26
- for (const key in parameters) {
27
- if (key.charCodeAt(0) === 91 || key.startsWith("...")) return null;
28
- const phase = phaseGetter[key];
29
- if (phase) out.add(phase);
30
- }
31
- return out;
32
- }
33
- function phasesFromMemberAccess(p, body) {
34
- const out = /* @__PURE__ */ new Set();
35
- const len = p.length;
36
- let i = 0;
37
- while (i < body.length) {
38
- const idx = body.indexOf(p, i);
39
- if (idx === -1) break;
40
- if (require_compile_lexer.isIdentCharCode(idx > 0 ? body.charCodeAt(idx - 1) : 0) || require_compile_lexer.isIdentCharCode(body.charCodeAt(idx + len))) {
41
- i = idx + len;
42
- continue;
43
- }
44
- let j = idx + len;
45
- let optional = false;
46
- if (body.charCodeAt(j) === 63) {
47
- optional = true;
48
- j++;
49
- }
50
- const next = body.charCodeAt(j);
51
- if (next === 46) {
52
- j++;
53
- const s = j;
54
- while (require_compile_lexer.isIdentCharCode(body.charCodeAt(j))) j++;
55
- const phase = phaseGetter[body.slice(s, j)];
56
- if (phase) out.add(phase);
57
- i = j;
58
- continue;
59
- }
60
- if (next === 91) {
61
- j++;
62
- const q = body.charCodeAt(j);
63
- if (q !== 34 && q !== 39) return null;
64
- j++;
65
- const s = j;
66
- while (j < body.length && body.charCodeAt(j) !== q) {
67
- if (body.charCodeAt(j) === 92) return null;
68
- j++;
69
- }
70
- const name = body.slice(s, j);
71
- j++;
72
- if (body.charCodeAt(j) !== 93) return null;
73
- j++;
74
- const phase = phaseGetter[name];
75
- if (phase) out.add(phase);
76
- i = j;
77
- continue;
78
- }
79
- if (optional) return null;
80
- let k = idx - 1;
81
- while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
82
- if (body.charCodeAt(k) === 61) {
83
- k--;
84
- while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
85
- if (body.charCodeAt(k) === 125) {
86
- i = idx + len;
87
- continue;
88
- }
89
- }
90
- return null;
91
- }
92
- return out;
93
- }
17
+ const phaseOf = (member) => Object.hasOwn(phaseGetter, member) ? phaseGetter[member] : void 0;
94
18
  const tracePhaseCache = /* @__PURE__ */ new WeakMap();
95
19
  function scanTracePhases(fn) {
96
20
  const cached = tracePhaseCache.get(fn);
97
21
  if (cached !== void 0) return cached;
98
- const result = computeTracePhases(fn);
99
- tracePhaseCache.set(fn, result);
100
- return result;
101
- }
102
- function computeTracePhases(fn) {
103
- let src;
104
- try {
105
- src = Function.prototype.toString.call(fn);
106
- } catch {
107
- return null;
108
- }
109
- if (src.includes("[native code]")) return null;
110
- let param;
111
- let body;
112
- try {
113
- [param, body] = require_sucrose.separateFunction(src);
22
+ let result = null;
23
+ if (fn.length) try {
24
+ result = require_sucrose.inferFunction(Function.prototype.toString.call(fn), phaseOf, true);
114
25
  } catch {
115
- return null;
26
+ result = null;
116
27
  }
117
- if (!param) return null;
118
- let roots;
119
- try {
120
- roots = require_sucrose.retrieveRootparameters(param);
121
- } catch {
122
- return null;
123
- }
124
- if (roots.hasParenthesis) return phasesFromDestructure(param);
125
- const first = Object.keys(roots.parameters)[0];
126
- if (!first) return null;
127
- const inner = body.charCodeAt(0) === 123 ? body.slice(1, -1) : body;
128
- const phases = phasesFromMemberAccess(first, inner);
129
- if (phases === null) return null;
130
- const aliases = require_sucrose.findAlias(first, inner);
131
- for (const alias of aliases) {
132
- if (alias.charCodeAt(0) !== 123) return null;
133
- const aliasPhases = phasesFromDestructure(alias);
134
- if (aliasPhases === null) return null;
135
- for (const p of aliasPhases) phases.add(p);
136
- }
137
- return phases;
28
+ tracePhaseCache.set(fn, result);
29
+ return result;
138
30
  }
139
31
  function unionTracePhases(handlers) {
140
32
  if (!handlers?.length) return /* @__PURE__ */ new Set();
@@ -146,6 +38,10 @@ function unionTracePhases(handlers) {
146
38
  }
147
39
  return union;
148
40
  }
41
+ /** Prevent rejected trace callbacks from becoming unhandled rejections. */
42
+ function fire(result) {
43
+ if (typeof result?.then === "function") result.then(void 0, (error) => console.error(error));
44
+ }
149
45
  var TraceRecorder = class {
150
46
  constructor() {
151
47
  this.remaining = 0;
@@ -159,11 +55,10 @@ var TraceRecorder = class {
159
55
  if (this.listenFn) return this.listenFn;
160
56
  if (this.begun) return this.listenFn = (_callback) => Promise.resolve(this.#result());
161
57
  const { promise, resolve } = Promise.withResolvers();
162
- this.pendingPromise = promise;
163
58
  this.pendingResolve = resolve;
164
59
  return this.listenFn = (callback) => {
165
60
  if (callback) (this.callbacksBegin ??= []).push(callback);
166
- return this.pendingPromise;
61
+ return promise;
167
62
  };
168
63
  }
169
64
  #result() {
@@ -175,7 +70,12 @@ var TraceRecorder = class {
175
70
  return slot.#end();
176
71
  },
177
72
  get error() {
178
- return slot.#error();
73
+ if (slot.errorPromise) return slot.errorPromise;
74
+ if (slot.ended) return slot.errorPromise = Promise.resolve(slot.endError);
75
+ const { promise, resolve } = Promise.withResolvers();
76
+ slot.errorPromise = promise;
77
+ slot.errorResolve = resolve;
78
+ return promise;
179
79
  },
180
80
  onEvent(callback) {
181
81
  if (callback) (slot.callbacksChild ??= []).push(callback);
@@ -194,14 +94,6 @@ var TraceRecorder = class {
194
94
  this.endResolve = resolve;
195
95
  return promise;
196
96
  }
197
- #error() {
198
- if (this.errorPromise) return this.errorPromise;
199
- if (this.ended) return this.errorPromise = Promise.resolve(this.endError);
200
- const { promise, resolve } = Promise.withResolvers();
201
- this.errorPromise = promise;
202
- this.errorResolve = resolve;
203
- return promise;
204
- }
205
97
  begin(process) {
206
98
  this.begun = process;
207
99
  this.remaining = process.total ?? 0;
@@ -211,13 +103,10 @@ var TraceRecorder = class {
211
103
  const result = this.#result();
212
104
  resolve(result);
213
105
  const callbacks = this.callbacksBegin;
214
- if (callbacks) for (let i = 0; i < callbacks.length; i++) callbacks[i](result);
106
+ if (callbacks) for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](result));
215
107
  }
216
108
  return this;
217
109
  }
218
- get resolveChild() {
219
- return this;
220
- }
221
110
  shift() {
222
111
  if (this.remaining <= 0) return;
223
112
  this.remaining--;
@@ -241,7 +130,7 @@ var TraceRecorder = class {
241
130
  return end;
242
131
  }
243
132
  };
244
- for (let i = 0; i < children.length; i++) children[i](result);
133
+ for (let i = 0; i < children.length; i++) fire(children[i](result));
245
134
  let resolved = false;
246
135
  return (err = null) => {
247
136
  if (resolved) return;
@@ -255,7 +144,7 @@ var TraceRecorder = class {
255
144
  return endAt - process.begin;
256
145
  }
257
146
  };
258
- for (let i = 0; i < callbacksEnd.length; i++) callbacksEnd[i](detail);
147
+ for (let i = 0; i < callbacksEnd.length; i++) fire(callbacksEnd[i](detail));
259
148
  resolveEnd(endAt);
260
149
  resolveError(err);
261
150
  };
@@ -278,7 +167,7 @@ var TraceRecorder = class {
278
167
  return end - begun.begin;
279
168
  }
280
169
  };
281
- for (let i = 0; i < callbacks.length; i++) callbacks[i](detail);
170
+ for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](detail));
282
171
  }
283
172
  this.endResolve?.(end);
284
173
  this.errorResolve?.(error);
@@ -380,7 +269,7 @@ var TracerLifecycle = class {
380
269
  const createTracer = (traceListener) => (context) => {
381
270
  const handle = new TracerHandle();
382
271
  handle.rid = context.rid ?? "";
383
- traceListener(new TracerLifecycle(handle, context));
272
+ fire(traceListener(new TracerLifecycle(handle, context)));
384
273
  return handle;
385
274
  };
386
275
 
package/dist/trace.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { traceEvents } from "./constants.mjs";
2
- import { isIdentCharCode } from "./compile/lexer.mjs";
3
- import { findAlias, retrieveRootparameters, separateFunction } from "./sucrose.mjs";
2
+ import { inferFunction } from "./sucrose.mjs";
4
3
 
5
4
  //#region src/trace.ts
6
5
  const phaseGetter = {
@@ -14,126 +13,19 @@ const phaseGetter = {
14
13
  onAfterResponse: "afterResponse",
15
14
  onError: "error"
16
15
  };
17
- function phasesFromDestructure(group) {
18
- let parameters;
19
- try {
20
- ({parameters} = retrieveRootparameters(group));
21
- } catch {
22
- return null;
23
- }
24
- const out = /* @__PURE__ */ new Set();
25
- for (const key in parameters) {
26
- if (key.charCodeAt(0) === 91 || key.startsWith("...")) return null;
27
- const phase = phaseGetter[key];
28
- if (phase) out.add(phase);
29
- }
30
- return out;
31
- }
32
- function phasesFromMemberAccess(p, body) {
33
- const out = /* @__PURE__ */ new Set();
34
- const len = p.length;
35
- let i = 0;
36
- while (i < body.length) {
37
- const idx = body.indexOf(p, i);
38
- if (idx === -1) break;
39
- if (isIdentCharCode(idx > 0 ? body.charCodeAt(idx - 1) : 0) || isIdentCharCode(body.charCodeAt(idx + len))) {
40
- i = idx + len;
41
- continue;
42
- }
43
- let j = idx + len;
44
- let optional = false;
45
- if (body.charCodeAt(j) === 63) {
46
- optional = true;
47
- j++;
48
- }
49
- const next = body.charCodeAt(j);
50
- if (next === 46) {
51
- j++;
52
- const s = j;
53
- while (isIdentCharCode(body.charCodeAt(j))) j++;
54
- const phase = phaseGetter[body.slice(s, j)];
55
- if (phase) out.add(phase);
56
- i = j;
57
- continue;
58
- }
59
- if (next === 91) {
60
- j++;
61
- const q = body.charCodeAt(j);
62
- if (q !== 34 && q !== 39) return null;
63
- j++;
64
- const s = j;
65
- while (j < body.length && body.charCodeAt(j) !== q) {
66
- if (body.charCodeAt(j) === 92) return null;
67
- j++;
68
- }
69
- const name = body.slice(s, j);
70
- j++;
71
- if (body.charCodeAt(j) !== 93) return null;
72
- j++;
73
- const phase = phaseGetter[name];
74
- if (phase) out.add(phase);
75
- i = j;
76
- continue;
77
- }
78
- if (optional) return null;
79
- let k = idx - 1;
80
- while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
81
- if (body.charCodeAt(k) === 61) {
82
- k--;
83
- while (k >= 0 && (body.charCodeAt(k) === 32 || body.charCodeAt(k) === 9)) k--;
84
- if (body.charCodeAt(k) === 125) {
85
- i = idx + len;
86
- continue;
87
- }
88
- }
89
- return null;
90
- }
91
- return out;
92
- }
16
+ const phaseOf = (member) => Object.hasOwn(phaseGetter, member) ? phaseGetter[member] : void 0;
93
17
  const tracePhaseCache = /* @__PURE__ */ new WeakMap();
94
18
  function scanTracePhases(fn) {
95
19
  const cached = tracePhaseCache.get(fn);
96
20
  if (cached !== void 0) return cached;
97
- const result = computeTracePhases(fn);
98
- tracePhaseCache.set(fn, result);
99
- return result;
100
- }
101
- function computeTracePhases(fn) {
102
- let src;
103
- try {
104
- src = Function.prototype.toString.call(fn);
105
- } catch {
106
- return null;
107
- }
108
- if (src.includes("[native code]")) return null;
109
- let param;
110
- let body;
111
- try {
112
- [param, body] = separateFunction(src);
21
+ let result = null;
22
+ if (fn.length) try {
23
+ result = inferFunction(Function.prototype.toString.call(fn), phaseOf, true);
113
24
  } catch {
114
- return null;
25
+ result = null;
115
26
  }
116
- if (!param) return null;
117
- let roots;
118
- try {
119
- roots = retrieveRootparameters(param);
120
- } catch {
121
- return null;
122
- }
123
- if (roots.hasParenthesis) return phasesFromDestructure(param);
124
- const first = Object.keys(roots.parameters)[0];
125
- if (!first) return null;
126
- const inner = body.charCodeAt(0) === 123 ? body.slice(1, -1) : body;
127
- const phases = phasesFromMemberAccess(first, inner);
128
- if (phases === null) return null;
129
- const aliases = findAlias(first, inner);
130
- for (const alias of aliases) {
131
- if (alias.charCodeAt(0) !== 123) return null;
132
- const aliasPhases = phasesFromDestructure(alias);
133
- if (aliasPhases === null) return null;
134
- for (const p of aliasPhases) phases.add(p);
135
- }
136
- return phases;
27
+ tracePhaseCache.set(fn, result);
28
+ return result;
137
29
  }
138
30
  function unionTracePhases(handlers) {
139
31
  if (!handlers?.length) return /* @__PURE__ */ new Set();
@@ -145,6 +37,10 @@ function unionTracePhases(handlers) {
145
37
  }
146
38
  return union;
147
39
  }
40
+ /** Prevent rejected trace callbacks from becoming unhandled rejections. */
41
+ function fire(result) {
42
+ if (typeof result?.then === "function") result.then(void 0, (error) => console.error(error));
43
+ }
148
44
  var TraceRecorder = class {
149
45
  constructor() {
150
46
  this.remaining = 0;
@@ -158,11 +54,10 @@ var TraceRecorder = class {
158
54
  if (this.listenFn) return this.listenFn;
159
55
  if (this.begun) return this.listenFn = (_callback) => Promise.resolve(this.#result());
160
56
  const { promise, resolve } = Promise.withResolvers();
161
- this.pendingPromise = promise;
162
57
  this.pendingResolve = resolve;
163
58
  return this.listenFn = (callback) => {
164
59
  if (callback) (this.callbacksBegin ??= []).push(callback);
165
- return this.pendingPromise;
60
+ return promise;
166
61
  };
167
62
  }
168
63
  #result() {
@@ -174,7 +69,12 @@ var TraceRecorder = class {
174
69
  return slot.#end();
175
70
  },
176
71
  get error() {
177
- return slot.#error();
72
+ if (slot.errorPromise) return slot.errorPromise;
73
+ if (slot.ended) return slot.errorPromise = Promise.resolve(slot.endError);
74
+ const { promise, resolve } = Promise.withResolvers();
75
+ slot.errorPromise = promise;
76
+ slot.errorResolve = resolve;
77
+ return promise;
178
78
  },
179
79
  onEvent(callback) {
180
80
  if (callback) (slot.callbacksChild ??= []).push(callback);
@@ -193,14 +93,6 @@ var TraceRecorder = class {
193
93
  this.endResolve = resolve;
194
94
  return promise;
195
95
  }
196
- #error() {
197
- if (this.errorPromise) return this.errorPromise;
198
- if (this.ended) return this.errorPromise = Promise.resolve(this.endError);
199
- const { promise, resolve } = Promise.withResolvers();
200
- this.errorPromise = promise;
201
- this.errorResolve = resolve;
202
- return promise;
203
- }
204
96
  begin(process) {
205
97
  this.begun = process;
206
98
  this.remaining = process.total ?? 0;
@@ -210,13 +102,10 @@ var TraceRecorder = class {
210
102
  const result = this.#result();
211
103
  resolve(result);
212
104
  const callbacks = this.callbacksBegin;
213
- if (callbacks) for (let i = 0; i < callbacks.length; i++) callbacks[i](result);
105
+ if (callbacks) for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](result));
214
106
  }
215
107
  return this;
216
108
  }
217
- get resolveChild() {
218
- return this;
219
- }
220
109
  shift() {
221
110
  if (this.remaining <= 0) return;
222
111
  this.remaining--;
@@ -240,7 +129,7 @@ var TraceRecorder = class {
240
129
  return end;
241
130
  }
242
131
  };
243
- for (let i = 0; i < children.length; i++) children[i](result);
132
+ for (let i = 0; i < children.length; i++) fire(children[i](result));
244
133
  let resolved = false;
245
134
  return (err = null) => {
246
135
  if (resolved) return;
@@ -254,7 +143,7 @@ var TraceRecorder = class {
254
143
  return endAt - process.begin;
255
144
  }
256
145
  };
257
- for (let i = 0; i < callbacksEnd.length; i++) callbacksEnd[i](detail);
146
+ for (let i = 0; i < callbacksEnd.length; i++) fire(callbacksEnd[i](detail));
258
147
  resolveEnd(endAt);
259
148
  resolveError(err);
260
149
  };
@@ -277,7 +166,7 @@ var TraceRecorder = class {
277
166
  return end - begun.begin;
278
167
  }
279
168
  };
280
- for (let i = 0; i < callbacks.length; i++) callbacks[i](detail);
169
+ for (let i = 0; i < callbacks.length; i++) fire(callbacks[i](detail));
281
170
  }
282
171
  this.endResolve?.(end);
283
172
  this.errorResolve?.(error);
@@ -379,7 +268,7 @@ var TracerLifecycle = class {
379
268
  const createTracer = (traceListener) => (context) => {
380
269
  const handle = new TracerHandle();
381
270
  handle.rid = context.rid ?? "";
382
- traceListener(new TracerLifecycle(handle, context));
271
+ fire(traceListener(new TracerLifecycle(handle, context)));
383
272
  return handle;
384
273
  };
385
274
 
@@ -5,11 +5,13 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
5
5
  import { TypeBoxValidator } from "./validator/index.js";
6
6
  import { applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure } from "./coerce.js";
7
7
  import { Ref } from "typebox/type";
8
+ import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
8
9
  import { Compile } from "typebox/compile";
9
- import { Check, Clone, Create, Decode, Default, HasCodec } from "typebox/value";
10
10
 
11
11
  //#region src/type/bridge-live.d.ts
12
12
  declare function useTypebox(_mod?: Parameters<typeof useTypebox$1>[0]): void;
13
+ declare function warmTypebox(): void;
14
+ declare function preloadTypebox(): Promise<void> | undefined;
13
15
  declare const isBridgeLive: () => boolean;
14
16
  //#endregion
15
- export { Check, Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, useTypebox };
17
+ export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
@@ -6,13 +6,15 @@ const require_type_validator_validator_cache = require('./validator/validator-ca
6
6
  const require_type_validator_index = require('./validator/index.js');
7
7
  const require_type_elysia_intersect = require('./elysia/intersect.js');
8
8
  let typebox_type = require("typebox/type");
9
- let typebox_compile = require("typebox/compile");
10
9
  let typebox_value = require("typebox/value");
10
+ let typebox_compile = require("typebox/compile");
11
11
  let typebox_system = require("typebox/system");
12
12
 
13
13
  //#region src/type/bridge-live.ts
14
14
  typebox_system.Settings.Set({ unionPrioritySort: false });
15
15
  function useTypebox(_mod) {}
16
+ function warmTypebox() {}
17
+ function preloadTypebox() {}
16
18
  const isBridgeLive = () => true;
17
19
 
18
20
  //#endregion
@@ -21,7 +23,6 @@ exports.Clone = typebox_value.Clone;
21
23
  exports.Compile = typebox_compile.Compile;
22
24
  exports.Create = typebox_value.Create;
23
25
  exports.Decode = typebox_value.Decode;
24
- exports.Default = typebox_value.Default;
25
26
  exports.HasCodec = typebox_value.HasCodec;
26
27
  exports.Intersect = require_type_elysia_intersect.Intersect;
27
28
  exports.Ref = typebox_type.Ref;
@@ -36,4 +37,6 @@ exports.coerceStringToStructure = require_type_coerce.coerceStringToStructure;
36
37
  exports.hasTypes = require_type_utils.hasTypes;
37
38
  exports.isBridgeLive = isBridgeLive;
38
39
  exports.mayHaveFileType = require_type_validator_validator_cache.mayHaveFileType;
39
- exports.useTypebox = useTypebox;
40
+ exports.preloadTypebox = preloadTypebox;
41
+ exports.useTypebox = useTypebox;
42
+ exports.warmTypebox = warmTypebox;
@@ -4,14 +4,16 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
4
4
  import { TypeBoxValidator } from "./validator/index.mjs";
5
5
  import { Intersect } from "./elysia/intersect.mjs";
6
6
  import { Ref } from "typebox/type";
7
+ import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
7
8
  import { Compile } from "typebox/compile";
8
- import { Check, Clone, Create, Decode, Default, HasCodec } from "typebox/value";
9
9
  import { Settings } from "typebox/system";
10
10
 
11
11
  //#region src/type/bridge-live.ts
12
12
  Settings.Set({ unionPrioritySort: false });
13
13
  function useTypebox(_mod) {}
14
+ function warmTypebox() {}
15
+ function preloadTypebox() {}
14
16
  const isBridgeLive = () => true;
15
17
 
16
18
  //#endregion
17
- export { Check, Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, useTypebox };
19
+ export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
@@ -4,8 +4,8 @@ import { TypeBoxValidatorCache as TypeBoxValidatorCache$1, mayHaveFileType as ma
4
4
  import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
5
5
  import { applyCoercions as applyCoercions$1, coerceBody as coerceBody$1, coerceFormData as coerceFormData$1, coerceQuery as coerceQuery$1, coerceRoot as coerceRoot$1, coerceStringToStructure as coerceStringToStructure$1 } from "./coerce.js";
6
6
  import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
7
+ import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, HasCodec as HasCodec$1 } from "typebox/value";
7
8
  import { Compile as Compile$1 } from "typebox/compile";
8
- import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
9
9
 
10
10
  //#region src/type/bridge.d.ts
11
11
  interface TypeboxModule {
@@ -24,10 +24,11 @@ interface TypeboxModule {
24
24
  mayHaveFileType: typeof mayHaveFileType$1;
25
25
  HasCodec: typeof HasCodec$1;
26
26
  Intersect: typeof Intersect$2;
27
- Default: typeof Default$1;
28
27
  Ref: typeof Ref$1;
29
28
  Clone: typeof Clone$1;
30
29
  Check: typeof Check$1;
30
+ warmTypebox: () => void;
31
+ preloadTypebox: () => Promise<void> | undefined;
31
32
  }
32
33
  declare let Compile: typeof Compile$1;
33
34
  declare let Create: typeof Create$1;
@@ -46,11 +47,12 @@ declare let hasTypes: typeof hasTypes$1;
46
47
  declare let mayHaveFileType: typeof mayHaveFileType$1;
47
48
  declare let HasCodec: typeof HasCodec$1;
48
49
  declare let Intersect: typeof Intersect$2;
49
- declare let Default: typeof Default$1;
50
50
  declare let Ref: typeof Ref$1;
51
51
  declare let Clone: typeof Clone$1;
52
52
  declare let Check: typeof Check$1;
53
+ declare let warmTypebox: () => void;
54
+ declare let preloadTypebox: () => Promise<void> | undefined;
53
55
  declare const isBridgeLive: () => boolean;
54
56
  declare function useTypebox(mod: TypeboxModule): void;
55
57
  //#endregion
56
- export { Check, Clone, Compile, Create, Decode, Default, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, useTypebox };
58
+ export { Check, Clone, Compile, Create, Decode, HasCodec, Intersect, Ref, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure, hasTypes, isBridgeLive, mayHaveFileType, preloadTypebox, useTypebox, warmTypebox };
@@ -33,10 +33,11 @@ let hasTypes = stub("hasTypes");
33
33
  let mayHaveFileType = stub("mayHaveFileType");
34
34
  let HasCodec = stub("HasCodec");
35
35
  let Intersect = stub("Intersect");
36
- let Default = stub("Default");
37
36
  let Ref = stub("Ref");
38
37
  let Clone = stub("Clone");
39
38
  let Check = stub("Check");
39
+ let warmTypebox = stub("warmTypebox");
40
+ let preloadTypebox = () => void 0;
40
41
  const isBridgeLive = () => live !== void 0;
41
42
  function useTypebox(mod) {
42
43
  live = mod;
@@ -55,10 +56,11 @@ function useTypebox(mod) {
55
56
  mayHaveFileType = mod.mayHaveFileType;
56
57
  HasCodec = mod.HasCodec;
57
58
  Intersect = mod.Intersect;
58
- Default = mod.Default;
59
59
  Ref = mod.Ref;
60
60
  Clone = mod.Clone;
61
61
  Check = mod.Check;
62
+ warmTypebox = mod.warmTypebox;
63
+ preloadTypebox = mod.preloadTypebox;
62
64
  }
63
65
 
64
66
  //#endregion
@@ -92,12 +94,6 @@ Object.defineProperty(exports, 'Decode', {
92
94
  return Decode;
93
95
  }
94
96
  });
95
- Object.defineProperty(exports, 'Default', {
96
- enumerable: true,
97
- get: function () {
98
- return Default;
99
- }
100
- });
101
97
  Object.defineProperty(exports, 'HasCodec', {
102
98
  enumerable: true,
103
99
  get: function () {
@@ -177,4 +173,16 @@ Object.defineProperty(exports, 'mayHaveFileType', {
177
173
  return mayHaveFileType;
178
174
  }
179
175
  });
180
- exports.useTypebox = useTypebox;
176
+ Object.defineProperty(exports, 'preloadTypebox', {
177
+ enumerable: true,
178
+ get: function () {
179
+ return preloadTypebox;
180
+ }
181
+ });
182
+ exports.useTypebox = useTypebox;
183
+ Object.defineProperty(exports, 'warmTypebox', {
184
+ enumerable: true,
185
+ get: function () {
186
+ return warmTypebox;
187
+ }
188
+ });