void 1.12.2 → 1.13.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/README.md +1 -0
- package/dist/{account-cmd-CdJQba_Q.mjs → account-cmd-4fQiXYX7.mjs} +6 -6
- package/dist/{application-analysis-DVeN8yoi.mjs → application-analysis-BjEwHTV2.mjs} +19 -13
- package/dist/{application-routing-KKw4Y84h.mjs → application-routing-COCfD2yc.mjs} +1 -1
- package/dist/args-DrnTI35r.mjs +88 -0
- package/dist/args-MnQnqypt.mjs +1 -0
- package/dist/{auth-CqwJwItO.mjs → auth-CeBmolb-.mjs} +3 -3
- package/dist/{auth-A7cZ8aXA.mjs → auth-CvaDxOMi.mjs} +1 -1
- package/dist/{auth-link-D9MWA_dj.mjs → auth-link-I4omV0pL.mjs} +6 -6
- package/dist/{auth-router-FskgTU3B.mjs → auth-router-CXq4q7bb.mjs} +6 -5
- package/dist/{better-auth-shared-BS3pDQbT.d.mts → better-auth-shared-CrIkcN8I.d.mts} +2 -1
- package/dist/bindings-C7zOgxT3.d.mts +28 -0
- package/dist/browser-run-BKgZVwLk.mjs +124 -0
- package/dist/{build-cmd-B7OJ0U5R.mjs → build-cmd-Biz6u4rn.mjs} +6 -6
- package/dist/{cache-wSpi3aeM.mjs → cache-WkLMUrjQ.mjs} +6 -6
- package/dist/{cancel-deploy-DMWzkAlb.mjs → cancel-deploy-BRsrmyTk.mjs} +6 -5
- package/dist/{cf-access-DHklo7Rg.mjs → cf-access-B21j-nd6.mjs} +1 -1
- package/dist/{cf-build-output-Cso7Vh-t.mjs → cf-build-output-G-7Tdd8b.mjs} +6 -5
- package/dist/cf-build-output-Qc43LWzE.mjs +1 -0
- package/dist/{cf-command-values-5BPBRc9Z.mjs → cf-command-values-cUnJwCyG.mjs} +24 -1
- package/dist/{cf-config-migrate-D271BTiw.mjs → cf-config-migrate-CsbQGzMf.mjs} +200 -94
- package/dist/cf-user-agent-HHTRzfud.mjs +15 -0
- package/dist/cf-version-api-BWHMVtzw.mjs +1 -0
- package/dist/cf-version-api-XEEK2B9A.mjs +856 -0
- package/dist/cf-worker-settings-DJKdy97k.mjs +127 -0
- package/dist/cli/cli.mjs +1 -1
- package/dist/cli/cloudflare-operation-process.mjs +111 -47
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/cli/json-command-process.d.mts +6 -0
- package/dist/cli/json-command-process.mjs +91 -0
- package/dist/{cli-main-DaLrQfPS.mjs → cli-main-CJTGhcYN.mjs} +84 -113
- package/dist/{client-eLZwqkPH.mjs → client-0um7Lzze.mjs} +1 -1
- package/dist/{client-DE2m2ldh.mjs → client-BEHI4UWn.mjs} +14 -8
- package/dist/{cloudflare-auth-eWfhdZCk.mjs → cloudflare-auth-iOgRurWm.mjs} +1 -1
- package/dist/{cloudflare-cmd-SsFlJe2B.mjs → cloudflare-cmd-DsSlXbNy.mjs} +5 -5
- package/dist/{cloudflare-config-D9UFH_A5.mjs → cloudflare-config-KPHKf57C.mjs} +2 -2
- package/dist/{cloudflare-connect-BgpHcSg3.mjs → cloudflare-connect-bEtneBjT.mjs} +5 -4
- package/dist/{cloudflare-operations-ByjFGats.mjs → cloudflare-operations-BmICrRnm.mjs} +1 -1
- package/dist/{cloudflare-operations-BIRQkYwL.mjs → cloudflare-operations-D-9psgPQ.mjs} +19 -11
- package/dist/cloudflare-preview-8eLSQPdO.mjs +1 -0
- package/dist/cloudflare-preview-BaeU-m74.mjs +112 -0
- package/dist/{cloudflare-process-60r4Z2Zf.mjs → cloudflare-process-DFNpqV_m.mjs} +57 -29
- package/dist/cloudflare-user-output-DFbD0l4l.mjs +36 -0
- package/dist/collect-Aam0GwAU.mjs +1 -0
- package/dist/{collect-rNLybAnF.mjs → collect-KC4cizWM.mjs} +6 -1
- package/dist/{config-DA6ZbLXO.d.mts → config-BdmM5ZzP.d.mts} +12 -2
- package/dist/{config-BFX5ZB1J.mjs → config-CUYGZqdN.mjs} +2 -2
- package/dist/{config-BSoW3QCB.mjs → config-C_UjzkVS.mjs} +3 -3
- package/dist/{config-DtjrUtPo.mjs → config-Ge-MytMU.mjs} +1 -1
- package/dist/{config-Dv5jri1-.mjs → config-KZAiI3gG.mjs} +32 -6
- package/dist/config-entry.d.mts +1 -1
- package/dist/config-write-dKLINlm2.mjs +80 -0
- package/dist/{connect-WG4TcR_d.mjs → connect-Bqq3b9sX.mjs} +10 -9
- package/dist/{create-project-CbuDH5Hv.mjs → create-project-MXoP_rte.mjs} +1 -1
- package/dist/{create-project-8FdN6D2i.mjs → create-project-T-9AIQDe.mjs} +7 -6
- package/dist/{db-BSuWV1PI.mjs → db-B3eoVDNA.mjs} +50 -47
- package/dist/{db-args-CiQVg8SJ.mjs → db-args-BcvTZ8KE.mjs} +1 -1
- package/dist/db-args-Cx1y4vZn.mjs +1 -0
- package/dist/{db-types-B4Cf9dzR.mjs → db-types-BpgXVtQZ.mjs} +1 -1
- package/dist/{delete-WtLEfap2.mjs → delete-Cf6SroAw.mjs} +7 -6
- package/dist/deploy-DZ9j7MC4.mjs +2 -0
- package/dist/{deploy-DtJeunLF.mjs → deploy-UojYUEWr.mjs} +803 -1415
- package/dist/{deploy-managed-static-BWBsxOww.mjs → deploy-managed-static-DV_OmTWf.mjs} +54 -393
- package/dist/{deploy-security-notice-IRGy6Edf.mjs → deploy-security-notice-3jX71IeP.mjs} +6 -4
- package/dist/deploy-summary-Dkl0zvQy.mjs +377 -0
- package/dist/{deploy-transport-BKP_oV9q.mjs → deploy-transport-4ISWxx8n.mjs} +4 -3
- package/dist/deploy.mjs +14 -10
- package/dist/discover-BZWVWeQs.mjs +1 -0
- package/dist/{discover-IcspacCg.mjs → discover-BeFs7OPS.mjs} +1 -1
- package/dist/{dispatch-DIhDA3NI.mjs → dispatch-BUKbPdqb.mjs} +7 -7
- package/dist/{dist-Cr_xGE_K.mjs → dist-BngS28id.mjs} +6 -6
- package/dist/{dist-C47zy_kJ.mjs → dist-x99fIj4n.mjs} +1 -1
- package/dist/{domain-mweyYXSw.mjs → domain-BK6NWkWK.mjs} +7 -7
- package/dist/{drizzle-BJDMPrj7.mjs → drizzle-CnSbVeiZ.mjs} +12 -13
- package/dist/{drizzle-CQ5jWuDL.mjs → drizzle-CrkwVwK8.mjs} +1 -1
- package/dist/{email-DoDqRH6i.mjs → email-BBSDV0J5.mjs} +13 -12
- package/dist/{email-cloudflare-DeYH3Ke7.mjs → email-cloudflare-C-guKEbz.mjs} +10 -8
- package/dist/{env-DaAoYR2-.mjs → env-BVnKiGYJ.mjs} +8 -8
- package/dist/{env-EjHqc7m9.mjs → env-CU2tMDdO.mjs} +6 -1
- package/dist/{env-types-D2hBodXP.mjs → env-types-B33fEHRH.mjs} +1 -1
- package/dist/{env-validation-j9pjCDfA.mjs → env-validation-BnAsx6gz.mjs} +1 -1
- package/dist/{env-validation-D-v5_CWL.mjs → env-validation-SXsjd6-Z.mjs} +4 -4
- package/dist/{fetch-CiEsvjpP.mjs → fetch-DL7OCgwB.mjs} +1 -1
- package/dist/{fetch-stream-BIG5lHW6.mjs → fetch-stream-DEilLTCc.mjs} +2 -2
- package/dist/{gen-aOtHhZLD.mjs → gen-BxuIN1bz.mjs} +10 -9
- package/dist/gen-DaayFP9v.mjs +1 -0
- package/dist/{generate-Dq2Bgw75.mjs → generate-Ck-L3e0e.mjs} +1 -1
- package/dist/{generate-C3ZAqCy-.mjs → generate-t1dDUYZZ.mjs} +1 -1
- package/dist/{github-cmd-BR19Ffdz.mjs → github-cmd-B7U9Hjmi.mjs} +7 -6
- package/dist/{handler-DCrDLzw2.mjs → handler-2wAywJgj.mjs} +11 -9
- package/dist/{headers-DqBsjDxg.mjs → headers-DPI4MDGC.mjs} +1 -1
- package/dist/{help-DvClCzqL.mjs → help-Bgiu5PMX.mjs} +36 -4
- package/dist/help-DWGHmt_n.mjs +1 -0
- package/dist/html-5sfGLjiI.d.mts +3 -0
- package/dist/html-DPSOBDCh.mjs +1 -0
- package/dist/{index-Dn2mkPr2.d.mts → index-CqF8_p9C.d.mts} +5 -105
- package/dist/index-Cvqotnhc.d.mts +91 -0
- package/dist/{index-BQ5qYiAw.d.mts → index-DAinHkj8.d.mts} +1 -1
- package/dist/{index-8cAgNdb6.d.mts → index-lnEWwVAS.d.mts} +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +536 -170
- package/dist/{info-P6MBiVJi.mjs → info-7COlpAfY.mjs} +32 -20
- package/dist/{init-B2VZ2Hut.mjs → init-DftAx3L4.mjs} +237 -88
- package/dist/input-jcps6lAn.mjs +64 -0
- package/dist/interactive-prompts-EK0dilFu.mjs +43 -0
- package/dist/{limits-BCoQLpn3.mjs → limits-3I3VdX2E.mjs} +4 -1
- package/dist/{link-Dyz9IGcM.mjs → link-C3WMNFTG.mjs} +7 -7
- package/dist/{list-VGYBMjmx.mjs → list-K4EGVUZN.mjs} +9 -9
- package/dist/{load-user-env-B8qC0Q2Y.mjs → load-user-env-uMmQJ-Th.mjs} +1 -1
- package/dist/{local-d1-CYOYkVwO.mjs → local-d1-BtLCVC1p.mjs} +2 -2
- package/dist/login-BJwPhV_S.mjs +1 -0
- package/dist/{login-jUBgfvzk.mjs → login-DaugBfBG.mjs} +6 -5
- package/dist/{logs-kS1wuR4b.mjs → logs-BR2szdN5.mjs} +6 -6
- package/dist/migrate-BHD46A31.mjs +1 -0
- package/dist/{migrate-BNZL1hee.mjs → migrate-Dtlg8fC6.mjs} +7 -7
- package/dist/nitro.mjs +3 -3
- package/dist/{node-DVJWfV6s.mjs → node-BbKlLpHa.mjs} +5 -5
- package/dist/{operator-ai-logging-DD0n6zc2.mjs → operator-ai-logging-4Nvs6Ut3.mjs} +5 -5
- package/dist/{operator-args-nvetCWuz.mjs → operator-args-DWvqq3Ws.mjs} +31 -15
- package/dist/{operator-auth-DMvn-y9X.mjs → operator-auth-DtRMGXYY.mjs} +2 -2
- package/dist/{operator-client-dFNnXfyB.mjs → operator-client-BG0VIMMM.mjs} +2 -2
- package/dist/operator-cmd-CR3Q9k4c.mjs +1 -0
- package/dist/{operator-cmd-wML5HNfS.mjs → operator-cmd-D4YcMKO-.mjs} +9 -9
- package/dist/{operator-security-D5MToU0p.mjs → operator-security-nVLo8vDt.mjs} +11 -5
- package/dist/{output-BZLnu0z8.mjs → output-DhJgS6Ve.mjs} +1 -1
- package/dist/output-OYwcEwok.mjs +1 -0
- package/dist/pages/client.d.mts +34 -20
- package/dist/pages/client.mjs +172 -74
- package/dist/pages/index.d.mts +11 -4
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +2 -2
- package/dist/pages/islands-plugin.mjs +5 -3
- package/dist/pages/protocol.d.mts +3 -3
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -2
- package/dist/pages/serialize.mjs +1 -1
- package/dist/parse-filename-DIPUjoCh.d.mts +2 -0
- package/dist/platform-C3Q44RJ8.mjs +250 -0
- package/dist/platform-args-BSyVZESg.mjs +1 -0
- package/dist/{platform-args-CvZSuhYS.mjs → platform-args-BnocJDC_.mjs} +1 -1
- package/dist/{platform-auth-config-Bv3oQ2gE.mjs → platform-auth-config-BbfNhjBc.mjs} +9 -9
- package/dist/{platform-auth-protection-OqzfhXwx.mjs → platform-auth-protection-BHPV4MUf.mjs} +9 -8
- package/dist/{platform-auth-recovery-rmIYjXST.mjs → platform-auth-recovery-DE0nArYy.mjs} +8 -7
- package/dist/{platform-cmd-D_4z2Ijv.mjs → platform-cmd-CLRU3BRb.mjs} +11 -10
- package/dist/{platform-cmd-B3rO4RhU.mjs → platform-cmd-Cs2LkT5L.mjs} +1 -1
- package/dist/{platform-discovery-CLxtixHJ.mjs → platform-discovery-CKeeeD82.mjs} +1 -1
- package/dist/{platform-domain-CUq9odbd.mjs → platform-domain-kn3WuKPG.mjs} +6 -5
- package/dist/{platform-lifecycle-DOSYo0UI.mjs → platform-lifecycle-BoCEYy2w.mjs} +1 -1
- package/dist/{platform-lifecycle-DuoVruij.mjs → platform-lifecycle-CKwOg8wz.mjs} +164 -72
- package/dist/{platform-management-D_gt3qLb.mjs → platform-management-CaSdFthX.mjs} +1 -1
- package/dist/{platform-management-MmO9IubR.mjs → platform-management-fyrsq2Ra.mjs} +27 -14
- package/dist/{platform-plans-config-DiydtNKY.mjs → platform-plans-config-BSI-6Inu.mjs} +11 -5
- package/dist/{platform-recovery-P_FVslfd.mjs → platform-recovery-PwJ54AIZ.mjs} +3 -3
- package/dist/{platform-registry-DHH6fivm.mjs → platform-registry-zHH3RiIm.mjs} +2 -1
- package/dist/{platform-setup-Lph9i-rh.mjs → platform-setup-DwYITHfY.mjs} +3 -3
- package/dist/{plugin-inference-COlq96WJ.mjs → plugin-inference-D5MjBVMB.mjs} +60 -142
- package/dist/prepare-CLl_TA_r.mjs +1 -0
- package/dist/{prepare-WvijE289.mjs → prepare-DZEs5AGr.mjs} +3 -3
- package/dist/{prepare-co1o1FFd.mjs → prepare-DhVzN7CB.mjs} +14 -12
- package/dist/{project-uXKua1it.mjs → project-BXpm-vgG.mjs} +1 -1
- package/dist/{project-dh9431bN.mjs → project-DC-BqHef.mjs} +1 -1
- package/dist/{project-cmd-BWJTplpc.mjs → project-cmd-BKN3qT4R.mjs} +31 -21
- package/dist/{project-paths-2ENfCCih.mjs → project-paths-BeAxxqGh.mjs} +1 -1
- package/dist/{project-security-BV1xfj1K.mjs → project-security-B-SHxprt.mjs} +1 -1
- package/dist/{project-security-CY_aahvW.mjs → project-security-BWTd6cTU.mjs} +87 -46
- package/dist/{project-team-BlIFXlmT.mjs → project-team-jcn9reIB.mjs} +6 -6
- package/dist/{project-token-CMsB7I1-.mjs → project-token-BHkBKtzt.mjs} +6 -6
- package/dist/{project-tsconfig-BOA4ym99.mjs → project-tsconfig-LjgxDdj_.mjs} +1 -1
- package/dist/{project-zero-trust-BI6pdpx4.mjs → project-zero-trust-2t_qI6xa.mjs} +4 -4
- package/dist/{protocol-4rEnumif.mjs → protocol-DhMbnxzy.mjs} +120 -35
- package/dist/{protocol-ERy-n3jf.d.mts → protocol-wG7JP5Mm.d.mts} +27 -4
- package/dist/{provision-DFv7SJDn.mjs → provision-C04aXE3a.mjs} +1 -1
- package/dist/{provision-Bh44omGA.mjs → provision-CQykn8gu.mjs} +8 -4
- package/dist/{redirect-Dyvuil0Q.mjs → redirect-DjyA_hx_.mjs} +1 -1
- package/dist/{requests-CfmJxNYg.mjs → requests-BznxnxTT.mjs} +5 -5
- package/dist/resolve-project-Bob_rEi2.mjs +1 -0
- package/dist/{resolve-project-8WZ3iVmr.mjs → resolve-project-s_FGWyr-.mjs} +2 -2
- package/dist/resource-binding-5nI30acw.mjs +20 -0
- package/dist/{resource-name-DlJ9QXzg.mjs → resource-name-D_gw36kh.mjs} +5 -1
- package/dist/{rollback-DL5HuAsM.mjs → rollback-CLiINtpt.mjs} +25 -14
- package/dist/{route-types-CSed9-Dp.mjs → route-types-DxvqN5bL.mjs} +59 -9
- package/dist/{route-url-B41eQ8QI.mjs → route-url-CRC8yR_2.mjs} +2 -3
- package/dist/{route-url-Bd6IX-JZ.d.mts → route-url-zDfC-7DD.d.mts} +33 -5
- package/dist/routes-stub.d.mts +18 -2
- package/dist/routes-stub.mjs +1 -1
- package/dist/{runner-CeguHWJx.mjs → runner-CnUrhc8H.mjs} +1 -1
- package/dist/{runner-mysql-DOjbj-N1.mjs → runner-mysql-CW6bFa67.mjs} +1 -1
- package/dist/{runner-mysql-D549vGGm.mjs → runner-mysql-DSLGFOlC.mjs} +1 -1
- package/dist/{runner-pg-Buzw17hl.mjs → runner-pg-BcGF7iBR.mjs} +1 -1
- package/dist/{runner-pg-DMJquR3d.mjs → runner-pg-OeP0JpEo.mjs} +1 -1
- package/dist/{runner-Bf94YVJK.mjs → runner-rnXCGa20.mjs} +1 -1
- package/dist/runtime/ai/index.mjs +1 -1
- package/dist/runtime/auth/better-auth-d1.d.mts +1 -1
- package/dist/runtime/auth/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/auth/better-auth-postgres.d.mts +1 -1
- package/dist/runtime/client/fetch-server.mjs +1 -1
- package/dist/runtime/client/fetch-stream.mjs +1 -1
- package/dist/runtime/client/fetch.mjs +1 -1
- package/dist/runtime/client/index.mjs +2 -2
- package/dist/runtime/client/react.mjs +2 -2
- package/dist/runtime/client/solid.mjs +2 -2
- package/dist/runtime/client/svelte.mjs +2 -2
- package/dist/runtime/client/vue.mjs +2 -2
- package/dist/runtime/durable/index.mjs +11 -26
- package/dist/runtime/env/runtime.d.mts +2 -10
- package/dist/runtime/handler/index.d.mts +3 -2
- package/dist/runtime/handler/index.mjs +2 -2
- package/dist/runtime/handler/validator.d.mts +1 -1
- package/dist/runtime/handler/validator.mjs +1 -1
- package/dist/runtime/html.d.mts +2 -0
- package/dist/runtime/html.mjs +1 -0
- package/dist/runtime/image/index.d.mts +103 -0
- package/dist/runtime/image/index.mjs +89 -0
- package/dist/runtime/jsx/index.d.mts +3 -0
- package/dist/runtime/jsx/index.mjs +2 -0
- package/dist/runtime/jsx/jsx-dev-runtime.d.mts +1 -0
- package/dist/runtime/jsx/jsx-dev-runtime.mjs +2 -0
- package/dist/runtime/jsx/jsx-runtime.d.mts +1 -0
- package/dist/runtime/jsx/jsx-runtime.mjs +2 -0
- package/dist/runtime/limits/index.mjs +1 -1
- package/dist/runtime/live/client.d.mts +2 -2
- package/dist/runtime/live/index.d.mts +1 -1
- package/dist/runtime/routing/index.d.mts +87 -4
- package/dist/runtime/routing/index.mjs +59 -20
- package/dist/runtime/routing/route-url.d.mts +2 -2
- package/dist/runtime/routing/route-url.mjs +1 -1
- package/dist/runtime/sandbox/index.mjs +1 -1
- package/dist/runtime/sse/client.d.mts +1 -1
- package/dist/runtime/workflows/entry.d.mts +8 -0
- package/dist/runtime/workflows/entry.mjs +49 -0
- package/dist/runtime/workflows/index.d.mts +3 -0
- package/dist/runtime/workflows/index.mjs +77 -0
- package/dist/runtime/ws/index.d.mts +1 -1
- package/dist/runtime/ws/index.mjs +2 -2
- package/dist/runtime/ws/room.d.mts +1 -1
- package/dist/runtime/ws/server.d.mts +2 -2
- package/dist/runtime-Db72hLY-.d.mts +11 -0
- package/dist/scan-BxhB4BA-.mjs +946 -0
- package/dist/scan-D2ISAobj.mjs +308 -0
- package/dist/{secret-C-WBaUSS.mjs → secret-Ck9N5xbU.mjs} +9 -8
- package/dist/{security-sarif-ClyYwtAW.mjs → security-sarif-DzTIqNwZ.mjs} +1 -1
- package/dist/{serialize-DN-envGQ.d.mts → serialize-Dr9B-0yV.d.mts} +10 -1
- package/dist/{serialize-BmB4BfKu.mjs → serialize-nW4IeEBI.mjs} +23 -2
- package/dist/{skills-C-csz78e.mjs → skills-BR7YHAF7.mjs} +1 -1
- package/dist/{scan-Ct_SEzH4.mjs → source-analysis-cache-Ccm_JSOl.mjs} +340 -902
- package/dist/standard-schema-DvMcZGMK.mjs +8 -0
- package/dist/{subcommand-prompt-B4LOLosl.mjs → subcommand-prompt-AFf2LcrC.mjs} +2 -2
- package/dist/{types-FDH6NuY1.d.mts → types-RYVujNS6.d.mts} +4 -2
- package/dist/{version-metadata-DqgLa6gc.mjs → untrusted-env-4oW0TdBP.mjs} +1 -23
- package/dist/{url-DBQluotE.mjs → url-DAQ1c3lh.mjs} +45 -1
- package/dist/{validate-CtBWCzez.mjs → validate-B1PsQ_mt.mjs} +1 -1
- package/dist/validate-p9b3r1k4.mjs +1 -0
- package/dist/{validation-error-CtcAvyI7.mjs → validation-error-EKI0wMWX.mjs} +2 -2
- package/dist/{validator-Dfh9kCDm.mjs → validator-JJcf9E48.mjs} +5 -8
- package/dist/version-metadata-CEla0kgi.mjs +23 -0
- package/dist/{wrangler-DVe5KV5G.mjs → wrangler-AyMfdVJK.mjs} +34 -69
- package/dist/wrangler-BT7qrzWc.mjs +1 -0
- package/dist/{wrapper-CcMYpOS8.mjs → wrapper-DPlTBVOx.mjs} +5 -5
- package/docs/guide/ai.md +1 -1
- package/docs/guide/app-types.md +6 -23
- package/docs/guide/auth.md +2 -4
- package/docs/guide/database/d1.md +21 -67
- package/docs/guide/database/mysql.md +8 -0
- package/docs/guide/database/postgresql.md +2 -2
- package/docs/guide/database.md +1 -1
- package/docs/guide/deployment.md +18 -0
- package/docs/guide/edge/prerendering.md +3 -7
- package/docs/guide/edge/redirects.md +1 -1
- package/docs/guide/edge/revalidation.md +8 -17
- package/docs/guide/edge/rewrites.md +1 -1
- package/docs/guide/edge/static-assets.md +10 -22
- package/docs/guide/email/domains.md +3 -1
- package/docs/guide/email/receiving.md +2 -2
- package/docs/guide/email/sending.md +3 -1
- package/docs/guide/env-vars.md +2 -0
- package/docs/guide/image-generation.md +142 -0
- package/docs/guide/index.md +17 -15
- package/docs/guide/jobs.md +2 -4
- package/docs/guide/kv.md +1 -1
- package/docs/guide/og-images.md +83 -0
- package/docs/guide/pages-routing/actions-and-forms.md +6 -4
- package/docs/guide/pages-routing/errors.md +20 -4
- package/docs/guide/pages-routing/head.md +5 -5
- package/docs/guide/pages-routing/islands.md +4 -14
- package/docs/guide/pages-routing/markdown.md +2 -2
- package/docs/guide/pages-routing/overview.md +129 -15
- package/docs/guide/platform/administration/plans.md +47 -16
- package/docs/guide/platform/administration/projects.md +10 -0
- package/docs/guide/platform/administration/security-audits.md +76 -30
- package/docs/guide/platform/administration/zero-trust.md +1 -1
- package/docs/guide/platform/installation/ci.md +0 -4
- package/docs/guide/platform/installation/credentials.md +1 -1
- package/docs/guide/platform/installation/maintenance.md +10 -10
- package/docs/guide/platform/installation/prerequisites.md +3 -1
- package/docs/guide/platform/installation/setup.md +7 -15
- package/docs/guide/platform/installation/uninstall.md +6 -12
- package/docs/guide/project-collaboration.md +1 -4
- package/docs/guide/queues.md +6 -8
- package/docs/guide/quickstart.md +6 -8
- package/docs/guide/sandboxes.md +1 -1
- package/docs/guide/self-hosted-platform.md +4 -7
- package/docs/guide/server-routing.md +5 -3
- package/docs/guide/ssg.md +1 -1
- package/docs/guide/type-safety.md +74 -10
- package/docs/guide/websockets.md +5 -7
- package/docs/guide/workflows.md +122 -0
- package/docs/index.md +2 -3
- package/docs/integrations/agents.md +3 -16
- package/docs/integrations/cloudflare.md +98 -2
- package/docs/integrations/frameworks/analog.md +9 -11
- package/docs/integrations/frameworks/astro.md +16 -17
- package/docs/integrations/frameworks/nuxt.md +11 -13
- package/docs/integrations/frameworks/overview.md +18 -20
- package/docs/integrations/frameworks/react-router.md +55 -6
- package/docs/integrations/frameworks/sveltekit.md +8 -6
- package/docs/integrations/frameworks/tanstack-start.md +10 -6
- package/docs/integrations/hono.md +27 -12
- package/docs/integrations/nodejs-bun-deno.md +10 -2
- package/docs/reference/api/database.md +8 -10
- package/docs/reference/api/env.md +2 -2
- package/docs/reference/api/handlers.md +1 -1
- package/docs/reference/api/html.md +45 -0
- package/docs/reference/api/pages.md +118 -167
- package/docs/reference/api/rewrites.md +5 -5
- package/docs/reference/api/types.md +13 -6
- package/docs/reference/api/workflows.md +48 -0
- package/docs/reference/api.md +7 -1
- package/docs/reference/cli/database.md +22 -10
- package/docs/reference/cli/deploy.md +49 -4
- package/docs/reference/cli/domains.md +7 -3
- package/docs/reference/cli/email.md +3 -1
- package/docs/reference/cli/platform-installation.md +9 -53
- package/docs/reference/cli/platform-security.md +36 -8
- package/docs/reference/cli/platform-users.md +11 -1
- package/docs/reference/cli/platform-zero-trust.md +1 -1
- package/docs/reference/cli/project.md +52 -11
- package/docs/reference/cli/setup.md +8 -10
- package/docs/reference/cli.md +49 -47
- package/docs/reference/config.md +22 -8
- package/docs/reference/resource-inference.md +8 -1
- package/docs/reference/structure.md +5 -0
- package/package.json +52 -25
- package/schema.json +20 -1
- package/skills/void/SKILL.md +60 -54
- package/dist/cf-build-output-Wpk_e5CI.mjs +0 -1
- package/dist/cf-worker-settings-BBdlhm9U.mjs +0 -41
- package/dist/cli/db-execute-process.d.mts +0 -2
- package/dist/cli/db-execute-process.mjs +0 -57
- package/dist/cloudflare-user-output-CCR99eQY.mjs +0 -19
- package/dist/collect-B6nlSnsb.mjs +0 -1
- package/dist/db-args-BvMwAber.mjs +0 -1
- package/dist/deploy-GT4CW5fs.mjs +0 -2
- package/dist/discover-D2KGP3cR.mjs +0 -1
- package/dist/entry-Bwb9ev8K.mjs +0 -113
- package/dist/gen-vhBDHs3q.mjs +0 -1
- package/dist/help-fKPzcTJv.mjs +0 -1
- package/dist/isr-config-DiTnL9Tb.mjs +0 -115
- package/dist/login-BbSQTZ6d.mjs +0 -1
- package/dist/migrate-C9aoWLvY.mjs +0 -1
- package/dist/operator-cmd-jnjzuJKX.mjs +0 -1
- package/dist/output-D7K9TWIA.mjs +0 -1
- package/dist/platform-args-CMwMoiLp.mjs +0 -1
- package/dist/prepare-DcwigRUS.mjs +0 -1
- package/dist/providers-D5P8j_8D.d.mts +0 -5
- package/dist/resolve-project-YsTH-U9I.mjs +0 -1
- package/dist/static-exports-s7P86Ngp.mjs +0 -354
- package/dist/validate-CZYUIfR-.mjs +0 -1
- package/dist/wrangler-Dq269bjx.mjs +0 -1
- package/docs/guide/platform/development/local.md +0 -120
- package/docs/guide/platform/development/runtime.md +0 -115
- package/docs/guide/platform/development/schema-ci.md +0 -44
- package/docs/guide/platform-development.md +0 -16
|
@@ -5,7 +5,7 @@ outline: deep
|
|
|
5
5
|
|
|
6
6
|
# Pages Adapters {#framework-adaptors}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Install the adapter for your framework to use [Pages Routing](../../guide/pages-routing/overview).
|
|
9
9
|
|
|
10
10
|
## Error components
|
|
11
11
|
|
|
@@ -28,6 +28,42 @@ With [`routing.typedRoutes`](../config.md#routing-typedroutes), `href` and route
|
|
|
28
28
|
|
|
29
29
|
See [Typed navigation](../../guide/pages-routing/overview.md#typed-navigation) for framework examples.
|
|
30
30
|
|
|
31
|
+
## Link status
|
|
32
|
+
|
|
33
|
+
`useLinkStatus(href, options?)` returns the same `current`, `active`, and `pending` values that `Link` gives its children. To track a particular link, pass its `href`, `method`, `data`, and `activeMatch`.
|
|
34
|
+
|
|
35
|
+
| Field | When it is true |
|
|
36
|
+
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
+
| `current` | The link matches the current page under the [active link rules](../../guide/pages-routing/overview.md#active-links). Void sets `aria-current="page"`. |
|
|
38
|
+
| `active` | The link is current, or matches a parent section with `activeMatch="prefix"`. Void sets `data-void-active`. |
|
|
39
|
+
| `pending` | A visit to this destination is in progress under the [pending link rules](../../guide/pages-routing/overview.md#pending-links). Void sets `data-void-pending`. |
|
|
40
|
+
|
|
41
|
+
| Adapter | Reading the result | Reactive inputs |
|
|
42
|
+
| ------- | ------------------------------------------------------------- | ----------------------------------------- |
|
|
43
|
+
| React | `status.active` | Pass the current props on each render. |
|
|
44
|
+
| Vue | `status.value.active` in script, `status.active` in templates | Pass refs or getters for changing inputs. |
|
|
45
|
+
| Svelte | `status.active` (destructuring reads the values only once) | Pass getters for changing inputs. |
|
|
46
|
+
| Solid | `status().active` | Pass accessors for changing inputs. |
|
|
47
|
+
|
|
48
|
+
To find which section of a menu is active, use `isLinkActive(router, href, options?)`:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { isLinkActive, useRouter } from '@void/react'; // or @void/vue, @void/svelte, @void/solid
|
|
52
|
+
import type { Href } from 'void/routes';
|
|
53
|
+
|
|
54
|
+
const sections: { href: Href; label: string }[] = [
|
|
55
|
+
{ href: '/admin/users', label: 'Users' },
|
|
56
|
+
{ href: '/admin/billing', label: 'Billing' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
// In a component:
|
|
60
|
+
const router = useRouter();
|
|
61
|
+
const activeLabel = () =>
|
|
62
|
+
sections.find(({ href }) => isLinkActive(router, href, { activeMatch: 'prefix' }))?.label;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Read `activeLabel()` during render so the label follows navigation. To match the pending destination instead, call `isLinkPending(router, navigation, href, options?)` with the result of `useNavigation()`.
|
|
66
|
+
|
|
31
67
|
## Prefetching {#prefetching}
|
|
32
68
|
|
|
33
69
|
`Link`'s `prefetch` prop takes `true`, `false`, a strategy, or an array of strategies:
|
|
@@ -60,60 +96,98 @@ Each adapter plugin's `prefetch` option sets app-wide values:
|
|
|
60
96
|
| `hoverDelay` | `75` | Milliseconds the pointer rests on a link before `'hover'` prefetches. |
|
|
61
97
|
| `cacheFor` | `'30s'` | The `cacheFor` value for every `Link` that doesn't set its own. |
|
|
62
98
|
|
|
99
|
+
## Shared runtime API
|
|
100
|
+
|
|
101
|
+
Import these helpers from your framework's adapter (`@void/react`, `@void/vue`, `@void/svelte`, or `@void/solid`).
|
|
102
|
+
|
|
103
|
+
| Export | Usage |
|
|
104
|
+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `Link` | Renders an anchor for GET and a button for mutations. Accepts `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `activeMatch`, and `onNavigate`. Children can read the [link status](#link-status). |
|
|
106
|
+
| `useRouter()` | Read `url`, `path`, `query`, and `params`. Navigate with `visit` or `refresh`, and manage prefetched pages with `prefetch`, `flush`, and `flushAll`. |
|
|
107
|
+
| `useParams()` | Read the current page's route parameters. Pass its pattern to type them, e.g. `useParams<'/users/[id]'>()`. |
|
|
108
|
+
| `usePageQuery()` | Read the current page's query. Pass its pattern to type the result, e.g. `usePageQuery<'/users'>()`. See [typed page queries](../../guide/type-safety.md#page-query). |
|
|
109
|
+
| `useLinkStatus(href, options?)` | Read a destination's [link status](#link-status): `current`, `active`, and `pending`. Takes `method`, `data`, and `activeMatch`. |
|
|
110
|
+
| `isLinkActive`, `isLinkPending` | Plain functions that match a [list of destinations](#link-status) with the same rules. |
|
|
111
|
+
| `useNavigation()` | Read `{ state, location, method }`. The state is `idle`, `loading`, or `submitting`. The location is the pending destination. |
|
|
112
|
+
| `useShared()` | Read [shared data](../../guide/pages-routing/layouts.md#shared-data) set by middleware, loaders, or actions. |
|
|
113
|
+
| `useForm(url, defaults, options?)` | Manage a [form](#form) bound to a page action. Submit with `post`, `put`, `patch`, or `delete`. |
|
|
114
|
+
| `useIslandForm(defaults)` | Manage a form in an [island](../../guide/pages-routing/islands.md#forms). Pass the action URL to each submit method. With [typed routes](../config.md#routing-typedroutes), the URL must be a [`RouteUrl`](./types.md#route-types). |
|
|
115
|
+
| `action(url, options?)` | Run a page action and await its [`ActionResult`](../../guide/pages-routing/actions-and-forms.md#action-helper). Accepts `data`, `params`, `preserveScroll`, and `method` (`POST` by default, or `PUT`, `PATCH`, or `DELETE`). |
|
|
116
|
+
| `isVoidActionError(error)` | Narrows a thrown action error to `VoidActionError`. |
|
|
117
|
+
| `isCallSiteActionError(error)` | Recognizes expected action errors such as `409` or `422`. |
|
|
118
|
+
| `getValidationErrors(body)` | Reads field errors from `error.body`. Returns `null` when there are none. |
|
|
119
|
+
|
|
120
|
+
On GET links, `data` adds query parameters to the rendered `href`. Primitive values become strings and arrays become repeated keys. Void skips `null` and `undefined` and rejects nested objects. Only GET links accept `prefetch` and `reloadDocument`. Style the current link with [`data-void-active`](../../guide/pages-routing/overview.md#active-links) or `aria-current="page"`, and the pending destination with [`data-void-pending`](../../guide/pages-routing/overview.md#pending-links).
|
|
121
|
+
|
|
122
|
+
`useForm()` exposes `data`, `pending`, `errors`, `error`, `hasChanges`, `wasSuccessful`, and `recentlySuccessful`. Use `reset`, `setError`, `clearErrors`, and `clearError` to update the form. React and Solid also provide `setData`. Vue and Svelte island forms also provide `submit(url, method)`.
|
|
123
|
+
|
|
124
|
+
## Shared plugin options
|
|
125
|
+
|
|
126
|
+
| Option | What it controls |
|
|
127
|
+
| ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
128
|
+
| [`prefetch`](#prefetching) | When to load a page before the visitor follows its link. |
|
|
129
|
+
| [`viewTransitions`](../../guide/pages-routing/view-transitions.md) | Animations between pages. |
|
|
130
|
+
| [`scrollRestoration`](../../guide/pages-routing/overview.md#scroll-restoration) | Restore the saved position on Back, Forward, and reload. Defaults to `true`. |
|
|
131
|
+
| [`deployRecovery`](../../guide/pages-routing/overview.md#after-a-deploy) | Reload after a deployment when the old page can no longer load. Defaults to `true`. |
|
|
132
|
+
|
|
63
133
|
## `@void/vue` {#void-vue}
|
|
64
134
|
|
|
65
135
|
### `voidVue(options?)` {#voidvue-options}
|
|
66
136
|
|
|
67
|
-
Imported from `"@void/vue/plugin"`. Returns an array of Vite plugins that handle Vue SFC compilation and SSR or hydration entry generation. It already includes `@vitejs/plugin-vue`, so you do not need to install or configure that separately.
|
|
68
|
-
|
|
69
137
|
```ts
|
|
70
138
|
import { voidVue } from '@void/vue/plugin';
|
|
139
|
+
import { defineConfig } from 'vite';
|
|
140
|
+
import { voidPlugin } from 'void';
|
|
71
141
|
|
|
72
142
|
export default defineConfig({
|
|
73
143
|
plugins: [voidPlugin(), voidVue()],
|
|
74
144
|
});
|
|
75
145
|
```
|
|
76
146
|
|
|
77
|
-
|
|
147
|
+
`VoidVueOptions` accepts the [shared plugin options](#shared-plugin-options) and `vue` for the included `@vitejs/plugin-vue` plugin. Use `appSetup` to configure the [Vue app](#vue-app-setup).
|
|
148
|
+
|
|
149
|
+
### Vue app setup {#vue-app-setup}
|
|
150
|
+
|
|
151
|
+
To use a Pinia store in your Vue pages, install `pinia` in your app. Then set `appSetup` to the path of a setup module, relative to the project root.
|
|
78
152
|
|
|
79
153
|
```ts
|
|
80
|
-
|
|
154
|
+
// vite.config.ts
|
|
155
|
+
import { voidVue } from '@void/vue/plugin';
|
|
156
|
+
import { defineConfig } from 'vite';
|
|
157
|
+
import { voidPlugin } from 'void';
|
|
158
|
+
|
|
159
|
+
export default defineConfig({
|
|
160
|
+
plugins: [voidPlugin(), voidVue({ appSetup: './src/vue-app.ts' })],
|
|
161
|
+
});
|
|
81
162
|
```
|
|
82
163
|
|
|
83
|
-
|
|
164
|
+
Create the store inside `setup(app)` so each server request gets its own instance. The optional `dehydrate()` and `hydrate(state)` functions let the browser start with the state the server used to render the page.
|
|
84
165
|
|
|
85
166
|
```ts
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
167
|
+
// src/vue-app.ts
|
|
168
|
+
import { createPinia } from 'pinia';
|
|
169
|
+
import type { App } from 'vue';
|
|
170
|
+
|
|
171
|
+
export default function setup(app: App) {
|
|
172
|
+
const pinia = createPinia();
|
|
173
|
+
app.use(pinia);
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
dehydrate: () => pinia.state.value,
|
|
177
|
+
hydrate(state: typeof pinia.state.value) {
|
|
178
|
+
pinia.state.value = state;
|
|
179
|
+
},
|
|
93
180
|
};
|
|
94
|
-
deployRecovery?: boolean; // reload a tab whose build is gone. default: true
|
|
95
181
|
}
|
|
96
182
|
```
|
|
97
183
|
|
|
98
|
-
|
|
184
|
+
Void calls `setup(app)` on the server for each request that renders a Vue app, and in the browser before mounting the page or an island. Keep setup and both state functions synchronous. Guard browser-only APIs with `if (!import.meta.env.SSR)`.
|
|
99
185
|
|
|
100
|
-
|
|
186
|
+
For a hydrated page, `dehydrate()` runs after rendering and before deferred callbacks. Its return value goes into the HTML, then `hydrate(state)` restores it before the page mounts. Each island gets its own store from `setup(app)`. Pass any server values an island needs as props.
|
|
101
187
|
|
|
102
|
-
|
|
103
|
-
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
104
|
-
| `Link` | Vue component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `activeMatch`, `onNavigate`. Adds `aria-current="page"` and `data-void-active` to the link to the current page ([active links](../../guide/pages-routing/overview.md#active-links)), and `data-void-pending` to links to a page while it loads ([pending links](../../guide/pages-routing/overview.md#pending-links)). |
|
|
105
|
-
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
106
|
-
| `useParams()` | Returns dynamic route params for the page currently being rendered. Pass the page's pattern as the type argument, such as `useParams<'/users/[id]'>()`, to type them. |
|
|
107
|
-
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
108
|
-
| `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 }`. |
|
|
109
|
-
| `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). |
|
|
110
|
-
| `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). |
|
|
111
|
-
| `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). |
|
|
112
|
-
| `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
|
|
113
|
-
| `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()`. |
|
|
114
|
-
| `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). |
|
|
188
|
+
### Vue Runtime {#vue-runtime}
|
|
115
189
|
|
|
116
|
-
|
|
190
|
+
Import the [shared runtime API](#shared-runtime-api) from `@void/vue`.
|
|
117
191
|
|
|
118
192
|
Vue GET navigation remounts the page so `useForm()` picks up the destination record's URL and defaults; layouts persist. Mutations and `router.refresh()` preserve page state by default. Set `preserveState` explicitly to override the default for navigation within the same record.
|
|
119
193
|
|
|
@@ -121,68 +195,25 @@ Vue GET navigation remounts the page so `useForm()` picks up the destination rec
|
|
|
121
195
|
|
|
122
196
|
### `voidReact(options?)` {#voidreact-options}
|
|
123
197
|
|
|
124
|
-
Imported from `"@void/react/plugin"`. Returns an array of Vite plugins that handle SSR and hydration entry generation. It already includes `@vitejs/plugin-react`, so you do not need to install or configure that separately.
|
|
125
|
-
|
|
126
198
|
```ts
|
|
127
199
|
import { voidReact } from '@void/react/plugin';
|
|
200
|
+
import { defineConfig } from 'vite';
|
|
201
|
+
import { voidPlugin } from 'void';
|
|
128
202
|
|
|
129
203
|
export default defineConfig({
|
|
130
204
|
plugins: [voidPlugin(), voidReact()],
|
|
131
205
|
});
|
|
132
206
|
```
|
|
133
207
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```ts
|
|
137
|
-
function voidReact(options?: VoidReactOptions): Plugin[];
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
**Options:**
|
|
141
|
-
|
|
142
|
-
```ts
|
|
143
|
-
interface VoidReactOptions {
|
|
144
|
-
react?: ReactPluginOptions; // passed through to @vitejs/plugin-react
|
|
145
|
-
viewTransitions?: boolean; // enable View Transitions API for navigations
|
|
146
|
-
prefetch?: {
|
|
147
|
-
defaultStrategy?: boolean | LinkPrefetchStrategy | LinkPrefetchStrategy[]; // default: false
|
|
148
|
-
hoverDelay?: number; // default: 75 (ms)
|
|
149
|
-
cacheFor?: number | string | [string, string]; // default: '30s'
|
|
150
|
-
};
|
|
151
|
-
deployRecovery?: boolean; // reload a tab whose build is gone. default: true
|
|
152
|
-
}
|
|
153
|
-
```
|
|
208
|
+
`VoidReactOptions` accepts the [shared plugin options](#shared-plugin-options) and `react` for the included `@vitejs/plugin-react` plugin.
|
|
154
209
|
|
|
155
210
|
### React Runtime {#react-runtime}
|
|
156
211
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
| Export | Description |
|
|
160
|
-
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
161
|
-
| `Link` | React component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `activeMatch`, `onNavigate`. Adds `aria-current="page"` and `data-void-active` to the link to the current page ([active links](../../guide/pages-routing/overview.md#active-links)), and `data-void-pending` to links to a page while it loads ([pending links](../../guide/pages-routing/overview.md#pending-links)). |
|
|
162
|
-
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. React navigations are scheduled as transitions. |
|
|
163
|
-
| `useParams()` | Returns dynamic route params for the page currently being rendered. Pass the page's pattern as the type argument, such as `useParams<'/users/[id]'>()`, to type them. |
|
|
164
|
-
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
165
|
-
| `useForm(url, defaults, options?)` | Form helper hook. Returns `{ data, setData, post, put, patch, delete, pending, errors, error, hasChanges, wasSuccessful, recentlySuccessful, reset, setError, clearErrors, clearError }`. |
|
|
166
|
-
| `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). |
|
|
167
|
-
| `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). |
|
|
168
|
-
| `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). |
|
|
169
|
-
| `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
|
|
170
|
-
| `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()`. |
|
|
171
|
-
| `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). |
|
|
172
|
-
| `Deferred<T>` | React-only prop type for `defer()` results. It is `Promise<T>` and is consumed with React `use()`. |
|
|
173
|
-
|
|
174
|
-
React `Link` GET `data` is merged into the rendered `href` query string. Primitive values are serialized with `String(value)`, arrays become repeated keys, `null` and `undefined` are omitted, and nested objects throw. `prefetch` and `reloadDocument` are GET-only and throw for mutation links.
|
|
212
|
+
Import the [shared runtime API](#shared-runtime-api) from `@void/react`. React schedules navigations as transitions.
|
|
175
213
|
|
|
176
214
|
React `useForm()` accepts `onSuccess?: () => void | Promise<void>` and `onError?: (error: Record<string, string> | VoidActionError) => void | Promise<void>`. `pending` stays true until callbacks finish. See [submission callbacks](../../guide/pages-routing/actions-and-forms.md#react-submission-callbacks).
|
|
177
215
|
|
|
178
|
-
React deferred
|
|
179
|
-
with React's `use()` inside a `<Suspense>` boundary. React Pages requires React
|
|
180
|
-
19 and uses streaming SSR for the initial deferred shell. Rejections throw from
|
|
181
|
-
`use()`, so use a normal React error boundary for custom deferred error UI. Vue,
|
|
182
|
-
Svelte, and Solid keep the `{ loading, value, error }` deferred state object.
|
|
183
|
-
When explicitly annotating props, import `Deferred` from the framework adapter
|
|
184
|
-
package (`@void/react`, `@void/vue`, `@void/svelte`, or `@void/solid`) so the
|
|
185
|
-
type matches that adapter's client runtime shape.
|
|
216
|
+
React Pages requires React 19. Read a deferred prop with `use()` inside `<Suspense>` and handle rejections with an error boundary. Import `Deferred<T>` from your adapter when annotating props. In React it is a `Promise<T>`. Vue, Svelte, and Solid expose `{ loading, value, error }`.
|
|
186
217
|
|
|
187
218
|
### React navigation completion {#react-navigation-completion}
|
|
188
219
|
|
|
@@ -207,125 +238,47 @@ The DOM and URL may still show the previous page after `await`. Use an effect or
|
|
|
207
238
|
|
|
208
239
|
### `voidSvelte(options?)` {#voidsvelte-options}
|
|
209
240
|
|
|
210
|
-
Imported from `"@void/svelte/plugin"`. Returns an array of Vite plugins that handle SSR and hydration entry generation for Svelte 5. It already includes `@sveltejs/vite-plugin-svelte`, so you do not need to install or configure that separately.
|
|
211
|
-
|
|
212
241
|
```ts
|
|
213
242
|
import { voidSvelte } from '@void/svelte/plugin';
|
|
243
|
+
import { defineConfig } from 'vite';
|
|
244
|
+
import { voidPlugin } from 'void';
|
|
214
245
|
|
|
215
246
|
export default defineConfig({
|
|
216
247
|
plugins: [voidPlugin(), voidSvelte()],
|
|
217
248
|
});
|
|
218
249
|
```
|
|
219
250
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
```ts
|
|
223
|
-
function voidSvelte(options?: VoidSvelteOptions): Plugin[];
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**Options:**
|
|
227
|
-
|
|
228
|
-
```ts
|
|
229
|
-
interface VoidSvelteOptions {
|
|
230
|
-
svelte?: SveltePluginOptions; // passed through to @sveltejs/vite-plugin-svelte
|
|
231
|
-
viewTransitions?: boolean; // enable View Transitions API
|
|
232
|
-
prefetch?: {
|
|
233
|
-
defaultStrategy?: boolean | LinkPrefetchStrategy | LinkPrefetchStrategy[]; // default: false
|
|
234
|
-
hoverDelay?: number; // default: 75 (ms)
|
|
235
|
-
cacheFor?: number | string | [string, string]; // default: '30s'
|
|
236
|
-
};
|
|
237
|
-
deployRecovery?: boolean; // reload a tab whose build is gone. default: true
|
|
238
|
-
}
|
|
239
|
-
```
|
|
251
|
+
`VoidSvelteOptions` accepts the [shared plugin options](#shared-plugin-options) and `svelte` for the included `@sveltejs/vite-plugin-svelte` plugin.
|
|
240
252
|
|
|
241
253
|
### Svelte Runtime {#svelte-runtime}
|
|
242
254
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
| Export | Description |
|
|
246
|
-
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
247
|
-
| `Link` | Svelte component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `activeMatch`, `onNavigate`. Adds `aria-current="page"` and `data-void-active` to the link to the current page ([active links](../../guide/pages-routing/overview.md#active-links)), and `data-void-pending` to links to a page while it loads ([pending links](../../guide/pages-routing/overview.md#pending-links)). |
|
|
248
|
-
| `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 }`. |
|
|
249
|
-
| `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). |
|
|
250
|
-
| `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). |
|
|
251
|
-
| `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). |
|
|
252
|
-
| `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
|
|
253
|
-
| `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()`. |
|
|
254
|
-
| `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). |
|
|
255
|
-
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
256
|
-
| `useParams()` | Returns dynamic route params for the page currently being rendered. Pass the page's pattern as the type argument, such as `useParams<'/users/[id]'>()`, to type them. |
|
|
257
|
-
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
258
|
-
|
|
259
|
-
Svelte `Link` GET `data` is merged into the rendered `href` query string. Primitive values are serialized with `String(value)`, arrays become repeated keys, `null` and `undefined` are omitted, and nested objects throw. `prefetch` and `reloadDocument` are GET-only and throw for mutation links.
|
|
255
|
+
Import the [shared runtime API](#shared-runtime-api) from `@void/svelte`. The adapter uses Svelte 5 runes.
|
|
260
256
|
|
|
261
257
|
## `@void/solid` {#void-solid}
|
|
262
258
|
|
|
263
259
|
### `voidSolid(options?)` {#voidsolid-options}
|
|
264
260
|
|
|
265
|
-
Imported from `"@void/solid/plugin"`. Returns an array of Vite plugins that handle SSR and hydration entry generation for Solid. It already includes `vite-plugin-solid`, so you do not need to install or configure that separately.
|
|
266
|
-
|
|
267
261
|
```ts
|
|
268
262
|
import { voidSolid } from '@void/solid/plugin';
|
|
263
|
+
import { defineConfig } from 'vite';
|
|
264
|
+
import { voidPlugin } from 'void';
|
|
269
265
|
|
|
270
266
|
export default defineConfig({
|
|
271
267
|
plugins: [voidPlugin(), voidSolid()],
|
|
272
268
|
});
|
|
273
269
|
```
|
|
274
270
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
```ts
|
|
278
|
-
function voidSolid(options?: VoidSolidOptions): Plugin[];
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**Options:**
|
|
282
|
-
|
|
283
|
-
```ts
|
|
284
|
-
interface VoidSolidOptions {
|
|
285
|
-
solid?: SolidPluginOptions; // passed through to vite-plugin-solid
|
|
286
|
-
viewTransitions?: boolean; // enable View Transitions API
|
|
287
|
-
prefetch?: {
|
|
288
|
-
defaultStrategy?: boolean | LinkPrefetchStrategy | LinkPrefetchStrategy[]; // default: false
|
|
289
|
-
hoverDelay?: number; // default: 75 (ms)
|
|
290
|
-
cacheFor?: number | string | [string, string]; // default: '30s'
|
|
291
|
-
};
|
|
292
|
-
deployRecovery?: boolean; // reload a tab whose build is gone. default: true
|
|
293
|
-
}
|
|
294
|
-
```
|
|
271
|
+
`VoidSolidOptions` accepts the [shared plugin options](#shared-plugin-options) and `solid` for the included `vite-plugin-solid` plugin.
|
|
295
272
|
|
|
296
273
|
### Solid Runtime {#solid-runtime}
|
|
297
274
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
| Export | Description |
|
|
301
|
-
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
302
|
-
| `Link` | Solid component for SPA navigation. Renders `<a>` for GET, `<button>` for non-GET methods. Props: `href`, `method`, `data`, `prefetch`, `cacheFor`, `preserveScroll`, `preserveState`, `replace`, `reloadDocument`, `viewTransition`, `activeMatch`, `onNavigate`. Adds `aria-current="page"` and `data-void-active` to the link to the current page ([active links](../../guide/pages-routing/overview.md#active-links)), and `data-void-pending` to links to a page while it loads ([pending links](../../guide/pages-routing/overview.md#pending-links)). |
|
|
303
|
-
| `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 }`. |
|
|
304
|
-
| `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). |
|
|
305
|
-
| `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). |
|
|
306
|
-
| `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). |
|
|
307
|
-
| `isCallSiteActionError(error)` | Recognizes the expected errors returned by `action()`, such as `409` or `422`. |
|
|
308
|
-
| `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()`. |
|
|
309
|
-
| `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). |
|
|
310
|
-
| `useRouter()` | Returns the Void Router with current route state (`url`, `path`, `query`, `params`) and navigation methods: `visit`, `refresh`, awaitable `prefetch`, `flush`, `flushAll`. |
|
|
311
|
-
| `useParams()` | Returns dynamic route params for the page currently being rendered. Pass the page's pattern as the type argument, such as `useParams<'/users/[id]'>()`, to type them. |
|
|
312
|
-
| `useNavigation()` | Returns pending navigation state: `{ state, location, method }`, where `state` is `"idle"`, `"loading"`, or `"submitting"` and `location` is the pending destination. |
|
|
313
|
-
|
|
314
|
-
Solid `Link` GET `data` is merged into the rendered `href` query string. Primitive values are serialized with `String(value)`, arrays become repeated keys, `null` and `undefined` are omitted, and nested objects throw. `prefetch` and `reloadDocument` are GET-only and throw for mutation links.
|
|
275
|
+
Import the [shared runtime API](#shared-runtime-api) from `@void/solid`.
|
|
315
276
|
|
|
316
277
|
Solid re-creates the page on GET navigation and whenever the route or its params change, so `useForm()` picks up the destination record's URL and defaults; layouts persist. Within the same record, back/forward, mutations, and `router.refresh()` keep the page and update its props in place, as do resolved deferred props, so read props inside JSX or memos instead of copying them in the component body. Set `preserveState` explicitly to override the default for navigation within the same record.
|
|
317
278
|
|
|
318
279
|
## Markdown Package {#markdown-package}
|
|
319
280
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
```ts
|
|
323
|
-
import { voidMarkdown } from '@void/md/plugin';
|
|
324
|
-
|
|
325
|
-
export default defineConfig({
|
|
326
|
-
plugins: [voidPlugin(), voidReact(), voidMarkdown()],
|
|
327
|
-
});
|
|
328
|
-
```
|
|
281
|
+
Install `@void/md` alongside your Pages adapter and add `voidMarkdown()` to your Vite plugins. See [Markdown Pages](../../guide/pages-routing/markdown.md) for setup.
|
|
329
282
|
|
|
330
283
|
| Import path | Contents |
|
|
331
284
|
| ---------------------------- | ---------------------------------------------------------------------------------------- |
|
|
@@ -337,8 +290,6 @@ export default defineConfig({
|
|
|
337
290
|
|
|
338
291
|
`FrontmatterContext` and `setFrontmatter()` are deprecated. Use `useFrontmatter()`.
|
|
339
292
|
|
|
340
|
-
See [Markdown Pages](../../guide/pages-routing/markdown.md) for setup and framework-specific examples.
|
|
341
|
-
|
|
342
293
|
## Form
|
|
343
294
|
|
|
344
295
|
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).
|
|
@@ -5,11 +5,13 @@ outline: deep
|
|
|
5
5
|
|
|
6
6
|
# Rewrites {#rewrites}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use the Hono context to [rewrite a request](../../guide/edge/rewrites.md) or read its original URL.
|
|
9
9
|
|
|
10
10
|
## `c.rewrite(destination)` {#c-rewrite-destination}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Serve the response from another route while keeping the original URL in the browser. For example, `c.rewrite("/search")` keeps the incoming query, while `c.rewrite("/search?q=void")` replaces it with `?q=void`.
|
|
13
|
+
|
|
14
|
+
Use a path starting with `/`. [`RewriteDestination`](#rewritedestination) suggests known routes in your editor and accepts strings for paths you build at runtime.
|
|
13
15
|
|
|
14
16
|
Pass a [`RouteDestination`](./types.md#route-types) object to check the route pattern and its parameters:
|
|
15
17
|
|
|
@@ -72,7 +74,7 @@ interface CloudContext {
|
|
|
72
74
|
**Caveats:**
|
|
73
75
|
|
|
74
76
|
- `destination` must start with a single `/` and point at an internal path. External URLs, protocol-relative destinations (`//host/...`), and anything non-path-absolute throw immediately — use `fetch()` for cross-origin calls.
|
|
75
|
-
- Destinations whose final path segment ends in a known static-asset extension (e.g. `/hero.png`, `/app.css`, `/data.json`) throw `VoidAssetRewriteError` (exported from `"void"`) before the re-dispatch. Runtime rewrites cannot reach assets — use a static `routing.rewrites` rule or a `_redirects` `200!` entry. `.html`
|
|
77
|
+
- Destinations whose final path segment ends in a known static-asset extension (e.g. `/hero.png`, `/app.css`, `/data.json`) throw `VoidAssetRewriteError` (exported from `"void"`) before the re-dispatch. Runtime rewrites cannot reach assets — use a static `routing.rewrites` rule or a `_redirects` `200!` entry. `.html` routes are allowed. See [Rewrites](../../guide/edge/rewrites.md#runtime-rewrites-cannot-reach-static-assets).
|
|
76
78
|
- Middleware re-runs on every rewrite hop. Guard side-effects with [`c.isRewritten()`](#c-originalurl-c-isrewritten).
|
|
77
79
|
- Client-side SPA navigation via `Link` does not trigger server rewrites; only full HTTP requests do.
|
|
78
80
|
- Purge the destination path to clear rewritten [ISR entries](../../guide/edge/revalidation.md#cache-keys-and-rewrites).
|
|
@@ -112,5 +114,3 @@ Suggests known route patterns in your editor while also accepting dynamic string
|
|
|
112
114
|
|
|
113
115
|
- The parameter type of [`c.rewrite()`](#c-rewrite-destination), unless `routing.typedRoutes` is on.
|
|
114
116
|
- The type of `destination` entries in `routing.rewrites` and `routing.fallbacks` in [`void.config.ts`](../config.md#routing).
|
|
115
|
-
|
|
116
|
-
Like [`RouteMap`](./types.md#routemap), `RewriteDestination` lives in the virtual `void/routes` module and is refreshed whenever routes change.
|
|
@@ -87,7 +87,9 @@ interface HeadDescriptor {
|
|
|
87
87
|
|
|
88
88
|
## `HeadConfig` {#headconfig}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
Use `HeadConfig` for a page’s `defineHead` result, middleware `headDefaults`, or the `head` field in `void.config.ts`. It accepts the fields in [`HeadDescriptor`](#headdescriptor) plus `titleTemplate`.
|
|
91
|
+
|
|
92
|
+
For example, `titleTemplate: "%s | My Site"` turns `About` into `About | My Site`. A page can supply its own template or set it to `""` to use the title as written. Otherwise Void uses the middleware template, then the one from `void.config.ts`.
|
|
91
93
|
|
|
92
94
|
```ts
|
|
93
95
|
type HeadConfig = HeadDescriptor & {
|
|
@@ -122,14 +124,16 @@ routeUrl('/users/[id]', {
|
|
|
122
124
|
// /users/42?tab=activity#details
|
|
123
125
|
```
|
|
124
126
|
|
|
125
|
-
| Option | Type
|
|
126
|
-
| -------- |
|
|
127
|
-
| `params` | Route-specific
|
|
128
|
-
| `query` | `
|
|
129
|
-
| `hash` | `string`
|
|
127
|
+
| Option | Type | Description |
|
|
128
|
+
| -------- | ------------------- | ---------------------------------------------------------------------------------- |
|
|
129
|
+
| `params` | Route-specific | Required for dynamic routes. Each parameter accepts a `string` or `number`. |
|
|
130
|
+
| `query` | `PageQueryInput<P>` | Query parameters. Arrays become repeated keys; `null` and `undefined` are omitted. |
|
|
131
|
+
| `hash` | `string` | URL fragment, such as `'details'` or `'#details'`. |
|
|
130
132
|
|
|
131
133
|
Static routes accept optional `query` and `hash` options. Pass raw parameter values for URL encoding. Catch-all parameters preserve `/` separators between segments. Invalid or missing path parameters throw a `TypeError`.
|
|
132
134
|
|
|
135
|
+
For a page with a `query` schema, `PageQueryInput<P>` checks its input keys and values. If a key is required, pass `query`. Values other than strings, numbers, and booleans use their string form in the URL. Pages without a schema accept `RouteQuery`. See [Page query](../../guide/type-safety.md#page-query) for an example.
|
|
136
|
+
|
|
133
137
|
Use the returned [`RouteUrl`](#route-types) with `Link`, `<a>`, and `c.redirect()`. See [Typed URLs and Navigation](../../guide/type-safety.md#typed-urls-and-navigation) for setup and examples.
|
|
134
138
|
|
|
135
139
|
### Route types {#route-types}
|
|
@@ -143,6 +147,9 @@ Import these types from `void/routes`:
|
|
|
143
147
|
| `PagePathMap` | Generated map of page patterns to their parameter names. |
|
|
144
148
|
| `PagePath` | Union of the page patterns in `PagePathMap`; accepted by `useParams()`. |
|
|
145
149
|
| `PageParams<P>` | The params page `P` receives, such as `{ id: string }` for `/users/[id]`. |
|
|
150
|
+
| `PageQueryMap` | Generated map of page patterns to a loader's query schema input and output types. |
|
|
151
|
+
| `PageQueryInput<P>` | Query values a link to page `P` accepts; `RouteQuery` when the page has no query schema. |
|
|
152
|
+
| `PageQuery<P>` | Query values page `P` reads: validated ones when it sets `exposeQuery`, else the query strings. |
|
|
146
153
|
| `RouteOptions<P>` | Options for a route pattern `P`, including its required `params`, optional `query`, and `hash`. |
|
|
147
154
|
| `RouteDestination<P>` | `{ pathname: P }` with `RouteOptions<P>`. Defaults to all known routes when `P` is omitted. |
|
|
148
155
|
| `RouteUrl` | The URL of one of your routes, returned by `routeUrl()`. `string` unless `typedRoutes` is on. |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Define a Cloudflare Workflow, start instances, and check their status with void/workflows.'
|
|
3
|
+
outline: deep
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Workflows
|
|
7
|
+
|
|
8
|
+
Import the Workflow helpers from `void/workflows` in server code. The [Workflows guide](../../guide/workflows.md) shows how to schedule a post and start an instance from a route.
|
|
9
|
+
|
|
10
|
+
## `defineWorkflow(definition)` {#defineworkflow-definition}
|
|
11
|
+
|
|
12
|
+
Default-export the definition from a file in `workflows/`. Only `run` is required:
|
|
13
|
+
|
|
14
|
+
- **`run(event, step, { env, ctx })`** receives the instance event, Cloudflare's `WorkflowStep`, your app's typed Worker bindings, and its execution context. The value you return is available as `output` on the completed instance's status.
|
|
15
|
+
- **`params`** accepts a Standard Schema. Callers send its input type. Void validates the payload when the instance starts and passes the schema's output to `run` as `event.payload`. Validation also applies to instances started through Cloudflare.
|
|
16
|
+
- **`name`** pins the resource identity when you rename or move the file. Run `void info` to see which name to use.
|
|
17
|
+
|
|
18
|
+
With no schema, annotate the event as `WorkflowEvent<MyParams>` or supply the type as `defineWorkflow<MyParams>()`. The default environment type is `CloudBindings`, just like `c.env` in a route. You can supply your own environment type with `defineWorkflow<MyParams, MyEnv>()`.
|
|
19
|
+
|
|
20
|
+
Cloudflare delivers an empty object when a caller omits params. If a schema should supply defaults in that case, make it accept `{}`. The handler receives exactly what the schema returns, including `undefined`.
|
|
21
|
+
|
|
22
|
+
## `defineWorkflowEntrypoint(definition)` {#defineworkflowentrypoint-definition}
|
|
23
|
+
|
|
24
|
+
Use `defineWorkflowEntrypoint({ class: MyWorkflow })` to register a native Cloudflare `WorkflowEntrypoint` class. You can also pass a `name` to pin its identity. Void infers the payload type from the class's `run(event, step)` method. Callers can omit params when that type accepts an empty object.
|
|
25
|
+
|
|
26
|
+
## `WorkflowApi` {#workflowapi}
|
|
27
|
+
|
|
28
|
+
Use the default export to start instances or get an existing one:
|
|
29
|
+
|
|
30
|
+
| Member | What you can do |
|
|
31
|
+
| -------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| `create(options?)` | Start one instance. Pass `params` when the definition requires input. Use `id` to choose the instance ID. |
|
|
33
|
+
| `createBatch({ instances })` | Start up to 100 instances with individual IDs and options. Each entry accepts the same options as `create()`. |
|
|
34
|
+
| `createBatch({ count, params })` | Start 1–100 instances with generated IDs and shared options. You can also pass `retention` and `locationHint`. |
|
|
35
|
+
| `get(id)` | Get an instance to read its status, send it an event, pause, resume, restart, or terminate it. |
|
|
36
|
+
| `class` | Access the registered entrypoint class. |
|
|
37
|
+
|
|
38
|
+
Both batch forms return `{ created, errors }`. Check `errors` for entries that could not start; each includes its `index`, `id`, `code`, and `message`. Use `status()` on a created instance to check the outcome of its run. See the [Cloudflare batch API](https://developers.cloudflare.com/workflows/build/workers-api/#createbatch).
|
|
39
|
+
|
|
40
|
+
You can pass an explicit binding as the first argument to `create()`, `createBatch()`, or `get()`. After `void prepare`, TypeScript checks calls such as `PublishPost.create(c.env.WORKFLOW_PUBLISH_POST, { params })` against the Workflow's input type.
|
|
41
|
+
|
|
42
|
+
## `WorkflowParamsError` {#workflowparamserror}
|
|
43
|
+
|
|
44
|
+
Void throws `WorkflowParamsError` at the entrypoint when the schema rejects the incoming payload. Its `issues` array contains a message and an optional field path for each problem. The instance fails before your `run` callback executes. Use `await instance.status()` to inspect the failure.
|
|
45
|
+
|
|
46
|
+
## Types {#types}
|
|
47
|
+
|
|
48
|
+
`WorkflowEvent`, `WorkflowStep`, `WorkflowContext`, `WorkflowCreateOptions`, `WorkflowBatchOptions`, `WorkflowApi`, and `WorkflowRun` are available from `void/workflows`.
|