void 1.1.11 → 1.2.0

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 (233) hide show
  1. package/dist/{account-cmd-R35a4Oa8.mjs → account-cmd-CdUll_35.mjs} +5 -5
  2. package/dist/action-key-XZ9HkWAO.mjs +26 -0
  3. package/dist/{application-analysis-D7nNmNJb.mjs → application-analysis-fEqoSeMp.mjs} +11 -11
  4. package/dist/{application-routing-CZH66gXn.mjs → application-routing-DAhNP4u3.mjs} +1 -1
  5. package/dist/{ast-CPGPjb0V.mjs → ast-CsZ_q_gc.mjs} +6 -1
  6. package/dist/ast-bindings-C3yaPs1y.mjs +296 -0
  7. package/dist/{auth-link-VHmiKZmP.mjs → auth-link-C87vGXM-.mjs} +5 -5
  8. package/dist/{auth-router-O_Wrs5kg.mjs → auth-router-6I81r-ix.mjs} +3 -3
  9. package/dist/{better-auth-shared-Bv18bB-l.d.mts → better-auth-shared-DVk2DkTW.d.mts} +1 -1
  10. package/dist/{build-cmd-CMZiMn46.mjs → build-cmd-ex1g-j_e.mjs} +4 -4
  11. package/dist/{cache-TZ5Ab3d7.mjs → cache-oHzrnY3z.mjs} +4 -4
  12. package/dist/{cancel-deploy-DXoR6oC3.mjs → cancel-deploy-viAMD0Q_.mjs} +3 -3
  13. package/dist/cf-build-output-BJHuSsVN.mjs +1 -0
  14. package/dist/{cf-build-output-Bc8i3dzE.mjs → cf-build-output-BhVxldCw.mjs} +75 -10
  15. package/dist/{cf-user-agent-ChjQp2MU.mjs → cf-command-values-ByHk0xg4.mjs} +6 -16
  16. package/dist/cf-worker-settings-BECvvTVd.mjs +37 -0
  17. package/dist/cli/cli.mjs +139 -35
  18. package/dist/cli/cloudflare-operation-process.mjs +65 -18
  19. package/dist/cli/env-schema-probe.d.mts +1 -1
  20. package/dist/cli/env-schema-probe.mjs +3 -3
  21. package/dist/{client-GuSO3v_x.mjs → client-BEkdj1kx.mjs} +58 -13
  22. package/dist/client-BiRDZTSd.mjs +1 -0
  23. package/dist/{cloudflare-auth-DSvBc1Gu.mjs → cloudflare-auth-Byo_0_N9.mjs} +1 -1
  24. package/dist/{cloudflare-cmd-ZSErUl6Y.mjs → cloudflare-cmd-DMzCv12s.mjs} +5 -5
  25. package/dist/{cloudflare-config-rdFOys4X.mjs → cloudflare-config-DchHxPTo.mjs} +1 -1
  26. package/dist/{cloudflare-connect-BN-k2kD-.mjs → cloudflare-connect-CCRTVg-I.mjs} +3 -3
  27. package/dist/{cloudflare-operations-DH3GedbV.mjs → cloudflare-operations-Dh9dEHJj.mjs} +17 -7
  28. package/dist/{cloudflare-operations-Cm8lVx7W.mjs → cloudflare-operations-DsSaw2BT.mjs} +1 -1
  29. package/dist/{cloudflare-process-CZJ4viYl.mjs → cloudflare-process-8jEYIeim.mjs} +3 -2
  30. package/dist/{config-DC5llZaI.mjs → config-BIaXIkkv.mjs} +8 -3
  31. package/dist/{config-DYJV8aEH.mjs → config-BU6hMu1W.mjs} +1 -1
  32. package/dist/{config-D26zcdKy.mjs → config-DHgSEWT7.mjs} +39 -6
  33. package/dist/{config-7qoq2p9v.d.mts → config-DQfHOKh9.d.mts} +10 -1
  34. package/dist/config-entry.d.mts +1 -1
  35. package/dist/{connect-yQuLbuiJ.mjs → connect-k7R2rPVA.mjs} +6 -6
  36. package/dist/{create-project-CGOo_OL_.mjs → create-project-DTuy-l0z.mjs} +1 -1
  37. package/dist/{create-project-DEEWJX_M.mjs → create-project-DV71ol5d.mjs} +4 -4
  38. package/dist/{db-COI-yTJE.mjs → db-DVOkLH5X.mjs} +79 -23
  39. package/dist/{delete-PgN6L_9N.mjs → delete-BbP5eopu.mjs} +4 -4
  40. package/dist/{deploy-DsW-PrRQ.mjs → deploy-7H32EnUs.mjs} +220 -95
  41. package/dist/deploy-CE0Ev0Ob.mjs +2 -0
  42. package/dist/{deploy-managed-static-Dqz06S2u.mjs → deploy-managed-static-DlvcvnQT.mjs} +74 -28
  43. package/dist/{deploy-transport-nY3vLXPL.mjs → deploy-transport-BzGEj0Ge.mjs} +2 -2
  44. package/dist/deploy.d.mts +22 -1
  45. package/dist/deploy.mjs +49 -8
  46. package/dist/{dev-inbox-Rd6j_8vM.mjs → dev-inbox-D0jxye_D.mjs} +1 -1
  47. package/dist/{dispatch-BAbbn3jg.mjs → dispatch-DoUnxTNo.mjs} +15 -11
  48. package/dist/{dist-CfgIkieS.mjs → dist-B1PLt4_8.mjs} +1 -1
  49. package/dist/{dist-BVdsO7Py.mjs → dist-Cor9XGoz.mjs} +94 -200
  50. package/dist/{dist-Bn8Kodjp.mjs → dist-D15hFhP0.mjs} +1 -1
  51. package/dist/{domain-DKlNI0SR.mjs → domain-CA2wBgra.mjs} +5 -5
  52. package/dist/drizzle-9TubSZvI.mjs +1 -0
  53. package/dist/{email-BcjSyAL0.mjs → email-B9ayYQEG.mjs} +1 -1
  54. package/dist/{email-C0s3OvJk.mjs → email-DXpCc77w.mjs} +10 -10
  55. package/dist/{email-cloudflare-etpKiITL.mjs → email-cloudflare-D03g2TkS.mjs} +7 -7
  56. package/dist/{entry-B_0IhV64.mjs → entry-BEM8ZuGP.mjs} +40 -12
  57. package/dist/{env-BX2JFsgF.mjs → env-DgOQ9_8S.mjs} +6 -6
  58. package/dist/{env-public-CCdykygU.d.mts → env-public-6lqiSD2b.d.mts} +1 -0
  59. package/dist/{env-types-GRchm5dw.mjs → env-types-BicfKBhV.mjs} +1 -1
  60. package/dist/{env-validation-CuGfWRJd.mjs → env-validation-BmsdCZEk.mjs} +1 -1
  61. package/dist/{env-validation-D_KyMdab.mjs → env-validation-Dwq3PJzK.mjs} +3 -3
  62. package/dist/{fetch-DHLOuPyk.d.mts → fetch-CUX0tB78.d.mts} +14 -1
  63. package/dist/fetch-CtESUYWd.mjs +26 -0
  64. package/dist/{fetch-error-Dj3crt0e.mjs → fetch-error-Bw0n-IY-.mjs} +1 -1
  65. package/dist/{fetch-stream-PGgz4uGz.mjs → fetch-stream-BspOeTAI.mjs} +1 -1
  66. package/dist/{fetch-stream-CNxOrBdP.d.mts → fetch-stream-DfkAzZf-.d.mts} +1 -1
  67. package/dist/{gen-Bj6ZkOcI.mjs → gen-BfmcIi2g.mjs} +5 -5
  68. package/dist/gen-NrOlWZaG.mjs +1 -0
  69. package/dist/{github-cmd-DQDryS-5.mjs → github-cmd-CY9LUqLh.mjs} +4 -4
  70. package/dist/{handler-_PqY82xe.d.mts → handler-BbkSPzGF.d.mts} +91 -9
  71. package/dist/{headers-Bi4bOAwp.mjs → headers-D522zd0A.mjs} +2 -2
  72. package/dist/help-BeAFFE5C.mjs +1 -0
  73. package/dist/{help-D49SL_lN.mjs → help-CxSlPpzJ.mjs} +83 -12
  74. package/dist/{inbound-BuTfm11U.mjs → inbound-VrOLqwZY.mjs} +1 -1
  75. package/dist/index.d.mts +1 -1
  76. package/dist/index.mjs +125 -124
  77. package/dist/{info-Bxunp14X.mjs → info-7VDlhtyy.mjs} +4 -4
  78. package/dist/{init-DyTEY04s.mjs → init-DxYyOs4-.mjs} +103 -43
  79. package/dist/{link-CgOVn9EC.mjs → link-Ddmod1dZ.mjs} +5 -5
  80. package/dist/{list-CUfD9RSb.mjs → list-MogaugiO.mjs} +5 -5
  81. package/dist/{live-DJONVlQK.d.mts → live-Bt8Y_0bg.d.mts} +1 -1
  82. package/dist/{local-d1-CpaPbd_L.mjs → local-d1-BHBnKWRb.mjs} +1 -1
  83. package/dist/{log-vqY3pqwI.mjs → log-BMwmN5Ae.mjs} +2 -2
  84. package/dist/{login-BJvGW5Eu.mjs → login-Cttnagmm.mjs} +4 -4
  85. package/dist/login-DgDwlKc_.mjs +1 -0
  86. package/dist/{logs-DeizBI4j.mjs → logs-CAszUWZI.mjs} +4 -4
  87. package/dist/{migrate-8rk56vV8.mjs → migrate-DyT2jJ8y.mjs} +5 -5
  88. package/dist/migrate-n49ZeS1X.mjs +1 -0
  89. package/dist/{mime-srOklVVv.mjs → mime-BAyHPskU.mjs} +1 -1
  90. package/dist/nitro.mjs +3 -3
  91. package/dist/{node-uN8_zxJr.mjs → node-WB7c2N4L.mjs} +2 -2
  92. package/dist/operator-cmd-d2MvJOrl.mjs +1 -0
  93. package/dist/{operator-cmd-CA5QQyvE.mjs → operator-cmd-skshjMGl.mjs} +4 -4
  94. package/dist/output-BW9uK099.mjs +1 -0
  95. package/dist/{output-Ba6ZbrzY.mjs → output-BpgYODYx.mjs} +16 -4
  96. package/dist/pages/client.d.mts +2 -2
  97. package/dist/pages/client.mjs +48 -25
  98. package/dist/pages/index.d.mts +2 -2
  99. package/dist/pages/index.mjs +4 -4
  100. package/dist/pages/islands-plugin.d.mts +43 -5
  101. package/dist/pages/islands-plugin.mjs +100 -28
  102. package/dist/pages/protocol.d.mts +2 -2
  103. package/dist/pages/protocol.mjs +1 -1
  104. package/dist/pages/serialize.d.mts +2 -2
  105. package/dist/pages/serialize.mjs +1 -1
  106. package/dist/{parse-filename-CUbj-1MP.mjs → parse-filename-DioPHiR9.mjs} +1 -35
  107. package/dist/{picocolors-BTps1_gs.mjs → picocolors-BsDfhxIw.mjs} +1 -1
  108. package/dist/{platform-args-B7ke06up.mjs → platform-args-DVbVClZl.mjs} +12 -4
  109. package/dist/platform-args-kQrgxScY.mjs +1 -0
  110. package/dist/{platform-auth-config-CZaY812e.mjs → platform-auth-config-C-pm5Qzx.mjs} +6 -6
  111. package/dist/{platform-auth-protection-U9HCqoXv.mjs → platform-auth-protection-SHhvim1L.mjs} +4 -4
  112. package/dist/{platform-auth-recovery-B0BV2hfV.mjs → platform-auth-recovery-DXVWs-wA.mjs} +4 -4
  113. package/dist/{platform-cmd-CXrjk4fb.mjs → platform-cmd-D5I1beUX.mjs} +7 -7
  114. package/dist/{platform-cmd-D9lwFpcl.mjs → platform-cmd-PiNRkopU.mjs} +1 -1
  115. package/dist/{platform-domain-CXyq-68_.mjs → platform-domain-jpmBfZeb.mjs} +4 -4
  116. package/dist/{platform-lifecycle-Dz2cJsLX.mjs → platform-lifecycle-DH3Yr1qQ.mjs} +1 -1
  117. package/dist/{platform-lifecycle-D0TdyXbN.mjs → platform-lifecycle-DyKmuNY6.mjs} +405 -44
  118. package/dist/{platform-management-CnXhgxTM.mjs → platform-management--vDwSn35.mjs} +49 -5
  119. package/dist/{platform-management-BvgbusqL.mjs → platform-management-7m-PLaPJ.mjs} +1 -1
  120. package/dist/{platform-plans-config-BWn1S2Rv.mjs → platform-plans-config-CeydDSj0.mjs} +2 -2
  121. package/dist/{platform-recovery-CH_fThW6.mjs → platform-recovery-BiNpZZab.mjs} +2 -2
  122. package/dist/{platform-setup-YvN9VQXV.mjs → platform-setup-Ca53gtt0.mjs} +3 -2
  123. package/dist/{plugin-inference-Bekzjuqw.mjs → plugin-inference-DUjCd55H.mjs} +145 -218
  124. package/dist/{prepare-2XD6kh77.mjs → prepare-BcAE5Sdj.mjs} +3 -3
  125. package/dist/prepare-C4I0f--h.mjs +1 -0
  126. package/dist/{prepare-DepAGBcV.mjs → prepare-DA-17DhO.mjs} +5 -5
  127. package/dist/{prerender-render-Bfsumdkv.mjs → prerender-render-Cijv7UFo.mjs} +11 -6
  128. package/dist/prerender-render.mjs +1 -1
  129. package/dist/{project-cmd-CpLYflCH.mjs → project-cmd-DA4K5faU.mjs} +18 -18
  130. package/dist/{project-team-CTSY7W7Q.mjs → project-team-CQBNveX3.mjs} +4 -4
  131. package/dist/{project-token-Cybtlfbl.mjs → project-token-CCalFyQf.mjs} +4 -4
  132. package/dist/{project-zero-trust-DKOtqyvu.mjs → project-zero-trust-DPnkiEuT.mjs} +4 -4
  133. package/dist/{protocol-B8sI8dRD.d.mts → protocol-BBDpJz3G.d.mts} +3 -1
  134. package/dist/{protocol-RNP0u7UY.mjs → protocol-DimNxVRr.mjs} +42 -17
  135. package/dist/{provision-UcYjpTRh.mjs → provision-BFLCrnUp.mjs} +1 -1
  136. package/dist/{provision-BuifYvLc.mjs → provision-DtROpNNI.mjs} +6 -5
  137. package/dist/{requests-Ryiazz9i.mjs → requests-BpH0kImL.mjs} +3 -3
  138. package/dist/resolve-project-DD1vu8s9.mjs +1 -0
  139. package/dist/{resolve-project-WpwkCB_c.mjs → resolve-project-Xoi6eTWY.mjs} +1 -1
  140. package/dist/{rollback-Or0EV3rP.mjs → rollback-CXS1tAa-.mjs} +10 -9
  141. package/dist/{rolldown-runtime-DXIUcv95.mjs → rolldown-runtime-3h0WiCiA.mjs} +1 -1
  142. package/dist/{routing-assets-VkrKIbxE.mjs → routing-assets-DdSFxoLp.mjs} +10 -4
  143. package/dist/runtime/better-auth-mysql.d.mts +1 -1
  144. package/dist/runtime/better-auth-pg.d.mts +1 -1
  145. package/dist/runtime/better-auth.d.mts +1 -1
  146. package/dist/runtime/client-react.d.mts +2 -2
  147. package/dist/runtime/client-react.mjs +3 -3
  148. package/dist/runtime/client-solid.d.mts +2 -2
  149. package/dist/runtime/client-solid.mjs +3 -3
  150. package/dist/runtime/client-svelte.d.mts +2 -2
  151. package/dist/runtime/client-svelte.mjs +3 -3
  152. package/dist/runtime/client-vue.d.mts +2 -2
  153. package/dist/runtime/client-vue.mjs +3 -3
  154. package/dist/runtime/client.d.mts +2 -2
  155. package/dist/runtime/client.mjs +3 -3
  156. package/dist/runtime/email/testing.mjs +4 -4
  157. package/dist/runtime/email.mjs +3 -3
  158. package/dist/runtime/env-public.d.mts +1 -1
  159. package/dist/runtime/fetch-server.d.mts +8 -0
  160. package/dist/runtime/fetch-server.mjs +30 -0
  161. package/dist/runtime/fetch-stream.d.mts +2 -2
  162. package/dist/runtime/fetch-stream.mjs +2 -2
  163. package/dist/runtime/fetch.d.mts +2 -2
  164. package/dist/runtime/fetch.mjs +3 -3
  165. package/dist/runtime/handler.d.mts +1 -1
  166. package/dist/runtime/live-client.d.mts +1 -1
  167. package/dist/runtime/live.d.mts +1 -1
  168. package/dist/runtime/routing.d.mts +17 -76
  169. package/dist/runtime/routing.mjs +277 -216
  170. package/dist/runtime/validator.d.mts +1 -1
  171. package/dist/runtime/ws-server.d.mts +2 -2
  172. package/dist/runtime/ws.d.mts +1 -1
  173. package/dist/{scan-D2-FcLHs.mjs → scan-8IzYXiU_.mjs} +12 -11
  174. package/dist/{secret-CClHaFxm.mjs → secret-BbXHfLAt.mjs} +6 -6
  175. package/dist/serialize-DtR8Vwa_.d.mts +18 -0
  176. package/dist/serialize-YHvlcG3Q.mjs +31 -0
  177. package/dist/{skills-C_yRTg0g.mjs → skills-CrUO3PJ0.mjs} +1 -1
  178. package/dist/{subcommand-prompt-Bm3ZlYgA.mjs → subcommand-prompt-D9OhhbGG.mjs} +2 -2
  179. package/dist/{version-metadata-B1Bm2wSq.mjs → version-metadata-tS39iW09.mjs} +1 -1
  180. package/dist/wrangler-BLb3_luP.mjs +1 -0
  181. package/dist/{wrangler-C9XSzrju.mjs → wrangler-F96NnLyb.mjs} +13 -5
  182. package/dist/{wrapper-BOigE1xJ.mjs → wrapper-D3sZyh2C.mjs} +5 -3
  183. package/dist/{ws-CsBNxv86.d.mts → ws-BH-im_tX.d.mts} +1 -1
  184. package/docs/guide/ai.md +1 -1
  185. package/docs/guide/database/postgresql.md +1 -1
  186. package/docs/guide/database.md +26 -0
  187. package/docs/guide/deployment.md +2 -0
  188. package/docs/guide/edge/headers.md +1 -1
  189. package/docs/guide/email/domains.md +1 -1
  190. package/docs/guide/email/receiving.md +1 -1
  191. package/docs/guide/email/sending.md +3 -3
  192. package/docs/guide/pages-routing/actions-and-forms.md +1 -1
  193. package/docs/guide/pages-routing/markdown.md +3 -1
  194. package/docs/guide/platform/administration/email.md +7 -1
  195. package/docs/guide/platform/installation/ci.md +2 -0
  196. package/docs/guide/platform/installation/credentials.md +24 -6
  197. package/docs/guide/platform/installation/domains.md +16 -0
  198. package/docs/guide/platform/installation/maintenance.md +32 -2
  199. package/docs/guide/platform/installation/setup.md +1 -1
  200. package/docs/guide/self-hosted-platform.md +1 -1
  201. package/docs/guide/server-routing.md +1 -1
  202. package/docs/guide/typed-fetch.md +1 -1
  203. package/docs/integrations/cloudflare.md +2 -1
  204. package/docs/integrations/frameworks/tanstack-start.md +25 -0
  205. package/docs/reference/api/deploy.md +35 -3
  206. package/docs/reference/api/env.md +1 -1
  207. package/docs/reference/api/rewrites.md +1 -1
  208. package/docs/reference/api/types.md +1 -0
  209. package/docs/reference/cli/database.md +15 -0
  210. package/docs/reference/cli/platform-installation.md +5 -2
  211. package/docs/reference/cli/project.md +4 -2
  212. package/docs/reference/cli/setup.md +17 -0
  213. package/docs/reference/cli.md +1 -0
  214. package/docs/reference/config.md +14 -1
  215. package/docs/reference/resource-inference.md +4 -0
  216. package/package.json +23 -22
  217. package/sandbox.Dockerfile +1 -1
  218. package/schema.json +23 -3
  219. package/dist/cf-build-output-BU3hqdHu.mjs +0 -1
  220. package/dist/client-DrdeJgHR.mjs +0 -1
  221. package/dist/deploy-CxNgEYr4.mjs +0 -2
  222. package/dist/fetch-sAcwjzLO.mjs +0 -18
  223. package/dist/gen-DsCukhuw.mjs +0 -1
  224. package/dist/help-DOFygYi4.mjs +0 -1
  225. package/dist/login-alAlxw4S.mjs +0 -1
  226. package/dist/migrate-D2odrAmh.mjs +0 -1
  227. package/dist/operator-cmd-D7toMPJ9.mjs +0 -1
  228. package/dist/platform-args-B_LrqEZB.mjs +0 -1
  229. package/dist/prepare-EVEbQ9n2.mjs +0 -1
  230. package/dist/resolve-project-PnhzMtY6.mjs +0 -1
  231. package/dist/serialize-BtQyaYoC.mjs +0 -20
  232. package/dist/serialize-CfSwWfF2.d.mts +0 -10
  233. package/dist/wrangler-DAdxHEzh.mjs +0 -1
