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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/dist/adapter/bun/index.d.ts +18 -2
  2. package/dist/adapter/bun/index.js +467 -110
  3. package/dist/adapter/bun/index.mjs +467 -112
  4. package/dist/adapter/types.d.ts +2 -21
  5. package/dist/adapter/utils.d.ts +14 -3
  6. package/dist/adapter/utils.js +146 -87
  7. package/dist/adapter/utils.mjs +148 -90
  8. package/dist/adapter/web-standard/handler.d.ts +1 -1
  9. package/dist/adapter/web-standard/handler.js +47 -36
  10. package/dist/adapter/web-standard/handler.mjs +48 -37
  11. package/dist/adapter/web-standard/index.js +2 -30
  12. package/dist/adapter/web-standard/index.mjs +2 -30
  13. package/dist/adapter/web-standard/utils.js +5 -18
  14. package/dist/adapter/web-standard/utils.mjs +5 -18
  15. package/dist/base.d.ts +99 -67
  16. package/dist/base.js +678 -510
  17. package/dist/base.mjs +682 -514
  18. package/dist/compile/aot-capture.d.ts +2 -13
  19. package/dist/compile/aot-capture.js +26 -69
  20. package/dist/compile/aot-capture.mjs +28 -67
  21. package/dist/compile/aot-emit.d.ts +9 -7
  22. package/dist/compile/aot-emit.js +42 -19
  23. package/dist/compile/aot-emit.mjs +42 -20
  24. package/dist/compile/aot.d.ts +11 -13
  25. package/dist/compile/aot.js +34 -46
  26. package/dist/compile/aot.mjs +35 -45
  27. package/dist/compile/handler/descriptor.d.ts +9 -12
  28. package/dist/compile/handler/descriptor.js +17 -41
  29. package/dist/compile/handler/descriptor.mjs +18 -39
  30. package/dist/compile/handler/frozen-validator.d.ts +5 -10
  31. package/dist/compile/handler/frozen-validator.js +55 -105
  32. package/dist/compile/handler/frozen-validator.mjs +53 -105
  33. package/dist/compile/handler/index.d.ts +6 -5
  34. package/dist/compile/handler/index.js +148 -109
  35. package/dist/compile/handler/index.mjs +149 -111
  36. package/dist/compile/handler/jit.d.ts +17 -17
  37. package/dist/compile/handler/jit.js +220 -148
  38. package/dist/compile/handler/jit.mjs +222 -151
  39. package/dist/compile/handler/params.d.ts +1 -4
  40. package/dist/compile/handler/params.js +10 -5
  41. package/dist/compile/handler/params.mjs +14 -8
  42. package/dist/compile/handler/reconstruct.d.ts +2 -2
  43. package/dist/compile/handler/reconstruct.js +4 -3
  44. package/dist/compile/handler/reconstruct.mjs +4 -3
  45. package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
  46. package/dist/compile/handler/static-clone-resolver.js +8 -0
  47. package/dist/compile/handler/static-clone-resolver.mjs +7 -0
  48. package/dist/compile/handler/utils.d.ts +22 -11
  49. package/dist/compile/handler/utils.js +159 -253
  50. package/dist/compile/handler/utils.mjs +155 -252
  51. package/dist/compile/jit-probe.d.ts +2 -2
  52. package/dist/compile/jit-probe.js +2 -3
  53. package/dist/compile/jit-probe.mjs +2 -3
  54. package/dist/compile/lexer.d.ts +7 -4
  55. package/dist/compile/lexer.js +268 -6
  56. package/dist/compile/lexer.mjs +268 -4
  57. package/dist/compile/utils.js +7 -4
  58. package/dist/compile/utils.mjs +7 -4
  59. package/dist/compiled.d.ts +0 -1
  60. package/dist/compiled.js +0 -1
  61. package/dist/compiled.mjs +0 -1
  62. package/dist/context.d.ts +14 -4
  63. package/dist/context.js +17 -32
  64. package/dist/context.mjs +19 -34
  65. package/dist/cookie/config.d.ts +1 -0
  66. package/dist/cookie/config.js +9 -9
  67. package/dist/cookie/config.mjs +9 -9
  68. package/dist/cookie/cookie.d.ts +1 -1
  69. package/dist/cookie/cookie.js +8 -10
  70. package/dist/cookie/cookie.mjs +8 -10
  71. package/dist/cookie/crypto.d.ts +8 -7
  72. package/dist/cookie/crypto.js +51 -40
  73. package/dist/cookie/crypto.mjs +51 -41
  74. package/dist/cookie/error.d.ts +1 -2
  75. package/dist/cookie/error.js +6 -4
  76. package/dist/cookie/error.mjs +6 -4
  77. package/dist/cookie/lib.js +7 -2
  78. package/dist/cookie/lib.mjs +7 -2
  79. package/dist/cookie/serialize.js +1 -1
  80. package/dist/cookie/serialize.mjs +1 -1
  81. package/dist/cookie/types.d.ts +10 -0
  82. package/dist/cookie/utils.d.ts +4 -8
  83. package/dist/cookie/utils.js +86 -52
  84. package/dist/cookie/utils.mjs +89 -54
  85. package/dist/error.d.ts +113 -103
  86. package/dist/error.js +181 -117
  87. package/dist/error.mjs +179 -118
  88. package/dist/generation.d.ts +2 -2
  89. package/dist/handler/error.d.ts +26 -15
  90. package/dist/handler/error.js +77 -96
  91. package/dist/handler/error.mjs +74 -97
  92. package/dist/handler/fetch.js +87 -108
  93. package/dist/handler/fetch.mjs +89 -110
  94. package/dist/handler/utils.d.ts +12 -6
  95. package/dist/handler/utils.js +84 -28
  96. package/dist/handler/utils.mjs +80 -28
  97. package/dist/index.d.ts +12 -12
  98. package/dist/index.js +2 -9
  99. package/dist/index.mjs +1 -1
  100. package/dist/memory.js +1 -1
  101. package/dist/memory.mjs +1 -1
  102. package/dist/package.js +1 -1
  103. package/dist/package.mjs +1 -1
  104. package/dist/plugin/aot/bun.d.ts +8 -1
  105. package/dist/plugin/aot/bun.js +16 -9
  106. package/dist/plugin/aot/bun.mjs +17 -10
  107. package/dist/plugin/aot/core.d.ts +47 -60
  108. package/dist/plugin/aot/core.js +172 -109
  109. package/dist/plugin/aot/core.mjs +169 -111
  110. package/dist/plugin/aot/esbuild.js +8 -5
  111. package/dist/plugin/aot/esbuild.mjs +9 -6
  112. package/dist/plugin/aot/hooks.d.ts +6 -17
  113. package/dist/plugin/aot/hooks.js +36 -14
  114. package/dist/plugin/aot/hooks.mjs +37 -16
  115. package/dist/plugin/aot/rspack-loader.d.ts +1 -5
  116. package/dist/plugin/aot/rspack-loader.js +1 -10
  117. package/dist/plugin/aot/rspack-loader.mjs +1 -10
  118. package/dist/plugin/aot/rspack.js +2 -5
  119. package/dist/plugin/aot/rspack.mjs +3 -6
  120. package/dist/plugin/aot/source.d.ts +6 -42
  121. package/dist/plugin/aot/source.js +47 -62
  122. package/dist/plugin/aot/source.mjs +48 -63
  123. package/dist/plugin/aot/treeshake.js +2 -6
  124. package/dist/plugin/aot/treeshake.mjs +2 -6
  125. package/dist/plugin/aot/unplugin.d.ts +1 -4
  126. package/dist/plugin/aot/unplugin.js +4 -13
  127. package/dist/plugin/aot/unplugin.mjs +4 -13
  128. package/dist/plugin/aot/vite.d.ts +2 -6
  129. package/dist/plugin/aot/worker.js +2 -2
  130. package/dist/plugin/aot/worker.mjs +2 -2
  131. package/dist/plugin/auto-head.js +1 -10
  132. package/dist/plugin/auto-head.mjs +1 -10
  133. package/dist/plugin/trace.d.ts +2 -1
  134. package/dist/route-table.d.ts +3 -0
  135. package/dist/route-table.js +16 -11
  136. package/dist/route-table.mjs +16 -11
  137. package/dist/schema-snapshot.d.ts +0 -4
  138. package/dist/schema-snapshot.js +29 -47
  139. package/dist/schema-snapshot.mjs +29 -47
  140. package/dist/sucrose.d.ts +6 -55
  141. package/dist/sucrose.js +103 -731
  142. package/dist/sucrose.mjs +102 -724
  143. package/dist/trace.d.ts +5 -8
  144. package/dist/trace.js +23 -134
  145. package/dist/trace.mjs +24 -135
  146. package/dist/type/bridge-live.d.ts +4 -2
  147. package/dist/type/bridge-live.js +6 -3
  148. package/dist/type/bridge-live.mjs +4 -2
  149. package/dist/type/bridge.d.ts +6 -4
  150. package/dist/type/bridge.js +17 -9
  151. package/dist/type/bridge.mjs +5 -3
  152. package/dist/type/coerce-plan.d.ts +5 -5
  153. package/dist/type/coerce-plan.js +41 -39
  154. package/dist/type/coerce-plan.mjs +43 -39
  155. package/dist/type/coerce.d.ts +2 -6
  156. package/dist/type/coerce.js +18 -75
  157. package/dist/type/coerce.mjs +19 -76
  158. package/dist/type/compat.d.ts +3 -0
  159. package/dist/type/compat.js +23 -14
  160. package/dist/type/compat.mjs +20 -10
  161. package/dist/type/constants.d.ts +1 -1
  162. package/dist/type/elysia/array-buffer.d.ts +4 -1
  163. package/dist/type/elysia/array-buffer.js +17 -17
  164. package/dist/type/elysia/array-buffer.mjs +17 -17
  165. package/dist/type/elysia/array-string.js +2 -40
  166. package/dist/type/elysia/array-string.mjs +2 -39
  167. package/dist/type/elysia/array.js +5 -9
  168. package/dist/type/elysia/array.mjs +5 -9
  169. package/dist/type/elysia/boolean-string.js +2 -3
  170. package/dist/type/elysia/boolean-string.mjs +1 -1
  171. package/dist/type/elysia/boolean.js +3 -12
  172. package/dist/type/elysia/boolean.mjs +3 -11
  173. package/dist/type/elysia/cookie.d.ts +3 -4
  174. package/dist/type/elysia/cookie.js +5 -15
  175. package/dist/type/elysia/cookie.mjs +5 -15
  176. package/dist/type/elysia/date.js +13 -20
  177. package/dist/type/elysia/date.mjs +10 -16
  178. package/dist/type/elysia/file-type.d.ts +11 -4
  179. package/dist/type/elysia/file-type.js +17 -2
  180. package/dist/type/elysia/file-type.mjs +17 -3
  181. package/dist/type/elysia/file.d.ts +1 -3
  182. package/dist/type/elysia/file.js +11 -27
  183. package/dist/type/elysia/file.mjs +11 -12
  184. package/dist/type/elysia/files.js +7 -11
  185. package/dist/type/elysia/files.mjs +7 -10
  186. package/dist/type/elysia/form.js +2 -3
  187. package/dist/type/elysia/form.mjs +3 -3
  188. package/dist/type/elysia/integer-string.d.ts +1 -1
  189. package/dist/type/elysia/integer-string.js +4 -30
  190. package/dist/type/elysia/integer-string.mjs +5 -30
  191. package/dist/type/elysia/integer.js +3 -12
  192. package/dist/type/elysia/integer.mjs +3 -11
  193. package/dist/type/elysia/intersect.js +0 -5
  194. package/dist/type/elysia/intersect.mjs +0 -5
  195. package/dist/type/elysia/json-string.d.ts +7 -0
  196. package/dist/type/elysia/json-string.js +47 -0
  197. package/dist/type/elysia/json-string.mjs +46 -0
  198. package/dist/type/elysia/maybe-empty.js +3 -4
  199. package/dist/type/elysia/maybe-empty.mjs +1 -1
  200. package/dist/type/elysia/nullable.js +2 -3
  201. package/dist/type/elysia/nullable.mjs +1 -1
  202. package/dist/type/elysia/number.d.ts +2 -1
  203. package/dist/type/elysia/number.js +19 -11
  204. package/dist/type/elysia/number.mjs +18 -10
  205. package/dist/type/elysia/numeric-enum.d.ts +1 -1
  206. package/dist/type/elysia/numeric-enum.js +4 -5
  207. package/dist/type/elysia/numeric-enum.mjs +3 -3
  208. package/dist/type/elysia/numeric.d.ts +4 -2
  209. package/dist/type/elysia/numeric.js +20 -17
  210. package/dist/type/elysia/numeric.mjs +19 -16
  211. package/dist/type/elysia/object-string.js +2 -37
  212. package/dist/type/elysia/object-string.mjs +2 -36
  213. package/dist/type/elysia/object.js +5 -9
  214. package/dist/type/elysia/object.mjs +5 -9
  215. package/dist/type/elysia/optional.js +8 -8
  216. package/dist/type/elysia/optional.mjs +7 -7
  217. package/dist/type/elysia/problem.d.ts +20 -0
  218. package/dist/type/elysia/problem.js +25 -0
  219. package/dist/type/elysia/problem.mjs +24 -0
  220. package/dist/type/elysia/string.js +4 -3
  221. package/dist/type/elysia/string.mjs +4 -2
  222. package/dist/type/elysia/uint8-array.d.ts +1 -1
  223. package/dist/type/elysia/uint8-array.js +5 -20
  224. package/dist/type/elysia/uint8-array.mjs +5 -19
  225. package/dist/type/elysia/union-enum.js +7 -8
  226. package/dist/type/elysia/union-enum.mjs +6 -6
  227. package/dist/type/elysia/union.js +0 -5
  228. package/dist/type/elysia/union.mjs +0 -5
  229. package/dist/type/elysia/utils.d.ts +2 -4
  230. package/dist/type/elysia/utils.js +10 -21
  231. package/dist/type/elysia/utils.mjs +7 -15
  232. package/dist/type/exports.d.ts +3 -2
  233. package/dist/type/exports.js +13 -2
  234. package/dist/type/exports.mjs +10 -2
  235. package/dist/type/index.d.ts +10 -2
  236. package/dist/type/index.js +52 -15
  237. package/dist/type/index.mjs +55 -11
  238. package/dist/type/shared.d.ts +3 -9
  239. package/dist/type/shared.js +44 -97
  240. package/dist/type/shared.mjs +43 -97
  241. package/dist/type/sync-require.d.ts +11 -0
  242. package/dist/type/sync-require.js +14 -0
  243. package/dist/type/sync-require.mjs +12 -0
  244. package/dist/type/typebox-system-lite.d.ts +2 -0
  245. package/dist/type/typebox-system-lite.js +34 -0
  246. package/dist/type/typebox-system-lite.mjs +3 -0
  247. package/dist/type/typebox-system-require.d.ts +7 -0
  248. package/dist/type/typebox-system-require.js +24 -0
  249. package/dist/type/typebox-system-require.mjs +23 -0
  250. package/dist/type/typebox-type-live.d.ts +11 -0
  251. package/dist/type/typebox-type-live.js +37 -0
  252. package/dist/type/typebox-type-live.mjs +20 -0
  253. package/dist/type/typebox-type.d.ts +26 -0
  254. package/dist/type/typebox-type.js +135 -0
  255. package/dist/type/typebox-type.mjs +70 -0
  256. package/dist/type/typebox-value-live.d.ts +11 -0
  257. package/dist/type/typebox-value-live.js +31 -0
  258. package/dist/type/typebox-value-live.mjs +13 -0
  259. package/dist/type/typebox-value-ops.d.ts +4 -0
  260. package/dist/type/typebox-value-ops.js +90 -0
  261. package/dist/type/typebox-value-ops.mjs +5 -0
  262. package/dist/type/typebox-value-require.d.ts +8 -0
  263. package/dist/type/typebox-value-require.js +28 -0
  264. package/dist/type/typebox-value-require.mjs +25 -0
  265. package/dist/type/typebox-value.d.ts +35 -0
  266. package/dist/type/typebox-value.js +161 -0
  267. package/dist/type/typebox-value.mjs +74 -0
  268. package/dist/type/utils.js +1 -10
  269. package/dist/type/utils.mjs +1 -10
  270. package/dist/type/validator/clean-safe.d.ts +2 -4
  271. package/dist/type/validator/clean-safe.js +15 -11
  272. package/dist/type/validator/clean-safe.mjs +16 -10
  273. package/dist/type/validator/custom-error.js +12 -16
  274. package/dist/type/validator/custom-error.mjs +11 -14
  275. package/dist/type/validator/default-precompute.d.ts +9 -1
  276. package/dist/type/validator/default-precompute.js +40 -77
  277. package/dist/type/validator/default-precompute.mjs +37 -74
  278. package/dist/type/validator/exact-mirror-live.d.ts +8 -0
  279. package/dist/type/validator/exact-mirror-live.js +22 -0
  280. package/dist/type/validator/exact-mirror-live.mjs +17 -0
  281. package/dist/type/validator/exact-mirror-require.d.ts +4 -0
  282. package/dist/type/validator/exact-mirror-require.js +11 -0
  283. package/dist/type/validator/exact-mirror-require.mjs +9 -0
  284. package/dist/type/validator/exact-mirror.js +8 -8
  285. package/dist/type/validator/exact-mirror.mjs +9 -8
  286. package/dist/type/validator/frozen-check.js +5 -6
  287. package/dist/type/validator/frozen-check.mjs +6 -7
  288. package/dist/type/validator/index.d.ts +1 -0
  289. package/dist/type/validator/index.js +169 -166
  290. package/dist/type/validator/index.mjs +162 -158
  291. package/dist/type/validator/string-codec-aot.d.ts +2 -1
  292. package/dist/type/validator/string-codec-aot.js +8 -2
  293. package/dist/type/validator/string-codec-aot.mjs +7 -2
  294. package/dist/type/validator/validator-cache.d.ts +5 -4
  295. package/dist/type/validator/validator-cache.js +41 -24
  296. package/dist/type/validator/validator-cache.mjs +40 -22
  297. package/dist/types.d.ts +261 -94
  298. package/dist/universal/constants.d.ts +2 -1
  299. package/dist/universal/constants.js +3 -1
  300. package/dist/universal/constants.mjs +2 -1
  301. package/dist/universal/env.js +2 -3
  302. package/dist/universal/env.mjs +2 -3
  303. package/dist/universal/file.d.ts +6 -4
  304. package/dist/universal/file.js +11 -16
  305. package/dist/universal/file.mjs +12 -16
  306. package/dist/universal/index.d.ts +2 -2
  307. package/dist/universal/is-production.d.ts +1 -2
  308. package/dist/universal/is-production.js +1 -3
  309. package/dist/universal/is-production.mjs +2 -3
  310. package/dist/universal/server.d.ts +0 -272
  311. package/dist/utils.d.ts +41 -7
  312. package/dist/utils.js +158 -126
  313. package/dist/utils.mjs +147 -126
  314. package/dist/validator/index.d.ts +1 -1
  315. package/dist/validator/index.js +17 -30
  316. package/dist/validator/index.mjs +18 -31
  317. package/dist/validator/route.js +2 -1
  318. package/dist/validator/route.mjs +2 -1
  319. package/dist/ws/context.d.ts +8 -1
  320. package/dist/ws/context.js +68 -44
  321. package/dist/ws/context.mjs +67 -44
  322. package/dist/ws/parser.js +10 -20
  323. package/dist/ws/parser.mjs +10 -20
  324. package/dist/ws/route.d.ts +2 -2
  325. package/dist/ws/route.js +219 -139
  326. package/dist/ws/route.mjs +223 -143
  327. package/dist/ws/types.d.ts +2 -2
  328. package/package.json +23 -49
  329. package/dist/compile/analysis-cache.d.ts +0 -6
  330. package/dist/compile/analysis-cache.js +0 -12
  331. package/dist/compile/analysis-cache.mjs +0 -11
  332. package/dist/cookie/index.d.ts +0 -7
  333. package/dist/cookie/index.js +0 -13
  334. package/dist/cookie/index.mjs +0 -7
  335. package/dist/handler/index.d.ts +0 -2
  336. package/dist/handler/index.js +0 -5
  337. package/dist/handler/index.mjs +0 -3
