elysia 2.0.0-exp.6 → 2.0.0-exp.60

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 (357) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +0 -14
  2. package/dist/_virtual/_rolldown/runtime.mjs +2 -0
  3. package/dist/adapter/bun/index.d.ts +3 -26
  4. package/dist/adapter/bun/index.js +192 -58
  5. package/dist/adapter/bun/index.mjs +193 -59
  6. package/dist/adapter/constants.d.ts +3 -26
  7. package/dist/adapter/default-headers.d.ts +4 -0
  8. package/dist/adapter/default-headers.js +7 -0
  9. package/dist/adapter/default-headers.mjs +5 -0
  10. package/dist/adapter/index.d.ts +2 -26
  11. package/dist/adapter/index.js +1 -19
  12. package/dist/adapter/index.mjs +1 -19
  13. package/dist/adapter/origin.d.ts +63 -0
  14. package/dist/adapter/origin.js +64 -0
  15. package/dist/adapter/origin.mjs +62 -0
  16. package/dist/adapter/response-ownership.d.ts +5 -0
  17. package/dist/adapter/response-ownership.js +13 -0
  18. package/dist/adapter/response-ownership.mjs +10 -0
  19. package/dist/adapter/skip-clone.d.ts +4 -0
  20. package/dist/adapter/skip-clone.js +7 -0
  21. package/dist/adapter/skip-clone.mjs +5 -0
  22. package/dist/adapter/types.d.ts +10 -35
  23. package/dist/adapter/utils.d.ts +21 -16
  24. package/dist/adapter/utils.js +351 -159
  25. package/dist/adapter/utils.mjs +351 -159
  26. package/dist/adapter/web-standard/handler.d.ts +3 -3
  27. package/dist/adapter/web-standard/handler.js +86 -84
  28. package/dist/adapter/web-standard/handler.mjs +88 -86
  29. package/dist/adapter/web-standard/index.d.ts +2 -26
  30. package/dist/adapter/web-standard/index.js +47 -2
  31. package/dist/adapter/web-standard/index.mjs +47 -2
  32. package/dist/adapter/web-standard/utils.js +9 -2
  33. package/dist/adapter/web-standard/utils.mjs +9 -2
  34. package/dist/base.d.ts +177 -338
  35. package/dist/base.js +941 -432
  36. package/dist/base.mjs +942 -433
  37. package/dist/compile/analysis-cache.d.ts +6 -0
  38. package/dist/compile/analysis-cache.js +12 -0
  39. package/dist/compile/analysis-cache.mjs +11 -0
  40. package/dist/compile/aot-capture.d.ts +24 -0
  41. package/dist/compile/aot-capture.js +376 -0
  42. package/dist/compile/aot-capture.mjs +365 -0
  43. package/dist/compile/aot-emit.d.ts +29 -0
  44. package/dist/compile/aot-emit.js +107 -0
  45. package/dist/compile/aot-emit.mjs +101 -0
  46. package/dist/compile/aot-reconstruct.d.ts +30 -0
  47. package/dist/compile/aot-reconstruct.js +156 -0
  48. package/dist/compile/aot-reconstruct.mjs +147 -0
  49. package/dist/compile/aot.d.ts +141 -60
  50. package/dist/compile/aot.js +169 -244
  51. package/dist/compile/aot.mjs +153 -234
  52. package/dist/compile/handler/descriptor.d.ts +77 -0
  53. package/dist/compile/handler/descriptor.js +198 -0
  54. package/dist/compile/handler/descriptor.mjs +193 -0
  55. package/dist/compile/handler/frozen-validator.d.ts +39 -0
  56. package/dist/compile/handler/frozen-validator.js +319 -0
  57. package/dist/compile/handler/frozen-validator.mjs +313 -0
  58. package/dist/compile/handler/index.d.ts +12 -4
  59. package/dist/compile/handler/index.js +202 -65
  60. package/dist/compile/handler/index.mjs +202 -69
  61. package/dist/compile/handler/jit.d.ts +15 -7
  62. package/dist/compile/handler/jit.js +240 -151
  63. package/dist/compile/handler/jit.mjs +243 -156
  64. package/dist/compile/handler/params.d.ts +6 -2
  65. package/dist/compile/handler/params.js +26 -6
  66. package/dist/compile/handler/params.mjs +28 -8
  67. package/dist/compile/handler/reconstruct.d.ts +3 -4
  68. package/dist/compile/handler/reconstruct.js +36 -15
  69. package/dist/compile/handler/reconstruct.mjs +36 -15
  70. package/dist/compile/handler/utils.d.ts +27 -12
  71. package/dist/compile/handler/utils.js +193 -128
  72. package/dist/compile/handler/utils.mjs +174 -113
  73. package/dist/compile/jit-probe.d.ts +0 -4
  74. package/dist/compile/jit-probe.js +1 -11
  75. package/dist/compile/jit-probe.mjs +1 -11
  76. package/dist/compile/lexer.d.ts +7 -0
  77. package/dist/compile/lexer.js +53 -0
  78. package/dist/compile/lexer.mjs +48 -0
  79. package/dist/compile/utils.js +8 -4
  80. package/dist/compile/utils.mjs +8 -4
  81. package/dist/constants.d.ts +4 -25
  82. package/dist/constants.js +17 -17
  83. package/dist/constants.mjs +15 -15
  84. package/dist/context.d.ts +14 -48
  85. package/dist/context.js +43 -20
  86. package/dist/context.mjs +44 -21
  87. package/dist/cookie/config.d.ts +5 -1
  88. package/dist/cookie/config.js +19 -22
  89. package/dist/cookie/config.mjs +18 -22
  90. package/dist/cookie/cookie.d.ts +3 -5
  91. package/dist/cookie/cookie.js +42 -23
  92. package/dist/cookie/cookie.mjs +43 -23
  93. package/dist/cookie/crypto.d.ts +20 -0
  94. package/dist/cookie/crypto.js +168 -0
  95. package/dist/cookie/crypto.mjs +151 -0
  96. package/dist/cookie/error.d.ts +17 -0
  97. package/dist/cookie/error.js +25 -0
  98. package/dist/cookie/error.mjs +24 -0
  99. package/dist/cookie/index.d.ts +5 -3
  100. package/dist/cookie/index.js +5 -3
  101. package/dist/cookie/index.mjs +4 -2
  102. package/dist/cookie/lib.d.ts +1 -1
  103. package/dist/cookie/lib.js +15 -13
  104. package/dist/cookie/lib.mjs +15 -13
  105. package/dist/cookie/serialize.js +5 -1
  106. package/dist/cookie/serialize.mjs +5 -1
  107. package/dist/cookie/types.d.ts +1 -3
  108. package/dist/cookie/utils.d.ts +14 -7
  109. package/dist/cookie/utils.js +108 -95
  110. package/dist/cookie/utils.mjs +103 -92
  111. package/dist/error.d.ts +99 -18
  112. package/dist/error.js +355 -120
  113. package/dist/error.mjs +347 -119
  114. package/dist/generation.d.ts +30 -0
  115. package/dist/generation.js +23 -0
  116. package/dist/generation.mjs +17 -0
  117. package/dist/handler/error.js +37 -6
  118. package/dist/handler/error.mjs +38 -7
  119. package/dist/handler/fetch.js +199 -131
  120. package/dist/handler/fetch.mjs +198 -131
  121. package/dist/handler/index.d.ts +1 -3
  122. package/dist/handler/index.js +1 -5
  123. package/dist/handler/index.mjs +1 -3
  124. package/dist/handler/utils.d.ts +11 -2
  125. package/dist/handler/utils.js +27 -5
  126. package/dist/handler/utils.mjs +24 -5
  127. package/dist/index.d.ts +17 -10
  128. package/dist/index.js +19 -7
  129. package/dist/index.mjs +11 -8
  130. package/dist/memory.js +2 -2
  131. package/dist/memory.mjs +2 -2
  132. package/dist/package.js +11 -0
  133. package/dist/package.mjs +5 -0
  134. package/dist/parse-query.js +43 -26
  135. package/dist/parse-query.mjs +39 -23
  136. package/dist/plugin/{bun.d.ts → aot/bun.d.ts} +4 -2
  137. package/dist/plugin/aot/bun.js +35 -0
  138. package/dist/plugin/aot/bun.mjs +34 -0
  139. package/dist/plugin/aot/core.d.ts +291 -0
  140. package/dist/plugin/aot/core.js +505 -0
  141. package/dist/plugin/aot/core.mjs +481 -0
  142. package/dist/plugin/{esbuild.d.ts → aot/esbuild.d.ts} +5 -3
  143. package/dist/plugin/aot/esbuild.js +48 -0
  144. package/dist/plugin/aot/esbuild.mjs +46 -0
  145. package/dist/plugin/aot/hooks.d.ts +28 -0
  146. package/dist/plugin/aot/hooks.js +114 -0
  147. package/dist/plugin/aot/hooks.mjs +112 -0
  148. package/dist/plugin/aot/rspack-loader.d.ts +23 -0
  149. package/dist/plugin/aot/rspack-loader.js +44 -0
  150. package/dist/plugin/aot/rspack-loader.mjs +40 -0
  151. package/dist/plugin/aot/rspack.d.ts +23 -0
  152. package/dist/plugin/aot/rspack.js +85 -0
  153. package/dist/plugin/aot/rspack.mjs +82 -0
  154. package/dist/plugin/aot/source.d.ts +60 -0
  155. package/dist/plugin/aot/source.js +422 -0
  156. package/dist/plugin/aot/source.mjs +418 -0
  157. package/dist/plugin/aot/treeshake.d.ts +4 -0
  158. package/dist/plugin/aot/treeshake.js +95 -0
  159. package/dist/plugin/aot/treeshake.mjs +94 -0
  160. package/dist/plugin/aot/unplugin.d.ts +50 -0
  161. package/dist/plugin/aot/unplugin.js +64 -0
  162. package/dist/plugin/aot/unplugin.mjs +62 -0
  163. package/dist/plugin/{vite.d.ts → aot/vite.d.ts} +4 -3
  164. package/dist/plugin/aot/vite.js +34 -0
  165. package/dist/plugin/aot/vite.mjs +33 -0
  166. package/dist/plugin/aot/worker.js +28 -0
  167. package/dist/plugin/aot/worker.mjs +27 -0
  168. package/dist/plugin/auto-head.d.ts +6 -0
  169. package/dist/plugin/auto-head.js +38 -0
  170. package/dist/plugin/auto-head.mjs +36 -0
  171. package/dist/plugin/trace.d.ts +10 -0
  172. package/dist/plugin/trace.js +39 -0
  173. package/dist/plugin/trace.mjs +36 -0
  174. package/dist/plugin/websocket.d.ts +6 -0
  175. package/dist/plugin/websocket.js +61 -0
  176. package/dist/plugin/websocket.mjs +60 -0
  177. package/dist/route-table.d.ts +28 -0
  178. package/dist/route-table.js +64 -0
  179. package/dist/route-table.mjs +61 -0
  180. package/dist/schema-snapshot.d.ts +9 -0
  181. package/dist/schema-snapshot.js +271 -0
  182. package/dist/schema-snapshot.mjs +269 -0
  183. package/dist/sucrose.d.ts +2 -24
  184. package/dist/sucrose.js +557 -228
  185. package/dist/sucrose.mjs +559 -227
  186. package/dist/trace.d.ts +27 -57
  187. package/dist/trace.js +256 -141
  188. package/dist/trace.mjs +256 -141
  189. package/dist/type/bridge-live.d.ts +15 -0
  190. package/dist/type/bridge-live.js +39 -0
  191. package/dist/type/bridge-live.mjs +17 -0
  192. package/dist/type/bridge.d.ts +20 -11
  193. package/dist/type/bridge.js +35 -2
  194. package/dist/type/bridge.mjs +11 -3
  195. package/dist/type/coerce-plan.d.ts +38 -0
  196. package/dist/type/coerce-plan.js +107 -0
  197. package/dist/type/coerce-plan.mjs +98 -0
  198. package/dist/type/coerce.d.ts +5 -23
  199. package/dist/type/coerce.js +49 -172
  200. package/dist/type/coerce.mjs +35 -158
  201. package/dist/type/compat.d.ts +5 -1
  202. package/dist/type/compat.js +10 -4
  203. package/dist/type/compat.mjs +12 -6
  204. package/dist/type/constants.d.ts +1 -1
  205. package/dist/type/elysia/accelerate.js +2 -1
  206. package/dist/type/elysia/accelerate.mjs +2 -1
  207. package/dist/type/elysia/array-buffer.d.ts +1 -2
  208. package/dist/type/elysia/array-buffer.js +9 -3
  209. package/dist/type/elysia/array-buffer.mjs +10 -4
  210. package/dist/type/elysia/array-string.js +3 -3
  211. package/dist/type/elysia/array-string.mjs +1 -1
  212. package/dist/type/elysia/array.js +7 -4
  213. package/dist/type/elysia/array.mjs +7 -4
  214. package/dist/type/elysia/boolean-string.js +2 -1
  215. package/dist/type/elysia/boolean-string.mjs +2 -1
  216. package/dist/type/elysia/boolean.js +6 -3
  217. package/dist/type/elysia/boolean.mjs +6 -3
  218. package/dist/type/elysia/cookie.d.ts +2 -5
  219. package/dist/type/elysia/date.js +38 -7
  220. package/dist/type/elysia/date.mjs +39 -8
  221. package/dist/type/elysia/file-type.d.ts +2 -1
  222. package/dist/type/elysia/file-type.js +11 -13
  223. package/dist/type/elysia/file-type.mjs +12 -14
  224. package/dist/type/elysia/file.js +10 -4
  225. package/dist/type/elysia/file.mjs +10 -4
  226. package/dist/type/elysia/files.js +16 -6
  227. package/dist/type/elysia/files.mjs +18 -8
  228. package/dist/type/elysia/integer-string.js +6 -4
  229. package/dist/type/elysia/integer-string.mjs +6 -4
  230. package/dist/type/elysia/integer.js +6 -3
  231. package/dist/type/elysia/integer.mjs +6 -3
  232. package/dist/type/elysia/intersect.js +8 -5
  233. package/dist/type/elysia/intersect.mjs +7 -4
  234. package/dist/type/elysia/maybe-empty.js +4 -2
  235. package/dist/type/elysia/maybe-empty.mjs +5 -3
  236. package/dist/type/elysia/nullable.js +4 -1
  237. package/dist/type/elysia/nullable.mjs +5 -2
  238. package/dist/type/elysia/number.js +6 -3
  239. package/dist/type/elysia/number.mjs +6 -3
  240. package/dist/type/elysia/numeric.js +29 -3
  241. package/dist/type/elysia/numeric.mjs +29 -3
  242. package/dist/type/elysia/object-string.js +3 -3
  243. package/dist/type/elysia/object-string.mjs +1 -1
  244. package/dist/type/elysia/object.js +8 -5
  245. package/dist/type/elysia/object.mjs +8 -5
  246. package/dist/type/elysia/optional.js +11 -13
  247. package/dist/type/elysia/optional.mjs +12 -13
  248. package/dist/type/elysia/string.js +22 -6
  249. package/dist/type/elysia/string.mjs +22 -6
  250. package/dist/type/elysia/uint8-array.d.ts +1 -2
  251. package/dist/type/elysia/uint8-array.js +10 -4
  252. package/dist/type/elysia/uint8-array.mjs +11 -5
  253. package/dist/type/elysia/union-enum.js +3 -2
  254. package/dist/type/elysia/union-enum.mjs +4 -3
  255. package/dist/type/elysia/union.js +6 -3
  256. package/dist/type/elysia/union.mjs +6 -3
  257. package/dist/type/elysia/utils.d.ts +3 -2
  258. package/dist/type/elysia/utils.js +32 -34
  259. package/dist/type/elysia/utils.mjs +32 -35
  260. package/dist/type/exports.js +6 -2073
  261. package/dist/type/exports.mjs +3 -323
  262. package/dist/type/index.d.ts +6 -2
  263. package/dist/type/index.js +64 -2
  264. package/dist/type/index.mjs +62 -3
  265. package/dist/type/shared.d.ts +27 -0
  266. package/dist/type/shared.js +171 -0
  267. package/dist/type/shared.mjs +161 -0
  268. package/dist/type/types.d.ts +20 -8
  269. package/dist/type/utils.js +29 -63
  270. package/dist/type/utils.mjs +29 -63
  271. package/dist/type/validator/clean-safe.d.ts +8 -0
  272. package/dist/type/validator/clean-safe.js +82 -0
  273. package/dist/type/validator/clean-safe.mjs +77 -0
  274. package/dist/type/validator/custom-error.js +124 -46
  275. package/dist/type/validator/custom-error.mjs +125 -47
  276. package/dist/type/validator/default-precompute.d.ts +7 -3
  277. package/dist/type/validator/default-precompute.js +61 -105
  278. package/dist/type/validator/default-precompute.mjs +60 -104
  279. package/dist/type/validator/exact-mirror.d.ts +7 -0
  280. package/dist/type/validator/exact-mirror.js +19 -0
  281. package/dist/type/validator/exact-mirror.mjs +15 -0
  282. package/dist/type/validator/frozen-check.js +4 -3
  283. package/dist/type/validator/frozen-check.mjs +2 -1
  284. package/dist/type/validator/index.d.ts +3 -2
  285. package/dist/type/validator/index.js +324 -239
  286. package/dist/type/validator/index.mjs +326 -242
  287. package/dist/type/validator/string-codec-aot.d.ts +2 -3
  288. package/dist/type/validator/string-codec-aot.js +12 -50
  289. package/dist/type/validator/string-codec-aot.mjs +10 -46
  290. package/dist/type/validator/validator-cache.d.ts +14 -9
  291. package/dist/type/validator/validator-cache.js +170 -86
  292. package/dist/type/validator/validator-cache.mjs +168 -87
  293. package/dist/types.d.ts +195 -107
  294. package/dist/universal/constants.d.ts +1 -3
  295. package/dist/universal/constants.js +1 -5
  296. package/dist/universal/constants.mjs +1 -3
  297. package/dist/universal/env.d.ts +3 -2
  298. package/dist/universal/env.js +6 -2
  299. package/dist/universal/env.mjs +5 -2
  300. package/dist/universal/file.d.ts +12 -5
  301. package/dist/universal/file.js +76 -47
  302. package/dist/universal/file.mjs +76 -47
  303. package/dist/universal/index.d.ts +2 -1
  304. package/dist/universal/index.js +3 -1
  305. package/dist/universal/index.mjs +2 -1
  306. package/dist/universal/is-production.d.ts +5 -0
  307. package/dist/universal/is-production.js +10 -0
  308. package/dist/universal/is-production.mjs +8 -0
  309. package/dist/universal/server.d.ts +1 -0
  310. package/dist/utils.d.ts +60 -21
  311. package/dist/utils.js +307 -54
  312. package/dist/utils.mjs +291 -53
  313. package/dist/validator/index.d.ts +13 -12
  314. package/dist/validator/index.js +157 -68
  315. package/dist/validator/index.mjs +158 -69
  316. package/dist/validator/route.d.ts +0 -1
  317. package/dist/validator/route.js +5 -3
  318. package/dist/validator/route.mjs +6 -4
  319. package/dist/ws/context.d.ts +13 -12
  320. package/dist/ws/context.js +33 -67
  321. package/dist/ws/context.mjs +33 -67
  322. package/dist/ws/parser.d.ts +1 -4
  323. package/dist/ws/route.d.ts +8 -3
  324. package/dist/ws/route.js +343 -133
  325. package/dist/ws/route.mjs +341 -135
  326. package/dist/ws/types.d.ts +47 -5
  327. package/package.json +87 -34
  328. package/dist/adapter/bun/router.d.ts +0 -10
  329. package/dist/adapter/bun/router.js +0 -86
  330. package/dist/adapter/bun/router.mjs +0 -83
  331. package/dist/compile/handler/constants.js +0 -1
  332. package/dist/compile/handler/constants.mjs +0 -1
  333. package/dist/compile/index.d.ts +0 -3
  334. package/dist/compile/index.js +0 -8
  335. package/dist/compile/index.mjs +0 -4
  336. package/dist/compile/types.d.ts +0 -4
  337. package/dist/compile/types.js +0 -1
  338. package/dist/compile/types.mjs +0 -1
  339. package/dist/plugin/bun.js +0 -82
  340. package/dist/plugin/bun.mjs +0 -80
  341. package/dist/plugin/core.d.ts +0 -87
  342. package/dist/plugin/core.js +0 -109
  343. package/dist/plugin/core.mjs +0 -102
  344. package/dist/plugin/esbuild.js +0 -83
  345. package/dist/plugin/esbuild.mjs +0 -81
  346. package/dist/plugin/source.d.ts +0 -75
  347. package/dist/plugin/source.js +0 -354
  348. package/dist/plugin/source.mjs +0 -349
  349. package/dist/plugin/treeshake.d.ts +0 -10
  350. package/dist/plugin/treeshake.js +0 -63
  351. package/dist/plugin/treeshake.mjs +0 -61
  352. package/dist/plugin/vite.js +0 -61
  353. package/dist/plugin/vite.mjs +0 -60
  354. package/dist/universal/types.d.ts +0 -127
  355. package/dist/universal/types.js +0 -20
  356. package/dist/universal/types.mjs +0 -17
  357. /package/dist/{compile/handler/constants.d.ts → plugin/aot/worker.d.ts} +0 -0