@@ -1,9 +1,249 @@
1
- import { n as createClientAssetTags, r as createManifestLoader, t as ASSET_EXTENSIONS } from "../routing-assets-VkrKIbxE.mjs";
1
+ import { n as createClientAssetTags, r as createManifestLoader, t as ASSET_EXTENSIONS } from "../routing-assets-DdSFxoLp.mjs";
2
2
  import { t as convertReturnValue } from "../response-Tn7rU0MV.mjs";
3
- import { n as handlePageGet, r as handlePageMutation } from "../protocol-RNP0u7UY.mjs";
3
+ import { i as searchWithoutActionKey, n as hasActionKey, r as markActionKey, t as actionKeySegment } from "../action-key-XZ9HkWAO.mjs";
4
+ import { n as handlePageGet, r as handlePageMutation } from "../protocol-DimNxVRr.mjs";
4
5
  import { t as VoidAssetRewriteError } from "../handler-BZ1t7-Rv.mjs";
5
6
  import { AsyncLocalStorage } from "node:async_hooks";
6
7
  import { compilePattern, matchPattern, matchPatternCaptures, mergeQueryIntoLocation, substituteParams } from "@void/edge";
8
+ //#region src/runtime/routing-worker.ts
9
+ const ASSET_CONTENT_TYPES = {
10
+ ".avif": "image/avif",
11
+ ".css": "text/css; charset=utf-8",
12
+ ".gif": "image/gif",
13
+ ".html": "text/html; charset=utf-8",
14
+ ".ico": "image/x-icon",
15
+ ".jpeg": "image/jpeg",
16
+ ".jpg": "image/jpeg",
17
+ ".js": "text/javascript; charset=utf-8",
18
+ ".json": "application/json; charset=utf-8",
19
+ ".mjs": "text/javascript; charset=utf-8",
20
+ ".png": "image/png",
21
+ ".svg": "image/svg+xml",
22
+ ".txt": "text/plain; charset=utf-8",
23
+ ".wasm": "application/wasm",
24
+ ".webp": "image/webp",
25
+ ".woff": "font/woff",
26
+ ".woff2": "font/woff2"
27
+ };
28
+ /** Apply native static policy before application middleware adds authored headers. */
29
+ function applyAssetCachePolicy(request, asset, assetsDir = "assets", fingerprinted = false) {
30
+ if (!["GET", "HEAD"].includes(request.method) || ![
31
+ 200,
32
+ 206,
33
+ 304
34
+ ].includes(asset.status)) return asset;
35
+ const pathname = new URL(request.url).pathname;
36
+ const filename = pathname.slice(pathname.lastIndexOf("/") + 1);
37
+ const extension = filename.slice(filename.lastIndexOf(".")).toLowerCase();
38
+ const headers = new Headers(asset.headers);
39
+ if (!headers.has("Content-Type") && ASSET_CONTENT_TYPES[extension]) headers.set("Content-Type", ASSET_CONTENT_TYPES[extension]);
40
+ const policy = headers.get("Cache-Control");
41
+ const providerDefault = (policy ?? "").toLowerCase().split(",").map((part) => part.trim()).sort().join(",") === "max-age=0,must-revalidate,public";
42
+ const hashed = fingerprinted && pathname.startsWith("/" + assetsDir.replace(/^\/+|\/+$/g, "") + "/") && extension !== ".html" && !(headers.get("Content-Type") ?? "").toLowerCase().includes("text/html");
43
+ if (!headers.has("Set-Cookie") && hashed && (!policy || providerDefault)) headers.set("Cache-Control", "public, max-age=31536000, immutable");
44
+ else if (!policy) headers.set("Cache-Control", "no-store");
45
+ return new Response(asset.body, {
46
+ status: asset.status,
47
+ statusText: asset.statusText,
48
+ headers
49
+ });
50
+ }
51
+ /** Public filenames are never evidence of a content fingerprint. */
52
+ function createAssetCachePolicy(assetsDir, loadManifest = createManifestLoader()) {
53
+ let files;
54
+ return async (request, env, asset) => {
55
+ const path = new URL(request.url).pathname;
56
+ if (!["GET", "HEAD"].includes(request.method) || ![
57
+ 200,
58
+ 206,
59
+ 304
60
+ ].includes(asset.status) || !path.startsWith("/" + (assetsDir ?? "assets").replace(/^\/+|\/+$/g, "") + "/")) return applyAssetCachePolicy(request, asset, assetsDir);
61
+ if (!files) files = loadManifest(request, env).then((manifest) => new Set(Object.values(manifest ?? {}).flatMap((entry) => Array.isArray(entry?.immutableFiles) ? entry.immutableFiles : [])), () => /* @__PURE__ */ new Set());
62
+ return applyAssetCachePolicy(request, asset, assetsDir, (await files).has(path.slice(1)));
63
+ };
64
+ }
65
+ function createAssetFallback(options = {}) {
66
+ const cachePolicy = createAssetCachePolicy(options.assetsDir);
67
+ return async (request, env, response) => {
68
+ if (response.status !== 404 || !env.ASSETS || request.method !== "GET" && request.method !== "HEAD") return response;
69
+ const asset = await env.ASSETS.fetch(new Request(request.url, {
70
+ method: request.method,
71
+ headers: request.headers
72
+ }));
73
+ if (asset.status !== 404) return cachePolicy(request, env, asset);
74
+ const accept = request.headers.get("accept") ?? "";
75
+ if (options.serveSpaFallback && accept.includes("text/html")) {
76
+ const url = new URL("/index.html", request.url);
77
+ const index = await env.ASSETS.fetch(new Request(url, { method: request.method }));
78
+ if (index.status === 200) {
79
+ const res = new Response(index.body, {
80
+ status: 200,
81
+ headers: index.headers
82
+ });
83
+ res.headers.set("Cache-Control", "no-store");
84
+ res.headers.set("Content-Type", "text/html; charset=utf-8");
85
+ return res;
86
+ }
87
+ } else if (!options.serveSpaFallback && options.notFound === "404-page" && accept.includes("text/html") && (asset.headers.get("content-type") ?? "").includes("text/html")) {
88
+ const res = new Response(asset.body, asset);
89
+ res.headers.set("Cache-Control", "no-store");
90
+ return res;
91
+ }
92
+ return response;
93
+ };
94
+ }
95
+ /** Hide platform capabilities without copying bindings or changing application bindings. */
96
+ function filterInternalBindings(env, prefixes, exactNames = []) {
97
+ const hidden = (key) => typeof key === "string" && (prefixes.some((prefix) => key.startsWith(prefix)) || exactNames.includes(key));
98
+ return new Proxy(env, {
99
+ get: (target, prop, receiver) => hidden(prop) ? void 0 : Reflect.get(target, prop, receiver),
100
+ has: (target, prop) => !hidden(prop) && Reflect.has(target, prop),
101
+ ownKeys: (target) => Reflect.ownKeys(target).filter((key) => !hidden(key)),
102
+ getOwnPropertyDescriptor: (target, prop) => hidden(prop) ? void 0 : Reflect.getOwnPropertyDescriptor(target, prop)
103
+ });
104
+ }
105
+ function createWorkerFetch(options) {
106
+ return async (request, originalEnv, ctx) => {
107
+ const url = new URL(request.url);
108
+ const discovery = request.method === "POST" && url.pathname === "/__void/prerender-paths" && originalEnv.__VOID_PRERENDER === "1";
109
+ if (options.validateEnv && !discovery) await options.validateEnv(originalEnv);
110
+ const env = options.remoteEnv && originalEnv.__VOID_REMOTE === "1" ? options.remoteEnv(originalEnv) : originalEnv;
111
+ if (options.isr) {
112
+ env.__VOID_ISR_DEPLOYMENT_ID ??= options.isr.deploymentId;
113
+ env.__VOID_ISR_HOST = url.hostname;
114
+ }
115
+ return options.withRawEnv(env, () => options.withRuntimeEnv(env, async () => {
116
+ if (options.emailReceipt && url.pathname === "/__void/email/receipt/v1") return options.emailReceipt(request, env, ctx);
117
+ if (request.method === "GET" && url.pathname === "/__void/ready") {
118
+ const metadata = options.versionMetadataBinding ? env[options.versionMetadataBinding] : void 0;
119
+ return Response.json({
120
+ ready: true,
121
+ ...options.versionMetadataBinding ? { versionId: metadata?.id } : {}
122
+ }, options.versionMetadataBinding ? { headers: { "cache-control": "no-store" } } : void 0);
123
+ }
124
+ const internal = await options.internalRoute(request, env, ctx);
125
+ if (internal) return internal;
126
+ if (discovery) return Response.json({ paths: await options.collectPrerenderPaths(request, env, ctx) });
127
+ const userEnv = options.filterBindings(env);
128
+ const render = async (req) => options.assets(req, env, await options.app.fetch(req, userEnv, ctx));
129
+ if (options.isr && env.ISR_CACHE && request.headers.get("upgrade")?.toLowerCase() !== "websocket") {
130
+ const cached = await options.isr.handle(request, env, ctx, render);
131
+ if (cached) return cached;
132
+ }
133
+ return render(request);
134
+ }));
135
+ };
136
+ }
137
+ //#endregion
138
+ //#region src/runtime/routing-pages.ts
139
+ function actionNameOf(url) {
140
+ return new URL(url).searchParams.keys().next().value;
141
+ }
142
+ const routeHandlers = /* @__PURE__ */ new WeakSet();
143
+ const namedActionHandlers = /* @__PURE__ */ new WeakSet();
144
+ /** Records a handler that answers a route, so the marker can tell it from middleware. */
145
+ function markRouteHandler(handler) {
146
+ routeHandlers.add(handler);
147
+ return handler;
148
+ }
149
+ /**
150
+ * Runs before auth and user middleware, so a c.redirect() there leaves the
151
+ * action key out too. It marks the request only when a page with named actions
152
+ * is the route that will answer it, not when a broad page pattern also matches.
153
+ *
154
+ * `matchedRoutes` comes from 'hono/route' of the same Hono copy as the app: it
155
+ * reads the request through a Symbol that each copy defines for itself.
156
+ */
157
+ function createNamedActionMarker(matchedRoutes) {
158
+ return async (c, next) => {
159
+ const answer = matchedRoutes(c).slice(c.req.routeIndex + 1).find((route) => routeHandlers.has(route.handler));
160
+ if (answer && namedActionHandlers.has(answer.handler) && actionNameOf(c.req.url)) markActionKey(c.req.raw);
161
+ await next();
162
+ };
163
+ }
164
+ function createPageGetHandler(options) {
165
+ return markRouteHandler(async (context) => {
166
+ const mod = options.load ? await options.load() : { head: options.head };
167
+ return handlePageGet(mod.loader, mod.head, context, options.componentId, options.render, options.assets, options.headConfig ?? void 0, options.renderOptions);
168
+ });
169
+ }
170
+ function createPageMutationHandler(options) {
171
+ const mutationHandler = async (context) => {
172
+ const mod = options.load ? await options.load() : {};
173
+ const actionName = options.namedActions ? actionNameOf(context.req.url) : void 0;
174
+ const name = actionName || "default";
175
+ const named = mod.actions;
176
+ const candidate = named && Object.hasOwn(named, name) ? named[name] : void 0;
177
+ const handler = options.namedActions ? typeof candidate === "function" ? candidate : void 0 : mod.action;
178
+ if (options.namedActions && !handler) return new Response("Unknown action" + (actionName ? ": " + actionName : ""), { status: 404 });
179
+ if (actionName) markActionKey(context.req.raw);
180
+ return handlePageMutation(handler, mod.loader, mod.head, context, options.componentId, options.render, options.assets, options.headConfig ?? void 0, options.renderOptions);
181
+ };
182
+ if (options.namedActions) namedActionHandlers.add(mutationHandler);
183
+ return markRouteHandler(mutationHandler);
184
+ }
185
+ function createPagesFallback(options) {
186
+ const cachePolicy = createAssetCachePolicy(options.assetsDir);
187
+ return async (c) => {
188
+ const path = c.req.path;
189
+ if (path === "/api" || path.startsWith("/api/") || c.req.method !== "GET" && c.req.method !== "HEAD") return c.text("Not Found", 404);
190
+ const assets = c.env?.ASSETS;
191
+ const assetResponse = assets && typeof assets.fetch === "function" ? await assets.fetch(c.req.raw) : options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
192
+ if (assetResponse.status !== 404) return cachePolicy(c.req.raw, c.env, assetResponse);
193
+ const fallback = options.fallbackRules ? await options.routing.applyFallback(c, options.fallbackRules) : void 0;
194
+ if (fallback) return fallback;
195
+ if (path.includes("/.") || path.substring(path.lastIndexOf("/") + 1).includes(".")) return options.errors.serveCustomPage(c, 404, "Not Found");
196
+ if (path !== "/" && path.endsWith("/")) {
197
+ const url = new URL(c.req.url);
198
+ url.pathname = path.slice(0, -1);
199
+ return Response.redirect(url.href, 301);
200
+ }
201
+ return options.routing.markNoMatch(c.req.raw, await options.errors.serveCustomPage(c, 404, "Not Found"));
202
+ };
203
+ }
204
+ function createSsrFallback(options) {
205
+ const cachePolicy = createAssetCachePolicy(options.assetsDir);
206
+ const fetchAssets = async (c) => {
207
+ const binding = c.env?.ASSETS;
208
+ if (!binding || typeof binding.fetch !== "function") return options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
209
+ const response = await binding.fetch(c.req.raw);
210
+ return response.status === 404 ? options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 })) : cachePolicy(c.req.raw, c.env, response);
211
+ };
212
+ return async (c) => {
213
+ if (options.nodeTarget && options.fallbackRules) {
214
+ const fallback = await options.routing.applyFallback(c, options.fallbackRules);
215
+ if (fallback) return fallback;
216
+ }
217
+ const path = c.req.path;
218
+ const destination = c.req.header("sec-fetch-dest");
219
+ if (path === "/api" || path.startsWith("/api/") || /\/[^/]+\.[^/]+$/.test(path) || destination && destination !== "document" && destination !== "empty") {
220
+ const response = await fetchAssets(c);
221
+ if (!options.nodeTarget && options.fallbackRules && response.status === 404) {
222
+ const fallback = await options.routing.applyFallback(c, options.fallbackRules);
223
+ if (fallback) return fallback;
224
+ }
225
+ return response;
226
+ }
227
+ const mod = await options.load();
228
+ const render = typeof mod.render === "function" ? mod.render : mod.default;
229
+ if (typeof render !== "function") throw new Error("ssr: Invalid entry. Export render(c, assetTags).");
230
+ return render(c, await options.assets(c.req.raw, c.env));
231
+ };
232
+ }
233
+ function createAssetNotFound(options) {
234
+ const cachePolicy = createAssetCachePolicy(options.assetsDir);
235
+ return async (c) => {
236
+ if (!options.nodeTarget) {
237
+ const assets = c.env?.ASSETS;
238
+ if (assets && typeof assets.fetch === "function") {
239
+ const response = await assets.fetch(c.req.raw);
240
+ if (response.status !== 404) return cachePolicy(c.req.raw, c.env, response);
241
+ }
242
+ }
243
+ return (options.fallbackRules ? await options.routing.applyFallback(c, options.fallbackRules) : void 0) ?? options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
244
+ };
245
+ }
246
+ //#endregion
7
247
  //#region src/runtime/routing-errors.ts
