elysia 2.0.0-beta.26 → 2.0.0-beta.28

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 (160) hide show
  1. package/README.md +1 -1
  2. package/dist/adapter/bun/index.js +0 -19
  3. package/dist/adapter/bun/index.mjs +0 -19
  4. package/dist/adapter/origin.js +0 -57
  5. package/dist/adapter/origin.mjs +0 -57
  6. package/dist/adapter/utils.d.ts +1 -1
  7. package/dist/adapter/utils.js +5 -35
  8. package/dist/adapter/utils.mjs +5 -35
  9. package/dist/adapter/web-standard/handler.js +9 -14
  10. package/dist/adapter/web-standard/handler.mjs +9 -14
  11. package/dist/base.d.ts +11 -11
  12. package/dist/base.js +26 -144
  13. package/dist/base.mjs +27 -145
  14. package/dist/compile/aot-capture.js +12 -19
  15. package/dist/compile/aot-capture.mjs +12 -19
  16. package/dist/compile/aot-emit.d.ts +1 -2
  17. package/dist/compile/aot-emit.js +5 -29
  18. package/dist/compile/aot-emit.mjs +6 -29
  19. package/dist/compile/aot-reconstruct.js +7 -30
  20. package/dist/compile/aot-reconstruct.mjs +7 -30
  21. package/dist/compile/aot.js +0 -7
  22. package/dist/compile/aot.mjs +0 -7
  23. package/dist/compile/handler/descriptor.d.ts +1 -2
  24. package/dist/compile/handler/descriptor.js +2 -5
  25. package/dist/compile/handler/descriptor.mjs +2 -4
  26. package/dist/compile/handler/frozen-validator.js +0 -11
  27. package/dist/compile/handler/frozen-validator.mjs +0 -11
  28. package/dist/compile/handler/index.js +10 -26
  29. package/dist/compile/handler/index.mjs +11 -27
  30. package/dist/compile/handler/jit.d.ts +5 -1
  31. package/dist/compile/handler/jit.js +7 -28
  32. package/dist/compile/handler/jit.mjs +9 -30
  33. package/dist/compile/handler/params.js +0 -3
  34. package/dist/compile/handler/params.mjs +0 -3
  35. package/dist/compile/handler/utils.d.ts +2 -1
  36. package/dist/compile/handler/utils.js +7 -16
  37. package/dist/compile/handler/utils.mjs +6 -16
  38. package/dist/compiled.js +0 -9
  39. package/dist/compiled.mjs +0 -9
  40. package/dist/constants.js +19 -4
  41. package/dist/constants.mjs +19 -4
  42. package/dist/context.d.ts +1 -1
  43. package/dist/context.js +1 -7
  44. package/dist/context.mjs +1 -7
  45. package/dist/cookie/cookie.d.ts +7 -4
  46. package/dist/cookie/cookie.js +10 -5
  47. package/dist/cookie/cookie.mjs +10 -5
  48. package/dist/cookie/crypto.d.ts +1 -1
  49. package/dist/cookie/crypto.js +8 -7
  50. package/dist/cookie/crypto.mjs +8 -7
  51. package/dist/cookie/types.d.ts +1 -1
  52. package/dist/cookie/utils.js +5 -18
  53. package/dist/cookie/utils.mjs +5 -18
  54. package/dist/error.d.ts +5 -4
  55. package/dist/error.js +0 -73
  56. package/dist/error.mjs +0 -73
  57. package/dist/generation.d.ts +1 -1
  58. package/dist/handler/error.js +1 -28
  59. package/dist/handler/error.mjs +1 -28
  60. package/dist/handler/fetch.js +18 -30
  61. package/dist/handler/fetch.mjs +18 -30
  62. package/dist/handler/utils.js +5 -5
  63. package/dist/handler/utils.mjs +5 -5
  64. package/dist/index.d.ts +5 -5
  65. package/dist/memory.js +1 -1
  66. package/dist/memory.mjs +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/package.mjs +1 -1
  69. package/dist/parse-query.js +0 -4
  70. package/dist/parse-query.mjs +0 -4
  71. package/dist/plugin/aot/bun.js +0 -26
  72. package/dist/plugin/aot/bun.mjs +0 -26
  73. package/dist/plugin/aot/core.js +2 -34
  74. package/dist/plugin/aot/core.mjs +2 -34
  75. package/dist/plugin/aot/esbuild.js +0 -19
  76. package/dist/plugin/aot/esbuild.mjs +0 -19
  77. package/dist/plugin/aot/hooks.js +2 -4
  78. package/dist/plugin/aot/hooks.mjs +3 -5
  79. package/dist/plugin/aot/rspack-loader.js +0 -16
  80. package/dist/plugin/aot/rspack-loader.mjs +0 -16
  81. package/dist/plugin/aot/rspack.js +0 -14
  82. package/dist/plugin/aot/rspack.mjs +0 -14
  83. package/dist/plugin/aot/source.js +6 -8
  84. package/dist/plugin/aot/source.mjs +6 -8
  85. package/dist/plugin/aot/unplugin.js +0 -19
  86. package/dist/plugin/aot/unplugin.mjs +0 -19
  87. package/dist/plugin/aot/vite.js +0 -14
  88. package/dist/plugin/aot/vite.mjs +0 -14
  89. package/dist/plugin/trace.d.ts +16 -0
  90. package/dist/plugin/trace.js +0 -16
  91. package/dist/plugin/trace.mjs +0 -16
  92. package/dist/plugin/websocket.d.ts +21 -0
  93. package/dist/plugin/websocket.js +0 -21
  94. package/dist/plugin/websocket.mjs +0 -21
  95. package/dist/schema-snapshot.js +0 -4
  96. package/dist/schema-snapshot.mjs +0 -4
  97. package/dist/sucrose.d.ts +1 -1
  98. package/dist/sucrose.js +0 -4
  99. package/dist/sucrose.mjs +0 -4
  100. package/dist/trace.d.ts +1 -1
  101. package/dist/trace.js +0 -1
  102. package/dist/trace.mjs +0 -1
  103. package/dist/type/bridge.js +22 -20
  104. package/dist/type/bridge.mjs +22 -20
  105. package/dist/type/coerce-plan.d.ts +1 -1
  106. package/dist/type/coerce-plan.js +19 -12
  107. package/dist/type/coerce-plan.mjs +19 -12
  108. package/dist/type/coerce.js +0 -4
  109. package/dist/type/coerce.mjs +0 -4
  110. package/dist/type/constants.d.ts +1 -1
  111. package/dist/type/elysia/date.d.ts +2 -1
  112. package/dist/type/elysia/file-type.js +3 -2
  113. package/dist/type/elysia/file-type.mjs +3 -2
  114. package/dist/type/elysia/numeric-enum.js +0 -4
  115. package/dist/type/elysia/numeric-enum.mjs +0 -4
  116. package/dist/type/elysia/problem.js +0 -6
  117. package/dist/type/elysia/problem.mjs +0 -6
  118. package/dist/type/elysia/union-enum.js +0 -1
  119. package/dist/type/elysia/union-enum.mjs +0 -1
  120. package/dist/type/elysia/utils.d.ts +2 -2
  121. package/dist/type/elysia/utils.js +5 -19
  122. package/dist/type/elysia/utils.mjs +5 -19
  123. package/dist/type/index.js +0 -11
  124. package/dist/type/index.mjs +0 -11
  125. package/dist/type/shared.d.ts +10 -2
  126. package/dist/type/shared.js +36 -17
  127. package/dist/type/shared.mjs +34 -17
  128. package/dist/type/sync-require.js +0 -7
  129. package/dist/type/sync-require.mjs +0 -7
  130. package/dist/type/typebox-type.js +1 -7
  131. package/dist/type/typebox-type.mjs +1 -7
  132. package/dist/type/typebox-value.js +0 -3
  133. package/dist/type/typebox-value.mjs +0 -3
  134. package/dist/type/types.d.ts +1 -1
  135. package/dist/type/validator/custom-error.js +1 -4
  136. package/dist/type/validator/custom-error.mjs +1 -4
  137. package/dist/type/validator/default-precompute.js +0 -7
  138. package/dist/type/validator/default-precompute.mjs +0 -7
  139. package/dist/type/validator/exact-mirror-live.js +0 -7
  140. package/dist/type/validator/exact-mirror-live.mjs +1 -7
  141. package/dist/type/validator/exact-mirror.js +15 -7
  142. package/dist/type/validator/exact-mirror.mjs +15 -7
  143. package/dist/type/validator/index.js +7 -19
  144. package/dist/type/validator/index.mjs +8 -20
  145. package/dist/type/validator/string-codec-aot.js +3 -5
  146. package/dist/type/validator/string-codec-aot.mjs +3 -5
  147. package/dist/types.d.ts +13 -21
  148. package/dist/universal/file.js +0 -7
  149. package/dist/universal/file.mjs +0 -7
  150. package/dist/utils.d.ts +1 -1
  151. package/dist/utils.js +11 -91
  152. package/dist/utils.mjs +11 -91
  153. package/dist/validator/route.d.ts +1 -8
  154. package/dist/ws/context.js +14 -15
  155. package/dist/ws/context.mjs +14 -15
  156. package/dist/ws/parser.js +2 -2
  157. package/dist/ws/parser.mjs +2 -2
  158. package/dist/ws/route.js +114 -58
  159. package/dist/ws/route.mjs +115 -59
  160. package/package.json +3 -8
