void 1.12.1 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{account-cmd-BU1Fy_Bf.mjs → account-cmd-4fQiXYX7.mjs} +6 -6
- package/dist/{application-analysis-DVeN8yoi.mjs → application-analysis-BjEwHTV2.mjs} +19 -13
- package/dist/{application-routing-KKw4Y84h.mjs → application-routing-COCfD2yc.mjs} +1 -1
- package/dist/args-DrnTI35r.mjs +88 -0
- package/dist/args-MnQnqypt.mjs +1 -0
- package/dist/{auth-CqwJwItO.mjs → auth-CeBmolb-.mjs} +3 -3
- package/dist/{auth-A7cZ8aXA.mjs → auth-CvaDxOMi.mjs} +1 -1
- package/dist/{auth-link-Duu2NvN5.mjs → auth-link-I4omV0pL.mjs} +6 -6
- package/dist/{auth-router-vgtOdb9j.mjs → auth-router-CXq4q7bb.mjs} +6 -5
- package/dist/{better-auth-shared-BS3pDQbT.d.mts → better-auth-shared-CrIkcN8I.d.mts} +2 -1
- package/dist/bindings-C7zOgxT3.d.mts +28 -0
- package/dist/browser-run-BKgZVwLk.mjs +124 -0
- package/dist/{build-cmd-B7OJ0U5R.mjs → build-cmd-Biz6u4rn.mjs} +6 -6
- package/dist/{cache-wSpi3aeM.mjs → cache-WkLMUrjQ.mjs} +6 -6
- package/dist/{cancel-deploy-DMWzkAlb.mjs → cancel-deploy-BRsrmyTk.mjs} +6 -5
- package/dist/{cf-access-DHklo7Rg.mjs → cf-access-B21j-nd6.mjs} +1 -1
- package/dist/{cf-build-output-Cso7Vh-t.mjs → cf-build-output-G-7Tdd8b.mjs} +6 -5
- package/dist/cf-build-output-Qc43LWzE.mjs +1 -0
- package/dist/{cf-command-values-5BPBRc9Z.mjs → cf-command-values-cUnJwCyG.mjs} +24 -1
- package/dist/{cf-config-migrate-D271BTiw.mjs → cf-config-migrate-CsbQGzMf.mjs} +200 -94
- package/dist/cf-user-agent-HHTRzfud.mjs +15 -0
- package/dist/cf-version-api-BWHMVtzw.mjs +1 -0
- package/dist/cf-version-api-XEEK2B9A.mjs +856 -0
- package/dist/cf-worker-settings-DJKdy97k.mjs +127 -0
- package/dist/cli/cli.mjs +1 -1
- package/dist/cli/cloudflare-operation-process.mjs +111 -47
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/cli/json-command-process.d.mts +6 -0
- package/dist/cli/json-command-process.mjs +91 -0
- package/dist/{cli-main-BrChcpE3.mjs → cli-main-CJTGhcYN.mjs} +84 -113
- package/dist/{client-eLZwqkPH.mjs → client-0um7Lzze.mjs} +1 -1
- package/dist/{client-DE2m2ldh.mjs → client-BEHI4UWn.mjs} +14 -8
- package/dist/{cloudflare-auth-eWfhdZCk.mjs → cloudflare-auth-iOgRurWm.mjs} +1 -1
- package/dist/{cloudflare-cmd-SsFlJe2B.mjs → cloudflare-cmd-DsSlXbNy.mjs} +5 -5
- package/dist/{cloudflare-config-D9UFH_A5.mjs → cloudflare-config-KPHKf57C.mjs} +2 -2
- package/dist/{cloudflare-connect-BgpHcSg3.mjs → cloudflare-connect-bEtneBjT.mjs} +5 -4
- package/dist/{cloudflare-operations-ByjFGats.mjs → cloudflare-operations-BmICrRnm.mjs} +1 -1
- package/dist/{cloudflare-operations-BIRQkYwL.mjs → cloudflare-operations-D-9psgPQ.mjs} +19 -11
- package/dist/cloudflare-preview-8eLSQPdO.mjs +1 -0
- package/dist/cloudflare-preview-BaeU-m74.mjs +112 -0
- package/dist/{cloudflare-process-60r4Z2Zf.mjs → cloudflare-process-DFNpqV_m.mjs} +57 -29
- package/dist/cloudflare-user-output-DFbD0l4l.mjs +36 -0
- package/dist/collect-Aam0GwAU.mjs +1 -0
- package/dist/{collect-rNLybAnF.mjs → collect-KC4cizWM.mjs} +6 -1
- package/dist/{config-DA6ZbLXO.d.mts → config-BdmM5ZzP.d.mts} +12 -2
- package/dist/{config-BFX5ZB1J.mjs → config-CUYGZqdN.mjs} +2 -2
- package/dist/{config-BSoW3QCB.mjs → config-C_UjzkVS.mjs} +3 -3
- package/dist/{config-DtjrUtPo.mjs → config-Ge-MytMU.mjs} +1 -1
- package/dist/{config-Dv5jri1-.mjs → config-KZAiI3gG.mjs} +32 -6
- package/dist/config-entry.d.mts +1 -1
- package/dist/config-write-dKLINlm2.mjs +80 -0
- package/dist/{connect-D0V0o40j.mjs → connect-Bqq3b9sX.mjs} +10 -9
- package/dist/{create-project-CbuDH5Hv.mjs → create-project-MXoP_rte.mjs} +1 -1
- package/dist/{create-project-8FdN6D2i.mjs → create-project-T-9AIQDe.mjs} +7 -6
- package/dist/{db-BNPIjLkK.mjs → db-B3eoVDNA.mjs} +50 -47
- package/dist/{db-args-CiQVg8SJ.mjs → db-args-BcvTZ8KE.mjs} +1 -1
- package/dist/db-args-Cx1y4vZn.mjs +1 -0
- package/dist/{db-types-B4Cf9dzR.mjs → db-types-BpgXVtQZ.mjs} +1 -1
- package/dist/{delete-WtLEfap2.mjs → delete-Cf6SroAw.mjs} +7 -6
- package/dist/deploy-DZ9j7MC4.mjs +2 -0
- package/dist/{deploy-BgSbagIP.mjs → deploy-UojYUEWr.mjs} +803 -1415
- package/dist/{deploy-managed-static-BWBsxOww.mjs → deploy-managed-static-DV_OmTWf.mjs} +54 -393
- package/dist/{deploy-security-notice-IRGy6Edf.mjs → deploy-security-notice-3jX71IeP.mjs} +6 -4
- package/dist/deploy-summary-Dkl0zvQy.mjs +377 -0
- package/dist/{deploy-transport-BKP_oV9q.mjs → deploy-transport-4ISWxx8n.mjs} +4 -3
- package/dist/deploy.mjs +14 -10
- package/dist/discover-BZWVWeQs.mjs +1 -0
- package/dist/{discover-IcspacCg.mjs → discover-BeFs7OPS.mjs} +1 -1
- package/dist/{dispatch-DIhDA3NI.mjs → dispatch-BUKbPdqb.mjs} +7 -7
- package/dist/{dist-Cr_xGE_K.mjs → dist-BngS28id.mjs} +6 -6
- package/dist/{dist-C47zy_kJ.mjs → dist-x99fIj4n.mjs} +1 -1
- package/dist/{domain-mweyYXSw.mjs → domain-BK6NWkWK.mjs} +7 -7
- package/dist/{drizzle-BJDMPrj7.mjs → drizzle-CnSbVeiZ.mjs} +12 -13
- package/dist/{drizzle-CQ5jWuDL.mjs → drizzle-CrkwVwK8.mjs} +1 -1
- package/dist/{email-DcQNP40O.mjs → email-BBSDV0J5.mjs} +13 -12
- package/dist/{email-cloudflare-DeYH3Ke7.mjs → email-cloudflare-C-guKEbz.mjs} +10 -8
- package/dist/{env-DaAoYR2-.mjs → env-BVnKiGYJ.mjs} +8 -8
- package/dist/{env-EjHqc7m9.mjs → env-CU2tMDdO.mjs} +6 -1
- package/dist/{env-types-D2hBodXP.mjs → env-types-B33fEHRH.mjs} +1 -1
- package/dist/{env-validation-j9pjCDfA.mjs → env-validation-BnAsx6gz.mjs} +1 -1
- package/dist/{env-validation-D-v5_CWL.mjs → env-validation-SXsjd6-Z.mjs} +4 -4
- package/dist/{fetch-CiEsvjpP.mjs → fetch-DL7OCgwB.mjs} +1 -1
- package/dist/{fetch-stream-BIG5lHW6.mjs → fetch-stream-DEilLTCc.mjs} +2 -2
- package/dist/{gen-aOtHhZLD.mjs → gen-BxuIN1bz.mjs} +10 -9
- package/dist/gen-DaayFP9v.mjs +1 -0
- package/dist/{generate-Dq2Bgw75.mjs → generate-Ck-L3e0e.mjs} +1 -1
- package/dist/{generate-C3ZAqCy-.mjs → generate-t1dDUYZZ.mjs} +1 -1
- package/dist/{github-cmd-BR19Ffdz.mjs → github-cmd-B7U9Hjmi.mjs} +7 -6
- package/dist/{handler-DCrDLzw2.mjs → handler-2wAywJgj.mjs} +11 -9
- package/dist/{headers-DqBsjDxg.mjs → headers-DPI4MDGC.mjs} +1 -1
- package/dist/{help-DvClCzqL.mjs → help-Bgiu5PMX.mjs} +36 -4
- package/dist/help-DWGHmt_n.mjs +1 -0
- package/dist/html-5sfGLjiI.d.mts +3 -0
- package/dist/html-DPSOBDCh.mjs +1 -0
- package/dist/{index-Dn2mkPr2.d.mts → index-CqF8_p9C.d.mts} +5 -105
- package/dist/index-Cvqotnhc.d.mts +91 -0
- package/dist/{index-BQ5qYiAw.d.mts → index-DAinHkj8.d.mts} +1 -1
- package/dist/{index-8cAgNdb6.d.mts → index-lnEWwVAS.d.mts} +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +536 -170
- package/dist/{info-P6MBiVJi.mjs → info-7COlpAfY.mjs} +32 -20
- package/dist/{init-C8YpkGIP.mjs → init-DftAx3L4.mjs} +237 -88
- package/dist/input-jcps6lAn.mjs +64 -0
- package/dist/interactive-prompts-EK0dilFu.mjs +43 -0
- package/dist/{limits-BCoQLpn3.mjs → limits-3I3VdX2E.mjs} +4 -1
- package/dist/{link-Dyz9IGcM.mjs → link-C3WMNFTG.mjs} +7 -7
- package/dist/{list-VGYBMjmx.mjs → list-K4EGVUZN.mjs} +9 -9
- package/dist/{load-user-env-B8qC0Q2Y.mjs → load-user-env-uMmQJ-Th.mjs} +1 -1
- package/dist/{local-d1-CYOYkVwO.mjs → local-d1-BtLCVC1p.mjs} +2 -2
- package/dist/login-BJwPhV_S.mjs +1 -0
- package/dist/{login-CWFr-G2I.mjs → login-DaugBfBG.mjs} +6 -5
- package/dist/{logs-kS1wuR4b.mjs → logs-BR2szdN5.mjs} +6 -6
- package/dist/migrate-BHD46A31.mjs +1 -0
- package/dist/{migrate-BNZL1hee.mjs → migrate-Dtlg8fC6.mjs} +7 -7
- package/dist/nitro.mjs +3 -3
- package/dist/{node-DVJWfV6s.mjs → node-BbKlLpHa.mjs} +5 -5
- package/dist/{operator-ai-logging-DD0n6zc2.mjs → operator-ai-logging-4Nvs6Ut3.mjs} +5 -5
- package/dist/{operator-args-nvetCWuz.mjs → operator-args-DWvqq3Ws.mjs} +31 -15
- package/dist/{operator-auth-DMvn-y9X.mjs → operator-auth-DtRMGXYY.mjs} +2 -2
- package/dist/{operator-client-dFNnXfyB.mjs → operator-client-BG0VIMMM.mjs} +2 -2
- package/dist/operator-cmd-CR3Q9k4c.mjs +1 -0
- package/dist/{operator-cmd-a7yOf2tH.mjs → operator-cmd-D4YcMKO-.mjs} +9 -9
- package/dist/{operator-security-D5MToU0p.mjs → operator-security-nVLo8vDt.mjs} +11 -5
- package/dist/{output-BZLnu0z8.mjs → output-DhJgS6Ve.mjs} +1 -1
- package/dist/output-OYwcEwok.mjs +1 -0
- package/dist/pages/client.d.mts +34 -20
- package/dist/pages/client.mjs +172 -74
- package/dist/pages/index.d.mts +11 -4
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +2 -2
- package/dist/pages/islands-plugin.mjs +5 -3
- package/dist/pages/protocol.d.mts +3 -3
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -2
- package/dist/pages/serialize.mjs +1 -1
- package/dist/parse-filename-DIPUjoCh.d.mts +2 -0
- package/dist/platform-C3Q44RJ8.mjs +250 -0
- package/dist/platform-args-BSyVZESg.mjs +1 -0
- package/dist/{platform-args-CvZSuhYS.mjs → platform-args-BnocJDC_.mjs} +1 -1
- package/dist/{platform-auth-config-CpszX-Ne.mjs → platform-auth-config-BbfNhjBc.mjs} +9 -9
- package/dist/{platform-auth-protection-DA6Tw8Og.mjs → platform-auth-protection-BHPV4MUf.mjs} +9 -8
- package/dist/{platform-auth-recovery-Cztrb1JC.mjs → platform-auth-recovery-DE0nArYy.mjs} +8 -7
- package/dist/{platform-cmd-m6Asj6nO.mjs → platform-cmd-CLRU3BRb.mjs} +11 -10
- package/dist/{platform-cmd-u1j88ggF.mjs → platform-cmd-Cs2LkT5L.mjs} +1 -1
- package/dist/{platform-discovery-CLxtixHJ.mjs → platform-discovery-CKeeeD82.mjs} +1 -1
- package/dist/{platform-domain-DJSznNTA.mjs → platform-domain-kn3WuKPG.mjs} +6 -5
- package/dist/{platform-lifecycle-BC-9p58d.mjs → platform-lifecycle-BoCEYy2w.mjs} +1 -1
- package/dist/{platform-lifecycle-GFeXv3NC.mjs → platform-lifecycle-CKwOg8wz.mjs} +244 -104
- package/dist/{platform-management-BwHkz46V.mjs → platform-management-CaSdFthX.mjs} +1 -1
- package/dist/{platform-management-DX1zINou.mjs → platform-management-fyrsq2Ra.mjs} +27 -14
- package/dist/{platform-plans-config-DiydtNKY.mjs → platform-plans-config-BSI-6Inu.mjs} +11 -5
- package/dist/{platform-recovery-CnzBbudV.mjs → platform-recovery-PwJ54AIZ.mjs} +3 -3
- package/dist/{platform-registry-DHH6fivm.mjs → platform-registry-zHH3RiIm.mjs} +2 -1
- package/dist/{platform-setup-Lph9i-rh.mjs → platform-setup-DwYITHfY.mjs} +3 -3
- package/dist/{plugin-inference-COlq96WJ.mjs → plugin-inference-D5MjBVMB.mjs} +60 -142
- package/dist/prepare-CLl_TA_r.mjs +1 -0
- package/dist/{prepare-WvijE289.mjs → prepare-DZEs5AGr.mjs} +3 -3
- package/dist/{prepare-co1o1FFd.mjs → prepare-DhVzN7CB.mjs} +14 -12
- package/dist/{project-uXKua1it.mjs → project-BXpm-vgG.mjs} +1 -1
- package/dist/{project-dh9431bN.mjs → project-DC-BqHef.mjs} +1 -1
- package/dist/{project-cmd-BWJTplpc.mjs → project-cmd-BKN3qT4R.mjs} +31 -21
- package/dist/{project-paths-2ENfCCih.mjs → project-paths-BeAxxqGh.mjs} +1 -1
- package/dist/{project-security-BV1xfj1K.mjs → project-security-B-SHxprt.mjs} +1 -1
- package/dist/{project-security-CY_aahvW.mjs → project-security-BWTd6cTU.mjs} +87 -46
- package/dist/{project-team-BlIFXlmT.mjs → project-team-jcn9reIB.mjs} +6 -6
- package/dist/{project-token-CMsB7I1-.mjs → project-token-BHkBKtzt.mjs} +6 -6
- package/dist/{project-tsconfig-BOA4ym99.mjs → project-tsconfig-LjgxDdj_.mjs} +1 -1
- package/dist/{project-zero-trust-BI6pdpx4.mjs → project-zero-trust-2t_qI6xa.mjs} +4 -4
- package/dist/{protocol-4rEnumif.mjs → protocol-DhMbnxzy.mjs} +120 -35
- package/dist/{protocol-ERy-n3jf.d.mts → protocol-wG7JP5Mm.d.mts} +27 -4
- package/dist/{provision-DFv7SJDn.mjs → provision-C04aXE3a.mjs} +1 -1
- package/dist/{provision-Bh44omGA.mjs → provision-CQykn8gu.mjs} +8 -4
- package/dist/{redirect-Dyvuil0Q.mjs → redirect-DjyA_hx_.mjs} +1 -1
- package/dist/{requests-CfmJxNYg.mjs → requests-BznxnxTT.mjs} +5 -5
- package/dist/resolve-project-Bob_rEi2.mjs +1 -0
- package/dist/{resolve-project-8WZ3iVmr.mjs → resolve-project-s_FGWyr-.mjs} +2 -2
- package/dist/resource-binding-5nI30acw.mjs +20 -0
- package/dist/{resource-name-DlJ9QXzg.mjs → resource-name-D_gw36kh.mjs} +5 -1
- package/dist/{rollback-DL5HuAsM.mjs → rollback-CLiINtpt.mjs} +25 -14
- package/dist/{route-types-CSed9-Dp.mjs → route-types-DxvqN5bL.mjs} +59 -9
- package/dist/{route-url-B41eQ8QI.mjs → route-url-CRC8yR_2.mjs} +2 -3
- package/dist/{route-url-Bd6IX-JZ.d.mts → route-url-zDfC-7DD.d.mts} +33 -5
- package/dist/routes-stub.d.mts +18 -2
- package/dist/routes-stub.mjs +1 -1
- package/dist/{runner-CeguHWJx.mjs → runner-CnUrhc8H.mjs} +1 -1
- package/dist/{runner-mysql-DOjbj-N1.mjs → runner-mysql-CW6bFa67.mjs} +1 -1
- package/dist/{runner-mysql-D549vGGm.mjs → runner-mysql-DSLGFOlC.mjs} +1 -1
- package/dist/{runner-pg-Buzw17hl.mjs → runner-pg-BcGF7iBR.mjs} +1 -1
- package/dist/{runner-pg-DMJquR3d.mjs → runner-pg-OeP0JpEo.mjs} +1 -1
- package/dist/{runner-Bf94YVJK.mjs → runner-rnXCGa20.mjs} +1 -1
- package/dist/runtime/ai/index.mjs +1 -1
- package/dist/runtime/auth/better-auth-d1.d.mts +1 -1
- package/dist/runtime/auth/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/auth/better-auth-postgres.d.mts +1 -1
- package/dist/runtime/client/fetch-server.mjs +1 -1
- package/dist/runtime/client/fetch-stream.mjs +1 -1
- package/dist/runtime/client/fetch.mjs +1 -1
- package/dist/runtime/client/index.mjs +2 -2
- package/dist/runtime/client/react.mjs +2 -2
- package/dist/runtime/client/solid.mjs +2 -2
- package/dist/runtime/client/svelte.mjs +2 -2
- package/dist/runtime/client/vue.mjs +2 -2
- package/dist/runtime/durable/index.mjs +11 -26
- package/dist/runtime/env/runtime.d.mts +2 -10
- package/dist/runtime/handler/index.d.mts +3 -2
- package/dist/runtime/handler/index.mjs +2 -2
- package/dist/runtime/handler/validator.d.mts +1 -1
- package/dist/runtime/handler/validator.mjs +1 -1
- package/dist/runtime/html.d.mts +2 -0
- package/dist/runtime/html.mjs +1 -0
- package/dist/runtime/image/index.d.mts +103 -0
- package/dist/runtime/image/index.mjs +89 -0
- package/dist/runtime/jsx/index.d.mts +3 -0
- package/dist/runtime/jsx/index.mjs +2 -0
- package/dist/runtime/jsx/jsx-dev-runtime.d.mts +1 -0
- package/dist/runtime/jsx/jsx-dev-runtime.mjs +2 -0
- package/dist/runtime/jsx/jsx-runtime.d.mts +1 -0
- package/dist/runtime/jsx/jsx-runtime.mjs +2 -0
- package/dist/runtime/limits/index.mjs +1 -1
- package/dist/runtime/live/client.d.mts +2 -2
- package/dist/runtime/live/index.d.mts +1 -1
- package/dist/runtime/routing/index.d.mts +87 -4
- package/dist/runtime/routing/index.mjs +59 -20
- package/dist/runtime/routing/route-url.d.mts +2 -2
- package/dist/runtime/routing/route-url.mjs +1 -1
- package/dist/runtime/sandbox/index.mjs +1 -1
- package/dist/runtime/sse/client.d.mts +1 -1
- package/dist/runtime/workflows/entry.d.mts +8 -0
- package/dist/runtime/workflows/entry.mjs +49 -0
- package/dist/runtime/workflows/index.d.mts +3 -0
- package/dist/runtime/workflows/index.mjs +77 -0
- package/dist/runtime/ws/index.d.mts +1 -1
- package/dist/runtime/ws/index.mjs +2 -2
- package/dist/runtime/ws/room.d.mts +1 -1
- package/dist/runtime/ws/server.d.mts +2 -2
- package/dist/runtime-Db72hLY-.d.mts +11 -0
- package/dist/scan-BxhB4BA-.mjs +946 -0
- package/dist/scan-D2ISAobj.mjs +308 -0
- package/dist/{secret-C-WBaUSS.mjs → secret-Ck9N5xbU.mjs} +9 -8
- package/dist/{security-sarif-ClyYwtAW.mjs → security-sarif-DzTIqNwZ.mjs} +1 -1
- package/dist/{serialize-DN-envGQ.d.mts → serialize-Dr9B-0yV.d.mts} +10 -1
- package/dist/{serialize-BmB4BfKu.mjs → serialize-nW4IeEBI.mjs} +23 -2
- package/dist/{skills-C-csz78e.mjs → skills-BR7YHAF7.mjs} +1 -1
- package/dist/{scan-Ct_SEzH4.mjs → source-analysis-cache-Ccm_JSOl.mjs} +340 -902
- package/dist/standard-schema-DvMcZGMK.mjs +8 -0
- package/dist/{subcommand-prompt-B4LOLosl.mjs → subcommand-prompt-AFf2LcrC.mjs} +2 -2
- package/dist/{types-FDH6NuY1.d.mts → types-RYVujNS6.d.mts} +4 -2
- package/dist/{version-metadata-DqgLa6gc.mjs → untrusted-env-4oW0TdBP.mjs} +1 -23
- package/dist/{url-DBQluotE.mjs → url-DAQ1c3lh.mjs} +45 -1
- package/dist/{validate-CtBWCzez.mjs → validate-B1PsQ_mt.mjs} +1 -1
- package/dist/validate-p9b3r1k4.mjs +1 -0
- package/dist/{validation-error-CtcAvyI7.mjs → validation-error-EKI0wMWX.mjs} +2 -2
- package/dist/{validator-Dfh9kCDm.mjs → validator-JJcf9E48.mjs} +5 -8
- package/dist/version-metadata-CEla0kgi.mjs +23 -0
- package/dist/{wrangler-DVe5KV5G.mjs → wrangler-AyMfdVJK.mjs} +34 -69
- package/dist/wrangler-BT7qrzWc.mjs +1 -0
- package/dist/{wrapper-CcMYpOS8.mjs → wrapper-DPlTBVOx.mjs} +5 -5
- package/docs/guide/ai.md +1 -1
- package/docs/guide/app-types.md +6 -23
- package/docs/guide/auth.md +2 -4
- package/docs/guide/database/d1.md +21 -67
- package/docs/guide/database/mysql.md +8 -0
- package/docs/guide/database/postgresql.md +2 -2
- package/docs/guide/database.md +1 -1
- package/docs/guide/deployment.md +18 -0
- package/docs/guide/edge/prerendering.md +3 -7
- package/docs/guide/edge/redirects.md +1 -1
- package/docs/guide/edge/revalidation.md +8 -17
- package/docs/guide/edge/rewrites.md +1 -1
- package/docs/guide/edge/static-assets.md +10 -22
- package/docs/guide/email/domains.md +3 -1
- package/docs/guide/email/receiving.md +2 -2
- package/docs/guide/email/sending.md +3 -1
- package/docs/guide/env-vars.md +2 -0
- package/docs/guide/image-generation.md +142 -0
- package/docs/guide/index.md +17 -15
- package/docs/guide/jobs.md +2 -4
- package/docs/guide/kv.md +1 -1
- package/docs/guide/og-images.md +83 -0
- package/docs/guide/pages-routing/actions-and-forms.md +6 -4
- package/docs/guide/pages-routing/errors.md +20 -4
- package/docs/guide/pages-routing/head.md +5 -5
- package/docs/guide/pages-routing/islands.md +4 -14
- package/docs/guide/pages-routing/markdown.md +2 -2
- package/docs/guide/pages-routing/overview.md +129 -15
- package/docs/guide/platform/administration/plans.md +47 -16
- package/docs/guide/platform/administration/projects.md +10 -0
- package/docs/guide/platform/administration/security-audits.md +76 -30
- package/docs/guide/platform/administration/zero-trust.md +1 -1
- package/docs/guide/platform/installation/ci.md +0 -4
- package/docs/guide/platform/installation/credentials.md +1 -1
- package/docs/guide/platform/installation/maintenance.md +11 -9
- package/docs/guide/platform/installation/prerequisites.md +3 -1
- package/docs/guide/platform/installation/setup.md +7 -15
- package/docs/guide/platform/installation/uninstall.md +6 -12
- package/docs/guide/project-collaboration.md +1 -4
- package/docs/guide/queues.md +6 -8
- package/docs/guide/quickstart.md +6 -8
- package/docs/guide/sandboxes.md +1 -1
- package/docs/guide/self-hosted-platform.md +4 -7
- package/docs/guide/server-routing.md +5 -3
- package/docs/guide/ssg.md +1 -1
- package/docs/guide/type-safety.md +74 -10
- package/docs/guide/websockets.md +5 -7
- package/docs/guide/workflows.md +122 -0
- package/docs/index.md +2 -3
- package/docs/integrations/agents.md +3 -16
- package/docs/integrations/cloudflare.md +98 -2
- package/docs/integrations/frameworks/analog.md +9 -11
- package/docs/integrations/frameworks/astro.md +16 -17
- package/docs/integrations/frameworks/nuxt.md +11 -13
- package/docs/integrations/frameworks/overview.md +18 -20
- package/docs/integrations/frameworks/react-router.md +55 -6
- package/docs/integrations/frameworks/sveltekit.md +8 -6
- package/docs/integrations/frameworks/tanstack-start.md +10 -6
- package/docs/integrations/hono.md +27 -12
- package/docs/integrations/nodejs-bun-deno.md +10 -2
- package/docs/reference/api/database.md +8 -10
- package/docs/reference/api/env.md +2 -2
- package/docs/reference/api/handlers.md +1 -1
- package/docs/reference/api/html.md +45 -0
- package/docs/reference/api/pages.md +118 -167
- package/docs/reference/api/rewrites.md +5 -5
- package/docs/reference/api/types.md +13 -6
- package/docs/reference/api/workflows.md +48 -0
- package/docs/reference/api.md +7 -1
- package/docs/reference/cli/database.md +22 -10
- package/docs/reference/cli/deploy.md +49 -4
- package/docs/reference/cli/domains.md +7 -3
- package/docs/reference/cli/email.md +3 -1
- package/docs/reference/cli/platform-installation.md +9 -53
- package/docs/reference/cli/platform-security.md +36 -8
- package/docs/reference/cli/platform-users.md +11 -1
- package/docs/reference/cli/platform-zero-trust.md +1 -1
- package/docs/reference/cli/project.md +52 -11
- package/docs/reference/cli/setup.md +8 -10
- package/docs/reference/cli.md +49 -47
- package/docs/reference/config.md +22 -8
- package/docs/reference/resource-inference.md +8 -1
- package/docs/reference/structure.md +5 -0
- package/package.json +52 -25
- package/schema.json +20 -1
- package/skills/void/SKILL.md +60 -54
- package/dist/cf-build-output-Wpk_e5CI.mjs +0 -1
- package/dist/cf-worker-settings-BBdlhm9U.mjs +0 -41
- package/dist/cli/db-execute-process.d.mts +0 -2
- package/dist/cli/db-execute-process.mjs +0 -57
- package/dist/cloudflare-user-output-CCR99eQY.mjs +0 -19
- package/dist/collect-B6nlSnsb.mjs +0 -1
- package/dist/db-args-BvMwAber.mjs +0 -1
- package/dist/deploy-Do6FWqon.mjs +0 -2
- package/dist/discover-D2KGP3cR.mjs +0 -1
- package/dist/entry-Bwb9ev8K.mjs +0 -113
- package/dist/gen-vhBDHs3q.mjs +0 -1
- package/dist/help-fKPzcTJv.mjs +0 -1
- package/dist/isr-config-DiTnL9Tb.mjs +0 -115
- package/dist/login-DECm3e9b.mjs +0 -1
- package/dist/migrate-C9aoWLvY.mjs +0 -1
- package/dist/operator-cmd-CVfK5U0B.mjs +0 -1
- package/dist/output-D7K9TWIA.mjs +0 -1
- package/dist/platform-args-CMwMoiLp.mjs +0 -1
- package/dist/prepare-DcwigRUS.mjs +0 -1
- package/dist/providers-D5P8j_8D.d.mts +0 -5
- package/dist/resolve-project-YsTH-U9I.mjs +0 -1
- package/dist/static-exports-s7P86Ngp.mjs +0 -354
- package/dist/validate-CZYUIfR-.mjs +0 -1
- package/dist/wrangler-Dq269bjx.mjs +0 -1
- package/docs/guide/platform/development/local.md +0 -120
- package/docs/guide/platform/development/runtime.md +0 -115
- package/docs/guide/platform/development/schema-ci.md +0 -44
- package/docs/guide/platform-development.md +0 -16
|
@@ -0,0 +1,946 @@
|
|
|
1
|
+
import { a as join, l as toSlash, n as dirname, r as extname, t as basename } from "./dist-DMYe8CZJ.mjs";
|
|
2
|
+
import { a as staticExports, c as bindingNames, f as glob, i as readStaticExports, o as staticLiteral, r as mayExportAll, t as deriveFromSource } from "./source-analysis-cache-Ccm_JSOl.mjs";
|
|
3
|
+
import { h as readConfig } from "./config-KZAiI3gG.mjs";
|
|
4
|
+
import { i as voidWarn } from "./log-D9hwSySP.mjs";
|
|
5
|
+
import { n as readProjectPaths } from "./project-paths-BeAxxqGh.mjs";
|
|
6
|
+
import { i as isLiteral, r as isIdentifier, s as moduleExportName, t as asAstProgram } from "./ast-BkPQu7A0.mjs";
|
|
7
|
+
import { t as MagicString } from "./dist-B6eN80gc.mjs";
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { parseSync } from "vite";
|
|
10
|
+
// src/shared/route-extensions.ts
|
|
11
|
+
const ROUTE_EXTENSIONS = [
|
|
12
|
+
"ts",
|
|
13
|
+
"tsx",
|
|
14
|
+
"js",
|
|
15
|
+
"jsx",
|
|
16
|
+
"mjs",
|
|
17
|
+
"mts"
|
|
18
|
+
];
|
|
19
|
+
const ROUTE_EXTENSIONS_SET = new Set(ROUTE_EXTENSIONS.map((ext) => `.${ext}`));
|
|
20
|
+
// src/router/parse-filename.ts
|
|
21
|
+
const ENV_SUFFIXES = ["dev", "prod"];
|
|
22
|
+
function parsePath(relativePath, isWebSocketRoute) {
|
|
23
|
+
const filePath = relativePath;
|
|
24
|
+
let path = relativePath.replaceAll("\\", "/");
|
|
25
|
+
for (const ext of ROUTE_EXTENSIONS) if (path.endsWith(`.${ext}`)) {
|
|
26
|
+
path = path.slice(0, -(ext.length + 1));
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
if (isWebSocketRoute && path.endsWith(".ws")) path = path.slice(0, -3);
|
|
30
|
+
const segments = path.split("/");
|
|
31
|
+
let filename = segments.pop() ?? "";
|
|
32
|
+
let env = null;
|
|
33
|
+
for (const suffix of ENV_SUFFIXES) if (filename.endsWith(`.${suffix}`)) {
|
|
34
|
+
env = suffix;
|
|
35
|
+
filename = filename.slice(0, -(suffix.length + 1));
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
segments.push(filename);
|
|
39
|
+
if (segments.at(-1) === "index") segments.pop();
|
|
40
|
+
const filtered = segments.filter((s) => !s.startsWith("(") || !s.endsWith(")"));
|
|
41
|
+
const params = [];
|
|
42
|
+
let catchAll = false;
|
|
43
|
+
return {
|
|
44
|
+
pattern: "/" + filtered.map((segment) => {
|
|
45
|
+
if (segment.startsWith("[...") && segment.endsWith("]")) {
|
|
46
|
+
const paramName = segment.slice(4, -1);
|
|
47
|
+
catchAll = true;
|
|
48
|
+
if (paramName) {
|
|
49
|
+
params.push(paramName);
|
|
50
|
+
return `:${paramName}{.+}`;
|
|
51
|
+
}
|
|
52
|
+
return "*";
|
|
53
|
+
}
|
|
54
|
+
if (segment.startsWith("[") && segment.endsWith("]")) {
|
|
55
|
+
const paramName = segment.slice(1, -1);
|
|
56
|
+
params.push(paramName);
|
|
57
|
+
return `:${paramName}`;
|
|
58
|
+
}
|
|
59
|
+
return segment;
|
|
60
|
+
}).join("/"),
|
|
61
|
+
methods: [],
|
|
62
|
+
params,
|
|
63
|
+
catchAll,
|
|
64
|
+
env,
|
|
65
|
+
filePath
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Parse a route filename (relative to routes/) into a RouteDefinition.
|
|
70
|
+
*
|
|
71
|
+
* Rules (applied in order):
|
|
72
|
+
* 1. Strip file extension (.ts, .tsx, .js, .jsx, .mts, .mjs)
|
|
73
|
+
* 2. Check for env suffix (.dev, .prod) → strip and record
|
|
74
|
+
* 3. Strip trailing "index" segment
|
|
75
|
+
* 4. Remove route group directories: (groupname)
|
|
76
|
+
* 5. Convert [param] → :param, [...param] → :param{.+}, [...] → *
|
|
77
|
+
* 6. Prefix with /
|
|
78
|
+
*/
|
|
79
|
+
function parseRouteFilename(relativePath) {
|
|
80
|
+
return parsePath(relativePath, false);
|
|
81
|
+
}
|
|
82
|
+
/** Parse a `.ws.*` route filename into a regular route definition. */
|
|
83
|
+
function parseWebSocketFilename(relativePath) {
|
|
84
|
+
return parsePath(relativePath, true);
|
|
85
|
+
}
|
|
86
|
+
function isRouteEnabledForEnvironment(route, environment) {
|
|
87
|
+
return environment === void 0 || route.env === null || route.env === environment;
|
|
88
|
+
}
|
|
89
|
+
// src/router/route-order.ts
|
|
90
|
+
/**
|
|
91
|
+
* Classify one segment of a route pattern. `*` and `:name{.+}` match the rest of the path,
|
|
92
|
+
* `:name` matches one segment, and anything else matches as written. Pages match with the
|
|
93
|
+
* same rules on the client (see `patternToRegex`), so ranking and matching agree.
|
|
94
|
+
*/
|
|
95
|
+
function routeSegmentKind(segment) {
|
|
96
|
+
if (segment === "*") return "rest";
|
|
97
|
+
if (segment.length < 2 || segment[0] !== ":") return "static";
|
|
98
|
+
const name = segment.endsWith("{.+}") ? segment.slice(1, -4) : "";
|
|
99
|
+
return name && !name.includes("{") && !name.includes("}") ? "rest" : "param";
|
|
100
|
+
}
|
|
101
|
+
const SEGMENT_RANK = {
|
|
102
|
+
static: 0,
|
|
103
|
+
param: 1,
|
|
104
|
+
rest: 2
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Order routes so that, of any two that match the same URL, the more specific one comes first.
|
|
108
|
+
* Hono and the Pages client matcher both use the first match.
|
|
109
|
+
*
|
|
110
|
+
* Catch-all routes come last and fully static routes first. Otherwise the first segment that
|
|
111
|
+
* differs decides: static before `:param` before catch-all. Parameter names never decide, so
|
|
112
|
+
* `/:lang/about` ranks ahead of `/:category/:item`. Two different static segments can't match
|
|
113
|
+
* the same URL, so their text only keeps the order stable.
|
|
114
|
+
*/
|
|
115
|
+
function compareRouteSpecificity(a, b) {
|
|
116
|
+
if (a.catchAll !== b.catchAll) return a.catchAll ? 1 : -1;
|
|
117
|
+
const aSegments = a.pattern.split("/");
|
|
118
|
+
const bSegments = b.pattern.split("/");
|
|
119
|
+
const aKinds = aSegments.map(routeSegmentKind);
|
|
120
|
+
const bKinds = bSegments.map(routeSegmentKind);
|
|
121
|
+
const aStatic = aKinds.every((kind) => kind === "static");
|
|
122
|
+
if (aStatic !== bKinds.every((kind) => kind === "static")) return aStatic ? -1 : 1;
|
|
123
|
+
const shared = Math.min(aSegments.length, bSegments.length);
|
|
124
|
+
for (let i = 0; i < shared; i++) {
|
|
125
|
+
const rank = SEGMENT_RANK[aKinds[i]] - SEGMENT_RANK[bKinds[i]];
|
|
126
|
+
if (rank !== 0) return rank;
|
|
127
|
+
if (aKinds[i] === "static" && aSegments[i] !== bSegments[i]) return compareText$1(aSegments[i], bSegments[i]);
|
|
128
|
+
}
|
|
129
|
+
return aSegments.length - bSegments.length || compareText$1(a.pattern, b.pattern);
|
|
130
|
+
}
|
|
131
|
+
function compareText$1(left, right) {
|
|
132
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
133
|
+
}
|
|
134
|
+
// src/pages/island-imports.ts
|
|
135
|
+
const SCRIPT_ATTRIBUTE_RE = /([^\s"'=/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;
|
|
136
|
+
/** `<script module>` (Svelte 5) or `<script context="module">` (Svelte 4). */
|
|
137
|
+
function isSvelteModuleScript(attributes) {
|
|
138
|
+
for (const [, name, doubleQuoted, singleQuoted, bare] of attributes.matchAll(SCRIPT_ATTRIBUTE_RE)) if (name === "module" || name === "context" && (doubleQuoted ?? singleQuoted ?? bare) === "module") return true;
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
const MARKDOWN_SCRIPT_RE = /^<script\b[^>]*>([\s\S]*?)<\/script>\s*\n?/;
|
|
142
|
+
/**
|
|
143
|
+
* The whole JS/TS module, each `<script>` block of a Vue/Svelte SFC, or the
|
|
144
|
+
* leading `<script>` block of a Markdown page, with its offset in the file.
|
|
145
|
+
*/
|
|
146
|
+
function scriptBlocks(code, filename) {
|
|
147
|
+
if (filename.endsWith(".md")) {
|
|
148
|
+
const match = MARKDOWN_SCRIPT_RE.exec(code);
|
|
149
|
+
if (!match) return [];
|
|
150
|
+
const source = match[1];
|
|
151
|
+
return [{
|
|
152
|
+
source,
|
|
153
|
+
offset: match[0].indexOf(source),
|
|
154
|
+
filename: filename.replace(/\.md$/, ".ts")
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
if (!/\.(?:vue|svelte)$/.test(filename)) return [{
|
|
158
|
+
source: code,
|
|
159
|
+
offset: 0,
|
|
160
|
+
filename
|
|
161
|
+
}];
|
|
162
|
+
const scriptFilename = filename.replace(/\.(?:vue|svelte)$/, ".ts");
|
|
163
|
+
const svelte = filename.endsWith(".svelte");
|
|
164
|
+
return [...code.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)].map((match) => {
|
|
165
|
+
const source = match[2];
|
|
166
|
+
const block = {
|
|
167
|
+
source,
|
|
168
|
+
offset: match.index + match[0].indexOf(source),
|
|
169
|
+
filename: scriptFilename
|
|
170
|
+
};
|
|
171
|
+
if (svelte && !isSvelteModuleScript(match[1])) block.instance = true;
|
|
172
|
+
return block;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/** Collect stylesheet imports from authored modules without treating dynamic imports or text as dependencies. */
|
|
176
|
+
function findStaticCssImports(code, filename) {
|
|
177
|
+
if (!code.includes("import")) return [];
|
|
178
|
+
const imports = [];
|
|
179
|
+
for (const script of scriptBlocks(code, filename)) {
|
|
180
|
+
if (!script.source.includes("import")) continue;
|
|
181
|
+
const program = asAstProgram(parseSync(script.filename, script.source).program);
|
|
182
|
+
for (const node of program.body ?? []) {
|
|
183
|
+
const source = node.source;
|
|
184
|
+
if (node.type !== "ImportDeclaration" || !isLiteral(source) || typeof source.value !== "string" || !/\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/.test(source.value) || node.start === void 0 || node.end === void 0) continue;
|
|
185
|
+
imports.push({
|
|
186
|
+
statement: script.source.slice(node.start, node.end),
|
|
187
|
+
specifier: source.value
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return imports;
|
|
192
|
+
}
|
|
193
|
+
function editIslandSource(code, edits, options) {
|
|
194
|
+
const ms = new MagicString(code);
|
|
195
|
+
for (const edit of edits) ms.overwrite(edit.start, edit.end, edit.text);
|
|
196
|
+
for (const insertion of options?.insert ?? []) ms.appendLeft(insertion.offset, insertion.text);
|
|
197
|
+
if (options?.prepend) ms.prepend(options.prepend);
|
|
198
|
+
if (options?.append) ms.append(options.append);
|
|
199
|
+
return {
|
|
200
|
+
code: ms.toString(),
|
|
201
|
+
map: ms.generateMap({ hires: true })
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/** Read island import attributes from JS/TS, or the script blocks of an SFC or a Markdown page. */
|
|
205
|
+
function findIslandImports(code, filename) {
|
|
206
|
+
if (!code.includes("import") || !code.includes("island")) return [];
|
|
207
|
+
const imports = [];
|
|
208
|
+
for (const script of scriptBlocks(code, filename)) {
|
|
209
|
+
if (!script.source.includes("island")) continue;
|
|
210
|
+
const program = asAstProgram(parseSync(script.filename, script.source).program);
|
|
211
|
+
for (const node of program.body ?? []) {
|
|
212
|
+
if (node.type !== "ImportDeclaration") continue;
|
|
213
|
+
const specifiers = node.specifiers;
|
|
214
|
+
const attributes = node.attributes;
|
|
215
|
+
const first = specifiers?.[0];
|
|
216
|
+
const attribute = attributes?.[0];
|
|
217
|
+
const key = attribute?.key;
|
|
218
|
+
const value = attribute?.value;
|
|
219
|
+
const source = node.source;
|
|
220
|
+
if (specifiers?.length !== 1 || first?.type !== "ImportDefaultSpecifier" || !isIdentifier(first.local) || attributes?.length !== 1 || !isIdentifier(key) || key.name !== "island" || !isLiteral(value) || typeof value.value !== "string" || !isLiteral(source) || typeof source.value !== "string" || source.start === void 0 || source.end === void 0 || node.start === void 0 || node.end === void 0) continue;
|
|
221
|
+
imports.push({
|
|
222
|
+
start: script.offset + node.start,
|
|
223
|
+
end: script.offset + node.end,
|
|
224
|
+
importName: first.local.name,
|
|
225
|
+
specifierRaw: script.source.slice(source.start, source.end),
|
|
226
|
+
specifier: source.value,
|
|
227
|
+
hydrate: value.value
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return imports;
|
|
232
|
+
}
|
|
233
|
+
// src/pages/layout-resolution.ts
|
|
234
|
+
function isNamedLayout(layout) {
|
|
235
|
+
return "name" in layout;
|
|
236
|
+
}
|
|
237
|
+
function toLayoutId(layout) {
|
|
238
|
+
if (isNamedLayout(layout)) return layout.directory ? `${layout.directory}/_layouts/${layout.name}` : `_layouts/${layout.name}`;
|
|
239
|
+
return layout.directory ? `${layout.directory}/layout` : "layout";
|
|
240
|
+
}
|
|
241
|
+
function resolveLayoutDirectories(componentId, componentPath) {
|
|
242
|
+
if (componentPath) {
|
|
243
|
+
const segments = componentPath.split("/");
|
|
244
|
+
segments.pop();
|
|
245
|
+
return segments.map((_, index) => segments.slice(0, index + 1).join("/"));
|
|
246
|
+
}
|
|
247
|
+
const parts = componentId.split("/");
|
|
248
|
+
return parts.slice(0, -1).map((_, index) => parts.slice(0, index + 1).join("/"));
|
|
249
|
+
}
|
|
250
|
+
/** Resolve the layout chain for a component (innermost last) */
|
|
251
|
+
function resolveLayoutChain(componentId, layouts, componentPath) {
|
|
252
|
+
const chain = [];
|
|
253
|
+
const root = layouts.find((layout) => layout.directory === "");
|
|
254
|
+
if (root) chain.push(root);
|
|
255
|
+
for (const dir of resolveLayoutDirectories(componentId, componentPath)) {
|
|
256
|
+
const layout = layouts.find((candidate) => candidate.directory === dir);
|
|
257
|
+
if (layout) chain.push(layout);
|
|
258
|
+
}
|
|
259
|
+
return chain;
|
|
260
|
+
}
|
|
261
|
+
/** Walk up directory tree to find closest _layouts/<name> */
|
|
262
|
+
function resolveNamedLayout(name, componentId, namedLayouts, componentPath) {
|
|
263
|
+
const dirs = resolveLayoutDirectories(componentId, componentPath).reverse();
|
|
264
|
+
dirs.push("");
|
|
265
|
+
for (const directory of dirs) {
|
|
266
|
+
const found = namedLayouts.find((namedLayout) => namedLayout.name === name && namedLayout.directory === directory);
|
|
267
|
+
if (found) return found;
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
function resolveEffectiveLayoutEntries(page, layouts, namedLayouts) {
|
|
272
|
+
if (page.layout === false) return [];
|
|
273
|
+
const defaultChain = resolveLayoutChain(page.componentId, layouts, page.componentPath).map((layout) => ({
|
|
274
|
+
id: toLayoutId(layout),
|
|
275
|
+
directory: layout.directory,
|
|
276
|
+
definition: layout
|
|
277
|
+
}));
|
|
278
|
+
if (page.layout === void 0) return defaultChain;
|
|
279
|
+
const isExclusive = page.layout.startsWith("!");
|
|
280
|
+
const resolved = resolveNamedLayout(isExclusive ? page.layout.slice(1) : page.layout, page.componentId, namedLayouts, page.componentPath);
|
|
281
|
+
if (!resolved) return defaultChain;
|
|
282
|
+
const namedEntry = {
|
|
283
|
+
id: toLayoutId(resolved),
|
|
284
|
+
directory: defaultChain.at(-1)?.directory ?? (page.componentPath ?? page.componentId).split("/").slice(0, -1).join("/"),
|
|
285
|
+
definition: resolved
|
|
286
|
+
};
|
|
287
|
+
if (isExclusive || defaultChain.length === 0) {
|
|
288
|
+
namedEntry.directory = (page.componentPath ?? page.componentId).split("/").slice(0, -1).join("/");
|
|
289
|
+
return [namedEntry];
|
|
290
|
+
}
|
|
291
|
+
const chain = [...defaultChain];
|
|
292
|
+
chain[chain.length - 1] = namedEntry;
|
|
293
|
+
return chain;
|
|
294
|
+
}
|
|
295
|
+
/** Resolve effective layout chain accounting for named layout selection */
|
|
296
|
+
function resolveEffectiveLayoutChain(page, layouts, namedLayouts) {
|
|
297
|
+
return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.definition);
|
|
298
|
+
}
|
|
299
|
+
function resolveLayoutIds(page, layouts, namedLayouts) {
|
|
300
|
+
return resolveEffectiveLayoutEntries(page, layouts, namedLayouts).map((layout) => layout.id);
|
|
301
|
+
}
|
|
302
|
+
// src/pages/boundary-plans.ts
|
|
303
|
+
/** What the client manifest carries; the server companion stays out of it. */
|
|
304
|
+
const planFields = ({ kind, directory, componentId, filePath }) => ({
|
|
305
|
+
kind,
|
|
306
|
+
directory,
|
|
307
|
+
componentId,
|
|
308
|
+
filePath
|
|
309
|
+
});
|
|
310
|
+
const encloses = (outer, inner) => !outer || outer === inner || inner.startsWith(outer + "/");
|
|
311
|
+
/** Build-local render identities preserve a named layout's logical placement. */
|
|
312
|
+
function createBoundaryManifest(scan) {
|
|
313
|
+
if (!scan.boundaries?.length) return {
|
|
314
|
+
plans: {},
|
|
315
|
+
pages: {}
|
|
316
|
+
};
|
|
317
|
+
const plans = {};
|
|
318
|
+
const pages = {};
|
|
319
|
+
const pageIds = new Set(scan.pages.map((page) => page.componentId));
|
|
320
|
+
const layoutKey = (id) => pageIds.has(id) ? id.replace(/(^|\/)([^/]+)$/, "$1_$2") : id;
|
|
321
|
+
for (const page of scan.pages) {
|
|
322
|
+
const directory = page.componentPath.split("/").slice(0, -1).join("/");
|
|
323
|
+
const layouts = resolveEffectiveLayoutEntries(page, scan.layouts, scan.namedLayouts);
|
|
324
|
+
const candidates = (scan.boundaries ?? []).filter((b) => encloses(b.directory, directory)).sort((a, b) => b.directory.length - a.directory.length);
|
|
325
|
+
const add = (boundary) => {
|
|
326
|
+
const retained = layouts.filter((l) => encloses(l.directory, boundary.directory)).map((l) => layoutKey(l.id));
|
|
327
|
+
const id = `_void:boundary:${JSON.stringify([
|
|
328
|
+
page.componentId,
|
|
329
|
+
boundary.componentId,
|
|
330
|
+
retained
|
|
331
|
+
])}`;
|
|
332
|
+
plans[id] = {
|
|
333
|
+
id,
|
|
334
|
+
...planFields(boundary),
|
|
335
|
+
source: page.componentId,
|
|
336
|
+
layouts: retained
|
|
337
|
+
};
|
|
338
|
+
return id;
|
|
339
|
+
};
|
|
340
|
+
const errors = candidates.filter((b) => b.kind === "error");
|
|
341
|
+
const notFound = candidates.find((b) => b.kind === "not-found");
|
|
342
|
+
pages[page.componentId] = {
|
|
343
|
+
...notFound ? {
|
|
344
|
+
notFound: add(notFound),
|
|
345
|
+
notFoundErrors: errors.filter((b) => encloses(b.directory, notFound.directory)).map(add)
|
|
346
|
+
} : {},
|
|
347
|
+
errors: errors.map(add),
|
|
348
|
+
catches: errors.map((b) => ({
|
|
349
|
+
depth: layouts.filter((l) => encloses(l.directory, b.directory)).length,
|
|
350
|
+
plan: add(b)
|
|
351
|
+
}))
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const root = scan.boundaries?.find((b) => b.kind === "not-found" && !b.directory);
|
|
355
|
+
if (root) {
|
|
356
|
+
const id = `_void:boundary:root-not-found:${JSON.stringify(scan.layouts.filter((l) => !l.directory).map((l) => l.filePath))}`;
|
|
357
|
+
plans[id] = {
|
|
358
|
+
id,
|
|
359
|
+
...planFields(root),
|
|
360
|
+
source: id,
|
|
361
|
+
layouts: scan.layouts.filter((l) => !l.directory).map((l) => layoutKey(l.directory ? l.directory + "/layout" : "layout"))
|
|
362
|
+
};
|
|
363
|
+
const error = scan.boundaries?.find((b) => b.kind === "error" && !b.directory);
|
|
364
|
+
const rootErrors = [];
|
|
365
|
+
if (error) {
|
|
366
|
+
const errorId = `_void:boundary:root-error:${id}`;
|
|
367
|
+
plans[errorId] = {
|
|
368
|
+
...planFields(error),
|
|
369
|
+
id: errorId,
|
|
370
|
+
source: id,
|
|
371
|
+
layouts: [...plans[id].layouts]
|
|
372
|
+
};
|
|
373
|
+
rootErrors.push(errorId);
|
|
374
|
+
}
|
|
375
|
+
pages[id] = {
|
|
376
|
+
errors: rootErrors,
|
|
377
|
+
catches: rootErrors.map((plan) => ({
|
|
378
|
+
depth: plans[id].layouts.length,
|
|
379
|
+
plan
|
|
380
|
+
}))
|
|
381
|
+
};
|
|
382
|
+
return {
|
|
383
|
+
plans,
|
|
384
|
+
pages,
|
|
385
|
+
root: id,
|
|
386
|
+
rootErrors
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
return {
|
|
390
|
+
plans,
|
|
391
|
+
pages
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
// src/pages/manifest.ts
|
|
395
|
+
/**
|
|
396
|
+
* Generates the component import map and layout tree as code strings.
|
|
397
|
+
* Used by both SSR renderer and client entry virtual modules.
|
|
398
|
+
*
|
|
399
|
+
* Client entries load this eagerly, so it grows with every page. Each page id
|
|
400
|
+
* is written once, identical layout chains are shared, and static routes are
|
|
401
|
+
* matched by exact lookup instead of a RegExp per page. The emitted bindings
|
|
402
|
+
* (`components`, `layoutTree`, `routeMeta`, `matchRoute`) keep their shape;
|
|
403
|
+
* `matchRoute` takes a decoded pathname (see `decodePagePath`).
|
|
404
|
+
*/
|
|
405
|
+
function generateComponentManifest(scan, pagesDir) {
|
|
406
|
+
const load = (filePath) => `() => import(${JSON.stringify(`${pagesDir}/${filePath}`)})`;
|
|
407
|
+
const pageIds = new Set(scan.pages.map((page) => page.componentId));
|
|
408
|
+
const layoutKey = (id) => {
|
|
409
|
+
if (!pageIds.has(id)) return id;
|
|
410
|
+
const slash = id.lastIndexOf("/");
|
|
411
|
+
return id.slice(0, slash + 1) + "_" + id.slice(slash + 1);
|
|
412
|
+
};
|
|
413
|
+
const chains = [];
|
|
414
|
+
const chainIndexes = /* @__PURE__ */ new Map();
|
|
415
|
+
const staticRows = [];
|
|
416
|
+
const dynamicRows = [];
|
|
417
|
+
let inStaticPrefix = true;
|
|
418
|
+
for (const page of scan.pages) {
|
|
419
|
+
const chain = JSON.stringify(resolveLayoutIds(page, scan.layouts, scan.namedLayouts).map(layoutKey));
|
|
420
|
+
let chainIndex = chain === "[]" ? -1 : chainIndexes.get(chain);
|
|
421
|
+
if (chainIndex === void 0) {
|
|
422
|
+
chainIndex = chains.push(chain) - 1;
|
|
423
|
+
chainIndexes.set(chain, chainIndex);
|
|
424
|
+
}
|
|
425
|
+
const id = JSON.stringify(page.componentId);
|
|
426
|
+
inStaticPrefix &&= isStaticPattern(page.pattern);
|
|
427
|
+
if (inStaticPrefix) {
|
|
428
|
+
const pattern = page.pattern === `/${page.componentId}` ? "" : `, ${JSON.stringify(page.pattern)}`;
|
|
429
|
+
staticRows.push(` [${id}, ${load(page.componentPath)}, ${chainIndex}${pattern}],`);
|
|
430
|
+
} else dynamicRows.push(` [${patternToRegex(page.pattern)}, ${id}, ${load(page.componentPath)}, ${chainIndex}],`);
|
|
431
|
+
}
|
|
432
|
+
const lines = [];
|
|
433
|
+
lines.push("const components = {};", `const __voidLayoutChains = [${chains.join(", ")}];`, "const __voidStaticRoutes = [", ...staticRows, "];", "const __voidDynamicRoutes = [", ...dynamicRows, "];", `const layoutTree = {};
|
|
434
|
+
const __voidStaticRouteIds = new Map();
|
|
435
|
+
for (const [id, load, chain, pattern = "/" + id] of __voidStaticRoutes) {
|
|
436
|
+
components[id] = load;
|
|
437
|
+
if (chain >= 0) layoutTree[id] = __voidLayoutChains[chain];
|
|
438
|
+
if (!__voidStaticRouteIds.has(pattern)) __voidStaticRouteIds.set(pattern, id);
|
|
439
|
+
}
|
|
440
|
+
const routes = [];
|
|
441
|
+
for (const [pattern, id, load, chain] of __voidDynamicRoutes) {
|
|
442
|
+
components[id] = load;
|
|
443
|
+
if (chain >= 0) layoutTree[id] = __voidLayoutChains[chain];
|
|
444
|
+
routes.push({ pattern, id });
|
|
445
|
+
}`);
|
|
446
|
+
for (const layout of [...scan.layouts, ...scan.namedLayouts]) lines.push(`components[${JSON.stringify(layoutKey(toLayoutId(layout)))}] = ${load(layout.filePath)};`);
|
|
447
|
+
for (const boundary of scan.boundaries ?? []) lines.push(`components[${JSON.stringify(boundary.componentId)}] = ${load(boundary.filePath)};`);
|
|
448
|
+
const boundaryManifest = createBoundaryManifest(scan);
|
|
449
|
+
lines.push(`const boundaryManifest = ${JSON.stringify(boundaryManifest)};`);
|
|
450
|
+
for (const plan of Object.values(boundaryManifest.plans)) lines.push(`components[${JSON.stringify(plan.id)}] = ${load(plan.filePath)};`, `layoutTree[${JSON.stringify(plan.id)}] = ${JSON.stringify(plan.layouts)};`);
|
|
451
|
+
lines.push("const routeMeta = {");
|
|
452
|
+
for (const page of scan.pages) {
|
|
453
|
+
const flags = [];
|
|
454
|
+
if (page.island) flags.push("island: true");
|
|
455
|
+
if (page.prerender === false) flags.push("prerender: false");
|
|
456
|
+
if (flags.length > 0) lines.push(` ${JSON.stringify(page.componentId)}: { ${flags.join(", ")} },`);
|
|
457
|
+
}
|
|
458
|
+
lines.push("};");
|
|
459
|
+
for (const plan of Object.values(boundaryManifest.plans)) lines.push(`routeMeta[${JSON.stringify(plan.id)}] = { boundary: true };`);
|
|
460
|
+
lines.push(`function matchRoute(path) {
|
|
461
|
+
const id = __voidStaticRouteIds.get(path);
|
|
462
|
+
if (id !== undefined) return id;
|
|
463
|
+
for (const r of routes) {
|
|
464
|
+
if (r.pattern.test(path)) return r.id;
|
|
465
|
+
}
|
|
466
|
+
return null;
|
|
467
|
+
}`);
|
|
468
|
+
return lines.join("\n");
|
|
469
|
+
}
|
|
470
|
+
const REGEX_SYNTAX = ".*+?^${}()|[]\\";
|
|
471
|
+
/** The capture group for `*`, `:name{.+}` and `:name`; other segments match as written. */
|
|
472
|
+
function captureGroup(segment) {
|
|
473
|
+
switch (routeSegmentKind(segment)) {
|
|
474
|
+
case "rest": return segment === "*" ? "(.*)" : "(.+)";
|
|
475
|
+
case "param": return String.raw`([^\/]+)`;
|
|
476
|
+
case "static": return;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
/** Whether `patternToRegex` matches only the pattern's own text. */
|
|
480
|
+
function isStaticPattern(pattern) {
|
|
481
|
+
return pattern.split("/").every((segment) => routeSegmentKind(segment) === "static");
|
|
482
|
+
}
|
|
483
|
+
/** The RegExp literal a page pattern matches with, the same on the client and the server. */
|
|
484
|
+
function patternToRegex(pattern) {
|
|
485
|
+
const trailingWildcard = pattern.endsWith("/*/");
|
|
486
|
+
return `/^${(trailingWildcard ? pattern.slice(0, -2) : pattern).split("/").map((segment) => {
|
|
487
|
+
const group = captureGroup(segment);
|
|
488
|
+
if (group) return group;
|
|
489
|
+
let literal = "";
|
|
490
|
+
for (const char of segment) literal += REGEX_SYNTAX.includes(char) ? "\\" + char : char;
|
|
491
|
+
return literal;
|
|
492
|
+
}).join(String.raw`\/`)}${trailingWildcard ? String.raw`(?:(.*)\/)?` : ""}$/`;
|
|
493
|
+
}
|
|
494
|
+
// src/pages/scan.ts
|
|
495
|
+
const COMPONENT_EXTENSIONS = [
|
|
496
|
+
"vue",
|
|
497
|
+
"tsx",
|
|
498
|
+
"jsx",
|
|
499
|
+
"svelte",
|
|
500
|
+
"md"
|
|
501
|
+
];
|
|
502
|
+
const PAGE_METHODS = /* @__PURE__ */ new Set([
|
|
503
|
+
"loader",
|
|
504
|
+
"action",
|
|
505
|
+
"actions"
|
|
506
|
+
]);
|
|
507
|
+
const MAX_REVALIDATE = 31536e3;
|
|
508
|
+
/** Layout paths already reported; a dev server rescans pages on every file change. */
|
|
509
|
+
const warnedLayoutPaths = /* @__PURE__ */ new Set();
|
|
510
|
+
/** Unreachable pages already reported, for the same reason. */
|
|
511
|
+
const warnedShadowedPages = /* @__PURE__ */ new Set();
|
|
512
|
+
/** Ignored page settings already reported, for the same reason. */
|
|
513
|
+
const warnedPageSettings = /* @__PURE__ */ new Set();
|
|
514
|
+
/**
|
|
515
|
+
* Page settings (layout, revalidate, prerender, ssr) are read from the source
|
|
516
|
+
* without running it. One the source does not show keeps its default, as
|
|
517
|
+
* before, with a warning: a hard error would break builds that already ship it.
|
|
518
|
+
*/
|
|
519
|
+
function warnPageSettings(pagesDir, warnings) {
|
|
520
|
+
for (const warning of warnings) {
|
|
521
|
+
const key = `${pagesDir}\0${warning}`;
|
|
522
|
+
if (!warnedPageSettings.has(key)) {
|
|
523
|
+
warnedPageSettings.add(key);
|
|
524
|
+
voidWarn(warning);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const LAYOUT_EXPORT = /* @__PURE__ */ new Set(["layout"]);
|
|
529
|
+
function mayExportLayout(source) {
|
|
530
|
+
return source.includes("layout") || mayExportAll(source);
|
|
531
|
+
}
|
|
532
|
+
/** The first script block that declares a readable layout wins; warnings only apply when none does. */
|
|
533
|
+
function componentLayout(source, filename) {
|
|
534
|
+
if (!mayExportLayout(source)) return {
|
|
535
|
+
layout: void 0,
|
|
536
|
+
warnings: []
|
|
537
|
+
};
|
|
538
|
+
let ignored;
|
|
539
|
+
let exportsAll = false;
|
|
540
|
+
for (const script of scriptBlocks(source, filename)) {
|
|
541
|
+
if (!mayExportLayout(script.source)) continue;
|
|
542
|
+
const exports = readStaticExports(script.filename, script.source, LAYOUT_EXPORT);
|
|
543
|
+
const initializer = exports.initializers.get("layout");
|
|
544
|
+
const value = staticLiteral(initializer);
|
|
545
|
+
if (typeof value === "string" || value === false) return {
|
|
546
|
+
layout: value,
|
|
547
|
+
warnings: []
|
|
548
|
+
};
|
|
549
|
+
if (script.instance) continue;
|
|
550
|
+
exportsAll ||= exports.exportsAll;
|
|
551
|
+
if (exports.unreadable.has("layout")) ignored ??= `pages: layout in '${filename}' is ignored. Declare it in that file as \`export const layout = '<name>'\`; re-exported layouts and other export forms are not read.`;
|
|
552
|
+
else if (initializer) ignored ??= `pages: layout in '${filename}' is ignored. It must be a string literal or \`false\`, such as \`export const layout = 'landing'\`.`;
|
|
553
|
+
}
|
|
554
|
+
if (ignored) return {
|
|
555
|
+
layout: void 0,
|
|
556
|
+
warnings: [ignored]
|
|
557
|
+
};
|
|
558
|
+
if (exportsAll) return {
|
|
559
|
+
layout: void 0,
|
|
560
|
+
warnings: [`pages: '${filename}' uses \`export * from\`. Void does not read a layout export through it, so declare layout in that file with \`export const\`.`]
|
|
561
|
+
};
|
|
562
|
+
return {
|
|
563
|
+
layout: void 0,
|
|
564
|
+
warnings: []
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
const TRANSPARENT_EXPRESSION_TYPES = /* @__PURE__ */ new Set([
|
|
568
|
+
"ParenthesizedExpression",
|
|
569
|
+
"TSAsExpression",
|
|
570
|
+
"TSNonNullExpression",
|
|
571
|
+
"TSSatisfiesExpression",
|
|
572
|
+
"TSTypeAssertion"
|
|
573
|
+
]);
|
|
574
|
+
function readLiteral(node) {
|
|
575
|
+
while (node && TRANSPARENT_EXPRESSION_TYPES.has(node.type)) node = node.expression;
|
|
576
|
+
return isLiteral(node) ? node.value : void 0;
|
|
577
|
+
}
|
|
578
|
+
const PAGE_SETTINGS = [
|
|
579
|
+
"revalidate",
|
|
580
|
+
"prerender",
|
|
581
|
+
"ssr"
|
|
582
|
+
];
|
|
583
|
+
const PAGE_SETTING_SET = new Set(PAGE_SETTINGS);
|
|
584
|
+
const PAGE_SETTING_PLACEHOLDERS = {
|
|
585
|
+
revalidate: "<seconds>",
|
|
586
|
+
prerender: "<boolean>",
|
|
587
|
+
ssr: "<boolean>"
|
|
588
|
+
};
|
|
589
|
+
/** Read revalidate, prerender and ssr from a page's server file, collecting warnings for values it cannot read. */
|
|
590
|
+
function readPageSettings(program, filename, metadata) {
|
|
591
|
+
const settings = staticExports(program, PAGE_SETTING_SET);
|
|
592
|
+
for (const name of PAGE_SETTINGS) {
|
|
593
|
+
if (settings.unreadable.has(name)) {
|
|
594
|
+
metadata.warnings.push(`pages: ${name} in '${filename}' is ignored. Declare it in that file as \`export const ${name} = ${PAGE_SETTING_PLACEHOLDERS[name]}\`; re-exported settings and other export forms are not read.`);
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
const initializer = settings.initializers.get(name);
|
|
598
|
+
if (!initializer) continue;
|
|
599
|
+
const value = readLiteral(initializer);
|
|
600
|
+
if (name === "revalidate") {
|
|
601
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 0) metadata.revalidate = value;
|
|
602
|
+
else metadata.warnings.push(`pages: revalidate in '${filename}' is ignored. It must be a nonnegative integer literal, such as \`export const revalidate = 3600\`.`);
|
|
603
|
+
} else if (typeof value === "boolean") metadata[name] = value;
|
|
604
|
+
else metadata.warnings.push(`pages: ${name} in '${filename}' is ignored. It must be \`true\` or \`false\`.`);
|
|
605
|
+
}
|
|
606
|
+
if (settings.exportsAll) metadata.warnings.push(`pages: '${filename}' uses \`export * from\`. Void does not see page exports through it, so export loader, action, actions and getPrerenderPaths by name, and declare revalidate, prerender and ssr in that file with \`export const\`.`);
|
|
607
|
+
}
|
|
608
|
+
function detectPageServerMetadata(source, filename) {
|
|
609
|
+
const metadata = {
|
|
610
|
+
methods: [],
|
|
611
|
+
warnings: []
|
|
612
|
+
};
|
|
613
|
+
let parsed;
|
|
614
|
+
try {
|
|
615
|
+
parsed = parseSync(filename, source);
|
|
616
|
+
} catch {
|
|
617
|
+
return metadata;
|
|
618
|
+
}
|
|
619
|
+
const program = asAstProgram(parsed.program);
|
|
620
|
+
for (const node of program.body ?? []) {
|
|
621
|
+
if (node.type !== "ExportNamedDeclaration") continue;
|
|
622
|
+
const exported = node;
|
|
623
|
+
if (exported.exportKind === "type") continue;
|
|
624
|
+
const declaration = exported.declaration;
|
|
625
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
626
|
+
const variables = declaration;
|
|
627
|
+
for (const variable of variables.declarations ?? []) for (const name of bindingNames(variable.id)) if (PAGE_METHODS.has(name)) metadata.methods.push(name);
|
|
628
|
+
else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
629
|
+
} else if (declaration?.type === "FunctionDeclaration") {
|
|
630
|
+
const functionName = declaration.id;
|
|
631
|
+
if (isIdentifier(functionName)) {
|
|
632
|
+
if (PAGE_METHODS.has(functionName.name)) metadata.methods.push(functionName.name);
|
|
633
|
+
else if (functionName.name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
for (const specifier of exported.specifiers ?? []) {
|
|
637
|
+
const name = moduleExportName(specifier.exported);
|
|
638
|
+
if (specifier.exportKind === "type" || name === void 0) continue;
|
|
639
|
+
if (PAGE_METHODS.has(name)) metadata.methods.push(name);
|
|
640
|
+
else if (name === "getPrerenderPaths") metadata.hasGetPrerenderPaths = true;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
readPageSettings(program, filename, metadata);
|
|
644
|
+
return metadata;
|
|
645
|
+
}
|
|
646
|
+
function inferAutoPrerender(page, options) {
|
|
647
|
+
const isDynamic = page.params.length > 0 || page.catchAll;
|
|
648
|
+
if (options?.output === "static") return !isDynamic || page.hasGetPrerenderPaths === true;
|
|
649
|
+
return page.island === true && !page.methods.includes("loader") && !isDynamic;
|
|
650
|
+
}
|
|
651
|
+
function resolvePageRendering(page, options) {
|
|
652
|
+
if (page.island && page.ssr === false) throw new Error(`pages: ssr = false is not valid for island page '${page.componentPath}'.`);
|
|
653
|
+
const ssrMode = page.ssr === true ? "server" : page.ssr === false ? "client" : "auto";
|
|
654
|
+
const prerenderMode = page.prerender === true ? "force" : page.prerender === false ? "disabled" : "auto";
|
|
655
|
+
return {
|
|
656
|
+
ssrMode,
|
|
657
|
+
prerenderMode,
|
|
658
|
+
renderMode: page.island === true ? "island" : ssrMode === "client" ? "client" : "server",
|
|
659
|
+
shouldPrerender: prerenderMode === "force" || prerenderMode === "auto" && inferAutoPrerender(page, options)
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const BOUNDARY_COMPONENT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
663
|
+
".tsx",
|
|
664
|
+
".jsx",
|
|
665
|
+
".vue",
|
|
666
|
+
".svelte"
|
|
667
|
+
]);
|
|
668
|
+
/**
|
|
669
|
+
* The environment a file under pages/ is limited to, read from its name the way
|
|
670
|
+
* scanPages does: `home.dev.tsx`, `home.dev.island.vue` and `home.dev.server.ts`
|
|
671
|
+
* give 'dev'. Boundary files count too: `_error.dev.tsx` and `_error.dev.server.ts`
|
|
672
|
+
* give 'dev'. Files the scanner skips (other `_` names, other extensions) give null.
|
|
673
|
+
*/
|
|
674
|
+
function pageFileEnvironment(relativePath) {
|
|
675
|
+
const segments = toSlash(relativePath).split("/");
|
|
676
|
+
if (segments.slice(0, -1).some((segment) => segment.startsWith("_"))) return null;
|
|
677
|
+
const file = segments.at(-1) ?? "";
|
|
678
|
+
const ext = extname(file);
|
|
679
|
+
let base = basename(file, ext);
|
|
680
|
+
const server = ROUTE_EXTENSIONS_SET.has(ext) && base.endsWith(".server");
|
|
681
|
+
if (server) base = base.slice(0, -7);
|
|
682
|
+
else if (COMPONENT_EXTENSIONS.includes(ext.slice(1))) {
|
|
683
|
+
if (base.endsWith(".island")) base = base.slice(0, -7);
|
|
684
|
+
} else return null;
|
|
685
|
+
const env = base.endsWith(".dev") ? "dev" : base.endsWith(".prod") ? "prod" : null;
|
|
686
|
+
if (base.startsWith("_")) {
|
|
687
|
+
const name = env ? base.slice(0, -env.length - 1) : base;
|
|
688
|
+
return (name === "_error" || name === "_not-found") && (server || BOUNDARY_COMPONENT_EXTENSIONS.has(ext) && !file.includes(".island.")) ? env : null;
|
|
689
|
+
}
|
|
690
|
+
return env;
|
|
691
|
+
}
|
|
692
|
+
async function scanPages(root, options) {
|
|
693
|
+
const trailingSlash = options?.trailingSlash ?? readConfig(root).routing?.trailingSlash;
|
|
694
|
+
const pagesDir = options?.pagesDir ?? options?.paths?.pagesDir ?? readProjectPaths(root).pagesDir;
|
|
695
|
+
if (!existsSync(pagesDir)) return {
|
|
696
|
+
pages: [],
|
|
697
|
+
layouts: [],
|
|
698
|
+
namedLayouts: []
|
|
699
|
+
};
|
|
700
|
+
const pattern = `**/*.{${COMPONENT_EXTENSIONS.join(",")}}`;
|
|
701
|
+
const files = await glob(pattern, {
|
|
702
|
+
cwd: pagesDir,
|
|
703
|
+
absolute: false
|
|
704
|
+
});
|
|
705
|
+
const pages = [];
|
|
706
|
+
const layouts = [];
|
|
707
|
+
const namedLayouts = [];
|
|
708
|
+
const boundaries = [];
|
|
709
|
+
for (const file of files.sort()) {
|
|
710
|
+
const segments = file.split("/");
|
|
711
|
+
const boundary = /^_(error|not-found)(?:\.(dev|prod))?(\.island)?\.(tsx|jsx|vue|svelte)$/.exec(file.slice(file.lastIndexOf("/") + 1));
|
|
712
|
+
if (boundary && !segments.slice(0, -1).some((segment) => segment.startsWith("_"))) {
|
|
713
|
+
const env = boundary[2];
|
|
714
|
+
if (options?.environment && env && env !== options.environment) continue;
|
|
715
|
+
const base = file.slice(0, -extname(file).length);
|
|
716
|
+
const serverPath = ROUTE_EXTENSIONS.map((ext) => `${base}.server.${ext}`).find((candidate) => existsSync(join(pagesDir, candidate)));
|
|
717
|
+
if (boundary[3] || deriveFromSource(join(pagesDir, file), "page-boundary-layout", (source) => scriptBlocks(source, file).some((script) => readStaticExports(script.filename, script.source, /* @__PURE__ */ new Set(["layout"])).initializers.has("layout")))) throw new Error(`pages: Boundary '${file}' cannot be an island or select a layout.`);
|
|
718
|
+
const directory = segments.slice(0, -1).join("/");
|
|
719
|
+
for (const prior of boundaries) {
|
|
720
|
+
const priorEnv = /^_(?:error|not-found)\.(dev|prod)\./.exec(basename(prior.filePath))?.[1];
|
|
721
|
+
if (prior.directory === directory && prior.kind === boundary[1] && (!env || !priorEnv || env === priorEnv)) throw new Error(`pages: Ambiguous boundary files '${prior.filePath}' and '${file}'.`);
|
|
722
|
+
}
|
|
723
|
+
if (serverPath) {
|
|
724
|
+
const { methods } = deriveFromSource(join(pagesDir, serverPath), "page-server", (source) => detectPageServerMetadata(source, serverPath));
|
|
725
|
+
if (methods.length > 0) throw new Error(`pages: '${serverPath}' can only export head(). Boundaries have no loader or actions, so remove ${methods.join(", ")}.`);
|
|
726
|
+
}
|
|
727
|
+
boundaries.push({
|
|
728
|
+
kind: boundary[1],
|
|
729
|
+
directory,
|
|
730
|
+
componentId: base,
|
|
731
|
+
filePath: file,
|
|
732
|
+
...serverPath && { serverPath }
|
|
733
|
+
});
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
if (segments.some((s) => s.startsWith("_") && s !== "_layouts")) continue;
|
|
737
|
+
const ext = extname(file);
|
|
738
|
+
let base = basename(file, ext);
|
|
739
|
+
if (base.endsWith(".server") && ROUTE_EXTENSIONS_SET.has(ext)) continue;
|
|
740
|
+
let island;
|
|
741
|
+
let hasIslandSuffix = false;
|
|
742
|
+
if (base.endsWith(".island")) {
|
|
743
|
+
island = true;
|
|
744
|
+
hasIslandSuffix = true;
|
|
745
|
+
base = base.slice(0, -7);
|
|
746
|
+
}
|
|
747
|
+
if (ext === ".md") island = true;
|
|
748
|
+
const layoutsDirIdx = segments.indexOf("_layouts");
|
|
749
|
+
if (layoutsDirIdx !== -1) {
|
|
750
|
+
if (layoutsDirIdx === segments.length - 2) namedLayouts.push({
|
|
751
|
+
name: base,
|
|
752
|
+
directory: segments.slice(0, layoutsDirIdx).join("/"),
|
|
753
|
+
filePath: file,
|
|
754
|
+
island
|
|
755
|
+
});
|
|
756
|
+
continue;
|
|
757
|
+
}
|
|
758
|
+
if (base === "layout") {
|
|
759
|
+
const dir = dirname(file);
|
|
760
|
+
layouts.push({
|
|
761
|
+
directory: dir === "." ? "" : dir,
|
|
762
|
+
filePath: file,
|
|
763
|
+
island
|
|
764
|
+
});
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
const route = parseRouteFilename(hasIslandSuffix ? file.replace(`.island${ext}`, ".ts") : file.replace(ext, ".ts"));
|
|
768
|
+
if (!isRouteEnabledForEnvironment(route, options?.environment)) continue;
|
|
769
|
+
const componentId = file.replace(ext, "").replace(/\.island$/, "").replace(/\/index$/, "").replace(/^index$/, "") || "index";
|
|
770
|
+
let serverPath = null;
|
|
771
|
+
const methods = [];
|
|
772
|
+
let revalidate;
|
|
773
|
+
let prerender;
|
|
774
|
+
let ssr;
|
|
775
|
+
let hasGetPrerenderPaths;
|
|
776
|
+
const serverBase = hasIslandSuffix ? file.replace(`.island${ext}`, "") : file.replace(ext, "");
|
|
777
|
+
for (const serverExt of ROUTE_EXTENSIONS) {
|
|
778
|
+
const candidate = `${serverBase}.server.${serverExt}`;
|
|
779
|
+
if (existsSync(join(pagesDir, candidate))) {
|
|
780
|
+
serverPath = candidate;
|
|
781
|
+
const metadata = deriveFromSource(join(pagesDir, candidate), "page-server", (source) => detectPageServerMetadata(source, candidate));
|
|
782
|
+
methods.push(...metadata.methods);
|
|
783
|
+
revalidate = metadata.revalidate;
|
|
784
|
+
prerender = metadata.prerender;
|
|
785
|
+
ssr = metadata.ssr;
|
|
786
|
+
hasGetPrerenderPaths = metadata.hasGetPrerenderPaths;
|
|
787
|
+
warnPageSettings(pagesDir, metadata.warnings);
|
|
788
|
+
break;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const rendering = resolvePageRendering({
|
|
792
|
+
componentPath: file,
|
|
793
|
+
island,
|
|
794
|
+
ssr,
|
|
795
|
+
prerender,
|
|
796
|
+
methods,
|
|
797
|
+
params: route.params,
|
|
798
|
+
catchAll: route.catchAll,
|
|
799
|
+
hasGetPrerenderPaths
|
|
800
|
+
}, options);
|
|
801
|
+
if (rendering.shouldPrerender && revalidate === void 0) revalidate = MAX_REVALIDATE;
|
|
802
|
+
let metadata;
|
|
803
|
+
let layout;
|
|
804
|
+
if (ext === ".md") {
|
|
805
|
+
const { default: matter } = await import("gray-matter");
|
|
806
|
+
({metadata, layout} = deriveFromSource(join(pagesDir, file), "page-markdown", (source) => ({
|
|
807
|
+
metadata: extractFrontmatterMeta(source),
|
|
808
|
+
layout: extractFrontmatterLayout(source, matter)
|
|
809
|
+
})));
|
|
810
|
+
} else {
|
|
811
|
+
const component = deriveFromSource(join(pagesDir, file), "page-layout", (source) => componentLayout(source, file));
|
|
812
|
+
layout = component.layout;
|
|
813
|
+
warnPageSettings(pagesDir, component.warnings);
|
|
814
|
+
}
|
|
815
|
+
pages.push({
|
|
816
|
+
pattern: trailingSlash && route.pattern !== "/" ? `${route.pattern}/` : route.pattern,
|
|
817
|
+
params: route.params,
|
|
818
|
+
catchAll: route.catchAll,
|
|
819
|
+
componentPath: file,
|
|
820
|
+
serverPath,
|
|
821
|
+
methods,
|
|
822
|
+
componentId,
|
|
823
|
+
revalidate,
|
|
824
|
+
prerender,
|
|
825
|
+
ssr,
|
|
826
|
+
...rendering,
|
|
827
|
+
hasGetPrerenderPaths,
|
|
828
|
+
island,
|
|
829
|
+
metadata: metadata ? { ...metadata } : void 0,
|
|
830
|
+
layout,
|
|
831
|
+
...route.env ? { env: route.env } : {}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
pages.sort(compareRouteSpecificity);
|
|
835
|
+
if (options?.checkRoutes !== false) {
|
|
836
|
+
const environments = options?.environment ? [options.environment] : ["dev", "prod"];
|
|
837
|
+
for (const environment of environments) {
|
|
838
|
+
const live = pages.filter((page) => isRouteEnabledForEnvironment({ env: page.env ?? null }, environment));
|
|
839
|
+
assertOnePagePerRoute(live);
|
|
840
|
+
warnShadowedPages(pagesDir, live);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
for (const page of pages) {
|
|
844
|
+
if (page.island) continue;
|
|
845
|
+
const dir = dirname(page.componentPath);
|
|
846
|
+
const segments = dir === "." ? [] : dir.split("/");
|
|
847
|
+
const ancestors = /* @__PURE__ */ new Set(["", ...segments.map((_, index) => segments.slice(0, index + 1).join("/"))]);
|
|
848
|
+
if (layouts.some((l) => l.island && ancestors.has(l.directory))) throw new Error(`pages: Regular page '${page.componentPath}' is under an island layout. Add a .island suffix.`);
|
|
849
|
+
}
|
|
850
|
+
for (const page of pages) {
|
|
851
|
+
if (page.layout === void 0 || page.layout === false) continue;
|
|
852
|
+
const name = page.layout.startsWith("!") ? page.layout.slice(1) : page.layout;
|
|
853
|
+
if (name.startsWith(".") || name.startsWith("/")) {
|
|
854
|
+
const key = `${pagesDir}\0${page.componentPath}\0${page.layout}`;
|
|
855
|
+
if (!warnedLayoutPaths.has(key)) {
|
|
856
|
+
warnedLayoutPaths.add(key);
|
|
857
|
+
voidWarn(`pages: Page '${page.componentPath}' specifies layout '${page.layout}'. Layout paths are not supported, so the default layouts are used. Use the name of a file in a _layouts/ directory, such as 'landing'.`);
|
|
858
|
+
}
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
if (!resolveNamedLayout(name, page.componentId, namedLayouts, page.componentPath)) throw new Error(`pages: Page '${page.componentPath}' specifies layout '${page.layout}', but _layouts/${name}.vue was not found in any ancestor directory.`);
|
|
862
|
+
}
|
|
863
|
+
return {
|
|
864
|
+
pages,
|
|
865
|
+
layouts,
|
|
866
|
+
namedLayouts,
|
|
867
|
+
...boundaries.length ? { boundaries } : {}
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
function compareText(left, right) {
|
|
871
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
872
|
+
}
|
|
873
|
+
/** Group sorted pages by `key`, keeping only groups with more than one page. */
|
|
874
|
+
function pagesSharing(pages, key) {
|
|
875
|
+
const groups = /* @__PURE__ */ new Map();
|
|
876
|
+
for (const page of pages) {
|
|
877
|
+
const group = groups.get(key(page));
|
|
878
|
+
if (group) group.push(page);
|
|
879
|
+
else groups.set(key(page), [page]);
|
|
880
|
+
}
|
|
881
|
+
return [...groups.values()].filter((group) => group.length > 1);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Two files for one path have no stable winner: the server and the client can
|
|
885
|
+
* each pick a different one, and the order can change between runs.
|
|
886
|
+
*/
|
|
887
|
+
function assertOnePagePerRoute(pages) {
|
|
888
|
+
assertNoneShare(pages, (page) => page.pattern, "pages: Multiple page files resolve to the same route:", "Keep one page file per route and rename or remove the others.");
|
|
889
|
+
assertNoneShare(pages, (page) => page.componentId, "pages: Multiple page files resolve to the same page id:", "Rename or remove one of them.");
|
|
890
|
+
}
|
|
891
|
+
function assertNoneShare(pages, key, title, hint) {
|
|
892
|
+
const clashes = pagesSharing(pages, key).map((group) => ({
|
|
893
|
+
key: key(group[0]),
|
|
894
|
+
files: group.map((page) => page.componentPath).sort(compareText)
|
|
895
|
+
})).sort((left, right) => compareText(left.key, right.key)).map((clash) => ` ${JSON.stringify(clash.key)}: ${clash.files.map((file) => JSON.stringify(file)).join(", ")}`);
|
|
896
|
+
if (clashes.length > 0) throw new Error([
|
|
897
|
+
title,
|
|
898
|
+
...clashes,
|
|
899
|
+
hint
|
|
900
|
+
].join("\n"));
|
|
901
|
+
}
|
|
902
|
+
/** Dynamic routes that match the same URLs, such as [id] and [slug]: only the first is ever used. */
|
|
903
|
+
function warnShadowedPages(pagesDir, pages) {
|
|
904
|
+
for (const [used, ...shadowed] of pagesSharing(pages, (page) => patternToRegex(page.pattern))) for (const page of shadowed) {
|
|
905
|
+
const key = `${pagesDir}\0${used.componentPath}\0${page.componentPath}`;
|
|
906
|
+
if (warnedShadowedPages.has(key)) continue;
|
|
907
|
+
warnedShadowedPages.add(key);
|
|
908
|
+
voidWarn(`pages: Page '${page.componentPath}' (${page.pattern}) is never used: '${used.componentPath}' (${used.pattern}) matches the same URLs first. Remove one of them.`);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
/** Return the raw YAML frontmatter of markdown source, after any leading <script> block. */
|
|
912
|
+
function markdownFrontmatter(source) {
|
|
913
|
+
return source.replace(MARKDOWN_SCRIPT_RE, "").match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
914
|
+
}
|
|
915
|
+
/** Read a single-line `key: value` field, stripping surrounding quotes. */
|
|
916
|
+
function frontmatterField(yaml, key) {
|
|
917
|
+
return yaml.match(new RegExp(`^${key}:\\s*(.+)$`, "m"))?.[1]?.trim().replaceAll(/^["']|["']$/g, "");
|
|
918
|
+
}
|
|
919
|
+
/** Extract title and description from YAML frontmatter in markdown source. */
|
|
920
|
+
function extractFrontmatterMeta(source) {
|
|
921
|
+
const yaml = markdownFrontmatter(source);
|
|
922
|
+
if (yaml === void 0) return;
|
|
923
|
+
const title = frontmatterField(yaml, "title");
|
|
924
|
+
const description = frontmatterField(yaml, "description");
|
|
925
|
+
if (!title && !description) return;
|
|
926
|
+
return {
|
|
927
|
+
title,
|
|
928
|
+
description
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
/** Extract layout field from YAML frontmatter in markdown source. */
|
|
932
|
+
function extractFrontmatterLayout(source, matter) {
|
|
933
|
+
const yaml = markdownFrontmatter(source);
|
|
934
|
+
if (yaml === void 0) return;
|
|
935
|
+
let frontmatter;
|
|
936
|
+
try {
|
|
937
|
+
frontmatter = matter(`---\n${yaml}\n---`, {}).data;
|
|
938
|
+
} catch {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const value = frontmatter.layout;
|
|
942
|
+
if (value === void 0 || value === null || value === "") return;
|
|
943
|
+
if (value === false || value === "false") return false;
|
|
944
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
945
|
+
}
|
|
946
|
+
export { parseWebSocketFilename as _, createBoundaryManifest as a, resolveLayoutIds as c, editIslandSource as d, findIslandImports as f, parseRouteFilename as g, isRouteEnabledForEnvironment as h, patternToRegex as i, resolveNamedLayout as l, compareRouteSpecificity as m, scanPages as n, resolveEffectiveLayoutChain as o, findStaticCssImports as p, generateComponentManifest as r, resolveLayoutChain as s, pageFileEnvironment as t, toLayoutId as u, ROUTE_EXTENSIONS as v };
|