8
248
  const ERROR_PAGE_FONT_STACK = "system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
9
249
  const errorStack = Error;
@@ -563,217 +803,6 @@ function createErrorRenderer(options) {
563
803
  };
564
804
  }
565
805
  //#endregion
566
- //#region src/runtime/routing-worker.ts
567
- const ASSET_CONTENT_TYPES = {
568
- ".avif": "image/avif",
569
- ".css": "text/css; charset=utf-8",
570
- ".gif": "image/gif",
571
- ".html": "text/html; charset=utf-8",
572
- ".ico": "image/x-icon",
573
- ".jpeg": "image/jpeg",
574
- ".jpg": "image/jpeg",
575
- ".js": "text/javascript; charset=utf-8",
576
- ".json": "application/json; charset=utf-8",
577
- ".mjs": "text/javascript; charset=utf-8",
578
- ".png": "image/png",
579
- ".svg": "image/svg+xml",
580
- ".txt": "text/plain; charset=utf-8",
581
- ".wasm": "application/wasm",
582
- ".webp": "image/webp",
583
- ".woff": "font/woff",
584
- ".woff2": "font/woff2"
585
- };
586
- /** Apply native static policy before application middleware adds authored headers. */
587
- function applyAssetCachePolicy(request, asset, assetsDir = "assets", fingerprinted = false) {
588
- if (!["GET", "HEAD"].includes(request.method) || ![
589
- 200,
590
- 206,
591
- 304
592
- ].includes(asset.status)) return asset;
593
- const pathname = new URL(request.url).pathname;
594
- const filename = pathname.slice(pathname.lastIndexOf("/") + 1);
595
- const extension = filename.slice(filename.lastIndexOf(".")).toLowerCase();
596
- const headers = new Headers(asset.headers);
597
- if (!headers.has("Content-Type") && ASSET_CONTENT_TYPES[extension]) headers.set("Content-Type", ASSET_CONTENT_TYPES[extension]);
598
- const policy = headers.get("Cache-Control");
599
- const providerDefault = (policy ?? "").toLowerCase().split(",").map((part) => part.trim()).sort().join(",") === "max-age=0,must-revalidate,public";
600
- const hashed = fingerprinted && pathname.startsWith("/" + assetsDir.replace(/^\/+|\/+$/g, "") + "/") && extension !== ".html" && !(headers.get("Content-Type") ?? "").toLowerCase().includes("text/html");
601
- if (!headers.has("Set-Cookie") && hashed && (!policy || providerDefault)) headers.set("Cache-Control", "public, max-age=31536000, immutable");
602
- else if (!policy) headers.set("Cache-Control", "no-store");
603
- return new Response(asset.body, {
604
- status: asset.status,
605
- statusText: asset.statusText,
606
- headers
607
- });
608
- }
609
- /** Public filenames are never evidence of a content fingerprint. */
610
- function createAssetCachePolicy(assetsDir, loadManifest = createManifestLoader()) {
611
- let files;
612
- return async (request, env, asset) => {
613
- const path = new URL(request.url).pathname;
614
- if (!["GET", "HEAD"].includes(request.method) || ![
615
- 200,
616
- 206,
617
- 304
618
- ].includes(asset.status) || !path.startsWith("/" + (assetsDir ?? "assets").replace(/^\/+|\/+$/g, "") + "/")) return applyAssetCachePolicy(request, asset, assetsDir);
619
- if (!files) files = loadManifest(request, env).then((manifest) => new Set(Object.values(manifest ?? {}).flatMap((entry) => Array.isArray(entry?.immutableFiles) ? entry.immutableFiles : [])), () => /* @__PURE__ */ new Set());
620
- return applyAssetCachePolicy(request, asset, assetsDir, (await files).has(path.slice(1)));
621
- };
622
- }
623
- function createAssetFallback(options = {}) {
624
- const cachePolicy = createAssetCachePolicy(options.assetsDir);
625
- return async (request, env, response) => {
626
- if (response.status !== 404 || !env.ASSETS || request.method !== "GET" && request.method !== "HEAD") return response;
627
- const asset = await env.ASSETS.fetch(new Request(request.url, {
628
- method: request.method,
629
- headers: request.headers
630
- }));
631
- if (asset.status !== 404) return cachePolicy(request, env, asset);
632
- const accept = request.headers.get("accept") ?? "";
633
- if (options.serveSpaFallback && accept.includes("text/html")) {
634
- const url = new URL("/index.html", request.url);
635
- const index = await env.ASSETS.fetch(new Request(url, { method: request.method }));
636
- if (index.status === 200) {
637
- const res = new Response(index.body, {
638
- status: 200,
639
- headers: index.headers
640
- });
641
- res.headers.set("Cache-Control", "no-store");
642
- res.headers.set("Content-Type", "text/html; charset=utf-8");
643
- return res;
644
- }
645
- } else if (!options.serveSpaFallback && options.notFound === "404-page" && accept.includes("text/html") && (asset.headers.get("content-type") ?? "").includes("text/html")) {
646
- const res = new Response(asset.body, asset);
647
- res.headers.set("Cache-Control", "no-store");
648
- return res;
649
- }
650
- return response;
651
- };
652
- }
653
- /** Hide platform capabilities without copying bindings or changing application bindings. */
654
- function filterInternalBindings(env, prefixes, exactNames = []) {
655
- const hidden = (key) => typeof key === "string" && (prefixes.some((prefix) => key.startsWith(prefix)) || exactNames.includes(key));
656
- return new Proxy(env, {
657
- get: (target, prop, receiver) => hidden(prop) ? void 0 : Reflect.get(target, prop, receiver),
658
- has: (target, prop) => !hidden(prop) && Reflect.has(target, prop),
659
- ownKeys: (target) => Reflect.ownKeys(target).filter((key) => !hidden(key)),
660
- getOwnPropertyDescriptor: (target, prop) => hidden(prop) ? void 0 : Reflect.getOwnPropertyDescriptor(target, prop)
661
- });
662
- }
663
- function createWorkerFetch(options) {
664
- return async (request, originalEnv, ctx) => {
665
- const url = new URL(request.url);
666
- const discovery = request.method === "POST" && url.pathname === "/__void/prerender-paths" && originalEnv.__VOID_PRERENDER === "1";
667
- if (options.validateEnv && !discovery) await options.validateEnv(originalEnv);
668
- const env = options.remoteEnv && originalEnv.__VOID_REMOTE === "1" ? options.remoteEnv(originalEnv) : originalEnv;
669
- if (options.isr) {
670
- env.__VOID_ISR_DEPLOYMENT_ID ??= options.isr.deploymentId;
671
- env.__VOID_ISR_HOST = url.hostname;
672
- }
673
- return options.withRawEnv(env, () => options.withRuntimeEnv(env, async () => {
674
- if (options.emailReceipt && url.pathname === "/__void/email/receipt/v1") return options.emailReceipt(request, env, ctx);
675
- if (request.method === "GET" && url.pathname === "/__void/ready") {
676
- const metadata = options.versionMetadataBinding ? env[options.versionMetadataBinding] : void 0;
677
- return Response.json({
678
- ready: true,
679
- ...options.versionMetadataBinding ? { versionId: metadata?.id } : {}
680
- }, options.versionMetadataBinding ? { headers: { "cache-control": "no-store" } } : void 0);
681
- }
682
- const internal = await options.internalRoute(request, env, ctx);
683
- if (internal) return internal;
684
- if (discovery) return Response.json({ paths: await options.collectPrerenderPaths(request, env, ctx) });
685
- const userEnv = options.filterBindings(env);
686
- const render = async (req) => options.assets(req, env, await options.app.fetch(req, userEnv, ctx));
687
- if (options.isr && env.ISR_CACHE && request.headers.get("upgrade")?.toLowerCase() !== "websocket") {
688
- const cached = await options.isr.handle(request, env, ctx, render);
689
- if (cached) return cached;
690
- }
691
- return render(request);
692
- }));
693
- };
694
- }
695
- //#endregion
696
- //#region src/runtime/routing-pages.ts
697
- function createPageGetHandler(options) {
698
- return async (context) => {
699
- const mod = options.load ? await options.load() : { head: options.head };
700
- return handlePageGet(mod.loader, mod.head, context, options.componentId, options.render, options.assets, options.headConfig ?? void 0, options.renderOptions);
701
- };
702
- }
703
- function createPageMutationHandler(options) {
704
- return async (context) => {
705
- const mod = options.load ? await options.load() : {};
706
- const actionName = options.namedActions ? new URL(context.req.url).searchParams.keys().next().value : void 0;
707
- const name = actionName || "default";
708
- const named = mod.actions;
709
- const candidate = named && Object.hasOwn(named, name) ? named[name] : void 0;
710
- const handler = options.namedActions ? typeof candidate === "function" ? candidate : void 0 : mod.action;
711
- if (options.namedActions && !handler) return new Response("Unknown action" + (actionName ? ": " + actionName : ""), { status: 404 });
712
- return handlePageMutation(handler, mod.loader, mod.head, context, options.componentId, options.render, options.assets, options.headConfig ?? void 0, options.renderOptions);
713
- };
714
- }
715
- function createPagesFallback(options) {
716
- const cachePolicy = createAssetCachePolicy(options.assetsDir);
717
- return async (c) => {
718
- const path = c.req.path;
719
- if (path === "/api" || path.startsWith("/api/") || c.req.method !== "GET" && c.req.method !== "HEAD") return c.text("Not Found", 404);
720
- const assets = c.env?.ASSETS;
721
- const assetResponse = assets && typeof assets.fetch === "function" ? await assets.fetch(c.req.raw) : options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
722
- if (assetResponse.status !== 404) return cachePolicy(c.req.raw, c.env, assetResponse);
723
- const fallback = options.fallbackRules ? await options.routing.applyFallback(c, options.fallbackRules) : void 0;
724
- if (fallback) return fallback;
725
- if (path.includes("/.") || path.substring(path.lastIndexOf("/") + 1).includes(".")) return options.errors.serveCustomPage(c, 404, "Not Found");
726
- if (path !== "/" && path.endsWith("/")) {
727
- const url = new URL(c.req.url);
728
- url.pathname = path.slice(0, -1);
729
- return Response.redirect(url.href, 301);
730
- }
731
- return options.routing.markNoMatch(c.req.raw, await options.errors.serveCustomPage(c, 404, "Not Found"));
732
- };
733
- }
734
- function createSsrFallback(options) {
735
- const cachePolicy = createAssetCachePolicy(options.assetsDir);
736
- const fetchAssets = async (c) => {
737
- const binding = c.env?.ASSETS;
738
- if (!binding || typeof binding.fetch !== "function") return options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
739
- const response = await binding.fetch(c.req.raw);
740
- return response.status === 404 ? options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 })) : cachePolicy(c.req.raw, c.env, response);
741
- };
742
- return async (c) => {
743
- if (options.nodeTarget && options.fallbackRules) {
744
- const fallback = await options.routing.applyFallback(c, options.fallbackRules);
745
- if (fallback) return fallback;
746
- }
747
- const path = c.req.path;
748
- const destination = c.req.header("sec-fetch-dest");
749
- if (path === "/api" || path.startsWith("/api/") || /\/[^/]+\.[^/]+$/.test(path) || destination && destination !== "document" && destination !== "empty") {
750
- const response = await fetchAssets(c);
751
- if (!options.nodeTarget && options.fallbackRules && response.status === 404) {
752
- const fallback = await options.routing.applyFallback(c, options.fallbackRules);
753
- if (fallback) return fallback;
754
- }
755
- return response;
756
- }
757
- const mod = await options.load();
758
- const render = typeof mod.render === "function" ? mod.render : mod.default;
759
- if (typeof render !== "function") throw new Error("ssr: Invalid entry. Export render(c, assetTags).");
760
- return render(c, await options.assets(c.req.raw, c.env));
761
- };
762
- }
763
- function createAssetNotFound(options) {
764
- const cachePolicy = createAssetCachePolicy(options.assetsDir);
765
- return async (c) => {
766
- if (!options.nodeTarget) {
767
- const assets = c.env?.ASSETS;
768
- if (assets && typeof assets.fetch === "function") {
769
- const response = await assets.fetch(c.req.raw);
770
- if (response.status !== 404) return cachePolicy(c.req.raw, c.env, response);
771
- }
772
- }
773
- return (options.fallbackRules ? await options.routing.applyFallback(c, options.fallbackRules) : void 0) ?? options.routing.markNoMatch(c.req.raw, new Response("Not Found", { status: 404 }));
774
- };
775
- }
776
- //#endregion
777
806
  //#region src/runtime/routing.ts
