void 1.6.1 → 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-DRhmCWcm.mjs → account-cmd-BfkJ_1PC.mjs} +6 -6
- package/dist/{application-analysis-HRFsZOv3.mjs → application-analysis-OV0CBJ80.mjs} +8 -19
- package/dist/{application-routing-P4TggvWp.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-CVXP1G6G.mjs → auth-link-CW1Zh6FM.mjs} +6 -6
- package/dist/{auth-router-D1pGdbvB.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-CEu-1Ps_.mjs → cloudflare-auth-DGIivpTb.mjs} +1 -1
- package/dist/{cloudflare-cmd-fZ6AMSWk.mjs → cloudflare-cmd-DJaxC-bc.mjs} +5 -5
- package/dist/{cloudflare-config-eQunqX6A.mjs → cloudflare-config-DtOGAbeB.mjs} +3 -3
- package/dist/{cloudflare-connect-9OZe4XVQ.mjs → cloudflare-connect-BjpWmglw.mjs} +3 -3
- package/dist/{cloudflare-operations-oLvAd9Nd.mjs → cloudflare-operations-CZkjFrzH.mjs} +1 -1
- package/dist/{cloudflare-operations-CrskD4_O.mjs → cloudflare-operations-k7wYUv56.mjs} +6 -6
- package/dist/{cloudflare-process-DjJ638A-.mjs → cloudflare-process-BcPvlMFd.mjs} +3 -3
- package/dist/{config-BITKQ3O6.mjs → config-5oSQhZNj.mjs} +7 -5
- package/dist/{config-CPxJmt4M.d.mts → config-CTlUaXWZ.d.mts} +3 -1
- package/dist/{config-BBlVXZCU.mjs → config-DcqUBGCb.mjs} +3 -3
- package/dist/{config-WlvEcL82.mjs → config-eeDzKBS9.mjs} +2 -2
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-BgysUhnm.mjs → config-wo2EaH0X.mjs} +1 -1
- package/dist/{connect-CKvmkl2R.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-DjtGAcOz.mjs → db-DyLzzxvM.mjs} +39 -39
- package/dist/{db-types-C_8amnB0.mjs → db-types-DdHHUVPy.mjs} +1 -1
- package/dist/{delete-CY4L8fi2.mjs → delete-Dey6YoMA.mjs} +5 -5
- package/dist/{deploy-D_gEojD2.mjs → deploy-Ccw2D2lw.mjs} +507 -122
- package/dist/deploy-DEZkUS77.mjs +2 -0
- package/dist/{deploy-managed-static-BHVbB_-A.mjs → deploy-managed-static-BBVtpuGv.mjs} +18 -18
- package/dist/{deploy-transport-DEyOUfac.mjs → deploy-transport-Dt0IvSVW.mjs} +2 -2
- package/dist/deploy.mjs +8 -8
- package/dist/discover-1DJD4YXD.mjs +1 -0
- package/dist/{discover-Dhkzxgdt.mjs → discover-CVFCWU7W.mjs} +1 -1
- package/dist/{dispatch-BNLB5_Gm.mjs → dispatch-pYaww76u.mjs} +6 -6
- package/dist/{dist-D23AAMxT.mjs → dist-BQdgCVQF.mjs} +1 -1
- package/dist/{dist-eV_Ep60B.mjs → dist-DeTdhbZc.mjs} +1 -1
- package/dist/{domain-BlH90Ods.mjs → domain-Dh3mG8Vs.mjs} +6 -6
- package/dist/{email-Bkq8ZL1p.mjs → email-DKyMjOYM.mjs} +11 -11
- package/dist/{email-cloudflare-MvJIxrwx.mjs → email-cloudflare-CTt2n_W2.mjs} +13 -9
- package/dist/{entry-CBZsCy3O.mjs → entry-Bw-G1VVx.mjs} +2 -2
- package/dist/{env-AvuCSeCH.mjs → env-DkZzh_Dd.mjs} +7 -7
- package/dist/env-mask-D31Qztl9.mjs +46 -0
- package/dist/{env-types-DqzVBKnS.mjs → env-types-Dz9qkiOn.mjs} +1 -1
- package/dist/{env-validation-GV1oD4EV.mjs → env-validation-1snjKtDX.mjs} +4 -4
- package/dist/{env-validation-C8Cmvas0.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-B9bCV5qu.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-CKeTtYID.mjs → handler-C9SnmeW1.mjs} +6 -5
- package/dist/{handler-BR6Tvjkp.d.mts → handler-DjqciiDc.d.mts} +20 -7
- package/dist/{headers-CuTEdP9C.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 +155 -110
- package/dist/{info-CJxua_db.mjs → info-DwB8IWIx.mjs} +4 -4
- package/dist/{init-B-4CluYx.mjs → init-CUGSmcED.mjs} +34 -32
- package/dist/{link-DAXOT-G_.mjs → link-BlRTGHan.mjs} +6 -6
- package/dist/{list-BYSOo9fm.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-BLgsNUj9.mjs → local-d1-CFcH9Bx3.mjs} +2 -2
- package/dist/login-C4q1S-5b.mjs +1 -0
- package/dist/{login-CJopTWX4.mjs → login-TA51e5Fw.mjs} +5 -5
- package/dist/{logs-DE0weBsR.mjs → logs-BlyAxlvx.mjs} +6 -6
- package/dist/{migrate-ChHHZBTi.mjs → migrate-BH6LCr00.mjs} +6 -6
- package/dist/migrate-CVBsSFhC.mjs +1 -0
- package/dist/nitro.d.mts +5 -0
- package/dist/nitro.mjs +27 -8
- package/dist/{node-CZ6lGNLn.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-BUqsdk2K.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 +18 -13
- package/dist/pages/client.mjs +40 -69
- package/dist/pages/index.d.mts +4 -3
- package/dist/pages/index.mjs +11 -7
- 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-K4m_LE8b.mjs → platform-auth-config-MO0VdVs9.mjs} +10 -10
- package/dist/{platform-auth-protection-KF5Vo-1I.mjs → platform-auth-protection-Dv208eyL.mjs} +8 -8
- package/dist/{platform-auth-recovery-BOdFrl7R.mjs → platform-auth-recovery-DvAQ674F.mjs} +7 -7
- package/dist/{platform-cmd-DpCHawGF.mjs → platform-cmd-BpUA19r_.mjs} +1 -1
- package/dist/{platform-cmd-Ds3EAV5t.mjs → platform-cmd-dlSxrcQ7.mjs} +9 -9
- package/dist/{platform-domain-rWJshybd.mjs → platform-domain-DSO4eUEw.mjs} +5 -5
- package/dist/{platform-lifecycle-D9RdGub1.mjs → platform-lifecycle-BSvsyB_x.mjs} +17 -17
- package/dist/{platform-lifecycle-BH34I0rh.mjs → platform-lifecycle-CfcFygHb.mjs} +1 -1
- package/dist/{platform-management-BfLW0Zlo.mjs → platform-management-BMdyt667.mjs} +1 -1
- package/dist/{platform-management-BRefdHGD.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-DZuZGJtt.mjs → platform-recovery-CHWwXVZ6.mjs} +3 -3
- package/dist/{platform-setup-Vw1AaUN8.mjs → platform-setup-BTQVbnTC.mjs} +3 -3
- package/dist/{plugin-inference-CdLbxZL_.mjs → plugin-inference-g66Q1Mx9.mjs} +5 -8
- package/dist/prepare-Bx4a8cb1.mjs +1 -0
- package/dist/{prepare-BuNbuFlA.mjs → prepare-DJYHjpzq.mjs} +3 -3
- package/dist/{prepare-BerOZiD4.mjs → prepare-DXduEwQp.mjs} +12 -9
- 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-B_bUyZ3J.mjs → project-cmd-Dfb1Sg8w.mjs} +18 -18
- package/dist/{project-paths-CdGv9Tmi.mjs → project-paths-G0yut6Zz.mjs} +12 -8
- 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-Cf2NFjlM.mjs → project-tsconfig-nhnTWO_Y.mjs} +4 -2
- 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-DQF6Kw-6.mjs → provision-CMH4-8ri.mjs} +1 -1
- package/dist/{provision-BbCzpbXs.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-BgL0wY1J.mjs → rollback-BfCs2la4.mjs} +7 -7
- package/dist/{route-types-CZc1YXjF.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 +94 -12
- 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-X2rDDRNa.mjs → scan-L8OSv1f7.mjs} +68 -19
- package/dist/{secret-CPq-B_vp.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-C8hLzQkv.mjs → version-metadata-eUd6Ar_U.mjs} +1 -1
- package/dist/wrangler-R3kMdJfw.mjs +1 -0
- package/dist/{wrangler-DESSbN8L.mjs → wrangler-k40T7XTQ.mjs} +3 -3
- package/dist/{wrapper-C9SUxoj7.mjs → wrapper-BGsi_uHs.mjs} +12 -9
- 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/headers.md +3 -1
- package/docs/guide/edge/prerendering.md +9 -4
- package/docs/guide/edge/redirects.md +1 -0
- package/docs/guide/edge/revalidation.md +3 -0
- package/docs/guide/edge/static-assets.md +1 -1
- package/docs/guide/live.md +2 -0
- package/docs/guide/pages-routing/actions-and-forms.md +29 -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/server-routing.md +14 -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 +16 -8
- package/docs/reference/api/resources.md +3 -1
- package/docs/reference/api/rewrites.md +19 -5
- 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-B029oHlE.mjs +0 -2
- package/dist/discover-D4mQthao.mjs +0 -1
- package/dist/gen-cCxrFp9L.mjs +0 -1
- package/dist/help-Ba8Dq5-r.mjs +0 -1
- package/dist/login-BpbYeu-n.mjs +0 -1
- package/dist/migrate-HdA6Kh2p.mjs +0 -1
- package/dist/operator-cmd-wBYyp8iQ.mjs +0 -1
- package/dist/output-E6gecbbV.mjs +0 -1
- package/dist/platform-args-C7XUw9mw.mjs +0 -1
- package/dist/prepare-Cz18kLkF.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-DUB3MGHV.mjs +0 -1
- package/dist/{cf-access-BmBT2h8_.mjs → cf-access-Dnyw8KFY.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
|
@@ -2,7 +2,8 @@ import { a as executeComposedHandler, i as separateDeferred, n as DEFERRED, o as
|
|
|
2
2
|
import { n as isConvertedResponse } from "./response-HmNjB30w.mjs";
|
|
3
3
|
import { i as searchWithoutActionKey, n as hasActionKey } from "./action-key-XtKKbbsi.mjs";
|
|
4
4
|
import { i as resolveHead, n as renderHeadToString, r as renderHtmlAttrs, t as renderBodyAttrs } from "./head-5XPcnG-j.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as serializePageData, o as escapeScriptJson } from "./serialize-Pf-CIQK_.mjs";
|
|
6
|
+
import { PAGES_PROTOCOL_VERSION } from "@void/edge";
|
|
6
7
|
// src/pages/protocol.ts
|
|
7
8
|
const POWERED_BY = { "X-Powered-By": "Void" };
|
|
8
9
|
const RENDER_ERROR_ASSET_TAGS_KEY = "__voidPageAssetTags";
|
|
@@ -13,9 +14,25 @@ function safeJsonStringify(value) {
|
|
|
13
14
|
function isPagesRequest(c) {
|
|
14
15
|
return c.req.header("x-voidpages") === "true";
|
|
15
16
|
}
|
|
17
|
+
function needsPageReload(c) {
|
|
18
|
+
return isPagesRequest(c) && c.req.header("X-VoidPages-Version") !== PAGES_PROTOCOL_VERSION;
|
|
19
|
+
}
|
|
20
|
+
/** Old clients reload a successful non-Pages response; form errors stay readable. */
|
|
21
|
+
function legacyPageResponse(c, errors = null) {
|
|
22
|
+
const headers = pageResponseHeaders(c, {
|
|
23
|
+
"Content-Type": errors ? "application/json" : "text/plain; charset=utf-8",
|
|
24
|
+
"Cache-Control": "no-store",
|
|
25
|
+
Vary: "X-VoidPages, X-VoidPages-Version"
|
|
26
|
+
});
|
|
27
|
+
headers.delete("X-VoidPages");
|
|
28
|
+
return new Response(errors ? JSON.stringify({ errors }) : null, {
|
|
29
|
+
status: errors ? 422 : 200,
|
|
30
|
+
headers
|
|
31
|
+
});
|
|
32
|
+
}
|
|
16
33
|
function pageResponseHeaders(c, headers) {
|
|
17
34
|
const out = new Headers(c.res.headers);
|
|
18
|
-
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "vary") appendVary(out,
|
|
35
|
+
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "vary") for (const name of value.split(",")) appendVary(out, name.trim());
|
|
19
36
|
else out.set(key, value);
|
|
20
37
|
return out;
|
|
21
38
|
}
|
|
@@ -23,6 +40,12 @@ function appendVary(headers, name) {
|
|
|
23
40
|
const existing = headers.get("Vary")?.split(",").map((value) => value.trim().toLowerCase()) ?? [];
|
|
24
41
|
if (!existing.includes("*") && !existing.includes(name.toLowerCase())) headers.append("Vary", name);
|
|
25
42
|
}
|
|
43
|
+
function varyPagesResponse(c) {
|
|
44
|
+
const headers = new Headers(c.res.headers);
|
|
45
|
+
appendVary(headers, "X-VoidPages");
|
|
46
|
+
appendVary(headers, "X-VoidPages-Version");
|
|
47
|
+
c.header("Vary", headers.get("Vary"));
|
|
48
|
+
}
|
|
26
49
|
function escapeHtmlAttr(value) {
|
|
27
50
|
return value.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<");
|
|
28
51
|
}
|
|
@@ -112,9 +135,11 @@ async function renderPageHtml(c, pageObj, componentId, renderMode, renderFn, get
|
|
|
112
135
|
};
|
|
113
136
|
}
|
|
114
137
|
function pageJsonResponse(c, pageObj) {
|
|
115
|
-
return Response
|
|
138
|
+
return new Response(serializePageData(pageObj), { headers: pageResponseHeaders(c, {
|
|
116
139
|
"X-VoidPages": "true",
|
|
117
|
-
|
|
140
|
+
"X-VoidPages-Version": PAGES_PROTOCOL_VERSION,
|
|
141
|
+
"Content-Type": "application/json",
|
|
142
|
+
Vary: "X-VoidPages, X-VoidPages-Version",
|
|
118
143
|
...POWERED_BY
|
|
119
144
|
}) });
|
|
120
145
|
}
|
|
@@ -224,14 +249,22 @@ function streamDeferredResponse(initialChunk, deferredMap, c, contentType, dev,
|
|
|
224
249
|
});
|
|
225
250
|
return renderedResponse(c, readable, contentType, assetTags);
|
|
226
251
|
}
|
|
252
|
+
function asCloudContext(c) {
|
|
253
|
+
return c;
|
|
254
|
+
}
|
|
227
255
|
/** Handle GET page request — run handler, return page object or SSR HTML */
|
|
228
256
|
async function handlePageGet(handler, headFn, c, componentId, renderFn, getAssetTags, configHead, options) {
|
|
257
|
+
return runPageGet(handler, headFn, asCloudContext(c), componentId, renderFn, getAssetTags, configHead, options);
|
|
258
|
+
}
|
|
259
|
+
async function runPageGet(handler, headFn, c, componentId, renderFn, getAssetTags, configHead, options) {
|
|
229
260
|
const renderMode = options?.renderMode ?? "server";
|
|
261
|
+
if (renderMode !== "island" && needsPageReload(c)) return legacyPageResponse(c);
|
|
230
262
|
return runLoader(handler, c, async (props) => {
|
|
231
263
|
const shared = c.get("shared") ?? {};
|
|
232
264
|
const pageHead = headFn ? headFn(c, props) : void 0;
|
|
233
265
|
const middlewareHead = c.get("headDefaults");
|
|
234
266
|
const head = resolveHead(configHead, middlewareHead, pageHead);
|
|
267
|
+
if (renderMode !== "island") varyPagesResponse(c);
|
|
235
268
|
const { immediateProps, deferredMap } = separateDeferred(props);
|
|
236
269
|
const hasDeferred = Object.keys(deferredMap).length > 0;
|
|
237
270
|
const deferredKeys = {};
|
|
@@ -275,13 +308,11 @@ async function handlePageGet(handler, headFn, c, componentId, renderFn, getAsset
|
|
|
275
308
|
}
|
|
276
309
|
if (!hasDeferred) return pageJsonResponse(c, pageObj);
|
|
277
310
|
c.header("X-VoidPages", "true");
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
c.header("Vary", headers.get("Vary"));
|
|
281
|
-
return streamDeferredResponse(JSON.stringify(pageObj) + "\n", deferredMap, c, "application/x-ndjson", options?.dev === true, (group, data) => JSON.stringify({
|
|
311
|
+
c.header("X-VoidPages-Version", PAGES_PROTOCOL_VERSION);
|
|
312
|
+
return streamDeferredResponse(serializePageData(pageObj) + "\n", deferredMap, c, "application/x-ndjson", options?.dev === true, (group, data) => serializePageData({
|
|
282
313
|
__deferred: group,
|
|
283
|
-
data
|
|
284
|
-
}) + "\n", (group, error) =>
|
|
314
|
+
data
|
|
315
|
+
}) + "\n", (group, error) => serializePageData({
|
|
285
316
|
__deferred: group,
|
|
286
317
|
error
|
|
287
318
|
}) + "\n");
|
|
@@ -290,7 +321,7 @@ async function handlePageGet(handler, headFn, c, componentId, renderFn, getAsset
|
|
|
290
321
|
if (!hasDeferred) return renderedResponse(c, html, "text/html; charset=utf-8", assetTags);
|
|
291
322
|
return streamDeferredResponse(html, deferredMap, c, "text/html; charset=utf-8", options?.dev === true, (group, data) => {
|
|
292
323
|
const g = safeJsonStringify(group);
|
|
293
|
-
return `\n<script>(function(d){window.__resolveDeferred?window.__resolveDeferred(${g},d):(window.__deferredQueue??=[]).push([${g},d])})(${
|
|
324
|
+
return `\n<script>(function(d){window.__resolveDeferred?window.__resolveDeferred(${g},d,true):(window.__deferredQueue??=[]).push([${g},d,0,true])})(${serializePageData(data)})<\/script>`;
|
|
294
325
|
}, (group, error) => {
|
|
295
326
|
const g = safeJsonStringify(group);
|
|
296
327
|
return `\n<script>(function(e){window.__rejectDeferred?window.__rejectDeferred(${g},e):(window.__deferredQueue??=[]).push([${g},0,e])})(${safeJsonStringify(error)})<\/script>`;
|
|
@@ -313,6 +344,9 @@ function isSameOriginAction(request) {
|
|
|
313
344
|
}
|
|
314
345
|
/** Handle POST/PUT/PATCH/DELETE page request — run mutation, then re-run GET or redirect */
|
|
315
346
|
async function handlePageMutation(mutationHandler, getHandler, headFn, c, componentId, renderFn, getAssetTags, configHead, options) {
|
|
347
|
+
return runPageMutation(mutationHandler, getHandler, headFn, asCloudContext(c), componentId, renderFn, getAssetTags, configHead, options);
|
|
348
|
+
}
|
|
349
|
+
async function runPageMutation(mutationHandler, getHandler, headFn, c, componentId, renderFn, getAssetTags, configHead, options) {
|
|
316
350
|
if (!isSameOriginAction(c.req.raw)) return new Response("Cross-origin page actions are not allowed.", { status: 403 });
|
|
317
351
|
const renderMode = options?.renderMode ?? "server";
|
|
318
352
|
function buildMutationPageObj(props, errors) {
|
|
@@ -333,9 +367,11 @@ async function handlePageMutation(mutationHandler, getHandler, headFn, c, compon
|
|
|
333
367
|
const rerenderErrors = /* @__PURE__ */ new WeakSet();
|
|
334
368
|
/** Re-run the GET loader and respond with the page, optionally carrying validation errors. */
|
|
335
369
|
async function respondWithPage(errors) {
|
|
370
|
+
if (needsPageReload(c)) return legacyPageResponse(c, errors);
|
|
336
371
|
try {
|
|
337
372
|
return await runLoader(getHandler, c, async (props) => {
|
|
338
373
|
const pageObj = buildMutationPageObj(stripDeferred(props), errors);
|
|
374
|
+
varyPagesResponse(c);
|
|
339
375
|
if (isPagesRequest(c)) return pageJsonResponse(c, pageObj);
|
|
340
376
|
const { html, assetTags } = await renderPageHtml(c, pageObj, componentId, renderMode, renderFn, getAssetTags);
|
|
341
377
|
return renderedResponse(c, html, "text/html; charset=utf-8", assetTags);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { f as isRealD1Id, p as isRealHyperdriveId } from "./provision-
|
|
1
|
+
export { f as isRealD1Id, p as isRealHyperdriveId } from "./provision-D5q-ptD3.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as join, c as resolve$2, n as dirname, o as normalize, t as basename } from "./dist-DMYe8CZJ.mjs";
|
|
2
2
|
import { i as voidWarn, r as voidLog } from "./log-D9hwSySP.mjs";
|
|
3
|
-
import { M as writeProvisionedWranglerConfig, _ as persistMaterializedWranglerConfig, s as assertNoDuplicateMembers, y as readProvisionedBindingEntry } from "./wrangler-DESSbN8L.mjs";
|
|
4
3
|
import { n as scanWranglerDotenvKeys } from "./dotenv-CEI8hapP.mjs";
|
|
5
|
-
import { l as resolveCloudflareOperationArgv, n as decodeCloudflareOperationResult, r as encodeCloudflareOperation } from "./cloudflare-process-
|
|
4
|
+
import { l as resolveCloudflareOperationArgv, n as decodeCloudflareOperationResult, r as encodeCloudflareOperation } from "./cloudflare-process-BcPvlMFd.mjs";
|
|
5
|
+
import { M as writeProvisionedWranglerConfig, _ as persistMaterializedWranglerConfig, s as assertNoDuplicateMembers, y as readProvisionedBindingEntry } from "./wrangler-k40T7XTQ.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { closeSync, existsSync, fsyncSync, lstatSync, openSync, readFileSync, readlinkSync, realpathSync, renameSync, unlinkSync, writeSync } from "node:fs";
|
|
8
8
|
import { isRecord } from "@void/deploy-core";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { H as outro, L as log } from "./dist-BQdgCVQF.mjs";
|
|
2
|
+
import { c as getToken } from "./auth-CCk9Seol.mjs";
|
|
3
|
+
import { r as PlatformClient } from "./client-BEZmTP6p.mjs";
|
|
4
|
+
import { f as import_picocolors, i as dim } from "./output-CXJTIAtF.mjs";
|
|
1
5
|
import { r as readProjectConfig } from "./project-CLwxcEdq.mjs";
|
|
2
|
-
import { c as getToken } from "./auth-Dy8svcqQ.mjs";
|
|
3
|
-
import { H as outro, L as log } from "./dist-D23AAMxT.mjs";
|
|
4
|
-
import { r as PlatformClient } from "./client-CoxPEhJq.mjs";
|
|
5
|
-
import { f as import_picocolors, i as dim } from "./output-BCdLioKP.mjs";
|
|
6
6
|
// src/cli/requests.ts
|
|
7
7
|
async function runRequestsCommand(root, range, status) {
|
|
8
8
|
console.log();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as inferDefaultSlug } from "./resolve-project-ClvLMTI9.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { L as log } from "./dist-BQdgCVQF.mjs";
|
|
1
2
|
import { a as join } from "./dist-DMYe8CZJ.mjs";
|
|
2
3
|
import { r as readProjectConfig } from "./project-CLwxcEdq.mjs";
|
|
3
|
-
import { L as log } from "./dist-D23AAMxT.mjs";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
// src/cli/resolve-project.ts
|
|
6
6
|
function getRequestedProjectSlug(options) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { A as confirm, H as outro, K as select, L as log, O as cancel, tt as isCancel } from "./dist-BQdgCVQF.mjs";
|
|
2
|
+
import { c as getToken } from "./auth-CCk9Seol.mjs";
|
|
3
|
+
import { r as PlatformClient } from "./client-BEZmTP6p.mjs";
|
|
4
|
+
import { c as formatRelativeTime, i as dim, m as printSuccess, o as formatCount, r as createSpinner } from "./output-CXJTIAtF.mjs";
|
|
1
5
|
import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-CLwxcEdq.mjs";
|
|
2
|
-
import { c as getToken } from "./auth-Dy8svcqQ.mjs";
|
|
3
|
-
import { A as confirm, H as outro, K as select, L as log, O as cancel, tt as isCancel } from "./dist-D23AAMxT.mjs";
|
|
4
|
-
import { r as PlatformClient } from "./client-CoxPEhJq.mjs";
|
|
5
|
-
import { c as formatRelativeTime, i as dim, m as printSuccess, o as formatCount, r as createSpinner } from "./output-BCdLioKP.mjs";
|
|
6
6
|
// src/cli/rollback.ts
|
|
7
7
|
async function runRollbackCommand(root, deployId, explicitPlatform) {
|
|
8
8
|
console.log();
|
|
@@ -74,7 +74,7 @@ async function runRollbackCommand(root, deployId, explicitPlatform) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async function runCloudflareRollback(root, deployId, restorePlatformFlag) {
|
|
77
|
-
const { activateCloudflareExistingVersion, readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-
|
|
77
|
+
const { activateCloudflareExistingVersion, readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-CZkjFrzH.mjs");
|
|
78
78
|
const context = resolveCloudflareOperationContext(root);
|
|
79
79
|
const status = await readCloudflareWorkerStatus(context);
|
|
80
80
|
const deployedVersionIds = new Set(status.deployedVersionIds);
|
|
@@ -100,7 +100,7 @@ async function runCloudflareRollback(root, deployId, restorePlatformFlag) {
|
|
|
100
100
|
options: candidates.map((version) => ({
|
|
101
101
|
value: version.id,
|
|
102
102
|
label: `${version.id} ${dim(version.createdAt ? formatRelativeTime(version.createdAt) : "")}`,
|
|
103
|
-
hint: version.metadata ? formatCount(version.metadata.migrations.length, "migration") : "migration state unknown"
|
|
103
|
+
hint: version.metadata?.migrations ? formatCount(version.metadata.migrations.length, "migration") : "migration state unknown"
|
|
104
104
|
}))
|
|
105
105
|
});
|
|
106
106
|
if (isCancel(result)) {
|
|
@@ -111,7 +111,7 @@ async function runCloudflareRollback(root, deployId, restorePlatformFlag) {
|
|
|
111
111
|
}
|
|
112
112
|
const current = status.versions.find((version) => version.id === status.activeVersionId);
|
|
113
113
|
if (target.metadata?.schema !== 2 || current?.metadata?.schema !== 2 || target.metadata.triggerConfig.preserve || current.metadata.triggerConfig.preserve) log.info("This rollback keeps the current domains, routes, and schedules. The selected version has no complete trigger snapshot.");
|
|
114
|
-
if (!current?.metadata || !target.metadata) {
|
|
114
|
+
if (!current?.metadata?.migrations || !target.metadata?.migrations) {
|
|
115
115
|
log.warn("Void migration metadata is unavailable for one of these versions. Database migrations are forward-only and will not be reverted.");
|
|
116
116
|
await confirmRollbackOrExit();
|
|
117
117
|
} else {
|
|
@@ -1,6 +1,212 @@
|
|
|
1
1
|
import { a as join, s as relative } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
-
import { i as writeFileIfChanged } from "./project-tsconfig-
|
|
2
|
+
import { i as writeFileIfChanged } from "./project-tsconfig-nhnTWO_Y.mjs";
|
|
3
3
|
import { existsSync, rmSync } from "node:fs";
|
|
4
|
+
// src/codegen/binding-types.ts
|
|
5
|
+
const bindingTypes = [
|
|
6
|
+
[
|
|
7
|
+
"kv_namespaces",
|
|
8
|
+
"binding",
|
|
9
|
+
"KVNamespace"
|
|
10
|
+
],
|
|
11
|
+
[
|
|
12
|
+
"d1_databases",
|
|
13
|
+
"binding",
|
|
14
|
+
"D1Database"
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
"r2_buckets",
|
|
18
|
+
"binding",
|
|
19
|
+
"R2Bucket"
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"services",
|
|
23
|
+
"binding",
|
|
24
|
+
"Fetcher"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"queues.producers",
|
|
28
|
+
"binding",
|
|
29
|
+
"Queue"
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
"durable_objects.bindings",
|
|
33
|
+
"name",
|
|
34
|
+
"DurableObjectNamespace"
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
"workflows",
|
|
38
|
+
"binding",
|
|
39
|
+
"Workflow"
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"hyperdrive",
|
|
43
|
+
"binding",
|
|
44
|
+
"Hyperdrive"
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"vectorize",
|
|
48
|
+
"binding",
|
|
49
|
+
"VectorizeIndex"
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"analytics_engine_datasets",
|
|
53
|
+
"binding",
|
|
54
|
+
"AnalyticsEngineDataset"
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"send_email",
|
|
58
|
+
"name",
|
|
59
|
+
"SendEmail"
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"ratelimits",
|
|
63
|
+
"name",
|
|
64
|
+
"RateLimit"
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"dispatch_namespaces",
|
|
68
|
+
"binding",
|
|
69
|
+
"DispatchNamespace"
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"mtls_certificates",
|
|
73
|
+
"binding",
|
|
74
|
+
"Fetcher"
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"secrets_store_secrets",
|
|
78
|
+
"binding",
|
|
79
|
+
"SecretsStoreSecret"
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"worker_loaders",
|
|
83
|
+
"binding",
|
|
84
|
+
"WorkerLoader"
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"vpc_services",
|
|
88
|
+
"binding",
|
|
89
|
+
"Fetcher"
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"vpc_networks",
|
|
93
|
+
"binding",
|
|
94
|
+
"Fetcher"
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
"ai_search_namespaces",
|
|
98
|
+
"binding",
|
|
99
|
+
"AiSearchNamespace"
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"ai_search",
|
|
103
|
+
"binding",
|
|
104
|
+
"AiSearchInstance"
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"agent_memory",
|
|
108
|
+
"binding",
|
|
109
|
+
"AgentMemoryNamespace"
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"artifacts",
|
|
113
|
+
"binding",
|
|
114
|
+
"Artifacts"
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"flagship",
|
|
118
|
+
"binding",
|
|
119
|
+
"Flagship"
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
"ai",
|
|
123
|
+
"binding",
|
|
124
|
+
"Ai"
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
"browser",
|
|
128
|
+
"binding",
|
|
129
|
+
"BrowserRun"
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"analytics",
|
|
133
|
+
"binding",
|
|
134
|
+
"AnalyticsSQLBinding"
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"images",
|
|
138
|
+
"binding",
|
|
139
|
+
"ImagesBinding"
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"stream",
|
|
143
|
+
"binding",
|
|
144
|
+
"StreamBinding"
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"media",
|
|
148
|
+
"binding",
|
|
149
|
+
"MediaBinding"
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"version_metadata",
|
|
153
|
+
"binding",
|
|
154
|
+
"WorkerVersionMetadata"
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"assets",
|
|
158
|
+
"binding",
|
|
159
|
+
"Fetcher"
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"pipelines",
|
|
163
|
+
"binding",
|
|
164
|
+
"import(\"cloudflare:pipelines\").Pipeline<import(\"cloudflare:pipelines\").PipelineRecord>"
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
"k2",
|
|
168
|
+
"binding",
|
|
169
|
+
"{ send(records: Array<{ content: ArrayBuffer; headers?: Record<string, string> }> | Array<{ content: Uint8Array; headers?: Record<string, string> }>): Promise<{ success: true } | { success: false; error: { code: number; message: string; retryable: boolean } }> }"
|
|
170
|
+
]
|
|
171
|
+
];
|
|
172
|
+
const managedBindings = /* @__PURE__ */ new Set([
|
|
173
|
+
"DB",
|
|
174
|
+
"KV",
|
|
175
|
+
"STORAGE",
|
|
176
|
+
"AI",
|
|
177
|
+
"SANDBOX",
|
|
178
|
+
"ASSETS"
|
|
179
|
+
]);
|
|
180
|
+
/** Generate types for explicitly configured bindings without changing managed types. */
|
|
181
|
+
function generateBindingTypes(config) {
|
|
182
|
+
if (config.target && config.target !== "cloudflare") return null;
|
|
183
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
184
|
+
for (const [path, nameField, type] of bindingTypes) {
|
|
185
|
+
let value = config.cloudflare;
|
|
186
|
+
for (const field of path.split(".")) value = value && typeof value === "object" ? value[field] : void 0;
|
|
187
|
+
for (const entry of Array.isArray(value) ? value : [value]) {
|
|
188
|
+
const name = entry && typeof entry === "object" ? entry[nameField] : void 0;
|
|
189
|
+
if (typeof name === "string" && !managedBindings.has(name)) bindings.set(name, type);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (bindings.size === 0) return null;
|
|
193
|
+
return [
|
|
194
|
+
"// Auto-generated by void — do not edit",
|
|
195
|
+
"export {};",
|
|
196
|
+
"declare global {",
|
|
197
|
+
" interface VoidGeneratedEnvBindings {",
|
|
198
|
+
...[...bindings].sort(([a], [b]) => a.localeCompare(b)).map(([name, type]) => ` ${JSON.stringify(name)}: ${type};`),
|
|
199
|
+
" }",
|
|
200
|
+
"}",
|
|
201
|
+
""
|
|
202
|
+
].join("\n");
|
|
203
|
+
}
|
|
204
|
+
function syncBindingTypes(root, config) {
|
|
205
|
+
const path = join(root, ".void", "bindings.d.ts");
|
|
206
|
+
const dts = generateBindingTypes(config);
|
|
207
|
+
if (dts) writeFileIfChanged(path, dts);
|
|
208
|
+
else rmSync(path, { force: true });
|
|
209
|
+
}
|
|
4
210
|
// src/codegen/auth-types.ts
|
|
5
211
|
/**
|
|
6
212
|
* Generate `.void/auth.d.ts` content. Fills `void/auth`'s `VoidAuthTypes`
|
|
@@ -22,12 +228,13 @@ function generateAuthTypes(authFileAbs, outDir) {
|
|
|
22
228
|
lines.push("// Auto-generated by void — do not edit");
|
|
23
229
|
lines.push("export {}");
|
|
24
230
|
lines.push("");
|
|
25
|
-
lines.push("import type { InferAuthSession } from \"void/auth\";");
|
|
231
|
+
lines.push("import type { InferAuthInstance, InferAuthSession } from \"void/auth\";");
|
|
26
232
|
lines.push("");
|
|
27
233
|
lines.push(`type _VoidAuthSession = InferAuthSession<typeof import("${importPath}")["default"]>;`);
|
|
28
234
|
lines.push("");
|
|
29
235
|
lines.push("declare module \"void/auth\" {");
|
|
30
236
|
lines.push(" interface VoidAuthTypes {");
|
|
237
|
+
lines.push(` auth: InferAuthInstance<typeof import("${importPath}")["default"]>;`);
|
|
31
238
|
lines.push(" user: _VoidAuthSession[\"user\"];");
|
|
32
239
|
lines.push(" session: _VoidAuthSession[\"session\"];");
|
|
33
240
|
lines.push(" }");
|
|
@@ -78,10 +285,27 @@ function generateQueueTypes(queues, queuesDir, outDir) {
|
|
|
78
285
|
return lines.join("\n");
|
|
79
286
|
}
|
|
80
287
|
// src/codegen/route-types.ts
|
|
288
|
+
/** Present bracket parameters without changing the router's compiled patterns. */
|
|
289
|
+
function publicRoutePattern(pattern) {
|
|
290
|
+
return pattern.split("/").map((segment) => {
|
|
291
|
+
if (segment === "*") return "[...]";
|
|
292
|
+
const param = segment.match(/^:([^/{}]+)(\{\.\+\})?$/);
|
|
293
|
+
return param ? `[${param[2] ? "..." : ""}${param[1]}]` : segment;
|
|
294
|
+
}).join("/");
|
|
295
|
+
}
|
|
296
|
+
/** Legacy keys stay indexable and carry the exact same contract as the public key. */
|
|
297
|
+
function legacyRouteAlias(lines, map, pattern) {
|
|
298
|
+
const publicPattern = publicRoutePattern(pattern);
|
|
299
|
+
if (publicPattern !== pattern) {
|
|
300
|
+
const label = JSON.stringify(publicPattern).replace(/\*\//g, "*\\/");
|
|
301
|
+
lines.push(` /** @deprecated Use ${label} instead. */`);
|
|
302
|
+
lines.push(` ${JSON.stringify(pattern)}: ${map}[${JSON.stringify(publicPattern)}];`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
81
305
|
/** Percent-encode a pattern's fixed segments the way `routeUrl()` serializes its pathname. */
|
|
82
306
|
function encodeRoutePattern(pattern) {
|
|
83
307
|
return pattern.split("/").map((segment) => {
|
|
84
|
-
if (segment.startsWith(":") || segment === "*") return segment;
|
|
308
|
+
if (segment.startsWith(":") || segment === "*" || /^\[.*\]$/.test(segment)) return segment;
|
|
85
309
|
const url = new URL("https://void.invalid");
|
|
86
310
|
url.pathname = `/${segment}`;
|
|
87
311
|
return url.pathname.slice(1);
|
|
@@ -152,11 +376,13 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
152
376
|
lines.push(" export type RouteDestination<P extends RoutePath = RoutePath> = P extends RoutePath");
|
|
153
377
|
lines.push(" ? { pathname: P } & RouteOptions<P>");
|
|
154
378
|
lines.push(" : never;");
|
|
155
|
-
lines.push(" type RouteUrlSegment<S extends string> = S extends `:${string}` | \"*\" ? string : S;");
|
|
379
|
+
lines.push(" type RouteUrlSegment<S extends string> = S extends `:${string}` | `[${string}]` | \"*\" ? string : S;");
|
|
156
380
|
lines.push(" type RouteSegmentsUrl<P extends string> = P extends `${infer Segment}/${infer Rest}`");
|
|
157
381
|
lines.push(" ? `${RouteUrlSegment<Segment>}/${RouteSegmentsUrl<Rest>}`");
|
|
158
382
|
lines.push(" : RouteUrlSegment<P>;");
|
|
159
|
-
lines.push(" type RoutePatternUrl<P extends string> = P extends `${infer Prefix}
|
|
383
|
+
lines.push(" type RoutePatternUrl<P extends string> = P extends `${infer Prefix}/${\"*\" | \"[...]\"}/`");
|
|
384
|
+
lines.push(" ? `${RouteSegmentsUrl<Prefix>}/` | `${RouteSegmentsUrl<Prefix>}/${string}/`");
|
|
385
|
+
lines.push(" : P extends `${infer Prefix}/${\"*\" | \"[...]\"}`");
|
|
160
386
|
lines.push(" ? (Prefix extends \"\" ? \"/\" : RouteSegmentsUrl<Prefix>) | `${RouteSegmentsUrl<Prefix>}/${string}`");
|
|
161
387
|
lines.push(" : RouteSegmentsUrl<P>;");
|
|
162
388
|
lines.push(" type EncodedRoutePath = EncodedRoutePathMap[keyof EncodedRoutePathMap] & string;");
|
|
@@ -194,14 +420,38 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
194
420
|
}
|
|
195
421
|
for (const [pattern, params] of paths) {
|
|
196
422
|
const names = [...params].map((name) => JSON.stringify(name)).join(" | ") || "never";
|
|
197
|
-
lines.push(` ${JSON.stringify(pattern)}: ${names};`);
|
|
423
|
+
lines.push(` ${JSON.stringify(publicRoutePattern(pattern))}: ${names};`);
|
|
424
|
+
legacyRouteAlias(lines, "RoutePathMap", pattern);
|
|
425
|
+
}
|
|
426
|
+
lines.push(" }");
|
|
427
|
+
lines.push("");
|
|
428
|
+
lines.push(" export interface PagePathMap {");
|
|
429
|
+
const pagePaths = /* @__PURE__ */ new Map();
|
|
430
|
+
for (const page of scan.pages.pages) {
|
|
431
|
+
const params = pagePaths.get(page.pattern) ?? /* @__PURE__ */ new Set();
|
|
432
|
+
for (const name of page.params) params.add(name);
|
|
433
|
+
if (page.pattern.split("/").includes("*")) params.add("*");
|
|
434
|
+
pagePaths.set(page.pattern, params);
|
|
435
|
+
}
|
|
436
|
+
for (const [pattern, params] of pagePaths) {
|
|
437
|
+
const names = [...params].map((name) => JSON.stringify(name)).join(" | ") || "never";
|
|
438
|
+
lines.push(` ${JSON.stringify(publicRoutePattern(pattern))}: ${names};`);
|
|
439
|
+
legacyRouteAlias(lines, "PagePathMap", pattern);
|
|
198
440
|
}
|
|
199
441
|
lines.push(" }");
|
|
442
|
+
lines.push(" export type PagePath = keyof PagePathMap & string;");
|
|
443
|
+
lines.push(" export type PageParams<P extends PagePath> = P extends PagePath");
|
|
444
|
+
lines.push(" ? { [K in Exclude<PagePathMap[P], \"*\"> & string]: string }");
|
|
445
|
+
lines.push(" : never;");
|
|
200
446
|
lines.push("");
|
|
201
447
|
lines.push(" export interface EncodedRoutePathMap {");
|
|
202
448
|
for (const pattern of paths.keys()) {
|
|
203
|
-
const
|
|
204
|
-
|
|
449
|
+
const publicPattern = publicRoutePattern(pattern);
|
|
450
|
+
const encoded = encodeRoutePattern(publicPattern);
|
|
451
|
+
if (encoded !== publicPattern) {
|
|
452
|
+
lines.push(` ${JSON.stringify(publicPattern)}: ${JSON.stringify(encoded)};`);
|
|
453
|
+
if (publicPattern !== pattern) lines.push(` ${JSON.stringify(pattern)}: ${JSON.stringify(encodeRoutePattern(pattern))};`);
|
|
454
|
+
}
|
|
205
455
|
}
|
|
206
456
|
lines.push(" }");
|
|
207
457
|
lines.push("");
|
|
@@ -293,7 +543,7 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
293
543
|
sources.push(route);
|
|
294
544
|
}
|
|
295
545
|
for (const [pattern, methods] of routesByPattern) {
|
|
296
|
-
lines.push(` ${JSON.stringify(pattern)}: {`);
|
|
546
|
+
lines.push(` ${JSON.stringify(publicRoutePattern(pattern))}: {`);
|
|
297
547
|
for (const [method, sources] of methods) {
|
|
298
548
|
const imports = sources.map((route) => {
|
|
299
549
|
const importPath = relative(outDir, `${routesDir}/${route.filePath}`);
|
|
@@ -305,6 +555,7 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
305
555
|
lines.push(" };");
|
|
306
556
|
}
|
|
307
557
|
lines.push(" };");
|
|
558
|
+
legacyRouteAlias(lines, "RouteMap", pattern);
|
|
308
559
|
}
|
|
309
560
|
lines.push(" }");
|
|
310
561
|
lines.push("");
|
|
@@ -320,11 +571,12 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
320
571
|
const importPath = relative(outDir, `${routesDir}/${route.filePath}`);
|
|
321
572
|
return `(typeof import(${JSON.stringify(importPath)}))["default"]["messages"]`;
|
|
322
573
|
});
|
|
323
|
-
lines.push(` ${JSON.stringify(pattern)}: {`);
|
|
574
|
+
lines.push(` ${JSON.stringify(publicRoutePattern(pattern))}: {`);
|
|
324
575
|
lines.push(` params: RouteParams<${JSON.stringify(sources[0].params)}>;`);
|
|
325
576
|
lines.push(` client: ${imports.map((source) => `ExtractInput<${source}["client"]>`).join(" & ")};`);
|
|
326
577
|
lines.push(` server: ${imports.map((source) => `ExtractOutput<${source}["server"]>`).join(" | ")};`);
|
|
327
578
|
lines.push(" };");
|
|
579
|
+
legacyRouteAlias(lines, "WebSocketRouteMap", pattern);
|
|
328
580
|
}
|
|
329
581
|
lines.push(" }");
|
|
330
582
|
const actionPages = scan.pages.pages.filter((p) => p.methods.includes("action") || p.methods.includes("actions"));
|
|
@@ -355,12 +607,13 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
355
607
|
else bodiesByPattern.set(page.pattern, [body]);
|
|
356
608
|
}
|
|
357
609
|
for (const [pattern, bodies] of bodiesByPattern) {
|
|
358
|
-
lines.push(` ${JSON.stringify(pattern)}: {`);
|
|
610
|
+
lines.push(` ${JSON.stringify(publicRoutePattern(pattern))}: {`);
|
|
359
611
|
bodies.forEach((body, index) => {
|
|
360
612
|
if (index > 0) lines.push(" } | {");
|
|
361
613
|
lines.push(...body);
|
|
362
614
|
});
|
|
363
615
|
lines.push(" };");
|
|
616
|
+
legacyRouteAlias(lines, "PageActionMap", pattern);
|
|
364
617
|
}
|
|
365
618
|
lines.push(" }");
|
|
366
619
|
}
|
|
@@ -368,4 +621,4 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir, options = {}) {
|
|
|
368
621
|
lines.push("");
|
|
369
622
|
return { dts: lines.join("\n") };
|
|
370
623
|
}
|
|
371
|
-
export { syncAuthTypesFile as a, removeAuthTypesIfPresent as i, generateQueueTypes as n, generateAuthTypes as r, generateRouteTypes as t };
|
|
624
|
+
export { syncAuthTypesFile as a, removeAuthTypesIfPresent as i, generateQueueTypes as n, generateBindingTypes as o, generateAuthTypes as r, syncBindingTypes as s, generateRouteTypes as t };
|
|
@@ -3,9 +3,9 @@ import { EncodedRoutePathMap, RoutePathMap, RouteTypesConfig } from "void/routes
|
|
|
3
3
|
declare function interpolateRouteParams(path: string, params?: Record<string, string>, requireParams?: boolean): string;
|
|
4
4
|
/** Known page, HTTP and WebSocket route patterns. */
|
|
5
5
|
type RoutePath = keyof RoutePathMap & string;
|
|
6
|
-
type RouteUrlSegment<S extends string> = S extends `:${string}` | "*" ? string : S;
|
|
6
|
+
type RouteUrlSegment<S extends string> = S extends `:${string}` | `[${string}]` | "*" ? string : S;
|
|
7
7
|
type RouteSegmentsUrl<P extends string> = P extends `${infer Segment}/${infer Rest}` ? `${RouteUrlSegment<Segment>}/${RouteSegmentsUrl<Rest>}` : RouteUrlSegment<P>;
|
|
8
|
-
type RoutePatternUrl<P extends string> = P extends `${infer Prefix}
|
|
8
|
+
type RoutePatternUrl<P extends string> = P extends `${infer Prefix}/${"*" | "[...]"}/` ? `${RouteSegmentsUrl<Prefix>}/` | `${RouteSegmentsUrl<Prefix>}/${string}/` : P extends `${infer Prefix}/${"*" | "[...]"}` ? (Prefix extends "" ? "/" : RouteSegmentsUrl<Prefix>) | `${RouteSegmentsUrl<Prefix>}/${string}` : RouteSegmentsUrl<P>;
|
|
9
9
|
type EncodedRoutePath = EncodedRoutePathMap[keyof EncodedRoutePathMap] & string;
|
|
10
10
|
type RoutePathUrl = RoutePatternUrl<RoutePath | EncodedRoutePath>;
|
|
11
11
|
/** Whether `routing.typedRoutes` is on in the generated route types. */
|
|
@@ -16,6 +16,11 @@ type TypedRoutes = RouteTypesConfig extends {
|
|
|
16
16
|
type RouteUrl$1 = TypedRoutes extends true ? RoutePathUrl | `${RoutePathUrl}${"?" | "#"}${string}` : string;
|
|
17
17
|
/** Anything a link can point to: a route URL, a same-page query or hash, or an external URL. */
|
|
18
18
|
type Href$1 = TypedRoutes extends true ? RouteUrl$1 | `${"?" | "#"}${string}` | `${"http://" | "https://" | "mailto:" | "tel:"}${string}` : string;
|
|
19
|
+
/**
|
|
20
|
+
* A URL an HTTP request can target: one of the app's routes or an absolute
|
|
21
|
+
* `http://`/`https://` URL. A plain string unless `routing.typedRoutes` is on.
|
|
22
|
+
*/
|
|
23
|
+
type RequestUrl = TypedRoutes extends true ? RouteUrl$1 | `${"http://" | "https://"}${string}` : string;
|
|
19
24
|
type RouteQueryValue = string | number | boolean | null | undefined;
|
|
20
25
|
type RouteQuery = Record<string, RouteQueryValue | ReadonlyArray<RouteQueryValue>>;
|
|
21
26
|
type RouteOptions<P extends RoutePath> = {
|
|
@@ -34,4 +39,4 @@ type RouteUrlInput$1 = Href$1 | URL | RouteDestination$1;
|
|
|
34
39
|
declare function routeUrl<P extends RoutePath>(path: P, ...args: [RoutePathMap[NoInfer<P>]] extends [never] ? [options?: RouteOptions<P>] : [options: RouteOptions<P>]): RouteUrl$1;
|
|
35
40
|
/** @internal Convert navigation inputs to URL strings without requiring an origin. */
|
|
36
41
|
declare function toUrlString(value: RouteUrlInput$1): string;
|
|
37
|
-
export {
|
|
42
|
+
export { RoutePath as a, RouteUrl$1 as c, interpolateRouteParams as d, routeUrl as f, RouteOptions as i, RouteUrlInput$1 as l, RequestUrl as n, RouteQuery as o, toUrlString as p, RouteDestination$1 as r, RouteQueryValue as s, Href$1 as t, TypedRoutes as u };
|
|
@@ -15,9 +15,9 @@ function interpolateRouteParams(path, params, requireParams = false) {
|
|
|
15
15
|
const pathname = suffixIndex === -1 ? path : path.slice(0, suffixIndex);
|
|
16
16
|
const suffix = suffixIndex === -1 ? "" : path.slice(suffixIndex);
|
|
17
17
|
let leadingName;
|
|
18
|
-
const replaced = pathname.replace(/(^|\/)(?::([^/{}]+)(\{\.\+\})
|
|
18
|
+
const replaced = pathname.replace(/(^|\/)(?::([^/{}]+)(\{\.\+\})?|\[(\.\.\.)?([^/[\]]*)\]|\*)(?=\/|$)/g, (token, prefix, name, catchAll, bracketCatchAll, bracketName, offset) => {
|
|
19
|
+
name ??= bracketName || void 0;
|
|
19
20
|
const anonymous = name === void 0;
|
|
20
|
-
if (anonymous && !requireParams) return token;
|
|
21
21
|
name ??= "*";
|
|
22
22
|
if (!params || !Object.hasOwn(params, name)) {
|
|
23
23
|
if (requireParams) throw new TypeError(`Missing route param "${name}".`);
|
|
@@ -25,8 +25,9 @@ function interpolateRouteParams(path, params, requireParams = false) {
|
|
|
25
25
|
}
|
|
26
26
|
if (offset === 0) leadingName = name;
|
|
27
27
|
const value = params[name];
|
|
28
|
+
if (anonymous && value === "" && pathname.slice(offset + token.length) === "/") return "";
|
|
28
29
|
if (requireParams && !anonymous && value === "") throw new TypeError(`Route param "${name}" must not be empty.`);
|
|
29
|
-
return prefix + (catchAll || anonymous ? value.split("/").map((segment) => encodeSegment(name, segment)).join("/") : encodeSegment(name, value));
|
|
30
|
+
return prefix + (catchAll || bracketCatchAll || anonymous ? value.split("/").map((segment) => encodeSegment(name, segment)).join("/") : encodeSegment(name, value));
|
|
30
31
|
});
|
|
31
32
|
if (replaced.startsWith("//") && !pathname.startsWith("//")) throw new TypeError(`Route param "${leadingName ?? ""}" would make the request path start with "//", which changes the request host.`);
|
|
32
33
|
return replaced + suffix;
|
package/dist/routes-stub.d.mts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as RoutePath, c as RouteUrl, f as routeUrl, i as RouteOptions, l as RouteUrlInput, o as RouteQuery, r as RouteDestination, s as RouteQueryValue, t as Href } from "./route-url-C3JwYrER.mjs";
|
|
2
2
|
/** Known URL patterns and their parameter names, augmented by .void/routes.d.ts. */
|
|
3
3
|
export interface RoutePathMap {}
|
|
4
|
+
/** Page URL patterns and their parameter names, augmented by .void/routes.d.ts. */
|
|
5
|
+
export interface PagePathMap {}
|
|
6
|
+
/** Union of the app's page URL patterns, such as `/users/[id]`. */
|
|
7
|
+
export type PagePath = keyof PagePathMap & string;
|
|
8
|
+
/**
|
|
9
|
+
* Params a page receives: `{ id: string }` for `/users/[id]`. An unnamed `[...]`
|
|
10
|
+
* catch-all has no param. A union of patterns gives a union of params.
|
|
11
|
+
*/
|
|
12
|
+
export type PageParams<P extends PagePath> = P extends PagePath ? { [K in Exclude<PagePathMap[P], "*"> & string]: string; } : never;
|
|
4
13
|
/** Percent-encoded spellings of patterns with encoded fixed segments, augmented by .void/routes.d.ts. */
|
|
5
14
|
export interface EncodedRoutePathMap {}
|
|
6
15
|
/** Route type options, augmented by .void/routes.d.ts when `routing.typedRoutes` is on. */
|
package/dist/routes-stub.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as routeUrl } from "./route-url-
|
|
1
|
+
export { n as routeUrl } from "./route-url-CfCR4oMj.mjs";
|