void 1.8.0 → 1.9.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 (222) hide show
  1. package/dist/{account-cmd-CZKntRH2.mjs → account-cmd-BEMOdwtl.mjs} +3 -3
  2. package/dist/{application-analysis-CyTagJQM.mjs → application-analysis-3VVsflWZ.mjs} +5 -5
  3. package/dist/{application-routing-BLrMVpqi.mjs → application-routing-CJRlXCc2.mjs} +1 -1
  4. package/dist/{auth-Bk9VGtQW.d.mts → auth-CV9kXHKe.d.mts} +3 -1
  5. package/dist/{auth-DyWp-fSo.mjs → auth-aMuFOZeI.mjs} +8 -2
  6. package/dist/{auth-link-BOaQWMKw.mjs → auth-link-B1IynRW5.mjs} +3 -3
  7. package/dist/{auth-router-D0-VcmDs.mjs → auth-router-DVaWJdRB.mjs} +2 -2
  8. package/dist/{better-auth-shared-CdVyCUou.mjs → better-auth-shared-C7LHvF4L.mjs} +1 -1
  9. package/dist/{better-auth-shared-CQFdtguU.d.mts → better-auth-shared-ajs3LNrY.d.mts} +1 -1
  10. package/dist/{build-cmd-JTsXXf2F.mjs → build-cmd-Dq8tdqQG.mjs} +1 -1
  11. package/dist/{cache-D0m3Z_Xf.mjs → cache-DGMnskX7.mjs} +1 -1
  12. package/dist/{cancel-deploy-Ce6Os4fa.mjs → cancel-deploy-96S5hD1E.mjs} +1 -1
  13. package/dist/cli/cli.mjs +1 -1
  14. package/dist/cli/env-schema-probe.mjs +3 -3
  15. package/dist/{cli-main-rkrJy2Ge.mjs → cli-main-CQRLxZAu.mjs} +28 -28
  16. package/dist/client-66c0RLDM.mjs +1 -0
  17. package/dist/{client-SZPyj4X_.mjs → client-D6w5x7hM.mjs} +7 -7
  18. package/dist/{cloudflare-auth-7jTqy9Bx.mjs → cloudflare-auth-pNvmT6kL.mjs} +1 -1
  19. package/dist/{cloudflare-cmd-ChPLQcTP.mjs → cloudflare-cmd-BuuHUM4z.mjs} +3 -3
  20. package/dist/{cloudflare-config-DtOGAbeB.mjs → cloudflare-config-PxbinLLE.mjs} +2 -2
  21. package/dist/{cloudflare-connect-Co93VYTo.mjs → cloudflare-connect-D1QOosLd.mjs} +2 -2
  22. package/dist/{cloudflare-operations-CXaDKYj2.mjs → cloudflare-operations-G5AObYzF.mjs} +5 -5
  23. package/dist/{cloudflare-operations-DATekLwI.mjs → cloudflare-operations-I4t3mt4R.mjs} +1 -1
  24. package/dist/{cloudflare-process-DmTxZR-N.mjs → cloudflare-process-wcnaQ5JG.mjs} +2 -2
  25. package/dist/{config-wo2EaH0X.mjs → config-C1DPf8EK.mjs} +1 -1
  26. package/dist/{config-CTlUaXWZ.d.mts → config-CCWVY7DY.d.mts} +1 -1
  27. package/dist/{config-5oSQhZNj.mjs → config-CzFdJYNA.mjs} +1 -1
  28. package/dist/{config-DcqUBGCb.mjs → config-DlWQ_hIJ.mjs} +3 -3
  29. package/dist/{config-eeDzKBS9.mjs → config-Do7gJI3T.mjs} +2 -2
  30. package/dist/config-entry.d.mts +1 -1
  31. package/dist/{connect-DlvXt1JR.mjs → connect-4uImOwut.mjs} +4 -4
  32. package/dist/{create-project-CC_7hmYJ.mjs → create-project-BaUzZnLZ.mjs} +1 -1
  33. package/dist/{create-project-DzY05xqC.mjs → create-project-CQMyzTvK.mjs} +1 -1
  34. package/dist/{db-FhyYGcJJ.mjs → db-DEpDeDsi.mjs} +19 -19
  35. package/dist/{db-types-sVwEpyPR.mjs → db-types-BpPYAx0B.mjs} +1 -1
  36. package/dist/{delete-CModjyOC.mjs → delete-BVD2kI82.mjs} +1 -1
  37. package/dist/deploy-Dr_Qamzw.mjs +2 -0
  38. package/dist/{deploy-Cz9TEzZy.mjs → deploy-Dyeo5soA.mjs} +24 -75
  39. package/dist/{deploy-managed-static-DlxxXkAM.mjs → deploy-managed-static-Kn73R83A.mjs} +20 -20
  40. package/dist/{deploy-transport-DUvm6-CR.mjs → deploy-transport-BpKBs_KR.mjs} +2 -2
  41. package/dist/deploy.mjs +6 -6
  42. package/dist/discover-Diq0l6TZ.mjs +1 -0
  43. package/dist/{discover-CVFCWU7W.mjs → discover-Vd18lHsj.mjs} +1 -1
  44. package/dist/{dispatch-CCiaAnSK.mjs → dispatch-BBfb519j.mjs} +5 -5
  45. package/dist/{domain-DvdZPA50.mjs → domain-BTIdyUVk.mjs} +2 -2
  46. package/dist/{email-ASpNrfLd.mjs → email-DvrS-I0U.mjs} +7 -7
  47. package/dist/{email-cloudflare-kqoN9jst.mjs → email-cloudflare-DAGpgzY1.mjs} +3 -3
  48. package/dist/{entry-BweGTCgj.mjs → entry-DMgR7XOf.mjs} +1 -1
  49. package/dist/{env-Bpkg3G5i.mjs → env-D7vORwpn.mjs} +4 -4
  50. package/dist/{env-types-Dz9qkiOn.mjs → env-types-WEZw5D-r.mjs} +1 -1
  51. package/dist/{env-validation-CN386Utu.mjs → env-validation-DKDcpxbt.mjs} +1 -1
  52. package/dist/{env-validation-BpCCQE_6.mjs → env-validation-DeYNRp1d.mjs} +3 -3
  53. package/dist/{gen-upKJChvd.mjs → gen-DimkGNve.mjs} +4 -4
  54. package/dist/gen-DmEeVEs4.mjs +1 -0
  55. package/dist/{github-cmd-BvMOlb8Z.mjs → github-cmd-D-zs6VQr.mjs} +1 -1
  56. package/dist/{handler-BO7Od-z9.d.mts → handler-6fzr_ikp.d.mts} +3 -3
  57. package/dist/{head-MeF_5M_3.d.mts → head-CVO92KEx.d.mts} +14 -3
  58. package/dist/{head-5XPcnG-j.mjs → head-CWJhfUwV.mjs} +62 -3
  59. package/dist/{headers-COGEDoMN.mjs → headers-Q0kZDpk8.mjs} +1 -1
  60. package/dist/{help-TPCjTu6e.mjs → help-Cgdcd-SG.mjs} +4 -4
  61. package/dist/help-Cp3K5m1w.mjs +1 -0
  62. package/dist/index.d.mts +4 -4
  63. package/dist/index.mjs +23 -23
  64. package/dist/{info-EsDyihwf.mjs → info-BbxQ34kk.mjs} +4 -4
  65. package/dist/{init-a4lVagrb.mjs → init-zyRj3QRw.mjs} +14 -14
  66. package/dist/{link-CE55DDzS.mjs → link-DAFXuIER.mjs} +2 -2
  67. package/dist/{list-CxRthQks.mjs → list-BTIcC3W9.mjs} +2 -2
  68. package/dist/{live-Kc55iuOQ.d.mts → live-DBybyDt0.d.mts} +2 -2
  69. package/dist/{live-CYJ4KGoR.mjs → live-Dw7NF1t2.mjs} +1 -1
  70. package/dist/load-user-env-ztmIyiLx.mjs +34 -0
  71. package/dist/{local-d1-CFcH9Bx3.mjs → local-d1-BnVb7Fem.mjs} +1 -1
  72. package/dist/login-DBs8JuSl.mjs +1 -0
  73. package/dist/{login-AfcSGSmE.mjs → login-DOE-MkeK.mjs} +2 -2
  74. package/dist/{logs-BgRJuvb1.mjs → logs-CUsjihc3.mjs} +2 -2
  75. package/dist/migrate-BYhoIK9R.mjs +1 -0
  76. package/dist/{migrate-BNAh6m_C.mjs → migrate-DtoKdGas.mjs} +4 -4
  77. package/dist/nitro.mjs +3 -3
  78. package/dist/{node-CXFUw0Uz.mjs → node-D9dPyUr0.mjs} +2 -2
  79. package/dist/operator-ai-logging-DFTEp81Z.mjs +121 -0
  80. package/dist/{operator-args-DGTuCdSE.mjs → operator-args-BCCohcz3.mjs} +3 -2
  81. package/dist/{operator-cmd-C-viB7Si.mjs → operator-cmd-CQOQrUiO.mjs} +26 -6
  82. package/dist/operator-cmd-xCACDtT1.mjs +1 -0
  83. package/dist/pages/client.d.mts +1 -1
  84. package/dist/pages/client.mjs +15 -13
  85. package/dist/pages/head.d.mts +2 -2
  86. package/dist/pages/head.mjs +1 -1
  87. package/dist/pages/index.d.mts +2 -2
  88. package/dist/pages/index.mjs +5 -5
  89. package/dist/pages/islands-plugin.d.mts +5 -1
  90. package/dist/pages/islands-plugin.mjs +6 -2
  91. package/dist/pages/protocol.d.mts +2 -2
  92. package/dist/pages/protocol.mjs +1 -1
  93. package/dist/platform-args-DSi4_M8n.mjs +1 -0
  94. package/dist/{platform-args-CiYeZmc5.mjs → platform-args-DtpHS_75.mjs} +1 -1
  95. package/dist/{platform-auth-config-Dt2qEc2w.mjs → platform-auth-config-fLwIS5VG.mjs} +3 -3
  96. package/dist/{platform-auth-protection-B7TaF-PZ.mjs → platform-auth-protection-BTRI_YwD.mjs} +2 -2
  97. package/dist/{platform-auth-recovery-suXSteJ6.mjs → platform-auth-recovery-DPK2Mvmo.mjs} +2 -2
  98. package/dist/{platform-cmd-DuAsIxbU.mjs → platform-cmd-BLy5uCa-.mjs} +1 -1
  99. package/dist/{platform-cmd-9rvYBBtr.mjs → platform-cmd-HS_FSthn.mjs} +5 -5
  100. package/dist/{platform-domain-DhH_vDr6.mjs → platform-domain-CHpcq_qg.mjs} +2 -2
  101. package/dist/{platform-lifecycle-3uI-E2bF.mjs → platform-lifecycle-B6LUBwjS.mjs} +1 -1
  102. package/dist/{platform-lifecycle-CXmXe2xt.mjs → platform-lifecycle-D2RS7DE0.mjs} +236 -26
  103. package/dist/{platform-management-PdrgDQTe.mjs → platform-management-C-T0ch4y.mjs} +1 -1
  104. package/dist/{platform-management-BBCHfwji.mjs → platform-management-d3ETv3Dw.mjs} +14 -14
  105. package/dist/{platform-plans-config-BGwkXYDM.mjs → platform-plans-config-B7yJQKf7.mjs} +114 -30
  106. package/dist/{platform-recovery-C8NxXGRR.mjs → platform-recovery-DS5CAsly.mjs} +2 -2
  107. package/dist/{plugin-inference-CErfTgEx.mjs → plugin-inference-DZHmVe1f.mjs} +3 -3
  108. package/dist/{prepare-BDKWZgfL.mjs → prepare-AVM4Hj3T.mjs} +8 -8
  109. package/dist/prepare-BSXKz6m8.mjs +1 -0
  110. package/dist/{prepare-BLrzXjIl.mjs → prepare-DMk8NAO-.mjs} +1 -1
  111. package/dist/{project-cmd-DzGvxXKH.mjs → project-cmd-TQKAOTMV.mjs} +15 -15
  112. package/dist/{project-paths-G0yut6Zz.mjs → project-paths-CUhCPMpK.mjs} +33 -2
  113. package/dist/{project-team-C5XtHbZk.mjs → project-team-B1OKeb-T.mjs} +1 -1
  114. package/dist/{project-token-B4D5yhHQ.mjs → project-token-RW_wpmN-.mjs} +1 -1
  115. package/dist/{project-tsconfig-nhnTWO_Y.mjs → project-tsconfig-MyRJgufB.mjs} +1 -1
  116. package/dist/{project-zero-trust--0LvktDg.mjs → project-zero-trust-TNc66p0_.mjs} +1 -1
  117. package/dist/{protocol-B1Tvc9-x.mjs → protocol-IPSWHolJ.mjs} +54 -19
  118. package/dist/{protocol-Cg2I81NA.d.mts → protocol-YS3tbxWE.d.mts} +2 -2
  119. package/dist/{provision-CAcrauvr.mjs → provision-BLdkpFT4.mjs} +1 -1
  120. package/dist/{provision-C3yiHdld.mjs → provision-bgQTi5QZ.mjs} +2 -2
  121. package/dist/redirect-Dqb4fEc5.mjs +80 -0
  122. package/dist/{requests-CrRiTgQA.mjs → requests-Cj15-yrI.mjs} +1 -1
  123. package/dist/{rollback-BsmQyj-Q.mjs → rollback-CYnkng7B.mjs} +2 -2
  124. package/dist/{route-types-CgtlFCDz.mjs → route-types-C6eAOmOj.mjs} +1 -1
  125. package/dist/runtime/auth.d.mts +1 -1
  126. package/dist/runtime/auth.mjs +1 -1
  127. package/dist/runtime/better-auth-mysql.d.mts +1 -1
  128. package/dist/runtime/better-auth-mysql.mjs +1 -1
  129. package/dist/runtime/better-auth-pg.d.mts +1 -1
  130. package/dist/runtime/better-auth-pg.mjs +1 -1
  131. package/dist/runtime/better-auth.d.mts +1 -1
  132. package/dist/runtime/better-auth.mjs +1 -1
  133. package/dist/runtime/client-react.d.mts +1 -1
  134. package/dist/runtime/client-solid.d.mts +1 -1
  135. package/dist/runtime/client-svelte.d.mts +1 -1
  136. package/dist/runtime/client-vue.d.mts +1 -1
  137. package/dist/runtime/client.d.mts +1 -1
  138. package/dist/runtime/handler.d.mts +1 -1
  139. package/dist/runtime/live-client.d.mts +1 -1
  140. package/dist/runtime/live-server.mjs +1 -1
  141. package/dist/runtime/live.d.mts +1 -1
  142. package/dist/runtime/live.mjs +1 -1
  143. package/dist/runtime/routing.d.mts +2 -2
  144. package/dist/runtime/routing.mjs +6 -5
  145. package/dist/runtime/validator.d.mts +1 -1
  146. package/dist/runtime/ws-server.d.mts +3 -3
  147. package/dist/runtime/ws-server.mjs +1 -1
  148. package/dist/runtime/ws.d.mts +1 -1
  149. package/dist/{scan-BJ3bj6aP.mjs → scan-4YOxDaw2.mjs} +2 -2
  150. package/dist/{secret-D0g5oBsP.mjs → secret-BSf7dgg_.mjs} +3 -3
  151. package/dist/{action-key-ByZ6DDld.mjs → url-DaehRGKR.mjs} +43 -1
  152. package/dist/{version-metadata-eUd6Ar_U.mjs → version-metadata-CeftH0fQ.mjs} +1 -1
  153. package/dist/{wrangler-k40T7XTQ.mjs → wrangler-B1gkT_wC.mjs} +3 -3
  154. package/dist/wrangler-fNGvPTlO.mjs +1 -0
  155. package/dist/{wrapper-CVMZarxf.mjs → wrapper-xJ4LP5A7.mjs} +3 -3
  156. package/dist/{ws--U7QicYy.d.mts → ws-C2zy0QBf.d.mts} +2 -2
  157. package/docs/guide/ai.md +1 -1
  158. package/docs/guide/app-types.md +1 -1
  159. package/docs/guide/auth.md +22 -27
  160. package/docs/guide/database/d1.md +4 -2
  161. package/docs/guide/database.md +29 -27
  162. package/docs/guide/deployment.md +2 -2
  163. package/docs/guide/edge/headers.md +3 -3
  164. package/docs/guide/edge/prerendering.md +5 -5
  165. package/docs/guide/edge/redirects.md +1 -1
  166. package/docs/guide/edge/revalidation.md +4 -2
  167. package/docs/guide/edge/rewrites.md +1 -1
  168. package/docs/guide/edge/static-assets.md +4 -0
  169. package/docs/guide/email/sending.md +4 -2
  170. package/docs/guide/live.md +1 -1
  171. package/docs/guide/pages-routing/actions-and-forms.md +25 -7
  172. package/docs/guide/pages-routing/errors.md +17 -9
  173. package/docs/guide/pages-routing/head.md +44 -1
  174. package/docs/guide/pages-routing/islands.md +3 -1
  175. package/docs/guide/pages-routing/layouts.md +2 -2
  176. package/docs/guide/pages-routing/loaders.md +3 -1
  177. package/docs/guide/pages-routing/markdown.md +5 -3
  178. package/docs/guide/pages-routing/overview.md +14 -21
  179. package/docs/guide/platform/administration/connected-apps.md +10 -3
  180. package/docs/guide/platform/administration/email.md +1 -1
  181. package/docs/guide/platform/administration/plans.md +34 -1
  182. package/docs/guide/platform/administration/projects.md +6 -2
  183. package/docs/guide/platform/installation/credentials.md +12 -10
  184. package/docs/guide/platform/installation/maintenance.md +7 -1
  185. package/docs/guide/platform/installation/setup.md +8 -7
  186. package/docs/guide/queues.md +1 -1
  187. package/docs/guide/server-routing.md +2 -2
  188. package/docs/guide/sse.md +1 -1
  189. package/docs/guide/ssg.md +17 -6
  190. package/docs/guide/storage.md +1 -1
  191. package/docs/guide/testing.md +9 -7
  192. package/docs/guide/type-safety.md +23 -21
  193. package/docs/integrations/cloudflare.md +6 -2
  194. package/docs/integrations/frameworks/nuxt.md +1 -1
  195. package/docs/integrations/hono.md +21 -0
  196. package/docs/integrations/nodejs-bun-deno.md +4 -4
  197. package/docs/reference/api/auth.md +22 -4
  198. package/docs/reference/api/database.md +2 -2
  199. package/docs/reference/api/pages.md +17 -13
  200. package/docs/reference/api/resources.md +1 -1
  201. package/docs/reference/api/rewrites.md +8 -4
  202. package/docs/reference/api.md +1 -1
  203. package/docs/reference/cli/deploy.md +4 -2
  204. package/docs/reference/cli/platform-config.md +3 -3
  205. package/docs/reference/cli/platform-users.md +58 -11
  206. package/docs/reference/cli.md +1 -1
  207. package/docs/reference/config.md +7 -3
  208. package/package.json +7 -7
  209. package/skills/void/SKILL.md +1 -1
  210. package/dist/client-D1Vz1Zep.mjs +0 -1
  211. package/dist/deploy-DMieisRu.mjs +0 -2
  212. package/dist/discover-1DJD4YXD.mjs +0 -1
  213. package/dist/gen-M5fNQKfH.mjs +0 -1
  214. package/dist/help-CItQVDL4.mjs +0 -1
  215. package/dist/load-user-env-CSwdofj0.mjs +0 -48
  216. package/dist/login-ZHsAm-I6.mjs +0 -1
  217. package/dist/migrate-BflbbZQK.mjs +0 -1
  218. package/dist/operator-cmd-D6qNuJ_z.mjs +0 -1
  219. package/dist/platform-args-DJvF1-kl.mjs +0 -1
  220. package/dist/prepare-a1_5usAn.mjs +0 -1
  221. package/dist/url-CuoEn0o3.mjs +0 -43
  222. package/dist/wrangler-R3kMdJfw.mjs +0 -1