778
807
  /** One state owner per generated app: recursive dispatch shares rewrite and fallback guards. */
779
808
  function createRoutingRuntime(app, options = {}) {
@@ -824,6 +853,7 @@ function createRoutingRuntime(app, options = {}) {
824
853
  if (search) rewriteUrl.search = search;
825
854
  const request = new Request(rewriteUrl.toString(), c.req.raw);
826
855
  rememberOriginal(request, c);
856
+ keepActionKey(c.req.raw, request, search);
827
857
  if (fallback) fallbackHandled.add(request);
828
858
  const response = await dispatch(request, c);
829
859
  const kind = rule.force === true ? "rewrite" : "fallback";
@@ -854,11 +884,12 @@ function createRoutingRuntime(app, options = {}) {
854
884
  if (search) url.search = search;
855
885
  const request = new Request(url.toString(), c.req.raw);
856
886
  rememberOriginal(request, c);
887
+ keepActionKey(c.req.raw, request, search);
857
888
  return dispatch(request, c).then((response) => annotate(response, `c.rewrite -> ${path} (middleware)`));
858
889
  };
859
890
  const redirect = c.redirect.bind(c);
860
891
  c.redirect = (location, status) => {
861
- if (typeof location === "string" && location.startsWith("/") && !location.startsWith("//")) return redirect(mergeQueryIntoLocation(location, new URL(c.req.raw.url).search), status);
892
+ if (typeof location === "string" && location.startsWith("/") && !location.startsWith("//")) return redirect(redirectLocation(c.req.raw, location, status), status);
862
893
  return redirect(location, status);
863
894
  };
864
895
  c.originalUrl = () => originalUrls.get(c.req.raw) ?? null;
@@ -909,6 +940,36 @@ function createRoutingRuntime(app, options = {}) {
909
940
  markNoMatch
910
941
  };
911
942
  }
943
+ function redirectLocation(request, location, status) {
944
+ const url = new URL(request.url);
945
+ const search = url.search;
946
+ if (!hasActionKey(request)) return mergeQueryIntoLocation(location, search);
947
+ if (status === 303 || (status === void 0 || status === 301 || status === 302) && request.method === "POST") return mergeQueryIntoLocation(location, searchWithoutActionKey(search));
948
+ const hash = location.indexOf("#");
949
+ const destinationQuery = location.indexOf("?");
950
+ if (destinationQuery === -1 || hash !== -1 && hash < destinationQuery) return mergeQueryIntoLocation(location, search);
951
+ const merged = mergeQueryIntoLocation(location, searchWithoutActionKey(search));
952
+ if (actionKeySegment(location.slice(destinationQuery, hash === -1 ? location.length : hash)) && new URL(location, url).pathname === url.pathname) return merged;
953
+ const mergedHash = merged.indexOf("#");
954
+ const base = mergedHash === -1 ? merged : merged.slice(0, mergedHash);
955
+ const fragment = mergedHash === -1 ? "" : merged.slice(mergedHash);
956
+ const q = base.indexOf("?");
957
+ const segments = q === -1 ? [] : base.slice(q + 1).split("&");
958
+ const key = actionKeySegment(search);
959
+ const name = queryKey(key);
960
+ const hasName = (segment) => segment !== "" && queryKey(segment) === name;
961
+ const own = location.slice(destinationQuery + 1, hash === -1 ? location.length : hash).split("&").some(hasName) ? segments.findIndex(hasName) : -1;
962
+ const first = own === -1 ? key : segments.splice(own, 1)[0];
963
+ const rest = segments.join("&");
964
+ return base.slice(0, q === -1 ? base.length : q) + "?" + first + (rest ? "&" + rest : "") + fragment;
965
+ }
966
+ function queryKey(segment) {
967
+ return new URLSearchParams(segment).keys().next().value;
968
+ }
969
+ /** A rewrite that keeps the query keeps the action key in it too. */
970
+ function keepActionKey(from, to, destinationSearch) {
971
+ if (!destinationSearch && hasActionKey(from)) markActionKey(to);
972
+ }
912
973
  function markNoMatch(request, response) {
913
974
  const url = new URL(request.url);
914
975
  if (response.status !== 404 || request.method !== "GET" && request.method !== "HEAD" || url.pathname === "/api" || url.pathname.startsWith("/api/") || /\/[^/]+\.[^/]+$/.test(url.pathname)) return response;
@@ -921,7 +982,7 @@ function markNoMatch(request, response) {
921
982
  });
922
983
  }
