void 1.7.0 → 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-BfkJ_1PC.mjs → account-cmd-CZKntRH2.mjs} +5 -5
- package/dist/action-key-ByZ6DDld.mjs +64 -0
- package/dist/{application-analysis-OV0CBJ80.mjs → application-analysis-CyTagJQM.mjs} +25 -5
- package/dist/{application-routing-QpyC5G8z.mjs → application-routing-BLrMVpqi.mjs} +1 -1
- package/dist/{auth-CZrthGxs.d.mts → auth-Bk9VGtQW.d.mts} +1 -1
- package/dist/{auth-link-CW1Zh6FM.mjs → auth-link-BOaQWMKw.mjs} +5 -5
- package/dist/{auth-router-CNBKnEZi.mjs → auth-router-D0-VcmDs.mjs} +3 -3
- package/dist/{better-auth-shared-C-0uZg8-.d.mts → better-auth-shared-CQFdtguU.d.mts} +2 -2
- package/dist/boundary-plans-CRmWH68v.d.mts +25 -0
- package/dist/{build-cmd-C9qOKW9W.mjs → build-cmd-JTsXXf2F.mjs} +4 -4
- package/dist/{cache-DVBBbWQL.mjs → cache-D0m3Z_Xf.mjs} +4 -4
- package/dist/{cancel-deploy-COavnjud.mjs → cancel-deploy-Ce6Os4fa.mjs} +3 -3
- package/dist/cli/cli.mjs +1 -1
- package/dist/cli/cloudflare-operation-process.mjs +92 -19
- package/dist/cli/env-schema-probe.d.mts +1 -1
- package/dist/cli/env-schema-probe.mjs +2 -2
- package/dist/{cli-main-DFteHrJI.mjs → cli-main-rkrJy2Ge.mjs} +32 -32
- package/dist/client-D1Vz1Zep.mjs +1 -0
- package/dist/{client-BEZmTP6p.mjs → client-SZPyj4X_.mjs} +1 -1
- package/dist/{cloudflare-auth-DGIivpTb.mjs → cloudflare-auth-7jTqy9Bx.mjs} +1 -1
- package/dist/{cloudflare-cmd-DJaxC-bc.mjs → cloudflare-cmd-ChPLQcTP.mjs} +4 -4
- package/dist/{cloudflare-connect-BjpWmglw.mjs → cloudflare-connect-Co93VYTo.mjs} +2 -2
- package/dist/{cloudflare-operations-k7wYUv56.mjs → cloudflare-operations-CXaDKYj2.mjs} +4 -4
- package/dist/{cloudflare-operations-CZkjFrzH.mjs → cloudflare-operations-DATekLwI.mjs} +1 -1
- package/dist/{cloudflare-process-BcPvlMFd.mjs → cloudflare-process-DmTxZR-N.mjs} +1 -1
- package/dist/{connect-j1F1C_rW.mjs → connect-DlvXt1JR.mjs} +6 -6
- package/dist/{create-project-CE3jOmd5.mjs → create-project-CC_7hmYJ.mjs} +4 -4
- package/dist/{create-project-DZH3aYGQ.mjs → create-project-DzY05xqC.mjs} +1 -1
- package/dist/{db-DyLzzxvM.mjs → db-FhyYGcJJ.mjs} +13 -13
- package/dist/{db-types-DdHHUVPy.mjs → db-types-sVwEpyPR.mjs} +3 -1
- package/dist/{delete-Dey6YoMA.mjs → delete-CModjyOC.mjs} +4 -4
- package/dist/{deploy-Ccw2D2lw.mjs → deploy-Cz9TEzZy.mjs} +34 -24
- package/dist/deploy-DMieisRu.mjs +2 -0
- package/dist/{deploy-managed-static-BBVtpuGv.mjs → deploy-managed-static-DlxxXkAM.mjs} +10 -10
- package/dist/{deploy-transport-Dt0IvSVW.mjs → deploy-transport-DUvm6-CR.mjs} +2 -2
- package/dist/deploy.mjs +5 -5
- package/dist/{dispatch-pYaww76u.mjs → dispatch-CCiaAnSK.mjs} +4 -4
- package/dist/{dist-DeTdhbZc.mjs → dist-Cp4b1_T9.mjs} +1 -1
- package/dist/{dist-BQdgCVQF.mjs → dist-STQXl8ck.mjs} +86 -138
- package/dist/{domain-Dh3mG8Vs.mjs → domain-DvdZPA50.mjs} +5 -5
- 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-DKyMjOYM.mjs → email-ASpNrfLd.mjs} +7 -7
- package/dist/{email-cloudflare-CTt2n_W2.mjs → email-cloudflare-kqoN9jst.mjs} +13 -8
- package/dist/{entry-Bw-G1VVx.mjs → entry-BweGTCgj.mjs} +1 -1
- package/dist/{env-DkZzh_Dd.mjs → env-Bpkg3G5i.mjs} +5 -5
- package/dist/{env-CuzZZyjB.mjs → env-UqS-21xi.mjs} +8 -1
- package/dist/{env-public-CeNeO_AT.d.mts → env-public-DtJL_hZq.d.mts} +8 -7
- package/dist/{env-validation-1snjKtDX.mjs → env-validation-BpCCQE_6.mjs} +3 -3
- package/dist/{env-validation-C8NL3lEH.mjs → env-validation-CN386Utu.mjs} +1 -1
- package/dist/gen-M5fNQKfH.mjs +1 -0
- package/dist/{gen-BZmFOGDQ.mjs → gen-upKJChvd.mjs} +3 -3
- package/dist/{github-cmd-7Oky9qgH.mjs → github-cmd-BvMOlb8Z.mjs} +4 -4
- package/dist/{handler-DjqciiDc.d.mts → handler-BO7Od-z9.d.mts} +3 -2
- package/dist/{headers-CimYIfQI.mjs → headers-COGEDoMN.mjs} +10 -1
- package/dist/help-CItQVDL4.mjs +1 -0
- package/dist/{help-CNuUb47C.mjs → help-TPCjTu6e.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +247 -178
- package/dist/{info-DwB8IWIx.mjs → info-EsDyihwf.mjs} +2 -2
- package/dist/{init-CUGSmcED.mjs → init-a4lVagrb.mjs} +13 -14
- package/dist/{link-BlRTGHan.mjs → link-CE55DDzS.mjs} +5 -5
- package/dist/{list-iCg7d5Pa.mjs → list-CxRthQks.mjs} +5 -5
- package/dist/{live-zKGbRT4h.d.mts → live-Kc55iuOQ.d.mts} +2 -2
- package/dist/{login-TA51e5Fw.mjs → login-AfcSGSmE.mjs} +4 -4
- package/dist/login-ZHsAm-I6.mjs +1 -0
- package/dist/{logs-BlyAxlvx.mjs → logs-BgRJuvb1.mjs} +4 -4
- package/dist/{migrate-BH6LCr00.mjs → migrate-BNAh6m_C.mjs} +2 -2
- package/dist/migrate-BflbbZQK.mjs +1 -0
- package/dist/nitro.mjs +2 -2
- package/dist/{node-B0otYjDv.mjs → node-CXFUw0Uz.mjs} +2 -2
- package/dist/{operator-args-DuKAQ3Ks.mjs → operator-args-DGTuCdSE.mjs} +8 -0
- package/dist/{operator-cmd-CoHlJjcT.mjs → operator-cmd-C-viB7Si.mjs} +4 -4
- package/dist/operator-cmd-D6qNuJ_z.mjs +1 -0
- package/dist/output-BsdnNpxa.mjs +1 -0
- package/dist/{output-CXJTIAtF.mjs → output-DNVILSz2.mjs} +1 -1
- package/dist/pages/client.d.mts +28 -3
- package/dist/pages/client.mjs +132 -15
- package/dist/pages/index.d.mts +3 -2
- package/dist/pages/index.mjs +2 -2
- 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/{platform-args-DfT8yQBF.mjs → platform-args-CiYeZmc5.mjs} +1 -1
- package/dist/platform-args-DJvF1-kl.mjs +1 -0
- package/dist/{platform-auth-config-MO0VdVs9.mjs → platform-auth-config-Dt2qEc2w.mjs} +6 -6
- package/dist/{platform-auth-protection-Dv208eyL.mjs → platform-auth-protection-B7TaF-PZ.mjs} +4 -4
- package/dist/{platform-auth-recovery-DvAQ674F.mjs → platform-auth-recovery-suXSteJ6.mjs} +4 -4
- package/dist/{platform-cmd-dlSxrcQ7.mjs → platform-cmd-9rvYBBtr.mjs} +7 -7
- package/dist/{platform-cmd-BpUA19r_.mjs → platform-cmd-DuAsIxbU.mjs} +1 -1
- package/dist/{platform-domain-DSO4eUEw.mjs → platform-domain-DhH_vDr6.mjs} +4 -4
- package/dist/{platform-lifecycle-CfcFygHb.mjs → platform-lifecycle-3uI-E2bF.mjs} +1 -1
- package/dist/{platform-lifecycle-BSvsyB_x.mjs → platform-lifecycle-CXmXe2xt.mjs} +13 -13
- package/dist/{platform-management-CrP1XhVd.mjs → platform-management-BBCHfwji.mjs} +3 -3
- package/dist/{platform-management-BMdyt667.mjs → platform-management-PdrgDQTe.mjs} +1 -1
- package/dist/{platform-plans-config-CgDiwflR.mjs → platform-plans-config-BGwkXYDM.mjs} +2 -2
- package/dist/{platform-recovery-CHWwXVZ6.mjs → platform-recovery-C8NxXGRR.mjs} +2 -2
- package/dist/{platform-setup-BTQVbnTC.mjs → platform-setup-Casiffqj.mjs} +2 -2
- package/dist/{plugin-inference-g66Q1Mx9.mjs → plugin-inference-CErfTgEx.mjs} +3 -3
- package/dist/{prepare-DXduEwQp.mjs → prepare-BDKWZgfL.mjs} +5 -5
- package/dist/{prepare-DJYHjpzq.mjs → prepare-BLrzXjIl.mjs} +3 -3
- package/dist/prepare-a1_5usAn.mjs +1 -0
- package/dist/{prerender-render-BN9Lmebs.mjs → prerender-render-BAdYhivW.mjs} +15 -2
- package/dist/prerender-render.d.mts +2 -0
- package/dist/prerender-render.mjs +1 -1
- package/dist/{project-cmd-Dfb1Sg8w.mjs → project-cmd-DzGvxXKH.mjs} +17 -17
- package/dist/{project-team-BO2dyc7S.mjs → project-team-C5XtHbZk.mjs} +4 -4
- package/dist/{project-token-ByO2mEI2.mjs → project-token-B4D5yhHQ.mjs} +4 -4
- package/dist/{project-zero-trust-CoQfwRBR.mjs → project-zero-trust--0LvktDg.mjs} +4 -4
- package/dist/{protocol-yxdHxFLN.mjs → protocol-B1Tvc9-x.mjs} +191 -69
- package/dist/{protocol-xZMvWsrg.d.mts → protocol-Cg2I81NA.d.mts} +9 -2
- package/dist/{provision-D5q-ptD3.mjs → provision-C3yiHdld.mjs} +1 -1
- package/dist/{provision-CMH4-8ri.mjs → provision-CAcrauvr.mjs} +1 -1
- package/dist/{requests-CPOiDkjh.mjs → requests-CrRiTgQA.mjs} +3 -3
- package/dist/resolve-project-C5wC-Hoi.mjs +1 -0
- package/dist/{resolve-project-ClvLMTI9.mjs → resolve-project-Da3OgCU1.mjs} +1 -1
- package/dist/{rollback-BfCs2la4.mjs → rollback-BsmQyj-Q.mjs} +4 -4
- package/dist/{route-types-Cl3x0Q8B.mjs → route-types-CgtlFCDz.mjs} +3 -2
- package/dist/routes-stub.d.mts +4 -3
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/client-react.d.mts +1 -1
- package/dist/runtime/client-solid.d.mts +1 -1
- package/dist/runtime/client-svelte.d.mts +1 -1
- package/dist/runtime/client-vue.d.mts +1 -1
- package/dist/runtime/client.d.mts +1 -1
- package/dist/runtime/db.d.mts +6 -3
- package/dist/runtime/db.mjs +2 -2
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/env-public.mjs +53 -39
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/routing.d.mts +8 -3
- package/dist/runtime/routing.mjs +161 -21
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +3 -3
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{scan-L8OSv1f7.mjs → scan-BJ3bj6aP.mjs} +228 -27
- package/dist/{secret-CuI6LTpD.mjs → secret-D0g5oBsP.mjs} +6 -6
- package/dist/{skills-BBO9wMjB.mjs → skills-CoBB9_Ao.mjs} +1 -1
- package/dist/{ast-bindings-BkivMJIo.mjs → static-exports-DFkzL-NX.mjs} +96 -33
- package/dist/{subcommand-prompt-BZMnCA8T.mjs → subcommand-prompt-0yIARXf2.mjs} +2 -2
- package/dist/{types-agfx0alu.d.mts → types-IPut3_Yx.d.mts} +15 -1
- package/dist/{wrapper-BGsi_uHs.mjs → wrapper-CVMZarxf.mjs} +1 -1
- package/dist/{ws-DB8Feytg.d.mts → ws--U7QicYy.d.mts} +2 -2
- package/docs/guide/ai.md +1 -0
- package/docs/guide/app-types.md +1 -0
- package/docs/guide/auth.md +1 -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 +1 -0
- package/docs/guide/deployment.md +1 -0
- package/docs/guide/durable-state.md +1 -0
- package/docs/guide/edge/headers.md +1 -0
- package/docs/guide/edge/prerendering.md +1 -0
- package/docs/guide/edge/redirects.md +1 -0
- package/docs/guide/edge/revalidation.md +3 -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 +1 -0
- package/docs/guide/pages-routing/actions-and-forms.md +36 -18
- package/docs/guide/pages-routing/errors.md +101 -0
- package/docs/guide/pages-routing/head.md +1 -0
- package/docs/guide/pages-routing/islands.md +1 -0
- package/docs/guide/pages-routing/layouts.md +3 -0
- package/docs/guide/pages-routing/loaders.md +1 -0
- package/docs/guide/pages-routing/markdown.md +1 -1
- package/docs/guide/pages-routing/overview.md +3 -0
- 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 +3 -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 +1 -0
- package/docs/guide/ssg.md +1 -0
- package/docs/guide/ssr.md +1 -0
- package/docs/guide/storage.md +1 -0
- package/docs/guide/testing.md +62 -0
- package/docs/guide/type-safety.md +1 -0
- package/docs/guide/typed-fetch.md +1 -0
- package/docs/guide/websockets.md +1 -0
- package/docs/index.md +1 -0
- package/docs/integrations/agents.md +1 -0
- package/docs/integrations/cloudflare.md +1 -0
- package/docs/integrations/frameworks/analog.md +1 -0
- package/docs/integrations/frameworks/astro.md +1 -0
- package/docs/integrations/frameworks/nuxt.md +1 -0
- package/docs/integrations/frameworks/overview.md +1 -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 +1 -0
- package/docs/reference/api/auth.md +1 -0
- package/docs/reference/api/client.md +1 -0
- 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 +1 -0
- package/docs/reference/api/pages.md +22 -4
- package/docs/reference/api/plugin.md +1 -0
- package/docs/reference/api/resources.md +1 -0
- package/docs/reference/api/rewrites.md +2 -1
- package/docs/reference/api/types.md +1 -0
- package/docs/reference/api.md +1 -0
- package/docs/reference/cli/auth.md +1 -0
- package/docs/reference/cli/database.md +1 -0
- package/docs/reference/cli/deploy.md +1 -0
- 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 +3 -0
- package/docs/reference/config.md +1 -0
- package/docs/reference/resource-inference.md +1 -0
- package/docs/reference/structure.md +1 -0
- package/package.json +25 -25
- package/skills/void/SKILL.md +2 -0
- package/dist/action-key-XtKKbbsi.mjs +0 -25
- package/dist/client-BAxLpSKv.mjs +0 -1
- package/dist/deploy-DEZkUS77.mjs +0 -2
- package/dist/gen-C6iknRdI.mjs +0 -1
- package/dist/help-C_cqTByy.mjs +0 -1
- package/dist/login-C4q1S-5b.mjs +0 -1
- package/dist/migrate-CVBsSFhC.mjs +0 -1
- package/dist/operator-cmd-DnaCnCSP.mjs +0 -1
- package/dist/output-CNsMDEd2.mjs +0 -1
- package/dist/platform-args-B7-wQ0_B.mjs +0 -1
- package/dist/prepare-Bx4a8cb1.mjs +0 -1
- package/dist/resolve-project-BALVa9q0.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 { 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-
|
|
5
|
-
import { l as inferBindingsFromSource, m as applyBindingOverrides, n as FRAMEWORK_SCAN_DIRS, t as DEFAULT_SCAN_DIRS, u as staticModuleReferences } from "./plugin-inference-
|
|
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-
|
|
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";
|
|
7
7
|
import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-CLwxcEdq.mjs";
|
|
8
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
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-
|
|
10
|
+
import { a as syncAuthTypesFile, i as removeAuthTypesIfPresent, n as generateQueueTypes, s as syncBindingTypes, t as generateRouteTypes } from "./route-types-CgtlFCDz.mjs";
|
|
11
11
|
import { c as getDatabaseCasing, l as getDatabaseDialect, p as readConfig, u as isNodeTarget } from "./config-5oSQhZNj.mjs";
|
|
12
12
|
import { n as writeLocalD1PersistState, t as resolveLocalD1Target } from "./local-d1-CFcH9Bx3.mjs";
|
|
13
13
|
import { i as voidWarn, n as voidError, r as voidLog, t as setShowTimestamp } from "./log-D9hwSySP.mjs";
|
|
@@ -17,27 +17,27 @@ import { n as scopedAccessCredentials } from "./cf-access-pejlJmuy.mjs";
|
|
|
17
17
|
import { n as readGeneratedWranglerConfigFile } from "./generated-wrangler-config-CoDaaFsA.mjs";
|
|
18
18
|
import { t as migrateBuiltWranglerConfig } from "./cf-config-migrate-Bb-EdAQq.mjs";
|
|
19
19
|
import { t as writeFileAtomic } from "./atomic-write-DA6eD1Kp.mjs";
|
|
20
|
-
import { a as findReservedEnvKeys, c as
|
|
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
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-
|
|
22
|
+
import { a as readDeployBuildQueueNames, r as cloudflareQueueName, s as drizzlePlugin, t as generateQueueResolverSource } from "./dispatch-CCiaAnSK.mjs";
|
|
23
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";
|
|
24
24
|
import { t as MagicString } from "./dist-B6eN80gc.mjs";
|
|
25
|
-
import {
|
|
25
|
+
import { s as bindingResolver } from "./static-exports-DFkzL-NX.mjs";
|
|
26
26
|
import { i as isMemberExpression, n as isIdentifier, r as isLiteral } from "./ast-Cv0JwXqb.mjs";
|
|
27
27
|
import { n as findEnvFileForPaths, r as generateEnvTypes, t as findEnvFile } from "./env-types-Dz9qkiOn.mjs";
|
|
28
28
|
import { i as writeFileIfChanged, r as syncAuthTypesInProjectTsconfig } from "./project-tsconfig-nhnTWO_Y.mjs";
|
|
29
29
|
import { t as loadUserEnvFile } from "./load-user-env-CSwdofj0.mjs";
|
|
30
30
|
import { n as scanWranglerDotenvKeys } from "./dotenv-CEI8hapP.mjs";
|
|
31
|
-
import {
|
|
31
|
+
import { _ as isRouteEnabledForEnvironment, a as createBoundaryManifest, c as resolveLayoutIds, h as invalidateSourceAnalysis, i as patternToRegex } from "./scan-BJ3bj6aP.mjs";
|
|
32
32
|
import { n as INTERNAL_BINDING_PREFIXES, t as INTERNAL_BINDING_EXACT_NAMES } from "./env-raw-e8qgqAzQ.mjs";
|
|
33
33
|
import { t as ASSET_EXTENSIONS } from "./routing-assets-DJIVOrCh.mjs";
|
|
34
34
|
import { i as loadVoidAuthConfig, n as devAuthConfigImporter, o as viteAuthConfigImporter, t as AUTH_CONFIG_ENVIRONMENT } from "./config-eeDzKBS9.mjs";
|
|
35
35
|
import { a as resolveDistDir, n as collectRevalidate, o as resolveWorkerDirName, r as hasRevalidate, t as collectPages } from "./isr-config-Czzb4mIq.mjs";
|
|
36
|
-
import { t as assertNoPrerenderFailures } from "./prerender-render-
|
|
37
|
-
import { f as prerenderPages, n as SEND_EMAIL_BINDING, p as prerenderPagesNode } from "./email-cloudflare-
|
|
38
|
-
import { i as safeJsonStringify } from "./protocol-
|
|
39
|
-
import { n as completeApplicationAnalysis } from "./application-routing-
|
|
40
|
-
import { a as validateSsrEntries, n as SSR_SERVER_ENTRY_RELATIVE_PATHS, o as validateSsrEntry, t as SSR_CLIENT_ENTRY_RELATIVE_PATHS } from "./entry-
|
|
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
41
|
import { r as selectNativeVersionMetadataBinding, t as CLOUDFLARE_PRESERVE_BINDINGS_BUILD_ENV } from "./version-metadata-eUd6Ar_U.mjs";
|
|
42
42
|
import { r as hasEmailHandlers } from "./email-BHY72ixO.mjs";
|
|
43
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";
|
|
@@ -495,11 +495,11 @@ function readVoidDevCredentials(root) {
|
|
|
495
495
|
* block the server. On completion, writes project.json and restarts the server.
|
|
496
496
|
*/
|
|
497
497
|
async function runAiSetupPrompt(root, token, apiUrl, server) {
|
|
498
|
-
const { select, text, isCancel, log } = await import("./dist-
|
|
499
|
-
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");
|
|
500
500
|
const { attachSelectedPlatform, writeProjectConfig } = await import("./project-DVsTAWFh.mjs");
|
|
501
|
-
const { inferDefaultSlug } = await import("./resolve-project-
|
|
502
|
-
const { printSuccess } = await import("./output-
|
|
501
|
+
const { inferDefaultSlug } = await import("./resolve-project-C5wC-Hoi.mjs");
|
|
502
|
+
const { printSuccess } = await import("./output-BsdnNpxa.mjs");
|
|
503
503
|
const client = new PlatformClient(token, { apiUrl });
|
|
504
504
|
let projects;
|
|
505
505
|
try {
|
|
@@ -526,7 +526,7 @@ async function runAiSetupPrompt(root, token, apiUrl, server) {
|
|
|
526
526
|
let slug;
|
|
527
527
|
if (result === "__create__") {
|
|
528
528
|
const { validateProjectSlug } = await import("./project-slug-BUy0lmyR.mjs");
|
|
529
|
-
const { createProjectWithSlugRetry } = await import("./create-project-
|
|
529
|
+
const { createProjectWithSlugRetry } = await import("./create-project-DzY05xqC.mjs");
|
|
530
530
|
let created;
|
|
531
531
|
try {
|
|
532
532
|
created = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => {
|
|
@@ -814,145 +814,23 @@ function withLocalPreviewBindings(plugins, root) {
|
|
|
814
814
|
}
|
|
815
815
|
}];
|
|
816
816
|
}
|
|
817
|
-
// src/plugin-cloudflare.ts
|
|
818
|
-
function isInside(directory, path) {
|
|
819
|
-
const child = relative(directory, path);
|
|
820
|
-
return child !== ".." && !child.startsWith("../") && !isAbsolute(child);
|
|
821
|
-
}
|
|
822
|
-
/** Keep Void's public configuration and artifact layout while running the v2 plugin. */
|
|
823
|
-
function cloudflare$1(options) {
|
|
824
|
-
const root = process.cwd();
|
|
825
|
-
let workerConfig;
|
|
826
|
-
let native;
|
|
827
|
-
let pluginNative;
|
|
828
|
-
const outputDirectories = /* @__PURE__ */ new Map();
|
|
829
|
-
const bridge = {
|
|
830
|
-
name: "void:cloudflare-config",
|
|
831
|
-
config(_userConfig, environment) {
|
|
832
|
-
if (environment.isPreview) return;
|
|
833
|
-
let base = options.configPath ? readGeneratedWranglerConfigFile(options.configPath) : {};
|
|
834
|
-
if (process.env.CLOUDFLARE_ENV && base.env) {
|
|
835
|
-
const selected = base.env[process.env.CLOUDFLARE_ENV];
|
|
836
|
-
if (!selected) throw new Error(`Cloudflare environment ${process.env.CLOUDFLARE_ENV} is not configured.`);
|
|
837
|
-
const original = base;
|
|
838
|
-
base = convertToWranglerConfig(toNativeCloudflareConfig(base, root));
|
|
839
|
-
base.main = selected.main ?? original.main;
|
|
840
|
-
base.migrations = selected.migrations ?? original.migrations;
|
|
841
|
-
base.assets = {
|
|
842
|
-
...base.assets,
|
|
843
|
-
directory: selected.assets?.directory ?? original.assets?.directory
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
workerConfig = mergeCloudflareConfig(options.config(base), base);
|
|
847
|
-
native = toNativeCloudflareConfig(workerConfig, root);
|
|
848
|
-
pluginNative = structuredClone(native);
|
|
849
|
-
if (environment.command === "build" && native.containers.length > 0) {
|
|
850
|
-
pluginNative.containers = [];
|
|
851
|
-
for (const declaration of Object.values(pluginNative.worker?.exports ?? {})) if ("container" in declaration) delete declaration.container;
|
|
852
|
-
} else if (environment.command === "serve") restoreLocalContainerBindings(pluginNative.worker);
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
const directories = {
|
|
856
|
-
name: "void:cloudflare-output-directories",
|
|
857
|
-
enforce: "post",
|
|
858
|
-
config(userConfig) {
|
|
859
|
-
const environmentNames = [options.viteEnvironment.name ?? "ssr", ...options.viteEnvironment.childEnvironments ?? []];
|
|
860
|
-
for (const name of [...environmentNames, "client"]) outputDirectories.set(name, resolve(root, userConfig.environments?.[name]?.build?.outDir ?? join(userConfig.build?.outDir ?? "dist", name)));
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
const output = {
|
|
864
|
-
name: "void:cloudflare-build-output",
|
|
865
|
-
enforce: "post",
|
|
866
|
-
writeBundle: {
|
|
867
|
-
order: "post",
|
|
868
|
-
handler() {
|
|
869
|
-
if (this.environment?.name !== "client") return;
|
|
870
|
-
const source = resolve(root, this.environment.config.build.outDir);
|
|
871
|
-
const destination = outputDirectories.get("client");
|
|
872
|
-
if (destination && source !== destination && existsSync(source)) {
|
|
873
|
-
mkdirSync(destination, { recursive: true });
|
|
874
|
-
cpSync(source, destination, { recursive: true });
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
buildApp: {
|
|
879
|
-
order: "post",
|
|
880
|
-
async handler(builder) {
|
|
881
|
-
if (Object.values(native.worker?.env ?? {}).some((binding) => binding.type === "assets")) mkdirSync(getWorkerAssetsDir(root), { recursive: true });
|
|
882
|
-
const worker = (await readBuildOutput(root)).workers.default;
|
|
883
|
-
const environment = options.viteEnvironment.name ?? "ssr";
|
|
884
|
-
const destination = outputDirectories.get(environment);
|
|
885
|
-
const client = outputDirectories.get("client");
|
|
886
|
-
if (!worker.bundleDir || !worker.config.manifest) throw new Error("Void requires a built Cloudflare Worker.");
|
|
887
|
-
for (const directory of [destination, client]) if (directory !== root && isInside(root, directory) && !isInside(directory, worker.bundleDir)) rmSync(directory, {
|
|
888
|
-
recursive: true,
|
|
889
|
-
force: true
|
|
890
|
-
});
|
|
891
|
-
mkdirSync(destination, { recursive: true });
|
|
892
|
-
cpSync(worker.bundleDir, destination, { recursive: true });
|
|
893
|
-
if (worker.assetsDir) {
|
|
894
|
-
mkdirSync(client, { recursive: true });
|
|
895
|
-
cpSync(worker.assetsDir, client, { recursive: true });
|
|
896
|
-
}
|
|
897
|
-
const config = {
|
|
898
|
-
...workerConfig,
|
|
899
|
-
name: worker.config.name,
|
|
900
|
-
account_id: native.accountId,
|
|
901
|
-
compatibility_date: worker.config.compatibilityDate,
|
|
902
|
-
compatibility_flags: worker.config.compatibilityFlags,
|
|
903
|
-
main: worker.config.manifest.mainModule,
|
|
904
|
-
no_bundle: true,
|
|
905
|
-
rules: [{
|
|
906
|
-
type: "ESModule",
|
|
907
|
-
globs: ["**/*.js", "**/*.mjs"]
|
|
908
|
-
}],
|
|
909
|
-
...process.env.CLOUDFLARE_ENV ? { targetEnvironment: process.env.CLOUDFLARE_ENV } : {},
|
|
910
|
-
...workerConfig.assets || worker.assetsDir ? { assets: {
|
|
911
|
-
...workerConfig.assets,
|
|
912
|
-
directory: relative(destination, client)
|
|
913
|
-
} } : {}
|
|
914
|
-
};
|
|
915
|
-
delete config.env;
|
|
916
|
-
writeFileAtomic(join(destination, "wrangler.json"), `${JSON.stringify(config, null, 2)}\n`);
|
|
917
|
-
if (options.finalizeAssets) {
|
|
918
|
-
options.finalizeAssets(client, builder.environments.client);
|
|
919
|
-
const finalized = JSON.parse(readFileSync(join(destination, "wrangler.json"), "utf8"));
|
|
920
|
-
if (worker.config.assets && finalized.assets) {
|
|
921
|
-
worker.config.assets.runWorkerFirst = finalized.assets.run_worker_first;
|
|
922
|
-
writeFileAtomic(worker.configPath, JSON.stringify(worker.config));
|
|
923
|
-
}
|
|
924
|
-
if (worker.assetsDir && existsSync(client)) cpSync(client, worker.assetsDir, { recursive: true });
|
|
925
|
-
}
|
|
926
|
-
if (native.containers.length > 0) writeFileAtomic(join(dirname(getRootConfigPath(root)), "void-containers.json"), JSON.stringify({ workerDirectory: relative(root, destination) }));
|
|
927
|
-
const pointer = join(root, ".wrangler/deploy/config.json");
|
|
928
|
-
const pointerDestination = existsSync(join(root, "void.config.ts")) && process.env["VOID_CLOUDFLARE_DEPLOY_BUILD"] !== "1" ? join(root, ".void/preview-deploy-config.json") : pointer;
|
|
929
|
-
mkdirSync(dirname(pointerDestination), { recursive: true });
|
|
930
|
-
writeFileAtomic(pointerDestination, JSON.stringify({ configPath: relative(dirname(pointer), join(destination, "wrangler.json")) }));
|
|
931
|
-
for (const name of options.viteEnvironment.childEnvironments ?? []) {
|
|
932
|
-
const source = builder.environments[name]?.config.build.outDir;
|
|
933
|
-
const target = outputDirectories.get(name);
|
|
934
|
-
if (source && target && existsSync(source)) cpSync(source, target, { recursive: true });
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
return [
|
|
940
|
-
bridge,
|
|
941
|
-
directories,
|
|
942
|
-
...withLocalPreviewBindings(cloudflare({
|
|
943
|
-
inspectorPort: options.inspectorPort,
|
|
944
|
-
persistState: options.persistState,
|
|
945
|
-
viteEnvironment: options.viteEnvironment,
|
|
946
|
-
auxiliaryWorkers: nativeAuxiliaryWorkers(options.auxiliaryWorkers, root),
|
|
947
|
-
types: { generate: false },
|
|
948
|
-
config() {
|
|
949
|
-
return pluginNative;
|
|
950
|
-
}
|
|
951
|
-
}), root),
|
|
952
|
-
output
|
|
953
|
-
];
|
|
954
|
-
}
|
|
955
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
|
+
}
|
|
956
834
|
/** Run `fn` shortly after Vite prints "ready" so dev messages stay visible. */
|
|
957
835
|
function afterServerReady(server, fn) {
|
|
958
836
|
if (server.httpServer) server.httpServer.once("listening", () => setTimeout(fn, 100));
|
|
@@ -1109,6 +987,157 @@ function warnIfPackageJsonIsNotEsm(root) {
|
|
|
1109
987
|
if (pkg.type === "module") return;
|
|
1110
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`.");
|
|
1111
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
|
+
}
|
|
1112
1141
|
// src/plugin-dev-triggers-hint.ts
|
|
1113
1142
|
/**
|
|
1114
1143
|
* Prints a one-shot hint on dev server start when the project has crons
|
|
@@ -1869,7 +1898,7 @@ function envSchemaPlugin(root, options = {}) {
|
|
|
1869
1898
|
async config(_config, environment) {
|
|
1870
1899
|
processEnvCopiesBefore = environment.command === "build" ? readProcessEnvCopies() : void 0;
|
|
1871
1900
|
const legacyFiles = findLegacyEnvFiles(root);
|
|
1872
|
-
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)}`);
|
|
1873
1902
|
const reservedInDotenv = findReservedEnvKeys(scanWranglerDotenvKeys(join(root, LOCAL_ENV_FILE)));
|
|
1874
1903
|
if (reservedInDotenv.length > 0) throw new Error(reservedEnvKeysMessage(".env", reservedInDotenv));
|
|
1875
1904
|
envFile = findEnvFile(root);
|
|
@@ -2464,7 +2493,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2464
2493
|
const managedDispatch = options.nodeTarget !== true && options.dev !== true && options.managedDispatch === true;
|
|
2465
2494
|
lines.push(`import { AsyncLocalStorage } from "node:async_hooks";`);
|
|
2466
2495
|
lines.push(`import { Hono } from ${JSON.stringify(options.honoPath)};`);
|
|
2467
|
-
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, buildPrerenderPath as __buildPrerenderPath } 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)};`);
|
|
2468
2497
|
if (options.nodeTarget) lines.push(`const withRuntimeEnv = (_env, fn) => fn();`);
|
|
2469
2498
|
else lines.push(`import { withRuntimeEnv } from ${JSON.stringify(options.runtimeEnvPath)};`);
|
|
2470
2499
|
if (auth) {
|
|
@@ -2499,7 +2528,7 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2499
2528
|
lines.push(`const app = new Hono();`);
|
|
2500
2529
|
const routePatterns = [];
|
|
2501
2530
|
for (const r of scan.routes) routePatterns.push(r.pattern);
|
|
2502
|
-
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);
|
|
2503
2532
|
const usedExts = /* @__PURE__ */ new Set();
|
|
2504
2533
|
for (const p of routePatterns) {
|
|
2505
2534
|
const m = /\.([A-Za-z0-9]+)$/.exec(p);
|
|
@@ -2598,12 +2627,19 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2598
2627
|
lines.push("");
|
|
2599
2628
|
}
|
|
2600
2629
|
const pageNames = createIdentifierNames();
|
|
2601
|
-
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 }); }");
|
|
2602
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}])));`);
|
|
2603
2633
|
if (webSockets.length > 0) lines.push("");
|
|
2604
|
-
|
|
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))) {
|
|
2605
2641
|
const pagePatterns = options.trailingSlash ? `[${scan.pages.pages.map((page) => patternToRegex(page.pattern)).join(", ")}]` : "undefined";
|
|
2606
|
-
|
|
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} })`);
|
|
2607
2643
|
}
|
|
2608
2644
|
compilePrerenderCollector(lines, scan, ssr, options, pageNames, pages?.pagesDirRelative);
|
|
2609
2645
|
if (ssr) {
|
|
@@ -2614,8 +2650,8 @@ function compileRouteTable(scan, routesDir, middlewareDir, jobsDir, queuesDir, s
|
|
|
2614
2650
|
dev: options.dev === true,
|
|
2615
2651
|
reactRefresh: options.reactRefresh
|
|
2616
2652
|
})});`);
|
|
2617
|
-
|
|
2618
|
-
} 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} })`);
|
|
2619
2655
|
if (scan.jobs.length > 0) {
|
|
2620
2656
|
for (let i = 0; i < scan.jobs.length; i++) {
|
|
2621
2657
|
const job = scan.jobs[i];
|
|
@@ -2918,6 +2954,7 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2918
2954
|
const relPagesDir = pages.pagesDirRelative;
|
|
2919
2955
|
const pageCssKeys = {};
|
|
2920
2956
|
const pageDevRootPhases = {};
|
|
2957
|
+
const boundaryManifest = createBoundaryManifest(scan.pages);
|
|
2921
2958
|
const projectRoot = options.projectRoot;
|
|
2922
2959
|
const toDevRootUrl = (absolutePath) => "/" + absolutePath.replaceAll("\\", "/").slice(projectRoot.replaceAll("\\", "/").length + 1);
|
|
2923
2960
|
const virtualDevUrl = (id) => "/@id/__x00__" + id;
|
|
@@ -2948,6 +2985,16 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2948
2985
|
pageCssKeys[page.componentId] = keys;
|
|
2949
2986
|
pageDevRootPhases[page.componentId] = routeRootPhases.filter((phase) => phase.length > 0);
|
|
2950
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
|
+
}
|
|
2951
2998
|
lines.push("const __loadPagesManifest = __createManifestLoader();");
|
|
2952
2999
|
const assetMetadata = {
|
|
2953
3000
|
pageCssKeys,
|
|
@@ -2969,6 +3016,17 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2969
3016
|
extraEntryUrl: pages.mdClientEntryId ? "/@id/__x00__" + pages.mdClientEntryId : void 0,
|
|
2970
3017
|
kind: "islands"
|
|
2971
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
|
+
}
|
|
2972
3030
|
const seenServerFiles = /* @__PURE__ */ new Set();
|
|
2973
3031
|
for (const page of scan.pages.pages) {
|
|
2974
3032
|
const safeId = pageNames(page.componentId);
|
|
@@ -2998,7 +3056,8 @@ function compilePageRoutes(lines, scan, pages, options, pageNames) {
|
|
|
2998
3056
|
const catchAllParam = page.pattern.match(/:([^/{}]+)\{\.\+\}\/$/)?.[1];
|
|
2999
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({
|
|
3000
3058
|
renderMode: page.renderMode,
|
|
3001
|
-
...options.dev === true ? { dev: true } : {}
|
|
3059
|
+
...options.dev === true ? { dev: true } : {},
|
|
3060
|
+
...boundaryManifest.pages[page.componentId] && { boundaries: boundaryManifest.pages[page.componentId] }
|
|
3002
3061
|
})} }`;
|
|
3003
3062
|
lines.push(`app.get(${JSON.stringify(pattern)}, __createPageGetHandler(${routeOptions}));`);
|
|
3004
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"))} }));`);
|
|
@@ -3064,6 +3123,7 @@ const __filterInternalBindings = (env) => __filterBindings(env, ${JSON.stringify
|
|
|
3064
3123
|
const isrDeploymentStamp = isr ? ` env.__VOID_ISR_DEPLOYMENT_ID ??= __VOID_ISR_DEPLOYMENT_ID;\n` : "";
|
|
3065
3124
|
const fetchHandler = `__createWorkerFetch({
|
|
3066
3125
|
app, assets: serveWithAssets, withRawEnv: __withRawEnv, withRuntimeEnv,
|
|
3126
|
+
staticNotFound: __voidRenderStaticNotFound,
|
|
3067
3127
|
filterBindings: __filterInternalBindings,
|
|
3068
3128
|
internalRoute: __voidHandleInternalRoute,
|
|
3069
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) }" : ""}
|
|
@@ -3142,7 +3202,7 @@ ${envValidateCall}${remoteEnvSwap}${isrDeploymentStamp} const userEnv = __filte
|
|
|
3142
3202
|
}
|
|
3143
3203
|
|
|
3144
3204
|
` : "";
|
|
3145
|
-
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';
|
|
3146
3206
|
${durableObjectImports}\n${runtimeEnvImport}${emailProxyImport}${envSchemaImport}${remoteImport}${isrImport}${filterBindingsHelper}${assetHelper}
|
|
3147
3207
|
${fetchDeclaration}
|
|
3148
3208
|
${scheduledHandler}
|
|
@@ -3161,11 +3221,11 @@ ${entryClass}`;
|
|
|
3161
3221
|
function compileNodeApp(target, honoPath, envSchemaModule) {
|
|
3162
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";`;
|
|
3163
3223
|
const envSchemaImport = envSchemaModule ? `import ${JSON.stringify(envSchemaModule.importPath)};\nimport { _validateEnvOnce } from ${JSON.stringify(envSchemaModule.helperPath)};\n` : "";
|
|
3164
|
-
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` : "";
|
|
3165
3225
|
return `${staticImport}
|
|
3166
3226
|
import { fileURLToPath } from "node:url";
|
|
3167
3227
|
import { Hono } from ${JSON.stringify(honoPath)};
|
|
3168
|
-
import innerApp, { __voidCollectPrerenderPaths } from "virtual:void-routes";
|
|
3228
|
+
import innerApp, { __voidCollectPrerenderPaths, __voidRenderStaticNotFound } from "virtual:void-routes";
|
|
3169
3229
|
import { prerenderPathsResponse as __prerenderPathsResponse } from ${JSON.stringify(ROUTING_RUNTIME_PATH)};
|
|
3170
3230
|
${envSchemaImport}
|
|
3171
3231
|
// dist/client, created on first use so a server that supplies its own ASSETS
|
|
@@ -3193,6 +3253,7 @@ ${envMiddleware}app.post("/__void/prerender-paths", async (c) => {
|
|
|
3193
3253
|
if (c.env?.__VOID_PRERENDER !== "1") return c.notFound();
|
|
3194
3254
|
return __prerenderPathsResponse(() => __voidCollectPrerenderPaths(c.req.raw));
|
|
3195
3255
|
});
|
|
3256
|
+
app.get("/__void/static-not-found", (c) => c.env?.__VOID_PRERENDER === "1" ? __voidRenderStaticNotFound(c.req.raw, { ...c.env, ASSETS: assetsFor(c) }) : c.notFound());
|
|
3196
3257
|
app.get("/assets/*", (c) => assetsFor(c).fetch(c.req.raw));
|
|
3197
3258
|
app.all("*", (c) => innerApp.fetch(c.req.raw, { ...c.env, ASSETS: assetsFor(c) }));
|
|
3198
3259
|
export default app;`;
|
|
@@ -3583,14 +3644,14 @@ function readAuthDatabaseUrl(root) {
|
|
|
3583
3644
|
function migrationPlugin(root, dialect, databaseId = "local", persistRoot = join(root, ".void"), auth) {
|
|
3584
3645
|
return {
|
|
3585
3646
|
name: "void:migrations",
|
|
3586
|
-
apply: "serve",
|
|
3647
|
+
apply: (config, { command }) => command === "serve" && !isVitestServer(config),
|
|
3587
3648
|
async configureServer(server) {
|
|
3588
3649
|
const paths = readProjectPaths(root);
|
|
3589
3650
|
const migrationsDir = paths.migrationsDir;
|
|
3590
3651
|
const hasSqlMigrations = existsSync(migrationsDir);
|
|
3591
3652
|
if (!hasSqlMigrations && !auth?.enabled) return;
|
|
3592
3653
|
const migrateAuth = async (databaseUrl) => {
|
|
3593
|
-
const { runLocalVoidAuthMigrations } = await import("./node-
|
|
3654
|
+
const { runLocalVoidAuthMigrations } = await import("./node-CXFUw0Uz.mjs");
|
|
3594
3655
|
await runLocalVoidAuthMigrations(root, dialect, persistRoot, databaseId, auth?.configPath, databaseUrl, devAuthConfigImporter(server));
|
|
3595
3656
|
};
|
|
3596
3657
|
const mysqlAuth = dialect === "mysql" && auth?.enabled === true;
|
|
@@ -4069,7 +4130,7 @@ const CF_ONLY_REGEX = new RegExp(`^(${[
|
|
|
4069
4130
|
* Bridge Node.js HTTP to Web API and serve via a Hono app.
|
|
4070
4131
|
* Used by both dev server and preview server middleware.
|
|
4071
4132
|
*/
|
|
4072
|
-
function honoMiddleware(getApp) {
|
|
4133
|
+
function honoMiddleware(getApp, isViteFile) {
|
|
4073
4134
|
return async (req, res, next) => {
|
|
4074
4135
|
try {
|
|
4075
4136
|
if (!req.url || req.url.startsWith("/@") || req.url.startsWith("/__") || req.url.startsWith("/node_modules/")) {
|
|
@@ -4092,7 +4153,7 @@ function honoMiddleware(getApp) {
|
|
|
4092
4153
|
duplex: hasBody ? "half" : void 0
|
|
4093
4154
|
});
|
|
4094
4155
|
const response = await app.fetch(request);
|
|
4095
|
-
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"))) {
|
|
4096
4157
|
next();
|
|
4097
4158
|
return;
|
|
4098
4159
|
}
|
|
@@ -4211,8 +4272,15 @@ function nodeTargetPlugin(target, options = {}) {
|
|
|
4211
4272
|
} };
|
|
4212
4273
|
server.middlewares.use(honoMiddleware(async () => {
|
|
4213
4274
|
const mod = await server.ssrLoadModule("virtual:void-routes");
|
|
4214
|
-
if (!options.trailingSlash) return mod.default;
|
|
4215
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
|
+
}
|
|
4216
4284
|
}));
|
|
4217
4285
|
},
|
|
4218
4286
|
configurePreviewServer(server) {
|
|
@@ -4716,7 +4784,7 @@ function routingPlugin(root, options) {
|
|
|
4716
4784
|
if (removeAuthTypesIfPresent(outDir)) syncAuthTypesInProjectTsconfig(root);
|
|
4717
4785
|
return;
|
|
4718
4786
|
}
|
|
4719
|
-
const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-
|
|
4787
|
+
const { generateVoidAuthDatabaseModule, generateVoidAuthDrizzleSchema } = await import("./drizzle-D4V_06-B.mjs");
|
|
4720
4788
|
const authRuntime = {
|
|
4721
4789
|
dialect: compileOptions.auth.dialect,
|
|
4722
4790
|
providers: compileOptions.auth.providers,
|
|
@@ -4731,7 +4799,8 @@ function routingPlugin(root, options) {
|
|
|
4731
4799
|
writeFileIfChanged(authDatabasePath, generateVoidAuthDatabaseModule({
|
|
4732
4800
|
dialect: compileOptions.auth.dialect,
|
|
4733
4801
|
schemaImportPath: authSchemaPath,
|
|
4734
|
-
drizzleAdapterPath
|
|
4802
|
+
drizzleAdapterPath,
|
|
4803
|
+
d1BindingName: options.bindingNames?.d1
|
|
4735
4804
|
}));
|
|
4736
4805
|
syncAuthTypesFile(compileOptions.auth.authConfigPath, outDir);
|
|
4737
4806
|
syncAuthTypesInProjectTsconfig(root);
|
|
@@ -4764,7 +4833,7 @@ function routingPlugin(root, options) {
|
|
|
4764
4833
|
return envFilePaths.has(normalizePath(path));
|
|
4765
4834
|
}
|
|
4766
4835
|
function getPagesCompileOptions() {
|
|
4767
|
-
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;
|
|
4768
4837
|
const hasIslandPages = scan.pages.pages.some((p) => p.island);
|
|
4769
4838
|
const mdPlugin = resolvedConfig?.plugins?.find((p) => p.name === "void-md");
|
|
4770
4839
|
const mdClientEntryId = hasIslandPages && mdPlugin?.api?.clientEntryId ? mdPlugin.api.clientEntryId : void 0;
|
|
@@ -4781,7 +4850,7 @@ function routingPlugin(root, options) {
|
|
|
4781
4850
|
const { pages, routes, websockets = [], middleware } = scan;
|
|
4782
4851
|
return resolveAssetRoutingPolicy({
|
|
4783
4852
|
isSsr: Boolean(ssr),
|
|
4784
|
-
hasPages: pages.pages.length > 0,
|
|
4853
|
+
hasPages: pages.pages.length > 0 || !!pages.boundaries?.some((boundary) => boundary.kind === "not-found" && !boundary.directory),
|
|
4785
4854
|
hasApiRoutes: hasApiRoutes(routes) || hasApiRoutes(websockets) || compileOptions.auth !== null,
|
|
4786
4855
|
hasDocumentRoutes: hasDocumentRoutes(routes),
|
|
4787
4856
|
hasMiddleware: middleware.length > 0,
|
|
@@ -5687,7 +5756,7 @@ function voidPlugin(options) {
|
|
|
5687
5756
|
voidWarn("AI requires authentication. Run `void account login`, then restart the dev server.");
|
|
5688
5757
|
});
|
|
5689
5758
|
else if (credentials.status === "no-project") {
|
|
5690
|
-
if (process.stdin.isTTY) afterServerReady(server, () => {
|
|
5759
|
+
if (process.stdin.isTTY && !isVitestServer(server.config)) afterServerReady(server, () => {
|
|
5691
5760
|
console.log();
|
|
5692
5761
|
runAiSetupPrompt(root, credentials.token, credentials.apiUrl, server);
|
|
5693
5762
|
});
|