@@ -5,19 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (!no_symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
8
  var __copyProps = (to, from, except, desc) => {
22
9
  if (from && typeof from === "object" || typeof from === "function") {
23
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -39,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
26
 
40
27
  //#endregion
41
28
 
42
- exports.__exportAll = __exportAll;
43
29
  exports.__toESM = __toESM;
@@ -1,3 +1,5 @@
1
+ import { createRequire } from "node:module";
2
+
1
3
  //#region \0rolldown/runtime.js
2
4
  var __defProp = Object.defineProperty;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,30 +1,7 @@
1
- import { ListenCallback, Serve } from "../../universal/server.js";
2
- import { AnyLocalHook, MaybePromise } from "../../types.js";
3
- import { Context } from "../../context.js";
4
1
  import { AnyElysia } from "../../base.js";
2
+ import { ElysiaAdapterOptions } from "../types.js";
5
3
  //#region src/adapter/bun/index.d.ts
6
- declare function collectStaticRoutes(app: AnyElysia): readonly [Record<string, Record<string, Response>>, Promise<void>[]] | undefined;
7
- declare const BunAdapter: {
8
- parse: {
9
- default: (context: Context, contentType: string) => string | ArrayBuffer | unknown[] | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
10
- json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
11
- text: (context: Context) => MaybePromise<string>;
12
- urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
13
- arrayBuffer: (context: Context) => MaybePromise<ArrayBuffer>;
14
- formData: (context: Context) => MaybePromise<Record<string, unknown>>;
15
- };
16
- name: string;
17
- runtime: "node" | "deno" | "bun" | "cloudflare-worker" | "browser" | "vercel" | "netlify" | "lambda" | "fastly" | "edge" | "unknown" | (string & {});
18
- isWebStandard: boolean;
19
- listen?(app: AnyElysia, options: string | number | Partial<Serve>, callback?: ListenCallback): void;
20
- stop?(app: AnyElysia, closeActiveConnections?: boolean): Promise<void>;
21
- response: {
22
- map(response: unknown, set: Context["set"], ...params: unknown[]): unknown;
23
- compact?(response: unknown, ...params: unknown[]): unknown;
24
- static?(handle: unknown, hooks: AnyLocalHook, setHeaders?: Context["set"]["headers"], ...params: unknown[]): (() => unknown) | undefined;
25
- nativeStatic?(handle: unknown, hooks: AnyLocalHook, set?: Context["set"]): (() => MaybePromise<Response>) | undefined;
26
- };
27
- fetch?(app: AnyElysia): (request: Request) => MaybePromise<Response>;
28
- };
4
+ declare function collectStaticRoutes(app: AnyElysia): readonly [Record<string, Record<string, Response>>, readonly []] | undefined;
5
+ declare const BunAdapter: ElysiaAdapterOptions<void>;
29
6
  //#endregion
30
7
  export { BunAdapter, collectStaticRoutes };
@@ -1,84 +1,218 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_adapter_index = require('../index.js');
3
+ const require_constants = require('../../constants.js');
3
4
  const require_utils = require('../../utils.js');
4
5
  const require_adapter_web_standard_index = require('../web-standard/index.js');
5
- const require_memory = require('../../memory.js');
6
- const require_ws_route = require('../../ws/route.js');
6
+ const require_generation = require('../../generation.js');
7
+ const require_adapter_origin = require('../origin.js');
8
+ const require_compile_handler_index = require('../../compile/handler/index.js');
9
+ const require_route_table = require('../../route-table.js');
7
10
 
8
11
  //#region src/adapter/bun/index.ts
12
+ /**
13
+ * ! This may looks like it would cause race condition, but it is not
14
+ * Bun is single-threaded and synchronous, so the `finally` block will
15
+ * always run before the next request comes in
16
+ * @see ../origin.ts
17
+ *
18
+ * `finally` runs on the synchronous return of `fetch` (the returned promise is
19
+ * not awaited), so the slot is live only for the handler's synchronous prologue
20
+ */
21
+ const withOrigin = (fetch) => (request, server) => {
22
+ require_adapter_origin.origin.request = request;
23
+ try {
24
+ return fetch(request, server);
25
+ } finally {
26
+ require_adapter_origin.origin.request = void 0;
27
+ }
28
+ };
29
+ const nativeStaticMethods = new Set([
30
+ "GET",
31
+ "POST",
32
+ "PUT",
33
+ "DELETE",
34
+ "PATCH",
35
+ "HEAD",
36
+ "OPTIONS"
37
+ ]);
9
38
  function collectStaticRoutes(app) {
10
- if (app["~ext"]?.hoc?.length) return;
11
- const hook = require_utils.flattenChain(app["~hookChain"]);
12
- if (hook && (hook?.request?.length || hook?.mapResponse?.length || hook?.afterResponse?.length || hook?.trace?.length)) return;
39
+ if (app["~config"]?.nativeStaticResponse === false) return;
13
40
  app.fetch;
14
- const source = app["~staticResponse"];
15
- if (!source) return;
41
+ const frozenRoot = require_generation.frozenRootOf(app);
42
+ const fetchLevelHook = require_utils.flattenChain(frozenRoot["~hookChain"]);
43
+ if (fetchLevelHook?.request?.length || fetchLevelHook?.trace?.length || frozenRoot["~ext"]?.hoc?.length) return;
44
+ const table = app["~generation"]?.routeTable ?? app["~routeTable"];
45
+ const length = table?.length ?? 0;
46
+ if (!table || !length) return;
47
+ const methods = table.method;
48
+ const paths = table.path;
49
+ const handlers = table.handler;
50
+ let hasCandidate = false;
51
+ for (let i = 0; i < length; i++) {
52
+ const h = handlers[i];
53
+ if (typeof h === "function" || h instanceof Error || h instanceof Promise) continue;
54
+ if (!nativeStaticMethods.has(methods[i])) continue;
55
+ hasCandidate = true;
56
+ break;
57
+ }
58
+ if (!hasCandidate) return;
16
59
  const ready = require_utils.nullObject();
17
- const pending = [];
18
- for (const rawPath in source) {
19
- const path = encodeURI(rawPath);
20
- const methods = source[rawPath];
21
- for (const method in methods) {
22
- const value = methods[method];
23
- if (value instanceof Promise) pending.push(value.then((resolved) => {
24
- if (resolved instanceof Response) (ready[path] ??= require_utils.nullObject())[method] = resolved;
25
- }, (err) => {
26
- console.error(`[Elysia] Static route ${method} ${path} failed to resolve:`, err);
27
- }));
28
- else (ready[path] ??= require_utils.nullObject())[method] = value;
60
+ const strictPath = frozenRoot["~config"]?.strictPath === true;
61
+ const seen = /* @__PURE__ */ new Map();
62
+ for (let i = 0; i < length; i++) seen.set(methods[i] + " " + paths[i], i);
63
+ let explicitPaths;
64
+ if (!strictPath) {
65
+ explicitPaths = /* @__PURE__ */ new Map();
66
+ for (let i = 0; i < length; i++) {
67
+ const method = methods[i];
68
+ const path = paths[i];
69
+ let set = explicitPaths.get(method);
70
+ if (!set) explicitPaths.set(method, set = /* @__PURE__ */ new Set());
71
+ set.add(path);
72
+ if (require_constants.needEncodeRegex.test(path)) {
73
+ const encoded = encodeURI(path);
74
+ if (encoded !== path) set.add(encoded);
75
+ }
29
76
  }
30
77
  }
31
- return [ready, pending];
78
+ const add = (method, path, value) => {
79
+ if (require_constants.needEncodeRegex.test(path)) path = encodeURI(path);
80
+ (ready[path] ??= require_utils.nullObject())[method] = value;
81
+ };
82
+ for (let i = 0; i < length; i++) {
83
+ const method = methods[i];
84
+ if (method === "WS") continue;
85
+ const path = paths[i];
86
+ if (seen.get(method + " " + path) !== i) continue;
87
+ if (!nativeStaticMethods.has(method)) continue;
88
+ const h = handlers[i];
89
+ if (typeof h === "function" || h instanceof Error || h instanceof Promise) continue;
90
+ const value = require_compile_handler_index.buildNativeStaticResponse(require_route_table.routeRow(table, i), app);
91
+ if (!value) continue;
92
+ add(method, path, value);
93
+ if (!strictPath && !require_constants.isDynamicRegex.test(path)) {
94
+ const loose = require_utils.getLoosePath(path);
95
+ if (loose !== path && !explicitPaths?.get(method)?.has(loose)) add(method, loose, value);
96
+ }
97
+ }
98
+ if (!Object.keys(ready).length) return;
99
+ return [ready, []];
32
100
  }
33
101
  const BunAdapter = require_adapter_index.createAdapter({
34
- ...require_adapter_web_standard_index.WebStandardAdapter,
35
102
  name: "bun",
36
103
  runtime: "bun",
104
+ isWebStandard: true,
105
+ parse: require_adapter_web_standard_index.WebStandardAdapter.parse,
106
+ response: require_adapter_web_standard_index.WebStandardAdapter.response,
37
107
  listen(app, options, callback) {
38
108
  const _config = app["~config"]?.serve;
39
- const _options = typeof options === "object" ? options : { port: +options };
109
+ const optionsIsObject = typeof options === "object";
110
+ let live;
111
+ const gatedFetch = (request, server) => live ? live(request, server) : Promise.resolve(ready).then(() => {
112
+ if (!live) throw new Error("[Elysia] Server was stopped before it was ready");
113
+ return live(request, server);
114
+ });
115
+ const _options = optionsIsObject ? { ...options } : {
116
+ port: +options,
117
+ fetch: gatedFetch
118
+ };
119
+ if (optionsIsObject) _options.fetch = gatedFetch;
40
120
  const serve = _config ? {
41
121
  ..._config,
42
122
  ..._options
43
123
  } : _options;
44
- const hasWs = app["~hasWS"];
45
- serve.fetch = (request, server) => app.fetch(request, server);
46
- app.server = Bun.serve(serve);
47
- if (!hasWs) callback?.(app.server);
48
- queueMicrotask(() => {
49
- if (!app.pending) serve.fetch = app.fetch;
50
- const buildWebSocket = () => {
51
- const defaultConfig = app["~config"]?.websocket;
52
- serve.websocket = defaultConfig ? Object.assign(require_ws_route.buildGlobalWSHandler(), defaultConfig) : require_ws_route.buildGlobalWSHandler();
53
- };
54
- if (hasWs) buildWebSocket();
55
- const collectRoutes = () => {
56
- const staticRoutes = collectStaticRoutes(app);
57
- if (!staticRoutes) return;
58
- if (staticRoutes[1].length) return Promise.all(staticRoutes[1]).then(() => {
59
- serve.routes = staticRoutes[0];
60
- app.server.reload(serve);
61
- });
62
- if (Object.keys(staticRoutes[0]).length) serve.routes = staticRoutes[0];
124
+ let ready;
125
+ const build = () => {
126
+ const fetch = app.fetch;
127
+ let routes;
128
+ try {
129
+ routes = collectStaticRoutes(app);
130
+ } catch (error) {
131
+ console.warn("[Elysia] Native static promotion was skipped:", error);
132
+ }
133
+ let websocket;
134
+ if (app["~hasWS"]) {
135
+ const resolved = require_generation.resolvedWsOf(app);
136
+ if (!resolved) throw new Error("[Elysia] internal: WebSocket routes are present but no capability provider was resolved");
137
+ websocket = resolved.config ? Object.assign(resolved.provider.buildGlobalWSHandler(), resolved.config) : resolved.provider.buildGlobalWSHandler();
138
+ }
139
+ return {
140
+ fetch,
141
+ routes,
142
+ websocket
63
143
  };
64
- if (app.pending) {
65
- if (app.server) app.server.reload(serve);
66
- else app.server = Bun.serve(serve);
67
- const reloadAfterModules = () => {
68
- serve.fetch = app.fetch;
69
- if (hasWs || app["~hasWS"]) buildWebSocket();
70
- collectRoutes();
71
- app.server.reload(serve);
72
- };
73
- app.modules.then(reloadAfterModules, reloadAfterModules);
74
- } else {
75
- collectRoutes();
76
- if (app.server) app.server.reload(serve);
77
- else app.server = Bun.serve(serve);
144
+ };
145
+ let built;
146
+ const server = app.server = Bun.serve(serve);
147
+ const reload = () => {
148
+ try {
149
+ server.reload(serve);
150
+ } catch (error) {
151
+ if (!serve.routes) throw error;
152
+ delete serve.routes;
153
+ console.warn("[Elysia] Native static promotion was skipped:", error);
154
+ try {
155
+ server.reload(serve);
156
+ } catch (fallbackError) {
157
+ console.error("[Elysia] Failed to reload Bun server:", fallbackError);
158
+ throw fallbackError;
159
+ }
78
160
  }
79
- require_memory.flushMemory();
80
- if (hasWs) callback?.(app.server);
81
- });
161
+ };
162
+ const setup = () => {
163
+ const onSetup = app["~ext"]?.setup;
164
+ if (!onSetup) return;
165
+ let pendingSetups;
166
+ for (let i = 0; i < onSetup.length; i++) {
167
+ const result = onSetup[i](app);
168
+ if (result && typeof result.then === "function") (pendingSetups ??= []).push(result);
169
+ }
170
+ if (pendingSetups) return Promise.all(pendingSetups);
171
+ };
172
+ const rollback = (error) => {
173
+ if (app.server !== server) return;
174
+ try {
175
+ server.stop(true);
176
+ } catch (stopError) {
177
+ console.error(stopError);
178
+ } finally {
179
+ app.server = void 0;
180
+ }
181
+ const cleanup = app["~ext"]?.cleanup;
182
+ if (cleanup) for (let i = cleanup.length - 1; i >= 0; i--) try {
183
+ const result = cleanup[i](app);
184
+ if (result && typeof result.then === "function") Promise.resolve(result).catch(console.error);
185
+ } catch (cleanupError) {
186
+ console.error(cleanupError);
187
+ }
188
+ return error;
189
+ };
190
+ const publish = () => {
191
+ if (app.server !== server) return;
192
+ built ??= build();
193
+ live = serve.fetch = withOrigin(built.fetch);
194
+ if (built.websocket) serve.websocket = built.websocket;
195
+ if (built.routes) serve.routes = built.routes[0];
196
+ reload();
197
+ if (callback) callback(server);
198
+ };
199
+ const start = () => {
200
+ if (app.server !== server) return;
201
+ const setupReady = setup();
202
+ if (setupReady && typeof setupReady.then === "function") return Promise.resolve(setupReady).then(publish);
203
+ publish();
204
+ };
205
+ try {
206
+ if (app.pending) ready = app.modules.then(start);
207
+ else ready = Promise.resolve().then(start);
208
+ ready.catch((error) => {
209
+ console.error("[Elysia] listen() failed:", error);
210
+ return rollback(error);
211
+ });
212
+ } catch (error) {
213
+ rollback(error);
214
+ throw error;
215
+ }
82
216
  }
83
217
  });
84
218
 
@@ -1,83 +1,217 @@
1
1
  import { createAdapter } from "../index.mjs";
2
- import { flattenChain, nullObject } from "../../utils.mjs";
2
+ import { isDynamicRegex, needEncodeRegex } from "../../constants.mjs";
3
+ import { flattenChain, getLoosePath, nullObject } from "../../utils.mjs";
3
4
  import { WebStandardAdapter } from "../web-standard/index.mjs";
4
- import { flushMemory } from "../../memory.mjs";
5
- import { buildGlobalWSHandler } from "../../ws/route.mjs";
5
+ import { frozenRootOf, resolvedWsOf } from "../../generation.mjs";
6
+ import { origin } from "../origin.mjs";
7
+ import { buildNativeStaticResponse } from "../../compile/handler/index.mjs";
8
+ import { routeRow } from "../../route-table.mjs";
6
9
 
7
10
  //#region src/adapter/bun/index.ts
11
+ /**
12
+ * ! This may looks like it would cause race condition, but it is not
13
+ * Bun is single-threaded and synchronous, so the `finally` block will
14
+ * always run before the next request comes in
15
+ * @see ../origin.ts
16
+ *
17
+ * `finally` runs on the synchronous return of `fetch` (the returned promise is
18
+ * not awaited), so the slot is live only for the handler's synchronous prologue
19
+ */
20
+ const withOrigin = (fetch) => (request, server) => {
21
+ origin.request = request;
22
+ try {
23
+ return fetch(request, server);
24
+ } finally {
25
+ origin.request = void 0;
26
+ }
27
+ };
28
+ const nativeStaticMethods = new Set([
29
+ "GET",
30
+ "POST",
31
+ "PUT",
32
+ "DELETE",
33
+ "PATCH",
34
+ "HEAD",
35
+ "OPTIONS"
36
+ ]);
8
37
  function collectStaticRoutes(app) {
9
- if (app["~ext"]?.hoc?.length) return;
10
- const hook = flattenChain(app["~hookChain"]);
11
- if (hook && (hook?.request?.length || hook?.mapResponse?.length || hook?.afterResponse?.length || hook?.trace?.length)) return;
38
+ if (app["~config"]?.nativeStaticResponse === false) return;
12
39
  app.fetch;
13
- const source = app["~staticResponse"];
14
- if (!source) return;
40
+ const frozenRoot = frozenRootOf(app);
41
+ const fetchLevelHook = flattenChain(frozenRoot["~hookChain"]);
42
+ if (fetchLevelHook?.request?.length || fetchLevelHook?.trace?.length || frozenRoot["~ext"]?.hoc?.length) return;
43
+ const table = app["~generation"]?.routeTable ?? app["~routeTable"];
44
+ const length = table?.length ?? 0;
45
+ if (!table || !length) return;
46
+ const methods = table.method;
47
+ const paths = table.path;
48
+ const handlers = table.handler;
49
+ let hasCandidate = false;
50
+ for (let i = 0; i < length; i++) {
51
+ const h = handlers[i];
52
+ if (typeof h === "function" || h instanceof Error || h instanceof Promise) continue;
53
+ if (!nativeStaticMethods.has(methods[i])) continue;
54
+ hasCandidate = true;
55
+ break;
56
+ }
57
+ if (!hasCandidate) return;
15
58
  const ready = nullObject();
16
- const pending = [];
17
- for (const rawPath in source) {
18
- const path = encodeURI(rawPath);
19
- const methods = source[rawPath];
20
- for (const method in methods) {
21
- const value = methods[method];
22
- if (value instanceof Promise) pending.push(value.then((resolved) => {
23
- if (resolved instanceof Response) (ready[path] ??= nullObject())[method] = resolved;
24
- }, (err) => {
25
- console.error(`[Elysia] Static route ${method} ${path} failed to resolve:`, err);
26
- }));
27
- else (ready[path] ??= nullObject())[method] = value;
59
+ const strictPath = frozenRoot["~config"]?.strictPath === true;
60
+ const seen = /* @__PURE__ */ new Map();
61
+ for (let i = 0; i < length; i++) seen.set(methods[i] + " " + paths[i], i);
62
+ let explicitPaths;
63
+ if (!strictPath) {
64
+ explicitPaths = /* @__PURE__ */ new Map();
65
+ for (let i = 0; i < length; i++) {
66
+ const method = methods[i];
67
+ const path = paths[i];
68
+ let set = explicitPaths.get(method);
69
+ if (!set) explicitPaths.set(method, set = /* @__PURE__ */ new Set());
70
+ set.add(path);
71
+ if (needEncodeRegex.test(path)) {
72
+ const encoded = encodeURI(path);
73
+ if (encoded !== path) set.add(encoded);
74
+ }
28
75
  }
29
76
  }
30
- return [ready, pending];
77
+ const add = (method, path, value) => {
78
+ if (needEncodeRegex.test(path)) path = encodeURI(path);
79
+ (ready[path] ??= nullObject())[method] = value;
80
+ };
81
+ for (let i = 0; i < length; i++) {
82
+ const method = methods[i];
83
+ if (method === "WS") continue;
84
+ const path = paths[i];
85
+ if (seen.get(method + " " + path) !== i) continue;
86
+ if (!nativeStaticMethods.has(method)) continue;
87
+ const h = handlers[i];
88
+ if (typeof h === "function" || h instanceof Error || h instanceof Promise) continue;
89
+ const value = buildNativeStaticResponse(routeRow(table, i), app);
90
+ if (!value) continue;
91
+ add(method, path, value);
92
+ if (!strictPath && !isDynamicRegex.test(path)) {
93
+ const loose = getLoosePath(path);
94
+ if (loose !== path && !explicitPaths?.get(method)?.has(loose)) add(method, loose, value);
95
+ }
96
+ }
97
+ if (!Object.keys(ready).length) return;
98
+ return [ready, []];
31
99
  }
32
100
  const BunAdapter = createAdapter({
33
- ...WebStandardAdapter,
34
101
  name: "bun",
35
102
  runtime: "bun",
103
+ isWebStandard: true,
104
+ parse: WebStandardAdapter.parse,
105
+ response: WebStandardAdapter.response,
36
106
  listen(app, options, callback) {
37
107
  const _config = app["~config"]?.serve;
38
- const _options = typeof options === "object" ? options : { port: +options };
108
+ const optionsIsObject = typeof options === "object";
109
+ let live;
110
+ const gatedFetch = (request, server) => live ? live(request, server) : Promise.resolve(ready).then(() => {
111
+ if (!live) throw new Error("[Elysia] Server was stopped before it was ready");
112
+ return live(request, server);
113
+ });
114
+ const _options = optionsIsObject ? { ...options } : {
115
+ port: +options,
116
+ fetch: gatedFetch
117
+ };
118
+ if (optionsIsObject) _options.fetch = gatedFetch;
39
119
  const serve = _config ? {
40
120
  ..._config,
41
121
  ..._options
42
122
  } : _options;
43
- const hasWs = app["~hasWS"];
44
- serve.fetch = (request, server) => app.fetch(request, server);
45
- app.server = Bun.serve(serve);
46
- if (!hasWs) callback?.(app.server);
47
- queueMicrotask(() => {
48
- if (!app.pending) serve.fetch = app.fetch;
49
- const buildWebSocket = () => {
50
- const defaultConfig = app["~config"]?.websocket;
51
- serve.websocket = defaultConfig ? Object.assign(buildGlobalWSHandler(), defaultConfig) : buildGlobalWSHandler();
52
- };
53
- if (hasWs) buildWebSocket();
54
- const collectRoutes = () => {
55
- const staticRoutes = collectStaticRoutes(app);
56
- if (!staticRoutes) return;
57
- if (staticRoutes[1].length) return Promise.all(staticRoutes[1]).then(() => {
58
- serve.routes = staticRoutes[0];
59
- app.server.reload(serve);
60
- });
61
- if (Object.keys(staticRoutes[0]).length) serve.routes = staticRoutes[0];
123
+ let ready;
124
+ const build = () => {
125
+ const fetch = app.fetch;
126
+ let routes;
127
+ try {
128
+ routes = collectStaticRoutes(app);
129
+ } catch (error) {
130
+ console.warn("[Elysia] Native static promotion was skipped:", error);
131
+ }
132
+ let websocket;
133
+ if (app["~hasWS"]) {
134
+ const resolved = resolvedWsOf(app);
135
+ if (!resolved) throw new Error("[Elysia] internal: WebSocket routes are present but no capability provider was resolved");
136
+ websocket = resolved.config ? Object.assign(resolved.provider.buildGlobalWSHandler(), resolved.config) : resolved.provider.buildGlobalWSHandler();
137
+ }
138
+ return {
139
+ fetch,
140
+ routes,
141
+ websocket
62
142
  };
63
- if (app.pending) {
64
- if (app.server) app.server.reload(serve);
65
- else app.server = Bun.serve(serve);
66
- const reloadAfterModules = () => {
67
- serve.fetch = app.fetch;
68
- if (hasWs || app["~hasWS"]) buildWebSocket();
69
- collectRoutes();
70
- app.server.reload(serve);
71
- };
72
- app.modules.then(reloadAfterModules, reloadAfterModules);
73
- } else {
74
- collectRoutes();
75
- if (app.server) app.server.reload(serve);
76
- else app.server = Bun.serve(serve);
143
+ };
144
+ let built;
145
+ const server = app.server = Bun.serve(serve);
146
+ const reload = () => {
147
+ try {
148
+ server.reload(serve);
149
+ } catch (error) {
150
+ if (!serve.routes) throw error;
151
+ delete serve.routes;
152
+ console.warn("[Elysia] Native static promotion was skipped:", error);
153
+ try {
154
+ server.reload(serve);
155
+ } catch (fallbackError) {
156
+ console.error("[Elysia] Failed to reload Bun server:", fallbackError);
157
+ throw fallbackError;
158
+ }
77
159
  }
78
- flushMemory();
79
- if (hasWs) callback?.(app.server);
80
- });
160
+ };
161
+ const setup = () => {
162
+ const onSetup = app["~ext"]?.setup;
163
+ if (!onSetup) return;
164
+ let pendingSetups;
165
+ for (let i = 0; i < onSetup.length; i++) {
166
+ const result = onSetup[i](app);
167
+ if (result && typeof result.then === "function") (pendingSetups ??= []).push(result);
168
+ }
169
+ if (pendingSetups) return Promise.all(pendingSetups);
170
+ };
171
+ const rollback = (error) => {
172
+ if (app.server !== server) return;
173
+ try {
174
+ server.stop(true);
175
+ } catch (stopError) {
176
+ console.error(stopError);
177
+ } finally {
178
+ app.server = void 0;
179
+ }
180
+ const cleanup = app["~ext"]?.cleanup;
181
+ if (cleanup) for (let i = cleanup.length - 1; i >= 0; i--) try {
182
+ const result = cleanup[i](app);
183
+ if (result && typeof result.then === "function") Promise.resolve(result).catch(console.error);
184
+ } catch (cleanupError) {
185
+ console.error(cleanupError);
186
+ }
187
+ return error;
188
+ };
189
+ const publish = () => {
190
+ if (app.server !== server) return;
191
+ built ??= build();
192
+ live = serve.fetch = withOrigin(built.fetch);
193
+ if (built.websocket) serve.websocket = built.websocket;
194
+ if (built.routes) serve.routes = built.routes[0];
195
+ reload();
196
+ if (callback) callback(server);
197
+ };
198
+ const start = () => {
199
+ if (app.server !== server) return;
200
+ const setupReady = setup();
201
+ if (setupReady && typeof setupReady.then === "function") return Promise.resolve(setupReady).then(publish);
202
+ publish();
203
+ };
204
+ try {
205
+ if (app.pending) ready = app.modules.then(start);
206
+ else ready = Promise.resolve().then(start);
207
+ ready.catch((error) => {
208
+ console.error("[Elysia] listen() failed:", error);
209
+ return rollback(error);
210
+ });
211
+ } catch (error) {
212
+ rollback(error);
213
+ throw error;
214
+ }
81
215
  }
82
216
  });
83
217
 
@@ -1,29 +1,6 @@
1
- import { ListenCallback, Serve } from "../universal/server.js";
2
- import { AnyLocalHook, MaybePromise } from "../types.js";
3
- import { Context } from "../context.js";
4
- import { AnyElysia } from "../base.js";
1
+ import { ElysiaAdapterOptions } from "./types.js";
2
+
5
3
  //#region src/adapter/constants.d.ts
6
- declare const defaultAdapter: {
7
- parse: {
8
- default: (context: Context, contentType: string) => string | ArrayBuffer | unknown[] | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
9
- json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
10
- text: (context: Context) => MaybePromise<string>;
11
- urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
12
- arrayBuffer: (context: Context) => MaybePromise<ArrayBuffer>;
13
- formData: (context: Context) => MaybePromise<Record<string, unknown>>;
14
- };
15
- name: string;
16
- runtime: "node" | "deno" | "bun" | "cloudflare-worker" | "browser" | "vercel" | "netlify" | "lambda" | "fastly" | "edge" | "unknown" | (string & {});
17
- isWebStandard: boolean;
18
- listen?(app: AnyElysia, options: string | number | Partial<Serve>, callback?: ListenCallback): void;
19
- stop?(app: AnyElysia, closeActiveConnections?: boolean): Promise<void>;
20
- response: {
21
- map(response: unknown, set: Context["set"], ...params: unknown[]): unknown;
22
- compact?(response: unknown, ...params: unknown[]): unknown;
23
- static?(handle: unknown, hooks: AnyLocalHook, setHeaders?: Context["set"]["headers"], ...params: unknown[]): (() => unknown) | undefined;
24
- nativeStatic?(handle: unknown, hooks: AnyLocalHook, set?: Context["set"]): (() => MaybePromise<Response>) | undefined;
25
- };
26
- fetch?(app: AnyElysia): (request: Request) => MaybePromise<Response>;
27
- };
4
+ declare const defaultAdapter: ElysiaAdapterOptions<void>;
28
5
  //#endregion
29
6
  export { defaultAdapter };
@@ -0,0 +1,4 @@
1
+ //#region src/adapter/default-headers.d.ts
2
+ declare const defaultHeaders = "\0";
3
+ //#endregion
4
+ export { defaultHeaders };