923
984
  function createHttpRouteHandler(load, method) {
924
- return async (c) => convertReturnValue(await (await load())[method](c));
985
+ return markRouteHandler(async (c) => convertReturnValue(await (await load())[method](c)));
925
986
  }
926
987
  function createModuleLoader(load, cache = true) {
927
988
  let module;
@@ -932,4 +993,4 @@ function createModuleLoader(load, cache = true) {
932
993
  };
933
994
  }
934
995
  //#endregion
935
- export { createAssetFallback, createAssetNotFound, createClientAssetTags, createErrorRenderer, createHttpRouteHandler, createManifestLoader, createModuleLoader, createPageGetHandler, createPageMutationHandler, createPagesFallback, createRoutingRuntime, createSsrFallback, createWorkerFetch, filterInternalBindings, markNoMatch };
996
+ export { createAssetFallback, createAssetNotFound, createClientAssetTags, createErrorRenderer, createHttpRouteHandler, createManifestLoader, createModuleLoader, createNamedActionMarker, createPageGetHandler, createPageMutationHandler, createPagesFallback, createRoutingRuntime, createSsrFallback, createWorkerFetch, filterInternalBindings, markNoMatch, markRouteHandler };
@@ -1,2 +1,2 @@
1
- import { D as runValidation, E as ValidatorSlots, T as HandlerInput } from "../handler-_PqY82xe.mjs";
1
+ import { D as runValidation, E as ValidatorSlots, T as HandlerInput } from "../handler-BbkSPzGF.mjs";
2
2
  export { HandlerInput, ValidatorSlots, runValidation };
