void 0.20.3 → 0.21.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 +2 -2
- package/dist/agents-gni4eqBu.mjs +111 -0
- package/dist/auth-3sGB0zJ1.mjs +22 -0
- package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
- package/dist/auth-CAw7zHqj.mjs +2 -0
- package/dist/auth-client-BWBT8HLp.mjs +6 -0
- package/dist/auth-client-Bawdj38n.d.mts +7 -0
- package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
- package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
- package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
- package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
- package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
- package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
- package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
- package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
- package/dist/{auth-cmd-CzwquNiP.mjs → auth-cmd-MkBG2u1f.mjs} +5 -5
- package/dist/{auth-link-ElDTgF7j.mjs → auth-link-Devmv96E.mjs} +5 -5
- package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
- package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
- package/dist/{build-cmd-BpJe6boP.mjs → build-cmd-DsBGwtfs.mjs} +6 -4
- package/dist/{cache-D98YTqeE.mjs → cache-BMw8eMyF.mjs} +6 -4
- package/dist/{cancel-deploy-CPbEQLMG.mjs → cancel-deploy-B3_s9NIN.mjs} +5 -3
- package/dist/cf-access-rAZxzMkL.mjs +181 -0
- package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
- package/dist/cli/cf-compat.d.mts +1 -0
- package/dist/cli/cf-compat.mjs +934 -0
- package/dist/cli/cli.mjs +60 -38
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DAAivdid.mjs +2 -0
- package/dist/{client-BQBrZoCX.mjs → client-PdAJ-F0t.mjs} +6 -12
- package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
- package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
- package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
- package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
- package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
- package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
- package/dist/collect-DAUItMDS.mjs +2 -0
- package/dist/collect-DXHNWHcT.mjs +48 -0
- package/dist/config--T87TD8T.mjs +2 -0
- package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
- package/dist/config-DDIFxQYx.mjs +2 -0
- package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
- package/dist/config-DywxBLQC.d.mts +185 -0
- package/dist/config-entry.d.mts +6 -0
- package/dist/config-entry.mjs +7 -0
- package/dist/config-uP7ZDtVZ.mjs +21 -0
- package/dist/config-write-y3CBI_ux.mjs +60 -0
- package/dist/{connect-WCQZ_u3m.mjs → connect-BvC9kolB.mjs} +8 -6
- package/dist/{create-project-D0oXA090.mjs → create-project-C9lQhRzj.mjs} +8 -23
- package/dist/create-project-CI-17RVJ.mjs +2 -0
- package/dist/database-provider-Cx525bwX.mjs +6 -0
- package/dist/database-provider.mjs +1 -5
- package/dist/{db-DJ-9qs3S.mjs → db-R7IQgOv5.mjs} +48 -44
- package/dist/{delete-BZ4-WaGm.mjs → delete-CghI_NXn.mjs} +6 -4
- package/dist/deploy-CYPymbtG.mjs +2 -0
- package/dist/{deploy-BAhhcg5q.mjs → deploy-H968Lo4T.mjs} +751 -190
- package/dist/discover-BBzDZe_o.mjs +2 -0
- package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
- package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
- package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
- package/dist/dist-C5fND3R0.mjs +2 -0
- package/dist/dist-D7-nEOXi.mjs +2 -0
- package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
- package/dist/{domain-BxAyhxXN.mjs → domain-CITt8lC-.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{email-Bj7Cvdwp.mjs → email-_8VmyX7V.mjs} +14 -12
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DP_EErve.mjs → env-DV4r3nHz.mjs} +9 -7
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/env-Yz4HcvHs.mjs +78 -0
- package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
- package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
- package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
- package/dist/env-validation-DIDGM7h4.mjs +2 -0
- package/dist/fetch-CXDChK7B.mjs +18 -0
- package/dist/fetch-_SeGZao9.d.mts +57 -0
- package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
- package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
- package/dist/gen-BBiIZw6g.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-CFOEEc-t.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-C-z_xRrQ.mjs → github-cmd-jYjha2LO.mjs} +6 -4
- package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
- package/dist/handler-DghKr6dU.mjs +150 -0
- package/dist/head-D_QRR5Yd.mjs +112 -0
- package/dist/head-client-DzmJGN4C.mjs +90 -0
- package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
- package/dist/{help-CwOX-zmI.mjs → help-C46mnlUS.mjs} +17 -12
- package/dist/help-CS_nAsWu.mjs +2 -0
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BGktCXgA.mjs → init-CSXmvxKu.mjs} +49 -50
- package/dist/{link-D2kbqhWb.mjs → link-DxMOALXk.mjs} +7 -5
- package/dist/{list-CvkK_G7k.mjs → list-0wQs0oYg.mjs} +7 -5
- package/dist/live-CB1y5IuC.mjs +411 -0
- package/dist/live-CKiJilLr.d.mts +105 -0
- package/dist/local-d1-DzykTWY8.mjs +104 -0
- package/dist/{login-WIjNc77c.mjs → login-CKk5NX4d.mjs} +6 -11
- package/dist/login-Ch9cgWRF.mjs +2 -0
- package/dist/{logs-dLUFCapG.mjs → logs-hxWBSoej.mjs} +6 -4
- package/dist/migrate-CLty4mZR.mjs +2 -0
- package/dist/migrate-DcW8F2W8.mjs +285 -0
- package/dist/migration-handler-DM4clYj5.d.mts +51 -0
- package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
- package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
- package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
- package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
- package/dist/{operator-cmd-CKJ7xIRs.mjs → operator-cmd-BEUYhaHB.mjs} +6 -6
- package/dist/output-urU86XeT.mjs +146 -0
- package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
- package/dist/pages/client.d.mts +5 -2
- package/dist/pages/client.mjs +5 -3
- package/dist/pages/head-client.mjs +1 -89
- package/dist/pages/head.mjs +1 -111
- package/dist/pages/index.d.mts +2 -3
- package/dist/pages/index.mjs +7 -7
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/prefetch.d.mts +2 -30
- package/dist/pages/prefetch.mjs +1 -89
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -9
- package/dist/pages/serialize.mjs +1 -13
- package/dist/plan-BEZ8VJW0.mjs +256 -0
- package/dist/plan-DpuOr14e.mjs +2 -0
- package/dist/{platform-auth-config-CdVWRRJr.mjs → platform-auth-config-Df6yVw-e.mjs} +6 -6
- package/dist/{platform-auth-protection-Drl0qhrn.mjs → platform-auth-protection-Jb0yftay.mjs} +7 -5
- package/dist/{platform-auth-recovery-CmKEWpDo.mjs → platform-auth-recovery-DmRyIfW0.mjs} +6 -5
- package/dist/platform-cmd-C9Vt7m-d.mjs +2 -0
- package/dist/{platform-cmd-5q_k56xS.mjs → platform-cmd-DRxCOTwy.mjs} +8 -5
- package/dist/{platform-domain-4GiDlcqx.mjs → platform-domain-IjiXgrXJ.mjs} +4 -3
- package/dist/{platform-lifecycle-R9xAxvtG.mjs → platform-lifecycle-BquAaU-5.mjs} +208 -37
- package/dist/platform-lifecycle-CuJIZNvA.mjs +2 -0
- package/dist/{platform-management-BfWsXHEW.mjs → platform-management-CCQKGsq4.mjs} +8 -5
- package/dist/platform-management-Cgyed0WY.mjs +2 -0
- package/dist/{platform-recovery-CbK-I1FB.mjs → platform-recovery-DS8ih1SW.mjs} +3 -3
- package/dist/platform-registry-BJbgZLS1.mjs +431 -0
- package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
- package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
- package/dist/prefetch-Ce6la4EI.d.mts +31 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-CaUxODOU.mjs} +3 -2
- package/dist/prepare-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
- package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
- package/dist/prerender-render.mjs +1 -110
- package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
- package/dist/project-BEBFDFLz.mjs +2 -0
- package/dist/project-CWNIPoXc.mjs +209 -0
- package/dist/{project-cmd-CTdmnzvc.mjs → project-cmd-2lN--YAX.mjs} +18 -16
- package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
- package/dist/project-slug-23TpquG4.mjs +8 -0
- package/dist/project-slug-DofjTFd-.mjs +2 -0
- package/dist/{project-team-CGxsQe3_.mjs → project-team-Dapn9HZn.mjs} +6 -4
- package/dist/{project-token-Cirx7uwZ.mjs → project-token-C90v9SJK.mjs} +6 -4
- package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
- package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
- package/dist/providers-BNKRacMr.d.mts +7 -0
- package/dist/provision-CNgEBkVA.mjs +3 -0
- package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
- package/dist/queues-BWKt1Xo4.d.mts +7 -0
- package/dist/{requests-4Nq59hOr.mjs → requests-CzX46I0i.mjs} +5 -3
- package/dist/resolve-project-BTotl8Nn.mjs +2 -0
- package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
- package/dist/response-Tn7rU0MV.mjs +30 -0
- package/dist/{rollback-Dr7u0Ljx.mjs → rollback-BEeyc73H.mjs} +6 -4
- package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
- package/dist/route-types-Id82-veQ.mjs +280 -0
- package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
- package/dist/runner-CQs_cDSG.mjs +2 -0
- package/dist/runner-mysql-1o47achK.mjs +2 -0
- package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
- package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
- package/dist/runner-pg-D7z01mQS.mjs +2 -0
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth-client-react.d.mts +2 -6
- package/dist/runtime/auth-client-react.mjs +1 -5
- package/dist/runtime/auth-client-solid.d.mts +2 -6
- package/dist/runtime/auth-client-solid.mjs +1 -5
- package/dist/runtime/auth-client-svelte.d.mts +2 -6
- package/dist/runtime/auth-client-svelte.mjs +1 -5
- package/dist/runtime/auth-client-vue.d.mts +2 -6
- package/dist/runtime/auth-client-vue.mjs +1 -5
- package/dist/runtime/auth-client.d.mts +2 -6
- package/dist/runtime/auth-client.mjs +1 -5
- package/dist/runtime/auth.mjs +1 -21
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +3 -3
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +3 -3
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +3 -3
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +3 -3
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +3 -3
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-helpers.mjs +1 -135
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -77
- package/dist/runtime/fetch-stream.d.mts +2 -49
- package/dist/runtime/fetch-stream.mjs +2 -80
- package/dist/runtime/fetch.d.mts +2 -57
- package/dist/runtime/fetch.mjs +2 -17
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -149
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +2 -2
- package/dist/runtime/live.d.mts +2 -104
- package/dist/runtime/live.mjs +1 -410
- package/dist/runtime/migration-handler-mysql.d.mts +1 -1
- package/dist/runtime/migration-handler-pg.d.mts +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -50
- package/dist/runtime/queues.d.mts +2 -6
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/response.mjs +1 -29
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/sse.mjs +1 -171
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -71
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -2
- package/dist/runtime/ws.d.mts +2 -121
- package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
- package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
- package/dist/{secret-AcPi-FoA.mjs → secret-wnTel5Yw.mjs} +8 -6
- package/dist/serialize-BPvnNQuA.mjs +14 -0
- package/dist/serialize-CfSwWfF2.d.mts +10 -0
- package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
- package/dist/sse-BaC1jXko.mjs +172 -0
- package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-Gj3VzLIh.mjs} +2 -1
- package/dist/sveltekit.d.mts +2 -1
- package/dist/sveltekit.mjs +3 -2
- package/dist/validate-DqJ33oHj.mjs +2 -0
- package/dist/validate-qNhV00PD.mjs +180 -0
- package/dist/validator-BTOu0fB0.mjs +72 -0
- package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
- package/dist/ws-BwcqizuH.d.mts +122 -0
- package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
- package/package.json +19 -8
- package/skills/void/SKILL.md +6 -4
- package/skills/void/docs/guide/ai.md +3 -3
- package/skills/void/docs/guide/app-types.md +12 -11
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +1 -1
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +3 -3
- package/skills/void/docs/guide/deployment.md +2 -2
- package/skills/void/docs/guide/durable-state.md +2 -2
- package/skills/void/docs/guide/edge/headers.md +3 -3
- package/skills/void/docs/guide/edge/prerendering.md +1 -1
- package/skills/void/docs/guide/edge/redirects.md +4 -4
- package/skills/void/docs/guide/edge/revalidation.md +6 -6
- package/skills/void/docs/guide/edge/rewrites.md +28 -27
- package/skills/void/docs/guide/edge/static-assets.md +1 -1
- package/skills/void/docs/guide/email.md +15 -15
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +1 -1
- package/skills/void/docs/guide/pages-routing/head.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +13 -5
- package/skills/void/docs/guide/platform/administration/projects.md +3 -1
- package/skills/void/docs/guide/platform/installation/ci.md +3 -0
- package/skills/void/docs/guide/platform/installation/credentials.md +15 -5
- package/skills/void/docs/guide/platform/installation/prerequisites.md +2 -0
- package/skills/void/docs/guide/platform/installation/setup.md +1 -1
- package/skills/void/docs/guide/remote-dev.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +1 -1
- package/skills/void/docs/guide/ssg.md +1 -1
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +86 -84
- package/skills/void/docs/integrations/frameworks/analog.md +14 -9
- package/skills/void/docs/integrations/frameworks/astro.md +14 -10
- package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
- package/skills/void/docs/integrations/frameworks/overview.md +35 -29
- package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
- package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
- package/skills/void/docs/reference/api.md +21 -4
- package/skills/void/docs/reference/cli.md +32 -23
- package/skills/void/docs/reference/config.md +56 -33
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { a as join, n as dirname } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
//#region src/prerender-render.ts
|
|
4
|
+
function outputFileForPath(path) {
|
|
5
|
+
return path === "/" ? "index.html" : `${path.slice(1)}.html`;
|
|
6
|
+
}
|
|
7
|
+
function pageDataFileForPath(path) {
|
|
8
|
+
return path === "/" ? "_void/pages/index.json" : `_void/pages/${path.slice(1)}.json`;
|
|
9
|
+
}
|
|
10
|
+
function normalizedFile(clientDir, path) {
|
|
11
|
+
return join(clientDir, path).normalize("NFC").toLowerCase();
|
|
12
|
+
}
|
|
13
|
+
function generatedFiles(path, clientDir) {
|
|
14
|
+
return [outputFileForPath(path), pageDataFileForPath(path)].map((file) => normalizedFile(clientDir, file));
|
|
15
|
+
}
|
|
16
|
+
function requestAssetCandidates(path, clientDir) {
|
|
17
|
+
const relativePath = path === "/" ? "" : path.slice(1);
|
|
18
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
19
|
+
const addCandidates = (candidate) => {
|
|
20
|
+
candidates.add(candidate);
|
|
21
|
+
if (candidate === "" || candidate.endsWith("/")) candidates.add(`${candidate}index.html`);
|
|
22
|
+
else if (!candidate.split("/").at(-1)?.includes(".")) {
|
|
23
|
+
candidates.add(`${candidate}.html`);
|
|
24
|
+
candidates.add(`${candidate}/index.html`);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
addCandidates(relativePath);
|
|
28
|
+
try {
|
|
29
|
+
addCandidates(decodeURI(relativePath));
|
|
30
|
+
} catch {}
|
|
31
|
+
try {
|
|
32
|
+
addCandidates(decodeURIComponent(relativePath));
|
|
33
|
+
} catch {}
|
|
34
|
+
return new Set([...candidates].map((file) => normalizedFile(clientDir, file)));
|
|
35
|
+
}
|
|
36
|
+
function renderConcurrency(paths, clientDir) {
|
|
37
|
+
const outputs = paths.map((path) => generatedFiles(path, clientDir));
|
|
38
|
+
const ownerByOutput = /* @__PURE__ */ new Map();
|
|
39
|
+
for (let index = 0; index < outputs.length; index++) for (const output of outputs[index]) {
|
|
40
|
+
if (ownerByOutput.has(output)) return 1;
|
|
41
|
+
ownerByOutput.set(output, index);
|
|
42
|
+
}
|
|
43
|
+
for (const file of ownerByOutput.keys()) {
|
|
44
|
+
let parent = dirname(file);
|
|
45
|
+
while (parent !== dirname(parent)) {
|
|
46
|
+
if (ownerByOutput.has(parent)) return 1;
|
|
47
|
+
parent = dirname(parent);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (let index = 0; index < paths.length; index++) for (const candidate of requestAssetCandidates(paths[index], clientDir)) {
|
|
51
|
+
const owner = ownerByOutput.get(candidate);
|
|
52
|
+
if (owner !== void 0 && owner !== index) return 1;
|
|
53
|
+
}
|
|
54
|
+
return 4;
|
|
55
|
+
}
|
|
56
|
+
/** Shared renderer for local Workers and the isolated Node prerender child. */
|
|
57
|
+
async function renderPrerenderPaths(paths, clientDir, fetchPath, fetchPageData, onResult) {
|
|
58
|
+
const results = paths.map(() => ({
|
|
59
|
+
rendered: [],
|
|
60
|
+
failed: []
|
|
61
|
+
}));
|
|
62
|
+
let next = 0;
|
|
63
|
+
await Promise.all(Array.from({ length: Math.min(paths.length, renderConcurrency(paths, clientDir)) }, async () => {
|
|
64
|
+
while (next < paths.length) {
|
|
65
|
+
const index = next++;
|
|
66
|
+
const path = paths[index];
|
|
67
|
+
const result = results[index];
|
|
68
|
+
const outputFile = outputFileForPath(path);
|
|
69
|
+
try {
|
|
70
|
+
const response = await fetchPath(path);
|
|
71
|
+
const html = await response.text();
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
const error = `HTTP ${response.status}`;
|
|
74
|
+
result.failed.push({
|
|
75
|
+
path,
|
|
76
|
+
error
|
|
77
|
+
});
|
|
78
|
+
onResult?.(path, outputFile, error);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const outputPath = join(clientDir, outputFile);
|
|
82
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
83
|
+
writeFileSync(outputPath, html);
|
|
84
|
+
if (fetchPageData) {
|
|
85
|
+
const pageDataResponse = await fetchPageData(path);
|
|
86
|
+
if (pageDataResponse.headers.get("X-VoidPages")) {
|
|
87
|
+
const pageData = await pageDataResponse.json();
|
|
88
|
+
const pageDataPath = join(clientDir, pageDataFileForPath(path));
|
|
89
|
+
mkdirSync(dirname(pageDataPath), { recursive: true });
|
|
90
|
+
writeFileSync(pageDataPath, JSON.stringify(pageData));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
result.rendered.push(path);
|
|
94
|
+
onResult?.(path, outputFile);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
const error = err instanceof Error ? err.message : String(err);
|
|
97
|
+
result.failed.push({
|
|
98
|
+
path,
|
|
99
|
+
error
|
|
100
|
+
});
|
|
101
|
+
onResult?.(path, outputFile, error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
105
|
+
return {
|
|
106
|
+
rendered: results.flatMap((result) => result.rendered),
|
|
107
|
+
failed: results.flatMap((result) => result.failed)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { renderPrerenderPaths as t };
|
|
@@ -1,111 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
//#region src/prerender-render.ts
|
|
4
|
-
function outputFileForPath(path) {
|
|
5
|
-
return path === "/" ? "index.html" : `${path.slice(1)}.html`;
|
|
6
|
-
}
|
|
7
|
-
function pageDataFileForPath(path) {
|
|
8
|
-
return path === "/" ? "_void/pages/index.json" : `_void/pages/${path.slice(1)}.json`;
|
|
9
|
-
}
|
|
10
|
-
function normalizedFile(clientDir, path) {
|
|
11
|
-
return join(clientDir, path).normalize("NFC").toLowerCase();
|
|
12
|
-
}
|
|
13
|
-
function generatedFiles(path, clientDir) {
|
|
14
|
-
return [outputFileForPath(path), pageDataFileForPath(path)].map((file) => normalizedFile(clientDir, file));
|
|
15
|
-
}
|
|
16
|
-
function requestAssetCandidates(path, clientDir) {
|
|
17
|
-
const relativePath = path === "/" ? "" : path.slice(1);
|
|
18
|
-
const candidates = /* @__PURE__ */ new Set();
|
|
19
|
-
const addCandidates = (candidate) => {
|
|
20
|
-
candidates.add(candidate);
|
|
21
|
-
if (candidate === "" || candidate.endsWith("/")) candidates.add(`${candidate}index.html`);
|
|
22
|
-
else if (!candidate.split("/").at(-1)?.includes(".")) {
|
|
23
|
-
candidates.add(`${candidate}.html`);
|
|
24
|
-
candidates.add(`${candidate}/index.html`);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
addCandidates(relativePath);
|
|
28
|
-
try {
|
|
29
|
-
addCandidates(decodeURI(relativePath));
|
|
30
|
-
} catch {}
|
|
31
|
-
try {
|
|
32
|
-
addCandidates(decodeURIComponent(relativePath));
|
|
33
|
-
} catch {}
|
|
34
|
-
return new Set([...candidates].map((file) => normalizedFile(clientDir, file)));
|
|
35
|
-
}
|
|
36
|
-
function renderConcurrency(paths, clientDir) {
|
|
37
|
-
const outputs = paths.map((path) => generatedFiles(path, clientDir));
|
|
38
|
-
const ownerByOutput = /* @__PURE__ */ new Map();
|
|
39
|
-
for (let index = 0; index < outputs.length; index++) for (const output of outputs[index]) {
|
|
40
|
-
if (ownerByOutput.has(output)) return 1;
|
|
41
|
-
ownerByOutput.set(output, index);
|
|
42
|
-
}
|
|
43
|
-
for (const file of ownerByOutput.keys()) {
|
|
44
|
-
let parent = dirname(file);
|
|
45
|
-
while (parent !== dirname(parent)) {
|
|
46
|
-
if (ownerByOutput.has(parent)) return 1;
|
|
47
|
-
parent = dirname(parent);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
for (let index = 0; index < paths.length; index++) for (const candidate of requestAssetCandidates(paths[index], clientDir)) {
|
|
51
|
-
const owner = ownerByOutput.get(candidate);
|
|
52
|
-
if (owner !== void 0 && owner !== index) return 1;
|
|
53
|
-
}
|
|
54
|
-
return 4;
|
|
55
|
-
}
|
|
56
|
-
/** Shared renderer for local Workers and the isolated Node prerender child. */
|
|
57
|
-
async function renderPrerenderPaths(paths, clientDir, fetchPath, fetchPageData, onResult) {
|
|
58
|
-
const results = paths.map(() => ({
|
|
59
|
-
rendered: [],
|
|
60
|
-
failed: []
|
|
61
|
-
}));
|
|
62
|
-
let next = 0;
|
|
63
|
-
await Promise.all(Array.from({ length: Math.min(paths.length, renderConcurrency(paths, clientDir)) }, async () => {
|
|
64
|
-
while (next < paths.length) {
|
|
65
|
-
const index = next++;
|
|
66
|
-
const path = paths[index];
|
|
67
|
-
const result = results[index];
|
|
68
|
-
const outputFile = outputFileForPath(path);
|
|
69
|
-
try {
|
|
70
|
-
const response = await fetchPath(path);
|
|
71
|
-
const html = await response.text();
|
|
72
|
-
if (!response.ok) {
|
|
73
|
-
const error = `HTTP ${response.status}`;
|
|
74
|
-
result.failed.push({
|
|
75
|
-
path,
|
|
76
|
-
error
|
|
77
|
-
});
|
|
78
|
-
onResult?.(path, outputFile, error);
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
const outputPath = join(clientDir, outputFile);
|
|
82
|
-
mkdirSync(dirname(outputPath), { recursive: true });
|
|
83
|
-
writeFileSync(outputPath, html);
|
|
84
|
-
if (fetchPageData) {
|
|
85
|
-
const pageDataResponse = await fetchPageData(path);
|
|
86
|
-
if (pageDataResponse.headers.get("X-VoidPages")) {
|
|
87
|
-
const pageData = await pageDataResponse.json();
|
|
88
|
-
const pageDataPath = join(clientDir, pageDataFileForPath(path));
|
|
89
|
-
mkdirSync(dirname(pageDataPath), { recursive: true });
|
|
90
|
-
writeFileSync(pageDataPath, JSON.stringify(pageData));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
result.rendered.push(path);
|
|
94
|
-
onResult?.(path, outputFile);
|
|
95
|
-
} catch (err) {
|
|
96
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
97
|
-
result.failed.push({
|
|
98
|
-
path,
|
|
99
|
-
error
|
|
100
|
-
});
|
|
101
|
-
onResult?.(path, outputFile, error);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}));
|
|
105
|
-
return {
|
|
106
|
-
rendered: results.flatMap((result) => result.rendered),
|
|
107
|
-
failed: results.flatMap((result) => result.failed)
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
//#endregion
|
|
1
|
+
import { t as renderPrerenderPaths } from "./prerender-render-Cf_WDE9W.mjs";
|
|
111
2
|
export { renderPrerenderPaths };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as readProjectPaths } from "./project-paths-
|
|
3
|
-
import { i as hasSsrEntry, r as getSsrServerEntryPath } from "./entry-
|
|
4
|
-
import { i as readPackageJson, n as hasPackageDependency, t as getPackageDependencies } from "./package-json-
|
|
5
|
-
import {
|
|
6
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
1
|
+
import { a as join, l as relative, n as dirname, u as resolve } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { n as readProjectPaths } from "./project-paths-CKQ-Q5JS.mjs";
|
|
3
|
+
import { i as hasSsrEntry, r as getSsrServerEntryPath } from "./entry-DdRFGK0y.mjs";
|
|
4
|
+
import { i as readPackageJson, n as hasPackageDependency, t as getPackageDependencies } from "./package-json-iCbMg5XF.mjs";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
7
6
|
import { fileURLToPath } from "node:url";
|
|
8
7
|
//#region src/cli/preset.ts
|
|
9
8
|
/**
|
|
@@ -133,117 +132,16 @@ function shellQuoteExecutable(value) {
|
|
|
133
132
|
if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(value)) return value;
|
|
134
133
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
135
134
|
}
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
* spawn with `shell: false`):
|
|
147
|
-
* 1. MODULE RESOLUTION of `wrangler/package.json` relative to THIS module (the
|
|
148
|
-
* `void` package). The provisioner targets wrangler 4.131's EXACT flags,
|
|
149
|
-
* `--json` shapes, and error strings, so void's own pinned wrangler must be
|
|
150
|
-
* PREFERRED — an app that hoists an older, incompatible wrangler at its root
|
|
151
|
-
* must not shadow it. Under strict pnpm (void + consumers use pnpm) void's
|
|
152
|
-
* wrangler is not at the app root anyway; module resolution finds it wherever
|
|
153
|
-
* pnpm placed it.
|
|
154
|
-
* 2. FALLBACK: the app-root `node_modules/wrangler` probe, used only when void's
|
|
155
|
-
* own wrangler cannot be resolved (e.g. a bundled/vendored layout).
|
|
156
|
-
*
|
|
157
|
-
* The resolved entry is wrangler's REAL CLI (`wrangler-dist/cli.js`, its
|
|
158
|
-
* package `main`/`exports["."]`), NOT the `bin.wrangler` WRAPPER. The wrapper
|
|
159
|
-
* (`bin/wrangler.js`) merely does a Node-version guard and then RE-SPAWNS
|
|
160
|
-
* `wrangler-dist/cli.js`, forwarding only SIGINT/SIGTERM to the grandchild (via a
|
|
161
|
-
* default `.kill()` = SIGTERM) and mapping a signal-killed grandchild (`code === null`)
|
|
162
|
-
* to `process.exit(0)`. Launching through it defeats the provisioner's hard command
|
|
163
|
-
* timeout: a `SIGKILL` sent to the wrapper cannot be relayed to the inner CLI, which
|
|
164
|
-
* survives holding the inherited stdio pipes so the parent's `close` never fires; and a
|
|
165
|
-
* killed inner CLI is masked as a clean exit 0. Launching `wrangler-dist/cli.js`
|
|
166
|
-
* DIRECTLY removes that layer entirely — the SIGKILL now hits the real process, and no
|
|
167
|
-
* wrapper can swallow the signal or rewrite the exit code. Bypassing the wrapper is
|
|
168
|
-
* safe: its only behaviors are the version guard (we spawn with the SAME `process.execPath`
|
|
169
|
-
* that already passed it) and an IPC-forwarding channel that is inert here (the runner
|
|
170
|
-
* spawns with `stdio: ['ignore','pipe','pipe']`, so the wrapper's `process.send` would be
|
|
171
|
-
* undefined and forward nothing).
|
|
172
|
-
*
|
|
173
|
-
* If wrangler cannot be resolved by EITHER avenue, throws a clear error — it never
|
|
174
|
-
* degrades to a bare `wrangler` (ENOENT in clean CI) or a `.cmd` shim.
|
|
175
|
-
*/
|
|
176
|
-
function resolveWranglerArgv(root, resolveWranglerPackageJson = defaultResolveWranglerPackageJson) {
|
|
177
|
-
const jsBin = resolveLocalWranglerJsBin(root, resolveWranglerPackageJson);
|
|
178
|
-
if (jsBin) return [process.execPath, jsBin];
|
|
179
|
-
throw new Error("provision: Void's bundled Cloudflare tooling is unavailable. Reinstall the project's dependencies from its trusted lockfile, then retry.");
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Resolve `wrangler/package.json` via Node module resolution, relative to THIS
|
|
183
|
-
* module (the `void` package), so it is found wherever pnpm placed void's own
|
|
184
|
-
* wrangler dependency. wrangler explicitly exports `./package.json`, so both
|
|
185
|
-
* `import.meta.resolve` and `createRequire().resolve()` succeed. Returns the
|
|
186
|
-
* absolute manifest path, or `undefined` when unresolvable.
|
|
187
|
-
*/
|
|
188
|
-
function defaultResolveWranglerPackageJson() {
|
|
189
|
-
if (typeof import.meta.resolve === "function") try {
|
|
190
|
-
return fileURLToPath(import.meta.resolve("wrangler/package.json"));
|
|
191
|
-
} catch {}
|
|
192
|
-
try {
|
|
193
|
-
return createRequire(import.meta.url).resolve("wrangler/package.json");
|
|
194
|
-
} catch {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Absolute path to wrangler's REAL CLI JS entry (its `package.json` `main` /
|
|
200
|
-
* `exports["."]` → `wrangler-dist/cli.js`, NOT the `bin.wrangler` wrapper — see
|
|
201
|
-
* {@link resolveWranglerArgv} for why we bypass the wrapper), trying the injected
|
|
202
|
-
* module resolver (void's OWN wrangler) FIRST, then falling back to the app-root
|
|
203
|
-
* probe. Returns `undefined` when wrangler cannot be located or its manifest is
|
|
204
|
-
* unreadable.
|
|
205
|
-
*/
|
|
206
|
-
function resolveLocalWranglerJsBin(root, resolveWranglerPackageJson) {
|
|
207
|
-
const fromVoid = wranglerCliEntryFromPackageJson(resolveWranglerPackageJson());
|
|
208
|
-
if (fromVoid) return fromVoid;
|
|
209
|
-
return wranglerCliEntryFromPackageJson(join(root, "node_modules", "wrangler", "package.json"));
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Resolve wrangler's REAL CLI entry from its `package.json` at `pkgPath`. Reads the
|
|
213
|
-
* `main` field (`wrangler-dist/cli.js`), falling back to `exports["."]` (its `default`
|
|
214
|
-
* condition, or a bare string), and resolves it to an absolute JS entry relative to the
|
|
215
|
-
* manifest's own directory (so it works for BOTH the app-root probe and module
|
|
216
|
-
* resolution). Deliberately does NOT read `bin.wrangler`: that is the signal-swallowing
|
|
217
|
-
* wrapper the provisioner must bypass. Returns `undefined` on any missing/unreadable/
|
|
218
|
-
* absent-entry case.
|
|
219
|
-
*/
|
|
220
|
-
function wranglerCliEntryFromPackageJson(pkgPath) {
|
|
221
|
-
if (!pkgPath || !existsSync(pkgPath)) return;
|
|
222
|
-
try {
|
|
223
|
-
const rel = wranglerCliRelativeEntry(JSON.parse(readFileSync(pkgPath, "utf-8")));
|
|
224
|
-
if (!rel) return;
|
|
225
|
-
const jsEntry = join(dirname(pkgPath), rel);
|
|
226
|
-
return existsSync(jsEntry) ? jsEntry : void 0;
|
|
227
|
-
} catch {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* The relative CLI entry from a wrangler manifest: `main` first (wrangler 4.131 sets it
|
|
233
|
-
* to `wrangler-dist/cli.js`, which equals `exports["."].default`), then the `.` export
|
|
234
|
-
* (`{ default: string }` or a bare string). Returns `undefined` when neither is a string.
|
|
235
|
-
*/
|
|
236
|
-
function wranglerCliRelativeEntry(pkg) {
|
|
237
|
-
if (typeof pkg.main === "string" && pkg.main.length > 0) return pkg.main;
|
|
238
|
-
const exports = pkg.exports;
|
|
239
|
-
if (exports && typeof exports === "object" && !Array.isArray(exports)) {
|
|
240
|
-
const dot = exports["."];
|
|
241
|
-
if (typeof dot === "string" && dot.length > 0) return dot;
|
|
242
|
-
if (dot && typeof dot === "object" && !Array.isArray(dot)) {
|
|
243
|
-
const dflt = dot.default;
|
|
244
|
-
if (typeof dflt === "string" && dflt.length > 0) return dflt;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
135
|
+
/** Resolve the bundled cf transport without consulting project dependencies. */
|
|
136
|
+
function resolveWranglerArgv(_root) {
|
|
137
|
+
const directory = dirname(fileURLToPath(import.meta.url));
|
|
138
|
+
const entry = [
|
|
139
|
+
join(directory, "cf-compat.ts"),
|
|
140
|
+
join(directory, "cf-compat.mjs"),
|
|
141
|
+
join(directory, "cli", "cf-compat.mjs")
|
|
142
|
+
].find((candidate) => existsSync(candidate));
|
|
143
|
+
if (!entry) throw new Error(`Void's bundled Cloudflare tooling is unavailable. Reinstall the project's dependencies from its trusted lockfile, then retry.`);
|
|
144
|
+
return [process.execPath, entry];
|
|
247
145
|
}
|
|
248
146
|
/**
|
|
249
147
|
* Format a user-facing command string, rewriting `vite` to `vp` when the
|
|
@@ -317,7 +215,7 @@ function detectPreset(root, options) {
|
|
|
317
215
|
function ssgWithBackendMessage(ssgDep, backendSources) {
|
|
318
216
|
return [
|
|
319
217
|
`deploy: "${ssgDep}" was detected, but this project also has backend code: ${backendSources.join(", ")}.`,
|
|
320
|
-
"A static deploy would silently drop it, so Void will not guess. Pick one in void.
|
|
218
|
+
"A static deploy would silently drop it, so Void will not guess. Pick one in void.config.ts:",
|
|
321
219
|
"",
|
|
322
220
|
" Deploy the static output only (the backend is NOT deployed):",
|
|
323
221
|
" { \"inference\": { \"appType\": \"static\" } }",
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { a as join, n as dirname } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { o as listPlatformConnections, s as normalizePlatformApiUrl } from "./platform-registry-BJbgZLS1.mjs";
|
|
3
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { normalizeApplicationDomain } from "@void/platform";
|
|
6
|
+
//#region src/cli/hosted-platform.ts
|
|
7
|
+
const VOID_CLOUD_PLATFORM = Object.freeze({
|
|
8
|
+
apiUrl: "https://api.void.cloud",
|
|
9
|
+
applicationDomain: "void.app",
|
|
10
|
+
displayName: "Void Cloud",
|
|
11
|
+
proxyUrl: "https://proxy.void.cloud"
|
|
12
|
+
});
|
|
13
|
+
const VOID_CLOUD_STAGING_PLATFORM = Object.freeze({
|
|
14
|
+
apiUrl: "https://api.staging.void.cloud",
|
|
15
|
+
applicationDomain: "staging.void.app",
|
|
16
|
+
displayName: "Void Cloud staging",
|
|
17
|
+
proxyUrl: "https://proxy.staging.void.cloud"
|
|
18
|
+
});
|
|
19
|
+
const HOSTED_PLATFORMS = [VOID_CLOUD_PLATFORM, VOID_CLOUD_STAGING_PLATFORM];
|
|
20
|
+
function hostedPlatformForApiUrl(apiUrl) {
|
|
21
|
+
if (typeof apiUrl !== "string") return null;
|
|
22
|
+
let normalized;
|
|
23
|
+
try {
|
|
24
|
+
const parsed = new URL(apiUrl);
|
|
25
|
+
if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.search || parsed.hash || parsed.pathname !== "/" && parsed.pathname !== "") return null;
|
|
26
|
+
normalized = parsed.origin;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return HOSTED_PLATFORMS.find((platform) => platform.apiUrl === normalized) ?? null;
|
|
31
|
+
}
|
|
32
|
+
/** Resolve an old ~/.void/config.json selection without returning credential values. */
|
|
33
|
+
function readLegacyHostedPlatformSelection(configPath = join(homedir(), ".void", "config.json")) {
|
|
34
|
+
let value = {};
|
|
35
|
+
try {
|
|
36
|
+
value = JSON.parse(readFileSync(configPath, "utf8"));
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (value.api !== void 0) {
|
|
41
|
+
const platform = hostedPlatformForApiUrl(value.api);
|
|
42
|
+
return platform ? {
|
|
43
|
+
...platform,
|
|
44
|
+
source: "configured-api"
|
|
45
|
+
} : null;
|
|
46
|
+
}
|
|
47
|
+
if (typeof value.token === "string" && value.token !== "") return {
|
|
48
|
+
...VOID_CLOUD_PLATFORM,
|
|
49
|
+
source: "legacy-credential"
|
|
50
|
+
};
|
|
51
|
+
if (typeof value.stagingToken === "string" && value.stagingToken !== "") return {
|
|
52
|
+
...VOID_CLOUD_STAGING_PLATFORM,
|
|
53
|
+
source: "legacy-credential"
|
|
54
|
+
};
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/cli/project.ts
|
|
59
|
+
const PROJECT_FILE = ".void/project.json";
|
|
60
|
+
function readProjectConfigFile(root) {
|
|
61
|
+
const filePath = join(root, PROJECT_FILE);
|
|
62
|
+
try {
|
|
63
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
64
|
+
const config = JSON.parse(raw);
|
|
65
|
+
if (typeof config !== "object" || config === null || Array.isArray(config)) return null;
|
|
66
|
+
return config;
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read the project config from the project root.
|
|
73
|
+
* Returns null if no project.json exists.
|
|
74
|
+
* A file containing only internal metadata is not treated as a linked project.
|
|
75
|
+
*/
|
|
76
|
+
function readProjectConfig(root) {
|
|
77
|
+
const config = readProjectConfigFile(root);
|
|
78
|
+
if (!config || typeof config.projectId !== "string" || typeof config.slug !== "string") return null;
|
|
79
|
+
const result = {
|
|
80
|
+
projectId: config.projectId,
|
|
81
|
+
slug: config.slug
|
|
82
|
+
};
|
|
83
|
+
if (typeof config.platformUrl === "string") result.platformUrl = normalizePlatformApiUrl(config.platformUrl);
|
|
84
|
+
if (typeof config.applicationDomain === "string") result.applicationDomain = normalizeApplicationDomain(config.applicationDomain);
|
|
85
|
+
if (typeof config.proxyUrl === "string") result.proxyUrl = normalizePlatformApiUrl(config.proxyUrl);
|
|
86
|
+
if (config.voidInternalStaging === true) result.voidInternalStaging = true;
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Read the deployment platform selected during `void init`.
|
|
91
|
+
*
|
|
92
|
+
* Linked project files created before the platform field existed implicitly
|
|
93
|
+
* target Void. A metadata-only file has no deployment preference.
|
|
94
|
+
*/
|
|
95
|
+
function readDeploymentPlatform(root) {
|
|
96
|
+
const config = readProjectConfigFile(root);
|
|
97
|
+
if (!config) return null;
|
|
98
|
+
if (config.platform === "cloudflare" || config.platform === "void" || config.platform === "none") return config.platform;
|
|
99
|
+
if (typeof config.projectId === "string" && typeof config.slug === "string") return "void";
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Persist a deployment preference without discarding an existing Void project
|
|
104
|
+
* link. Keeping the link makes switching back to Void non-destructive.
|
|
105
|
+
*/
|
|
106
|
+
function writeDeploymentPlatform(root, platform) {
|
|
107
|
+
const filePath = join(root, PROJECT_FILE);
|
|
108
|
+
const existing = readProjectConfigFile(root);
|
|
109
|
+
const next = { platform };
|
|
110
|
+
if (typeof existing?.projectId === "string") next.projectId = existing.projectId;
|
|
111
|
+
if (typeof existing?.platformUrl === "string") next.platformUrl = existing.platformUrl;
|
|
112
|
+
if (typeof existing?.applicationDomain === "string") next.applicationDomain = existing.applicationDomain;
|
|
113
|
+
if (typeof existing?.proxyUrl === "string") next.proxyUrl = existing.proxyUrl;
|
|
114
|
+
if (typeof existing?.slug === "string") next.slug = existing.slug;
|
|
115
|
+
if (existing?.voidInternalStaging === true) next.voidInternalStaging = true;
|
|
116
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
117
|
+
writeFileSync(filePath, JSON.stringify(next, null, 2) + "\n");
|
|
118
|
+
}
|
|
119
|
+
/** Select a verified platform without changing an existing project link. */
|
|
120
|
+
function writePlatformSelection(root, connection) {
|
|
121
|
+
const existing = readProjectConfigFile(root);
|
|
122
|
+
const linked = readProjectConfig(root);
|
|
123
|
+
const pinnedUrl = isVoidInternalStaging(root) ? VOID_CLOUD_STAGING_PLATFORM.apiUrl : linked ? linked.platformUrl ?? VOID_CLOUD_PLATFORM.apiUrl : null;
|
|
124
|
+
if (pinnedUrl && pinnedUrl !== connection.apiUrl) return false;
|
|
125
|
+
const filePath = join(root, PROJECT_FILE);
|
|
126
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
127
|
+
writeFileSync(filePath, JSON.stringify({
|
|
128
|
+
...existing,
|
|
129
|
+
platform: "void",
|
|
130
|
+
platformUrl: normalizePlatformApiUrl(connection.apiUrl),
|
|
131
|
+
applicationDomain: normalizeApplicationDomain(connection.applicationDomain),
|
|
132
|
+
proxyUrl: normalizePlatformApiUrl(connection.proxyUrl)
|
|
133
|
+
}, null, 2) + "\n");
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Internal-only platform developers' staging switch.
|
|
138
|
+
* This intentionally lives with the project link state, not public void.json.
|
|
139
|
+
*/
|
|
140
|
+
function isVoidInternalStaging(root) {
|
|
141
|
+
return readProjectConfigFile(root)?.voidInternalStaging === true;
|
|
142
|
+
}
|
|
143
|
+
function readProjectPlatformUrl(root) {
|
|
144
|
+
const value = readProjectConfigFile(root)?.platformUrl;
|
|
145
|
+
return typeof value === "string" && value !== "" ? normalizePlatformApiUrl(value) : null;
|
|
146
|
+
}
|
|
147
|
+
function readProjectApplicationDomain(root) {
|
|
148
|
+
const value = readProjectConfigFile(root)?.applicationDomain;
|
|
149
|
+
return typeof value === "string" && value !== "" ? normalizeApplicationDomain(value) : null;
|
|
150
|
+
}
|
|
151
|
+
/** Resolve the immutable platform identity that every newly linked project records. */
|
|
152
|
+
function attachSelectedPlatform(root, config, platformApiUrl) {
|
|
153
|
+
const apiUrl = normalizePlatformApiUrl(platformApiUrl);
|
|
154
|
+
const hosted = hostedPlatformForApiUrl(apiUrl);
|
|
155
|
+
if (hosted) return {
|
|
156
|
+
...config,
|
|
157
|
+
applicationDomain: hosted.applicationDomain,
|
|
158
|
+
platformUrl: hosted.apiUrl,
|
|
159
|
+
proxyUrl: hosted.proxyUrl,
|
|
160
|
+
...isVoidInternalStaging(root) && hosted.apiUrl === VOID_CLOUD_STAGING_PLATFORM.apiUrl ? { voidInternalStaging: true } : {}
|
|
161
|
+
};
|
|
162
|
+
const connection = listPlatformConnections().find((entry) => entry.apiUrl === apiUrl);
|
|
163
|
+
if (connection?.applicationDomain && connection.proxyUrl) return {
|
|
164
|
+
...config,
|
|
165
|
+
applicationDomain: connection.applicationDomain,
|
|
166
|
+
platformUrl: connection.apiUrl,
|
|
167
|
+
proxyUrl: connection.proxyUrl
|
|
168
|
+
};
|
|
169
|
+
throw new Error(`platform: No verified metadata is registered for ${apiUrl}. Run \`void connect ${apiUrl}\` before linking a project.`);
|
|
170
|
+
}
|
|
171
|
+
function isLegacyVoidCloudProject(root) {
|
|
172
|
+
const config = readProjectConfigFile(root);
|
|
173
|
+
return typeof config?.projectId === "string" && typeof config.slug === "string" && typeof config.platformUrl !== "string";
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Write the project config to the project root.
|
|
177
|
+
*/
|
|
178
|
+
function writeProjectConfig(root, config) {
|
|
179
|
+
const filePath = join(root, PROJECT_FILE);
|
|
180
|
+
const existing = readProjectConfigFile(root);
|
|
181
|
+
const next = {
|
|
182
|
+
platform: "void",
|
|
183
|
+
projectId: config.projectId,
|
|
184
|
+
slug: config.slug
|
|
185
|
+
};
|
|
186
|
+
if (config.platformUrl) next.platformUrl = normalizePlatformApiUrl(config.platformUrl);
|
|
187
|
+
else if (typeof existing?.platformUrl === "string") next.platformUrl = existing.platformUrl;
|
|
188
|
+
if (config.applicationDomain) next.applicationDomain = normalizeApplicationDomain(config.applicationDomain);
|
|
189
|
+
else if (typeof existing?.applicationDomain === "string") next.applicationDomain = existing.applicationDomain;
|
|
190
|
+
if (config.proxyUrl) next.proxyUrl = normalizePlatformApiUrl(config.proxyUrl);
|
|
191
|
+
else if (typeof existing?.proxyUrl === "string") next.proxyUrl = existing.proxyUrl;
|
|
192
|
+
if (config.voidInternalStaging === true || existing?.voidInternalStaging === true) next.voidInternalStaging = true;
|
|
193
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
194
|
+
writeFileSync(filePath, JSON.stringify(next, null, 2) + "\n");
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Remove the project config file. Returns true if removed, false if it didn't exist.
|
|
198
|
+
*/
|
|
199
|
+
function removeProjectConfig(root) {
|
|
200
|
+
const filePath = join(root, PROJECT_FILE);
|
|
201
|
+
try {
|
|
202
|
+
rmSync(filePath);
|
|
203
|
+
return true;
|
|
204
|
+
} catch {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { readProjectApplicationDomain as a, removeProjectConfig as c, writeProjectConfig as d, VOID_CLOUD_PLATFORM as f, readDeploymentPlatform as i, writeDeploymentPlatform as l, readLegacyHostedPlatformSelection as m, isLegacyVoidCloudProject as n, readProjectConfig as o, VOID_CLOUD_STAGING_PLATFORM as p, isVoidInternalStaging as r, readProjectPlatformUrl as s, attachSelectedPlatform as t, writePlatformSelection as u };
|