@@ -1,6 +1,7 @@
1
1
  //#region src/universal/constants.d.ts
2
2
  declare const isBun: boolean;
3
+ declare const isFastly: boolean;
3
4
  declare const isCloudflareWorker: boolean;
4
5
  declare const hasHeaderShorthand: boolean;
5
6
  //#endregion
6
- export { hasHeaderShorthand, isBun, isCloudflareWorker };
7
+ export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/universal/constants.ts
4
4
  const isBun = typeof Bun !== "undefined";
5
+ const isFastly = typeof fastly !== "undefined";
5
6
  const isCloudflareWorker = (() => {
6
7
  try {
7
8
  if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
@@ -16,4 +17,5 @@ const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
16
17
  //#endregion
17
18
  exports.hasHeaderShorthand = hasHeaderShorthand;
18
19
  exports.isBun = isBun;
19
- exports.isCloudflareWorker = isCloudflareWorker;
20
+ exports.isCloudflareWorker = isCloudflareWorker;
21
+ exports.isFastly = isFastly;
@@ -1,5 +1,6 @@
1
1
  //#region src/universal/constants.ts
2
2
  const isBun = typeof Bun !== "undefined";
3
+ const isFastly = typeof fastly !== "undefined";
3
4
  const isCloudflareWorker = (() => {
4
5
  try {
5
6
  if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
@@ -12,4 +13,4 @@ const isCloudflareWorker = (() => {
12
13
  const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
13
14
 
14
15
  //#endregion
15
- export { hasHeaderShorthand, isBun, isCloudflareWorker };
16
+ export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_universal_constants = require('./constants.js');
3
2
  const require_utils = require('../utils.js');
4
3
 
5
4
  //#region src/universal/env.ts
6
5
  const nodeEnv = typeof process !== "undefined" && process?.env ? process.env : void 0;
7
- const env = require_universal_constants.isBun ? Bun.env : nodeEnv ?? require_utils.nullObject();
8
- const hasReadableEnv = require_universal_constants.isBun || nodeEnv !== void 0;
6
+ const env = nodeEnv ?? require_utils.nullObject();
7
+ const hasReadableEnv = nodeEnv !== void 0;
9
8
 
10
9
  //#endregion
11
10
  exports.env = env;
@@ -1,10 +1,9 @@
1
- import { isBun } from "./constants.mjs";
2
1
  import { nullObject } from "../utils.mjs";
3
2
 
4
3
  //#region src/universal/env.ts
5
4
  const nodeEnv = typeof process !== "undefined" && process?.env ? process.env : void 0;
6
- const env = isBun ? Bun.env : nodeEnv ?? nullObject();
7
- const hasReadableEnv = isBun || nodeEnv !== void 0;
5
+ const env = nodeEnv ?? nullObject();
6
+ const hasReadableEnv = nodeEnv !== void 0;
8
7
 
9
8
  //#endregion
10
9
  export { env, hasReadableEnv };
@@ -37,8 +37,6 @@ declare const mime: {
37
37
  readonly ppt: "application/vnd.ms-powerpoint";
38
38
  readonly pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
39
39
  };
40
- /** @internal exported for test/universal/file-extension.test.ts */
41
- declare function getFileExtension(path: string): string;
42
40
  /**
43
41
  * Serve a file from a path as the response.
44
42
  */
@@ -47,11 +45,15 @@ declare class ElysiaFile {
47
45
  #private;
48
46
  path: string;
49
47
  constructor(path: string);
48
+ /**
49
+ * Brand check on the private field: true for subclasses, and unlike
50
+ * `instanceof` it never walks the prototype chain, so no user trap runs
51
+ */
52
+ static isElysiaFile(value: unknown): value is ElysiaFile;
50
53
  get stats(): Promise<_$node_fs0.Stats> | undefined;
51
54
  get value(): BunFile | _$node_fs0.ReadStream | undefined;
52
55
  slice(start: number, end: number): BunFile | _$node_fs0.ReadStream | undefined;
53
56
  get type(): any;
54
- get length(): number | Promise<number>;
55
57
  }
56
58
  //#endregion
57
- export { ElysiaFile, file, getFileExtension, mime };
59
+ export { ElysiaFile, file, mime };
@@ -41,20 +41,14 @@ const mime = {
41
41
  ppt: `${application}vnd.ms-powerpoint`,
42
42
  pptx: `${msft365}presentationml.presentation`
43
43
  };
44
- /** @internal exported for test/universal/file-extension.test.ts */
45
- function getFileExtension(path) {
46
- const index = path.lastIndexOf(".");
47
- if (index === -1) return "";
48
- return path.slice(index + 1).toLowerCase();
49
- }
50
44
  /**
51
45
  * Serve a file from a path as the response.
52
46
  */
53
47
  const file = (path) => new ElysiaFile(path);
54
48
  let createReadStream;
55
49
  let stat;
56
- function warnMissing(name) {
57
- console.warn(/* @__PURE__ */ new Error(`[Elysia] \`file\` require \`fs${name ? "." + name : ""}\` ${name?.includes(".") ? "module " : ""}which is not available in this environment`));
50
+ function warnMissing() {
51
+ console.warn(/* @__PURE__ */ new Error("[Elysia] `file` require `fs` which is not available in this environment"));
58
52
  }
59
53
  var ElysiaFile = class {
60
54
  #value;
@@ -79,6 +73,13 @@ var ElysiaFile = class {
79
73
  stat = fs.promises.stat;
80
74
  }
81
75
  }
76
+ /**
77
+ * Brand check on the private field: true for subclasses, and unlike
78
+ * `instanceof` it never walks the prototype chain, so no user trap runs
79
+ */
80
+ static isElysiaFile(value) {
81
+ return typeof value === "object" && value !== null && #value in value;
82
+ }
82
83
  get stats() {
83
84
  if (require_universal_constants.isBun || !stat) return;
84
85
  const value = stat(this.path);
@@ -101,13 +102,8 @@ var ElysiaFile = class {
101
102
  return stream;
102
103
  }
103
104
  get type() {
104
- return mime[getFileExtension(this.path)] || "application/octet-stream";
105
- }
106
- get length() {
107
- if (require_universal_constants.isBun) return this.#value.size;
108
- const value = this.stats?.then((x) => x.size);
109
- value?.catch(() => {});
110
- return value ?? 0;
105
+ const index = this.path.lastIndexOf(".");
106
+ return mime[index === -1 ? "" : this.path.slice(index + 1).toLowerCase()] || "application/octet-stream";
111
107
  }
112
108
  };
113
109
  Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
@@ -115,5 +111,4 @@ Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
115
111
  //#endregion
116
112
  exports.ElysiaFile = ElysiaFile;
117
113
  exports.file = file;
118
- exports.getFileExtension = getFileExtension;
119
114
  exports.mime = mime;
@@ -40,20 +40,14 @@ const mime = {
40
40
  ppt: `${application}vnd.ms-powerpoint`,
41
41
  pptx: `${msft365}presentationml.presentation`
42
42
  };
43
- /** @internal exported for test/universal/file-extension.test.ts */
44
- function getFileExtension(path) {
45
- const index = path.lastIndexOf(".");
46
- if (index === -1) return "";
47
- return path.slice(index + 1).toLowerCase();
48
- }
49
43
  /**
50
44
  * Serve a file from a path as the response.
51
45
  */
52
46
  const file = (path) => new ElysiaFile(path);
53
47
  let createReadStream;
54
48
  let stat;
55
- function warnMissing(name) {
56
- console.warn(/* @__PURE__ */ new Error(`[Elysia] \`file\` require \`fs${name ? "." + name : ""}\` ${name?.includes(".") ? "module " : ""}which is not available in this environment`));
49
+ function warnMissing() {
50
+ console.warn(/* @__PURE__ */ new Error("[Elysia] `file` require `fs` which is not available in this environment"));
57
51
  }
58
52
  var ElysiaFile = class {
59
53
  #value;
@@ -78,6 +72,13 @@ var ElysiaFile = class {
78
72
  stat = fs.promises.stat;
79
73
  }
80
74
  }
75
+ /**
76
+ * Brand check on the private field: true for subclasses, and unlike
77
+ * `instanceof` it never walks the prototype chain, so no user trap runs
78
+ */
79
+ static isElysiaFile(value) {
80
+ return typeof value === "object" && value !== null && #value in value;
81
+ }
81
82
  get stats() {
82
83
  if (isBun || !stat) return;
83
84
  const value = stat(this.path);
@@ -100,16 +101,11 @@ var ElysiaFile = class {
100
101
  return stream;
101
102
  }
102
103
  get type() {
103
- return mime[getFileExtension(this.path)] || "application/octet-stream";
104
- }
105
- get length() {
106
- if (isBun) return this.#value.size;
107
- const value = this.stats?.then((x) => x.size);
108
- value?.catch(() => {});
109
- return value ?? 0;
104
+ const index = this.path.lastIndexOf(".");
105
+ return mime[index === -1 ? "" : this.path.slice(index + 1).toLowerCase()] || "application/octet-stream";
110
106
  }
111
107
  };
112
108
  Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
113
109
 
114
110
  //#endregion
115
- export { ElysiaFile, file, getFileExtension, mime };
111
+ export { ElysiaFile, file, mime };
@@ -1,5 +1,5 @@
1
+ import { isProduction } from "./is-production.js";
2
+ import { ErrorLike, GenericServeOptions, ListenCallback, Serve, ServeOptions, Server, ServerWebSocketSendStatus, SocketAddress } from "./server.js";
1
3
  import { file } from "./file.js";
2
4
  import { env } from "./env.js";
3
- import { ErrorLike, GenericServeOptions, ListenCallback, Serve, ServeOptions, Server, ServerWebSocketSendStatus, SocketAddress } from "./server.js";
4
- import { isProduction } from "./is-production.js";
5
5
  export { type ErrorLike, type GenericServeOptions, type ListenCallback, type Serve, type ServeOptions, type Server, type ServerWebSocketSendStatus, type SocketAddress, env, file, isProduction };
@@ -1,5 +1,4 @@
1
1
  //#region src/universal/is-production.d.ts
2
- declare const computeIsProduction: (readable: boolean, nodeEnv?: string, elysiaEnv?: string) => boolean;
3
2
  declare const isProduction: () => boolean;
4
3
  //#endregion
5
- export { computeIsProduction, isProduction };
4
+ export { isProduction };
@@ -2,9 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_universal_env = require('./env.js');
3
3
 
4
4
  //#region src/universal/is-production.ts
5
- const computeIsProduction = (readable, nodeEnv, elysiaEnv) => !readable || (nodeEnv ?? elysiaEnv) === "production";
6
- const isProduction = () => computeIsProduction(require_universal_env.hasReadableEnv, require_universal_env.env.NODE_ENV, require_universal_env.env.ENV);
5
+ const isProduction = () => !require_universal_env.hasReadableEnv || (require_universal_env.env.NODE_ENV ?? require_universal_env.env.ENV) === "production";
7
6
 
8
7
  //#endregion
9
- exports.computeIsProduction = computeIsProduction;
10
8
  exports.isProduction = isProduction;
@@ -1,8 +1,7 @@
1
1
  import { env, hasReadableEnv } from "./env.mjs";
2
2
 
3
3
  //#region src/universal/is-production.ts
4
- const computeIsProduction = (readable, nodeEnv, elysiaEnv) => !readable || (nodeEnv ?? elysiaEnv) === "production";
5
- const isProduction = () => computeIsProduction(hasReadableEnv, env.NODE_ENV, env.ENV);
4
+ const isProduction = () => !hasReadableEnv || (env.NODE_ENV ?? env.ENV) === "production";
6
5
 
7
6
  //#endregion
8
- export { computeIsProduction, isProduction };
7
+ export { isProduction };
@@ -8,96 +8,16 @@ interface ErrorLike extends Error {
8
8
  syscall?: string;
9
9
  }
10
10
  interface GenericServeOptions {
11
- /**
12
- * What URI should be used to make {@link Request.url} absolute?
13
- *
14
- * By default, looks at {@link hostname}, {@link port}, and whether or not SSL is enabled to generate one
15
- *
16
- * @example
17
- * ```js
18
- * "http://my-app.com"
19
- * ```
20
- *
21
- * @example
22
- * ```js
23
- * "https://wongmjane.com/"
24
- * ```
25
- *
26
- * This should be the public, absolute URL – include the protocol and {@link hostname}. If the port isn't 80 or 443, then include the {@link port} too.
27
- *
28
- * @example
29
- * "http://localhost:3000"
30
- */
31
- /**
32
- * What is the maximum size of a request body? (in bytes)
33
- *
34
- * @default 1024 * 1024 * 128 // 128MB
35
- */
36
11
  maxRequestBodySize?: number;
37
- /**
38
- * Render contextual errors? This enables bun's error page
39
- * @default process.env.NODE_ENV !== 'production'
40
- */
41
12
  development?: boolean;
42
13
  error?: (this: Server, request: ErrorLike) => Response | Promise<Response> | undefined | Promise<undefined>;
43
- /**
44
- * Uniquely identify a server instance with an ID
45
- *
46
- * ### When bun is started with the `--hot` flag
47
- *
48
- * This string will be used to hot reload the server without interrupting
49
- * pending requests or websockets. If not provided, a value will be
50
- * generated. To disable hot reloading, set this value to `null`.
51
- *
52
- * ### When bun is not started with the `--hot` flag
53
- *
54
- * This string will currently do nothing. But in the future it could be useful for logs or metrics.
55
- */
56
14
  id?: string | null;
57
15
  }
58
16
  interface ServeOptions extends GenericServeOptions {
59
- /**
60
- * What port should the server listen on?
61
- * @default process.env.PORT || "3000"
62
- */
63
17
  port?: string | number;
64
- /**
65
- * If the `SO_REUSEPORT` flag should be set.
66
- *
67
- * This allows multiple processes to bind to the same port, which is useful for load balancing.
68
- *
69
- * @default false
70
- */
71
18
  reusePort?: boolean;
72
- /**
73
- * What hostname should the server listen on?
74
- *
75
- * @default
76
- * ```js
77
- * "0.0.0.0" // listen on all interfaces
78
- * ```
79
- * @example
80
- * ```js
81
- * "127.0.0.1" // Only listen locally
82
- * ```
83
- * @example
84
- * ```js
85
- * "remix.run" // Only listen on remix.run
86
- * ````
87
- *
88
- * note: hostname should not include a {@link port}
89
- */
90
19
  hostname?: string;
91
- /**
92
- * If set, the HTTP server will listen on a unix socket instead of a port.
93
- * (Cannot be used with hostname+port)
94
- */
95
20
  unix?: never;
96
- /**
97
- * Handle HTTP requests
98
- *
99
- * Respond to {@link Request} objects with a {@link Response} object.
100
- */
101
21
  fetch(this: Server, request: Request, server: Server): Response | Promise<Response>;
102
22
  routes: Record<string, Function | Response | Record<string, Function | Response>>;
103
23
  }
@@ -105,221 +25,29 @@ type Serve = Equal<Serve$1.Options<unknown>, unknown> extends false ? Serve$1.Op
105
25
  type Server = Equal<Server$1<unknown>, unknown> extends false ? Server$1<unknown> : ServerOptions;
106
26
  type ServerWebSocketSendStatus = number;
107
27
  interface SocketAddress {
108
- /**
109
- * The IP address of the client.
110
- */
111
28
  address: string;
112
- /**
113
- * The port of the client.
114
- */
115
29
  port: number;
116
- /**
117
- * The IP family ("IPv4" or "IPv6").
118
- */
119
30
  family: 'IPv4' | 'IPv6';
120
31
  }
121
32
  interface ServerOptions extends Disposable {
122
- /**
123
- * Stop listening to prevent new connections from being accepted.
124
- *
125
- * By default, it does not cancel in-flight requests or websockets. That means it may take some time before all network activity stops.
126
- *
127
- * @param closeActiveConnections Immediately terminate in-flight requests, websockets, and stop accepting new connections.
128
- * @default false
129
- */
130
33
  stop(closeActiveConnections?: boolean): void;
131
- /**
132
- * Update the `fetch` and `error` handlers without restarting the server.
133
- *
134
- * This is useful if you want to change the behavior of your server without
135
- * restarting it or for hot reloading.
136
- *
137
- * @example
138
- *
139
- * ```js
140
- * // create the server
141
- * const server = Bun.serve({
142
- * fetch(request) {
143
- * return new Response("Hello World v1")
144
- * }
145
- * });
146
- *
147
- * // Update the server to return a different response
148
- * server.reload({
149
- * fetch(request) {
150
- * return new Response("Hello World v2")
151
- * }
152
- * });
153
- * ```
154
- *
155
- * Passing other options such as `port` or `hostname` won't do anything.
156
- */
157
34
  reload(options: Serve): void;
158
- /**
159
- * Mock the fetch handler for a running server.
160
- *
161
- * This feature is not fully implemented yet. It doesn't normalize URLs
162
- * consistently in all cases and it doesn't yet call the `error` handler
163
- * consistently. This needs to be fixed
164
- */
165
35
  fetch(request: Request | string): Response | Promise<Response>;
166
- /**
167
- * Upgrade a {@link Request} to a {@link ServerWebSocket}
168
- *
169
- * @param request The {@link Request} to upgrade
170
- * @param options Pass headers or attach data to the {@link ServerWebSocket}
171
- *
172
- * @returns `true` if the upgrade was successful and `false` if it failed
173
- *
174
- * @example
175
- * ```js
176
- * import { serve } from "bun";
177
- * serve({
178
- * websocket: {
179
- * open: (ws) => {
180
- * console.log("Client connected");
181
- * },
182
- * message: (ws, message) => {
183
- * console.log("Client sent message", message);
184
- * },
185
- * close: (ws) => {
186
- * console.log("Client disconnected");
187
- * },
188
- * },
189
- * fetch(req, server) {
190
- * const url = new URL(req.url);
191
- * if (url.pathname === "/chat") {
192
- * const upgraded = server.upgrade(req);
193
- * if (!upgraded) {
194
- * return new Response("Upgrade failed", { status: 400 });
195
- * }
196
- * }
197
- * return new Response("Hello World");
198
- * },
199
- * });
200
- * ```
201
- * What you pass to `data` is available on the {@link ServerWebSocket.data} property
202
- */
203
36
  upgrade<T = undefined>(request: Request, options?: {
204
- /**
205
- * Send any additional headers while upgrading, like cookies
206
- */
207
37
  headers?: Bun.HeadersInit;
208
- /**
209
- * This value is passed to the {@link ServerWebSocket.data} property
210
- */
211
38
  data?: T;
212
39
  }): boolean;
213
- /**
214
- * Send a message to all connected {@link ServerWebSocket} subscribed to a topic
215
- *
216
- * @param topic The topic to publish to
217
- * @param data The data to send
218
- * @param compress Should the data be compressed? Ignored if the client does not support compression.
219
- *
220
- * @returns 0 if the message was dropped, -1 if backpressure was applied, or the number of bytes sent.
221
- *
222
- * @example
223
- *
224
- * ```js
225
- * server.publish("chat", "Hello World");
226
- * ```
227
- *
228
- * @example
229
- * ```js
230
- * server.publish("chat", new Uint8Array([1, 2, 3, 4]));
231
- * ```
232
- *
233
- * @example
234
- * ```js
235
- * server.publish("chat", new ArrayBuffer(4), true);
236
- * ```
237
- *
238
- * @example
239
- * ```js
240
- * server.publish("chat", new DataView(new ArrayBuffer(4)));
241
- * ```
242
- */
243
40
  publish(topic: string, data: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer, compress?: boolean): ServerWebSocketSendStatus;
244
- /**
245
- * Returns the client IP address and port of the given Request. If the request was closed or is a unix socket, returns null.
246
- *
247
- * @example
248
- * ```js
249
- * export default {
250
- * async fetch(request, server) {
251
- * return new Response(server.requestIP(request));
252
- * }
253
- * }
254
- * ```
255
- */
256
41
  requestIP(request: Request): SocketAddress | null;
257
- /**
258
- * Reset the idleTimeout of the given Request to the number in seconds. 0 means no timeout.
259
- *
260
- * @example
261
- * ```js
262
- * export default {
263
- * async fetch(request, server) {
264
- * server.timeout(request, 60);
265
- * await Bun.sleep(30000);
266
- * return new Response("30 seconds have passed");
267
- * }
268
- * }
269
- * ```
270
- */
271
42
  timeout(request: Request, seconds: number): void;
272
- /**
273
- * Undo a call to {@link Server.unref}
274
- *
275
- * If the Server has already been stopped, this does nothing.
276
- *
277
- * If {@link Server.ref} is called multiple times, this does nothing. Think of it as a boolean toggle.
278
- */
279
43
  ref(): void;
280
- /**
281
- * Don't keep the process alive if this server is the only thing left.
282
- * Active connections may continue to keep the process alive.
283
- *
284
- * By default, the server is ref'd.
285
- *
286
- * To prevent new connections from being accepted, use {@link Server.stop}
287
- */
288
44
  unref(): void;
289
- /**
290
- * How many requests are in-flight right now?
291
- */
292
45
  readonly pendingRequests: number;
293
- /**
294
- * How many {@link ServerWebSocket}s are in-flight right now?
295
- */
296
46
  readonly pendingWebSockets: number;
297
47
  readonly url: URL;
298
48
  readonly port: number;
299
- /**
300
- * The hostname the server is listening on. Does not include the port
301
- * @example
302
- * ```js
303
- * "localhost"
304
- * ```
305
- */
306
49
  readonly hostname: string;
307
- /**
308
- * Is the server running in development mode?
309
- *
310
- * In development mode, `Bun.serve()` returns rendered error messages with
311
- * stack traces instead of a generic 500 error. This makes debugging easier,
312
- * but development mode shouldn't be used in production or you will risk
313
- * leaking sensitive information.
314
- */
315
50
  readonly development: boolean;
316
- /**
317
- * An identifier of the server instance
318
- *
319
- * When bun is started with the `--hot` flag, this ID is used to hot reload the server without interrupting pending requests or websockets.
320
- *
321
- * When bun is not started with the `--hot` flag, this ID is currently unused.
322
- */
323
51
  readonly id: string;
324
52
  }
325
53
  type ListenCallback = (server: Server) => MaybePromise<void>;
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { AnyLocalHook, AppHook, ElysiaFormData, EventFn, EventScope, GuardSchemaType, InputSchema, Macro, MaybeArray, Prettify, SSEPayload } from "./types.js";
2
- import { Context } from "./context.js";
3
1
  import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
2
+ import { Context } from "./context.js";
3
+ import { AnyLocalHook, AppHook, BunHTMLBundlelike, ElysiaFormData, EventFn, EventScope, GuardSchemaType, InputSchema, Macro, MaybeArray, Prettify, SSEPayload } from "./types.js";
4
4
 
5
5
  //#region src/utils.d.ts
6
6
  type DeriveEntry = Function | readonly [Function, 'mapDerive'];
@@ -49,6 +49,11 @@ declare const isLocalScope: (s: EventScope | undefined) => s is "local" | undefi
49
49
  * without flattening - `over` is walked first (older / outer context),
50
50
  * then `combine` (newer / inner context)
51
51
  *
52
+ * `tail` is the child's own chain head at that `.use()`. Its local hooks
53
+ * registered after the child absorbed the route run after the route's own
54
+ * hooks, as they would with the child as the root (`afterUseHooks` in
55
+ * `compile/handler`)
56
+ *
52
57
  * Use with {@link flattenChain} to walk tail-first and reconstruct
53
58
  * flat `Partial<AppHook>` at compile time
54
59
  */
@@ -60,10 +65,17 @@ type ChainNode = {
60
65
  propagated?: boolean;
61
66
  owner?: object;
62
67
  } | {
63
- combine: ChainNode;
68
+ combine: ChainNode | undefined;
64
69
  over: ChainNode | undefined;
70
+ tail?: ChainNode;
65
71
  refs: boolean;
66
72
  };
73
+ /**
74
+ * The absorbing instance's chain as it stood at `.use()`: the `over` of a
75
+ * combine node, or the node itself. A combine node is never on an instance's
76
+ * own chain, so it can't serve as a `stopAt` directly
77
+ */
78
+ declare const rootSnapshot: (node: ChainNode | undefined) => ChainNode | undefined;
67
79
  interface CompactBeforeHandleChunk {
68
80
  parent?: CompactBeforeHandleChunk;
69
81
  values: readonly Function[];
@@ -88,8 +100,8 @@ declare const macroEpoch: () => number;
88
100
  declare const invalidateMacroEpoch: () => void;
89
101
  /** Drop this root's flattened-chain memo. Recomputable on next compile. */
90
102
  declare function clearFlattenChainMemo(root: object): void;
91
- declare function flattenChainMemo(root: object, start: ChainNode | undefined, resolveAdded?: (node: ChainNode) => Partial<AppHook> | undefined): Partial<AppHook> | undefined;
92
103
  declare function flattenChainMemoReadonly(root: object, start: ChainNode | undefined, resolveAdded?: (node: ChainNode) => Partial<AppHook> | undefined): Partial<AppHook> | undefined;
104
+ declare function flattenChainMemo(root: object, start: ChainNode | undefined, resolveAdded?: (node: ChainNode) => Partial<AppHook> | undefined): Partial<AppHook> | undefined;
93
105
  /**
94
106
  *
95
107
  * @param url URL to redirect to
@@ -116,6 +128,7 @@ declare function formToFormData(value: Record<keyof any, unknown>): FormData;
116
128
  * ```
117
129
  */
118
130
  declare const form: <const T extends Record<keyof any, unknown>>(value: T) => ElysiaFormData<T>;
131
+ declare const assignOwn: <T extends object>(target: T, source: any) => T;
119
132
  declare const getLoosePath: (path: string) => string;
120
133
  /**
121
134
  * Certify a byte stream for direct Response body pass-through.
@@ -129,6 +142,7 @@ declare const isByteStream: (value: unknown) => value is ReadableStream<Uint8Arr
129
142
  type FormatSSEPayload<T = unknown> = T extends string ? {
130
143
  readonly data: T;
131
144
  } : Prettify<SSEPayload<T>>;
145
+ declare const sseData: (value: string) => string;
132
146
  declare const sse: <const T extends string | SSEPayload | Generator | AsyncGenerator | ReadableStream>(_payload: T) => T extends string ? {
133
147
  readonly data: T;
134
148
  } : T extends SSEPayload ? T : T extends ReadableStream<infer A> ? ReadableStream<FormatSSEPayload<A>> : T extends Generator<infer A, infer B, infer C> ? Generator<FormatSSEPayload<A>, B, C> : T extends AsyncGenerator<infer A, infer B_1, infer C_1> ? AsyncGenerator<FormatSSEPayload<A>, B_1, C_1> : T;
@@ -165,14 +179,34 @@ declare function cloneHook<T extends Partial<AnyLocalHook> | Partial<AppHook>>(s
165
179
  declare function clonePlainDeep<T>(value: T, seen?: WeakMap<object, any>): T;
166
180
  declare function guardNonPlainLeaves(target: Record<string, unknown>, source: Record<string, unknown>): void;
167
181
  declare function joinPath(base: string, path: string): string;
168
- declare function pushField<K extends keyof any>(target: Record<K, unknown>, key: K, item: unknown, defaultArray?: boolean): void;
169
- declare const requestId: any;
182
+ declare function pushField<K extends keyof any>(target: Record<K, unknown>, key: K, item: unknown): void;
183
+ declare const requestId: typeof Bun.randomUUIDv7 | (() => `${string}-${string}-${string}-${string}-${string}`);
184
+ /**
185
+ * Offset of the first byte after `://`, so the authority is never scanned as
186
+ * path. A fixed offset would let the client-supplied `Host` decide how many
187
+ * leading path bytes are dropped
188
+ */
189
+ declare const authorityEnd: (url: string) => number;
170
190
  declare function replaceUrlPath(url: string, path: string): string;
191
+ declare function isPlainObject(v: unknown): v is Record<string, unknown>;
171
192
  declare function clonePlainDecorators<T extends Record<string, unknown>>(source: T, seen?: WeakMap<object, any>): T;
172
193
  declare function prefix<T extends string, Models extends Record<string, AnySchema>>(prefix: T, models: Models): { [k in keyof Models as `${T}.${k & string}`]: Models[k] };
173
194
  declare namespace prefix {
174
195
  var capitalize: <T extends string, Models extends Record<string, AnySchema>>(prefix: T, models: Models) => { [k in keyof Models as `${T}.${Capitalize<k & string>}`]: Models[k] };
175
196
  }
176
197
  declare function serializeMacroSeed(_key: string, value: unknown): unknown;
198
+ declare const throwLifecycleErrors: (errors: unknown[]) => void;
199
+ declare const isDisposable: (value: any) => boolean;
200
+ declare const isSingleton: (value: object) => boolean;
201
+ declare const markSingletons: (value: unknown, depth?: number, seen?: Set<object>) => void;
202
+ declare const isSocketQuiet: (socket: {
203
+ readyState: number;
204
+ data: {
205
+ inflight?: number;
206
+ opening?: unknown;
207
+ settling?: number;
208
+ };
209
+ }) => boolean;
210
+ declare const isHTMLBundle: (value: unknown) => value is BunHTMLBundlelike;
177
211
  //#endregion
178
- export { ChainNode, CompactBeforeHandleChunk, CompactBeforeHandlePrefix, DeriveEntry, ELYSIA_FORM_PROTOTYPE, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isElysiaForm, isEmpty, isLocalScope, isMapDeriveEntry, isNotEmpty, isRecordNumber, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, schemaProperties, serializeMacroSeed, sse };
212
+ export { ChainNode, CompactBeforeHandleChunk, CompactBeforeHandlePrefix, DeriveEntry, ELYSIA_FORM_PROTOTYPE, assignOwn, authorityEnd, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isDisposable, isElysiaForm, isEmpty, isHTMLBundle, isLocalScope, isMapDeriveEntry, isNotEmpty, isPlainObject, isRecordNumber, isSingleton, isSocketQuiet, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, markSingletons, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, rootSnapshot, schemaProperties, serializeMacroSeed, sse, sseData, throwLifecycleErrors };