package/dist/base.js CHANGED
@@ -66,17 +66,11 @@ const toModel = (key, value) => {
66
66
  value.$id ??= key;
67
67
  return value;
68
68
  };
69
- const hookKeys = new Set([
70
- ...require_utils.schemaProperties,
71
- ...require_utils.eventProperties,
72
- "detail",
73
- "tags"
74
- ]);
75
69
  const assertScope = (scope) => {
76
70
  if (scope !== void 0 && scope !== "local" && scope !== "plugin" && scope !== "global") throw new Error(`[Elysia] Invalid hook scope ${JSON.stringify(scope)}, expected 'local', 'plugin' or 'global' (1.x 'scoped' is 'plugin')`);
77
71
  };
78
72
  const hasHookKeys = (value) => {
79
- for (const key in value) if (hookKeys.has(key)) return true;
73
+ for (const key in value) if (require_utils.schemaProperties.has(key) || require_utils.eventProperties.has(key) || key === "detail" || key === "tags") return true;
80
74
  return false;
81
75
  };
82
76
  function assertSchemaShape(hook, where) {
@@ -95,13 +89,6 @@ function assertSchemaShape(hook, where) {
95
89
  throw new Error(`[Elysia] ${where}: "${key}" is not a schema — use t.Object({ ... })`);
96
90
  }
97
91
  }
