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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/dist/adapter/bun/index.d.ts +18 -2
  2. package/dist/adapter/bun/index.js +467 -110
  3. package/dist/adapter/bun/index.mjs +467 -112
  4. package/dist/adapter/types.d.ts +2 -21
  5. package/dist/adapter/utils.d.ts +14 -3
  6. package/dist/adapter/utils.js +146 -87
  7. package/dist/adapter/utils.mjs +148 -90
  8. package/dist/adapter/web-standard/handler.d.ts +1 -1
  9. package/dist/adapter/web-standard/handler.js +47 -36
  10. package/dist/adapter/web-standard/handler.mjs +48 -37
  11. package/dist/adapter/web-standard/index.js +2 -30
  12. package/dist/adapter/web-standard/index.mjs +2 -30
  13. package/dist/adapter/web-standard/utils.js +5 -18
  14. package/dist/adapter/web-standard/utils.mjs +5 -18
  15. package/dist/base.d.ts +99 -67
  16. package/dist/base.js +678 -510
  17. package/dist/base.mjs +682 -514
  18. package/dist/compile/aot-capture.d.ts +2 -13
  19. package/dist/compile/aot-capture.js +26 -69
  20. package/dist/compile/aot-capture.mjs +28 -67
  21. package/dist/compile/aot-emit.d.ts +9 -7
  22. package/dist/compile/aot-emit.js +42 -19
  23. package/dist/compile/aot-emit.mjs +42 -20
  24. package/dist/compile/aot.d.ts +17 -19
  25. package/dist/compile/aot.js +41 -51
  26. package/dist/compile/aot.mjs +39 -49
  27. package/dist/compile/handler/descriptor.d.ts +9 -12
  28. package/dist/compile/handler/descriptor.js +19 -44
  29. package/dist/compile/handler/descriptor.mjs +20 -42
  30. package/dist/compile/handler/frozen-validator.d.ts +5 -10
  31. package/dist/compile/handler/frozen-validator.js +55 -105
  32. package/dist/compile/handler/frozen-validator.mjs +53 -105
  33. package/dist/compile/handler/index.d.ts +7 -5
  34. package/dist/compile/handler/index.js +270 -111
  35. package/dist/compile/handler/index.mjs +270 -113
  36. package/dist/compile/handler/jit.d.ts +19 -17
  37. package/dist/compile/handler/jit.js +222 -149
  38. package/dist/compile/handler/jit.mjs +224 -152
  39. package/dist/compile/handler/params.d.ts +1 -4
  40. package/dist/compile/handler/params.js +10 -5
  41. package/dist/compile/handler/params.mjs +14 -8
  42. package/dist/compile/handler/reconstruct.d.ts +2 -2
  43. package/dist/compile/handler/reconstruct.js +6 -4
  44. package/dist/compile/handler/reconstruct.mjs +6 -4
  45. package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
  46. package/dist/compile/handler/static-clone-resolver.js +8 -0
  47. package/dist/compile/handler/static-clone-resolver.mjs +7 -0
  48. package/dist/compile/handler/utils.d.ts +22 -11
  49. package/dist/compile/handler/utils.js +159 -253
  50. package/dist/compile/handler/utils.mjs +155 -252
  51. package/dist/compile/jit-probe.d.ts +2 -2
  52. package/dist/compile/jit-probe.js +2 -3
  53. package/dist/compile/jit-probe.mjs +2 -3
  54. package/dist/compile/lexer.d.ts +7 -4
  55. package/dist/compile/lexer.js +268 -6
  56. package/dist/compile/lexer.mjs +268 -4
  57. package/dist/compile/utils.js +7 -4
  58. package/dist/compile/utils.mjs +7 -4
  59. package/dist/compiled.d.ts +0 -1
  60. package/dist/compiled.js +0 -1
  61. package/dist/compiled.mjs +0 -1
  62. package/dist/context.d.ts +14 -4
  63. package/dist/context.js +17 -32
  64. package/dist/context.mjs +19 -34
  65. package/dist/cookie/config.d.ts +7 -2
  66. package/dist/cookie/config.js +76 -16
  67. package/dist/cookie/config.mjs +77 -18
  68. package/dist/cookie/cookie.d.ts +1 -1
  69. package/dist/cookie/cookie.js +8 -10
  70. package/dist/cookie/cookie.mjs +8 -10
  71. package/dist/cookie/crypto.d.ts +8 -7
  72. package/dist/cookie/crypto.js +51 -40
  73. package/dist/cookie/crypto.mjs +51 -41
  74. package/dist/cookie/error.d.ts +1 -2
  75. package/dist/cookie/error.js +6 -4
  76. package/dist/cookie/error.mjs +6 -4
  77. package/dist/cookie/lib.js +7 -2
  78. package/dist/cookie/lib.mjs +7 -2
  79. package/dist/cookie/serialize.js +1 -1
  80. package/dist/cookie/serialize.mjs +1 -1
  81. package/dist/cookie/types.d.ts +10 -0
  82. package/dist/cookie/utils.d.ts +4 -8
  83. package/dist/cookie/utils.js +86 -52
  84. package/dist/cookie/utils.mjs +89 -54
  85. package/dist/error.d.ts +113 -103
  86. package/dist/error.js +181 -117
  87. package/dist/error.mjs +179 -118
  88. package/dist/generation.d.ts +2 -2
  89. package/dist/handler/error.d.ts +26 -15
  90. package/dist/handler/error.js +77 -96
  91. package/dist/handler/error.mjs +74 -97
  92. package/dist/handler/fetch.js +87 -108
  93. package/dist/handler/fetch.mjs +89 -110
  94. package/dist/handler/utils.d.ts +12 -6
  95. package/dist/handler/utils.js +84 -28
  96. package/dist/handler/utils.mjs +80 -28
  97. package/dist/index.d.ts +12 -12
  98. package/dist/index.js +2 -9
  99. package/dist/index.mjs +1 -1
  100. package/dist/memory.js +1 -1
  101. package/dist/memory.mjs +1 -1
  102. package/dist/package.js +1 -1
  103. package/dist/package.mjs +1 -1
  104. package/dist/plugin/aot/bun.d.ts +8 -1
  105. package/dist/plugin/aot/bun.js +16 -9
  106. package/dist/plugin/aot/bun.mjs +17 -10
  107. package/dist/plugin/aot/core.d.ts +52 -60
  108. package/dist/plugin/aot/core.js +208 -109
  109. package/dist/plugin/aot/core.mjs +205 -111
  110. package/dist/plugin/aot/esbuild.js +8 -5
  111. package/dist/plugin/aot/esbuild.mjs +9 -6
  112. package/dist/plugin/aot/hooks.d.ts +6 -17
  113. package/dist/plugin/aot/hooks.js +36 -14
  114. package/dist/plugin/aot/hooks.mjs +37 -16
  115. package/dist/plugin/aot/rspack-loader.d.ts +1 -5
  116. package/dist/plugin/aot/rspack-loader.js +1 -10
  117. package/dist/plugin/aot/rspack-loader.mjs +1 -10
  118. package/dist/plugin/aot/rspack.js +2 -5
  119. package/dist/plugin/aot/rspack.mjs +3 -6
  120. package/dist/plugin/aot/source.d.ts +6 -42
  121. package/dist/plugin/aot/source.js +71 -71
  122. package/dist/plugin/aot/source.mjs +72 -72
  123. package/dist/plugin/aot/treeshake.js +2 -6
  124. package/dist/plugin/aot/treeshake.mjs +2 -6
  125. package/dist/plugin/aot/unplugin.d.ts +1 -4
  126. package/dist/plugin/aot/unplugin.js +4 -13
  127. package/dist/plugin/aot/unplugin.mjs +4 -13
  128. package/dist/plugin/aot/vite.d.ts +2 -6
  129. package/dist/plugin/aot/worker.js +2 -2
  130. package/dist/plugin/aot/worker.mjs +2 -2
  131. package/dist/plugin/auto-head.js +1 -10
  132. package/dist/plugin/auto-head.mjs +1 -10
  133. package/dist/plugin/trace.d.ts +2 -1
  134. package/dist/route-table.d.ts +3 -0
  135. package/dist/route-table.js +16 -11
  136. package/dist/route-table.mjs +16 -11
  137. package/dist/schema-snapshot.d.ts +0 -4
  138. package/dist/schema-snapshot.js +32 -49
  139. package/dist/schema-snapshot.mjs +32 -49
  140. package/dist/sucrose.d.ts +6 -55
  141. package/dist/sucrose.js +103 -731
  142. package/dist/sucrose.mjs +102 -724
  143. package/dist/trace.d.ts +5 -8
  144. package/dist/trace.js +23 -134
  145. package/dist/trace.mjs +24 -135
  146. package/dist/type/bridge-live.d.ts +4 -2
  147. package/dist/type/bridge-live.js +6 -3
  148. package/dist/type/bridge-live.mjs +4 -2
  149. package/dist/type/bridge.d.ts +6 -4
  150. package/dist/type/bridge.js +17 -9
  151. package/dist/type/bridge.mjs +5 -3
  152. package/dist/type/coerce-plan.d.ts +5 -5
  153. package/dist/type/coerce-plan.js +41 -39
  154. package/dist/type/coerce-plan.mjs +43 -39
  155. package/dist/type/coerce.d.ts +3 -7
  156. package/dist/type/coerce.js +18 -75
  157. package/dist/type/coerce.mjs +19 -76
  158. package/dist/type/compat.d.ts +3 -0
  159. package/dist/type/compat.js +23 -14
  160. package/dist/type/compat.mjs +20 -10
  161. package/dist/type/elysia/array-buffer.d.ts +4 -1
  162. package/dist/type/elysia/array-buffer.js +17 -17
  163. package/dist/type/elysia/array-buffer.mjs +17 -17
  164. package/dist/type/elysia/array-string.js +2 -40
  165. package/dist/type/elysia/array-string.mjs +2 -39
  166. package/dist/type/elysia/array.js +5 -9
  167. package/dist/type/elysia/array.mjs +5 -9
  168. package/dist/type/elysia/boolean-string.js +2 -3
  169. package/dist/type/elysia/boolean-string.mjs +1 -1
  170. package/dist/type/elysia/boolean.js +3 -12
  171. package/dist/type/elysia/boolean.mjs +3 -11
  172. package/dist/type/elysia/cookie.d.ts +3 -4
  173. package/dist/type/elysia/cookie.js +5 -15
  174. package/dist/type/elysia/cookie.mjs +5 -15
  175. package/dist/type/elysia/date.js +13 -20
  176. package/dist/type/elysia/date.mjs +10 -16
  177. package/dist/type/elysia/file-type.d.ts +11 -4
  178. package/dist/type/elysia/file-type.js +17 -2
  179. package/dist/type/elysia/file-type.mjs +17 -3
  180. package/dist/type/elysia/file.d.ts +1 -3
  181. package/dist/type/elysia/file.js +11 -27
  182. package/dist/type/elysia/file.mjs +11 -12
  183. package/dist/type/elysia/files.js +7 -11
  184. package/dist/type/elysia/files.mjs +7 -10
  185. package/dist/type/elysia/form.js +2 -3
  186. package/dist/type/elysia/form.mjs +3 -3
  187. package/dist/type/elysia/integer-string.d.ts +1 -1
  188. package/dist/type/elysia/integer-string.js +4 -30
  189. package/dist/type/elysia/integer-string.mjs +5 -30
  190. package/dist/type/elysia/integer.js +3 -12
  191. package/dist/type/elysia/integer.mjs +3 -11
  192. package/dist/type/elysia/intersect.js +0 -5
  193. package/dist/type/elysia/intersect.mjs +0 -5
  194. package/dist/type/elysia/json-string.d.ts +7 -0
  195. package/dist/type/elysia/json-string.js +47 -0
  196. package/dist/type/elysia/json-string.mjs +46 -0
  197. package/dist/type/elysia/keep-config.d.ts +14 -0
  198. package/dist/type/elysia/keep-config.js +62 -0
  199. package/dist/type/elysia/keep-config.mjs +53 -0
  200. package/dist/type/elysia/maybe-empty.js +3 -4
  201. package/dist/type/elysia/maybe-empty.mjs +1 -1
  202. package/dist/type/elysia/nullable.js +2 -3
  203. package/dist/type/elysia/nullable.mjs +1 -1
  204. package/dist/type/elysia/number.d.ts +2 -1
  205. package/dist/type/elysia/number.js +19 -11
  206. package/dist/type/elysia/number.mjs +18 -10
  207. package/dist/type/elysia/numeric-enum.d.ts +1 -1
  208. package/dist/type/elysia/numeric-enum.js +4 -5
  209. package/dist/type/elysia/numeric-enum.mjs +3 -3
  210. package/dist/type/elysia/numeric.d.ts +4 -2
  211. package/dist/type/elysia/numeric.js +20 -17
  212. package/dist/type/elysia/numeric.mjs +19 -16
  213. package/dist/type/elysia/object-string.js +2 -37
  214. package/dist/type/elysia/object-string.mjs +2 -36
  215. package/dist/type/elysia/object.js +5 -9
  216. package/dist/type/elysia/object.mjs +5 -9
  217. package/dist/type/elysia/optional.js +8 -8
  218. package/dist/type/elysia/optional.mjs +7 -7
  219. package/dist/type/elysia/problem.d.ts +20 -0
  220. package/dist/type/elysia/problem.js +25 -0
  221. package/dist/type/elysia/problem.mjs +24 -0
  222. package/dist/type/elysia/string.js +4 -3
  223. package/dist/type/elysia/string.mjs +4 -2
  224. package/dist/type/elysia/uint8-array.d.ts +1 -1
  225. package/dist/type/elysia/uint8-array.js +5 -20
  226. package/dist/type/elysia/uint8-array.mjs +5 -19
  227. package/dist/type/elysia/union-enum.js +7 -8
  228. package/dist/type/elysia/union-enum.mjs +6 -6
  229. package/dist/type/elysia/union.js +0 -5
  230. package/dist/type/elysia/union.mjs +0 -5
  231. package/dist/type/elysia/utils.d.ts +2 -4
  232. package/dist/type/elysia/utils.js +10 -21
  233. package/dist/type/elysia/utils.mjs +7 -15
  234. package/dist/type/exports.d.ts +4 -2
  235. package/dist/type/exports.js +23 -2
  236. package/dist/type/exports.mjs +11 -2
  237. package/dist/type/index.d.ts +10 -2
  238. package/dist/type/index.js +62 -15
  239. package/dist/type/index.mjs +65 -11
  240. package/dist/type/shared.d.ts +3 -9
  241. package/dist/type/shared.js +44 -97
  242. package/dist/type/shared.mjs +43 -97
  243. package/dist/type/sync-require.d.ts +11 -0
  244. package/dist/type/sync-require.js +14 -0
  245. package/dist/type/sync-require.mjs +12 -0
  246. package/dist/type/typebox-system-lite.d.ts +2 -0
  247. package/dist/type/typebox-system-lite.js +34 -0
  248. package/dist/type/typebox-system-lite.mjs +3 -0
  249. package/dist/type/typebox-system-require.d.ts +7 -0
  250. package/dist/type/typebox-system-require.js +24 -0
  251. package/dist/type/typebox-system-require.mjs +23 -0
  252. package/dist/type/typebox-type-live.d.ts +11 -0
  253. package/dist/type/typebox-type-live.js +45 -0
  254. package/dist/type/typebox-type-live.mjs +20 -0
  255. package/dist/type/typebox-type.d.ts +34 -0
  256. package/dist/type/typebox-type.js +199 -0
  257. package/dist/type/typebox-type.mjs +86 -0
  258. package/dist/type/typebox-value-live.d.ts +11 -0
  259. package/dist/type/typebox-value-live.js +31 -0
  260. package/dist/type/typebox-value-live.mjs +13 -0
  261. package/dist/type/typebox-value-ops.d.ts +4 -0
  262. package/dist/type/typebox-value-ops.js +90 -0
  263. package/dist/type/typebox-value-ops.mjs +5 -0
  264. package/dist/type/typebox-value-require.d.ts +8 -0
  265. package/dist/type/typebox-value-require.js +28 -0
  266. package/dist/type/typebox-value-require.mjs +25 -0
  267. package/dist/type/typebox-value.d.ts +35 -0
  268. package/dist/type/typebox-value.js +161 -0
  269. package/dist/type/typebox-value.mjs +74 -0
  270. package/dist/type/utils.js +1 -10
  271. package/dist/type/utils.mjs +1 -10
  272. package/dist/type/validator/clean-safe.d.ts +2 -4
  273. package/dist/type/validator/clean-safe.js +15 -11
  274. package/dist/type/validator/clean-safe.mjs +16 -10
  275. package/dist/type/validator/custom-error.js +12 -16
  276. package/dist/type/validator/custom-error.mjs +11 -14
  277. package/dist/type/validator/default-precompute.d.ts +9 -1
  278. package/dist/type/validator/default-precompute.js +40 -77
  279. package/dist/type/validator/default-precompute.mjs +37 -74
  280. package/dist/type/validator/exact-mirror-live.d.ts +8 -0
  281. package/dist/type/validator/exact-mirror-live.js +22 -0
  282. package/dist/type/validator/exact-mirror-live.mjs +17 -0
  283. package/dist/type/validator/exact-mirror-require.d.ts +4 -0
  284. package/dist/type/validator/exact-mirror-require.js +11 -0
  285. package/dist/type/validator/exact-mirror-require.mjs +9 -0
  286. package/dist/type/validator/exact-mirror.js +8 -8
  287. package/dist/type/validator/exact-mirror.mjs +9 -8
  288. package/dist/type/validator/frozen-check.js +5 -6
  289. package/dist/type/validator/frozen-check.mjs +6 -7
  290. package/dist/type/validator/index.d.ts +1 -0
  291. package/dist/type/validator/index.js +169 -166
  292. package/dist/type/validator/index.mjs +162 -158
  293. package/dist/type/validator/string-codec-aot.d.ts +2 -1
  294. package/dist/type/validator/string-codec-aot.js +8 -2
  295. package/dist/type/validator/string-codec-aot.mjs +7 -2
  296. package/dist/type/validator/validator-cache.d.ts +5 -4
  297. package/dist/type/validator/validator-cache.js +41 -24
  298. package/dist/type/validator/validator-cache.mjs +40 -22
  299. package/dist/types.d.ts +263 -95
  300. package/dist/universal/constants.d.ts +2 -1
  301. package/dist/universal/constants.js +3 -1
  302. package/dist/universal/constants.mjs +2 -1
  303. package/dist/universal/env.js +2 -3
  304. package/dist/universal/env.mjs +2 -3
  305. package/dist/universal/file.d.ts +6 -4
  306. package/dist/universal/file.js +11 -16
  307. package/dist/universal/file.mjs +12 -16
  308. package/dist/universal/index.d.ts +2 -2
  309. package/dist/universal/is-production.d.ts +1 -2
  310. package/dist/universal/is-production.js +1 -3
  311. package/dist/universal/is-production.mjs +2 -3
  312. package/dist/universal/server.d.ts +0 -272
  313. package/dist/utils.d.ts +43 -7
  314. package/dist/utils.js +181 -126
  315. package/dist/utils.mjs +168 -126
  316. package/dist/validator/index.d.ts +1 -1
  317. package/dist/validator/index.js +17 -30
  318. package/dist/validator/index.mjs +18 -31
  319. package/dist/validator/route.js +2 -1
  320. package/dist/validator/route.mjs +2 -1
  321. package/dist/ws/context.d.ts +8 -1
  322. package/dist/ws/context.js +68 -44
  323. package/dist/ws/context.mjs +67 -44
  324. package/dist/ws/parser.js +10 -20
  325. package/dist/ws/parser.mjs +10 -20
  326. package/dist/ws/route.d.ts +2 -2
  327. package/dist/ws/route.js +249 -141
  328. package/dist/ws/route.mjs +254 -146
  329. package/dist/ws/types.d.ts +2 -2
  330. package/package.json +23 -49
  331. package/dist/compile/analysis-cache.d.ts +0 -6
  332. package/dist/compile/analysis-cache.js +0 -12
  333. package/dist/compile/analysis-cache.mjs +0 -11
  334. package/dist/cookie/index.d.ts +0 -7
  335. package/dist/cookie/index.js +0 -13
  336. package/dist/cookie/index.mjs +0 -7
  337. package/dist/handler/index.d.ts +0 -2
  338. package/dist/handler/index.js +0 -5
  339. package/dist/handler/index.mjs +0 -3