@@ -1,27 +1,27 @@
1
1
  ---
2
- description: 'Test a Void app with Vitest. With Vite+, run the tests through vp test.'
2
+ description: 'Run tests with Vitest and Vite+, mock Cloudflare bindings, and test email with the built-in harnesses.'
3
3
  outline: deep
4
4
  ---
5
5
 
6
6
  # Testing
7
7
 
8
- Test your app with [Vitest](https://vitest.dev/). With Vite+, the default toolchain, run it with `vp test`:
8
+ Void apps use [Vitest](https://vitest.dev/). With Vite+, run your tests with:
9
9
 
10
10
  ```sh
11
11
  vp test
12
12
  ```
13
13
 
14
- Import test APIs from `vite-plus/test`. With the Vite toolchain, add `vitest` to your dev dependencies, run `vitest`, and import from `vitest` instead.
14
+ Import `it`, `expect`, and other test APIs from `vite-plus/test`. If you chose Vite instead of Vite+, install `vitest` as a dev dependency and use `vitest` for both the imports and command.
15
15
 
16
- Vitest reads your `vite.config.ts`, so `void/*` imports, `@schema`, and the other modules Void provides resolve in tests as they do in your app. Tests need no separate configuration.
16
+ Vitest uses your `vite.config.ts`. Imports such as `void/*` and `@schema` work without extra test configuration.
17
17
 
18
- Keep test files out of the [convention directories](../reference/structure.md) such as `routes/` and `pages/`. Void reads the files there as part of your app, so a test file in `routes/` becomes a route. Put tests in `tests/`, or next to the code they test in `src/`.
18
+ Put tests in `tests/` or beside the code they test in `src/`. Keep them out of [convention directories](../reference/structure.md) such as `routes/` and `pages/`, where Void would treat them as app routes.
19
19
 
20
20
  ## Bindings {#bindings}
21
21
 
22
- Tests run in Node.js, not in the Workers runtime. Void doesn't start your Worker for a test run, so D1, KV, R2, and other bindings are unavailable, and it doesn't apply migrations to your local database. You can import modules that use bindings, but a call that reaches one throws `env: Cloudflare env is unavailable`.
22
+ Tests run in Node.js without starting a Worker or applying local migrations. To test code that uses D1, KV, R2, or another binding, mock the module with [`vi.mock()`](https://vitest.dev/api/vi#vi-mock).
23
23
 
24
- To test code that uses a binding, replace its module with [`vi.mock()`](https://vitest.dev/api/vi#vi-mock):
24
+ For example, this function counts visits in KV:
25
25
 
26
26
  ```ts
27
27
  // src/visits.ts
@@ -34,6 +34,8 @@ export async function countVisit(): Promise<number> {
34
34
  }
35
35
  ```
36
36
 
37
+ Replace KV with an in-memory map in the test:
38
+
37
39
  ```ts
38
40
  // src/visits.test.ts
39
41
  import { expect, it, vi } from 'vite-plus/test';
@@ -137,7 +137,7 @@ The `action()` helper gets the same type checking. See [Actions & Forms](./pages
137
137
 
138
138
  ## Typed URLs and Navigation
139
139
 
140
- Use `routeUrl()` from `void/routes` to build URLs from your app's page, HTTP, and WebSocket route patterns. For a page at `pages/users/[id].tsx`, `.vue`, or `.svelte`, the pattern is `/users/[id]`:
140
+ To link to a user's profile, pass its route pattern and ID to `routeUrl()`:
141
141
 
142
142
  ```ts
143
143
  import { routeUrl } from 'void/routes';
@@ -150,9 +150,11 @@ const url = routeUrl('/users/[id]', {
150
150
  // /users/42?tab=activity#details
151
151
  ```
152
152
 
153
- Your editor autocompletes route patterns and parameter names. TypeScript checks that the route exists and all required parameters are supplied. Parameter values accept strings or numbers; Void encodes them for the URL. Query keys are chosen by your app, and values can be strings, numbers, booleans, or arrays of those values. Arrays become repeated query parameters; `null` and `undefined` values are omitted.
153
+ TypeScript checks the route and required parameter names. Patterns follow your filenames: `pages/users/[id].tsx`, `.vue`, or `.svelte` uses `/users/[id]`.
154
154
 
155
- Use bracket patterns with `routeUrl()`, typed `fetch()`, WebSocket `connect()`, page actions, and `useParams()`.
155
+ Parameters accept strings or numbers and are URL-encoded for you. Query values can be strings, numbers, booleans, or arrays. Arrays become repeated keys; `null` and `undefined` values are omitted.
156
+
157
+ The same bracket patterns work with typed `fetch()`, WebSocket `connect()`, page actions, and `useParams()`.
156
158
 
157
159
  Pass the returned string to `Link`, a plain `<a>`, or `c.redirect()`. For programmatic navigation and `c.rewrite()`, you can pass a destination object directly:
158
160
 
@@ -167,7 +169,7 @@ const profile = {
167
169
  } satisfies RouteDestination;
168
170
  ```
169
171
 
170
- Destination objects use the same parameter checking and URL encoding as `routeUrl()`. See [Pages Routing](./pages-routing/overview.md#typed-navigation) for links and router methods, and [Rewrites](../reference/api/rewrites.md#c-rewrite-destination) for server navigation.
172
+ Destination objects check and encode parameters just like `routeUrl()`. See [Pages Routing](./pages-routing/overview.md#typed-navigation) for client navigation and [Rewrites](../reference/api/rewrites.md#c-rewrite-destination) for server navigation.
171
173
 
172
174
  For a catch-all page such as `pages/files/[...path].tsx`, `.vue`, or `.svelte`, use `/files/[...path]` and pass the full path as one value:
173
175
 
@@ -185,7 +187,7 @@ routeUrl('/files/[...]', { params: { '*': 'docs/get started' } });
185
187
 
186
188
  ### Page params
187
189
 
188
- Pass a page's URL pattern as the type argument of `useParams()` to type the params it reads. For a page at `pages/users/[id].tsx`, `.vue`, or `.svelte`, the pattern is `/users/[id]`:
190
+ Pass the current page's pattern to `useParams()` to get typed parameters:
189
191
 
190
192
  ::: code-group
191
193
 
@@ -230,9 +232,9 @@ useParams<'/userz/[id]'>(); // Type error: no page matches
230
232
 
231
233
  :::
232
234
 
233
- The pattern must be one of your pages; HTTP and WebSocket routes are not accepted. A catch-all page such as `pages/files/[...path].tsx`, `.vue`, or `.svelte` gives `{ path: string }`. An unnamed catch-all (`[...].tsx`, `[...].vue`, or `[...].svelte`) has no params.
235
+ Use a page pattern, rather than an HTTP or WebSocket route. Named catch-alls such as `/files/[...path]` return `{ path: string }`; unnamed catch-alls have no named params.
234
236
 
235
- The pattern is checked by TypeScript only. Pass the pattern of the page the component renders in; without a pattern, `useParams()` returns `Record<string, string>`.
237
+ The type argument doesn't change which page is read. Without it, `useParams()` returns `Record<string, string>`.
236
238
 
237
239
  On the server, `c.req.param('slug')` accepts any name. Read the params object through `PageParams` so a missing or misspelled name is a type error:
238
240
 
@@ -244,7 +246,7 @@ const { slug } = c.req.param() as PageParams<'/posts/[slug]'>;
244
246
 
245
247
  ### Prerender paths
246
248
 
247
- On a dynamic page, annotate `getPrerenderPaths()` with `PageParams` for that page's URL pattern. Each returned object must then include the page's params, and a missing or misspelled key is a type error. Void does not infer this type from the filename, so the check applies only when the annotation is present:
249
+ Annotate `getPrerenderPaths()` with `PageParams` to check that every path includes the page's required parameters:
248
250
 
249
251
  ```ts
250
252
  // pages/blog/[slug].server.ts
@@ -255,9 +257,9 @@ export async function getPrerenderPaths(): Promise<PageParams<'/blog/[slug]'>[]>
255
257
  }
256
258
  ```
257
259
 
258
- In custom SSR mode the function returns full path strings, so annotate it as `Promise<string[]>`. See [Edge Prerendering](./edge/prerendering.md#dynamic-pages-with-params) and [Static Site Generation](./ssg.md#per-page-overrides).
260
+ Void doesn't infer this return type from the filename; include the annotation to catch missing or misspelled keys. Custom SSR returns full paths instead, typed as `Promise<string[]>`. See [Edge Prerendering](./edge/prerendering.md#dynamic-pages-with-params) and [Static Site Generation](./ssg.md#per-page-overrides).
259
261
 
260
- `routing.prerender` is a list of plain strings. Annotate the array with `satisfies RouteUrl[]` so each path has to match a route. The check applies when [`routing.typedRoutes`](../reference/config.md#routing-typedroutes) is on; otherwise `RouteUrl` is `string`:
262
+ For `routing.prerender`, use `satisfies RouteUrl[]` to check paths when [`routing.typedRoutes`](../reference/config.md#routing-typedroutes) is enabled:
261
263
 
262
264
  ```ts
263
265
  // void.config.ts
@@ -271,7 +273,7 @@ export default defineConfig({
271
273
 
272
274
  ### Checked URL strings
273
275
 
274
- [`routing.typedRoutes`](../reference/config.md#routing-typedroutes) checks plain URL strings in `Link`'s `href`, `router.visit()`, `router.prefetch()`, `router.flush()`, `c.rewrite()`, `c.redirect()`, `revalidate({ paths })`, `connectEventStream()`, `connectLiveStream()`, and `useIslandForm()`'s `post()`, `put()`, `patch()`, `delete()`, and `submit()`. Apps created with `void init` have it on. To turn it on in an existing app:
276
+ Enable [`routing.typedRoutes`](../reference/config.md#routing-typedroutes) to catch misspelled URLs in links, router calls, redirects, rewrites, cache revalidation, island forms, and stream clients. Apps created with `void init` already have it enabled. For an existing app:
275
277
 
276
278
  ```ts
277
279
  // void.config.ts
@@ -336,11 +338,13 @@ import { routeUrl } from 'void/routes';
336
338
 
337
339
  :::
338
340
 
339
- Links can also point to the current page (`?page=2`, `#comments`) and to `http://`, `https://`, `mailto:`, and `tel:` URLs. Relative paths such as `../settings` are rejected; use the absolute path. A fixed part with spaces or non-ASCII characters can be written as is (`/café menu`) or percent-encoded in uppercase, as `routeUrl()` returns it (`/caf%C3%A9%20menu`). A dynamic segment matches any text, including none, so `/users/[id]` also accepts `/users/` and `/users/42/edit`. With a root dynamic page such as `pages/[slug].tsx`, `.vue`, or `.svelte`, a protocol-relative URL like `//example.com` passes too.
341
+ Links also accept same-page queries and hashes (`?page=2`, `#comments`), and `http://`, `https://`, `mailto:`, and `tel:` URLs. Use absolute paths within your app; relative paths such as `../settings` are rejected. Static path segments accept raw text such as `/café menu` or uppercase percent encoding such as `/caf%C3%A9%20menu`.
342
+
343
+ String checks use TypeScript patterns, which don't validate individual dynamic segments. For example, `/users/[id]` also accepts `/users/` and `/users/42/edit`. A root dynamic page can accept `//example.com`. Prefer `routeUrl()` to encode parameters, and validate untrusted URLs at runtime.
340
344
 
341
- The [SSE](./sse.md#client) and [live stream](./live.md#subscribe-from-the-browser) clients, `connectEventStream()` and `connectLiveStream()`, take one of your routes or an `http://` or `https://` URL for a stream on another origin. They reject same-page, `mailto:`, `tel:`, and `ws://` URLs. Cast a stream URL that TypeScript can't check with `as RouteUrl`; the cast turns off the check for that URL.
345
+ The [SSE](./sse.md#client) and [live stream](./live.md#subscribe-from-the-browser) clients accept route URLs and external `http://` or `https://` URLs. Same-page links, `mailto:`, `tel:`, and `ws://` aren't stream destinations.
342
346
 
343
- `c.redirect()` uses the same check as links. With `routing.typedRoutes` on, the location is a route URL, a same-page query or hash (`?page=2`, `#comments`), or an `http://`, `https://`, `mailto:`, or `tel:` URL. A path that matches no route is a type error. An external `https://` literal needs no cast. A `URL` or a destination object is accepted too. Cast a string TypeScript cannot check, such as a URL from a provider SDK, your CMS, or a file in `public/`, with `as Href`:
347
+ `c.redirect()` accepts the same strings as links, plus a `URL` or destination object. For a URL from a provider SDK, your CMS, or `public/`, use `as Href` to skip the type check:
344
348
 
345
349
  ```ts
346
350
  import { routeUrl, type Href } from 'void/routes';
@@ -356,14 +360,14 @@ c.redirect(new URL('https://example.com/login'));
356
360
  c.redirect(dynamic as Href);
357
361
  ```
358
362
 
359
- The cast turns the check off, so cast only URLs you trust. Check a URL from the request, such as a `?redirectTo=` parameter, before redirecting to it. See [`c.redirect()`](../reference/api/rewrites.md#c-rewrite-destination).
363
+ Cast only URLs you trust. Validate request values such as `?redirectTo=` before redirecting; see [`c.redirect()`](../reference/api/rewrites.md#c-rewrite-destination) for an example.
360
364
 
361
365
  `void/routes` exports two types for these strings:
362
366
 
363
367
  - `RouteUrl`: the URL of one of your routes. `routeUrl()` returns it, and `c.rewrite()`, `useIslandForm()`, and `revalidate({ paths })` accept it. Annotate a `routing.prerender` list with it.
364
368
  - `Href`: anything a link or `c.redirect()` can point to: a `RouteUrl`, a same-page query or hash, or an external URL.
365
369
 
366
- Cast a string that TypeScript can't check, such as a path from your CMS or a file in `public/`. The cast turns the check off for that string:
370
+ Use these types for URLs you check at runtime:
367
371
 
368
372
  ::: code-group
369
373
 
@@ -413,9 +417,7 @@ import type { Href, RouteUrl } from 'void/routes';
413
417
 
414
418
  :::
415
419
 
416
- Restart the dev server or run `void prepare` after changing `routing.typedRoutes`.
417
-
418
- Route types update with the dev server. For CI or standalone typechecking, run `void prepare` and follow [Setup](#setup). The [API reference](../reference/api/types.md#void-routes) lists the URL helper and route types.
420
+ The dev server keeps route types up to date. After changing `routing.typedRoutes`, restart it or run `void prepare`. For CI and standalone typechecking, follow [Setup](#setup). See the [API reference](../reference/api/types.md#void-routes) for the URL helper and route types.
419
421
 
420
422
  ## What Gets Checked
421
423
 
@@ -469,7 +471,7 @@ Now `c.get("requestId")` returns `string` everywhere, with no assertion needed.
469
471
 
470
472
  ## Custom Binding Types
471
473
 
472
- On the Cloudflare target, Void generates types for bindings declared under `cloudflare` in `void.config.ts`. For example, configure a [Cloudflare rate limiter](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/):
474
+ For native Cloudflare deployments, declare a binding in `void.config.ts` to give `c.env` its type. For example, add a [rate limiter](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/):
473
475
 
474
476
  ```ts
475
477
  // void.config.ts
@@ -507,7 +509,7 @@ declare module 'void' {
507
509
  }
508
510
  ```
509
511
 
510
- The declaration can refine a generated binding or type a binding that is not declared in `cloudflare`. Fixed values and secrets declared in `env.ts` retain their schema types. These types apply to Void's `c.env`; use your framework's Cloudflare type setup when accessing bindings through `cloudflare:workers`.
512
+ Augmentation can refine a generated binding or add one you provide separately. Values declared in `env.ts` keep their schema types. These types apply to Void's `c.env`; for `cloudflare:workers`, use your framework's binding types.
511
513
 
512
514
  ## Setup
513
515
 
@@ -43,7 +43,7 @@ Add `void/env` to your TypeScript types:
43
43
  }
44
44
  ```
45
45
 
46
- This provides binding types and Workers runtime types. Custom bindings declared in `cloudflare` in `void.config.ts` are typed on `c.env` after `void prepare` or starting a dev server or build. See [Custom Binding Types](../guide/type-safety.md#custom-binding-types) to add RPC methods to service or Durable Object bindings.
46
+ This provides binding and Workers runtime types. For custom bindings in `void.config.ts`, run `void prepare` or start the dev server or build to type them on `c.env`. See [Custom Binding Types](../guide/type-safety.md#custom-binding-types) for RPC methods on service and Durable Object bindings.
47
47
 
48
48
  ### Available bindings
49
49
 
@@ -175,7 +175,11 @@ Set production server values with `void secret put <NAME>`. Void preserves exist
175
175
 
176
176
  ### Readiness and rollback
177
177
 
178
- Void normally verifies an uploaded version before sending it traffic. A Worker with workers.dev turned off and no route or Custom Domain has no URL Void can check, so that deploy skips the readiness check and activates the uploaded version. If readiness or trigger updates fail, it restores the previous deployment. If trigger updates fail and Void cannot restore the previous version's triggers, for example because another tool deployed it or it is an empty draft, the new version stays live and the error says which version is serving traffic. Finish or cancel any gradual rollout in Cloudflare before deploying through Void.
178
+ Void checks an uploaded version before sending it traffic. If the Worker has no public URL, because workers.dev is off and no route or Custom Domain is configured, Void activates it without a readiness check.
179
+
180
+ If readiness or trigger updates fail, Void restores the previous deployment. If trigger updates fail and the previous triggers can't be restored, such as after another tool's deployment or from an empty draft, the new version stays live. The error names the version serving traffic.
181
+
182
+ Finish or cancel gradual rollouts in Cloudflare before deploying through Void.
179
183
 
180
184
  For an existing Durable Object Worker that Cloudflare cannot stage, review the changes and use:
181
185
 
@@ -49,7 +49,7 @@ export default defineNuxtConfig({
49
49
 
50
50
  The `void/nitro` module gives Nuxt server routes your app's `void/db` and `@schema`. The top-level `alias` lets `nuxi typecheck` resolve `@schema`, because Nuxt also checks server routes with the app's types. `cloudflare.dev` gives the development server the bindings from Void's generated Cloudflare config; Nuxt runs it in development when `compatibilityDate` is `2025-07-15` or later.
51
51
 
52
- The database module supports Nitro 2 and Nitro 3 prereleases. Keep your Nuxt version's Cloudflare development configuration; Nitro 3 manages local Workers through its development runner.
52
+ The database module supports Nitro 2 and Nitro 3 prereleases. Use the Cloudflare development configuration for your Nuxt version; Nitro 3 uses its own Worker runner.
53
53
 
54
54
  ### 4. Create `void.config.ts`
55
55
 
@@ -104,3 +104,24 @@ throw new HTTPException(404, { message: 'User not found' });
104
104
  ```
105
105
 
106
106
  For the full list of built-in middleware, see the [Hono documentation](https://hono.dev/docs/middleware/builtin).
107
+
108
+ ### Redirects
109
+
110
+ Return `c.redirect()` from a handler to redirect. From a shared helper, throw an `HTTPException` with the redirect response in `res`. This works in loaders, actions, and middleware, including client-side page visits:
111
+
112
+ ```ts
113
+ // lib/require-page-user.ts
114
+ import { HTTPException } from 'hono/http-exception';
115
+ import type { CloudContext } from 'void';
116
+ import { getUser } from 'void/auth';
117
+
118
+ export function requirePageUser(c: CloudContext) {
119
+ const user = getUser();
120
+ if (!user) {
121
+ throw new HTTPException(302, { res: c.redirect('/login') });
122
+ }
123
+ return user;
124
+ }
125
+ ```
126
+
127
+ After a mutation, use `303` for both the exception and `c.redirect('/login', 303)` so the browser follows with a GET.
@@ -164,9 +164,9 @@ This is useful for testing, embedding in Express/Fastify, or running in serverle
164
164
 
165
165
  ### Serving the client build from somewhere else
166
166
 
167
- By default, `app.js` serves the client build from `dist/client`, next to `dist/ssr`. To serve it from elsewhere, such as from inside a [single executable application](https://nodejs.org/api/single-executable-applications.html), pass an `ASSETS` object with a `fetch(request)` method in the env. Void then reads the client manifest, scripts, styles and `public/` files through it, and doesn't look for `dist/client`.
167
+ To embed your app in a [single executable](https://nodejs.org/api/single-executable-applications.html), pass an `ASSETS` object with a `fetch(request)` method to `app.fetch()`. Void uses it for the client manifest, scripts, styles, and public files instead of reading `dist/client`.
168
168
 
169
- This server reads the client build from a single executable's assets, stored under their URL paths (`/.vite/manifest.json`, `/assets/…`, and `public/` files):
169
+ For Node.js, store assets under their URL paths, including `/.vite/manifest.json`, `/assets/…`, and files copied from `public/`:
170
170
 
171
171
  ```ts
172
172
  import { getAsset } from 'node:sea';
@@ -194,9 +194,9 @@ const ASSETS = {
194
194
  serve({ fetch: (request, env) => app.fetch(request, { ...env, ASSETS }), port: 3000 });
195
195
  ```
196
196
 
197
- Keep the env the server passes in: on Node.js it carries the incoming request, which `getConnInfo()` reads.
197
+ Keep the server's existing `env` values when adding `ASSETS`, so `getConnInfo()` can read the incoming request.
198
198
 
199
- With Bun, `bun build --compile` embeds a file only when the code imports it with `{ type: 'file' }`. Listing `dist/client` files as extra entry points doesn't work, because Bun bundles JavaScript entry points as code. Client file names change with every build, so write the imports into a module after `vite build`, one per file in `dist/client`:
199
+ For Bun, import each client file with `{ type: 'file' }` so `bun build --compile` embeds it as an asset. Generate this module after each `vite build`, since filenames change with the build. Don't list client scripts as build entry points; Bun would bundle them as executable code:
200
200
 
201
201
  ```ts
202
202
  // client-files.ts, written after each `vite build`
@@ -69,7 +69,7 @@ import { getAuth } from 'void/auth';
69
69
  export const GET = defineHandler((c) => getAuth(c).handler(c.req.raw));
70
70
  ```
71
71
 
72
- Requires [authentication](../../guide/auth.md) to be enabled. Throws if no instance is available on the request. It is available to anonymous requests too; use `requireAuth(c)` when a route requires a signed-in user.
72
+ Enable [authentication](../../guide/auth.md) before calling this helper; it throws if no instance is available. Anonymous requests can use it too. Call `requireAuth(c)` separately to require a signed-in user.
73
73
 
74
74
  **Signature:**
75
75
 
@@ -77,9 +77,11 @@ Requires [authentication](../../guide/auth.md) to be enabled. Throws if no insta
77
77
  function getAuth(c: CloudContext): AuthInstance;
78
78
  ```
79
79
 
80
- ## `requireAuth(c)` {#requireauth-c}
80
+ ## `requireAuth(c, options?)` {#requireauth-c}
81
81
 
82
- Extracts the authenticated user from the request context. Throws a 401 `HTTPException` if no session is present.
82
+ Returns the authenticated user from the request context. Without `throwRedirect`, throws a 401 `HTTPException` if no session is present.
83
+
84
+ Use it without options in route handlers or actions when you want a plain-text `401`, not an error page:
83
85
 
84
86
  ```ts
85
87
  import { defineHandler } from 'void';
@@ -91,10 +93,26 @@ export const GET = defineHandler((c) => {
91
93
  });
92
94
  ```
93
95
 
96
+ For protected pages, pass `throwRedirect` to [redirect unauthenticated visitors to login](../../guide/auth.md#protect-a-server-route):
97
+
98
+ ```ts
99
+ import { defineHandler } from 'void';
100
+ import { requireAuth } from 'void/auth';
101
+
102
+ export const loader = defineHandler((c) => {
103
+ const user = requireAuth(c, { throwRedirect: '/login' });
104
+ return { email: user.email };
105
+ });
106
+ ```
107
+
108
+ `throwRedirect` works in loaders, actions, and middleware. When signed out, it throws a redirect with status `302` for GET/HEAD requests or `303` for other methods, stopping execution. When signed in, it returns the user normally.
109
+
110
+ The destination is application-controlled.
111
+
94
112
  **Signature:**
95
113
 
96
114
  ```ts
97
- function requireAuth(c: CloudContext): AuthUser;
115
+ function requireAuth(c: CloudContext, options?: { throwRedirect?: string }): AuthUser;
98
116
  ```
99
117
 
100
118
  ## `AuthUser` {#authuser}
@@ -37,7 +37,7 @@ import { createDb } from 'void/db';
37
37
  const db = createDb(env.MY_OTHER_DB);
38
38
  ```
39
39
 
40
- Pass `{ session: 'first-primary' }` to start the D1 session with a query on the primary, keeping your app's schema and query types. Create this client inside the request that needs a fresh read. The default is `'first-unconstrained'`, which allows the first query to use a replica. See [read replication](../../guide/database/d1.md#read-replication).
40
+ For a fresh D1 read, pass `{ session: 'first-primary' }` and create the client inside the request. The default, `'first-unconstrained'`, allows the first query to use a replica. Both keep your schema and query types. See [Read replication](../../guide/database/d1.md#read-replication).
41
41
 
42
42
  For PostgreSQL and MySQL projects, pass a connection string.
43
43
 
@@ -73,7 +73,7 @@ import { db, eq, and, or, desc, like, inArray, sql } from 'void/db';
73
73
 
74
74
  **Full list:** `sql`, `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `and`, `or`, `not`, `desc`, `asc`, `like`, `ilike`, `notLike`, `inArray`, `notInArray`, `isNull`, `isNotNull`, `between`, `notBetween`, `exists`, `notExists`, `count`, `sum`, `avg`, `min`, `max`.
75
75
 
76
- It also exports the Drizzle types `SQL`, `SQLWrapper`, `AnyColumn`, and `BatchItem` for helpers that take part of a query:
76
+ Use the exported Drizzle types `SQL`, `SQLWrapper`, `AnyColumn`, and `BatchItem` to type query helpers and batches:
77
77
 
78
78
  ```ts
79
79
  import { posts } from '@schema';
@@ -20,7 +20,7 @@ import type { ErrorPageProps, PageError } from 'void/pages';
20
20
 
21
21
  ## Navigation destinations {#navigation-destinations}
22
22
 
23
- All four adapters support typed URLs through [`routeUrl()`](./types.md#routeurl-path-options). Pass the returned string to `Link`'s `href`, which has the type [`Href`](./types.md#route-types).
23
+ Build a URL with [`routeUrl()`](./types.md#routeurl-path-options) and pass it to `Link`'s `href`. All four adapters use the [`Href`](./types.md#route-types) type for links.
24
24
 
25
25
  The router's `visit(destination, options?)`, `prefetch(destination, options?)`, and `flush(destination, method?)` accept [`RouteUrlInput`](./types.md#route-types): a string, `URL`, or typed destination object.
26
26
 
@@ -44,9 +44,11 @@ type LinkPrefetchStrategy = 'hover' | 'click' | 'mount' | 'visible';
44
44
  | `'visible'` | Once the link has stayed in view for 300 ms. Links scrolled quickly past are skipped |
45
45
  | `false` | Never |
46
46
 
47
- With an array such as `['visible', 'hover']`, the first strategy to happen loads the page, and later ones reuse it. `prefetch` works only on GET links, and links to other sites are never prefetched. No strategy prefetches while the browser reports data saver or a 2G connection, which only Chromium-based browsers report; calling `router.prefetch()` yourself still loads the page.
47
+ Combine strategies with an array such as `['visible', 'hover']`. The first one triggered loads the page; later triggers reuse it.
48
48
 
49
- `cacheFor` sets how long a prefetched page is reused, in milliseconds or as a duration such as `'5m'`. A pair such as `['30s', '5m']` treats the page as fresh for 30 seconds, then still shows it for up to 5 minutes while loading a fresh copy in the background.
49
+ Only same-origin GET links prefetch. `Link` skips prefetching when Chromium reports data saver or a 2G connection. Calling `router.prefetch()` explicitly still loads the page.
50
+
51
+ Set `cacheFor` in milliseconds or as a duration such as `'5m'`. To show cached data while refreshing it in the background, use a pair such as `['30s', '5m']`: the page stays fresh for 30 seconds and can be reused for up to 5 minutes.
50
52
 
51
53
  Each adapter plugin's `prefetch` option sets app-wide values:
52
54
 
@@ -103,8 +105,8 @@ Imported from `"@void/vue"`.
103
105
  | `useForm(url, defaults, options?)` | Typed reactive form helper bound to a page action URL. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
104
106
  | `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. With [`routing.typedRoutes`](../config.md#routing-typedroutes), the URL is a [`RouteUrl`](./types.md#route-types). |
105
107
  | `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an [`ActionResult`](../../guide/pages-routing/actions-and-forms.md#action-helper). |
106
- | `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
107
- | `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
108
+ | `isVoidActionError(error)` | Checks and narrows `error` to `VoidActionError`, including thrown `401`, `403`, and `500` errors. See [Handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
109
+ | `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
108
110
  | `getValidationErrors(body)` | Returns the field-error map from a failed action's `error.body`, or `null` when the body has no field errors. Use it to show validation errors from `action()`. |
109
111
  | `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
110
112
 
@@ -159,8 +161,8 @@ Imported from `"@void/react"`.
159
161
  | `useForm(url, defaults, options?)` | Form helper hook. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
160
162
  | `useIslandForm(defaults)` | Form helper hook for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. With [`routing.typedRoutes`](../config.md#routing-typedroutes), the URL is a [`RouteUrl`](./types.md#route-types). |
161
163
  | `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an [`ActionResult`](../../guide/pages-routing/actions-and-forms.md#action-helper). |
162
- | `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
163
- | `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
164
+ | `isVoidActionError(error)` | Checks and narrows `error` to `VoidActionError`, including thrown `401`, `403`, and `500` errors. See [Handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
165
+ | `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
164
166
  | `getValidationErrors(body)` | Returns the field-error map from a failed action's `error.body`, or `null` when the body has no field errors. Use it to show validation errors from `action()`. |
165
167
  | `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
166
168
  | `Deferred<T>` | React-only prop type for `defer()` results. It is `Promise<T>` and is consumed with React `use()`. |
@@ -193,7 +195,9 @@ startTransition(async () => {
193
195
  await router.visit('/account', { resolveOn: 'data' });
194
196
  ```
195
197
 
196
- With `'data'`, the promise resolves when the destination's page data is ready, allowing the Action to finish while React renders the update. The transition can remain pending through Suspense. The DOM and URL may still show the previous page after `await`; use an effect or ref callback for work that requires the updated DOM.
198
+ With `'data'`, the promise resolves when page data is ready, so the Action can finish before React commits. The transition can stay pending through Suspense.
199
+
200
+ The DOM and URL may still show the previous page after `await`. Use an effect or ref callback for work that needs the updated DOM.
197
201
 
198
202
  ## `@void/svelte` {#void-svelte}
199
203
 
@@ -239,8 +243,8 @@ Imported from `"@void/svelte"`.
239
243
  | `useForm(url, defaults, options?)` | Form helper using Svelte 5 runes. Returns `{ data, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
240
244
  | `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`, plus `submit(url, method)`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. With [`routing.typedRoutes`](../config.md#routing-typedroutes), the URL is a [`RouteUrl`](./types.md#route-types). |
241
245
  | `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an [`ActionResult`](../../guide/pages-routing/actions-and-forms.md#action-helper). |
242
- | `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
243
- | `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
246
+ | `isVoidActionError(error)` | Checks and narrows `error` to `VoidActionError`, including thrown `401`, `403`, and `500` errors. See [Handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
247
+ | `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
244
248
  | `getValidationErrors(body)` | Returns the field-error map from a failed action's `error.body`, or `null` when the body has no field errors. Use it to show validation errors from `action()`. |
245
249
  | `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
246
250
  | `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
@@ -293,8 +297,8 @@ Imported from `"@void/solid"`.
293
297
  | `useForm(url, defaults, options?)` | Form helper using Solid stores. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
294
298
  | `useIslandForm(defaults)` | Form helper for island components. Same form state as `useForm()`. `post(url)`, `put(url)`, `patch(url)`, and `delete(url)` take the action URL and submit with `fetch()`. With [`routing.typedRoutes`](../config.md#routing-typedroutes), the URL is a [`RouteUrl`](./types.md#route-types). |
295
299
  | `action(url, options?)` | Awaitable one-shot page action helper. Uses `POST` by default and accepts `{ data, method, params, preserveScroll }`, where `method` can be `"PUT"`, `"PATCH"`, or `"DELETE"`. Returns an [`ActionResult`](../../guide/pages-routing/actions-and-forms.md#action-helper). |
296
- | `isVoidActionError(error)` | Returns `true` when `error` is a `VoidActionError` at any status, such as a thrown `401`, `403`, or `500`. Narrows `error` to `VoidActionError`. See [handling thrown errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
297
- | `isCallSiteActionError(error)` | Returns `true` only for the expected `VoidActionError` statuses that `action()` returns, such as `409` or `422`. |
300
+ | `isVoidActionError(error)` | Checks and narrows `error` to `VoidActionError`, including thrown `401`, `403`, and `500` errors. See [Handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors). |
301
+ | `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
298
302
  | `getValidationErrors(body)` | Returns the field-error map from a failed action's `error.body`, or `null` when the body has no field errors. Use it to show validation errors from `action()`. |
299
303
  | `useShared()` | Returns shared data. Middleware sets it with `c.set("shared", {...})`; a loader or action can update it. See [Shared data](../../guide/pages-routing/layouts.md#shared-data). |
300
304
  | `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
@@ -333,4 +337,4 @@ See [Markdown Pages](../../guide/pages-routing/markdown.md) for setup and framew
333
337
 
334
338
  Each Pages adapter exports `Form`. Pass the object returned by `useForm()` as `form`; `method` defaults to `post`. It renders validation and action errors, preserves controlled input, and respects known quota retry deadlines without submitting automatically. `renderError` customizes action-error presentation; Svelte uses a snippet. See [Actions and Forms](../../guide/pages-routing/actions-and-forms.md).
335
339
 
336
- All four adapters accept `{ throwOnError: false }` in the third argument to `useForm()`. Authentication and server HTTP failures then populate `form.error` instead of throwing; validation failures still populate `form.errors`. React also calls `onError`. Unexpected failures still throw, and cancelled submissions do not set a form error. The default HTTP error handling is unchanged. See [handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors).
340
+ Pass `{ throwOnError: false }` as the third argument to `useForm()` to show HTTP failures inline. Validation errors populate `form.errors`; other HTTP failures populate `form.error`. React also calls `onError`. Unexpected failures still throw, and cancelled submissions don't set a form error. See [Handling action errors](../../guide/pages-routing/actions-and-forms.md#validation-errors).
@@ -110,7 +110,7 @@ await revalidate({ paths: ['/', '/blog/hello'] });
110
110
  await revalidate({ all: true });
111
111
  ```
112
112
 
113
- With [`routing.typedRoutes`](../config.md#routing-typedroutes) on, each path in `paths` must match one of your routes; otherwise `RouteUrl` is `string`. Cast a path that TypeScript can't check with `as RouteUrl`. The cast turns the check off for that path.
113
+ With [`routing.typedRoutes`](../config.md#routing-typedroutes), each path must match one of your routes. Build paths with `routeUrl()`, or use `as RouteUrl` for paths you validate at runtime. Without this setting, `RouteUrl` is `string`.
114
114
 
115
115
  **Signature:**
116
116
 
@@ -23,7 +23,9 @@ return c.rewrite({
23
23
 
24
24
  With [`routing.typedRoutes`](../config.md#routing-typedroutes), a string destination must be a [`RouteUrl`](./types.md#route-types): a URL that matches one of your routes. Cast a path built at runtime, such as ``c.rewrite(`/${locale}${path}` as RouteUrl)``.
25
25
 
26
- With [`routing.typedRoutes`](../config.md#routing-typedroutes), `c.redirect()` checks its location the same way as a link. A string must be a route URL, a same-page query or hash, or an `http://`, `https://`, `mailto:`, or `tel:` URL. An external `https://` literal needs no cast. A `URL`, a [`routeUrl()`](./types.md#routeurl-path-options) string, or a destination object is accepted. Cast a string TypeScript cannot check, such as a checkout URL from a payment provider's SDK, with `as Href`:
26
+ With [`routing.typedRoutes`](../config.md#routing-typedroutes), `c.redirect()` checks strings like a link: route URLs, same-page queries and hashes, and `http://`, `https://`, `mailto:`, or `tel:` URLs. It also accepts a `URL` or typed destination object.
27
+
28
+ For a string TypeScript can't check, such as a payment provider's checkout URL, use `as Href`:
27
29
 
28
30
  ```ts
29
31
  import { routeUrl, type Href } from 'void/routes';
@@ -36,16 +38,18 @@ return c.redirect('https://example.com/login');
36
38
  return c.redirect(checkoutUrl as Href);
37
39
  ```
38
40
 
39
- The cast turns the check off for that value, and Void does not check the location at runtime, so cast only URLs you trust. A URL from the request, such as a `?redirectTo=` parameter, can point to another site. Resolve it against the request URL and redirect only when the origin matches:
41
+ A cast skips the type check; Void doesn't validate redirect destinations at runtime. For request values such as `?redirectTo=`, check the origin before redirecting:
40
42
 
41
43
  ```ts
42
44
  const requested = new URL(c.req.query('redirectTo') ?? '/', c.req.url);
43
45
  return c.redirect(requested.origin === new URL(c.req.url).origin ? requested : '/');
44
46
  ```
45
47
 
46
- `c.redirect()` sends the location it is given. The request query is not added to an internal path, a protocol-relative URL, or an absolute URL, so `c.redirect('/notes')` from `/sign-in?redirectTo=/notes` goes to `/notes`. [`routing.redirects`](../../guide/edge/redirects.md) still merge the request query into the destination.
48
+ `c.redirect()` sends the location you provide without adding the request query. From `/sign-in?redirectTo=/notes`, `c.redirect('/notes')` goes to `/notes`. Configured [`routing.redirects`](../../guide/edge/redirects.md) merge query parameters instead.
49
+
50
+ A [named action](../../guide/pages-routing/actions-and-forms.md#named-actions) keeps its own query parameters. For example, `POST /users/42?delete&tab=profile` with `c.redirect('/users/42')` redirects to `/users/42?tab=profile`. The action key is removed when the redirect changes the method to GET.
47
51
 
48
- A [named action](../../guide/pages-routing/actions-and-forms.md#named-actions) is the exception. Redirecting it to a GET page drops the action key and keeps the page's other query parameters: `POST /users/42?delete&tab=profile` with `c.redirect('/users/42')` goes to `/users/42?tab=profile`. Redirects that preserve the request method keep the action key: `307` and `308`, or `301` and `302` after a `PUT`, `PATCH`, or `DELETE`. Only the action URL's own parameters are kept: the [current page's query](../../guide/pages-routing/actions-and-forms.md#query-parameters-after-submission) that `action()` and forms add is left out.
52
+ Redirects that preserve the method keep the action key: `307` and `308`, or `301` and `302` after `PUT`, `PATCH`, or `DELETE`. Parameters added from the [current page's query](../../guide/pages-routing/actions-and-forms.md#query-parameters-after-submission) aren't carried into the redirect.
49
53
 
50
54
  ```ts
51
55
  import { defineHandler } from 'void';
@@ -37,7 +37,7 @@ Import Void's app-facing APIs from these paths:
37
37
 
38
38
  | Import path | Contents |
39
39
  | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
40
- | `void` | `voidPlugin`, handler/type re-exports, `defer`, `Deferred`, `DeferredState`, `InferProps`, `HeadDescriptor` |
40
+ | `void` | `voidPlugin`, handler/type re-exports, `defer`, `Deferred`, `DeferredState`, `InferProps`, `HeadConfig`, `HeadDescriptor` |
41
41
  | `void/handler` | `defineHandler`, `defineMiddleware`, `basicAuth`, `defineScheduled`, `defineQueue`, `defineRender`, `defineHead`, types |
42
42
  | `void/auth` | `defineAuth`, `getUser`, `getSession`, `requireAuth`, `AuthUser`, `AuthSession`, `AuthState` |
43
43
  | `void/client` | `fetch`, `fetchStream`, `FetchError`, `auth`, `createAuthClient`, `AuthUser`, `AuthSession`, `AuthState` |
@@ -43,7 +43,9 @@ For Drizzle projects, deploy performs a read-only schema drift check. If a new m
43
43
 
44
44
  `--atomic` applies to one deployment. For an existing Durable Object Worker that consistently cannot stage, set `deploy: { cloudflare: { mode: 'atomic' } }` in `void.config.ts` so plain `void deploy` uses atomic publication. The default is `staged`.
45
45
 
46
- Use `--skip-migrations` when migrations run in a separate release step or when a preview shares an existing database. Ensure the deployed code works with that database's current schema. The flag applies only to this invocation: normal deploys still apply pending migrations. Migration files and schema validation remain required, and Cloudflare Durable Object class migrations still run as part of publishing code. A Void platform must support this option; upgrade the platform if the CLI reports that it does not.
46
+ Use `--skip-migrations` when you run migrations separately or share a database with a preview. The code must work with the database's current schema. The next deploy without this flag applies pending migrations.
47
+
48
+ Keep migration files and schema validation in place. This option skips application and authentication SQL; Durable Object class migrations still run when publishing code. If a Void platform doesn't support the flag, upgrade it first.
47
49
 
48
50
  Every deploy writes a JSONL log to `~/.void/logs/`. Failures print the log path and relevant details. Use `--debug` or `VOID_DEPLOY_DEBUG=1` to mirror it to stderr.
49
51
 
@@ -102,7 +104,7 @@ Void signs you in through your browser when needed and saves the selected accoun
102
104
  | `--require-email` | Fail instead of deploying without email when the email step cannot run, as in CI |
103
105
  | `DATABASE_URL` | Required in the deploy environment for PostgreSQL or MySQL provisioning and migrations |
104
106
 
105
- After `--skip-migrations`, native deployment history shows the applied migration state as unknown. Rollback retains its warning that database changes are not reversed.
107
+ After `--skip-migrations`, direct Cloudflare deployment history shows the applied migration state as unknown. Rolling back code doesn't reverse database changes.
106
108
 
107
109
  The token needs Workers Scripts: Edit, read access to bound resources, and edit access to products Void provisions. Commit `void.lock.json` after the first deploy before using other machines or CI.
108
110