98
- /**
99
- * Every key a single route must answer to, in registration order.
100
- *
101
- * `registerLoose` is the caller's call, not this helper's: HTTP gates it on
102
- * `canRegisterLoose` because its lookup retries the trailing slash, while WS
103
- * has no such retry and must own both directions outright
104
- */
105
92
  function expandPaths(path, needsEncode, registerLoose, explicit) {
106
93
  const variants = [path];
107
94
  if (needsEncode) {
@@ -172,31 +159,10 @@ var Elysia = class Elysia {
172
159
  get ["~programId"]() {
173
160
  return this;
174
161
  }
162
+ static #nextScopeChild;
175
163
  constructor(config) {
176
- /**
177
- * ! Don't tune
178
- *
179
- * Interesting JSC internal: These `= undefined` shouldn't be removed
180
- *
181
- * Inline slots live inside the object cell, so JSC must pick their
182
- * count at allocation before any initializer runs
183
- *
184
- * Its only signal is counting `this.x =` in the ctor body;
185
- * class-field initializers compile into a separate hidden function
186
- * the guess never sees
187
- *
188
- * The cell can't grow afterwards, so once inline slots run out every
189
- * later property spills into the butterfly, and capacity is by n^2
190
- *
191
- * Fields run first before ctor (here), so they take the inline slots
192
- * these assignments reserve
193
- *
194
- * Don't omitted field either for monomorphic access
195
- *
196
- * @see test/memory/instance-footprint.test.ts
197
- * Est. overflow 37 -> 21 = butterfly 64 -> 32 slots = 738B -> 450B;
198
- * reusing the app as its program identity brings the current cell to ~386B.
199
- **/
164
+ const scopeChild = Elysia.#nextScopeChild;
165
+ Elysia.#nextScopeChild = void 0;
200
166
  this["~config"] = config;
201
167
  this["~ext"] = void 0;
202
168
  this["~hookChain"] = void 0;
@@ -212,8 +178,7 @@ var Elysia = class Elysia {
212
178
  this["~aotFingerprint"] = void 0;
213
179
  this["~compilerSession"] = void 0;
214
180
  this["~generation"] = void 0;
215
- this["~introspect"] = void 0;
216
- this["~scopeChild"] = void 0;
181
+ this["~scopeChild"] = scopeChild;
217
182
  this["~scopeChildren"] = void 0;
218
183
  if (config) {
219
184
  const { prefix, name, seed, adapter } = config;
@@ -222,18 +187,12 @@ var Elysia = class Elysia {
222
187
  if (adapter?.setup) this.#useFn(adapter.setup);
223
188
  } else this["~Prefix"] = void 0;
224
189
  }
225
- /**
226
- * Every registered route with its merged hooks.
227
- * Development shares a frozen cache.
228
- * Production rebuilds the list on every read
229
- * so its metadata can be released after startup.
230
- */
231
190
  get routes() {
232
191
  const generation = this["~generation"];
233
192
  if (this.#isCacheable && this.cachedGeneration === generation && this.cachedEpoch === mutationEpoch && this.cachedRoutes !== void 0) return this.cachedRoutes;
234
- if (this.declaredRoutes === void 0 && this["~routeTable"]?.length) this.#materializeDeclaredRoutes();
235
- if (!this.declaredRoutes?.length) return [];
236
- const routes = this["~routes"].map(([method, path, handler, instance, hook, appHook, inheritedChain, macroScope]) => {
193
+ const declared = this["~routes"];
194
+ if (!declared.length) return [];
195
+ const routes = declared.map(([method, path, handler, instance, hook, appHook, inheritedChain, macroScope]) => {
237
196
  const merged = require_compile_handler_index.composeRouteHook(instance, hook, appHook, inheritedChain, this, macroScope);
238
197
  require_compile_handler_index.runIntrospect(merged);
239
198
  if (merged?.schemas?.length) for (const entry of merged.schemas) {
@@ -346,7 +305,7 @@ var Elysia = class Elysia {
346
305
  parent,
347
306
  refs,
348
307
  scope,
349
- owner: this,
308
+ owner: this["~scopeChild"] ? this : void 0,
350
309
  origin: this.hash
351
310
  };
352
311
  }
@@ -369,20 +328,6 @@ var Elysia = class Elysia {
369
328
  parsers[name] = fn;
370
329
  return this;
371
330
  }
372
- /**
373
- * ### setup | Life cycle event
374
- * Called after server is ready for serving
375
- *
376
- * ---
377
- * @example
378
- * ```typescript
379
- * new Elysia()
380
- * .setup(({ server }) => {
381
- * console.log("Running at ${server?.url}:${server?.port}")
382
- * })
383
- * .listen(3000)
384
- * ```
385
- */
386
331
  setup(handler) {
387
332
  this.#assertMutable("setup");
388
333
  (this.#ext.setup ??= []).push(...[].concat(handler));
@@ -421,7 +366,7 @@ var Elysia = class Elysia {
421
366
  this.#assertMutable("error");
422
367
  switch (arguments.length) {
423
368
  case 1:
424
- if (scopeOrFnOrError && typeof scopeOrFnOrError === "object") return this;
369
+ if (scopeOrFnOrError && typeof scopeOrFnOrError === "object" && !Array.isArray(scopeOrFnOrError)) throw new Error("[Elysia] .error({ CODE: Class }) was removed in 2.0 — use .error(Class, handler)");
425
370
  return this.#onBranch("error", scopeOrFnOrError);
426
371
  case 2:
427
372
  if (typeof scopeOrFnOrError === "function" && scopeOrFnOrError.prototype instanceof Object) return this.#onErrorClass(scopeOrFnOrError, fnOrError);
@@ -482,14 +427,15 @@ var Elysia = class Elysia {
482
427
  const run = arguments[2];
483
428
  const isSchema = typeof schemaOrRun === "object";
484
429
  const callback = isSchema ? run : schemaOrRun;
485
- const child = new Elysia(this["~config"] || prefix ? {
430
+ const config = this["~config"] || prefix ? {
486
431
  ...this["~config"],
487
432
  name: void 0,
488
433
  seed: void 0,
489
434
  as: void 0,
490
435
  prefix
491
- } : void 0);
492
- child["~scopeChild"] = true;
436
+ } : void 0;
437
+ Elysia.#nextScopeChild = true;
438
+ const child = new Elysia(config);
493
439
  child.scopeParent = this;
494
440
  (this["~scopeChildren"] ??= []).push(child);
495
441
  const src = this["~ext"];
@@ -512,7 +458,6 @@ var Elysia = class Elysia {
512
458
  get #ext() {
513
459
  return this["~ext"] ??= require_utils.nullObject();
514
460
  }
515
- /** A group child starts or takes up its parent's table, see `group()` */
516
461
  #table(field) {
517
462
  return this.#ext[field] ??= this.scopeParent ? this.scopeParent.#table(field) : require_utils.nullObject();
518
463
  }
@@ -710,9 +655,7 @@ var Elysia = class Elysia {
710
655
  }
711
656
  #use(app) {
712
657
  let addedByThisCall;
713
- const config = app["~config"];
714
- if (app["~introspect"] || config?.introspect) this["~introspect"] = true;
715
- const name = config?.name;
658
+ const name = app["~config"]?.name;
716
659
  if (name) {
717
660
  const hash = app.hash;
718
661
  if (this.childrenHash?.has(hash)) return;
@@ -745,10 +688,6 @@ var Elysia = class Elysia {
745
688
  }
746
689
  return addedByThisCall;
747
690
  }
748
- /**
749
- * Reject a second, unrelated definition of an already-registered macro.
750
- * Split out of `#use` for the same reason as `#absorbExt`.
751
- */
752
691
  #assertMacroUnique(app, addedByThisCall) {
753
692
  const incomingMacro = app["~ext"]?.macro;
754
693
  const existingMacro = this["~ext"]?.macro;
@@ -763,14 +702,6 @@ var Elysia = class Elysia {
763
702
  throw new Error(`[Elysia] Macro "${macroName}" can be only define once`);
764
703
  }
765
704
  }
766
- /**
767
- * Merge the absorbed app's `~ext` container into this one.
768
- *
769
- * `#use` needed a frame wide enoughfor every local in this block + `#propagateHooks`
770
- * JSC pays that width on *entry*, before a single field is read
771
- *
772
- * Keep the cold blocks in their own frames.
773
- */
774
705
  #absorbExt(app, addedByThisCall) {
775
706
  const source = app["~ext"];
776
707
  const { decorator, store, headers, models, parser, macro, hoc, setup, cleanup, capability } = source;
@@ -857,10 +788,6 @@ var Elysia = class Elysia {
857
788
  }
858
789
  }
859
790
  }
860
- /**
861
- * Republish the absorbed app's plugin/global hooks onto this instance's chain.
862
- * Split out from #use, see #absorbExt
863
- */
864
791
  #propagateHooks(app, hookChain, addedByThisCall) {
865
792
  const nodes = useNodesBuffer;
866
793
  nodes.length = 0;
@@ -920,7 +847,7 @@ var Elysia = class Elysia {
920
847
  delete added.schema;
921
848
  if (dropRequest) delete added.request;
922
849
  }
923
- if (require_utils.isNotEmpty(added)) this.#pushChainNode(added, scope, registration, origin, app);
850
+ if (require_utils.isNotEmpty(added)) this.#pushChainNode(added, scope, registration, origin, scopeChild ? app : void 0);
924
851
  }
925
852
  if (lifting) liftedRequests.set(this, lifting);
926
853
  nodes.length = 0;
@@ -1090,10 +1017,6 @@ var Elysia = class Elysia {
1090
1017
  if (this["~generation"] === void 0) return;
1091
1018
  throw new Error(`[Elysia] .${api}() called after the app was sealed by its first request, listen or compile`);
1092
1019
  }
1093
- /**
1094
- * `#assertMutable` for the tables a group child shares with its parents:
1095
- * a child kept past its callback must not write into a sealed one
1096
- */
1097
1020
  #assertTableMutable(api) {
1098
1021
  for (let app = this; app; app = app.scopeParent) app.#assertMutable(api);
1099
1022
  }
@@ -1151,9 +1074,6 @@ var Elysia = class Elysia {
1151
1074
  return this;
1152
1075
  }
1153
1076
  }
1154
- /**
1155
- * Registered reusable models (via `.model()`), keyed by name.
1156
- */
1157
1077
  get models() {
1158
1078
  return this["~ext"]?.models ?? this.scopeParent?.models ?? require_utils.nullObject();
1159
1079
  }
@@ -1245,10 +1165,6 @@ var Elysia = class Elysia {
1245
1165
  OPTIONS: void 0
1246
1166
  };
1247
1167
  }
1248
- /**
1249
- * Force all route handlers to compile immediately (sets `precompile: true`
1250
- * on the config and triggers a fresh build of the fetch handler).
1251
- */
1252
1168
  compile() {
1253
1169
  this["~config"] ??= require_utils.nullObject();
1254
1170
  this["~config"].precompile = true;
@@ -1567,14 +1483,17 @@ var Elysia = class Elysia {
1567
1483
  break;
1568
1484
  }
1569
1485
  }
1570
- if (hasTypeBoxSchema) try {
1571
- require_type_bridge.warmTypebox();
1572
- } catch {}
1573
1486
  let markDuplicates = false;
1487
+ let eager = false;
1574
1488
  if (length) {
1575
1489
  const programId = this["~programId"];
1576
1490
  if (!require_compile_aot.Compiled.claim(programId, this["~aotFingerprint"] = require_compile_aot.createAotFingerprint())) require_compile_aot.Compiled.assertUncontested(programId);
1577
1491
  markDuplicates = require_compile_aot.Compiled.hasProgram(programId) || precompile !== true && require_universal_is_production.isProduction() && !require_compile_aot.Capture.isAotBuildEnv();
1492
+ if (hasTypeBoxSchema) try {
1493
+ require_type_bridge.warmTypebox();
1494
+ } catch {
1495
+ if (!require_type_bridge.isBridgeLive() && !require_compile_aot.Compiled.hasProgram(programId)) eager = markDuplicates = true;
1496
+ }
1578
1497
  }
1579
1498
  const isLoose = this["~config"]?.strictPath !== true;
1580
1499
  const collectExplicit = isLoose && table.hasLoose;
@@ -1624,7 +1543,7 @@ var Elysia = class Elysia {
1624
1543
  }
1625
1544
  continue;
1626
1545
  }
1627
- const lazy = !precompile && !this.compiled?.[i];
1546
+ const lazy = (eager ? (routeFlags & require_route_table.RouteFlag.ExactDuplicate) !== 0 : !precompile) && !this.compiled?.[i];
1628
1547
  if (lazy) {
1629
1548
  this.compiled ??= new Array(length);
1630
1549
  this.jitTable = table;
@@ -1634,14 +1553,14 @@ var Elysia = class Elysia {
1634
1553
  const registerLoose = isLoose && canRegisterLoose(routePath, isDynamic);
1635
1554
  if (!isDynamic && !needsEncode && !registerLoose) {
1636
1555
  const map = methods[routeMethod] ??= require_utils.nullObject();
1637
- map[routePath] = lazy ? ~i : this.handler(i, precompile, void 0, void 0, table);
1556
+ map[routePath] = lazy ? ~i : this.handler(i, true, void 0, void 0, table);
1638
1557
  continue;
1639
1558
  }
1640
1559
  const paths = expandPaths(routePath, needsEncode, registerLoose, registerLoose ? explicitPaths?.get(routeMethod) : void 0);
1641
1560
  if (isDynamic) {
1642
1561
  if (require_utils.isHTMLBundle(table.handler[i])) continue;
1643
1562
  const router = this["~router"] ??= new memoirist.default({ loosePath: isLoose });
1644
- const store = lazy ? i : this.handler(i, precompile, void 0, void 0, table);
1563
+ const store = lazy ? i : this.handler(i, true, void 0, void 0, table);
1645
1564
  for (let p = 0; p < paths.length; p++) router.add(routeMethod, paths[p], store);
1646
1565
  } else {
1647
1566
  const map = methods[routeMethod] ??= require_utils.nullObject();
@@ -1649,7 +1568,7 @@ var Elysia = class Elysia {
1649
1568
  method: routeMethod,
1650
1569
  paths
1651
1570
  };
1652
- const handler = lazy ? ~i : this.handler(i, precompile, void 0, void 0, table);
1571
+ const handler = lazy ? ~i : this.handler(i, true, void 0, void 0, table);
1653
1572
  for (let p = 0; p < paths.length; p++) map[paths[p]] = handler;
1654
1573
  }
1655
1574
  }
@@ -1680,21 +1599,6 @@ var Elysia = class Elysia {
1680
1599
  if (!require_compile_aot.Capture.isAotBuildEnv()) listen(this, options, callback);
1681
1600
  return this;
1682
1601
  }
1683
- /**
1684
- * Add a higher order function over Elysia.fetch
1685
- *
1686
- * @example
1687
- * ```ts
1688
- * const ctx = new AsyncLocalStorage<{ counter: number }>()
1689
- *
1690
- * new Elysia()
1691
- * .wrap(
1692
- * (fetch) => (request, ...rest) =>
1693
- * ctx.run({ counter: 0 }, () => fetch(request, ...rest))
1694
- * )
1695
- * .get('/', () => ctx.getStore())
1696
- * ```
1697
- */
1698
1602
  wrap(callback) {
1699
1603
  this.#assertMutable("wrap");
1700
1604
  if (this.fetchFn && !this.#pending) console.warn("[Elysia] .wrap() was called after the fetch handler was built");
@@ -1703,34 +1607,12 @@ var Elysia = class Elysia {
1703
1607
  (ext.hocOrigin ??= []).push(this.hash ?? {});
1704
1608
  return this;
1705
1609
  }
1706
- /**
1707
- * ### cleanup | Life cycle event
1708
- * Called after server stop serving request
1709
- *
1710
- * ---
1711
- * @example
1712
- * ```typescript
1713
- * new Elysia()
1714
- * .cleanup((app) => {
1715
- * closeDatabase()
1716
- * })
1717
- * ```
1718
- */
1719
1610
  cleanup(handler) {
1720
1611
  if (this["~ext"]?.cleanupEpoch?.(handler)) return this;
1721
1612
  this.#assertMutable("cleanup");
1722
1613
  (this.#ext.cleanup ??= []).push(...[].concat(handler));
1723
1614
  return this;
1724
1615
  }
1725
- /**
1726
- * Stop the underlying server (if any), then run every `cleanup` handler
1727
- *
1728
- * Awaiting `stop()` from inside a `setup`, `cleanup` or WebSocket lifecycle
1729
- * callback is only supported while that callback is still synchronous
1730
- *
1731
- * @param closeActiveConnections Pass `true` to terminate active
1732
- * transports. Omit (or pass `false`) to drain safely.
1733
- */
1734
1616
  stop(closeActiveConnections) {
1735
1617
  const stop = this["~ext"]?.stop;
1736
1618
  if (stop) return stop(closeActiveConnections);