@@ -1,15 +1,15 @@
1
- import { deriveEntryFn, isMapDeriveEntry } from "../../utils.mjs";
1
+ import { ElysiaFile } from "../../universal/file.mjs";
2
+ import { assignOwn, deriveEntryFn, isMapDeriveEntry } from "../../utils.mjs";
2
3
  import { ELYSIA_TYPES } from "../../type/constants.mjs";
3
4
  import { skipClone } from "../../adapter/skip-clone.mjs";
4
5
  import { ElysiaStatus } from "../../error.mjs";
5
6
  import { isAsyncFunction } from "../utils.mjs";
6
- import { emptyResponse } from "../../handler/utils.mjs";
7
+ import { registerDeriveDisposable } from "../../handler/utils.mjs";
7
8
  import { adoptErrorType } from "../../handler/error.mjs";
8
9
  import { origin } from "../../adapter/origin.mjs";
9
- import { isIdentChar, isSpace, skipString } from "../lexer.mjs";
10
+ import { scanTokens } from "../lexer.mjs";
10
11
 
11
12
  //#region src/compile/handler/utils.ts
12
- const childName = (fn) => fn?.name && typeof fn.name === "string" ? fn.name : "anonymous";
13
13
  const noTrace = {
14
14
  begin: "",
15
15
  end: () => ""
@@ -22,6 +22,16 @@ function cloneResponse(r) {
22
22
  }
23
23
  return r;
24
24
  }
