void 1.6.2 → 1.7.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.
- package/dist/{account-cmd-D903EEWQ.mjs → account-cmd-BfkJ_1PC.mjs} +6 -6
- package/dist/{application-analysis-DlUG-XNT.mjs → application-analysis-OV0CBJ80.mjs} +8 -7
- package/dist/{application-routing-GCBSwXA9.mjs → application-routing-QpyC5G8z.mjs} +2 -1
- package/dist/{auth-CL-p_rqV.mjs → auth-BN0NU9dz.mjs} +1 -1
- package/dist/{auth-Dy8svcqQ.mjs → auth-CCk9Seol.mjs} +2 -2
- package/dist/{auth-CH4PLAX1.d.mts → auth-CZrthGxs.d.mts} +8 -1
- package/dist/{auth-YVjBX5NY.mjs → auth-DyWp-fSo.mjs} +7 -1
- package/dist/{auth-link-g9J7MSmP.mjs → auth-link-CW1Zh6FM.mjs} +6 -6
- package/dist/{auth-router-DMZbG9Qn.mjs → auth-router-CNBKnEZi.mjs} +3 -3
- package/dist/{better-auth-shared-BJyG2mH0.d.mts → better-auth-shared-C-0uZg8-.d.mts} +1 -1
- package/dist/{better-auth-shared-C958aM7W.mjs → better-auth-shared-CdVyCUou.mjs} +1 -1
- package/dist/{build-cmd-DmjbuT6d.mjs → build-cmd-C9qOKW9W.mjs} +5 -5
- package/dist/{cache-2khBO1MR.mjs → cache-DVBBbWQL.mjs} +5 -5
- package/dist/{cancel-deploy-_itbbvY3.mjs → cancel-deploy-COavnjud.mjs} +4 -4
- package/dist/{cf-build-output-B1C8U83u.mjs → cf-build-output-CWNOH-KA.mjs} +2 -1
- package/dist/cf-build-output-DUZnAeZ1.mjs +1 -0
- package/dist/{cf-config-migrate-Dy8MrKgF.mjs → cf-config-migrate-Bb-EdAQq.mjs} +5 -1
- package/dist/cli/cli.mjs +68 -1868
- package/dist/cli/cloudflare-operation-process.mjs +10 -8
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/cli-main-DFteHrJI.mjs +1889 -0
- package/dist/client-BAxLpSKv.mjs +1 -0
- package/dist/{client-CoxPEhJq.mjs → client-BEZmTP6p.mjs} +10 -4
- package/dist/{cloudflare-auth-CuS42-9A.mjs → cloudflare-auth-DGIivpTb.mjs} +1 -1
- package/dist/{cloudflare-cmd-DTF19-j-.mjs → cloudflare-cmd-DJaxC-bc.mjs} +5 -5
- package/dist/{cloudflare-config-Ce8j5S7V.mjs → cloudflare-config-DtOGAbeB.mjs} +2 -2
- package/dist/{cloudflare-connect-BN4dHp8i.mjs → cloudflare-connect-BjpWmglw.mjs} +3 -3
- package/dist/{cloudflare-operations-laxRA8HN.mjs → cloudflare-operations-CZkjFrzH.mjs} +1 -1
- package/dist/{cloudflare-operations-DrZGzQap.mjs → cloudflare-operations-k7wYUv56.mjs} +6 -6
- package/dist/{cloudflare-process-D9aC-jXr.mjs → cloudflare-process-BcPvlMFd.mjs} +2 -2
- package/dist/{config-hL-S-Y9D.mjs → config-5oSQhZNj.mjs} +3 -1
- package/dist/{config-CPxJmt4M.d.mts → config-CTlUaXWZ.d.mts} +3 -1
- package/dist/{config-CNDjO-15.mjs → config-DcqUBGCb.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-DMR0i3Z2.mjs → config-wo2EaH0X.mjs} +1 -1
- package/dist/{connect-DHepM7Xs.mjs → connect-j1F1C_rW.mjs} +7 -7
- package/dist/{create-project-Bq0M8MtO.mjs → create-project-CE3jOmd5.mjs} +5 -5
- package/dist/{create-project-BiMmR5wA.mjs → create-project-DZH3aYGQ.mjs} +1 -1
- package/dist/{db-CqfT6lhV.mjs → db-DyLzzxvM.mjs} +38 -38
- package/dist/{db-types-DRmxBJ2K.mjs → db-types-DdHHUVPy.mjs} +1 -1
- package/dist/{delete-CY4L8fi2.mjs → delete-Dey6YoMA.mjs} +5 -5
- package/dist/{deploy-La_Ly8g_.mjs → deploy-Ccw2D2lw.mjs} +491 -109
- package/dist/deploy-DEZkUS77.mjs +2 -0
- package/dist/{deploy-managed-static-CESLfKHN.mjs → deploy-managed-static-BBVtpuGv.mjs} +16 -16
- package/dist/{deploy-transport-DcI6LXhY.mjs → deploy-transport-Dt0IvSVW.mjs} +2 -2
- package/dist/deploy.mjs +8 -8
- package/dist/{dispatch-DM4Xdd2l.mjs → dispatch-pYaww76u.mjs} +4 -4
- package/dist/{dist-D23AAMxT.mjs → dist-BQdgCVQF.mjs} +1 -1
- package/dist/{dist-eV_Ep60B.mjs → dist-DeTdhbZc.mjs} +1 -1
- package/dist/{domain-BD1KOQL3.mjs → domain-Dh3mG8Vs.mjs} +6 -6
- package/dist/{email-XAspopcj.mjs → email-DKyMjOYM.mjs} +10 -10
- package/dist/{email-cloudflare-RxIQoPc9.mjs → email-cloudflare-CTt2n_W2.mjs} +13 -9
- package/dist/{env-DrYUh55t.mjs → env-DkZzh_Dd.mjs} +7 -7
- package/dist/env-mask-D31Qztl9.mjs +46 -0
- package/dist/{env-validation-Del3C8AY.mjs → env-validation-1snjKtDX.mjs} +4 -4
- package/dist/{env-validation-Bosj7EVg.mjs → env-validation-C8NL3lEH.mjs} +1 -1
- package/dist/{fetch-C8yhLoF3.mjs → fetch-CAIVkLvW.mjs} +1 -1
- package/dist/{fetch-B-gLGYVl.d.mts → fetch-CbI6lNnk.d.mts} +6 -4
- package/dist/{fetch-stream-DafNtVJC.mjs → fetch-stream-6Op0qlLd.mjs} +1 -1
- package/dist/{fetch-stream-DuwxWmBM.d.mts → fetch-stream-DoED9atq.d.mts} +1 -1
- package/dist/{gen-DSkScMIz.mjs → gen-BZmFOGDQ.mjs} +7 -7
- package/dist/gen-C6iknRdI.mjs +1 -0
- package/dist/{github-cmd-CA-lBdkn.mjs → github-cmd-7Oky9qgH.mjs} +6 -6
- package/dist/{handler-DnI_au0K.mjs → handler-C9SnmeW1.mjs} +5 -4
- package/dist/{handler-BR6Tvjkp.d.mts → handler-DjqciiDc.d.mts} +20 -7
- package/dist/{headers--cbz6iZ8.mjs → headers-CimYIfQI.mjs} +1 -1
- package/dist/{help-1OCFDsRr.mjs → help-CNuUb47C.mjs} +7 -3
- package/dist/help-C_cqTByy.mjs +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +154 -109
- package/dist/{info-BpxpsX0B.mjs → info-DwB8IWIx.mjs} +4 -4
- package/dist/{init-DpVXO5S-.mjs → init-CUGSmcED.mjs} +33 -31
- package/dist/{link-DAXOT-G_.mjs → link-BlRTGHan.mjs} +6 -6
- package/dist/{list-BFQ0gcML.mjs → list-iCg7d5Pa.mjs} +7 -7
- package/dist/{live-DF4HUl2m.mjs → live-CYJ4KGoR.mjs} +2 -2
- package/dist/{live-0xrcVpyq.d.mts → live-zKGbRT4h.d.mts} +2 -2
- package/dist/{local-d1-CLVPP6v7.mjs → local-d1-CFcH9Bx3.mjs} +2 -2
- package/dist/login-C4q1S-5b.mjs +1 -0
- package/dist/{login-RIw7ffPe.mjs → login-TA51e5Fw.mjs} +5 -5
- package/dist/{logs-B2OeLS4X.mjs → logs-BlyAxlvx.mjs} +6 -6
- package/dist/{migrate-DiI50Chz.mjs → migrate-BH6LCr00.mjs} +5 -5
- package/dist/migrate-CVBsSFhC.mjs +1 -0
- package/dist/nitro.d.mts +5 -0
- package/dist/nitro.mjs +27 -8
- package/dist/{node-Bc-dBAGL.mjs → node-B0otYjDv.mjs} +4 -4
- package/dist/{operator-args-D79WQP70.mjs → operator-args-DuKAQ3Ks.mjs} +1 -1
- package/dist/{operator-auth-CfDcmzpo.mjs → operator-auth-CD3pap65.mjs} +1 -1
- package/dist/{operator-client-BIY4-N_6.mjs → operator-client-XvXTkea6.mjs} +2 -2
- package/dist/{operator-cmd-CEI5Aaza.mjs → operator-cmd-CoHlJjcT.mjs} +7 -7
- package/dist/operator-cmd-DnaCnCSP.mjs +1 -0
- package/dist/output-CNsMDEd2.mjs +1 -0
- package/dist/{output-BCdLioKP.mjs → output-CXJTIAtF.mjs} +1 -1
- package/dist/pages/client.d.mts +16 -13
- package/dist/pages/client.mjs +34 -66
- package/dist/pages/index.d.mts +4 -3
- package/dist/pages/index.mjs +6 -6
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/pages/serialize.d.mts +2 -2
- package/dist/pages/serialize.mjs +1 -1
- package/dist/platform-args-B7-wQ0_B.mjs +1 -0
- package/dist/{platform-args-Cx1M-7bq.mjs → platform-args-DfT8yQBF.mjs} +1 -1
- package/dist/{platform-auth-config-ZrYm8KVs.mjs → platform-auth-config-MO0VdVs9.mjs} +10 -10
- package/dist/{platform-auth-protection-t6mdY4nn.mjs → platform-auth-protection-Dv208eyL.mjs} +8 -8
- package/dist/{platform-auth-recovery-XeBmPTXx.mjs → platform-auth-recovery-DvAQ674F.mjs} +7 -7
- package/dist/{platform-cmd-C7BevP9b.mjs → platform-cmd-BpUA19r_.mjs} +1 -1
- package/dist/{platform-cmd-EXehmSYA.mjs → platform-cmd-dlSxrcQ7.mjs} +9 -9
- package/dist/{platform-domain-DR263ObA.mjs → platform-domain-DSO4eUEw.mjs} +5 -5
- package/dist/{platform-lifecycle-BvU_TNji.mjs → platform-lifecycle-BSvsyB_x.mjs} +17 -17
- package/dist/{platform-lifecycle-CN4aXldN.mjs → platform-lifecycle-CfcFygHb.mjs} +1 -1
- package/dist/{platform-management-yS2sve3V.mjs → platform-management-BMdyt667.mjs} +1 -1
- package/dist/{platform-management-_UE1_GM8.mjs → platform-management-CrP1XhVd.mjs} +4 -4
- package/dist/{platform-plans-config-Dx1agneU.mjs → platform-plans-config-CgDiwflR.mjs} +5 -5
- package/dist/{platform-recovery-CPVk9-Q4.mjs → platform-recovery-CHWwXVZ6.mjs} +3 -3
- package/dist/{platform-setup-Vw1AaUN8.mjs → platform-setup-BTQVbnTC.mjs} +3 -3
- package/dist/{plugin-inference-bQ1Be840.mjs → plugin-inference-g66Q1Mx9.mjs} +4 -4
- package/dist/prepare-Bx4a8cb1.mjs +1 -0
- package/dist/{prepare-BkRhDnxw.mjs → prepare-DJYHjpzq.mjs} +3 -3
- package/dist/{prepare-D8L9AQbw.mjs → prepare-DXduEwQp.mjs} +11 -8
- package/dist/{prerender-render-RlAj6hh8.mjs → prerender-render-BN9Lmebs.mjs} +29 -13
- package/dist/prerender-render.d.mts +10 -2
- package/dist/prerender-render.mjs +1 -1
- package/dist/{project-cmd-DH3CuFC6.mjs → project-cmd-Dfb1Sg8w.mjs} +18 -18
- package/dist/{project-team-MjT5K4rQ.mjs → project-team-BO2dyc7S.mjs} +5 -5
- package/dist/{project-token-BKHGwY3k.mjs → project-token-ByO2mEI2.mjs} +5 -5
- package/dist/{project-tsconfig-BMveFb4b.mjs → project-tsconfig-nhnTWO_Y.mjs} +3 -1
- package/dist/{project-zero-trust-Bzdd05-h.mjs → project-zero-trust-CoQfwRBR.mjs} +5 -5
- package/dist/{protocol-CkwjASep.d.mts → protocol-xZMvWsrg.d.mts} +5 -3
- package/dist/{protocol-COyySMki.mjs → protocol-yxdHxFLN.mjs} +47 -11
- package/dist/{provision-CYhZR_Mn.mjs → provision-CMH4-8ri.mjs} +1 -1
- package/dist/{provision-B0HqoRuI.mjs → provision-D5q-ptD3.mjs} +2 -2
- package/dist/{requests-daJmVpjk.mjs → requests-CPOiDkjh.mjs} +4 -4
- package/dist/resolve-project-BALVa9q0.mjs +1 -0
- package/dist/{resolve-project-D0YNnJfm.mjs → resolve-project-ClvLMTI9.mjs} +1 -1
- package/dist/{rollback-AVwiMAkk.mjs → rollback-BfCs2la4.mjs} +7 -7
- package/dist/{route-types-e69EqY88.mjs → route-types-Cl3x0Q8B.mjs} +265 -12
- package/dist/{route-url-C_YIH_zO.d.mts → route-url-C3JwYrER.d.mts} +8 -3
- package/dist/{route-url-CRDF-I0I.mjs → route-url-CfCR4oMj.mjs} +4 -3
- package/dist/routes-stub.d.mts +10 -1
- package/dist/routes-stub.mjs +1 -1
- package/dist/{runner-QMeOpScZ.mjs → runner-CTk21HrO.mjs} +1 -1
- package/dist/{runner-mysql-0zVmB1JW.mjs → runner-mysql-CHvEg_sy.mjs} +1 -1
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth.d.mts +2 -2
- package/dist/runtime/auth.mjs +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/email/testing.mjs +2 -2
- package/dist/runtime/email.mjs +3 -3
- package/dist/runtime/env-public.mjs +2 -46
- package/dist/runtime/fetch-server.d.mts +1 -1
- package/dist/runtime/fetch-server.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +2 -2
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.d.mts +3 -1
- package/dist/runtime/live-client.d.mts +11 -2
- package/dist/runtime/live-client.mjs +8 -0
- package/dist/runtime/live-server.mjs +1 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/log.mjs +1 -1
- package/dist/runtime/remote/index.mjs +1 -1
- package/dist/runtime/route-url.d.mts +2 -2
- package/dist/runtime/route-url.mjs +1 -1
- package/dist/runtime/routing.d.mts +15 -4
- package/dist/runtime/routing.mjs +93 -11
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/sse-client.d.mts +9 -1
- package/dist/runtime/sse-client.mjs +7 -0
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -1
- package/dist/runtime/ws-server.d.mts +3 -3
- package/dist/runtime/ws-server.mjs +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/runtime/ws.mjs +1 -1
- package/dist/{scan-F0psanp7.mjs → scan-L8OSv1f7.mjs} +10 -7
- package/dist/{secret-szNdoeKa.mjs → secret-CuI6LTpD.mjs} +7 -7
- package/dist/serialize-DN-envGQ.d.mts +18 -0
- package/dist/serialize-Pf-CIQK_.mjs +39 -0
- package/dist/{skills-D393E4lB.mjs → skills-BBO9wMjB.mjs} +1 -1
- package/dist/{subcommand-prompt-CxJXporl.mjs → subcommand-prompt-BZMnCA8T.mjs} +2 -2
- package/dist/url-CuoEn0o3.mjs +43 -0
- package/dist/validator-8-NZs2Xr.mjs +168 -0
- package/dist/{version-metadata-BC3LK7Y-.mjs → version-metadata-eUd6Ar_U.mjs} +1 -1
- package/dist/wrangler-R3kMdJfw.mjs +1 -0
- package/dist/{wrangler-Gn4EoY4-.mjs → wrangler-k40T7XTQ.mjs} +2 -2
- package/dist/{wrapper-B9W9RE8z.mjs → wrapper-BGsi_uHs.mjs} +11 -8
- package/dist/{ws-Dmjg5NH2.d.mts → ws-DB8Feytg.d.mts} +2 -2
- package/docs/guide/ai.md +2 -0
- package/docs/guide/auth.md +62 -0
- package/docs/guide/database.md +33 -0
- package/docs/guide/deployment.md +8 -0
- package/docs/guide/edge/prerendering.md +9 -4
- package/docs/guide/edge/revalidation.md +3 -0
- package/docs/guide/live.md +2 -0
- package/docs/guide/pages-routing/actions-and-forms.md +15 -10
- package/docs/guide/pages-routing/head.md +3 -1
- package/docs/guide/pages-routing/islands.md +1 -1
- package/docs/guide/pages-routing/loaders.md +2 -0
- package/docs/guide/pages-routing/markdown.md +2 -2
- package/docs/guide/pages-routing/overview.md +139 -10
- package/docs/guide/quickstart.md +1 -0
- package/docs/guide/sse.md +2 -0
- package/docs/guide/ssg.md +23 -2
- package/docs/guide/storage.md +6 -2
- package/docs/guide/type-safety.md +307 -26
- package/docs/guide/typed-fetch.md +7 -3
- package/docs/guide/websockets.md +5 -5
- package/docs/integrations/cloudflare.md +10 -10
- package/docs/integrations/frameworks/nuxt.md +2 -0
- package/docs/integrations/frameworks/overview.md +2 -0
- package/docs/integrations/nodejs-bun-deno.md +65 -0
- package/docs/reference/api/auth.md +19 -0
- package/docs/reference/api/client.md +6 -4
- package/docs/reference/api/handlers.md +3 -1
- package/docs/reference/api/pages.md +8 -8
- package/docs/reference/api/resources.md +3 -1
- package/docs/reference/api/rewrites.md +16 -4
- package/docs/reference/api/types.md +9 -2
- package/docs/reference/cli/database.md +2 -0
- package/docs/reference/cli/deploy.md +17 -11
- package/docs/reference/cli.md +3 -0
- package/docs/reference/config.md +24 -2
- package/package.json +25 -23
- package/schema.json +4 -0
- package/skills/void/SKILL.md +5 -0
- package/dist/cf-build-output-CmDOcA7K.mjs +0 -1
- package/dist/client-CEtr5UOR.mjs +0 -1
- package/dist/deploy-DMhOyebt.mjs +0 -2
- package/dist/gen-BbT1Ku1P.mjs +0 -1
- package/dist/help-Ba8Dq5-r.mjs +0 -1
- package/dist/login-BX2gzHUt.mjs +0 -1
- package/dist/migrate-CUGMGaIM.mjs +0 -1
- package/dist/operator-cmd-oTT2MA9G.mjs +0 -1
- package/dist/output-E6gecbbV.mjs +0 -1
- package/dist/platform-args-C7XUw9mw.mjs +0 -1
- package/dist/prepare-CZRVGNld.mjs +0 -1
- package/dist/resolve-project-CgfjtOwz.mjs +0 -1
- package/dist/serialize-DUuYuaY3.mjs +0 -29
- package/dist/serialize-I4EmS-Wf.d.mts +0 -16
- package/dist/validator-CTfmzZYb.mjs +0 -69
- package/dist/wrangler-CQ5c-MtJ.mjs +0 -1
- package/dist/{cf-access-BmBT2h8_.mjs → cf-access-Dnyw8KFY.mjs} +1 -1
- package/dist/{config-s6TkpSat.mjs → config-eeDzKBS9.mjs} +1 -1
- package/dist/{entry-DFBca6aS.mjs → entry-Bw-G1VVx.mjs} +1 -1
- package/dist/{env-types-Bd8DkQhl.mjs → env-types-Dz9qkiOn.mjs} +1 -1
- package/dist/{inbound-CdO-qY0w.mjs → inbound-C2H6Dzz1.mjs} +2 -2
- package/dist/{runner-5MCSimKx.mjs → runner-CMZb7jNU.mjs} +1 -1
- package/dist/{runner-mysql-Bdmsp_x4.mjs → runner-mysql-BXfcQQj3.mjs} +1 -1
|
@@ -24,10 +24,10 @@ export const action = defineHandler.withValidator({
|
|
|
24
24
|
});
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
| Action returns
|
|
28
|
-
|
|
|
29
|
-
| Nothing (void)
|
|
30
|
-
| `c.redirect(
|
|
27
|
+
| Action returns | Behavior |
|
|
28
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| Nothing (void) | Re-runs the loader, page re-renders with fresh props. |
|
|
30
|
+
| `c.redirect(url)` | Navigates to another page. With [`routing.typedRoutes`](../type-safety.md#checked-url-strings), the location is checked the same way as a link. Cast a string TypeScript cannot check with `as Href`. |
|
|
31
31
|
|
|
32
32
|
Middleware does not run again after the action. To change [shared data](./layouts.md#shared-data), update it in the action or redirect.
|
|
33
33
|
|
|
@@ -173,7 +173,7 @@ For dynamic routes, pass `params` in the options:
|
|
|
173
173
|
|
|
174
174
|
```ts
|
|
175
175
|
// pages/users/[id].server.ts has an action
|
|
176
|
-
const form = useForm('/users
|
|
176
|
+
const form = useForm('/users/[id]', { name: '' }, { params: { id: '42' } });
|
|
177
177
|
<Form form={form} method="put">{/* submits to /users/42 */}</Form>
|
|
178
178
|
```
|
|
179
179
|
|
|
@@ -209,7 +209,7 @@ Actions and forms keep the current scroll position when updating the page in pla
|
|
|
209
209
|
Pass `preserveScroll: false` to reset scroll after an in-place update, or `true` to keep it even after a redirect:
|
|
210
210
|
|
|
211
211
|
```ts
|
|
212
|
-
await action('/users
|
|
212
|
+
await action('/users/[id]?update', {
|
|
213
213
|
params: { id: '42' },
|
|
214
214
|
data: { name: 'Alice' },
|
|
215
215
|
preserveScroll: false,
|
|
@@ -227,19 +227,22 @@ When a page needs multiple mutations, such as updating and deleting a user on th
|
|
|
227
227
|
import { users, updateUserSchema } from '@schema';
|
|
228
228
|
import { defineHandler } from 'void';
|
|
229
229
|
import { db, eq } from 'void/db';
|
|
230
|
+
import type { PageParams } from 'void/routes';
|
|
230
231
|
|
|
231
232
|
export const actions = {
|
|
232
233
|
update: defineHandler.withValidator({
|
|
233
234
|
body: updateUserSchema,
|
|
234
235
|
})(async (c, { body }) => {
|
|
236
|
+
const { id } = c.req.param() as PageParams<'/users/[id]'>;
|
|
235
237
|
await db
|
|
236
238
|
.update(users)
|
|
237
239
|
.set(body)
|
|
238
|
-
.where(eq(users.id, Number(
|
|
240
|
+
.where(eq(users.id, Number(id)));
|
|
239
241
|
}),
|
|
240
242
|
|
|
241
243
|
delete: defineHandler(async (c) => {
|
|
242
|
-
|
|
244
|
+
const { id } = c.req.param() as PageParams<'/users/[id]'>;
|
|
245
|
+
await db.delete(users).where(eq(users.id, Number(id)));
|
|
243
246
|
}),
|
|
244
247
|
};
|
|
245
248
|
```
|
|
@@ -266,7 +269,7 @@ export const actions = {
|
|
|
266
269
|
When a page exports named actions, append `?actionName` to the URL:
|
|
267
270
|
|
|
268
271
|
```ts
|
|
269
|
-
const form = useForm('/users
|
|
272
|
+
const form = useForm('/users/[id]?update', { name: '' }, { params: { id } });
|
|
270
273
|
<Form form={form} method="put">{/* submits to /users/42?update */}</Form>
|
|
271
274
|
```
|
|
272
275
|
|
|
@@ -279,7 +282,7 @@ Use `action()` for a button or other mutation that does not need form state. It
|
|
|
279
282
|
```ts
|
|
280
283
|
import { action } from '@void/react'; // or "@void/vue", "@void/svelte", "@void/solid"
|
|
281
284
|
|
|
282
|
-
const result = await action('/users
|
|
285
|
+
const result = await action('/users/[id]?delete', {
|
|
283
286
|
params: { id: '42' },
|
|
284
287
|
method: 'DELETE',
|
|
285
288
|
});
|
|
@@ -440,6 +443,8 @@ export const action = defineHandler(async (c) => {
|
|
|
440
443
|
});
|
|
441
444
|
```
|
|
442
445
|
|
|
446
|
+
`withValidator({ body })` accepts the same upload. Nested names such as `profile[name]`, `tags[0]`, and `tags[]` are objects and arrays again. A multipart schema has to coerce the rest: booleans arrive as `'1'` or `'0'`, numbers and dates as strings, and `null` as `''`.
|
|
447
|
+
|
|
443
448
|
Pick the storage key on the server and allow only the file types you expect. See [Serving Files](../storage.md#serving-files) to send them back safely.
|
|
444
449
|
|
|
445
450
|
## Choosing a Primitive
|
|
@@ -13,13 +13,15 @@ Export a `head()` function from your `.server.ts` file. It receives the Hono con
|
|
|
13
13
|
```ts
|
|
14
14
|
// pages/posts/[slug].server.ts
|
|
15
15
|
import { defineHandler, defineHead } from 'void';
|
|
16
|
+
import type { PageParams } from 'void/routes';
|
|
16
17
|
|
|
17
18
|
export interface Props {
|
|
18
19
|
post: { title: string; excerpt: string; slug: string };
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const loader = defineHandler<Props>(async (c) => {
|
|
22
|
-
const
|
|
23
|
+
const { slug } = c.req.param() as PageParams<'/posts/[slug]'>;
|
|
24
|
+
const post = await getPost(slug);
|
|
23
25
|
return { post };
|
|
24
26
|
});
|
|
25
27
|
|
|
@@ -344,7 +344,7 @@ export default function PostForm() {
|
|
|
344
344
|
|
|
345
345
|
:::
|
|
346
346
|
|
|
347
|
-
`useIslandForm` provides the same form state as [`useForm`](./actions-and-forms#useform). Pass the action URL to `post`, `put`, `patch`, or `delete` to submit.
|
|
347
|
+
`useIslandForm` provides the same form state as [`useForm`](./actions-and-forms#useform). Pass the action URL to `post`, `put`, `patch`, or `delete` to submit. With [`routing.typedRoutes`](../type-safety.md#checked-url-strings), that URL is a [`RouteUrl`](../../reference/api/types.md#route-types). Cast a path built at runtime with `as RouteUrl`.
|
|
348
348
|
|
|
349
349
|
Successful submissions reload the page; redirects navigate to their destination. A `422` response populates `errors` from `{ errors: { field: "message" } }`. Submit helpers return `Promise<void>`.
|
|
350
350
|
|
|
@@ -26,6 +26,8 @@ export const loader = defineHandler(async (c) => {
|
|
|
26
26
|
|
|
27
27
|
`InferProps` infers the loader’s return type, so page props stay in sync with the data it returns.
|
|
28
28
|
|
|
29
|
+
Void preserves `Date`, `Map`, `Set`, `bigint`, `RegExp`, `URL`, `undefined`, and repeated or cyclic references in page props and shared data. These values keep their types during server rendering, hydration, navigation, and deferred loading. Return data directly from your loader; explicitly returning `Response.json()` uses ordinary JSON conversion instead. Functions and custom class instances cannot be sent as page data.
|
|
30
|
+
|
|
29
31
|
## Using the Data in Page Components
|
|
30
32
|
|
|
31
33
|
The page component receives the loader's result as props. Export the inferred type from the server file so the component stays in sync:
|
|
@@ -136,13 +136,13 @@ Welcome to Void. Here's an interactive demo:
|
|
|
136
136
|
<Counter />
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
- **`<script>` block:** extracted before markdown compilation. Island imports use `with { island: "..." }` syntax (see [islands](./islands)). Any other code in the block becomes a [client script](#client-scripts) that runs in the browser.
|
|
139
|
+
- **`<script>` block:** extracted before markdown compilation. Island imports use `with { island: "..." }` syntax (see [islands](./islands)). The component file uses your framework's extension (`.vue`, `.tsx`, or `.svelte`). Any other code in the block becomes a [client script](#client-scripts) that runs in the browser.
|
|
140
140
|
- **Frontmatter:** YAML metadata between `---` fences. Layouts and islands can read it through [`useFrontmatter()`](#frontmatter-access).
|
|
141
141
|
- **Body:** standard markdown plus GFM. Uppercase tags such as `<Counter />` reference imported components and render as islands.
|
|
142
142
|
|
|
143
143
|
## Client Scripts
|
|
144
144
|
|
|
145
|
-
Use the `<script>` block for island imports and JavaScript that runs when the page loads:
|
|
145
|
+
Use the `<script>` block for island imports and JavaScript that runs when the page loads. Import the component with your framework's extension (`.vue`, `.tsx`, or `.svelte`):
|
|
146
146
|
|
|
147
147
|
```md
|
|
148
148
|
<script>
|
|
@@ -164,7 +164,7 @@ import { Link } from "@void/react";
|
|
|
164
164
|
import { routeUrl } from 'void/routes';
|
|
165
165
|
|
|
166
166
|
<Link href="/users">Users</Link>
|
|
167
|
-
<Link href={routeUrl('/users
|
|
167
|
+
<Link href={routeUrl('/users/[id]', { params: { id } })}>View</Link>
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
```vue [Vue]
|
|
@@ -175,7 +175,7 @@ import { routeUrl } from 'void/routes';
|
|
|
175
175
|
|
|
176
176
|
<template>
|
|
177
177
|
<Link href="/users">Users</Link>
|
|
178
|
-
<Link :href="routeUrl('/users
|
|
178
|
+
<Link :href="routeUrl('/users/[id]', { params: { id } })">View</Link>
|
|
179
179
|
</template>
|
|
180
180
|
```
|
|
181
181
|
|
|
@@ -186,7 +186,7 @@ import { routeUrl } from 'void/routes';
|
|
|
186
186
|
</script>
|
|
187
187
|
|
|
188
188
|
<Link href="/users">Users</Link>
|
|
189
|
-
<Link href={routeUrl('/users
|
|
189
|
+
<Link href={routeUrl('/users/[id]', { params: { id } })}>View</Link>
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
```tsx [Solid]
|
|
@@ -194,7 +194,7 @@ import { Link } from "@void/solid";
|
|
|
194
194
|
import { routeUrl } from 'void/routes';
|
|
195
195
|
|
|
196
196
|
<Link href="/users">Users</Link>
|
|
197
|
-
<Link href={routeUrl('/users
|
|
197
|
+
<Link href={routeUrl('/users/[id]', { params: { id } })}>View</Link>
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
:::
|
|
@@ -203,7 +203,80 @@ With [`routing.typedRoutes`](../type-safety.md#checked-url-strings), which apps
|
|
|
203
203
|
|
|
204
204
|
`Link` also supports query data, history replacement, full-page navigation, and cancellation:
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
::: code-group
|
|
207
|
+
|
|
208
|
+
```tsx [React]
|
|
209
|
+
import { Link } from '@void/react';
|
|
210
|
+
|
|
211
|
+
<Link href="/users" data={{ page: 2, tag: ['active', 'new'] }}>
|
|
212
|
+
Filtered users
|
|
213
|
+
</Link>
|
|
214
|
+
|
|
215
|
+
<Link href="/users" replace>
|
|
216
|
+
Users
|
|
217
|
+
</Link>
|
|
218
|
+
|
|
219
|
+
<Link href="/logout" reloadDocument>
|
|
220
|
+
Sign out
|
|
221
|
+
</Link>
|
|
222
|
+
|
|
223
|
+
<Link
|
|
224
|
+
href="/settings"
|
|
225
|
+
onNavigate={(event) => {
|
|
226
|
+
if (!confirm('Leave this page?')) {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
}
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
Settings
|
|
232
|
+
</Link>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
```vue [Vue]
|
|
236
|
+
<script setup lang="ts">
|
|
237
|
+
import { Link } from '@void/vue';
|
|
238
|
+
|
|
239
|
+
function onNavigate(event: { preventDefault(): void }) {
|
|
240
|
+
if (!confirm('Leave this page?')) {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
</script>
|
|
245
|
+
|
|
246
|
+
<template>
|
|
247
|
+
<Link href="/users" :data="{ page: 2, tag: ['active', 'new'] }">Filtered users</Link>
|
|
248
|
+
<Link href="/users" replace>Users</Link>
|
|
249
|
+
<Link href="/logout" reload-document>Sign out</Link>
|
|
250
|
+
<Link href="/settings" :on-navigate="onNavigate">Settings</Link>
|
|
251
|
+
</template>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```svelte [Svelte]
|
|
255
|
+
<script lang="ts">
|
|
256
|
+
import { Link } from '@void/svelte';
|
|
257
|
+
</script>
|
|
258
|
+
|
|
259
|
+
<Link href="/users" data={{ page: 2, tag: ['active', 'new'] }}>Filtered users</Link>
|
|
260
|
+
|
|
261
|
+
<Link href="/users" replace>Users</Link>
|
|
262
|
+
|
|
263
|
+
<Link href="/logout" reloadDocument>Sign out</Link>
|
|
264
|
+
|
|
265
|
+
<Link
|
|
266
|
+
href="/settings"
|
|
267
|
+
onNavigate={(event) => {
|
|
268
|
+
if (!confirm('Leave this page?')) {
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
}
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
Settings
|
|
274
|
+
</Link>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```tsx [Solid]
|
|
278
|
+
import { Link } from '@void/solid';
|
|
279
|
+
|
|
207
280
|
<Link href="/users" data={{ page: 2, tag: ['active', 'new'] }}>
|
|
208
281
|
Filtered users
|
|
209
282
|
</Link>
|
|
@@ -228,8 +301,12 @@ With [`routing.typedRoutes`](../type-safety.md#checked-url-strings), which apps
|
|
|
228
301
|
</Link>
|
|
229
302
|
```
|
|
230
303
|
|
|
304
|
+
:::
|
|
305
|
+
|
|
231
306
|
`prefetch` and `reloadDocument` work only with GET links. GET `data` becomes query parameters; use scalar values or arrays.
|
|
232
307
|
|
|
308
|
+
If a deployment changes Void's page-data format, already-open tabs reload on their next page navigation to load the matching client.
|
|
309
|
+
|
|
233
310
|
For programmatic navigation, use `useRouter()`. Pass a typed destination object to `visit()`, `prefetch()`, or `flush()`:
|
|
234
311
|
|
|
235
312
|
```ts
|
|
@@ -238,7 +315,7 @@ import type { RouteDestination } from 'void/routes';
|
|
|
238
315
|
|
|
239
316
|
const router = useRouter();
|
|
240
317
|
const profile = {
|
|
241
|
-
pathname: '/users
|
|
318
|
+
pathname: '/users/[id]',
|
|
242
319
|
params: { id: 42 },
|
|
243
320
|
query: { tab: 'activity' },
|
|
244
321
|
} satisfies RouteDestination;
|
|
@@ -254,17 +331,58 @@ You can also pass URL strings or `URL` instances to these router methods. See [T
|
|
|
254
331
|
|
|
255
332
|
`router.visit()` updates the page in place for same-origin URLs. `http(s)` URLs on another origin get a full page load, and other schemes such as `javascript:` are rejected.
|
|
256
333
|
|
|
257
|
-
For dynamic route params, use `useParams()` from the same adapter package:
|
|
334
|
+
For dynamic route params, use `useParams()` from the same adapter package. Pass the page's URL pattern as the type argument to type the result:
|
|
258
335
|
|
|
259
|
-
|
|
336
|
+
::: code-group
|
|
337
|
+
|
|
338
|
+
```tsx [React]
|
|
339
|
+
// pages/posts/[id].tsx
|
|
260
340
|
import { useParams } from '@void/react';
|
|
261
341
|
|
|
262
342
|
export default function PostPage() {
|
|
263
|
-
const { id } = useParams<{ id: string }
|
|
343
|
+
const { id } = useParams<'/posts/[id]'>(); // { id: string }
|
|
264
344
|
return <h1>Post {id}</h1>;
|
|
265
345
|
}
|
|
266
346
|
```
|
|
267
347
|
|
|
348
|
+
```vue [Vue]
|
|
349
|
+
<!-- pages/posts/[id].vue -->
|
|
350
|
+
<script setup lang="ts">
|
|
351
|
+
import { useParams } from '@void/vue';
|
|
352
|
+
|
|
353
|
+
const params = useParams<'/posts/[id]'>(); // { id: string }
|
|
354
|
+
</script>
|
|
355
|
+
|
|
356
|
+
<template>
|
|
357
|
+
<h1>Post {{ params.id }}</h1>
|
|
358
|
+
</template>
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
```svelte [Svelte]
|
|
362
|
+
<!-- pages/posts/[id].svelte -->
|
|
363
|
+
<script lang="ts">
|
|
364
|
+
import { useParams } from '@void/svelte';
|
|
365
|
+
|
|
366
|
+
const params = useParams<'/posts/[id]'>(); // { id: string }
|
|
367
|
+
</script>
|
|
368
|
+
|
|
369
|
+
<h1>Post {params.id}</h1>
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
```tsx [Solid]
|
|
373
|
+
// pages/posts/[id].tsx
|
|
374
|
+
import { useParams } from '@void/solid';
|
|
375
|
+
|
|
376
|
+
export default function PostPage() {
|
|
377
|
+
const params = useParams<'/posts/[id]'>(); // { id: string }
|
|
378
|
+
return <h1>Post {params.id}</h1>;
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
:::
|
|
383
|
+
|
|
384
|
+
See [Page params](../type-safety.md#page-params) for how patterns are checked.
|
|
385
|
+
|
|
268
386
|
### Active links
|
|
269
387
|
|
|
270
388
|
`Link` marks the link to the current page with `aria-current="page"` and `data-void-active`. Use them to style navigation:
|
|
@@ -322,7 +440,18 @@ A link is active only on its own path by default. Set `activeMatch="prefix"` to
|
|
|
322
440
|
|
|
323
441
|
`aria-current="page"` marks only the exact page, so select `[aria-current="page"]` to style it differently from its section. A link to `/` is active only on the home page.
|
|
324
442
|
|
|
325
|
-
|
|
443
|
+
A link without a query ignores the current query, as `/users?page=2` shows above. A link with a query is active only when the current URL has each of its params with the same value. The current URL can have other params, in any order, and a GET link's `data` counts as part of its query. Pagination links to other pages are not marked, while a filter tab stays active as you page through it:
|
|
444
|
+
|
|
445
|
+
| Current URL | Link | Active |
|
|
446
|
+
| ---------------------------- | ------------------------------ | --------------- |
|
|
447
|
+
| `/posts?page=2` | `href="/posts?page=1"` | none |
|
|
448
|
+
| `/posts?page=2` | `href="/posts?page=2"` | both attributes |
|
|
449
|
+
| `/issues?status=open&page=2` | `href="/issues?status=open"` | both attributes |
|
|
450
|
+
| `/issues?status=open` | `href="/issues?status=closed"` | none |
|
|
451
|
+
|
|
452
|
+
On nested pages, `activeMatch="prefix"` compares only the path, so `href="/reports?range=30d"` has `data-void-active` on `/reports/42`.
|
|
453
|
+
|
|
454
|
+
Paths match the way pages are routed: letter case and trailing slashes count. The hash is ignored. Links to other origins and non-GET links are never active. An `aria-current` or `data-void-active` you pass to `Link` replaces the computed value. Pass them yourself on a link that stands for a default value, such as an "All" tab at `/issues`, or a `?page=1` link when page 1 is `/posts`.
|
|
326
455
|
|
|
327
456
|
### Pending links
|
|
328
457
|
|
package/docs/guide/quickstart.md
CHANGED
package/docs/guide/sse.md
CHANGED
|
@@ -141,6 +141,8 @@ stream.close();
|
|
|
141
141
|
|
|
142
142
|
The client wraps native `EventSource`. It supports cookie credentials and typed event handlers, but it does not support request bodies or arbitrary headers. Use cookie auth, signed URLs, or a fetch-based streaming route when you need custom headers.
|
|
143
143
|
|
|
144
|
+
With [`routing.typedRoutes`](../reference/config.md#routing-typedroutes), the URL must match one of your routes, such as `` `/api/jobs/${id}` ``, or be an `http://` or `https://` URL. Cast a `string` that TypeScript can't check with `as RouteUrl` from `void/routes`. The cast turns off the check for that URL.
|
|
145
|
+
|
|
144
146
|
JSON parsing is the default. Set `parse: 'text'` or pass a custom parser for non-JSON payloads:
|
|
145
147
|
|
|
146
148
|
```ts
|
package/docs/guide/ssg.md
CHANGED
|
@@ -19,6 +19,23 @@ When `output` is `"static"`:
|
|
|
19
19
|
- Dynamic pages without `getPrerenderPaths()` are implicitly not prerendered (the paths aren't known at build time).
|
|
20
20
|
- The build output is self-contained and works for direct Cloudflare deployment, self-hosting, or `void deploy`.
|
|
21
21
|
|
|
22
|
+
## Trailing slashes and directory indexes
|
|
23
|
+
|
|
24
|
+
For hosts such as GitHub Pages, enable trailing-slash Pages URLs and directory-style HTML output:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { defineConfig } from 'void/config';
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
output: 'static',
|
|
31
|
+
routing: { trailingSlash: true },
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`/posts/` is written to `posts/index.html`, and `/posts/hello/` to `posts/hello/index.html`. Pages URLs without the slash redirect to their trailing-slash URL in development and when served by Void. Use trailing slashes in your page links; generated route types follow this setting. API routes keep their existing URLs.
|
|
36
|
+
|
|
37
|
+
Omitting the option or setting it to `false` preserves the default `posts.html` output. Static builds keep `404.html` at the output root. On Cloudflare, use the default HTML handling or `force-trailing-slash`; `drop-trailing-slash` conflicts with this option. Third-party frameworks retain their own URL configuration.
|
|
38
|
+
|
|
22
39
|
## Per-page overrides
|
|
23
40
|
|
|
24
41
|
Individual pages can opt out of prerendering:
|
|
@@ -28,15 +45,19 @@ Individual pages can opt out of prerendering:
|
|
|
28
45
|
export const prerender = false;
|
|
29
46
|
```
|
|
30
47
|
|
|
31
|
-
Dynamic pages with `getPrerenderPaths()` are prerendered for the returned param combinations:
|
|
48
|
+
Dynamic pages with `getPrerenderPaths()` are prerendered for the returned param combinations. Annotate the return type with [`PageParams`](../reference/api/types.md#route-types) so TypeScript checks the param names. Void does not infer them from the filename:
|
|
32
49
|
|
|
33
50
|
```ts
|
|
34
51
|
// pages/blog/[slug].server.ts
|
|
35
|
-
|
|
52
|
+
import type { PageParams } from 'void/routes';
|
|
53
|
+
|
|
54
|
+
export async function getPrerenderPaths(): Promise<PageParams<'/blog/[slug]'>[]> {
|
|
36
55
|
return [{ slug: 'hello-world' }, { slug: 'getting-started' }];
|
|
37
56
|
}
|
|
38
57
|
```
|
|
39
58
|
|
|
59
|
+
Each object must include every param in the page path. Values can be strings or numbers, and Void URL-encodes them. A single-segment param such as `[slug]` cannot contain `/`. For nested paths, use a catch-all page such as `pages/docs/[...slug]` and return `{ slug: 'guides/intro' }`. If an entry is invalid, the build fails. The error names the server file and the entry index.
|
|
60
|
+
|
|
40
61
|
## 404 pages
|
|
41
62
|
|
|
42
63
|
Static builds that prerender at least one page include a default `404.html` in `dist/client/`. To provide your own, add `public/404.html` or prerender a page at `/404`.
|
package/docs/guide/storage.md
CHANGED
|
@@ -68,10 +68,14 @@ Files your users upload can contain HTML or scripts. Store them under keys your
|
|
|
68
68
|
|
|
69
69
|
## Custom bindings
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
Declare your R2 binding under `cloudflare.r2_buckets` in `void.config.ts`, for example `{ binding: 'MY_BUCKET', bucket_name: 'uploads' }`. Run `void prepare` to generate its type, then pass it to `createStorage(bucket)`:
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
|
+
import { defineHandler } from 'void';
|
|
74
75
|
import { createStorage } from 'void/storage';
|
|
75
76
|
|
|
76
|
-
const
|
|
77
|
+
export const GET = defineHandler((c) => {
|
|
78
|
+
const storage = createStorage(c.env.MY_BUCKET);
|
|
79
|
+
return storage.list();
|
|
80
|
+
});
|
|
77
81
|
```
|