void 1.6.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-cmd-D903EEWQ.mjs → account-cmd-CZKntRH2.mjs} +6 -6
- package/dist/action-key-ByZ6DDld.mjs +64 -0
- package/dist/{application-analysis-DlUG-XNT.mjs → application-analysis-CyTagJQM.mjs} +31 -10
- package/dist/{application-routing-GCBSwXA9.mjs → application-routing-BLrMVpqi.mjs} +2 -1
- package/dist/{auth-CL-p_rqV.mjs → auth-BN0NU9dz.mjs} +1 -1
- package/dist/{auth-CH4PLAX1.d.mts → auth-Bk9VGtQW.d.mts} +9 -2
- package/dist/{auth-Dy8svcqQ.mjs → auth-CCk9Seol.mjs} +2 -2
- package/dist/{auth-YVjBX5NY.mjs → auth-DyWp-fSo.mjs} +7 -1
- package/dist/{auth-link-g9J7MSmP.mjs → auth-link-BOaQWMKw.mjs} +6 -6
- package/dist/{auth-router-DMZbG9Qn.mjs → auth-router-D0-VcmDs.mjs} +3 -3
- package/dist/{better-auth-shared-BJyG2mH0.d.mts → better-auth-shared-CQFdtguU.d.mts} +2 -2
- package/dist/{better-auth-shared-C958aM7W.mjs → better-auth-shared-CdVyCUou.mjs} +1 -1
- package/dist/boundary-plans-CRmWH68v.d.mts +25 -0
- package/dist/{build-cmd-DmjbuT6d.mjs → build-cmd-JTsXXf2F.mjs} +5 -5
- package/dist/{cache-2khBO1MR.mjs → cache-D0m3Z_Xf.mjs} +5 -5
- package/dist/{cancel-deploy-_itbbvY3.mjs → cancel-deploy-Ce6Os4fa.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 +101 -26
- package/dist/cli/env-schema-probe.d.mts +1 -1
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/cli-main-rkrJy2Ge.mjs +1889 -0
- package/dist/client-D1Vz1Zep.mjs +1 -0
- package/dist/{client-CoxPEhJq.mjs → client-SZPyj4X_.mjs} +10 -4
- package/dist/{cloudflare-auth-CuS42-9A.mjs → cloudflare-auth-7jTqy9Bx.mjs} +1 -1
- package/dist/{cloudflare-cmd-DTF19-j-.mjs → cloudflare-cmd-ChPLQcTP.mjs} +5 -5
- package/dist/{cloudflare-config-Ce8j5S7V.mjs → cloudflare-config-DtOGAbeB.mjs} +2 -2
- package/dist/{cloudflare-connect-BN4dHp8i.mjs → cloudflare-connect-Co93VYTo.mjs} +3 -3
- package/dist/{cloudflare-operations-DrZGzQap.mjs → cloudflare-operations-CXaDKYj2.mjs} +6 -6
- package/dist/{cloudflare-operations-laxRA8HN.mjs → cloudflare-operations-DATekLwI.mjs} +1 -1
- package/dist/{cloudflare-process-D9aC-jXr.mjs → cloudflare-process-DmTxZR-N.mjs} +2 -2
- package/dist/{config-hL-S-Y9D.mjs → config-5oSQhZNj.mjs} +3 -1
- package/dist/{config-CPxJmt4M.d.mts → config-CTlUaXWZ.d.mts} +3 -1
- package/dist/{config-CNDjO-15.mjs → config-DcqUBGCb.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-DMR0i3Z2.mjs → config-wo2EaH0X.mjs} +1 -1
- package/dist/{connect-DHepM7Xs.mjs → connect-DlvXt1JR.mjs} +7 -7
- package/dist/{create-project-Bq0M8MtO.mjs → create-project-CC_7hmYJ.mjs} +5 -5
- package/dist/{create-project-BiMmR5wA.mjs → create-project-DzY05xqC.mjs} +1 -1
- package/dist/{db-CqfT6lhV.mjs → db-FhyYGcJJ.mjs} +39 -39
- package/dist/{db-types-DRmxBJ2K.mjs → db-types-sVwEpyPR.mjs} +4 -2
- package/dist/{delete-CY4L8fi2.mjs → delete-CModjyOC.mjs} +5 -5
- package/dist/{deploy-La_Ly8g_.mjs → deploy-Cz9TEzZy.mjs} +502 -110
- package/dist/deploy-DMieisRu.mjs +2 -0
- package/dist/{deploy-managed-static-CESLfKHN.mjs → deploy-managed-static-DlxxXkAM.mjs} +16 -16
- package/dist/{deploy-transport-DcI6LXhY.mjs → deploy-transport-DUvm6-CR.mjs} +3 -3
- package/dist/deploy.mjs +8 -8
- package/dist/{dispatch-DM4Xdd2l.mjs → dispatch-CCiaAnSK.mjs} +7 -7
- package/dist/{dist-eV_Ep60B.mjs → dist-Cp4b1_T9.mjs} +1 -1
- package/dist/{dist-D23AAMxT.mjs → dist-STQXl8ck.mjs} +86 -138
- package/dist/{domain-BD1KOQL3.mjs → domain-DvdZPA50.mjs} +6 -6
- package/dist/{drizzle-C8MPqt5m.mjs → drizzle-D4V_06-B.mjs} +1 -1
- package/dist/{drizzle-lFdzSEa9.mjs → drizzle-DBSpPpU1.mjs} +34 -8
- package/dist/{email-XAspopcj.mjs → email-ASpNrfLd.mjs} +10 -10
- package/dist/{email-cloudflare-RxIQoPc9.mjs → email-cloudflare-kqoN9jst.mjs} +25 -16
- package/dist/{entry-DFBca6aS.mjs → entry-BweGTCgj.mjs} +1 -1
- package/dist/{env-DrYUh55t.mjs → env-Bpkg3G5i.mjs} +7 -7
- package/dist/{env-CuzZZyjB.mjs → env-UqS-21xi.mjs} +8 -1
- package/dist/env-mask-D31Qztl9.mjs +46 -0
- package/dist/{env-public-CeNeO_AT.d.mts → env-public-DtJL_hZq.d.mts} +8 -7
- package/dist/{env-validation-Del3C8AY.mjs → env-validation-BpCCQE_6.mjs} +6 -6
- package/dist/{env-validation-Bosj7EVg.mjs → env-validation-CN386Utu.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-M5fNQKfH.mjs +1 -0
- package/dist/{gen-DSkScMIz.mjs → gen-upKJChvd.mjs} +7 -7
- package/dist/{github-cmd-CA-lBdkn.mjs → github-cmd-BvMOlb8Z.mjs} +6 -6
- package/dist/{handler-BR6Tvjkp.d.mts → handler-BO7Od-z9.d.mts} +22 -8
- package/dist/{handler-DnI_au0K.mjs → handler-C9SnmeW1.mjs} +5 -4
- package/dist/{headers--cbz6iZ8.mjs → headers-COGEDoMN.mjs} +11 -2
- package/dist/help-CItQVDL4.mjs +1 -0
- package/dist/{help-1OCFDsRr.mjs → help-TPCjTu6e.mjs} +7 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +379 -265
- package/dist/{info-BpxpsX0B.mjs → info-EsDyihwf.mjs} +4 -4
- package/dist/{init-DpVXO5S-.mjs → init-a4lVagrb.mjs} +33 -32
- package/dist/{link-DAXOT-G_.mjs → link-CE55DDzS.mjs} +6 -6
- package/dist/{list-BFQ0gcML.mjs → list-CxRthQks.mjs} +7 -7
- package/dist/{live-DF4HUl2m.mjs → live-CYJ4KGoR.mjs} +2 -2
- package/dist/{live-0xrcVpyq.d.mts → live-Kc55iuOQ.d.mts} +2 -2
- package/dist/{local-d1-CLVPP6v7.mjs → local-d1-CFcH9Bx3.mjs} +2 -2
- package/dist/{login-RIw7ffPe.mjs → login-AfcSGSmE.mjs} +5 -5
- package/dist/login-ZHsAm-I6.mjs +1 -0
- package/dist/{logs-B2OeLS4X.mjs → logs-BgRJuvb1.mjs} +6 -6
- package/dist/{migrate-DiI50Chz.mjs → migrate-BNAh6m_C.mjs} +5 -5
- package/dist/migrate-BflbbZQK.mjs +1 -0
- package/dist/nitro.d.mts +5 -0
- package/dist/nitro.mjs +27 -8
- package/dist/{node-Bc-dBAGL.mjs → node-CXFUw0Uz.mjs} +5 -5
- package/dist/{operator-args-D79WQP70.mjs → operator-args-DGTuCdSE.mjs} +9 -1
- package/dist/{operator-auth-CfDcmzpo.mjs → operator-auth-CD3pap65.mjs} +1 -1
- package/dist/{operator-client-BIY4-N_6.mjs → operator-client-XvXTkea6.mjs} +2 -2
- package/dist/{operator-cmd-CEI5Aaza.mjs → operator-cmd-C-viB7Si.mjs} +7 -7
- package/dist/operator-cmd-D6qNuJ_z.mjs +1 -0
- package/dist/output-BsdnNpxa.mjs +1 -0
- package/dist/{output-BCdLioKP.mjs → output-DNVILSz2.mjs} +1 -1
- package/dist/pages/client.d.mts +43 -15
- package/dist/pages/client.mjs +165 -80
- package/dist/pages/index.d.mts +6 -4
- package/dist/pages/index.mjs +6 -6
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +13 -2
- 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-Cx1M-7bq.mjs → platform-args-CiYeZmc5.mjs} +1 -1
- package/dist/platform-args-DJvF1-kl.mjs +1 -0
- package/dist/{platform-auth-config-ZrYm8KVs.mjs → platform-auth-config-Dt2qEc2w.mjs} +10 -10
- package/dist/{platform-auth-protection-t6mdY4nn.mjs → platform-auth-protection-B7TaF-PZ.mjs} +8 -8
- package/dist/{platform-auth-recovery-XeBmPTXx.mjs → platform-auth-recovery-suXSteJ6.mjs} +7 -7
- package/dist/{platform-cmd-EXehmSYA.mjs → platform-cmd-9rvYBBtr.mjs} +9 -9
- package/dist/{platform-cmd-C7BevP9b.mjs → platform-cmd-DuAsIxbU.mjs} +1 -1
- package/dist/{platform-domain-DR263ObA.mjs → platform-domain-DhH_vDr6.mjs} +5 -5
- package/dist/{platform-lifecycle-CN4aXldN.mjs → platform-lifecycle-3uI-E2bF.mjs} +1 -1
- package/dist/{platform-lifecycle-BvU_TNji.mjs → platform-lifecycle-CXmXe2xt.mjs} +17 -17
- package/dist/{platform-management-_UE1_GM8.mjs → platform-management-BBCHfwji.mjs} +4 -4
- package/dist/{platform-management-yS2sve3V.mjs → platform-management-PdrgDQTe.mjs} +1 -1
- package/dist/{platform-plans-config-Dx1agneU.mjs → platform-plans-config-BGwkXYDM.mjs} +5 -5
- package/dist/{platform-recovery-CPVk9-Q4.mjs → platform-recovery-C8NxXGRR.mjs} +3 -3
- package/dist/{platform-setup-Vw1AaUN8.mjs → platform-setup-Casiffqj.mjs} +3 -3
- package/dist/{plugin-inference-bQ1Be840.mjs → plugin-inference-CErfTgEx.mjs} +4 -4
- package/dist/{prepare-D8L9AQbw.mjs → prepare-BDKWZgfL.mjs} +12 -9
- package/dist/{prepare-BkRhDnxw.mjs → prepare-BLrzXjIl.mjs} +3 -3
- package/dist/prepare-a1_5usAn.mjs +1 -0
- package/dist/{prerender-render-RlAj6hh8.mjs → prerender-render-BAdYhivW.mjs} +44 -15
- package/dist/prerender-render.d.mts +12 -2
- package/dist/prerender-render.mjs +1 -1
- package/dist/{project-cmd-DH3CuFC6.mjs → project-cmd-DzGvxXKH.mjs} +18 -18
- package/dist/{project-team-MjT5K4rQ.mjs → project-team-C5XtHbZk.mjs} +5 -5
- package/dist/{project-token-BKHGwY3k.mjs → project-token-B4D5yhHQ.mjs} +5 -5
- package/dist/{project-tsconfig-BMveFb4b.mjs → project-tsconfig-nhnTWO_Y.mjs} +3 -1
- package/dist/{project-zero-trust-Bzdd05-h.mjs → project-zero-trust--0LvktDg.mjs} +5 -5
- package/dist/{protocol-COyySMki.mjs → protocol-B1Tvc9-x.mjs} +232 -74
- package/dist/{protocol-CkwjASep.d.mts → protocol-Cg2I81NA.d.mts} +13 -4
- package/dist/{provision-B0HqoRuI.mjs → provision-C3yiHdld.mjs} +2 -2
- package/dist/{provision-CYhZR_Mn.mjs → provision-CAcrauvr.mjs} +1 -1
- package/dist/{requests-daJmVpjk.mjs → requests-CrRiTgQA.mjs} +4 -4
- package/dist/resolve-project-C5wC-Hoi.mjs +1 -0
- package/dist/{resolve-project-D0YNnJfm.mjs → resolve-project-Da3OgCU1.mjs} +1 -1
- package/dist/{rollback-AVwiMAkk.mjs → rollback-BsmQyj-Q.mjs} +7 -7
- package/dist/{route-types-e69EqY88.mjs → route-types-CgtlFCDz.mjs} +268 -14
- 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 +14 -4
- 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/db.d.mts +6 -3
- package/dist/runtime/db.mjs +2 -2
- package/dist/runtime/email/testing.mjs +2 -2
- package/dist/runtime/email.mjs +3 -3
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/env-public.mjs +55 -85
- 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 +21 -5
- package/dist/runtime/routing.mjs +251 -29
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/sse-client.d.mts +9 -1
- package/dist/runtime/sse-client.mjs +7 -0
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -1
- package/dist/runtime/ws-server.d.mts +3 -3
- package/dist/runtime/ws-server.mjs +1 -1
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/runtime/ws.mjs +1 -1
- package/dist/{scan-F0psanp7.mjs → scan-BJ3bj6aP.mjs} +236 -32
- package/dist/{secret-szNdoeKa.mjs → secret-D0g5oBsP.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-CoBB9_Ao.mjs} +1 -1
- package/dist/{ast-bindings-BkivMJIo.mjs → static-exports-DFkzL-NX.mjs} +96 -33
- package/dist/{subcommand-prompt-CxJXporl.mjs → subcommand-prompt-0yIARXf2.mjs} +2 -2
- package/dist/{types-agfx0alu.d.mts → types-IPut3_Yx.d.mts} +15 -1
- package/dist/url-CuoEn0o3.mjs +43 -0
- package/dist/validator-8-NZs2Xr.mjs +168 -0
- package/dist/{version-metadata-BC3LK7Y-.mjs → version-metadata-eUd6Ar_U.mjs} +1 -1
- package/dist/wrangler-R3kMdJfw.mjs +1 -0
- package/dist/{wrangler-Gn4EoY4-.mjs → wrangler-k40T7XTQ.mjs} +2 -2
- package/dist/{wrapper-B9W9RE8z.mjs → wrapper-CVMZarxf.mjs} +11 -8
- package/dist/{ws-Dmjg5NH2.d.mts → ws--U7QicYy.d.mts} +2 -2
- package/docs/guide/ai.md +3 -0
- package/docs/guide/app-types.md +1 -0
- package/docs/guide/auth.md +63 -0
- package/docs/guide/database/d1.md +16 -1
- package/docs/guide/database/mysql.md +1 -0
- package/docs/guide/database/postgresql.md +1 -0
- package/docs/guide/database.md +34 -0
- package/docs/guide/deployment.md +9 -0
- package/docs/guide/durable-state.md +1 -0
- package/docs/guide/edge/headers.md +1 -0
- package/docs/guide/edge/prerendering.md +10 -4
- package/docs/guide/edge/redirects.md +1 -0
- package/docs/guide/edge/revalidation.md +6 -0
- package/docs/guide/edge/rewrites.md +1 -0
- package/docs/guide/edge/static-assets.md +1 -0
- package/docs/guide/email/domains.md +1 -0
- package/docs/guide/email/receiving.md +3 -2
- package/docs/guide/email/sending.md +3 -2
- package/docs/guide/email.md +1 -0
- package/docs/guide/env-vars.md +4 -0
- package/docs/guide/index.md +1 -0
- package/docs/guide/jobs.md +1 -0
- package/docs/guide/kv.md +1 -0
- package/docs/guide/live.md +3 -0
- package/docs/guide/pages-routing/actions-and-forms.md +51 -28
- package/docs/guide/pages-routing/errors.md +101 -0
- package/docs/guide/pages-routing/head.md +4 -1
- package/docs/guide/pages-routing/islands.md +2 -1
- package/docs/guide/pages-routing/layouts.md +3 -0
- package/docs/guide/pages-routing/loaders.md +3 -0
- package/docs/guide/pages-routing/markdown.md +3 -3
- package/docs/guide/pages-routing/overview.md +142 -10
- package/docs/guide/pages-routing/view-transitions.md +1 -0
- package/docs/guide/platform/administration/access.md +1 -0
- package/docs/guide/platform/administration/connected-apps.md +4 -0
- package/docs/guide/platform/administration/email.md +1 -0
- package/docs/guide/platform/administration/operations.md +1 -0
- package/docs/guide/platform/administration/plans.md +1 -0
- package/docs/guide/platform/administration/projects.md +11 -0
- package/docs/guide/platform/administration/zero-trust.md +1 -0
- package/docs/guide/platform/development/local.md +1 -0
- package/docs/guide/platform/development/runtime.md +1 -0
- package/docs/guide/platform/development/schema-ci.md +1 -0
- package/docs/guide/platform/installation/ci.md +1 -0
- package/docs/guide/platform/installation/credentials.md +1 -0
- package/docs/guide/platform/installation/domains.md +1 -0
- package/docs/guide/platform/installation/first-deployment.md +1 -0
- package/docs/guide/platform/installation/maintenance.md +1 -0
- package/docs/guide/platform/installation/prerequisites.md +1 -0
- package/docs/guide/platform/installation/setup.md +1 -0
- package/docs/guide/platform/installation/uninstall.md +1 -0
- package/docs/guide/platform-administration.md +1 -0
- package/docs/guide/platform-development.md +1 -0
- package/docs/guide/project-collaboration.md +1 -0
- package/docs/guide/queues.md +3 -0
- package/docs/guide/quickstart.md +4 -2
- package/docs/guide/remote-dev.md +1 -0
- package/docs/guide/sandboxes.md +1 -0
- package/docs/guide/self-hosted-platform.md +1 -0
- package/docs/guide/server-routing.md +1 -0
- package/docs/guide/sse.md +3 -0
- package/docs/guide/ssg.md +24 -2
- package/docs/guide/ssr.md +1 -0
- package/docs/guide/storage.md +7 -2
- package/docs/guide/testing.md +62 -0
- package/docs/guide/type-safety.md +308 -26
- package/docs/guide/typed-fetch.md +8 -3
- package/docs/guide/websockets.md +6 -5
- package/docs/index.md +1 -0
- package/docs/integrations/agents.md +1 -0
- package/docs/integrations/cloudflare.md +11 -10
- package/docs/integrations/frameworks/analog.md +1 -0
- package/docs/integrations/frameworks/astro.md +1 -0
- package/docs/integrations/frameworks/nuxt.md +3 -0
- package/docs/integrations/frameworks/overview.md +3 -0
- package/docs/integrations/frameworks/react-router.md +1 -0
- package/docs/integrations/frameworks/sveltekit.md +1 -0
- package/docs/integrations/frameworks/tanstack-start.md +1 -0
- package/docs/integrations/hono.md +1 -0
- package/docs/integrations/nodejs-bun-deno.md +66 -0
- package/docs/reference/api/auth.md +20 -0
- package/docs/reference/api/client.md +7 -4
- package/docs/reference/api/database.md +24 -1
- package/docs/reference/api/deploy.md +4 -0
- package/docs/reference/api/durable.md +1 -0
- package/docs/reference/api/env.md +1 -0
- package/docs/reference/api/handlers.md +4 -1
- package/docs/reference/api/pages.md +30 -12
- package/docs/reference/api/plugin.md +1 -0
- package/docs/reference/api/resources.md +4 -1
- package/docs/reference/api/rewrites.md +18 -5
- package/docs/reference/api/types.md +10 -2
- package/docs/reference/api.md +1 -0
- package/docs/reference/cli/auth.md +1 -0
- package/docs/reference/cli/database.md +3 -0
- package/docs/reference/cli/deploy.md +18 -11
- package/docs/reference/cli/domains.md +1 -0
- package/docs/reference/cli/email.md +1 -0
- package/docs/reference/cli/generate.md +1 -0
- package/docs/reference/cli/github.md +1 -0
- package/docs/reference/cli/platform-config.md +1 -0
- package/docs/reference/cli/platform-email.md +1 -0
- package/docs/reference/cli/platform-installation.md +1 -0
- package/docs/reference/cli/platform-operations.md +1 -0
- package/docs/reference/cli/platform-users.md +23 -0
- package/docs/reference/cli/platform-zero-trust.md +1 -0
- package/docs/reference/cli/platform.md +1 -0
- package/docs/reference/cli/project.md +1 -0
- package/docs/reference/cli/secrets.md +1 -0
- package/docs/reference/cli/setup.md +1 -0
- package/docs/reference/cli.md +6 -0
- package/docs/reference/config.md +25 -2
- package/docs/reference/resource-inference.md +1 -0
- package/docs/reference/structure.md +1 -0
- package/package.json +27 -25
- package/schema.json +4 -0
- package/skills/void/SKILL.md +7 -0
- package/dist/action-key-XtKKbbsi.mjs +0 -25
- package/dist/cf-build-output-CmDOcA7K.mjs +0 -1
- package/dist/client-CEtr5UOR.mjs +0 -1
- package/dist/deploy-DMhOyebt.mjs +0 -2
- package/dist/gen-BbT1Ku1P.mjs +0 -1
- package/dist/help-Ba8Dq5-r.mjs +0 -1
- package/dist/login-BX2gzHUt.mjs +0 -1
- package/dist/migrate-CUGMGaIM.mjs +0 -1
- package/dist/operator-cmd-oTT2MA9G.mjs +0 -1
- package/dist/output-E6gecbbV.mjs +0 -1
- package/dist/platform-args-C7XUw9mw.mjs +0 -1
- package/dist/prepare-CZRVGNld.mjs +0 -1
- package/dist/resolve-project-CgfjtOwz.mjs +0 -1
- package/dist/serialize-DUuYuaY3.mjs +0 -29
- package/dist/serialize-I4EmS-Wf.d.mts +0 -16
- package/dist/validator-CTfmzZYb.mjs +0 -69
- package/dist/wrangler-CQ5c-MtJ.mjs +0 -1
- package/dist/{cf-access-BmBT2h8_.mjs → cf-access-Dnyw8KFY.mjs} +1 -1
- package/dist/{config-s6TkpSat.mjs → config-eeDzKBS9.mjs} +1 -1
- package/dist/{env-types-Bd8DkQhl.mjs → env-types-Dz9qkiOn.mjs} +1 -1
- package/dist/{inbound-CdO-qY0w.mjs → inbound-C2H6Dzz1.mjs} +2 -2
- package/dist/{runner-5MCSimKx.mjs → runner-CMZb7jNU.mjs} +1 -1
- package/dist/{runner-mysql-Bdmsp_x4.mjs → runner-mysql-BXfcQQj3.mjs} +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { n as __toESM } from "./rolldown-runtime-uD8oG6U2.mjs";
|
|
2
2
|
import { a as join, c as resolve, i as isAbsolute, n as dirname, o as normalize, s as relative, t as basename } from "./dist-DMYe8CZJ.mjs";
|
|
3
3
|
import { t as require_picocolors } from "./picocolors-D1NxSLw-.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-hL-S-Y9D.mjs";
|
|
8
|
-
import { f as invalidateSourceAnalysis, m as isRouteEnabledForEnvironment, o as resolveLayoutIds } from "./scan-F0psanp7.mjs";
|
|
9
|
-
import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
|
|
10
|
-
import { n as bindingResolver } from "./ast-bindings-BkivMJIo.mjs";
|
|
11
|
-
import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, i as assertSandboxNamespaceConfig, n as DEFAULT_SANDBOX_CLASS_NAME, p as scanJobsSync, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as scanQueuesSync } from "./application-analysis-DlUG-XNT.mjs";
|
|
12
|
-
import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-D9hwSySP.mjs";
|
|
13
|
-
import { t as MagicString } from "./dist-B6eN80gc.mjs";
|
|
14
|
-
import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-DFBca6aS.mjs";
|
|
15
|
-
import { r as hasEmailHandlers } from "./email-BHY72ixO.mjs";
|
|
16
|
-
import { a as isAssetBypassRule, d as hasDocumentRoutes, l as edgeRulesNeedWorker, n as mergeRoutingRules, o as isGeneratedAssetHeaders, p as resolveAssetRoutingPolicy, s as resolveAssetWorkerBypass, t as lintRoutingPhases, u as hasApiRoutes } from "./headers--cbz6iZ8.mjs";
|
|
17
|
-
import { t as writeFileAtomic } from "./atomic-write-DA6eD1Kp.mjs";
|
|
4
|
+
import { a as hasSandboxSqliteMigration, c as sandboxContainerConfig, i as assertSandboxNamespaceConfig, n as DEFAULT_SANDBOX_CLASS_NAME, p as scanJobsSync, r as SANDBOX_MIGRATION_TAG, s as resolveSandboxConfig, t as analyzeApplicationSync, u as scanQueuesSync } from "./application-analysis-CyTagJQM.mjs";
|
|
5
|
+
import { l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-CErfTgEx.mjs";
|
|
6
|
+
import { a as isAssetBypassRule, d as hasDocumentRoutes, l as edgeRulesNeedWorker, n as mergeRoutingRules, o as isGeneratedAssetHeaders, p as resolveAssetRoutingPolicy, s as resolveAssetWorkerBypass, t as lintRoutingPhases, u as hasApiRoutes } from "./headers-COGEDoMN.mjs";
|
|
18
7
|
import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-CLwxcEdq.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import { c as stashCloudflareDeployPointer, i as materializeCloudflareConfig, l as ensureGitignoreLines, o as restoreCloudflarePreviewPointer } from "./cloudflare-config-
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
8
|
+
import { A as syncWranglerWebSockets, E as resolveLiveBindingConfig, O as syncWranglerBindings, T as readWranglerWebSocketTombstones, a as LIVE_MIGRATION_TAG, b as readRootWranglerConfig, d as ensureWranglerCompatibilityDate, f as ensureWranglerNodejsAlsFlag, g as normalizeWranglerCompatibilityFlags, h as nextDurableObjectMigrationTag, k as syncWranglerDurableObjects, m as hasDurableObjectSqliteMigration, p as findBindingNameOwner, u as ensureWranglerCompat, v as readExistingLiveBindingConfig, x as readWranglerCompat } from "./wrangler-k40T7XTQ.mjs";
|
|
9
|
+
import { c as stashCloudflareDeployPointer, i as materializeCloudflareConfig, l as ensureGitignoreLines, o as restoreCloudflarePreviewPointer } from "./cloudflare-config-DtOGAbeB.mjs";
|
|
10
|
+
import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, s as syncBindingTypes, t as generateRouteTypes } from "./route-types-CgtlFCDz.mjs";
|
|
11
|
+
import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-5oSQhZNj.mjs";
|
|
12
|
+
import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-CFcH9Bx3.mjs";
|
|
13
|
+
import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-D9hwSySP.mjs";
|
|
14
|
+
import { a as getApiUrl, c as getToken, o as getProxyUrl } from "./auth-CCk9Seol.mjs";
|
|
15
|
+
import { n as ensurePlatformProxyAccess } from "./cf-access-Dnyw8KFY.mjs";
|
|
23
16
|
import { n as scopedAccessCredentials } from "./cf-access-pejlJmuy.mjs";
|
|
24
|
-
import { n as
|
|
25
|
-
import {
|
|
26
|
-
import { t as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-DM4Xdd2l.mjs";
|
|
17
|
+
import { n as readGeneratedWranglerConfigFile } from "./generated-wrangler-config-CoDaaFsA.mjs";
|
|
18
|
+
import { t as migrateBuiltWranglerConfig } from "./cf-config-migrate-Bb-EdAQq.mjs";
|
|
19
|
+
import { t as writeFileAtomic } from "./atomic-write-DA6eD1Kp.mjs";
|
|
20
|
+
import { a as findReservedEnvKeys, c as loadLocalEnv, i as findLegacyEnvFiles, l as reservedEnvKeysMessage, o as isClientEnvKey, r as LOCAL_ENV_FILE, s as legacyEnvExampleHint, u as resolveRemoteMode } from "./env-UqS-21xi.mjs";
|
|
21
|
+
import { n as readProjectPaths, t as assertNoRootSourceConventionConflicts } from "./project-paths-G0yut6Zz.mjs";
|
|
22
|
+
import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-CCiaAnSK.mjs";
|
|
31
23
|
import { _ as parseCapturedMessage, a as DEV_INBOX_ENV_VAR, c as DEV_INBOX_TOKEN_ENV_VAR, f as clearDevBuffer, g as listDevMessages, l as DEV_INBOX_TOKEN_HEADER, m as findDevMessage, n as DEV_INBOX_ACK_VALUE, o as DEV_INBOX_MAX_CAPTURE_BYTES, s as DEV_INBOX_PREFIX, t as DEV_INBOX_ACK_HEADER, u as DEV_INBOX_TOKEN_QUERY, v as pushToDevBuffer } from "./dev-inbox-CUUS6iUg.mjs";
|
|
32
|
-
import {
|
|
24
|
+
import { t as MagicString } from "./dist-B6eN80gc.mjs";
|
|
25
|
+
import { s as bindingResolver } from "./static-exports-DFkzL-NX.mjs";
|
|
26
|
+
import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
|
|
27
|
+
import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-Dz9qkiOn.mjs";
|
|
28
|
+
import { i as writeFileIfChanged, r as syncAuthTypesInProjectTsconfig } from "./project-tsconfig-nhnTWO_Y.mjs";
|
|
33
29
|
import { t as loadUserEnvFile } from "./load-user-env-CSwdofj0.mjs";
|
|
30
|
+
import { n as scanWranglerDotenvKeys } from "./dotenv-CEI8hapP.mjs";
|
|
31
|
+
import { _ as isRouteEnabledForEnvironment, a as createBoundaryManifest, c as resolveLayoutIds, h as invalidateSourceAnalysis, i as patternToRegex } from "./scan-BJ3bj6aP.mjs";
|
|
34
32
|
import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-e8qgqAzQ.mjs";
|
|
35
33
|
import { t as ASSET_EXTENSIONS } from "./routing-assets-DJIVOrCh.mjs";
|
|
34
|
+
import { i as loadVoidAuthConfig, n as devAuthConfigImporter, o as viteAuthConfigImporter, t as AUTH_CONFIG_ENVIRONMENT } from "./config-eeDzKBS9.mjs";
|
|
36
35
|
import { a as resolveDistDir, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, t as collectPages } from "./isr-config-Czzb4mIq.mjs";
|
|
37
|
-
import { t as assertNoPrerenderFailures } from "./prerender-render-
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
36
|
+
import { t as assertNoPrerenderFailures } from "./prerender-render-BAdYhivW.mjs";
|
|
37
|
+
import { f as prerenderPages, n as SEND_EMAIL_BINDING, p as prerenderPagesNode } from "./email-cloudflare-kqoN9jst.mjs";
|
|
38
|
+
import { i as safeJsonStringify } from "./protocol-B1Tvc9-x.mjs";
|
|
39
|
+
import { n as completeApplicationAnalysis } from "./application-routing-BLrMVpqi.mjs";
|
|
40
|
+
import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-BweGTCgj.mjs";
|
|
41
|
+
import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-eUd6Ar_U.mjs";
|
|
42
|
+
import { r as hasEmailHandlers } from "./email-BHY72ixO.mjs";
|
|
43
|
+
import { a as defineMiddleware, c as defineScheduled, i as defineHead, n as basicAuth, o as defineQueue, r as defineHandler, s as defineRender, t as VoidAssetRewriteError } from "./handler-C9SnmeW1.mjs";
|
|
40
44
|
import { r as defer } from "./validation-error-uAAjlsiW.mjs";
|
|
41
|
-
import { i as safeJsonStringify } from "./protocol-COyySMki.mjs";
|
|
42
|
-
import { n as completeApplicationAnalysis } from "./application-routing-GCBSwXA9.mjs";
|
|
43
|
-
import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, t as generateRouteTypes } from "./route-types-e69EqY88.mjs";
|
|
44
|
-
import { a as defineMiddleware, c as defineScheduled, i as defineHead, n as basicAuth, o as defineQueue, r as defineHandler, s as defineRender, t as VoidAssetRewriteError } from "./handler-DnI_au0K.mjs";
|
|
45
45
|
import module, { builtinModules, createRequire } from "node:module";
|
|
46
|
-
import { chmodSync, closeSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
47
|
-
import { createRunnableDevEnvironment, defaultServerConditions, isRunnableDevEnvironment, loadEnv, normalizePath, parseSync, resolveEnvPrefix } from "vite";
|
|
46
|
+
import { chmodSync, closeSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
47
|
+
import { createRunnableDevEnvironment, defaultServerConditions, isFileServingAllowed, isRunnableDevEnvironment, loadEnv, normalizePath, parseSync, resolveEnvPrefix } from "vite";
|
|
48
48
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
49
49
|
import { appendSqliteClassMigration } from "@void/deploy-core";
|
|
50
50
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
@@ -54,6 +54,8 @@ import { getRootConfigPath, getWorkerAssetsDir, getWorkerConfigPath, readBuildOu
|
|
|
54
54
|
import { convertToWranglerConfig } from "@cloudflare/config";
|
|
55
55
|
import { cloudflare } from "@cloudflare/vite-plugin";
|
|
56
56
|
import { parse } from "smol-toml";
|
|
57
|
+
import { readFile, stat } from "node:fs/promises";
|
|
58
|
+
import mime from "mime";
|
|
57
59
|
import { compilePattern, matchPattern } from "@void/edge";
|
|
58
60
|
// src/pages/dev-css-assets.ts
|
|
59
61
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
@@ -493,11 +495,11 @@ function readVoidDevCredentials(root) {
|
|
|
493
495
|
* block the server. On completion, writes project.json and restarts the server.
|
|
494
496
|
*/
|
|
495
497
|
async function runAiSetupPrompt(root, token, apiUrl, server) {
|
|
496
|
-
const { select, text, isCancel, log } = await import("./dist-
|
|
497
|
-
const { PlatformClient } = await import("./client-
|
|
498
|
+
const { select, text, isCancel, log } = await import("./dist-Cp4b1_T9.mjs");
|
|
499
|
+
const { PlatformClient } = await import("./client-D1Vz1Zep.mjs");
|
|
498
500
|
const { attachSelectedPlatform, writeProjectConfig } = await import("./project-DVsTAWFh.mjs");
|
|
499
|
-
const { inferDefaultSlug } = await import("./resolve-project-
|
|
500
|
-
const { printSuccess } = await import("./output-
|
|
501
|
+
const { inferDefaultSlug } = await import("./resolve-project-C5wC-Hoi.mjs");
|
|
502
|
+
const { printSuccess } = await import("./output-BsdnNpxa.mjs");
|
|
501
503
|
const client = new PlatformClient(token, { apiUrl });
|
|
502
504
|
let projects;
|
|
503
505
|
try {
|
|
@@ -524,7 +526,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
|
|
|
524
526
|
let slug;
|
|
525
527
|
if (result === "__create__") {
|
|
526
528
|
const { validateProjectSlug } = await import("./project-slug-BUy0lmyR.mjs");
|
|
527
|
-
const { createProjectWithSlugRetry } = await import("./create-project-
|
|
529
|
+
const { createProjectWithSlugRetry } = await import("./create-project-DzY05xqC.mjs");
|
|
528
530
|
let created;
|
|
529
531
|
try {
|
|
530
532
|
created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
|
|
@@ -812,145 +814,23 @@ function withLocalPreviewBindings(plugins, root) {
|
|
|
812
814
|
}
|
|
813
815
|
}];
|
|
814
816
|
}
|
|
815
|
-
// src/plugin-cloudflare.ts
|
|
816
|
-
function isInside(directory, path) {
|
|
817
|
-
const child = relative(directory, path);
|
|
818
|
-
return child !== ".." && !child.startsWith("../") && !isAbsolute(child);
|
|
819
|
-
}
|
|
820
|
-
/** Keep Void's public configuration and artifact layout while running the v2 plugin. */
|
|
821
|
-
function cloudflare$1(options) {
|
|
822
|
-
const root = process.cwd();
|
|
823
|
-
let workerConfig;
|
|
824
|
-
let native;
|
|
825
|
-
let pluginNative;
|
|
826
|
-
const outputDirectories = /* @__PURE__ */ new Map();
|
|
827
|
-
const bridge = {
|
|
828
|
-
name: "void:cloudflare-config",
|
|
829
|
-
config(_userConfig, environment) {
|
|
830
|
-
if (environment.isPreview) return;
|
|
831
|
-
let base = options.configPath ? readGeneratedWranglerConfigFile(options.configPath) : {};
|
|
832
|
-
if (process.env.CLOUDFLARE_ENV && base.env) {
|
|
833
|
-
const selected = base.env[process.env.CLOUDFLARE_ENV];
|
|
834
|
-
if (!selected) throw new Error(`Cloudflare environment ${process.env.CLOUDFLARE_ENV} is not configured.`);
|
|
835
|
-
const original = base;
|
|
836
|
-
base = convertToWranglerConfig(toNativeCloudflareConfig(base, root));
|
|
837
|
-
base.main = selected.main ?? original.main;
|
|
838
|
-
base.migrations = selected.migrations ?? original.migrations;
|
|
839
|
-
base.assets = {
|
|
840
|
-
...base.assets,
|
|
841
|
-
directory: selected.assets?.directory ?? original.assets?.directory
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
workerConfig = mergeCloudflareConfig(options.config(base), base);
|
|
845
|
-
native = toNativeCloudflareConfig(workerConfig, root);
|
|
846
|
-
pluginNative = structuredClone(native);
|
|
847
|
-
if (environment.command === "build" && native.containers.length > 0) {
|
|
848
|
-
pluginNative.containers = [];
|
|
849
|
-
for (const declaration of Object.values(pluginNative.worker?.exports ?? {})) if ("container" in declaration) delete declaration.container;
|
|
850
|
-
} else if (environment.command === "serve") restoreLocalContainerBindings(pluginNative.worker);
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
const directories = {
|
|
854
|
-
name: "void:cloudflare-output-directories",
|
|
855
|
-
enforce: "post",
|
|
856
|
-
config(userConfig) {
|
|
857
|
-
const environmentNames = [options.viteEnvironment.name ?? "ssr", ...options.viteEnvironment.childEnvironments ?? []];
|
|
858
|
-
for (const name of [...environmentNames, "client"]) outputDirectories.set(name, resolve(root, userConfig.environments?.[name]?.build?.outDir ?? join(userConfig.build?.outDir ?? "dist", name)));
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
const output = {
|
|
862
|
-
name: "void:cloudflare-build-output",
|
|
863
|
-
enforce: "post",
|
|
864
|
-
writeBundle: {
|
|
865
|
-
order: "post",
|
|
866
|
-
handler() {
|
|
867
|
-
if (this.environment?.name !== "client") return;
|
|
868
|
-
const source = resolve(root, this.environment.config.build.outDir);
|
|
869
|
-
const destination = outputDirectories.get("client");
|
|
870
|
-
if (destination && source !== destination && existsSync(source)) {
|
|
871
|
-
mkdirSync(destination, { recursive: true });
|
|
872
|
-
cpSync(source, destination, { recursive: true });
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
},
|
|
876
|
-
buildApp: {
|
|
877
|
-
order: "post",
|
|
878
|
-
async handler(builder) {
|
|
879
|
-
if (Object.values(native.worker?.env ?? {}).some((binding) => binding.type === "assets")) mkdirSync(getWorkerAssetsDir(root), { recursive: true });
|
|
880
|
-
const worker = (await readBuildOutput(root)).workers.default;
|
|
881
|
-
const environment = options.viteEnvironment.name ?? "ssr";
|
|
882
|
-
const destination = outputDirectories.get(environment);
|
|
883
|
-
const client = outputDirectories.get("client");
|
|
884
|
-
if (!worker.bundleDir || !worker.config.manifest) throw new Error("Void requires a built Cloudflare Worker.");
|
|
885
|
-
for (const directory of [destination, client]) if (directory !== root && isInside(root, directory) && !isInside(directory, worker.bundleDir)) rmSync(directory, {
|
|
886
|
-
recursive: true,
|
|
887
|
-
force: true
|
|
888
|
-
});
|
|
889
|
-
mkdirSync(destination, { recursive: true });
|
|
890
|
-
cpSync(worker.bundleDir, destination, { recursive: true });
|
|
891
|
-
if (worker.assetsDir) {
|
|
892
|
-
mkdirSync(client, { recursive: true });
|
|
893
|
-
cpSync(worker.assetsDir, client, { recursive: true });
|
|
894
|
-
}
|
|
895
|
-
const config = {
|
|
896
|
-
...workerConfig,
|
|
897
|
-
name: worker.config.name,
|
|
898
|
-
account_id: native.accountId,
|
|
899
|
-
compatibility_date: worker.config.compatibilityDate,
|
|
900
|
-
compatibility_flags: worker.config.compatibilityFlags,
|
|
901
|
-
main: worker.config.manifest.mainModule,
|
|
902
|
-
no_bundle: true,
|
|
903
|
-
rules: [{
|
|
904
|
-
type: "ESModule",
|
|
905
|
-
globs: ["**/*.js", "**/*.mjs"]
|
|
906
|
-
}],
|
|
907
|
-
...process.env.CLOUDFLARE_ENV ? { targetEnvironment: process.env.CLOUDFLARE_ENV } : {},
|
|
908
|
-
...workerConfig.assets || worker.assetsDir ? { assets: {
|
|
909
|
-
...workerConfig.assets,
|
|
910
|
-
directory: relative(destination, client)
|
|
911
|
-
} } : {}
|
|
912
|
-
};
|
|
913
|
-
delete config.env;
|
|
914
|
-
writeFileAtomic(join(destination, "wrangler.json"), `${JSON.stringify(config, null, 2)}\n`);
|
|
915
|
-
if (options.finalizeAssets) {
|
|
916
|
-
options.finalizeAssets(client, builder.environments.client);
|
|
917
|
-
const finalized = JSON.parse(readFileSync(join(destination, "wrangler.json"), "utf8"));
|
|
918
|
-
if (worker.config.assets && finalized.assets) {
|
|
919
|
-
worker.config.assets.runWorkerFirst = finalized.assets.run_worker_first;
|
|
920
|
-
writeFileAtomic(worker.configPath, JSON.stringify(worker.config));
|
|
921
|
-
}
|
|
922
|
-
if (worker.assetsDir && existsSync(client)) cpSync(client, worker.assetsDir, { recursive: true });
|
|
923
|
-
}
|
|
924
|
-
if (native.containers.length > 0) writeFileAtomic(join(dirname(getRootConfigPath(root)), "void-containers.json"), JSON.stringify({ workerDirectory: relative(root, destination) }));
|
|
925
|
-
const pointer = join(root, ".wrangler/deploy/config.json");
|
|
926
|
-
const pointerDestination = existsSync(join(root, "void.config.ts")) && process.env["VOID_CLOUDFLARE_DEPLOY_BUILD"] !== "1" ? join(root, ".void/preview-deploy-config.json") : pointer;
|
|
927
|
-
mkdirSync(dirname(pointerDestination), { recursive: true });
|
|
928
|
-
writeFileAtomic(pointerDestination, JSON.stringify({ configPath: relative(dirname(pointer), join(destination, "wrangler.json")) }));
|
|
929
|
-
for (const name of options.viteEnvironment.childEnvironments ?? []) {
|
|
930
|
-
const source = builder.environments[name]?.config.build.outDir;
|
|
931
|
-
const target = outputDirectories.get(name);
|
|
932
|
-
if (source && target && existsSync(source)) cpSync(source, target, { recursive: true });
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
return [
|
|
938
|
-
bridge,
|
|
939
|
-
directories,
|
|
940
|
-
...withLocalPreviewBindings(cloudflare({
|
|
941
|
-
inspectorPort: options.inspectorPort,
|
|
942
|
-
persistState: options.persistState,
|
|
943
|
-
viteEnvironment: options.viteEnvironment,
|
|
944
|
-
auxiliaryWorkers: nativeAuxiliaryWorkers(options.auxiliaryWorkers, root),
|
|
945
|
-
types: { generate: false },
|
|
946
|
-
config() {
|
|
947
|
-
return pluginNative;
|
|
948
|
-
}
|
|
949
|
-
}), root),
|
|
950
|
-
output
|
|
951
|
-
];
|
|
952
|
-
}
|
|
953
817
|
// src/plugin-dev-config.ts
|
|
818
|
+
/**
|
|
819
|
+
* Whether Vite is resolving the server that Vitest creates to run tests, whatever its `--mode`.
|
|
820
|
+
* Vitest adds its own plugins (`vitest`, `vitest:*`) to that server's config; a server that a
|
|
821
|
+
* test starts through Vite's API has none. Vitest runs test files in Node.js, so Void starts no
|
|
822
|
+
* Worker there, applies no local migrations and asks no questions. Check these names again when
|
|
823
|
+
* updating Vitest: `test/integration/vitest-app.test.ts` runs the tests of Void apps.
|
|
824
|
+
*/
|
|
825
|
+
function isVitestServer(config) {
|
|
826
|
+
const pending = [...config.plugins ?? []];
|
|
827
|
+
while (pending.length > 0) {
|
|
828
|
+
const plugin = pending.pop();
|
|
829
|
+
if (Array.isArray(plugin)) pending.push(...plugin);
|
|
830
|
+
else if (plugin && "name" in plugin && typeof plugin.name === "string" && (plugin.name === "vitest" || plugin.name.startsWith("vitest:"))) return true;
|
|
831
|
+
}
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
954
834
|
/** Run `fn` shortly after Vite prints "ready" so dev messages stay visible. */
|
|
955
835
|
function afterServerReady(server, fn) {
|
|
956
836
|
if (server.httpServer) server.httpServer.once("listening", () => setTimeout(fn, 100));
|
|
@@ -1107,6 +987,157 @@ function warnIfPackageJsonIsNotEsm(root) {
|
|
|
1107
987
|
if (pkg.type === "module") return;
|
|
1108
988
|
voidWarn("package.json is missing `\"type\": \"module\"`. Vite's default config loader will fail with ERR_REQUIRE_ASYNC_MODULE on transitive top-level await (e.g. @cloudflare/vite-plugin). Add `\"type\": \"module\"` to package.json, or run vite build with `--configLoader runner`.");
|
|
1109
989
|
}
|
|
990
|
+
// src/plugin-cloudflare.ts
|
|
991
|
+
function isInside(directory, path) {
|
|
992
|
+
const child = relative(directory, path);
|
|
993
|
+
return child !== ".." && !child.startsWith("../") && !isAbsolute(child);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Vitest runs tests in Node.js, in a Vite server of its own that turns off dependency
|
|
997
|
+
* prebundling. The Cloudflare plugin needs prebundling to start the Worker, so the Worker would
|
|
998
|
+
* fail before any test runs. Leave these plugins out of that server; Void's other plugins still
|
|
999
|
+
* resolve `void/*`, `@schema` and the generated modules for tests.
|
|
1000
|
+
*/
|
|
1001
|
+
function skipOnVitestServer(plugins) {
|
|
1002
|
+
for (const plugin of plugins) {
|
|
1003
|
+
const apply = plugin.apply;
|
|
1004
|
+
plugin.apply = (config, environment) => !isVitestServer(config) && (typeof apply === "function" ? apply(config, environment) : apply === void 0 || apply === environment.command);
|
|
1005
|
+
}
|
|
1006
|
+
return plugins;
|
|
1007
|
+
}
|
|
1008
|
+
/** Keep Void's public configuration and artifact layout while running the v2 plugin. */
|
|
1009
|
+
function cloudflare$1(options) {
|
|
1010
|
+
const root = process.cwd();
|
|
1011
|
+
let workerConfig;
|
|
1012
|
+
let native;
|
|
1013
|
+
let pluginNative;
|
|
1014
|
+
const outputDirectories = /* @__PURE__ */ new Map();
|
|
1015
|
+
const bridge = {
|
|
1016
|
+
name: "void:cloudflare-config",
|
|
1017
|
+
config(_userConfig, environment) {
|
|
1018
|
+
if (environment.isPreview) return;
|
|
1019
|
+
let base = options.configPath ? readGeneratedWranglerConfigFile(options.configPath) : {};
|
|
1020
|
+
if (process.env.CLOUDFLARE_ENV && base.env) {
|
|
1021
|
+
const selected = base.env[process.env.CLOUDFLARE_ENV];
|
|
1022
|
+
if (!selected) throw new Error(`Cloudflare environment ${process.env.CLOUDFLARE_ENV} is not configured.`);
|
|
1023
|
+
const original = base;
|
|
1024
|
+
base = convertToWranglerConfig(toNativeCloudflareConfig(base, root));
|
|
1025
|
+
base.main = selected.main ?? original.main;
|
|
1026
|
+
base.migrations = selected.migrations ?? original.migrations;
|
|
1027
|
+
base.assets = {
|
|
1028
|
+
...base.assets,
|
|
1029
|
+
directory: selected.assets?.directory ?? original.assets?.directory
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
workerConfig = mergeCloudflareConfig(options.config(base), base);
|
|
1033
|
+
native = toNativeCloudflareConfig(workerConfig, root);
|
|
1034
|
+
pluginNative = structuredClone(native);
|
|
1035
|
+
if (environment.command === "build" && native.containers.length > 0) {
|
|
1036
|
+
pluginNative.containers = [];
|
|
1037
|
+
for (const declaration of Object.values(pluginNative.worker?.exports ?? {})) if ("container" in declaration) delete declaration.container;
|
|
1038
|
+
} else if (environment.command === "serve") restoreLocalContainerBindings(pluginNative.worker);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
const directories = {
|
|
1042
|
+
name: "void:cloudflare-output-directories",
|
|
1043
|
+
enforce: "post",
|
|
1044
|
+
config(userConfig) {
|
|
1045
|
+
const environmentNames = [options.viteEnvironment.name ?? "ssr", ...options.viteEnvironment.childEnvironments ?? []];
|
|
1046
|
+
for (const name of [...environmentNames, "client"]) outputDirectories.set(name, resolve(root, userConfig.environments?.[name]?.build?.outDir ?? join(userConfig.build?.outDir ?? "dist", name)));
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
const output = {
|
|
1050
|
+
name: "void:cloudflare-build-output",
|
|
1051
|
+
enforce: "post",
|
|
1052
|
+
writeBundle: {
|
|
1053
|
+
order: "post",
|
|
1054
|
+
handler() {
|
|
1055
|
+
if (this.environment?.name !== "client") return;
|
|
1056
|
+
const source = resolve(root, this.environment.config.build.outDir);
|
|
1057
|
+
const destination = outputDirectories.get("client");
|
|
1058
|
+
if (destination && source !== destination && existsSync(source)) {
|
|
1059
|
+
mkdirSync(destination, { recursive: true });
|
|
1060
|
+
cpSync(source, destination, { recursive: true });
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
buildApp: {
|
|
1065
|
+
order: "post",
|
|
1066
|
+
async handler(builder) {
|
|
1067
|
+
if (Object.values(native.worker?.env ?? {}).some((binding) => binding.type === "assets")) mkdirSync(getWorkerAssetsDir(root), { recursive: true });
|
|
1068
|
+
const worker = (await readBuildOutput(root)).workers.default;
|
|
1069
|
+
const environment = options.viteEnvironment.name ?? "ssr";
|
|
1070
|
+
const destination = outputDirectories.get(environment);
|
|
1071
|
+
const client = outputDirectories.get("client");
|
|
1072
|
+
if (!worker.bundleDir || !worker.config.manifest) throw new Error("Void requires a built Cloudflare Worker.");
|
|
1073
|
+
for (const directory of [destination, client]) if (directory !== root && isInside(root, directory) && !isInside(directory, worker.bundleDir)) rmSync(directory, {
|
|
1074
|
+
recursive: true,
|
|
1075
|
+
force: true
|
|
1076
|
+
});
|
|
1077
|
+
mkdirSync(destination, { recursive: true });
|
|
1078
|
+
cpSync(worker.bundleDir, destination, { recursive: true });
|
|
1079
|
+
if (worker.assetsDir) {
|
|
1080
|
+
mkdirSync(client, { recursive: true });
|
|
1081
|
+
cpSync(worker.assetsDir, client, { recursive: true });
|
|
1082
|
+
}
|
|
1083
|
+
const config = {
|
|
1084
|
+
...workerConfig,
|
|
1085
|
+
name: worker.config.name,
|
|
1086
|
+
account_id: native.accountId,
|
|
1087
|
+
compatibility_date: worker.config.compatibilityDate,
|
|
1088
|
+
compatibility_flags: worker.config.compatibilityFlags,
|
|
1089
|
+
main: worker.config.manifest.mainModule,
|
|
1090
|
+
no_bundle: true,
|
|
1091
|
+
rules: [{
|
|
1092
|
+
type: "ESModule",
|
|
1093
|
+
globs: ["**/*.js", "**/*.mjs"]
|
|
1094
|
+
}],
|
|
1095
|
+
...process.env.CLOUDFLARE_ENV ? { targetEnvironment: process.env.CLOUDFLARE_ENV } : {},
|
|
1096
|
+
...workerConfig.assets || worker.assetsDir ? { assets: {
|
|
1097
|
+
...workerConfig.assets,
|
|
1098
|
+
directory: relative(destination, client)
|
|
1099
|
+
} } : {}
|
|
1100
|
+
};
|
|
1101
|
+
delete config.env;
|
|
1102
|
+
writeFileAtomic(join(destination, "wrangler.json"), `${JSON.stringify(config, null, 2)}\n`);
|
|
1103
|
+
if (options.finalizeAssets) {
|
|
1104
|
+
options.finalizeAssets(client, builder.environments.client);
|
|
1105
|
+
const finalized = JSON.parse(readFileSync(join(destination, "wrangler.json"), "utf8"));
|
|
1106
|
+
if (worker.config.assets && finalized.assets) {
|
|
1107
|
+
worker.config.assets.runWorkerFirst = finalized.assets.run_worker_first;
|
|
1108
|
+
writeFileAtomic(worker.configPath, JSON.stringify(worker.config));
|
|
1109
|
+
}
|
|
1110
|
+
if (worker.assetsDir && existsSync(client)) cpSync(client, worker.assetsDir, { recursive: true });
|
|
1111
|
+
}
|
|
1112
|
+
if (native.containers.length > 0) writeFileAtomic(join(dirname(getRootConfigPath(root)), "void-containers.json"), JSON.stringify({ workerDirectory: relative(root, destination) }));
|
|
1113
|
+
const pointer = join(root, ".wrangler/deploy/config.json");
|
|
1114
|
+
const pointerDestination = existsSync(join(root, "void.config.ts")) && process.env["VOID_CLOUDFLARE_DEPLOY_BUILD"] !== "1" ? join(root, ".void/preview-deploy-config.json") : pointer;
|
|
1115
|
+
mkdirSync(dirname(pointerDestination), { recursive: true });
|
|
1116
|
+
writeFileAtomic(pointerDestination, JSON.stringify({ configPath: relative(dirname(pointer), join(destination, "wrangler.json")) }));
|
|
1117
|
+
for (const name of options.viteEnvironment.childEnvironments ?? []) {
|
|
1118
|
+
const source = builder.environments[name]?.config.build.outDir;
|
|
1119
|
+
const target = outputDirectories.get(name);
|
|
1120
|
+
if (source && target && existsSync(source)) cpSync(source, target, { recursive: true });
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
return skipOnVitestServer([
|
|
1126
|
+
bridge,
|
|
1127
|
+
directories,
|
|
1128
|
+
...withLocalPreviewBindings(cloudflare({
|
|
1129
|
+
inspectorPort: options.inspectorPort,
|
|
1130
|
+
persistState: options.persistState,
|
|
1131
|
+
viteEnvironment: options.viteEnvironment,
|
|
1132
|
+
auxiliaryWorkers: nativeAuxiliaryWorkers(options.auxiliaryWorkers, root),
|
|
1133
|
+
types: { generate: false },
|
|
1134
|
+
config() {
|
|
1135
|
+
return pluginNative;
|
|
1136
|
+
}
|
|
1137
|
+
}), root),
|
|
1138
|
+
output
|
|
1139
|
+
]);
|
|
1140
|
+
}
|
|
1110
1141
|
// src/plugin-dev-triggers-hint.ts
|
|
1111
1142
|
/**
|
|
1112
1143
|
* Prints a one-shot hint on dev server start when the project has crons
|
|
@@ -1695,7 +1726,7 @@ function readProcessEnvCopies() {
|
|
|
1695
1726
|
* once per environment) see only the shell.
|
|
1696
1727
|
*/
|
|
1697
1728
|
function stripLocalClientEnv(root, config, before) {
|
|
1698
|
-
if (config.envDir === false ||
|
|
1729
|
+
if (config.envDir === false || realPath(config.envDir) !== realPath(root)) return;
|
|
1699
1730
|
const file = join(root, LOCAL_ENV_FILE);
|
|
1700
1731
|
if (!existsSync(file)) return;
|
|
1701
1732
|
const parsed = parseEnv(readFileSync(file, "utf8"));
|
|
@@ -1716,13 +1747,21 @@ function stripLocalClientEnv(root, config, before) {
|
|
|
1716
1747
|
}
|
|
1717
1748
|
}
|
|
1718
1749
|
/** Match Vite's canonical paths, including Windows short names and filesystem casing. */
|
|
1719
|
-
function
|
|
1750
|
+
function realPath(path) {
|
|
1720
1751
|
try {
|
|
1721
|
-
return realpathSync.native(
|
|
1752
|
+
return realpathSync.native(path);
|
|
1722
1753
|
} catch {
|
|
1723
|
-
return resolve(
|
|
1754
|
+
return resolve(path);
|
|
1724
1755
|
}
|
|
1725
1756
|
}
|
|
1757
|
+
/** Module ids that name an env file: its path as found, and as Vite resolves it. */
|
|
1758
|
+
function envFileIdsFor(envFile) {
|
|
1759
|
+
return new Set(envFile ? [normalizePath(envFile), normalizePath(realPath(envFile))] : []);
|
|
1760
|
+
}
|
|
1761
|
+
/** A hook filter pattern that matches exactly `id`. */
|
|
1762
|
+
function exactId(id) {
|
|
1763
|
+
return new RegExp(`^${id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
|
|
1764
|
+
}
|
|
1726
1765
|
/** Patterns Vite's `define` typically uses for env-shaped constants. */
|
|
1727
1766
|
const DEFINE_ENV_PATTERN = /^(?:globalThis\.)?(?:process\.env|import\.meta\.env)\.([A-Z_][A-Z0-9_]*)$/;
|
|
1728
1767
|
/**
|
|
@@ -1739,6 +1778,18 @@ const DEFINE_ENV_PATTERN = /^(?:globalThis\.)?(?:process\.env|import\.meta\.env)
|
|
|
1739
1778
|
function envSchemaPlugin(root, options = {}) {
|
|
1740
1779
|
const outDir = join(root, ".void");
|
|
1741
1780
|
let envFile = null;
|
|
1781
|
+
let envFileIds = envFileIdsFor(findEnvFile(root));
|
|
1782
|
+
const keepEnvFileImport = {
|
|
1783
|
+
filter: { id: [...envFileIds].map(exactId) },
|
|
1784
|
+
handler(code, id) {
|
|
1785
|
+
if (this.environment.config.consumer === "client" || !envFileIds.has(id)) return;
|
|
1786
|
+
return {
|
|
1787
|
+
code,
|
|
1788
|
+
map: null,
|
|
1789
|
+
moduleSideEffects: true
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
};
|
|
1742
1793
|
let command = "serve";
|
|
1743
1794
|
let processEnvCopiesBefore;
|
|
1744
1795
|
const appliedClientDefaults = /* @__PURE__ */ new Map();
|
|
@@ -1847,10 +1898,11 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1847
1898
|
async config(_config, environment) {
|
|
1848
1899
|
processEnvCopiesBefore = environment.command === "build" ? readProcessEnvCopies() : void 0;
|
|
1849
1900
|
const legacyFiles = findLegacyEnvFiles(root);
|
|
1850
|
-
if (legacyFiles.length > 0) throw new Error(`void/env supports one local file: .env. Remove ${legacyFiles.join(", ")} and follow the env migration guide
|
|
1901
|
+
if (legacyFiles.length > 0) throw new Error(`void/env supports one local file: .env. Remove ${legacyFiles.join(", ")} and follow the env migration guide.${legacyEnvExampleHint(legacyFiles)}`);
|
|
1851
1902
|
const reservedInDotenv = findReservedEnvKeys(scanWranglerDotenvKeys(join(root, LOCAL_ENV_FILE)));
|
|
1852
1903
|
if (reservedInDotenv.length > 0) throw new Error(reservedEnvKeysMessage(".env", reservedInDotenv));
|
|
1853
1904
|
envFile = findEnvFile(root);
|
|
1905
|
+
envFileIds = envFileIdsFor(envFile);
|
|
1854
1906
|
if (!envFile) return;
|
|
1855
1907
|
regenerateTypes();
|
|
1856
1908
|
await importUserEnv(environment.command === "build");
|
|
@@ -1898,7 +1950,8 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1898
1950
|
},
|
|
1899
1951
|
async buildStart() {
|
|
1900
1952
|
if (envFile) await importUserEnv();
|
|
1901
|
-
}
|
|
1953
|
+
},
|
|
1954
|
+
...envFileIds.size > 0 && { transform: keepEnvFileImport }
|
|
1902
1955
|
};
|
|
1903
1956
|
}
|
|
1904
1957
|
// src/plugin-framework-triggers.ts
|
|
@@ -2440,7 +2493,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2440
2493
|
const managedDispatch = options.nodeTarget !== true && options.dev !== true && options.managedDispatch === true;
|
|
2441
2494
|
lines.push(`import { AsyncLocalStorage } from "node:async_hooks";`);
|
|
2442
2495
|
lines.push(`import { Hono } from ${JSON.stringify(options.honoPath)};`);
|
|
2443
|
-
lines.push(`import { createRoutingRuntime as __createRoutingRuntime, createHttpRouteHandler as __createHttpRouteHandler, createErrorRenderer as __createErrorRenderer, createPageGetHandler as __createPageGetHandler, createPageMutationHandler as __createPageMutationHandler, createNamedActionMarker as __createNamedActionMarker, markRouteHandler as __markRouteHandler, createPagesFallback as __createPagesFallback, createModuleLoader as __createModuleLoader, createClientAssetTags as __createClientAssetTags, createManifestLoader as __createManifestLoader, createSsrFallback as __createSsrFallback, createAssetNotFound as __createAssetNotFound } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
|
|
2496
|
+
lines.push(`import { createRoutingRuntime as __createRoutingRuntime, createHttpRouteHandler as __createHttpRouteHandler, createErrorRenderer as __createErrorRenderer, createPageGetHandler as __createPageGetHandler, createStaticNotFound as __createStaticNotFound, createPageMutationHandler as __createPageMutationHandler, createNamedActionMarker as __createNamedActionMarker, markRouteHandler as __markRouteHandler, createPagesFallback as __createPagesFallback, createModuleLoader as __createModuleLoader, createClientAssetTags as __createClientAssetTags, createManifestLoader as __createManifestLoader, createSsrFallback as __createSsrFallback, createAssetNotFound as __createAssetNotFound, buildPrerenderPath as __buildPrerenderPath } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};`);
|
|
2444
2497
|
if (options.nodeTarget) lines.push(`const withRuntimeEnv = (_env, fn) => fn();`);
|
|
2445
2498
|
else lines.push(`import { withRuntimeEnv } from ${JSON.stringify(options.runtimeEnvPath)};`);
|
|
2446
2499
|
if (auth) {
|
|
@@ -2475,7 +2528,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2475
2528
|
lines.push(`const app = new Hono();`);
|
|
2476
2529
|
const routePatterns = [];
|
|
2477
2530
|
for (const r of scan.routes) routePatterns.push(r.pattern);
|
|
2478
|
-
if (pages && scan.pages.pages.length > 0) for (const p of scan.pages.pages) routePatterns.push(p.pattern);
|
|
2531
|
+
if (pages && (scan.pages.pages.length > 0 || scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory))) for (const p of scan.pages.pages) routePatterns.push(p.pattern);
|
|
2479
2532
|
const usedExts = /* @__PURE__ */ new Set();
|
|
2480
2533
|
for (const p of routePatterns) {
|
|
2481
2534
|
const m = /\.([A-Za-z0-9]+)$/.exec(p);
|
|
@@ -2574,11 +2627,21 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2574
2627
|
lines.push("");
|
|
2575
2628
|
}
|
|
2576
2629
|
const pageNames = createIdentifierNames();
|
|
2577
|
-
if (pages && scan.pages.pages.length > 0) compilePageRoutes(lines, scan, pages, options, pageNames);
|
|
2630
|
+
if (pages && (scan.pages.pages.length > 0 || scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory))) compilePageRoutes(lines, scan, pages, options, pageNames);
|
|
2631
|
+
if (!pages || !createBoundaryManifest(scan.pages).root) lines.push("export async function __voidRenderStaticNotFound() { return new Response(null, { status: 204 }); }");
|
|
2578
2632
|
for (let i = 0; i < webSockets.length; i++) lines.push(`app.all(${JSON.stringify(webSockets[i].pattern)}, __markRouteHandler((c) => __forwardWebSocketRequest(c.req.raw, c.env, __voidWebSocketRoutes[${i}])));`);
|
|
2579
2633
|
if (webSockets.length > 0) lines.push("");
|
|
2580
|
-
|
|
2581
|
-
|
|
2634
|
+
const trackAssetMisses = !options.nodeTarget && !managedDispatch;
|
|
2635
|
+
const registerNotFound = (handler) => {
|
|
2636
|
+
const tracked = trackAssetMisses ? `__routingRuntime.trackNotFound(${handler})` : handler;
|
|
2637
|
+
lines.push(`app.notFound(${tracked});`);
|
|
2638
|
+
};
|
|
2639
|
+
if (trackAssetMisses) lines.push("app.notFound(__routingRuntime.trackNotFound());");
|
|
2640
|
+
if (pages && (scan.pages.pages.length > 0 || scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory))) {
|
|
2641
|
+
const pagePatterns = options.trailingSlash ? `[${scan.pages.pages.map((page) => patternToRegex(page.pattern)).join(", ")}]` : "undefined";
|
|
2642
|
+
registerNotFound(`__createPagesFallback({ ${createBoundaryManifest(scan.pages).root ? "pageNotFound: __voidRootNotFound, " : ""}routing: __routingRuntime, errors: __errorRenderer, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson}, trailingSlash: ${options.trailingSlash === true}, pagePatterns: ${pagePatterns} })`);
|
|
2643
|
+
}
|
|
2644
|
+
compilePrerenderCollector(lines, scan, ssr, options, pageNames, pages?.pagesDirRelative);
|
|
2582
2645
|
if (ssr) {
|
|
2583
2646
|
lines.push(`const getClientAssetTags = __createClientAssetTags(${JSON.stringify({
|
|
2584
2647
|
entryId: ssr.clientEntryRelativePath,
|
|
@@ -2587,8 +2650,8 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2587
2650
|
dev: options.dev === true,
|
|
2588
2651
|
reactRefresh: options.reactRefresh
|
|
2589
2652
|
})});`);
|
|
2590
|
-
|
|
2591
|
-
} else if (emitEdgeRules && (options.fallbackRules?.length || options.redirectRules?.some((rule) => rule.status === 200) || !options.nodeTarget && options.headerRules?.length) && !(pages && scan.pages.pages.length > 0))
|
|
2653
|
+
registerNotFound(`__createSsrFallback({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson}, load: () => import(${JSON.stringify(ssr.serverEntryPath)}), assets: getClientAssetTags })`);
|
|
2654
|
+
} else if (emitEdgeRules && (options.fallbackRules?.length || options.redirectRules?.some((rule) => rule.status === 200) || !options.nodeTarget && options.headerRules?.length) && !(pages && (scan.pages.pages.length > 0 || scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory)))) registerNotFound(`__createAssetNotFound({ routing: __routingRuntime, nodeTarget: ${JSON.stringify(options.nodeTarget === true)}, assetsDir: ${JSON.stringify(options.assetsDir)}, fallbackRules: ${fallbackRulesJson} })`);
|
|
2592
2655
|
if (scan.jobs.length > 0) {
|
|
2593
2656
|
for (let i = 0; i < scan.jobs.length; i++) {
|
|
2594
2657
|
const job = scan.jobs[i];
|
|
@@ -2834,19 +2897,10 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2834
2897
|
lines.push(`export default app;`);
|
|
2835
2898
|
return lines.join("\n");
|
|
2836
2899
|
}
|
|
2837
|
-
function compilePrerenderCollector(lines, scan, ssr, options, pageNames) {
|
|
2900
|
+
function compilePrerenderCollector(lines, scan, ssr, options, pageNames, pagesDirRelative) {
|
|
2838
2901
|
const staticPaths = scan.pages.pages.filter((page) => page.shouldPrerender && page.params.length === 0 && !page.catchAll).map((page) => page.pattern);
|
|
2839
2902
|
const dynamicPages = scan.pages.pages.filter((page) => page.shouldPrerender && page.hasGetPrerenderPaths && (page.params.length > 0 || page.catchAll));
|
|
2840
2903
|
const explicitPaths = options.explicitPrerenderPaths ?? [];
|
|
2841
|
-
lines.push(`function __voidBuildPrerenderPath(pattern, params) {`);
|
|
2842
|
-
lines.push(` let path = pattern;`);
|
|
2843
|
-
lines.push(` for (const [key, value] of Object.entries(params)) {`);
|
|
2844
|
-
lines.push(` path = path.replace(":" + key + "{.+}", value);`);
|
|
2845
|
-
lines.push(` path = path.replace(":" + key, value);`);
|
|
2846
|
-
lines.push(` }`);
|
|
2847
|
-
lines.push(` return path;`);
|
|
2848
|
-
lines.push(`}`);
|
|
2849
|
-
lines.push("");
|
|
2850
2904
|
lines.push(`export async function __voidCollectPrerenderPaths(request, env, ctx) {`);
|
|
2851
2905
|
lines.push(` return withRuntimeEnv(env, async () => {`);
|
|
2852
2906
|
if (options.nodeTarget) lines.push(` return requestContext.run({ request }, async () => {`);
|
|
@@ -2860,8 +2914,9 @@ function compilePrerenderCollector(lines, scan, ssr, options, pageNames) {
|
|
|
2860
2914
|
lines.push(` if (typeof mod.getPrerenderPaths === "function") {`);
|
|
2861
2915
|
lines.push(` const paramSets = await mod.getPrerenderPaths();`);
|
|
2862
2916
|
lines.push(` if (Array.isArray(paramSets)) {`);
|
|
2863
|
-
|
|
2864
|
-
lines.push(`
|
|
2917
|
+
const file = [pagesDirRelative, page.serverPath ?? page.componentPath].filter(Boolean).join("/");
|
|
2918
|
+
lines.push(` for (let index = 0; index < paramSets.length; index++) {`);
|
|
2919
|
+
lines.push(` paths.push(__buildPrerenderPath(${JSON.stringify(page.pattern)}, paramSets[index], ${JSON.stringify(file)}, index));`);
|
|
2865
2920
|
lines.push(` }`);
|
|
2866
2921
|
lines.push(` }`);
|
|
2867
2922
|
lines.push(` }`);
|
|
@@ -2881,7 +2936,7 @@ function compilePrerenderCollector(lines, scan, ssr, options, pageNames) {
|
|
|
2881
2936
|
lines.push(` }`);
|
|
2882
2937
|
}
|
|
2883
2938
|
for (const path of explicitPaths) lines.push(` paths.push(${JSON.stringify(path)});`);
|
|
2884
|
-
lines.push(` return [...new Set(paths)];`);
|
|
2939
|
+
lines.push(options.trailingSlash ? ` return [...new Set(paths.map((path) => path.endsWith("/") ? path : path + "/"))];` : ` return [...new Set(paths)];`);
|
|
2885
2940
|
lines.push(` });`);
|
|
2886
2941
|
lines.push(` });`);
|
|
2887
2942
|
lines.push(`}`);
|
|
@@ -2899,6 +2954,7 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2899
2954
|
const relPagesDir = pages.pagesDirRelative;
|
|
2900
2955
|
const pageCssKeys = {};
|
|
2901
2956
|
const pageDevRootPhases = {};
|
|
2957
|
+
const boundaryManifest = createBoundaryManifest(scan.pages);
|
|
2902
2958
|
const projectRoot = options.projectRoot;
|
|
2903
2959
|
const toDevRootUrl = (absolutePath) => "/" + absolutePath.replaceAll("\\", "/").slice(projectRoot.replaceAll("\\", "/").length + 1);
|
|
2904
2960
|
const virtualDevUrl = (id) => "/@id/__x00__" + id;
|
|
@@ -2929,6 +2985,16 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2929
2985
|
pageCssKeys[page.componentId] = keys;
|
|
2930
2986
|
pageDevRootPhases[page.componentId] = routeRootPhases.filter((phase) => phase.length > 0);
|
|
2931
2987
|
}
|
|
2988
|
+
for (const plan of Object.values(boundaryManifest.plans)) {
|
|
2989
|
+
const files = [...scan.pages.layouts, ...scan.pages.namedLayouts].filter((layout) => {
|
|
2990
|
+
const id = "name" in layout ? layout.directory ? layout.directory + "/_layouts/" + layout.name : "_layouts/" + layout.name : layout.directory ? layout.directory + "/layout" : "layout";
|
|
2991
|
+
const key = scan.pages.pages.some((page) => page.componentId === id) ? id.replace(/(^|\/)([^/]+)$/, "$1_$2") : id;
|
|
2992
|
+
return plan.layouts.includes(key);
|
|
2993
|
+
}).map((layout) => layout.filePath);
|
|
2994
|
+
files.push(plan.filePath);
|
|
2995
|
+
pageCssKeys[plan.id] = files.map((file) => `${relPagesDir}/${file}`);
|
|
2996
|
+
pageDevRootPhases[plan.id] = [[virtualDevUrl(pages.clientEntryId)], files.map((file) => toDevRootUrl(`${pages.pagesDir}/${file}`))];
|
|
2997
|
+
}
|
|
2932
2998
|
lines.push("const __loadPagesManifest = __createManifestLoader();");
|
|
2933
2999
|
const assetMetadata = {
|
|
2934
3000
|
pageCssKeys,
|
|
@@ -2950,6 +3016,17 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2950
3016
|
extraEntryUrl: pages.mdClientEntryId ? "/@id/__x00__" + pages.mdClientEntryId : void 0,
|
|
2951
3017
|
kind: "islands"
|
|
2952
3018
|
})}${devCssOption} }, __loadPagesManifest);`);
|
|
3019
|
+
if (boundaryManifest.root) {
|
|
3020
|
+
const island = scan.pages.pages.length > 0 && scan.pages.pages.every((page) => page.island);
|
|
3021
|
+
lines.push(`const __voidRootNotFoundOptions = { componentId: ${JSON.stringify(boundaryManifest.root)}, load: async () => ({ loader: () => new Response(null, { status: 404 }) }), render: ${island ? "renderIslandPage" : "renderPage"}, assets: ${island && pages.islandClientEntryId ? "getIslandsAssetTags" : "getPagesAssetTags"}, headConfig: __voidHeadConfig, renderOptions: ${JSON.stringify({
|
|
3022
|
+
renderMode: island ? "island" : "server",
|
|
3023
|
+
dev: options.dev === true,
|
|
3024
|
+
boundaries: {
|
|
3025
|
+
notFound: boundaryManifest.root,
|
|
3026
|
+
errors: boundaryManifest.rootErrors ?? []
|
|
3027
|
+
}
|
|
3028
|
+
})} }; const __voidRootNotFound = __createPageGetHandler(__voidRootNotFoundOptions); export const __voidRenderStaticNotFound = __createStaticNotFound({ ...__voidRootNotFoundOptions, render: renderPage, assets: getPagesAssetTags });`);
|
|
3029
|
+
}
|
|
2953
3030
|
const seenServerFiles = /* @__PURE__ */ new Set();
|
|
2954
3031
|
for (const page of scan.pages.pages) {
|
|
2955
3032
|
const safeId = pageNames(page.componentId);
|
|
@@ -2974,12 +3051,16 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2974
3051
|
}
|
|
2975
3052
|
const renderer = page.renderMode === "island" ? "renderIslandPage" : "renderPage";
|
|
2976
3053
|
const assetTags = page.renderMode === "island" && pages.islandClientEntryId ? "getIslandsAssetTags" : "getPagesAssetTags";
|
|
2977
|
-
const
|
|
3054
|
+
const trailingCatchAll = options.trailingSlash && page.catchAll;
|
|
3055
|
+
const pattern = trailingCatchAll ? page.pattern.slice(0, -1) : page.pattern;
|
|
3056
|
+
const catchAllParam = page.pattern.match(/:([^/{}]+)\{\.\+\}\/$/)?.[1];
|
|
3057
|
+
const routeOptions = `{ ${serverImportPath ? "load: _pload_" + safeId + ", " : ""}${mdHeadRef ? "head: " + mdHeadRef + ", " : ""}${trailingCatchAll ? `trailingSlash: true, catchAllParam: ${JSON.stringify(catchAllParam)}, ` : ""}componentId: ${JSON.stringify(page.componentId)}, render: ${renderer}, assets: ${assetTags}, headConfig: __voidHeadConfig, renderOptions: ${JSON.stringify({
|
|
2978
3058
|
renderMode: page.renderMode,
|
|
2979
|
-
...options.dev === true ? { dev: true } : {}
|
|
3059
|
+
...options.dev === true ? { dev: true } : {},
|
|
3060
|
+
...boundaryManifest.pages[page.componentId] && { boundaries: boundaryManifest.pages[page.componentId] }
|
|
2980
3061
|
})} }`;
|
|
2981
|
-
lines.push(`app.get(${JSON.stringify(
|
|
2982
|
-
if (page.methods.includes("action") || page.methods.includes("actions")) lines.push(`app.on(["POST", "PUT", "PATCH", "DELETE"], ${JSON.stringify(
|
|
3062
|
+
lines.push(`app.get(${JSON.stringify(pattern)}, __createPageGetHandler(${routeOptions}));`);
|
|
3063
|
+
if (page.methods.includes("action") || page.methods.includes("actions")) lines.push(`app.on(["POST", "PUT", "PATCH", "DELETE"], ${JSON.stringify(pattern)}, __createPageMutationHandler({ ...${routeOptions}, namedActions: ${JSON.stringify(page.methods.includes("actions"))} }));`);
|
|
2983
3064
|
}
|
|
2984
3065
|
lines.push("");
|
|
2985
3066
|
}
|
|
@@ -3042,6 +3123,7 @@ const __filterInternalBindings = (env) => __filterBindings(env, ${JSON.stringify
|
|
|
3042
3123
|
const isrDeploymentStamp = isr ? ` env.__VOID_ISR_DEPLOYMENT_ID ??= __VOID_ISR_DEPLOYMENT_ID;\n` : "";
|
|
3043
3124
|
const fetchHandler = `__createWorkerFetch({
|
|
3044
3125
|
app, assets: serveWithAssets, withRawEnv: __withRawEnv, withRuntimeEnv,
|
|
3126
|
+
staticNotFound: __voidRenderStaticNotFound,
|
|
3045
3127
|
filterBindings: __filterInternalBindings,
|
|
3046
3128
|
internalRoute: __voidHandleInternalRoute,
|
|
3047
3129
|
collectPrerenderPaths: __voidCollectPrerenderPaths${alwaysUseHttps ? ", alwaysUseHttps: true" : ""}${versionMetadataBinding ? ", versionMetadataBinding: " + JSON.stringify(versionMetadataBinding) : ""}${envSchemaModule ? ", validateEnv: _validateEnvOnce" : ""}${remotePath ? ", remoteEnv: (env) => " + createRemoteEnvCall : ""}${hasEmail ? ", emailReceipt: __handleEmailReceipt" : ""}${isr ? ", isr: { deploymentId: __VOID_ISR_DEPLOYMENT_ID, handle: (request, env, ctx, render) => handleIsr(request, env, ctx, { revalidate: __VOID_ISR_REVALIDATE, pages: __VOID_ISR_PAGES, pathRevalidate: __VOID_ISR_PATH_REVALIDATE, deploymentId: __VOID_ISR_DEPLOYMENT_ID, queryAllowlist: " + JSON.stringify(isr.queryAllowlist) + " }, render) }" : ""}
|
|
@@ -3120,7 +3202,7 @@ ${envValidateCall}${remoteEnvSwap}${isrDeploymentStamp} const userEnv = __filte
|
|
|
3120
3202
|
}
|
|
3121
3203
|
|
|
3122
3204
|
` : "";
|
|
3123
|
-
return `${sandboxImport}${entryImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidHandleInternalRoute, __withRawEnv${queueImport}${emailImport}${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
|
|
3205
|
+
return `${sandboxImport}${entryImport}${liveRuntimeImport}import app, { scheduled, __voidCollectPrerenderPaths, __voidRenderStaticNotFound, __voidHandleInternalRoute, __withRawEnv${queueImport}${emailImport}${webSocketClasses.length > 0 ? `, ${webSocketClasses.join(", ")}` : ""}${liveRouteImport} } from 'virtual:void-routes';
|
|
3124
3206
|
${durableObjectImports}\n${runtimeEnvImport}${emailProxyImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
|
|
3125
3207
|
${fetchDeclaration}
|
|
3126
3208
|
${scheduledHandler}
|
|
@@ -3139,25 +3221,41 @@ ${entryClass}`;
|
|
|
3139
3221
|
function compileNodeApp(target, honoPath, envSchemaModule) {
|
|
3140
3222
|
const staticImport = target === "bun" ? `import { serveStatic } from "hono/bun";` : target === "deno" ? `import { serveStatic } from "hono/deno";` : `import { serveStatic } from "@hono/node-server/serve-static";`;
|
|
3141
3223
|
const envSchemaImport = envSchemaModule ? `import ${JSON.stringify(envSchemaModule.importPath)};\nimport { _validateEnvOnce } from ${JSON.stringify(envSchemaModule.helperPath)};\n` : "";
|
|
3142
|
-
const envMiddleware = envSchemaModule ? `app.use("*", async (c, next) => { if (!(c.req.method === "POST" && c.req.path === "/__void/prerender-paths" && c.env?.__VOID_PRERENDER === "1")) await _validateEnvOnce(${target === "deno" ? "Deno.env.toObject()" : "process.env"}); return next(); });\n` : "";
|
|
3224
|
+
const envMiddleware = envSchemaModule ? `app.use("*", async (c, next) => { if (!(((c.req.method === "POST" && c.req.path === "/__void/prerender-paths") || (c.req.method === "GET" && c.req.path === "/__void/static-not-found")) && c.env?.__VOID_PRERENDER === "1")) await _validateEnvOnce(${target === "deno" ? "Deno.env.toObject()" : "process.env"}); return next(); });\n` : "";
|
|
3143
3225
|
return `${staticImport}
|
|
3144
3226
|
import { fileURLToPath } from "node:url";
|
|
3145
3227
|
import { Hono } from ${JSON.stringify(honoPath)};
|
|
3146
|
-
import innerApp, { __voidCollectPrerenderPaths } from "virtual:void-routes";
|
|
3228
|
+
import innerApp, { __voidCollectPrerenderPaths, __voidRenderStaticNotFound } from "virtual:void-routes";
|
|
3229
|
+
import { prerenderPathsResponse as __prerenderPathsResponse } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};
|
|
3147
3230
|
${envSchemaImport}
|
|
3148
|
-
//
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3231
|
+
// dist/client, created on first use so a server that supplies its own ASSETS
|
|
3232
|
+
// (a single executable, for one) never looks for a directory it doesn't have.
|
|
3233
|
+
let fileAssets;
|
|
3234
|
+
const clientAssets = () => {
|
|
3235
|
+
if (!fileAssets) {
|
|
3236
|
+
// Resolved by nodeTargetPlugin for this emitted chunk, including shared chunks.
|
|
3237
|
+
const clientRoot = fileURLToPath(import.meta.voidClientDirectory);
|
|
3238
|
+
const assetApp = new Hono();
|
|
3239
|
+
assetApp.get("*", serveStatic({
|
|
3240
|
+
root: clientRoot,
|
|
3241
|
+
allowPercentInPath: true,
|
|
3242
|
+
// Windows permits a trailing separator when opening a regular file.
|
|
3243
|
+
// Directory URLs must look up an index so they cannot alias those files.
|
|
3244
|
+
rewriteRequestPath: (path) => path.endsWith("/") ? path + "index.html" : path,
|
|
3245
|
+
}));
|
|
3246
|
+
fileAssets = { fetch: (request) => assetApp.fetch(request) };
|
|
3247
|
+
}
|
|
3248
|
+
return fileAssets;
|
|
3249
|
+
};
|
|
3250
|
+
const assetsFor = (c) => (typeof c.env?.ASSETS?.fetch === "function" ? c.env.ASSETS : clientAssets());
|
|
3153
3251
|
const app = new Hono();
|
|
3154
3252
|
${envMiddleware}app.post("/__void/prerender-paths", async (c) => {
|
|
3155
3253
|
if (c.env?.__VOID_PRERENDER !== "1") return c.notFound();
|
|
3156
|
-
|
|
3157
|
-
return c.json({ paths });
|
|
3254
|
+
return __prerenderPathsResponse(() => __voidCollectPrerenderPaths(c.req.raw));
|
|
3158
3255
|
});
|
|
3159
|
-
app.get("/
|
|
3160
|
-
app.
|
|
3256
|
+
app.get("/__void/static-not-found", (c) => c.env?.__VOID_PRERENDER === "1" ? __voidRenderStaticNotFound(c.req.raw, { ...c.env, ASSETS: assetsFor(c) }) : c.notFound());
|
|
3257
|
+
app.get("/assets/*", (c) => assetsFor(c).fetch(c.req.raw));
|
|
3258
|
+
app.all("*", (c) => innerApp.fetch(c.req.raw, { ...c.env, ASSETS: assetsFor(c) }));
|
|
3161
3259
|
export default app;`;
|
|
3162
3260
|
}
|
|
3163
3261
|
/**
|
|
@@ -3227,6 +3325,10 @@ function getFrameworkEntry(framework, root, devTriggerToken, dialect, notFound,
|
|
|
3227
3325
|
return generateClassATriggerWrapper(root, framework, getOriginalFrameworkEntry(framework, root, configuredMain), isBuild, dialect, void 0, notFound);
|
|
3228
3326
|
}
|
|
3229
3327
|
const TANSTACK_SERVER_ENTRY = "@tanstack/react-start/server-entry";
|
|
3328
|
+
/** Include proxy.ts and custom page extensions; vinext selects the actual convention file. */
|
|
3329
|
+
function hasVinextMiddleware(root) {
|
|
3330
|
+
return [root, join(root, "src")].some((dir) => statSync(dir, { throwIfNoEntry: false })?.isDirectory() && readdirSync(dir).some((file) => /^(?:middleware|proxy)\./i.test(file)));
|
|
3331
|
+
}
|
|
3230
3332
|
/**
|
|
3231
3333
|
* Whether `main` names a file in the app rather than a package. A migrated TanStack config keeps
|
|
3232
3334
|
* `main: "@tanstack/react-start/server-entry"`, and a package subpath may end in `.js`, so a
|
|
@@ -3249,7 +3351,7 @@ function getOriginalFrameworkEntry(framework, root, configuredMain) {
|
|
|
3249
3351
|
}
|
|
3250
3352
|
case "react-router": return generateReactRouterEntry(root);
|
|
3251
3353
|
case "vinext-app": return "vinext/server/app-router-entry";
|
|
3252
|
-
case "vinext-pages": return
|
|
3354
|
+
case "vinext-pages": return "vinext/server/pages-router-entry";
|
|
3253
3355
|
}
|
|
3254
3356
|
}
|
|
3255
3357
|
/**
|
|
@@ -3279,7 +3381,8 @@ function generateClassATriggerWrapper(root, framework, original, isBuild, dialec
|
|
|
3279
3381
|
const outDir = join(root, ".void");
|
|
3280
3382
|
mkdirSync(outDir, { recursive: true });
|
|
3281
3383
|
const wrapperPath = join(outDir, `${framework}-trigger-wrapper.ts`);
|
|
3282
|
-
const
|
|
3384
|
+
const assetFallback = framework !== "vinext-app" && framework !== "vinext-pages";
|
|
3385
|
+
const fetchBody = isBuild ? assetFallback ? ` return serveWithAssets(request, env, await original.fetch(request, env, ctx));` : ` return original.fetch(request, env, ctx);` : ` if (request.method === "POST") {
|
|
3283
3386
|
const pathname = new URL(request.url).pathname;
|
|
3284
3387
|
if (pathname === "/__void/scheduled" || pathname === "/__void/queue") {
|
|
3285
3388
|
const { handleDevTrigger } = await import(${JSON.stringify(frameworkTriggersDispatchPath(root))});
|
|
@@ -3304,36 +3407,10 @@ export default {
|
|
|
3304
3407
|
...original,
|
|
3305
3408
|
${fetchMethod}
|
|
3306
3409
|
};
|
|
3307
|
-
${isBuild ? `${compileAssetFallbackHelper(assetsDir, false, notFound)}\n` : ""}`;
|
|
3410
|
+
${isBuild && assetFallback ? `${compileAssetFallbackHelper(assetsDir, false, notFound)}\n` : ""}`;
|
|
3308
3411
|
writeFileIfChanged(wrapperPath, body);
|
|
3309
3412
|
return wrapperPath;
|
|
3310
3413
|
}
|
|
3311
|
-
/** Generate a worker entry for vinext Pages Router projects. */
|
|
3312
|
-
function generateVinextPagesEntry(root) {
|
|
3313
|
-
const outDir = join(root, ".void");
|
|
3314
|
-
mkdirSync(outDir, { recursive: true });
|
|
3315
|
-
const entryPath = join(outDir, "vinext-pages-entry.ts");
|
|
3316
|
-
writeFileIfChanged(entryPath, `// Auto-generated by Void — vinext Pages Router worker entry
|
|
3317
|
-
// @ts-expect-error virtual module resolved by vinext at build time
|
|
3318
|
-
import { renderPage, handleApiRoute } from "virtual:vinext-server-entry";
|
|
3319
|
-
|
|
3320
|
-
export default {
|
|
3321
|
-
async fetch(request: Request): Promise<Response> {
|
|
3322
|
-
const url = new URL(request.url);
|
|
3323
|
-
const pathname = url.pathname;
|
|
3324
|
-
if (pathname.replaceAll("\\\\", "/").startsWith("//")) {
|
|
3325
|
-
return new Response("404 Not Found", { status: 404 });
|
|
3326
|
-
}
|
|
3327
|
-
const urlWithQuery = pathname + url.search;
|
|
3328
|
-
if (pathname.startsWith("/api/") || pathname === "/api") {
|
|
3329
|
-
return await handleApiRoute(request, urlWithQuery);
|
|
3330
|
-
}
|
|
3331
|
-
return await renderPage(request, urlWithQuery, null);
|
|
3332
|
-
},
|
|
3333
|
-
};
|
|
3334
|
-
`);
|
|
3335
|
-
return entryPath;
|
|
3336
|
-
}
|
|
3337
3414
|
/** Generate a worker entry for React Router v7 projects. */
|
|
3338
3415
|
function generateReactRouterEntry(root) {
|
|
3339
3416
|
const outDir = join(root, ".void");
|
|
@@ -3567,14 +3644,14 @@ function readAuthDatabaseUrl(root) {
|
|
|
3567
3644
|
function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join(root, ".void"), auth) {
|
|
3568
3645
|
return {
|
|
3569
3646
|
name: "void:migrations",
|
|
3570
|
-
apply: "serve",
|
|
3647
|
+
apply: (config, { command }) => command === "serve" && !isVitestServer(config),
|
|
3571
3648
|
async configureServer(server) {
|
|
3572
3649
|
const paths = readProjectPaths(root);
|
|
3573
3650
|
const migrationsDir = paths.migrationsDir;
|
|
3574
3651
|
const hasSqlMigrations = existsSync(migrationsDir);
|
|
3575
3652
|
if (!hasSqlMigrations && !auth?.enabled) return;
|
|
3576
3653
|
const migrateAuth = async (databaseUrl) => {
|
|
3577
|
-
const { runLocalVoidAuthMigrations } = await import("./node-
|
|
3654
|
+
const { runLocalVoidAuthMigrations } = await import("./node-CXFUw0Uz.mjs");
|
|
3578
3655
|
await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth?.configPath, databaseUrl, devAuthConfigImporter(server));
|
|
3579
3656
|
};
|
|
3580
3657
|
const mysqlAuth = dialect === "mysql" && auth?.enabled === true;
|
|
@@ -3604,7 +3681,7 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
3604
3681
|
const authWithFiles = authUrl !== void 0 && authUrl === url;
|
|
3605
3682
|
if (url) {
|
|
3606
3683
|
const { validateMigrations } = await import("./validate-DY1U9rET.mjs");
|
|
3607
|
-
const appliedNames = dialect === "mysql" ? await import("./runner-mysql-
|
|
3684
|
+
const appliedNames = dialect === "mysql" ? await import("./runner-mysql-CHvEg_sy.mjs").then((runner) => runner.getMySqlAppliedMigrations(url)) : await import("./runner-pg-2pjltt0t.mjs").then((runner) => runner.getPgAppliedMigrations(url));
|
|
3608
3685
|
const appliedSet = new Set(appliedNames);
|
|
3609
3686
|
const pending = allMigrations.filter((migration) => !appliedSet.has(migration.name));
|
|
3610
3687
|
if (pending.length > 0) try {
|
|
@@ -3613,18 +3690,18 @@ function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join
|
|
|
3613
3690
|
refuse(err);
|
|
3614
3691
|
return;
|
|
3615
3692
|
}
|
|
3616
|
-
const applied = dialect === "mysql" ? await import("./runner-mysql-
|
|
3693
|
+
const applied = dialect === "mysql" ? await import("./runner-mysql-CHvEg_sy.mjs").then((runner) => runner.runMySqlMigrations(migrationsDir, url, authWithFiles ? async (names) => {
|
|
3617
3694
|
logApplied(names);
|
|
3618
3695
|
await migrateAuth(url);
|
|
3619
3696
|
} : void 0)) : await import("./runner-pg-2pjltt0t.mjs").then((runner) => runner.runPgMigrations(migrationsDir, url));
|
|
3620
3697
|
if (!authWithFiles) logApplied(applied);
|
|
3621
3698
|
}
|
|
3622
3699
|
if (authUrl && !authWithFiles) {
|
|
3623
|
-
const { withMySqlMigrationLockAt } = await import("./runner-mysql-
|
|
3700
|
+
const { withMySqlMigrationLockAt } = await import("./runner-mysql-CHvEg_sy.mjs");
|
|
3624
3701
|
await withMySqlMigrationLockAt(authUrl, () => migrateAuth(authUrl));
|
|
3625
3702
|
}
|
|
3626
3703
|
} else if (hasSqlMigrations) {
|
|
3627
|
-
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-
|
|
3704
|
+
const { runMigrations, getMiniflareDatabasePath, getAppliedMigrations } = await import("./runner-CTk21HrO.mjs");
|
|
3628
3705
|
const { collectMigrations } = await import("./collect-8i0wU63d.mjs");
|
|
3629
3706
|
const { validateMigrations } = await import("./validate-DY1U9rET.mjs");
|
|
3630
3707
|
const dbPath = getMiniflareDatabasePath(persistRoot, databaseId);
|
|
@@ -4053,7 +4130,7 @@ const CF_ONLY_REGEX = new RegExp(`^(${[
|
|
|
4053
4130
|
* Bridge Node.js HTTP to Web API and serve via a Hono app.
|
|
4054
4131
|
* Used by both dev server and preview server middleware.
|
|
4055
4132
|
*/
|
|
4056
|
-
function honoMiddleware(getApp) {
|
|
4133
|
+
function honoMiddleware(getApp, isViteFile) {
|
|
4057
4134
|
return async (req, res, next) => {
|
|
4058
4135
|
try {
|
|
4059
4136
|
if (!req.url || req.url.startsWith("/@") || req.url.startsWith("/__") || req.url.startsWith("/node_modules/")) {
|
|
@@ -4076,7 +4153,7 @@ function honoMiddleware(getApp) {
|
|
|
4076
4153
|
duplex: hasBody ? "half" : void 0
|
|
4077
4154
|
});
|
|
4078
4155
|
const response = await app.fetch(request);
|
|
4079
|
-
if (response.status === 404) {
|
|
4156
|
+
if (response.status === 404 && (await isViteFile?.(request) || !response.headers.get("content-type")?.includes("text/html") && !response.headers.has("X-VoidPages"))) {
|
|
4080
4157
|
next();
|
|
4081
4158
|
return;
|
|
4082
4159
|
}
|
|
@@ -4109,7 +4186,7 @@ function honoMiddleware(getApp) {
|
|
|
4109
4186
|
* 4. Build — dual-environment build (client + SSR) for pages apps,
|
|
4110
4187
|
* single SSR build for API-only apps
|
|
4111
4188
|
*/
|
|
4112
|
-
function nodeTargetPlugin(target) {
|
|
4189
|
+
function nodeTargetPlugin(target, options = {}) {
|
|
4113
4190
|
const unavailable = (id, root, importer) => {
|
|
4114
4191
|
const source = importer ? ` Imported by ${relative(root, importer)}.` : "";
|
|
4115
4192
|
return /* @__PURE__ */ new Error(`target: '${id}' is not available with target '${target}'. CF bindings require target: "cloudflare".${source}`);
|
|
@@ -4173,8 +4250,37 @@ function nodeTargetPlugin(target) {
|
|
|
4173
4250
|
if (builder.environments.client) await builder.build(builder.environments.client);
|
|
4174
4251
|
},
|
|
4175
4252
|
configureServer(server) {
|
|
4253
|
+
const assets = { async fetch(request) {
|
|
4254
|
+
try {
|
|
4255
|
+
const root = server.config.publicDir;
|
|
4256
|
+
if (!root) return new Response(null, { status: 404 });
|
|
4257
|
+
const pathname = new URL(request.url).pathname;
|
|
4258
|
+
let file = resolve(root, "." + decodeURIComponent(pathname));
|
|
4259
|
+
const rel = relative(root, file);
|
|
4260
|
+
if (rel === ".." || rel.startsWith("../") || isAbsolute(rel)) return new Response(null, { status: 404 });
|
|
4261
|
+
let entry = await stat(file);
|
|
4262
|
+
if (pathname.endsWith("/") && !entry.isDirectory()) return new Response(null, { status: 404 });
|
|
4263
|
+
if (entry.isDirectory()) {
|
|
4264
|
+
file = join(file, "index.html");
|
|
4265
|
+
entry = await stat(file);
|
|
4266
|
+
}
|
|
4267
|
+
if (!entry.isFile() || !isFileServingAllowed(server.config, file)) return new Response(null, { status: 404 });
|
|
4268
|
+
return new Response(request.method === "HEAD" ? null : new Uint8Array(await readFile(file)), { headers: { "Content-Type": mime.getType(file) ?? "application/octet-stream" } });
|
|
4269
|
+
} catch {
|
|
4270
|
+
return new Response(null, { status: 404 });
|
|
4271
|
+
}
|
|
4272
|
+
} };
|
|
4176
4273
|
server.middlewares.use(honoMiddleware(async () => {
|
|
4177
|
-
|
|
4274
|
+
const mod = await server.ssrLoadModule("virtual:void-routes");
|
|
4275
|
+
return { fetch: (request) => mod.default.fetch(request, { ASSETS: assets }) };
|
|
4276
|
+
}, async (request) => {
|
|
4277
|
+
try {
|
|
4278
|
+
const pathname = decodeURIComponent(new URL(request.url).pathname);
|
|
4279
|
+
const file = resolve(server.config.root, "." + pathname);
|
|
4280
|
+
return isFileServingAllowed(server.config, file) && (await stat(file)).isFile();
|
|
4281
|
+
} catch {
|
|
4282
|
+
return false;
|
|
4283
|
+
}
|
|
4178
4284
|
}));
|
|
4179
4285
|
},
|
|
4180
4286
|
configurePreviewServer(server) {
|
|
@@ -4589,6 +4695,7 @@ function routingPlugin(root, options) {
|
|
|
4589
4695
|
}
|
|
4590
4696
|
const runtimeEmailPath = resolveFile("#self/email");
|
|
4591
4697
|
const compileOptions = {
|
|
4698
|
+
trailingSlash: options.routing?.trailingSlash,
|
|
4592
4699
|
honoPath: resolveFile("hono"),
|
|
4593
4700
|
honoRoutePath: resolveFile("hono/route"),
|
|
4594
4701
|
runtimeEnvPath: resolveFile("#self/_env"),
|
|
@@ -4677,7 +4784,7 @@ function routingPlugin(root, options) {
|
|
|
4677
4784
|
if (removeAuthTypesIfPresent(outDir)) syncAuthTypesInProjectTsconfig(root);
|
|
4678
4785
|
return;
|
|
4679
4786
|
}
|
|
4680
|
-
const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-
|
|
4787
|
+
const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-D4V_06-B.mjs");
|
|
4681
4788
|
const authRuntime = {
|
|
4682
4789
|
dialect: compileOptions.auth.dialect,
|
|
4683
4790
|
providers: compileOptions.auth.providers,
|
|
@@ -4692,7 +4799,8 @@ function routingPlugin(root, options) {
|
|
|
4692
4799
|
writeFileIfChanged(authDatabasePath, generateVoidAuthDatabaseModule({
|
|
4693
4800
|
dialect: compileOptions.auth.dialect,
|
|
4694
4801
|
schemaImportPath: authSchemaPath,
|
|
4695
|
-
drizzleAdapterPath
|
|
4802
|
+
drizzleAdapterPath,
|
|
4803
|
+
d1BindingName: options.bindingNames?.d1
|
|
4696
4804
|
}));
|
|
4697
4805
|
syncAuthTypesFile(compileOptions.auth.authConfigPath, outDir);
|
|
4698
4806
|
syncAuthTypesInProjectTsconfig(root);
|
|
@@ -4725,7 +4833,7 @@ function routingPlugin(root, options) {
|
|
|
4725
4833
|
return envFilePaths.has(normalizePath(path));
|
|
4726
4834
|
}
|
|
4727
4835
|
function getPagesCompileOptions() {
|
|
4728
|
-
if (!scan || scan.pages.pages.length === 0) return null;
|
|
4836
|
+
if (!scan || scan.pages.pages.length === 0 && !scan.pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory)) return null;
|
|
4729
4837
|
const hasIslandPages = scan.pages.pages.some((p) => p.island);
|
|
4730
4838
|
const mdPlugin = resolvedConfig?.plugins?.find((p) => p.name === "void-md");
|
|
4731
4839
|
const mdClientEntryId = hasIslandPages && mdPlugin?.api?.clientEntryId ? mdPlugin.api.clientEntryId : void 0;
|
|
@@ -4742,7 +4850,7 @@ function routingPlugin(root, options) {
|
|
|
4742
4850
|
const { pages, routes, websockets = [], middleware } = scan;
|
|
4743
4851
|
return resolveAssetRoutingPolicy({
|
|
4744
4852
|
isSsr: Boolean(ssr),
|
|
4745
|
-
hasPages: pages.pages.length > 0,
|
|
4853
|
+
hasPages: pages.pages.length > 0 || !!pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory),
|
|
4746
4854
|
hasApiRoutes: hasApiRoutes(routes) || hasApiRoutes(websockets) || compileOptions.auth !== null,
|
|
4747
4855
|
hasDocumentRoutes: hasDocumentRoutes(routes),
|
|
4748
4856
|
hasMiddleware: middleware.length > 0,
|
|
@@ -5419,6 +5527,7 @@ function voidPlugin(options) {
|
|
|
5419
5527
|
warnIfPackageJsonIsNotEsm(root);
|
|
5420
5528
|
const devTriggerToken = isViteBuildOrPreview() ? crypto.randomUUID() : getOrCreateDevTriggerToken(root);
|
|
5421
5529
|
const config = readConfig(root);
|
|
5530
|
+
syncBindingTypes(root, config);
|
|
5422
5531
|
const projectCloudflareConfigPath = !isNodeTarget(config.target) ? materializeCloudflareConfig(root) : void 0;
|
|
5423
5532
|
const cloudflareConfigPath = projectCloudflareConfigPath && existsSync(projectCloudflareConfigPath) ? projectCloudflareConfigPath : void 0;
|
|
5424
5533
|
let previewing = false;
|
|
@@ -5647,7 +5756,7 @@ function voidPlugin(options) {
|
|
|
5647
5756
|
voidWarn("AI requires authentication. Run `void account login`, then restart the dev server.");
|
|
5648
5757
|
});
|
|
5649
5758
|
else if (credentials.status === "no-project") {
|
|
5650
|
-
if (process.stdin.isTTY) afterServerReady(server, () => {
|
|
5759
|
+
if (process.stdin.isTTY && !isVitestServer(server.config)) afterServerReady(server, () => {
|
|
5651
5760
|
console.log();
|
|
5652
5761
|
runAiSetupPrompt(root, credentials.token, credentials.apiUrl, server);
|
|
5653
5762
|
});
|
|
@@ -5703,6 +5812,11 @@ function voidPlugin(options) {
|
|
|
5703
5812
|
}
|
|
5704
5813
|
};
|
|
5705
5814
|
if (framework) {
|
|
5815
|
+
if ((framework === "vinext-app" || framework === "vinext-pages") && hasVinextMiddleware(root)) workerConfig.assets = {
|
|
5816
|
+
binding: "ASSETS",
|
|
5817
|
+
not_found_handling: "none",
|
|
5818
|
+
run_worker_first: ["/*"]
|
|
5819
|
+
};
|
|
5706
5820
|
workerConfig.main = getFrameworkEntry(framework, root, devTriggerToken, dialect, config.routing?.notFound, config.cloudflare?.main);
|
|
5707
5821
|
let notFoundIgnoredWarned = false;
|
|
5708
5822
|
const frameworkBuildWrapperPlugin = {
|
|
@@ -5815,7 +5929,7 @@ function voidPlugin(options) {
|
|
|
5815
5929
|
hasSandbox: false
|
|
5816
5930
|
}),
|
|
5817
5931
|
prerenderPlugin(root, config),
|
|
5818
|
-
...nodeTargetPlugin(config.target)
|
|
5932
|
+
...nodeTargetPlugin(config.target, { trailingSlash: config.routing?.trailingSlash })
|
|
5819
5933
|
];
|
|
5820
5934
|
}
|
|
5821
5935
|
const existingFlags = workerConfig.compatibility_flags ?? [];
|