25
+ function cloneStaticValue(value) {
26
+ if (ElysiaFile.isElysiaFile(value)) return value;
27
+ try {
28
+ const cloned = structuredClone(value);
29
+ if (Object.getPrototypeOf(value) === ElysiaStatus.prototype) Object.setPrototypeOf(cloned, ElysiaStatus.prototype);
30
+ return cloned;
31
+ } catch {
32
+ return value;
33
+ }
34
+ }
25
35
  function hasRequestBody(request) {
26
36
  const length = request.headers.get("content-length");
27
37
  if (length !== null) return length !== "0";
@@ -41,28 +51,102 @@ function armEntryAbort(context) {
41
51
  if (context.request === origin.request) return false;
42
52
  return (context["~sig"] = context.request.signal).aborted;
43
53
  }
44
- const trace = (report, fn) => report?.resolveChild(childName(fn)) ?? noTrace;
54
+ const trace = (report, fn) => report?.resolveChild(fn?.name && typeof fn.name === "string" ? fn.name : "anonymous") ?? noTrace;
45
55
  const toArray = (v) => Array.isArray(v) ? v : [v];
46
- const mapTransform = /* @__PURE__ */ map((i, fn, [isAsync, report]) => {
56
+ const mapTransform = /* @__PURE__ */ map((i, fn, [isAsync, report, arm]) => {
47
57
  const t = trace(report, fn);
48
- const guard = awaitGuard(fn, isAsync, "_tf");
49
- const call = guard ? `_tf=tf${at(i)}(c)\n${guard}` : `${Await(fn)}tf${at(i)}(c)\n`;
58
+ const call = isAsync ? awaitSite(`tf${at(i)}(c)`, fn, isAsync, "_tf", arm) : `tf${at(i)}(c)\n`;
50
59
  return t.begin + call + t.end();
51
60
  });
52
61
  const deriveKeyCache = /* @__PURE__ */ new WeakMap();
53
62
  function extractDeriveKeys(fn) {
54
63
  const cached = deriveKeyCache.get(fn);
55
64
  if (cached !== void 0) return cached;
56
- const result = scanDeriveKeys(fn);
65
+ let src;
66
+ try {
67
+ src = Function.prototype.toString.call(fn);
68
+ } catch {
69
+ src = void 0;
70
+ }
71
+ const result = src === void 0 || src.includes("[native code]") || src.includes("...") ? null : returnedObjectKeys(src);
57
72
  deriveKeyCache.set(fn, result);
58
73
  return result;
59
74
  }
75
+ function returnedObjectKeys(src) {
76
+ const tokens = scanTokens(src);
77
+ if (!tokens) return null;
78
+ const is = (i, value) => tokens[i]?.k === "p" && tokens[i].value === value;
79
+ const blank = (i) => {
80
+ const token = tokens[i];
81
+ return /^[ \t\n\r]*$/.test(src.slice(token.at + token.value.length + (token.k === "s" ? 2 : 0), tokens[i + 1]?.at));
82
+ };
83
+ let open = -1;
84
+ let parens = 0;
85
+ let depth = 0;
86
+ for (let i = 0; i < tokens.length; i++) {
87
+ const { k, value } = tokens[i];
88
+ if (k === "i") {
89
+ if (depth === 0 && value === "function") break;
90
+ } else if (k !== "p") continue;
91
+ else if (value === "(" || value === "[" || value === "{") depth++;
92
+ else if (value === ")" || value === "]" || value === "}") depth--;
93
+ else if (depth === 0 && value === "=>") {
94
+ if (!blank(i)) return null;
95
+ if (is(i + 1, "(")) {
96
+ if (!blank(i + 1) || !is(i + 2, "{")) return null;
97
+ open = i + 2;
98
+ parens = 1;
99
+ } else if (!is(i + 1, "{")) return null;
100
+ break;
101
+ }
102
+ }
103
+ if (open === -1) {
104
+ let at = -1;
105
+ for (let i = 0; i < tokens.length; i++) {
106
+ const { k, value } = tokens[i];
107
+ if (k !== "i") continue;
108
+ if (value === "return") {
109
+ if (at !== -1) return null;
110
+ at = i;
111
+ } else if (value.includes("return") && /[^\w$]/.test(value)) return null;
112
+ }
113
+ if (at === -1) return null;
114
+ for (; blank(at) && is(at + 1, "("); at++) parens++;
115
+ if (!blank(at) || !is(at + 1, "{")) return null;
116
+ open = at + 1;
117
+ }
118
+ const keys = [];
119
+ let i = open + 1;
120
+ while (!is(i, "}")) {
121
+ const key = tokens[i];
122
+ if (!key || (key.k === "s" ? key.value.includes("\\") : key.k !== "i" || !/^[\w$]+$/.test(key.value)) || !blank(i) || !is(i + 1, ":")) return null;
123
+ keys.push(key.value);
124
+ for (depth = 0, i += 2;; i++) {
125
+ const token = tokens[i];
126
+ if (!token) return null;
127
+ if (token.k !== "p") continue;
128
+ const { value } = token;
129
+ if (value === "(" || value === "[" || value === "{") depth++;
130
+ else if (value === ")" || value === "]" || value === "}") {
131
+ if (depth === 0) {
132
+ if (value !== "}") return null;
133
+ break;
134
+ }
135
+ depth--;
136
+ } else if (value === "," && depth === 0) break;
137
+ }
138
+ if (is(i, ",")) i++;
139
+ }
140
+ for (; parens; parens--) if (!is(++i, ")")) return null;
141
+ return i + 1 === tokens.length || is(i + 1, ";") || is(i + 1, "}") ? keys : null;
142
+ }
60
143
  function replaceDeriveContext(context, derivative) {
61
144
  const next = Object.create(Object.getPrototypeOf(context));
62
- Object.assign(next, derivative);
145
+ assignOwn(next, derivative);
63
146
  next.request = context.request;
64
147
  next["~sig"] = context["~sig"];
65
148
  next["~afterResponse"] = context["~afterResponse"];
149
+ next["~dispose"] = context["~dispose"];
66
150
  next.store = context.store;
67
151
  next.set = context.set;
68
152
  next.body = context.body;
@@ -82,21 +166,19 @@ function replaceDeriveContext(context, derivative) {
82
166
  next.redirect = context.redirect;
83
167
  return next;
84
168
  }
85
- function deriveModeQueues(entries) {
86
- if (!entries?.length) return;
87
- const queues = /* @__PURE__ */ new Map();
88
- for (let i = 0; i < entries.length; i++) {
89
- const entry = entries[i];
90
- const fn = deriveEntryFn(entry);
91
- const queue = queues.get(fn);
92
- const mode = isMapDeriveEntry(entry);
93
- if (queue) queue.push(mode);
94
- else queues.set(fn, [mode]);
95
- }
96
- return queues;
97
- }
98
169
  function deriveModes(hooks, entries) {
99
- const queues = deriveModeQueues(entries);
170
+ let queues;
171
+ if (entries?.length) {
172
+ queues = /* @__PURE__ */ new Map();
173
+ for (let i = 0; i < entries.length; i++) {
174
+ const entry = entries[i];
175
+ const fn = deriveEntryFn(entry);
176
+ const queue = queues.get(fn);
177
+ const mode = isMapDeriveEntry(entry);
178
+ if (queue) queue.push(mode);
179
+ else queues.set(fn, [mode]);
180
+ }
181
+ }
100
182
  if (!queues) return;
101
183
  let found = false;
102
184
  const modes = Array(hooks.length);
@@ -109,236 +191,39 @@ function deriveModes(hooks, entries) {
109
191
  }
110
192
  return found ? modes : void 0;
111
193
  }
112
- function scanDeriveKeys(fn) {
113
- let src;
114
- try {
115
- src = Function.prototype.toString.call(fn);
116
- } catch {
117
- return null;
118
- }
119
- if (src.includes("[native code]")) return null;
120
- if (src.includes("...")) return null;
121
- const objStart = findReturnedObjectStart(src);
122
- if (objStart === -1) return null;
123
- return scanObjectLiteralKeys(src, objStart);
124
- }
125
- function findReturnedObjectStart(src) {
126
- const arrow = topLevelArrowIndex(src);
127
- if (arrow !== -1) {
128
- let i = arrow + 2;
129
- while (i < src.length && isSpace(src[i])) i++;
130
- if (src[i] === "(") {
131
- let j = i + 1;
132
- while (j < src.length && isSpace(src[j])) j++;
133
- if (src[j] === "{") return j;
134
- return -1;
135
- }
136
- if (src[i] !== "{") return -1;
137
- }
138
- const { count: returns, firstIndex: idx } = scanReturns(src);
139
- if (returns !== 1) return -1;
140
- if (idx === -1) return -1;
141
- let i = idx + 6;
142
- while (i < src.length && isSpace(src[i])) i++;
143
- while (i < src.length && src[i] === "(") {
144
- i++;
145
- while (i < src.length && isSpace(src[i])) i++;
146
- }
147
- return src[i] === "{" ? i : -1;
148
- }
149
- function topLevelArrowIndex(src) {
150
- let depth = 0;
151
- for (let i = 0; i < src.length;) {
152
- const ch = src[i];
153
- if (ch === "\"" || ch === "'" || ch === "`") {
154
- i = skipString(src, i);
155
- continue;
156
- }
157
- if (ch === "/" && src[i + 1] === "/") {
158
- const nl = src.indexOf("\n", i);
159
- if (nl === -1) return -1;
160
- i = nl + 1;
161
- continue;
162
- }
163
- if (ch === "/" && src[i + 1] === "*") {
164
- const end = src.indexOf("*/", i);
165
- if (end === -1) return -1;
166
- i = end + 2;
167
- continue;
168
- }
169
- if (depth === 0 && ch === "f" && src.startsWith("function", i) && !isIdentChar(src[i - 1] ?? " ") && !isIdentChar(src[i + 8] ?? " ")) return -1;
170
- if (ch === "(" || ch === "[" || ch === "{") {
171
- depth++;
172
- i++;
173
- continue;
174
- }
175
- if (ch === ")" || ch === "]" || ch === "}") {
176
- depth--;
177
- i++;
178
- continue;
179
- }
180
- if (depth === 0 && ch === "=" && src[i + 1] === ">") return i;
181
- i++;
182
- }
183
- return -1;
184
- }
185
- function scanReturns(src) {
186
- let count = 0;
187
- let firstIndex = -1;
188
- for (let i = 0; i < src.length;) {
189
- const ch = src[i];
190
- if (ch === "\"" || ch === "'" || ch === "`") {
191
- i = skipString(src, i);
192
- continue;
193
- }
194
- if (ch === "/" && src[i + 1] === "/") {
195
- const nl = src.indexOf("\n", i);
196
- if (nl === -1) break;
197
- i = nl;
198
- continue;
199
- }
200
- if (ch === "/" && src[i + 1] === "*") {
201
- const end = src.indexOf("*/", i);
202
- if (end === -1) break;
203
- i = end + 2;
204
- continue;
205
- }
206
- if (ch === "r" && src.startsWith("return", i) && !isIdentChar(src[i - 1] ?? " ") && !isIdentChar(src[i + 6] ?? " ")) {
207
- if (firstIndex === -1) firstIndex = i;
208
- count++;
209
- i += 6;
210
- continue;
211
- }
212
- i++;
213
- }
214
- return {
215
- count,
216
- firstIndex
217
- };
218
- }
219
- function scanObjectLiteralKeys(src, open) {
220
- const keys = [];
221
- let i = open + 1;
222
- let expectKey = true;
223
- while (i < src.length) {
224
- const ch = src[i];
225
- if (isSpace(ch)) {
226
- i++;
227
- continue;
228
- }
229
- if (ch === "/" && src[i + 1] === "/") {
230
- const nl = src.indexOf("\n", i);
231
- if (nl === -1) return null;
232
- i = nl + 1;
233
- continue;
234
- }
235
- if (ch === "/" && src[i + 1] === "*") {
236
- const end = src.indexOf("*/", i);
237
- if (end === -1) return null;
238
- i = end + 2;
239
- continue;
240
- }
241
- if (ch === "}") return keys;
242
- if (expectKey) {
243
- if (ch === "[") return null;
244
- let key;
245
- if (ch === "\"" || ch === "'") {
246
- const end = skipString(src, i);
247
- key = src.slice(i + 1, end - 1);
248
- if (key.includes("\\")) return null;
249
- i = end;
250
- } else if (isIdentChar(ch) && !(ch >= "0" && ch <= "9")) {
251
- const start = i;
252
- while (i < src.length && isIdentChar(src[i])) i++;
253
- key = src.slice(start, i);
254
- } else return null;
255
- let j = i;
256
- while (j < src.length && isSpace(src[j])) j++;
257
- if (src[j] !== ":") return null;
258
- keys.push(key);
259
- i = j + 1;
260
- i = skipValue(src, i);
261
- if (i === -1) return null;
262
- expectKey = false;
263
- continue;
264
- }
265
- if (ch === ",") {
266
- expectKey = true;
267
- i++;
268
- continue;
269
- }
270
- return null;
271
- }
272
- return null;
273
- }
274
- function skipValue(src, i) {
275
- let depth = 0;
276
- while (i < src.length) {
277
- const ch = src[i];
278
- if (ch === "\"" || ch === "'" || ch === "`") {
279
- i = skipString(src, i);
280
- continue;
281
- }
282
- if (ch === "/" && src[i + 1] === "/") {
283
- const nl = src.indexOf("\n", i);
284
- if (nl === -1) return -1;
285
- i = nl + 1;
286
- continue;
287
- }
288
- if (ch === "/" && src[i + 1] === "*") {
289
- const end = src.indexOf("*/", i);
290
- if (end === -1) return -1;
291
- i = end + 2;
292
- continue;
293
- }
294
- if (ch === "{" || ch === "(" || ch === "[") {
295
- depth++;
296
- i++;
297
- continue;
298
- }
299
- if (ch === "}" || ch === ")" || ch === "]") {
300
- if (depth === 0) {
301
- if (ch === "}") return i;
302
- return -1;
303
- }
304
- depth--;
305
- i++;
306
- continue;
307
- }
308
- if (ch === "," && depth === 0) return i;
309
- i++;
310
- }
311
- return -1;
312
- }
313
- function mapBeforeHandle(_hooks, derive, link, isAsync, report, abortGuard) {
194
+ function mapBeforeHandle(_hooks, derive, link, isAsync, report, abortGuard, arm) {
314
195
  const hooks = toArray(_hooks);
315
196
  const modes = deriveModes(hooks, derive);
197
+ const tail = asyncTail(isAsync);
316
198
  let code = "";
317
199
  let depth = 0;
318
200
  let needsEs = false;
319
201
  for (let i = 0; i < hooks.length; i++) {
320
202
  const fn = hooks[i];
321
- if (i > 0) {
322
- code += `if(${abortGuard ? `!${abortGuard}&&` : ""}_r===undefined){\n`;
203
+ const guard = i > 0 ? `${abortGuard ? `!${abortGuard}&&` : ""}_r===undefined` : void 0;
204
+ if (tail) code += tailStage(tail, guard);
205
+ else if (guard) {
206
+ code += `if(${guard}){\n`;
323
207
  depth++;
324
208
  }
325
209
  const t = trace(report, fn);
326
210
  code += t.begin;
327
- code += `tmp=${Await(fn)}bf${at(i)}(c)\n`;
328
- code += awaitGuard(fn, isAsync, "tmp");
211
+ code += awaitSite(`bf${at(i)}(c)`, fn, isAsync, "tmp", arm);
329
212
  if (modes?.[i] !== void 0) {
330
213
  needsEs = true;
214
+ link(registerDeriveDisposable, "dsp");
331
215
  if (modes[i]) {
332
216
  link(replaceDeriveContext, "rdc");
333
- code += "if(tmp instanceof es)_r=tmp\nelse if(tmp){if(typeof tmp==='object'||typeof tmp==='function')c=rdc(c,tmp);tmp=undefined}\n";
217
+ code += "if(tmp instanceof es)_r=tmp\nelse if(tmp){if(typeof tmp==='object'||typeof tmp==='function'){const _pc=c;c=rdc(c,tmp);for(const _k of Object.keys(tmp))dsp(c,c[_k],_pc)}tmp=undefined}\n";
334
218
  } else {
335
219
  const keys = extractDeriveKeys(fn);
336
- const merge = keys && keys.length ? keys.map((k) => `c[${JSON.stringify(k)}]=tmp[${JSON.stringify(k)}]`).join(";") : "Object.assign(c,tmp)";
220
+ const merge = !!keys && !!keys.length && !keys.includes("__proto__") ? keys.map((k) => `_v=tmp[${JSON.stringify(k)}];dsp(c,_v);c[${JSON.stringify(k)}]=_v`).join(";") : "if(Object.hasOwn(tmp,'__proto__')){for(const _k of Object.keys(tmp))dsp(c,tmp[_k]);Object.defineProperties(c,Object.getOwnPropertyDescriptors(tmp))}else{_v=Object.assign({},tmp);for(const _k of Reflect.ownKeys(_v)){dsp(c,_v[_k]);c[_k]=_v[_k]}}";
337
221
  code += `if(tmp instanceof es)_r=tmp
338
222
  else if(tmp){${merge};tmp=undefined}\n`;
339
223
  }
340
224
  } else code += "if(tmp!==undefined)_r=tmp\n";
341
225
  code += t.end("tmp");
226
+ if (tail) code += "}\n";
342
227
  }
343
228
  code += "}".repeat(depth);
344
229
  if (needsEs) link(ElysiaStatus, "es");
@@ -371,7 +256,7 @@ async function runBeforeHandlePrefixAsync(prefix, context, abort) {
371
256
  if (!first && abort && context["~sig"]?.aborted) return;
372
257
  first = false;
373
258
  let result = values[j](context);
374
- if (result instanceof Promise) {
259
+ if (typeof result?.then === "function") {
375
260
  result = await result;
376
261
  if (abort) context["~sig"] ??= context.request.signal;
377
262
  }
@@ -379,52 +264,58 @@ async function runBeforeHandlePrefixAsync(prefix, context, abort) {
379
264
  }
380
265
  }
381
266
  }
382
- function mapChainHook(hooks, prefix, isAsync, report, abortGuard) {
267
+ function mapChainHook(_hooks, prefix, isAsync, report, abortGuard, arm) {
268
+ const hooks = toArray(_hooks);
269
+ const tail = asyncTail(isAsync);
383
270
  let code = "";
384
271
  let depth = 0;
385
272
  for (let i = 0; i < hooks.length; i++) {
386
273
  const fn = hooks[i];
387
- if (i > 0) {
388
- code += `if(${abortGuard ? `!${abortGuard}&&` : ""}tmp===undefined){\n`;
274
+ const guard = i > 0 ? `${abortGuard ? `!${abortGuard}&&` : ""}tmp===undefined` : void 0;
275
+ if (tail) code += tailStage(tail, guard);
276
+ else if (guard) {
277
+ code += `if(${guard}){\n`;
389
278
  depth++;
390
279
  }
391
280
  const t = trace(report, fn);
392
281
  code += t.begin;
393
- code += `tmp=${Await(fn)}${prefix}${at(i)}(c)\n`;
394
- code += awaitGuard(fn, isAsync, "tmp");
282
+ code += awaitSite(`${prefix}${at(i)}(c)`, fn, isAsync, "tmp", arm);
395
283
  code += t.end("tmp");
284
+ if (tail) code += "}\n";
396
285
  }
397
286
  code += "}".repeat(depth);
398
- code += `if(tmp!==undefined)_r=c.responseValue=tmp\n`;
287
+ code += tailPlain(isAsync, `if(tmp!==undefined)_r=c.responseValue=tmp\n`);
399
288
  return code;
400
289
  }
401
- const mapAfterHandle = (_hooks, isAsync, report, abortGuard) => mapChainHook(toArray(_hooks), "af", isAsync, report, abortGuard);
402
- const mapMapResponse = (_hooks, isAsync, report, abortGuard) => mapChainHook(toArray(_hooks), "mr", isAsync, report, abortGuard);
403
290
  const mapAfterResponse = /* @__PURE__ */ map((i, fn, [report]) => {
404
291
  const t = trace(report, fn);
405
- const call = isAsyncFunction(fn) ? `await ar${at(i)}(c)\n` : `let _ar=ar${at(i)}(c)\nif(_ar instanceof Promise)await _ar\n`;
406
- return `try{` + t.begin + call + t.end() + `}catch(_e){` + t.end("_e") + `}\n`;
292
+ const call = isAsyncFunction(fn) ? `await ar${at(i)}(c)\n` : `let _ar=ar${at(i)}(c)\nif(typeof _ar?.then==='function')await _ar\n`;
293
+ return `try{${t.begin}${call}${t.end()}}catch(_e){${t.end("_e")}console.error(_e)}\n`;
407
294
  });
408
- const mapError = /* @__PURE__ */ map((i, fn, [map, link, mapResponse, schedule, sign, isAsync]) => {
295
+ const mapError = /* @__PURE__ */ map((i, fn, [map, link, mapResponse, schedule, sign, isAsync, arm]) => {
409
296
  link(mapResponse, "rm");
410
297
  link(adoptErrorType, "aet");
411
- return `_r=${Await(fn)}er${at(i)}(c)\n` + awaitGuard(fn, isAsync, "_r") + "if(_r!==undefined){\nif(_r instanceof Response)c.set.status=_r.status\nelse if(c.set.status===undefined||c.set.status===200)c.set.status=500\n" + schedule + sign + `return _em(c,${map}(aet(_r,e),c.set,c.request,true))\n}\n`;
298
+ return awaitSite(`er${at(i)}(c)`, fn, isAsync, "_r", arm) + "if(_r!==undefined){\nif(_r instanceof Response)c.set.status=_r.status\nelse if(c.set.status===undefined||c.set.status===200)c.set.status=500\n" + schedule + sign + `return _em(c,${map}(aet(_r,e),c.set,c.request,true))\n}\n`;
412
299
  });
413
300
  function map(map) {
414
- return function(event, rest, abortGuard) {
301
+ return function(event, rest, abortGuard, tail) {
415
302
  if (Array.isArray(event)) {
416
303
  let code = "";
417
304
  let depth = 0;
418
305
  for (let i = 0; i < event.length; i++) {
419
- if (i > 0 && abortGuard) {
420
- code += `if(!${abortGuard}){\n`;
306
+ const guard = i > 0 && abortGuard ? `!${abortGuard}` : void 0;
307
+ if (tail) code += tailStage(tail, guard);
308
+ else if (guard) {
309
+ code += `if(${guard}){\n`;
421
310
  depth++;
422
311
  }
423
312
  code += map(i, event[i], rest);
313
+ if (tail) code += "}\n";
424
314
  }
425
315
  code += "}".repeat(depth);
426
316
  return code;
427
- } else return map(void 0, event, rest);
317
+ } else if (tail) return tailStage(tail) + map(void 0, event, rest) + "}\n";
318
+ else return map(void 0, event, rest);
428
319
  };
429
320
  }
430
321
  const at = (index) => index === void 0 ? "" : `[${index}]`;
@@ -494,8 +385,20 @@ function getQueryParseChannels(querySchema) {
494
385
  queryParseChannelsCache.set(querySchema, result);
495
386
  return result ?? void 0;
496
387
  }
497
- const Await = (fn) => isAsyncFunction(fn) ? "await " : "";
498
- const awaitGuard = (fn, isAsync, target) => isAsync && !isAsyncFunction(fn) ? `if(${target} instanceof Promise)${target}=await ${target}\n` : "";
388
+ const asyncTail = (mode) => typeof mode === "object" && mode.async ? mode : void 0;
389
+ function awaitSite(call, fn, isAsync, target, arm = "") {
390
+ if (typeof isAsync !== "object") return `${target}=${call}\n${awaitGuard(fn, isAsync, target, arm)}`;
391
+ const k = isAsync.n++;
392
+ isAsync.sites.push(`${isAsync.e ? "e:" : ""}${target}=${call}`);
393
+ return isAsync.async ? `${target}=_rk===${k}?_y:${call}\nif(_rk===${k}||typeof ${target}?.then==='function'){${arm ? `;${arm}\n` : ""}${target}=await ${target}}\n` : `${target}=${call}\nif(typeof ${target}?.then==='function')return _t(c,${k},${target},${isAsync.r ? "_r" : "undefined"},${isAsync.e ? "e" : "undefined"}${isAsync.live})\n`;
394
+ }
395
+ const tailStage = (mode, guard) => `if(_rk<=${mode.n}${guard ? `&&(_rk===${mode.n}||${guard})` : ""}){\n`;
396
+ const tailPlain = (mode, code) => !code || !asyncTail(mode) ? code : mode.n ? `if(_rk<${mode.n}){\n${code}}\n` : "";
397
+ function awaitGuard(fn, isAsync, target, arm = "") {
398
+ if (!isAsync) return "";
399
+ const code = `${arm ? `;${arm}\n` : ""}${target}=await ${target}\n`;
400
+ return isAsyncFunction(fn) ? code : `if(typeof ${target}?.then==='function'){${code}}\n`;
401
+ }
499
402
 
500
403
  //#endregion
501
- export { armEntryAbort, cloneResponse, deriveModes, emptyResponse, extractDeriveKeys, getQueryParseChannels, hasRequestBody, mapAfterHandle, mapAfterResponse, mapBeforeHandle, mapError, mapMapResponse, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync };
404
+ export { armEntryAbort, asyncTail, awaitGuard, awaitSite, cloneResponse, cloneStaticValue, deriveModes, getQueryParseChannels, hasRequestBody, mapAfterResponse, mapBeforeHandle, mapChainHook, mapError, mapTransform, replaceDeriveContext, runBeforeHandlePrefix, runBeforeHandlePrefixAsync, tailPlain, tailStage };
@@ -1,8 +1,8 @@
1
1
  //#region src/compile/jit-probe.d.ts
2
2
  /** A handler-JIT entry point the frozen replay can trip over. */
3
- type JITProbeReason = 'sucrose' | 'handler:new-function';
3
+ type JITProbeReason = 'sucrose' | 'handler:new-function' | 'handler:indexed-duplicate';
4
4
  interface JITProbeResult {
5
- /** `sucrose` + the handler `new Function` codegen is unused. */
5
+ /** No route needs sucrose, handler codegen, or indexed duplicate replay. */
6
6
  jit: boolean;
7
7
  reasons: JITProbeReason[];
8
8
  }
@@ -15,12 +15,11 @@ var JITProbe = class {
15
15
  static end() {
16
16
  armed = false;
17
17
  const fired = [...reasons];
18
- const result = {
18
+ reasons.clear();
19
+ return {
19
20
  jit: fired.length === 0,
20
21
  reasons: fired
21
22
  };
22
- reasons.clear();
23
- return result;
24
23
  }
25
24
  };
26
25
 
@@ -13,12 +13,11 @@ var JITProbe = class {
13
13
  static end() {
14
14
  armed = false;
15
15
  const fired = [...reasons];
16
- const result = {
16
+ reasons.clear();
17
+ return {
17
18
  jit: fired.length === 0,
18
19
  reasons: fired
19
20
  };
20
- reasons.clear();
21
- return result;
22
21
  }
23
22
  };
24
23
 
@@ -1,7 +1,10 @@
1
1
  //#region src/compile/lexer.d.ts
2
- declare const isSpace: (ch: string) => ch is "\n" | " " | "\t" | "\r";
3
- declare const isIdentChar: (ch: string) => boolean;
4
- declare const isIdentCharCode: (code: number) => boolean;
5
2
  declare function skipString(src: string, start: number): number;
3
+ interface ScanToken {
4
+ k: 'i' | 's' | 'p';
5
+ value: string;
6
+ at: number;
7
+ }
8
+ declare function scanTokens(source: string): ScanToken[] | undefined;
6
9
  //#endregion
7
- export { isIdentChar, isIdentCharCode, isSpace, skipString };
10
+ export { ScanToken, scanTokens, skipString };