void 0.20.3 → 0.21.1
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-g_ymMkUe.mjs} +5 -5
- package/dist/{auth-link-ElDTgF7j.mjs → auth-link-DFvxIyZi.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-wJAv808h.mjs} +6 -4
- package/dist/{cache-D98YTqeE.mjs → cache-Be0Fu5Ka.mjs} +6 -4
- package/dist/{cancel-deploy-CPbEQLMG.mjs → cancel-deploy-BgmyOwhe.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 +944 -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-LnvW4HKx.mjs} +8 -6
- package/dist/{create-project-D0oXA090.mjs → create-project-BZBl_gQ0.mjs} +8 -23
- package/dist/create-project-JV9-6ICF.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-Mzv88E1C.mjs} +48 -44
- package/dist/{delete-BZ4-WaGm.mjs → delete-Ri6JemSU.mjs} +6 -4
- package/dist/deploy-DAH2-m_-.mjs +2 -0
- package/dist/{deploy-BAhhcg5q.mjs → deploy-DEsMVrCY.mjs} +796 -198
- 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-BA37Ye7T.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Bj7Cvdwp.mjs → email-C5NsxrQG.mjs} +14 -12
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/{env-DP_EErve.mjs → env-U_ohASB0.mjs} +9 -7
- 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-B87rlalt.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-pg-Ojg8Y.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-C-z_xRrQ.mjs → github-cmd-DsrkweIl.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-B403BLBB.mjs +2 -0
- package/dist/{help-CwOX-zmI.mjs → help-sBhFH6pi.mjs} +17 -12
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BGktCXgA.mjs → init-C--Yyj1b.mjs} +49 -50
- package/dist/{link-D2kbqhWb.mjs → link-BC-mNG9-.mjs} +7 -5
- package/dist/{list-CvkK_G7k.mjs → list-DHU1Wj6c.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-BwiopVdg.mjs +2 -0
- package/dist/{login-WIjNc77c.mjs → login-jKe_0QZL.mjs} +6 -11
- package/dist/{logs-dLUFCapG.mjs → logs-BG11f5PR.mjs} +6 -4
- package/dist/migrate-BV8qHiCb.mjs +285 -0
- package/dist/migrate-BXY3B3m7.mjs +2 -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-BwAS2XZt.mjs} +6 -6
- package/dist/output-CCH48AMM.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-C-hv-_Ok.mjs} +6 -6
- package/dist/{platform-auth-protection-Drl0qhrn.mjs → platform-auth-protection-DjTE5Hj-.mjs} +7 -5
- package/dist/{platform-auth-recovery-CmKEWpDo.mjs → platform-auth-recovery-Cr0r8TEb.mjs} +6 -5
- package/dist/{platform-cmd-5q_k56xS.mjs → platform-cmd-0tEh2ZtA.mjs} +8 -5
- package/dist/platform-cmd-DE6dw45v.mjs +2 -0
- package/dist/{platform-domain-4GiDlcqx.mjs → platform-domain-B_7x6Iqx.mjs} +4 -3
- package/dist/platform-lifecycle-Dhx9Pnub.mjs +2 -0
- package/dist/{platform-lifecycle-R9xAxvtG.mjs → platform-lifecycle-Di0LbhPM.mjs} +208 -37
- package/dist/platform-management-B9LUtMt9.mjs +2 -0
- package/dist/{platform-management-BfWsXHEW.mjs → platform-management-eaiaU3uM.mjs} +8 -5
- package/dist/{platform-recovery-CbK-I1FB.mjs → platform-recovery-BxfA8E5C.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-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-_T-Haxrr.mjs} +3 -2
- 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-DrnRJdep.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-CzRbO_kA.mjs} +6 -4
- package/dist/{project-token-Cirx7uwZ.mjs → project-token-Bwxjf4y6.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-DwrqUQZ8.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-B4tFWmkN.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-UtrRjhEO.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-BuGYkAkC.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 +8 -15
- 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 +60 -66
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +15 -41
- 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/quickstart.md +11 -78
- 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/index.md +17 -17
- package/skills/void/docs/integrations/cloudflare.md +91 -96
- 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 +40 -25
- package/skills/void/docs/reference/config.md +58 -35
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { a as join, l as relative } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { r as writeFileIfChanged } from "./project-tsconfig-CwfqUnVp.mjs";
|
|
3
|
+
import { mkdirSync } from "node:fs";
|
|
4
|
+
//#region src/codegen/db-types.ts
|
|
5
|
+
const DRIZZLE_OPERATORS = "sql, eq, ne, gt, gte, lt, lte, and, or, not, desc, asc, like, ilike, notLike, inArray, notInArray, isNull, isNotNull, between, notBetween, exists, notExists, count, sum, avg, min, max";
|
|
6
|
+
/**
|
|
7
|
+
* Generate `.void/db.d.ts` with Drizzle types referencing the user's schema.
|
|
8
|
+
*
|
|
9
|
+
* This is a proper module file (not `declare module`) whose types override
|
|
10
|
+
* the base `void/db` package via a tsconfig `paths` redirect:
|
|
11
|
+
* "void/db": ["./.void/db.d.ts"]
|
|
12
|
+
*
|
|
13
|
+
* Imports reference `void/_db` (internal subpath pointing at the same
|
|
14
|
+
* base module) to avoid circular resolution through the paths redirect.
|
|
15
|
+
*/
|
|
16
|
+
function generateDbDts(outDir, schema, dialect) {
|
|
17
|
+
mkdirSync(outDir, { recursive: true });
|
|
18
|
+
const lines = dialect === "mysql" ? schema ? [
|
|
19
|
+
"// Auto-generated by void — do not edit",
|
|
20
|
+
"import type { MySql2Database } from \"void/_db-mysql\";",
|
|
21
|
+
"import type * as schema from \"@schema\";",
|
|
22
|
+
"type Schema = typeof schema;",
|
|
23
|
+
"export declare const db: MySql2Database<Schema>;",
|
|
24
|
+
"export declare function createDb(connectionString: string): MySql2Database<Schema>;",
|
|
25
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
26
|
+
"export type { MySql2Database } from \"void/_db-mysql\";",
|
|
27
|
+
""
|
|
28
|
+
] : [
|
|
29
|
+
"// Auto-generated by void — do not edit",
|
|
30
|
+
"import type { MySql2Database } from \"void/_db-mysql\";",
|
|
31
|
+
"export declare const db: MySql2Database<Record<string, never>>;",
|
|
32
|
+
"export declare function createDb(connectionString: string): MySql2Database<Record<string, never>>;",
|
|
33
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
34
|
+
"export type { MySql2Database } from \"void/_db-mysql\";",
|
|
35
|
+
""
|
|
36
|
+
] : dialect === "postgresql" ? schema ? [
|
|
37
|
+
"// Auto-generated by void — do not edit",
|
|
38
|
+
"import type { NodePgDatabase } from \"void/_db-pg\";",
|
|
39
|
+
"import type * as schema from \"@schema\";",
|
|
40
|
+
"type Schema = typeof schema;",
|
|
41
|
+
"export declare const db: NodePgDatabase<Schema>;",
|
|
42
|
+
"export declare function createDb(connectionString: string): NodePgDatabase<Schema>;",
|
|
43
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
44
|
+
"export type { NodePgDatabase } from \"void/_db-pg\";",
|
|
45
|
+
""
|
|
46
|
+
] : [
|
|
47
|
+
"// Auto-generated by void — do not edit",
|
|
48
|
+
"import type { NodePgDatabase } from \"void/_db-pg\";",
|
|
49
|
+
"export declare const db: NodePgDatabase<Record<string, never>>;",
|
|
50
|
+
"export declare function createDb(connectionString: string): NodePgDatabase<Record<string, never>>;",
|
|
51
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
52
|
+
"export type { NodePgDatabase } from \"void/_db-pg\";",
|
|
53
|
+
""
|
|
54
|
+
] : schema ? [
|
|
55
|
+
"// Auto-generated by void — do not edit",
|
|
56
|
+
"/// <reference types=\"@cloudflare/workers-types\" />",
|
|
57
|
+
"import type { DrizzleD1Database } from \"void/_db\";",
|
|
58
|
+
"import type * as schema from \"@schema\";",
|
|
59
|
+
"type Schema = typeof schema;",
|
|
60
|
+
"export declare const db: DrizzleD1Database<Schema>;",
|
|
61
|
+
"export declare function createDb(d1: D1Database): DrizzleD1Database<Schema>;",
|
|
62
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
63
|
+
"export type { DrizzleD1Database } from \"void/_db\";",
|
|
64
|
+
""
|
|
65
|
+
] : [
|
|
66
|
+
"// Auto-generated by void — do not edit",
|
|
67
|
+
"/// <reference types=\"@cloudflare/workers-types\" />",
|
|
68
|
+
"import type { DrizzleD1Database } from \"void/_db\";",
|
|
69
|
+
"export declare const db: DrizzleD1Database<Record<string, never>>;",
|
|
70
|
+
"export declare function createDb(d1: D1Database): DrizzleD1Database<Record<string, never>>;",
|
|
71
|
+
`export { ${DRIZZLE_OPERATORS} } from "void/_db";`,
|
|
72
|
+
"export type { DrizzleD1Database } from \"void/_db\";",
|
|
73
|
+
""
|
|
74
|
+
];
|
|
75
|
+
return writeFileIfChanged(join(outDir, "db.d.ts"), lines.join("\n"));
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/codegen/queue-types.ts
|
|
79
|
+
/**
|
|
80
|
+
* Generate .void/queues.d.ts content.
|
|
81
|
+
*
|
|
82
|
+
* Augments `void/queues` with a typed `QueueMap` interface
|
|
83
|
+
* so `queues.emails.send(body)` is fully typed from the consumer's
|
|
84
|
+
* `defineQueue<T>` phantom type.
|
|
85
|
+
*/
|
|
86
|
+
function generateQueueTypes(queues, queuesDir, outDir) {
|
|
87
|
+
const lines = [];
|
|
88
|
+
lines.push("// Auto-generated by void — do not edit");
|
|
89
|
+
lines.push("export interface QueueMap {");
|
|
90
|
+
for (const q of queues) {
|
|
91
|
+
const absPath = `${queuesDir}/${q.filePath}`;
|
|
92
|
+
const importPath = relative(outDir, absPath);
|
|
93
|
+
lines.push(` ${JSON.stringify(q.name)}: Queue<(typeof import(${JSON.stringify(importPath)}))["default"]["__payload"]>;`);
|
|
94
|
+
}
|
|
95
|
+
lines.push("}");
|
|
96
|
+
lines.push("");
|
|
97
|
+
lines.push("export declare const queues: QueueMap;");
|
|
98
|
+
lines.push("");
|
|
99
|
+
return lines.join("\n");
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/codegen/route-types.ts
|
|
103
|
+
/**
|
|
104
|
+
* Generate .void/routes.d.ts content.
|
|
105
|
+
*
|
|
106
|
+
* Uses `typeof import(...)` so TypeScript resolves all types.
|
|
107
|
+
* The codegen generates scaffolding only — never analyzes types itself.
|
|
108
|
+
*/
|
|
109
|
+
function generateRouteTypes(scan, routesDir, outDir, pagesDir) {
|
|
110
|
+
const lines = [];
|
|
111
|
+
lines.push("// Auto-generated by void — do not edit");
|
|
112
|
+
lines.push("export {}");
|
|
113
|
+
lines.push("type StandardSchemaV1<Input = unknown, Output = Input> = {");
|
|
114
|
+
lines.push(" readonly \"~standard\": {");
|
|
115
|
+
lines.push(" readonly version: 1;");
|
|
116
|
+
lines.push(" readonly vendor: string;");
|
|
117
|
+
lines.push(" readonly validate: (value: unknown) => unknown;");
|
|
118
|
+
lines.push(" readonly types?: { readonly input: Input; readonly output: Output } | undefined;");
|
|
119
|
+
lines.push(" };");
|
|
120
|
+
lines.push("};");
|
|
121
|
+
lines.push("declare namespace StandardSchemaV1 {");
|
|
122
|
+
lines.push(" type InferInput<Schema extends StandardSchemaV1> = NonNullable<");
|
|
123
|
+
lines.push(" Schema[\"~standard\"][\"types\"]");
|
|
124
|
+
lines.push(" >[\"input\"];");
|
|
125
|
+
lines.push(" type InferOutput<Schema extends StandardSchemaV1> = NonNullable<");
|
|
126
|
+
lines.push(" Schema[\"~standard\"][\"types\"]");
|
|
127
|
+
lines.push(" >[\"output\"];");
|
|
128
|
+
lines.push("}");
|
|
129
|
+
lines.push("");
|
|
130
|
+
lines.push("type Serialize<T> =");
|
|
131
|
+
lines.push(" T extends Response ? never :");
|
|
132
|
+
lines.push(" T extends Date ? string :");
|
|
133
|
+
lines.push(" T extends bigint ? never :");
|
|
134
|
+
lines.push(" T extends Function ? never :");
|
|
135
|
+
lines.push(" T extends undefined ? never :");
|
|
136
|
+
lines.push(" T extends Array<infer U> ? Array<Serialize<U>> :");
|
|
137
|
+
lines.push(" T extends object ? { [K in keyof T as T[K] extends Function ? never : K]: Serialize<T[K]> } :");
|
|
138
|
+
lines.push(" T;");
|
|
139
|
+
lines.push("");
|
|
140
|
+
lines.push("type ExtractInput<V> = {");
|
|
141
|
+
lines.push(" [K in keyof V as V[K] extends StandardSchemaV1 ? K : never]:");
|
|
142
|
+
lines.push(" V[K] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<V[K]> : never;");
|
|
143
|
+
lines.push("};");
|
|
144
|
+
lines.push("");
|
|
145
|
+
lines.push("type ExtractOutput<S> =");
|
|
146
|
+
lines.push(" S extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<S> : never;");
|
|
147
|
+
lines.push("");
|
|
148
|
+
lines.push("type RouteParams<P extends readonly string[]> =");
|
|
149
|
+
lines.push(" P extends readonly [] ? Record<string, never> : { [K in P[number]]: string };");
|
|
150
|
+
lines.push("");
|
|
151
|
+
lines.push("declare module \"void/routes\" {");
|
|
152
|
+
lines.push(" export interface RouteMap {}");
|
|
153
|
+
lines.push(" export interface WebSocketRouteMap {}");
|
|
154
|
+
lines.push(" export interface PageActionMap {}");
|
|
155
|
+
lines.push("");
|
|
156
|
+
lines.push(" /** Union of known route patterns (keys of the generated RouteMap). */");
|
|
157
|
+
lines.push(" export type RouteName = keyof RouteMap;");
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push(" /**");
|
|
160
|
+
lines.push(" * Destination type for rewrites / fallbacks / c.rewrite().");
|
|
161
|
+
lines.push(" *");
|
|
162
|
+
lines.push(" * The `string & {}` branch keeps IDE autocomplete of known routes while");
|
|
163
|
+
lines.push(" * still accepting arbitrary strings (needed for dynamic paths like");
|
|
164
|
+
lines.push(" * `/users/${id}`). When no routes are generated yet, `RouteName` is");
|
|
165
|
+
lines.push(" * `never` and this degenerates to `string & {}`, which is assignable");
|
|
166
|
+
lines.push(" * from any string.");
|
|
167
|
+
lines.push(" */");
|
|
168
|
+
lines.push(" export type RewriteDestination = RouteName | (string & {});");
|
|
169
|
+
lines.push("");
|
|
170
|
+
lines.push(" export type ParseActionUrl<U extends string> = U extends `${infer Base}?${infer Action}` ? {");
|
|
171
|
+
lines.push(" base: Base;");
|
|
172
|
+
lines.push(" action: Action;");
|
|
173
|
+
lines.push(" } : {");
|
|
174
|
+
lines.push(" base: U;");
|
|
175
|
+
lines.push(" action: never;");
|
|
176
|
+
lines.push(" };");
|
|
177
|
+
lines.push("");
|
|
178
|
+
lines.push(" export type ResolveActionBody<U extends string> =");
|
|
179
|
+
lines.push(" ParseActionUrl<U>[\"base\"] extends keyof PageActionMap");
|
|
180
|
+
lines.push(" ? ParseActionUrl<U>[\"action\"] extends never");
|
|
181
|
+
lines.push(" ? PageActionMap[ParseActionUrl<U>[\"base\"]] extends { body: infer B }");
|
|
182
|
+
lines.push(" ? B");
|
|
183
|
+
lines.push(" : Record<string, unknown>");
|
|
184
|
+
lines.push(" : PageActionMap[ParseActionUrl<U>[\"base\"]] extends { actions: infer A }");
|
|
185
|
+
lines.push(" ? ParseActionUrl<U>[\"action\"] extends keyof A");
|
|
186
|
+
lines.push(" ? A[ParseActionUrl<U>[\"action\"]] extends { body: infer B }");
|
|
187
|
+
lines.push(" ? B");
|
|
188
|
+
lines.push(" : Record<string, unknown>");
|
|
189
|
+
lines.push(" : never");
|
|
190
|
+
lines.push(" : never");
|
|
191
|
+
lines.push(" : Record<string, unknown>;");
|
|
192
|
+
lines.push("");
|
|
193
|
+
lines.push(" export type ResolveActionParams<U extends string> =");
|
|
194
|
+
lines.push(" ParseActionUrl<U>[\"base\"] extends keyof PageActionMap");
|
|
195
|
+
lines.push(" ? PageActionMap[ParseActionUrl<U>[\"base\"]] extends { params: infer P }");
|
|
196
|
+
lines.push(" ? P");
|
|
197
|
+
lines.push(" : never");
|
|
198
|
+
lines.push(" : never;");
|
|
199
|
+
lines.push("");
|
|
200
|
+
lines.push(" export type HasActionParams<U extends string> =");
|
|
201
|
+
lines.push(" ResolveActionParams<U> extends Record<string, string> ? true : false;");
|
|
202
|
+
lines.push("");
|
|
203
|
+
lines.push(" export type ActionFormOptions<U extends string> =");
|
|
204
|
+
lines.push(" HasActionParams<U> extends true ? { params: ResolveActionParams<U> } : { params?: never };");
|
|
205
|
+
lines.push("");
|
|
206
|
+
lines.push(" export type ActionUrl =");
|
|
207
|
+
lines.push(" | {");
|
|
208
|
+
lines.push(" [K in keyof PageActionMap]: PageActionMap[K] extends { body: any } ? K : never;");
|
|
209
|
+
lines.push(" }[keyof PageActionMap]");
|
|
210
|
+
lines.push(" | {");
|
|
211
|
+
lines.push(" [K in keyof PageActionMap]: PageActionMap[K] extends { actions: infer A }");
|
|
212
|
+
lines.push(" ? `${K & string}?${keyof A & string}`");
|
|
213
|
+
lines.push(" : never;");
|
|
214
|
+
lines.push(" }[keyof PageActionMap]");
|
|
215
|
+
lines.push("");
|
|
216
|
+
lines.push(" interface RouteMap {");
|
|
217
|
+
for (const route of scan.routes) {
|
|
218
|
+
if (route.methods.length === 0) continue;
|
|
219
|
+
const absRoutePath = `${routesDir}/${route.filePath}`;
|
|
220
|
+
const importPath = relative(outDir, absRoutePath);
|
|
221
|
+
lines.push(` ${JSON.stringify(route.pattern)}: {`);
|
|
222
|
+
for (const method of route.methods) {
|
|
223
|
+
lines.push(` ${method}: {`);
|
|
224
|
+
lines.push(` input: ExtractInput<(typeof import(${JSON.stringify(importPath)}))["${method}"]["__validators"]>;`);
|
|
225
|
+
lines.push(` output: Serialize<Awaited<(typeof import(${JSON.stringify(importPath)}))["${method}"]["__output"]>>;`);
|
|
226
|
+
lines.push(" };");
|
|
227
|
+
}
|
|
228
|
+
lines.push(" };");
|
|
229
|
+
}
|
|
230
|
+
lines.push(" }");
|
|
231
|
+
lines.push("");
|
|
232
|
+
lines.push(" interface WebSocketRouteMap {");
|
|
233
|
+
for (const route of scan.websockets ?? []) {
|
|
234
|
+
const absRoutePath = `${routesDir}/${route.filePath}`;
|
|
235
|
+
const importPath = relative(outDir, absRoutePath);
|
|
236
|
+
lines.push(` ${JSON.stringify(route.pattern)}: {`);
|
|
237
|
+
lines.push(` params: RouteParams<${JSON.stringify(route.params)}>;`);
|
|
238
|
+
lines.push(` client: ExtractInput<(typeof import(${JSON.stringify(importPath)}))["default"]["messages"]["client"]>;`);
|
|
239
|
+
lines.push(` server: ExtractOutput<(typeof import(${JSON.stringify(importPath)}))["default"]["messages"]["server"]>;`);
|
|
240
|
+
lines.push(" };");
|
|
241
|
+
}
|
|
242
|
+
lines.push(" }");
|
|
243
|
+
const actionPages = scan.pages.pages.filter((p) => p.methods.includes("action") || p.methods.includes("actions"));
|
|
244
|
+
if (actionPages.length > 0 && pagesDir) {
|
|
245
|
+
lines.push(" interface PageActionMap {");
|
|
246
|
+
for (const page of actionPages) {
|
|
247
|
+
const hasAction = page.methods.includes("action");
|
|
248
|
+
const hasActions = page.methods.includes("actions");
|
|
249
|
+
if (hasAction && hasActions) throw new Error(`pages: Page '${page.pattern}' exports both "action" and "actions". Use one or the other.`);
|
|
250
|
+
lines.push(` ${JSON.stringify(page.pattern)}: {`);
|
|
251
|
+
let importPath = null;
|
|
252
|
+
if (page.serverPath) {
|
|
253
|
+
const absPath = `${pagesDir}/${page.serverPath}`;
|
|
254
|
+
importPath = relative(outDir, absPath);
|
|
255
|
+
}
|
|
256
|
+
if (hasActions) {
|
|
257
|
+
if (importPath) {
|
|
258
|
+
const actionsImport = `(typeof import(${JSON.stringify(importPath)}))["actions"]`;
|
|
259
|
+
lines.push(` actions: { [K in keyof ${actionsImport}]: {`);
|
|
260
|
+
lines.push(` body: ExtractInput<${actionsImport}[K]["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
|
|
261
|
+
lines.push(" } };");
|
|
262
|
+
}
|
|
263
|
+
} else if (importPath) {
|
|
264
|
+
const importExpr = `(typeof import(${JSON.stringify(importPath)}))["action"]`;
|
|
265
|
+
lines.push(` body: ExtractInput<${importExpr}["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
|
|
266
|
+
} else lines.push(" body: Record<string, unknown>;");
|
|
267
|
+
if (page.params.length > 0) {
|
|
268
|
+
const paramsType = page.params.map((p) => `${p}: string`).join("; ");
|
|
269
|
+
lines.push(` params: { ${paramsType} };`);
|
|
270
|
+
}
|
|
271
|
+
lines.push(" };");
|
|
272
|
+
}
|
|
273
|
+
lines.push(" }");
|
|
274
|
+
}
|
|
275
|
+
lines.push("}");
|
|
276
|
+
lines.push("");
|
|
277
|
+
return { dts: lines.join("\n") };
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
export { generateDbDts as i, generateQueueTypes as n, DRIZZLE_OPERATORS as r, generateRouteTypes as t };
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { a as join, n as dirname } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { n as hasPackageDependency, r as readNearestPackageJson } from "./package-json-iCbMg5XF.mjs";
|
|
3
|
+
import { t as collectMigrations } from "./collect-DXHNWHcT.mjs";
|
|
4
|
+
import { a as classifyMigration } from "./plan-BEZ8VJW0.mjs";
|
|
5
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
7
6
|
import { createHash, createHmac } from "node:crypto";
|
|
8
7
|
//#region src/migrations/runner.ts
|
|
9
|
-
var runner_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
getApplicationTables: () => getApplicationTables,
|
|
11
|
-
getAppliedMigrations: () => getAppliedMigrations,
|
|
12
|
-
getMiniflareDatabasePath: () => getMiniflareDatabasePath,
|
|
13
|
-
openSqliteDatabase: () => openSqliteDatabase,
|
|
14
|
-
projectUsesVitePlus: () => projectUsesVitePlus,
|
|
15
|
-
runMigrations: () => runMigrations,
|
|
16
|
-
toBetterSqlite3Error: () => toBetterSqlite3Error
|
|
17
|
-
});
|
|
18
8
|
const SQLITE_INTERNAL_TABLES = /* @__PURE__ */ new Set([
|
|
19
9
|
"_cf_METADATA",
|
|
20
10
|
"_migrations",
|
|
@@ -181,102 +171,4 @@ async function runMigrations(migrationsDir, dbPath) {
|
|
|
181
171
|
}
|
|
182
172
|
}
|
|
183
173
|
//#endregion
|
|
184
|
-
|
|
185
|
-
const LOCAL_D1_STATE_FILE = "local-d1.json";
|
|
186
|
-
const VITE_CONFIG_NAMES = [
|
|
187
|
-
"vite.config.ts",
|
|
188
|
-
"vite.config.mts",
|
|
189
|
-
"vite.config.js",
|
|
190
|
-
"vite.config.mjs",
|
|
191
|
-
"vite.config.cts",
|
|
192
|
-
"vite.config.cjs"
|
|
193
|
-
];
|
|
194
|
-
function readConfiguredDatabaseId(root, bindingName) {
|
|
195
|
-
let rootConfig;
|
|
196
|
-
try {
|
|
197
|
-
rootConfig = readRootWranglerConfig(root);
|
|
198
|
-
} catch {
|
|
199
|
-
throw new Error(`db: cannot read malformed Wrangler configuration in ${root}.`);
|
|
200
|
-
}
|
|
201
|
-
if (!rootConfig) return;
|
|
202
|
-
const { configPath, config } = rootConfig;
|
|
203
|
-
const rawDatabases = config.d1_databases;
|
|
204
|
-
if (rawDatabases === void 0) return;
|
|
205
|
-
if (!Array.isArray(rawDatabases)) throw new Error(`db: cannot read ${configPath}: "d1_databases" must be an array.`);
|
|
206
|
-
if (rawDatabases.some((entry) => entry === null || typeof entry !== "object" || Array.isArray(entry) || typeof entry.binding !== "string" || entry.binding === "")) throw new Error(`db: cannot read ${configPath}: every "d1_databases" entry needs a non-empty binding.`);
|
|
207
|
-
const matches = rawDatabases.filter((entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry) && entry.binding === bindingName);
|
|
208
|
-
if (matches.length > 1) throw new Error(`db: cannot select local D1 database: binding ${JSON.stringify(bindingName)} is declared ${matches.length} times in ${configPath}.`);
|
|
209
|
-
const match = matches[0];
|
|
210
|
-
if (!match) return;
|
|
211
|
-
for (const value of [
|
|
212
|
-
match.preview_database_id,
|
|
213
|
-
match.database_id,
|
|
214
|
-
match.binding
|
|
215
|
-
]) if (typeof value === "string" && value.length > 0) return value;
|
|
216
|
-
}
|
|
217
|
-
function statePath(root) {
|
|
218
|
-
return join(root, ".void", LOCAL_D1_STATE_FILE);
|
|
219
|
-
}
|
|
220
|
-
function hashFile(path) {
|
|
221
|
-
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
222
|
-
}
|
|
223
|
-
function findViteConfig(root) {
|
|
224
|
-
return VITE_CONFIG_NAMES.map((name) => join(root, name)).find(existsSync);
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Record the persistence directory selected by voidPlugin({ persistTo }). The binding and
|
|
228
|
-
* database ID are deliberately not cached: CLI commands always reread Wrangler configuration.
|
|
229
|
-
*/
|
|
230
|
-
function writeLocalD1PersistState(root, persistTo) {
|
|
231
|
-
const path = statePath(root);
|
|
232
|
-
if (persistTo === void 0) {
|
|
233
|
-
rmSync(path, { force: true });
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const projectRoot = resolve(root);
|
|
237
|
-
const viteConfigPath = findViteConfig(projectRoot);
|
|
238
|
-
const state = {
|
|
239
|
-
version: 1,
|
|
240
|
-
projectRoot,
|
|
241
|
-
persistRoot: isAbsolute(persistTo) ? persistTo : resolve(projectRoot, persistTo),
|
|
242
|
-
...viteConfigPath ? { viteConfig: {
|
|
243
|
-
path: viteConfigPath,
|
|
244
|
-
hash: hashFile(viteConfigPath)
|
|
245
|
-
} } : {}
|
|
246
|
-
};
|
|
247
|
-
mkdirSync(join(projectRoot, ".void"), { recursive: true });
|
|
248
|
-
writeFileSync(path, `${JSON.stringify(state, null, 2)}\n`);
|
|
249
|
-
}
|
|
250
|
-
function readLocalD1PersistState(root) {
|
|
251
|
-
const path = statePath(root);
|
|
252
|
-
if (!existsSync(path)) return;
|
|
253
|
-
let state;
|
|
254
|
-
try {
|
|
255
|
-
state = JSON.parse(readFileSync(path, "utf-8"));
|
|
256
|
-
} catch {
|
|
257
|
-
throw new Error(`db: local D1 state in ${path} is invalid. Run \`void dev\` to refresh it.`);
|
|
258
|
-
}
|
|
259
|
-
const projectRoot = resolve(root);
|
|
260
|
-
if (state.version !== 1 || state.projectRoot !== projectRoot || typeof state.persistRoot !== "string" || state.persistRoot.length === 0) throw new Error(`db: local D1 state in ${path} is stale. Run \`void dev\` to refresh it.`);
|
|
261
|
-
if (state.viteConfig) {
|
|
262
|
-
const { path: configPath, hash } = state.viteConfig;
|
|
263
|
-
if (!existsSync(configPath) || hashFile(configPath) !== hash) throw new Error("db: voidPlugin persistence configuration changed since the local D1 state was written. Run `void dev` to refresh it before using `void db`.");
|
|
264
|
-
}
|
|
265
|
-
return state;
|
|
266
|
-
}
|
|
267
|
-
function resolveLocalD1Target(root, options = {}) {
|
|
268
|
-
const projectRoot = resolve(root);
|
|
269
|
-
const bindingName = options.bindingName ?? "DB";
|
|
270
|
-
const state = options.readPersistState ? readLocalD1PersistState(projectRoot) : void 0;
|
|
271
|
-
const selectedPersistRoot = options.persistRoot ?? state?.persistRoot ?? options.defaultPersistRoot ?? join(projectRoot, ".void");
|
|
272
|
-
const persistRoot = isAbsolute(selectedPersistRoot) ? selectedPersistRoot : resolve(projectRoot, selectedPersistRoot);
|
|
273
|
-
const databaseId = readConfiguredDatabaseId(projectRoot, bindingName) ?? "local";
|
|
274
|
-
return {
|
|
275
|
-
bindingName,
|
|
276
|
-
databaseId,
|
|
277
|
-
persistRoot,
|
|
278
|
-
databasePath: getMiniflareDatabasePath(persistRoot, databaseId)
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
//#endregion
|
|
282
|
-
export { runner_exports as i, writeLocalD1PersistState as n, getMiniflareDatabasePath as r, resolveLocalD1Target as t };
|
|
174
|
+
export { projectUsesVitePlus as a, openSqliteDatabase as i, getAppliedMigrations as n, runMigrations as o, getMiniflareDatabasePath as r, toBetterSqlite3Error as s, getApplicationTables as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { i as openSqliteDatabase, n as getAppliedMigrations, o as runMigrations, r as getMiniflareDatabasePath, t as getApplicationTables } from "./runner-BGVsGgkb.mjs";
|
|
2
|
+
export { getApplicationTables, getAppliedMigrations, getMiniflareDatabasePath, openSqliteDatabase, runMigrations };
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as collectMigrations } from "./validate-tBBN_dXH.mjs";
|
|
1
|
+
import { t as collectMigrations } from "./collect-DXHNWHcT.mjs";
|
|
3
2
|
//#region src/migrations/runner-mysql.ts
|
|
4
|
-
var runner_mysql_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
applyMySqlMigrations: () => applyMySqlMigrations,
|
|
6
|
-
getMySqlAppliedMigrations: () => getMySqlAppliedMigrations,
|
|
7
|
-
readMySqlAppliedMigrations: () => readMySqlAppliedMigrations,
|
|
8
|
-
runMySqlMigrations: () => runMySqlMigrations
|
|
9
|
-
});
|
|
10
3
|
async function readMySqlAppliedMigrations(client) {
|
|
11
4
|
try {
|
|
12
5
|
return (await client.query("SELECT `name` FROM `_void_migrations`")).map((row) => String(row.name));
|
|
@@ -58,4 +51,4 @@ async function runMySqlMigrations(migrationsDir, url) {
|
|
|
58
51
|
}
|
|
59
52
|
}
|
|
60
53
|
//#endregion
|
|
61
|
-
export {
|
|
54
|
+
export { runMySqlMigrations as i, getMySqlAppliedMigrations as n, readMySqlAppliedMigrations as r, applyMySqlMigrations as t };
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as collectMigrations } from "./validate-tBBN_dXH.mjs";
|
|
1
|
+
import { t as collectMigrations } from "./collect-DXHNWHcT.mjs";
|
|
3
2
|
//#region src/migrations/runner-pg.ts
|
|
4
|
-
var runner_pg_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
applyPgMigrations: () => applyPgMigrations,
|
|
6
|
-
getPgAppliedMigrations: () => getPgAppliedMigrations,
|
|
7
|
-
readPgAppliedMigrations: () => readPgAppliedMigrations,
|
|
8
|
-
runPgMigrations: () => runPgMigrations
|
|
9
|
-
});
|
|
10
3
|
async function readPgAppliedMigrations(client) {
|
|
11
4
|
try {
|
|
12
5
|
return (await client.query("SELECT name FROM _void_migrations")).rows.map((row) => String(row.name));
|
|
@@ -66,4 +59,4 @@ async function runPgMigrations(migrationsDir, url) {
|
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
//#endregion
|
|
69
|
-
export {
|
|
62
|
+
export { runPgMigrations as i, getPgAppliedMigrations as n, readPgAppliedMigrations as r, applyPgMigrations as t };
|
package/dist/runtime/ai.mjs
CHANGED
|
@@ -286,7 +286,7 @@ function resolveBackend() {
|
|
|
286
286
|
const aiBindingName = typeof runtimeEnv.__VOID_AI_BINDING === "string" ? runtimeEnv.__VOID_AI_BINDING : "AI";
|
|
287
287
|
const directAi = runtimeEnv[aiBindingName];
|
|
288
288
|
if (directAi) return makeDirectBackend(directAi, runtimeEnv, runtimeEnv.__VOID_AI_GATEWAY);
|
|
289
|
-
throw new Error(`ai: Not available.
|
|
289
|
+
throw new Error(`ai: Not available. Configure a Workers AI binding (env.${aiBindingName}) for direct Cloudflare development or deployment, or connect and link a Void platform.`);
|
|
290
290
|
}
|
|
291
291
|
function unsupported(method) {
|
|
292
292
|
return () => {
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAuthClient: typeof createAuthClient$1;
|
|
4
|
-
type BetterAuthClientInstance = ReturnType<typeof createAuthClient>;
|
|
5
|
-
export declare const auth: BetterAuthClientInstance;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-react-7GFffu8R.mjs";
|
|
2
|
+
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/auth-client-react.ts
|
|
3
|
-
const createAuthClient = createAuthClient$1;
|
|
4
|
-
const auth = createAuthClient$1({ basePath: "/api/auth" });
|
|
5
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-react-CMLwT2xI.mjs";
|
|
6
2
|
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAuthClient: typeof createAuthClient$1;
|
|
4
|
-
type BetterAuthClientInstance = ReturnType<typeof createAuthClient>;
|
|
5
|
-
export declare const auth: BetterAuthClientInstance;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-solid-DyTFL4cq.mjs";
|
|
2
|
+
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/auth-client-solid.ts
|
|
3
|
-
const createAuthClient = createAuthClient$1;
|
|
4
|
-
const auth = createAuthClient$1({ basePath: "/api/auth" });
|
|
5
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-solid-UoreJWZG.mjs";
|
|
6
2
|
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAuthClient: typeof createAuthClient$1;
|
|
4
|
-
type BetterAuthClientInstance = ReturnType<typeof createAuthClient>;
|
|
5
|
-
export declare const auth: BetterAuthClientInstance;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-svelte-zetW0KIH.mjs";
|
|
2
|
+
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/auth-client-svelte.ts
|
|
3
|
-
const createAuthClient = createAuthClient$1;
|
|
4
|
-
const auth = createAuthClient$1({ basePath: "/api/auth" });
|
|
5
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-svelte-Cv_WvrRk.mjs";
|
|
6
2
|
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAuthClient: typeof createAuthClient$1;
|
|
4
|
-
type BetterAuthClientInstance = ReturnType<typeof createAuthClient>;
|
|
5
|
-
export declare const auth: BetterAuthClientInstance;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-vue-bChShbQP.mjs";
|
|
2
|
+
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/auth-client-vue.ts
|
|
3
|
-
const createAuthClient = createAuthClient$1;
|
|
4
|
-
const auth = createAuthClient$1({ basePath: "/api/auth" });
|
|
5
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-vue-CFk7Xbv3.mjs";
|
|
6
2
|
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const createAuthClient: typeof createAuthClient$1;
|
|
4
|
-
type BetterAuthClientInstance = ReturnType<typeof createAuthClient>;
|
|
5
|
-
export declare const auth: BetterAuthClientInstance;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-Bawdj38n.mjs";
|
|
2
|
+
export { auth, createAuthClient };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/runtime/auth-client.ts
|
|
3
|
-
const createAuthClient = createAuthClient$1;
|
|
4
|
-
const auth = createAuthClient$1({ basePath: "/api/auth" });
|
|
5
|
-
//#endregion
|
|
1
|
+
import { n as createAuthClient, t as auth } from "../auth-client-BWBT8HLp.mjs";
|
|
6
2
|
export { auth, createAuthClient };
|
package/dist/runtime/auth.mjs
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HTTPException } from "hono/http-exception";
|
|
3
|
-
//#region src/runtime/auth.ts
|
|
4
|
-
const AUTH_CONTEXT_SYMBOL = Symbol.for("void.authContext.v1");
|
|
5
|
-
const globalWithAuthContext = globalThis;
|
|
6
|
-
const authContext = globalWithAuthContext[AUTH_CONTEXT_SYMBOL] ?? (globalWithAuthContext[AUTH_CONTEXT_SYMBOL] = new AsyncLocalStorage());
|
|
7
|
-
function defineAuth(config) {
|
|
8
|
-
return config;
|
|
9
|
-
}
|
|
10
|
-
function getUser() {
|
|
11
|
-
return authContext.getStore()?.user ?? null;
|
|
12
|
-
}
|
|
13
|
-
function getSession() {
|
|
14
|
-
return authContext.getStore()?.state ?? null;
|
|
15
|
-
}
|
|
16
|
-
function requireAuth(c) {
|
|
17
|
-
const user = c.get("user");
|
|
18
|
-
if (!user) throw new HTTPException(401, { message: "Unauthorized" });
|
|
19
|
-
return user;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
1
|
+
import { a as requireAuth, i as getUser, n as defineAuth, r as getSession, t as authContext } from "../auth-3sGB0zJ1.mjs";
|
|
22
2
|
export { authContext, defineAuth, getSession, getUser, requireAuth };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-
|
|
1
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-BoVwA5Vm.mjs";
|
|
2
2
|
//#region src/runtime/better-auth-mysql.d.ts
|
|
3
3
|
export declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
4
4
|
export declare const createVoidAuth: VoidAuthRuntimeApi["createVoidAuth"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applyMySqlAuthMigrations } from "../auth-migrations-9vif1uj8.mjs";
|
|
2
|
-
import { t as createVoidAuthRuntime } from "../better-auth-shared-
|
|
2
|
+
import { t as createVoidAuthRuntime } from "../better-auth-shared-syGYYmnY.mjs";
|
|
3
3
|
//#region src/runtime/better-auth-mysql.ts
|
|
4
4
|
function resolveConnectionString(env) {
|
|
5
5
|
const connectionString = typeof env.DATABASE_URL === "string" && env.DATABASE_URL.length > 0 ? env.DATABASE_URL : typeof env.HYPERDRIVE?.connectionString === "string" && env.HYPERDRIVE.connectionString.length > 0 ? env.HYPERDRIVE.connectionString : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-
|
|
1
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-BoVwA5Vm.mjs";
|
|
2
2
|
//#region src/runtime/better-auth-pg.d.ts
|
|
3
3
|
export declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
4
4
|
export declare const createVoidAuth: VoidAuthRuntimeApi["createVoidAuth"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as applyPgAuthMigrations } from "../auth-migrations-9vif1uj8.mjs";
|
|
2
|
-
import { t as createVoidAuthRuntime } from "../better-auth-shared-
|
|
2
|
+
import { t as createVoidAuthRuntime } from "../better-auth-shared-syGYYmnY.mjs";
|
|
3
3
|
import { t as disablePgPassFallback } from "../pg-J2HbZIkX.mjs";
|
|
4
4
|
//#region src/runtime/better-auth-pg.ts
|
|
5
5
|
function resolveConnectionString(env) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-
|
|
1
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-BoVwA5Vm.mjs";
|
|
2
2
|
//#region src/runtime/better-auth.d.ts
|
|
3
3
|
export declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
4
4
|
export declare const createVoidAuth: VoidAuthRuntimeApi["createVoidAuth"];
|