@@ -1,6 +1,6 @@
1
1
  import { n as AuthState } from "../auth-DkcFflXV.mjs";
2
- import { r as VoidAuthRuntimeOptions, t as VoidAuthEnv } from "../better-auth-shared-Bv18bB-l.mjs";
3
- import { f as WebSocketInstanceKey, t as AnyWebSocketDefinition } from "../ws-CsBNxv86.mjs";
2
+ import { r as VoidAuthRuntimeOptions, t as VoidAuthEnv } from "../better-auth-shared-DVk2DkTW.mjs";
3
+ import { f as WebSocketInstanceKey, t as AnyWebSocketDefinition } from "../ws-BH-im_tX.mjs";
4
4
  //#region src/runtime/ws-server.d.ts
5
5
  export type WebSocketRouteMeta = {
6
6
  name?: string;
@@ -1,2 +1,2 @@
1
- import { a as RoomDefinition, c as VoidSocket, d as WebSocketConnection, f as WebSocketInstanceKey, h as defineWebSocket, i as RoomController, l as VoidSocketCloseEvent, m as defineRoom, n as ConnectCommonOptions, o as SocketContext, p as connect, r as RoomContext, s as SocketDefinition, t as AnyWebSocketDefinition, u as WebSocketBaseContext } from "../ws-CsBNxv86.mjs";
1
+ import { a as RoomDefinition, c as VoidSocket, d as WebSocketConnection, f as WebSocketInstanceKey, h as defineWebSocket, i as RoomController, l as VoidSocketCloseEvent, m as defineRoom, n as ConnectCommonOptions, o as SocketContext, p as connect, r as RoomContext, s as SocketDefinition, t as AnyWebSocketDefinition, u as WebSocketBaseContext } from "../ws-BH-im_tX.mjs";
2
2
  export { AnyWebSocketDefinition, ConnectCommonOptions, RoomContext, RoomController, RoomDefinition, SocketContext, SocketDefinition, VoidSocket, VoidSocketCloseEvent, WebSocketBaseContext, WebSocketConnection, WebSocketInstanceKey, connect, defineRoom, defineWebSocket };
@@ -1,9 +1,10 @@
1
1
  import { a as join, n as dirname, r as extname, t as basename } from "./dist-ipQi0Q8y.mjs";
2
2
  import { n as readProjectPaths } from "./project-paths-DGu_QZ_Q.mjs";
3
- import { t as glob } from "./dist-Bn8Kodjp.mjs";
4
- import { n as isIdentifier, r as isLiteral } from "./ast-CPGPjb0V.mjs";
5
- import { a as staticLiteral, i as staticExportInitializers, n as parseRouteFilename } from "./parse-filename-CUbj-1MP.mjs";
6
- import { i as voidWarn } from "./log-vqY3pqwI.mjs";
3
+ import { t as glob } from "./dist-D15hFhP0.mjs";
4
+ import { n as isIdentifier, o as moduleExportName, r as isLiteral } from "./ast-CsZ_q_gc.mjs";
5
+ import { a as staticLiteral, i as staticExportInitializers, t as bindingNames } from "./ast-bindings-C3yaPs1y.mjs";
6
+ import { n as parseRouteFilename } from "./parse-filename-DioPHiR9.mjs";
7
+ import { i as voidWarn } from "./log-BMwmN5Ae.mjs";
7
8
  import { t as MagicString } from "./dist-Cegxq8gs.mjs";
8
9
  import { existsSync, readFileSync } from "node:fs";
9
10
  import { parseSync } from "vite";
@@ -209,11 +210,10 @@ function detectPageServerMetadata(source, filename) {
209
210
  if (declaration?.type === "VariableDeclaration") {
210
211
  const variables = declaration;
211
212
  for (const variable of variables.declarations ?? []) {
212
- if (!isIdentifier(variable.id)) continue;
213
- const name = variable.id.name;
214
- if (PAGE_METHODS.has(name)) metadata.methods.push(name);
213
+ for (const name of bindingNames(variable.id)) if (PAGE_METHODS.has(name)) metadata.methods.push(name);
215
214
  else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
216
- else if (variables.kind === "const") {
215
+ if (isIdentifier(variable.id) && variables.kind === "const") {
216
+ const name = variable.id.name;
217
217
  if (name === "revalidate") {
218
218
  const value = readLiteral(variable.init);
219
219
  if (typeof value === "number" && Number.isInteger(value) && value >= 0) metadata.revalidate = value;
@@ -231,9 +231,10 @@ function detectPageServerMetadata(source, filename) {
231
231
  }
232
232
  }
233
233
  for (const specifier of exported.specifiers ?? []) {
234
- if (specifier.exportKind === "type" || !isIdentifier(specifier.exported)) continue;
235
- if (PAGE_METHODS.has(specifier.exported.name)) metadata.methods.push(specifier.exported.name);
236
- else if (specifier.exported.name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
234
+ const name = moduleExportName(specifier.exported);
235
+ if (specifier.exportKind === "type" || name === void 0) continue;
236
+ if (PAGE_METHODS.has(name)) metadata.methods.push(name);
237
+ else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
237
238
  }
238
239
  }
239
240
  return metadata;
@@ -1,10 +1,10 @@
1
1
  import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken } from "./auth-B6iOCjKI.mjs";
3
- import { A as confirm, H as outro, L as log, O as cancel, U as password, tt as isCancel } from "./dist-BVdsO7Py.mjs";
4
- import { m as printSuccess, o as formatCount, p as note } from "./output-Ba6ZbrzY.mjs";
5
- import { r as PlatformClient } from "./client-GuSO3v_x.mjs";
6
- import { a as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-WpwkCB_c.mjs";
7
- import { _ as validateSecretValues } from "./env-validation-D_KyMdab.mjs";
3
+ import { A as confirm, H as outro, L as log, O as cancel, U as password, tt as isCancel } from "./dist-Cor9XGoz.mjs";
4
+ import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
5
+ import { m as printSuccess, o as formatCount, p as note } from "./output-BpgYODYx.mjs";
6
+ import { a as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-Xoi6eTWY.mjs";
7
+ import { _ as validateSecretValues } from "./env-validation-Dwq3PJzK.mjs";
8
8
  import { readFileSync } from "node:fs";
9
9
  //#region src/cli/secret.ts
10
10
  async function runSecretCommand(root, args) {
@@ -93,7 +93,7 @@ async function resolveSecretBackend(root, args) {
93
93
  }
94
94
  async function resolveCloudflareSecretBackend(root, args) {
95
95
  if (args.projectName) throw new Error("secret: --project selects a Void platform project and is not used for direct Cloudflare apps.");
96
- const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-Cm8lVx7W.mjs");
96
+ const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-DsSaw2BT.mjs");
97
97
  const context = resolveCloudflareOperationContext(root);
98
98
  return {
99
99
  target: "Cloudflare Worker",
@@ -0,0 +1,18 @@
1
+ //#region src/pages/serialize.d.ts
2
+ /**
3
+ * Escape JSON for embedding inside an inline `<script type="application/json">`
4
+ * tag. Replaces `<`, `>`, `&`, U+2028, U+2029 with their `\uXXXX` JSON escape
5
+ * sequences so the script tag cannot be closed early and the payload survives
6
+ * `JSON.parse` on hydration.
7
+ */
8
+ declare function serializePageData(pageObj: unknown): string;
9
+ /** Element id of the Markdown page frontmatter that islands read when they hydrate. */
10
+ declare const ISLAND_FRONTMATTER_ID = "__void_frontmatter";
11
+ /**
12
+ * Script tag that carries a Markdown page's frontmatter to its islands, so
13
+ * `useFrontmatter()` returns the same value in the browser as on the server.
14
+ * Empty when the page has no frontmatter.
15
+ */
16
+ declare function islandFrontmatterScript(frontmatter: Record<string, unknown> | undefined): string;
17
+ //#endregion
18
+ export { islandFrontmatterScript as n, serializePageData as r, ISLAND_FRONTMATTER_ID as t };