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.
Files changed (296) hide show
  1. package/README.md +2 -2
  2. package/dist/agents-gni4eqBu.mjs +111 -0
  3. package/dist/auth-3sGB0zJ1.mjs +22 -0
  4. package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
  5. package/dist/auth-CAw7zHqj.mjs +2 -0
  6. package/dist/auth-client-BWBT8HLp.mjs +6 -0
  7. package/dist/auth-client-Bawdj38n.d.mts +7 -0
  8. package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
  9. package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
  10. package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
  11. package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
  12. package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
  13. package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
  14. package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
  15. package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
  16. package/dist/{auth-cmd-CzwquNiP.mjs → auth-cmd-g_ymMkUe.mjs} +5 -5
  17. package/dist/{auth-link-ElDTgF7j.mjs → auth-link-DFvxIyZi.mjs} +5 -5
  18. package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
  19. package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
  20. package/dist/{build-cmd-BpJe6boP.mjs → build-cmd-wJAv808h.mjs} +6 -4
  21. package/dist/{cache-D98YTqeE.mjs → cache-Be0Fu5Ka.mjs} +6 -4
  22. package/dist/{cancel-deploy-CPbEQLMG.mjs → cancel-deploy-BgmyOwhe.mjs} +5 -3
  23. package/dist/cf-access-rAZxzMkL.mjs +181 -0
  24. package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
  25. package/dist/cli/cf-compat.d.mts +1 -0
  26. package/dist/cli/cf-compat.mjs +944 -0
  27. package/dist/cli/cli.mjs +60 -38
  28. package/dist/cli/env-schema-probe.mjs +3 -3
  29. package/dist/client-DAAivdid.mjs +2 -0
  30. package/dist/{client-BQBrZoCX.mjs → client-PdAJ-F0t.mjs} +6 -12
  31. package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
  32. package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
  33. package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
  34. package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
  35. package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
  36. package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
  37. package/dist/collect-DAUItMDS.mjs +2 -0
  38. package/dist/collect-DXHNWHcT.mjs +48 -0
  39. package/dist/config--T87TD8T.mjs +2 -0
  40. package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
  41. package/dist/config-DDIFxQYx.mjs +2 -0
  42. package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
  43. package/dist/config-DywxBLQC.d.mts +185 -0
  44. package/dist/config-entry.d.mts +6 -0
  45. package/dist/config-entry.mjs +7 -0
  46. package/dist/config-uP7ZDtVZ.mjs +21 -0
  47. package/dist/config-write-y3CBI_ux.mjs +60 -0
  48. package/dist/{connect-WCQZ_u3m.mjs → connect-LnvW4HKx.mjs} +8 -6
  49. package/dist/{create-project-D0oXA090.mjs → create-project-BZBl_gQ0.mjs} +8 -23
  50. package/dist/create-project-JV9-6ICF.mjs +2 -0
  51. package/dist/database-provider-Cx525bwX.mjs +6 -0
  52. package/dist/database-provider.mjs +1 -5
  53. package/dist/{db-DJ-9qs3S.mjs → db-Mzv88E1C.mjs} +48 -44
  54. package/dist/{delete-BZ4-WaGm.mjs → delete-Ri6JemSU.mjs} +6 -4
  55. package/dist/deploy-DAH2-m_-.mjs +2 -0
  56. package/dist/{deploy-BAhhcg5q.mjs → deploy-DEsMVrCY.mjs} +796 -198
  57. package/dist/discover-BBzDZe_o.mjs +2 -0
  58. package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
  59. package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
  60. package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
  61. package/dist/dist-C5fND3R0.mjs +2 -0
  62. package/dist/dist-D7-nEOXi.mjs +2 -0
  63. package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
  64. package/dist/{domain-BxAyhxXN.mjs → domain-BA37Ye7T.mjs} +7 -5
  65. package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
  66. package/dist/{email-Bj7Cvdwp.mjs → email-C5NsxrQG.mjs} +14 -12
  67. package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
  68. package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
  69. package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
  70. package/dist/{env-DP_EErve.mjs → env-U_ohASB0.mjs} +9 -7
  71. package/dist/env-Yz4HcvHs.mjs +78 -0
  72. package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
  73. package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
  74. package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
  75. package/dist/env-validation-DIDGM7h4.mjs +2 -0
  76. package/dist/fetch-CXDChK7B.mjs +18 -0
  77. package/dist/fetch-_SeGZao9.d.mts +57 -0
  78. package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
  79. package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
  80. package/dist/gen-B87rlalt.mjs +2 -0
  81. package/dist/{gen-B_wPnVTK.mjs → gen-pg-Ojg8Y.mjs} +13 -11
  82. package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
  83. package/dist/{github-cmd-C-z_xRrQ.mjs → github-cmd-DsrkweIl.mjs} +6 -4
  84. package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
  85. package/dist/handler-DghKr6dU.mjs +150 -0
  86. package/dist/head-D_QRR5Yd.mjs +112 -0
  87. package/dist/head-client-DzmJGN4C.mjs +90 -0
  88. package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
  89. package/dist/help-B403BLBB.mjs +2 -0
  90. package/dist/{help-CwOX-zmI.mjs → help-sBhFH6pi.mjs} +17 -12
  91. package/dist/index.d.mts +2 -20
  92. package/dist/index.mjs +116 -60
  93. package/dist/{init-BGktCXgA.mjs → init-C--Yyj1b.mjs} +49 -50
  94. package/dist/{link-D2kbqhWb.mjs → link-BC-mNG9-.mjs} +7 -5
  95. package/dist/{list-CvkK_G7k.mjs → list-DHU1Wj6c.mjs} +7 -5
  96. package/dist/live-CB1y5IuC.mjs +411 -0
  97. package/dist/live-CKiJilLr.d.mts +105 -0
  98. package/dist/local-d1-DzykTWY8.mjs +104 -0
  99. package/dist/login-BwiopVdg.mjs +2 -0
  100. package/dist/{login-WIjNc77c.mjs → login-jKe_0QZL.mjs} +6 -11
  101. package/dist/{logs-dLUFCapG.mjs → logs-BG11f5PR.mjs} +6 -4
  102. package/dist/migrate-BV8qHiCb.mjs +285 -0
  103. package/dist/migrate-BXY3B3m7.mjs +2 -0
  104. package/dist/migration-handler-DM4clYj5.d.mts +51 -0
  105. package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
  106. package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
  107. package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
  108. package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
  109. package/dist/{operator-cmd-CKJ7xIRs.mjs → operator-cmd-BwAS2XZt.mjs} +6 -6
  110. package/dist/output-CCH48AMM.mjs +146 -0
  111. package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
  112. package/dist/pages/client.d.mts +5 -2
  113. package/dist/pages/client.mjs +5 -3
  114. package/dist/pages/head-client.mjs +1 -89
  115. package/dist/pages/head.mjs +1 -111
  116. package/dist/pages/index.d.mts +2 -3
  117. package/dist/pages/index.mjs +7 -7
  118. package/dist/pages/islands-plugin.mjs +2 -2
  119. package/dist/pages/prefetch.d.mts +2 -30
  120. package/dist/pages/prefetch.mjs +1 -89
  121. package/dist/pages/protocol.d.mts +2 -2
  122. package/dist/pages/protocol.mjs +3 -3
  123. package/dist/pages/serialize.d.mts +2 -9
  124. package/dist/pages/serialize.mjs +1 -13
  125. package/dist/plan-BEZ8VJW0.mjs +256 -0
  126. package/dist/plan-DpuOr14e.mjs +2 -0
  127. package/dist/{platform-auth-config-CdVWRRJr.mjs → platform-auth-config-C-hv-_Ok.mjs} +6 -6
  128. package/dist/{platform-auth-protection-Drl0qhrn.mjs → platform-auth-protection-DjTE5Hj-.mjs} +7 -5
  129. package/dist/{platform-auth-recovery-CmKEWpDo.mjs → platform-auth-recovery-Cr0r8TEb.mjs} +6 -5
  130. package/dist/{platform-cmd-5q_k56xS.mjs → platform-cmd-0tEh2ZtA.mjs} +8 -5
  131. package/dist/platform-cmd-DE6dw45v.mjs +2 -0
  132. package/dist/{platform-domain-4GiDlcqx.mjs → platform-domain-B_7x6Iqx.mjs} +4 -3
  133. package/dist/platform-lifecycle-Dhx9Pnub.mjs +2 -0
  134. package/dist/{platform-lifecycle-R9xAxvtG.mjs → platform-lifecycle-Di0LbhPM.mjs} +208 -37
  135. package/dist/platform-management-B9LUtMt9.mjs +2 -0
  136. package/dist/{platform-management-BfWsXHEW.mjs → platform-management-eaiaU3uM.mjs} +8 -5
  137. package/dist/{platform-recovery-CbK-I1FB.mjs → platform-recovery-BxfA8E5C.mjs} +3 -3
  138. package/dist/platform-registry-BJbgZLS1.mjs +431 -0
  139. package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
  140. package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
  141. package/dist/prefetch-Ce6la4EI.d.mts +31 -0
  142. package/dist/prepare-D4CkM3_v.mjs +2 -0
  143. package/dist/{prepare-blNRQvQl.mjs → prepare-_T-Haxrr.mjs} +3 -2
  144. package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
  145. package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
  146. package/dist/prerender-render.mjs +1 -110
  147. package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
  148. package/dist/project-BEBFDFLz.mjs +2 -0
  149. package/dist/project-CWNIPoXc.mjs +209 -0
  150. package/dist/{project-cmd-CTdmnzvc.mjs → project-cmd-DrnRJdep.mjs} +18 -16
  151. package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
  152. package/dist/project-slug-23TpquG4.mjs +8 -0
  153. package/dist/project-slug-DofjTFd-.mjs +2 -0
  154. package/dist/{project-team-CGxsQe3_.mjs → project-team-CzRbO_kA.mjs} +6 -4
  155. package/dist/{project-token-Cirx7uwZ.mjs → project-token-Bwxjf4y6.mjs} +6 -4
  156. package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
  157. package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
  158. package/dist/providers-BNKRacMr.d.mts +7 -0
  159. package/dist/provision-CNgEBkVA.mjs +3 -0
  160. package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
  161. package/dist/queues-BWKt1Xo4.d.mts +7 -0
  162. package/dist/{requests-4Nq59hOr.mjs → requests-DwrqUQZ8.mjs} +5 -3
  163. package/dist/resolve-project-BTotl8Nn.mjs +2 -0
  164. package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
  165. package/dist/response-Tn7rU0MV.mjs +30 -0
  166. package/dist/{rollback-Dr7u0Ljx.mjs → rollback-B4tFWmkN.mjs} +6 -4
  167. package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
  168. package/dist/route-types-Id82-veQ.mjs +280 -0
  169. package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
  170. package/dist/runner-CQs_cDSG.mjs +2 -0
  171. package/dist/runner-mysql-1o47achK.mjs +2 -0
  172. package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
  173. package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
  174. package/dist/runner-pg-D7z01mQS.mjs +2 -0
  175. package/dist/runtime/ai.mjs +1 -1
  176. package/dist/runtime/auth-client-react.d.mts +2 -6
  177. package/dist/runtime/auth-client-react.mjs +1 -5
  178. package/dist/runtime/auth-client-solid.d.mts +2 -6
  179. package/dist/runtime/auth-client-solid.mjs +1 -5
  180. package/dist/runtime/auth-client-svelte.d.mts +2 -6
  181. package/dist/runtime/auth-client-svelte.mjs +1 -5
  182. package/dist/runtime/auth-client-vue.d.mts +2 -6
  183. package/dist/runtime/auth-client-vue.mjs +1 -5
  184. package/dist/runtime/auth-client.d.mts +2 -6
  185. package/dist/runtime/auth-client.mjs +1 -5
  186. package/dist/runtime/auth.mjs +1 -21
  187. package/dist/runtime/better-auth-mysql.d.mts +1 -1
  188. package/dist/runtime/better-auth-mysql.mjs +1 -1
  189. package/dist/runtime/better-auth-pg.d.mts +1 -1
  190. package/dist/runtime/better-auth-pg.mjs +1 -1
  191. package/dist/runtime/better-auth.d.mts +1 -1
  192. package/dist/runtime/better-auth.mjs +1 -1
  193. package/dist/runtime/client-react.d.mts +3 -3
  194. package/dist/runtime/client-react.mjs +3 -3
  195. package/dist/runtime/client-solid.d.mts +3 -3
  196. package/dist/runtime/client-solid.mjs +3 -3
  197. package/dist/runtime/client-svelte.d.mts +3 -3
  198. package/dist/runtime/client-svelte.mjs +3 -3
  199. package/dist/runtime/client-vue.d.mts +3 -3
  200. package/dist/runtime/client-vue.mjs +3 -3
  201. package/dist/runtime/client.d.mts +3 -3
  202. package/dist/runtime/client.mjs +3 -3
  203. package/dist/runtime/db.mjs +1 -1
  204. package/dist/runtime/durable.mjs +1 -1
  205. package/dist/runtime/email/testing.mjs +1 -1
  206. package/dist/runtime/env-helpers.mjs +1 -135
  207. package/dist/runtime/env-public-client.mjs +1 -1
  208. package/dist/runtime/env-public.mjs +2 -2
  209. package/dist/runtime/env.mjs +1 -77
  210. package/dist/runtime/fetch-stream.d.mts +2 -49
  211. package/dist/runtime/fetch-stream.mjs +2 -80
  212. package/dist/runtime/fetch.d.mts +2 -57
  213. package/dist/runtime/fetch.mjs +2 -17
  214. package/dist/runtime/handler.d.mts +1 -1
  215. package/dist/runtime/handler.mjs +1 -149
  216. package/dist/runtime/kv.mjs +1 -1
  217. package/dist/runtime/live-client.d.mts +1 -1
  218. package/dist/runtime/live-server.mjs +2 -2
  219. package/dist/runtime/live.d.mts +2 -104
  220. package/dist/runtime/live.mjs +1 -410
  221. package/dist/runtime/migration-handler-mysql.d.mts +1 -1
  222. package/dist/runtime/migration-handler-pg.d.mts +1 -1
  223. package/dist/runtime/migration-handler.d.mts +2 -50
  224. package/dist/runtime/queues.d.mts +2 -6
  225. package/dist/runtime/queues.mjs +1 -1
  226. package/dist/runtime/response.mjs +1 -29
  227. package/dist/runtime/sandbox.mjs +1 -1
  228. package/dist/runtime/sse.mjs +1 -171
  229. package/dist/runtime/storage.mjs +1 -1
  230. package/dist/runtime/validator.d.mts +1 -1
  231. package/dist/runtime/validator.mjs +1 -71
  232. package/dist/runtime/ws-server.d.mts +2 -2
  233. package/dist/runtime/ws-server.mjs +2 -2
  234. package/dist/runtime/ws.d.mts +2 -121
  235. package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
  236. package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
  237. package/dist/{secret-AcPi-FoA.mjs → secret-UtrRjhEO.mjs} +8 -6
  238. package/dist/serialize-BPvnNQuA.mjs +14 -0
  239. package/dist/serialize-CfSwWfF2.d.mts +10 -0
  240. package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
  241. package/dist/sse-BaC1jXko.mjs +172 -0
  242. package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-BuGYkAkC.mjs} +2 -1
  243. package/dist/sveltekit.d.mts +2 -1
  244. package/dist/sveltekit.mjs +3 -2
  245. package/dist/validate-DqJ33oHj.mjs +2 -0
  246. package/dist/validate-qNhV00PD.mjs +180 -0
  247. package/dist/validator-BTOu0fB0.mjs +72 -0
  248. package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
  249. package/dist/ws-BwcqizuH.d.mts +122 -0
  250. package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
  251. package/package.json +19 -8
  252. package/skills/void/SKILL.md +6 -4
  253. package/skills/void/docs/guide/ai.md +3 -3
  254. package/skills/void/docs/guide/app-types.md +12 -11
  255. package/skills/void/docs/guide/auth.md +2 -2
  256. package/skills/void/docs/guide/database/d1.md +1 -1
  257. package/skills/void/docs/guide/database/mysql.md +1 -1
  258. package/skills/void/docs/guide/database/postgresql.md +3 -3
  259. package/skills/void/docs/guide/deployment.md +8 -15
  260. package/skills/void/docs/guide/durable-state.md +2 -2
  261. package/skills/void/docs/guide/edge/headers.md +3 -3
  262. package/skills/void/docs/guide/edge/prerendering.md +1 -1
  263. package/skills/void/docs/guide/edge/redirects.md +4 -4
  264. package/skills/void/docs/guide/edge/revalidation.md +6 -6
  265. package/skills/void/docs/guide/edge/rewrites.md +28 -27
  266. package/skills/void/docs/guide/edge/static-assets.md +1 -1
  267. package/skills/void/docs/guide/email.md +60 -66
  268. package/skills/void/docs/guide/env-migration.md +1 -1
  269. package/skills/void/docs/guide/index.md +15 -41
  270. package/skills/void/docs/guide/pages-routing/head.md +1 -1
  271. package/skills/void/docs/guide/platform/administration/access.md +13 -5
  272. package/skills/void/docs/guide/platform/administration/projects.md +3 -1
  273. package/skills/void/docs/guide/platform/installation/ci.md +3 -0
  274. package/skills/void/docs/guide/platform/installation/credentials.md +15 -5
  275. package/skills/void/docs/guide/platform/installation/prerequisites.md +2 -0
  276. package/skills/void/docs/guide/platform/installation/setup.md +1 -1
  277. package/skills/void/docs/guide/quickstart.md +11 -78
  278. package/skills/void/docs/guide/remote-dev.md +2 -2
  279. package/skills/void/docs/guide/sandboxes.md +1 -1
  280. package/skills/void/docs/guide/ssg.md +1 -1
  281. package/skills/void/docs/guide/websockets.md +1 -1
  282. package/skills/void/docs/index.md +17 -17
  283. package/skills/void/docs/integrations/cloudflare.md +91 -96
  284. package/skills/void/docs/integrations/frameworks/analog.md +14 -9
  285. package/skills/void/docs/integrations/frameworks/astro.md +14 -10
  286. package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
  287. package/skills/void/docs/integrations/frameworks/overview.md +35 -29
  288. package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
  289. package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
  290. package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
  291. package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
  292. package/skills/void/docs/reference/api.md +21 -4
  293. package/skills/void/docs/reference/cli.md +40 -25
  294. package/skills/void/docs/reference/config.md +58 -35
  295. package/skills/void/docs/reference/structure.md +2 -2
  296. package/dist/validate-tBBN_dXH.mjs +0 -505
@@ -1,9 +1,8 @@
1
- import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.mjs";
2
- import { l as resolve, n as dirname, o as join } from "./dist-BrsS7cai.mjs";
1
+ import { a as join, n as dirname, u as resolve } from "./dist-4WkAWhWx.mjs";
3
2
  import { i as voidWarn } from "./log-ChfPKsVd.mjs";
4
- import { t as findEnvFile } from "./env-types-BNPhro-M.mjs";
5
- import { a as loadLocalEnv, i as isClientEnvKey, r as findLegacyEnvFiles } from "./env-DBKmK4vc.mjs";
6
- import { o as resolveWranglerArgv } from "./preset-lAy0B0BQ.mjs";
3
+ import { t as findEnvFile } from "./env-types-CWDtqHgw.mjs";
4
+ import { a as loadLocalEnv, i as isClientEnvKey, r as findLegacyEnvFiles } from "./env-DX_v-Q-v.mjs";
5
+ import { o as resolveWranglerArgv } from "./preset-Dowh9tTt.mjs";
7
6
  import { existsSync, readFileSync } from "node:fs";
8
7
  import { pathToFileURL } from "node:url";
9
8
  import { spawn } from "node:child_process";
@@ -71,6 +70,17 @@ async function loadUserEnvFile(envFile) {
71
70
  }
72
71
  }
73
72
  //#endregion
73
+ //#region src/cli/generated-wrangler-config.ts
74
+ /** Parse a generated Wrangler JSON/JSONC config without accepting a partial parse. */
75
+ function readGeneratedWranglerConfigFile(path) {
76
+ const raw = readFileSync(path, "utf8");
77
+ const content = raw.startsWith("") ? raw.slice(1) : raw;
78
+ const errors = [];
79
+ const parsed = parse(content, errors, { allowTrailingComma: true });
80
+ if (errors.length > 0 || parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Invalid Wrangler JSON/JSONC config.");
81
+ return parsed;
82
+ }
83
+ //#endregion
74
84
  //#region src/cli/env-validation.ts
75
85
  /**
76
86
  * Shared env-schema validation for CLI commands.
@@ -82,25 +92,6 @@ async function loadUserEnvFile(envFile) {
82
92
  * Used by both `void deploy` (hard error on missing prod env) and
83
93
  * `void env check` (CI/pre-push validation).
84
94
  */
85
- var env_validation_exports = /* @__PURE__ */ __exportAll({
86
- SelfHostEnvValidationError: () => SelfHostEnvValidationError,
87
- SelfHostFirstDeployError: () => SelfHostFirstDeployError,
88
- SelfHostSchemaError: () => SelfHostSchemaError,
89
- SelfHostSecretListError: () => SelfHostSecretListError,
90
- computeInvalidEmittedKeys: () => computeInvalidEmittedKeys,
91
- createDefaultSecretListRunner: () => createDefaultSecretListRunner,
92
- deriveSelfHostEnvContextFromVars: () => deriveSelfHostEnvContextFromVars,
93
- deriveSelfHostSchemaFacts: () => deriveSelfHostSchemaFacts,
94
- dischargeSelfHostEnvContext: () => dischargeSelfHostEnvContext,
95
- fetchRemoteSecretNames: () => fetchRemoteSecretNames,
96
- formatEnvReport: () => formatEnvReport,
97
- listSelfHostSecretNames: () => listSelfHostSecretNames,
98
- readEmittedWorkerVars: () => readEmittedWorkerVars,
99
- secretListEnv: () => secretListEnv,
100
- selfHostSchemaFailureMessage: () => selfHostSchemaFailureMessage,
101
- validateProdEnv: () => validateProdEnv,
102
- validateSecretValues: () => validateSecretValues
103
- });
104
95
  /**
105
96
  * Validate plaintext while it is still available to `void secret put/sync`.
106
97
  * Existing remote values remain unreadable and are validated again at worker boot.
@@ -430,12 +421,12 @@ function readGeneratedWranglerConfig(root) {
430
421
  try {
431
422
  return {
432
423
  ok: true,
433
- config: JSON.parse(readFileSync(redirectedPath, "utf-8"))
424
+ config: readGeneratedWranglerConfigFile(redirectedPath)
434
425
  };
435
426
  } catch {
436
427
  return {
437
428
  ok: false,
438
- reason: `generated wrangler config ${redirectedPath} is not valid JSON.`
429
+ reason: `generated wrangler config ${redirectedPath} is not valid JSON/JSONC.`
439
430
  };
440
431
  }
441
432
  }
@@ -794,7 +785,7 @@ function secretListArgs(configPath) {
794
785
  */
795
786
  function isWorkerNotFoundOutput(output) {
796
787
  const normalized = output.replace(/\s+/g, " ");
797
- return /Worker ".*?"(?: \(env: [^)]*\))? not found\./.test(normalized) && normalized.includes("If this is a new Worker, run `wrangler deploy` first to create it.") && normalized.includes("Otherwise, check that the Worker name is correct and you're logged into the right account.");
788
+ return /Worker ".*?"(?: \(env: [^)]*\))? not found\./.test(normalized) && (normalized.includes("[code: 10007]") || normalized.includes("[code: 10090]") || normalized.includes("If this is a new Worker, run `wrangler deploy` first to create it.") && normalized.includes("Otherwise, check that the Worker name is correct and you're logged into the right account."));
798
789
  }
799
790
  /**
800
791
  * Build the THROWN message for a wrangler-run failure from the structural
@@ -1014,4 +1005,4 @@ function secretListEnv(accountId, platform) {
1014
1005
  return env;
1015
1006
  }
1016
1007
  //#endregion
1017
- export { deriveSelfHostEnvContextFromVars as a, fetchRemoteSecretNames as c, readEmittedWorkerVars as d, selfHostSchemaFailureMessage as f, loadUserEnvFile as h, SelfHostSecretListError as i, formatEnvReport as l, validateSecretValues as m, SelfHostFirstDeployError as n, dischargeSelfHostEnvContext as o, validateProdEnv as p, SelfHostSchemaError as r, env_validation_exports as s, SelfHostEnvValidationError as t, listSelfHostSecretNames as u };
1008
+ export { validateSecretValues as _, computeInvalidEmittedKeys as a, deriveSelfHostSchemaFacts as c, formatEnvReport as d, listSelfHostSecretNames as f, validateProdEnv as g, selfHostSchemaFailureMessage as h, SelfHostSecretListError as i, dischargeSelfHostEnvContext as l, secretListEnv as m, SelfHostFirstDeployError as n, createDefaultSecretListRunner as o, readEmittedWorkerVars as p, SelfHostSchemaError as r, deriveSelfHostEnvContextFromVars as s, SelfHostEnvValidationError as t, fetchRemoteSecretNames as u, readGeneratedWranglerConfigFile as v, loadUserEnvFile as y };
@@ -0,0 +1,2 @@
1
+ import { a as computeInvalidEmittedKeys, c as deriveSelfHostSchemaFacts, p as readEmittedWorkerVars, r as SelfHostSchemaError } from "./env-validation-BsFEXps5.mjs";
2
+ export { SelfHostSchemaError, computeInvalidEmittedKeys, deriveSelfHostSchemaFacts, readEmittedWorkerVars };
@@ -0,0 +1,18 @@
1
+ import { n as ofetch } from "./fetch-error-Dj3crt0e.mjs";
2
+ //#region src/runtime/fetch.ts
3
+ async function fetch(path, options) {
4
+ let url = path;
5
+ if (options?.params) for (const [key, value] of Object.entries(options.params)) url = url.replace(`:${key}`, encodeURIComponent(value));
6
+ return ofetch(url, {
7
+ method: options?.method ?? "GET",
8
+ body: options?.body,
9
+ query: options?.query,
10
+ headers: options?.headers,
11
+ signal: options?.signal,
12
+ baseURL: options?.baseURL,
13
+ retry: options?.retry,
14
+ timeout: options?.timeout
15
+ });
16
+ }
17
+ //#endregion
18
+ export { fetch as t };
@@ -0,0 +1,57 @@
1
+ import { RouteMap } from "void/routes";
2
+ //#region src/runtime/fetch.d.ts
3
+ type MethodsOf<P extends keyof RouteMap> = keyof RouteMap[P] & string;
4
+ type DefaultMethod<P extends keyof RouteMap> = "GET" extends MethodsOf<P> ? "GET" : never;
5
+ type RouteEntry<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteMap[P][M] extends {
6
+ input: infer I;
7
+ output: infer O;
8
+ } ? {
9
+ input: I;
10
+ output: O;
11
+ } : {
12
+ input: {};
13
+ output: unknown;
14
+ };
15
+ type OutputOf<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteEntry<P, M>["output"];
16
+ type InputOf<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteEntry<P, M>["input"];
17
+ type BodyOption<I> = "body" extends keyof I ? {
18
+ body: I["body" & keyof I];
19
+ } : {
20
+ body?: Record<string, unknown> | BodyInit | null;
21
+ };
22
+ type QueryOption<I> = "query" extends keyof I ? {
23
+ query: I["query" & keyof I];
24
+ } : {
25
+ query?: Record<string, string>;
26
+ };
27
+ type ParamsOption<I> = "params" extends keyof I ? {
28
+ params: I["params" & keyof I];
29
+ } : {
30
+ params?: Record<string, string>;
31
+ };
32
+ type HasRequiredInput<P extends keyof RouteMap, M extends MethodsOf<P>> = "body" extends keyof InputOf<P, M> ? true : "query" extends keyof InputOf<P, M> ? true : "params" extends keyof InputOf<P, M> ? true : false;
33
+ type FetchOptions<P extends keyof RouteMap, M extends MethodsOf<P>> = BodyOption<InputOf<P, M>> & QueryOption<InputOf<P, M>> & ParamsOption<InputOf<P, M>> & {
34
+ method?: M;
35
+ headers?: HeadersInit;
36
+ signal?: AbortSignal;
37
+ baseURL?: string;
38
+ retry?: number;
39
+ timeout?: number;
40
+ };
41
+ /**
42
+ * Typed fetch client for Void API routes.
43
+ *
44
+ * Built on top of ofetch. Supports baseURL, retry, timeout, and all
45
+ * ofetch features while providing full route type safety.
46
+ *
47
+ * ```ts
48
+ * import { fetch } from "void/client";
49
+ *
50
+ * const users = await fetch("/api/users"); // typed!
51
+ * const user = await fetch("/api/users/:id", { params: { id: "1" } });
52
+ * ```
53
+ */
54
+ declare function fetch<P extends keyof RouteMap & string>(path: HasRequiredInput<P, DefaultMethod<P>> extends false ? P : never): Promise<OutputOf<P, DefaultMethod<P>>>;
55
+ declare function fetch<P extends keyof RouteMap & string, M extends MethodsOf<P> = DefaultMethod<P>>(path: P, options: FetchOptions<P, M>): Promise<OutputOf<P, M>>;
56
+ //#endregion
57
+ export { fetch as t };
@@ -0,0 +1,81 @@
1
+ import { n as ofetch } from "./fetch-error-Dj3crt0e.mjs";
2
+ //#region src/runtime/fetch-stream.ts
3
+ /**
4
+ * Consume an SSE endpoint as an async generator of text chunks.
5
+ *
6
+ * Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
7
+ * and plain text SSE (`data: some text`).
8
+ *
9
+ * ```ts
10
+ * import { fetchStream } from "void/client";
11
+ *
12
+ * for await (const chunk of fetchStream("/api/ai/chat", {
13
+ * method: "POST",
14
+ * body: { messages: [{ role: "user", content: "Hello" }] },
15
+ * })) {
16
+ * output += chunk;
17
+ * }
18
+ * ```
19
+ *
20
+ * @yields {string} Text chunks from SSE data frames.
21
+ */
22
+ async function* fetchStream(path, options) {
23
+ let url = path;
24
+ if (options?.params) for (const [key, value] of Object.entries(options.params)) url = url.replace(`:${key}`, encodeURIComponent(value));
25
+ const body = (await ofetch.raw(url, {
26
+ method: options?.method ?? "POST",
27
+ body: options?.body,
28
+ query: options?.query,
29
+ headers: options?.headers,
30
+ signal: options?.signal,
31
+ baseURL: options?.baseURL,
32
+ responseType: "stream"
33
+ }))._data;
34
+ if (!body) return;
35
+ const reader = body.getReader();
36
+ const decoder = new TextDecoder();
37
+ let buffer = "";
38
+ try {
39
+ while (true) {
40
+ const { done, value } = await reader.read();
41
+ if (done) break;
42
+ buffer += decoder.decode(value, { stream: true });
43
+ const lines = buffer.split("\n");
44
+ buffer = lines.pop();
45
+ for (const line of lines) {
46
+ const trimmed = line.trim();
47
+ if (!trimmed || trimmed.startsWith(":")) continue;
48
+ if (trimmed.startsWith("data: ")) {
49
+ const data = trimmed.slice(6);
50
+ if (data === "[DONE]") return;
51
+ try {
52
+ const parsed = JSON.parse(data);
53
+ if (typeof parsed.response === "string") {
54
+ yield parsed.response;
55
+ continue;
56
+ }
57
+ if ("response" in parsed) continue;
58
+ } catch {}
59
+ yield data;
60
+ }
61
+ }
62
+ }
63
+ if (buffer.trim()) {
64
+ const trimmed = buffer.trim();
65
+ if (trimmed.startsWith("data: ")) {
66
+ const data = trimmed.slice(6);
67
+ if (data !== "[DONE]") try {
68
+ const parsed = JSON.parse(data);
69
+ if (typeof parsed.response === "string") yield parsed.response;
70
+ else if (!("response" in parsed)) yield data;
71
+ } catch {
72
+ yield data;
73
+ }
74
+ }
75
+ }
76
+ } finally {
77
+ reader.releaseLock();
78
+ }
79
+ }
80
+ //#endregion
81
+ export { fetchStream as t };
@@ -0,0 +1,49 @@
1
+ import { RouteMap } from "void/routes";
2
+ //#region src/runtime/fetch-stream.d.ts
3
+ type MethodsOf<P extends keyof RouteMap> = keyof RouteMap[P] & string;
4
+ type InputOf<P extends keyof RouteMap, M extends MethodsOf<P>> = RouteMap[P][M] extends {
5
+ input: infer I;
6
+ } ? I : {};
7
+ type BodyOption<I> = "body" extends keyof I ? {
8
+ body: I["body" & keyof I];
9
+ } : {
10
+ body?: Record<string, unknown> | BodyInit | null;
11
+ };
12
+ type QueryOption<I> = "query" extends keyof I ? {
13
+ query: I["query" & keyof I];
14
+ } : {
15
+ query?: Record<string, string>;
16
+ };
17
+ type ParamsOption<I> = "params" extends keyof I ? {
18
+ params: I["params" & keyof I];
19
+ } : {
20
+ params?: Record<string, string>;
21
+ };
22
+ type StreamOptions<P extends keyof RouteMap, M extends MethodsOf<P>> = BodyOption<InputOf<P, M>> & QueryOption<InputOf<P, M>> & ParamsOption<InputOf<P, M>> & {
23
+ method?: M;
24
+ headers?: HeadersInit;
25
+ signal?: AbortSignal;
26
+ baseURL?: string;
27
+ };
28
+ /**
29
+ * Consume an SSE endpoint as an async generator of text chunks.
30
+ *
31
+ * Parses Workers AI SSE format (`data: {"response":"chunk"}` + `data: [DONE]`)
32
+ * and plain text SSE (`data: some text`).
33
+ *
34
+ * ```ts
35
+ * import { fetchStream } from "void/client";
36
+ *
37
+ * for await (const chunk of fetchStream("/api/ai/chat", {
38
+ * method: "POST",
39
+ * body: { messages: [{ role: "user", content: "Hello" }] },
40
+ * })) {
41
+ * output += chunk;
42
+ * }
43
+ * ```
44
+ *
45
+ * @yields {string} Text chunks from SSE data frames.
46
+ */
47
+ declare function fetchStream<P extends keyof RouteMap & string, M extends MethodsOf<P> = "POST" extends MethodsOf<P> ? "POST" : MethodsOf<P>>(path: P, options?: StreamOptions<P, M>): AsyncGenerator<string, void, undefined>;
48
+ //#endregion
49
+ export { fetchStream as t };
@@ -0,0 +1,2 @@
1
+ import { r as runGenCommand } from "./gen-pg-Ojg8Y.mjs";
2
+ export { runGenCommand };
@@ -1,11 +1,13 @@
1
- import { c as relative, n as dirname, o as join } from "./dist-BrsS7cai.mjs";
2
- import { A as outro, C as cancel, D as log, E as intro, I as isCancel, M as select, r as cliTitle } from "./output-B0cfNSx5.mjs";
3
- import { n as readProjectPaths } from "./project-paths-SK8nMHPp.mjs";
4
- import { c as getDatabaseDialect, f as readConfig } from "./config-uNGuFsI2.mjs";
5
- import { n as ensureProjectTsconfig } from "./project-tsconfig-Ql2XsSQp.mjs";
6
- import { c as collectMigrations, n as listDrizzleArtifacts, t as assertJournalCoherence, u as readJournal } from "./validate-tBBN_dXH.mjs";
7
- import { n as writeDrizzleConfig } from "./config-NOG_U1aK.mjs";
8
- import { t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-DxSInkzL.mjs";
1
+ import { a as join, l as relative, n as dirname } from "./dist-4WkAWhWx.mjs";
2
+ import { r as cliTitle } from "./output-CCH48AMM.mjs";
3
+ import { n as readProjectPaths } from "./project-paths-CKQ-Q5JS.mjs";
4
+ import { m as readConfig, u as getDatabaseDialect } from "./config-Dxr6cTXn.mjs";
5
+ import { n as ensureProjectTsconfig } from "./project-tsconfig-CwfqUnVp.mjs";
6
+ import { n as readJournal, t as collectMigrations } from "./collect-DXHNWHcT.mjs";
7
+ import { I as select, O as intro, P as outro, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
8
+ import { t as writeDrizzleConfig } from "./config-BSe70f4T.mjs";
9
+ import { r as listDrizzleArtifacts, t as assertJournalCoherence } from "./validate-qNhV00PD.mjs";
10
+ import { t as buildDrizzleKitSpawnEnv } from "./yarn-pnp-CVEc3gE7.mjs";
9
11
  import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
10
12
  import { fileURLToPath } from "node:url";
11
13
  import { spawnSync } from "node:child_process";
@@ -491,8 +493,8 @@ function runMigration(root, name) {
491
493
  }
492
494
  const configDialect = getDatabaseDialect(readConfig(root));
493
495
  if (configDialect !== journalDialect) {
494
- log.error(`db/migrations/meta/_journal.json was generated for ${journalDialect}, but void.json is configured for ${configDialect}.`);
495
- log.error(`Generating a new custom migration now would append a snapshot in the wrong dialect. Revert void.json's \`database\` field to ${journalDialect}, or drop db/migrations/ and regenerate from scratch.`);
496
+ log.error(`db/migrations/meta/_journal.json was generated for ${journalDialect}, but void.config.ts is configured for ${configDialect}.`);
497
+ log.error(`Generating a new custom migration now would append a snapshot in the wrong dialect. Revert void.config.ts's \`database\` field to ${journalDialect}, or drop db/migrations/ and regenerate from scratch.`);
496
498
  process.exit(1);
497
499
  }
498
500
  const authSchemaPath = join(root, ".void", "better-auth-schema.ts");
@@ -817,4 +819,4 @@ export default function App() {
817
819
  `);
818
820
  }
819
821
  //#endregion
820
- export { formatTimestamp, runGenCommand };
822
+ export { formatTimestamp as n, runGenCommand as r, detectValidator as t };
@@ -1,5 +1,5 @@
1
- import { n as dirname, o as join } from "./dist-BrsS7cai.mjs";
2
- import { c as collectMigrations } from "./validate-tBBN_dXH.mjs";
1
+ import { a as join, n as dirname } from "./dist-4WkAWhWx.mjs";
2
+ import { t as collectMigrations } from "./collect-DXHNWHcT.mjs";
3
3
  import { n as openMigrationValidationDatabase } from "./sqlite-validation-BzKMWnO4.mjs";
4
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
5
5
  //#region src/drizzle/generate.ts
@@ -1,7 +1,9 @@
1
- import { C as cancel, D as log, I as isCancel, M as select, P as text, c as import_picocolors, w as confirm } from "./output-B0cfNSx5.mjs";
2
- import { S as readProjectConfig, f as openBrowser, i as createCodeVerifier, l as getToken, n as awaitBrowserCallback, r as createCodeChallenge } from "./auth-DPl6kck4.mjs";
3
- import { n as PlatformClient, o as parsePlatformErrorBody, s as platformErrorMessage, t as PlatformApiError } from "./client-BQBrZoCX.mjs";
4
- import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project--Vxawf7z.mjs";
1
+ import { c as import_picocolors } from "./output-CCH48AMM.mjs";
2
+ import { c as getToken, d as openBrowser, n as createCodeChallenge, r as createCodeVerifier, t as awaitBrowserCallback } from "./auth-B9_D6ygs.mjs";
3
+ import { o as readProjectConfig } from "./project-CWNIPoXc.mjs";
4
+ import { B as text, E as confirm, I as select, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
5
+ import { n as PlatformClient, o as parsePlatformErrorBody, s as platformErrorMessage, t as PlatformApiError } from "./client-PdAJ-F0t.mjs";
6
+ import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-Xvis70DG.mjs";
5
7
  import { t as collectGitDeployMetadata } from "./git-metadata-D-gurjzG.mjs";
6
8
  import { randomBytes } from "node:crypto";
7
9
  //#region src/cli/github-cmd.ts
@@ -80,6 +80,11 @@ interface CloudContextVariables {
80
80
  headDefaults?: HeadDescriptor;
81
81
  [key: string]: unknown;
82
82
  }
83
+ declare global {
84
+ interface VoidGeneratedEnvBindings {
85
+ readonly [key: string]: unknown;
86
+ }
87
+ }
83
88
  /**
84
89
  * Hono `Bindings` shape for Void workers.
85
90
  *
@@ -88,7 +93,7 @@ interface CloudContextVariables {
88
93
  * working for bindings that aren't in the schema (queues, custom
89
94
  * bindings, etc.).
90
95
  */
91
- interface CloudBindings {
96
+ interface CloudBindings extends VoidGeneratedEnvBindings {
92
97
  DB: D1Database;
93
98
  KV: KVNamespace;
94
99
  STORAGE: R2Bucket;
@@ -0,0 +1,150 @@
1
+ import { t as convertReturnValue } from "./response-Tn7rU0MV.mjs";
2
+ import { t as runValidation } from "./validator-BTOu0fB0.mjs";
3
+ //#region src/runtime/handler.ts
4
+ /**
5
+ * Thrown when `c.rewrite()` is called with a destination whose final path
6
+ * segment ends in a known static-asset extension (e.g. `/hero.png`,
7
+ * `/app.css`). Runtime rewrites only reach routes and SSR entries inside
8
+ * the worker — static asset handlers run in front of the worker, so a
9
+ * `c.rewrite()` into an asset path re-enters the Hono router, matches
10
+ * nothing, and returns a 404. Fail at the call site so users reach for
11
+ * static `routing.rewrites` instead of debugging a mystery 404.
12
+ */
13
+ var VoidAssetRewriteError = class extends Error {
14
+ name = "VoidAssetRewriteError";
15
+ constructor(destination) {
16
+ super(`c.rewrite() cannot re-dispatch to a static asset path (${JSON.stringify(destination)}). Runtime rewrites only reach routes and SSR entries inside the worker — static asset handlers run in front of the worker. To rewrite into an asset, use a static \`routing.rewrites\` rule in void.json or a \`200!\` entry in _redirects. See https://void.dev/guide/edge/rewrites#runtime-rewrites-cannot-reach-static-assets`);
17
+ }
18
+ };
19
+ function defineHandler(...args) {
20
+ if (args.length === 1) return args[0];
21
+ const middlewares = args.slice(0, -1);
22
+ const handler = args[args.length - 1];
23
+ return (async (c) => {
24
+ let index = 0;
25
+ const dispatch = async () => {
26
+ if (index < middlewares.length) {
27
+ const middleware = middlewares[index++];
28
+ const middlewareResponse = await middleware(c, dispatch);
29
+ if (middlewareResponse instanceof Response) c.res = middlewareResponse;
30
+ } else c.res = convertReturnValue(await handler(c));
31
+ };
32
+ await dispatch();
33
+ return c.res;
34
+ });
35
+ }
36
+ (function(_defineHandler) {
37
+ function withValidator(validators) {
38
+ return (handler) => {
39
+ return (async (c) => {
40
+ const result = await runValidation(validators, c);
41
+ if (!result.ok) return result.response;
42
+ return convertReturnValue(await handler(c, result.input));
43
+ });
44
+ };
45
+ }
46
+ _defineHandler.withValidator = withValidator;
47
+ })(defineHandler || (defineHandler = {}));
48
+ /**
49
+ * Identity function that provides type inference for middleware.
50
+ * At runtime it simply returns the function passed to it.
51
+ */
52
+ function defineMiddleware(handler) {
53
+ return handler;
54
+ }
55
+ const basicAuthEncoder = new TextEncoder();
56
+ const basicAuthDecoder = new TextDecoder("utf-8", { fatal: true });
57
+ function parseBasicAuthHeader(authorization) {
58
+ if (!authorization?.toLowerCase().startsWith("basic ")) return null;
59
+ try {
60
+ const encoded = authorization.slice(6).trim();
61
+ const binary = atob(encoded);
62
+ const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
63
+ const decoded = basicAuthDecoder.decode(bytes);
64
+ const separator = decoded.indexOf(":");
65
+ if (separator === -1) return null;
66
+ return {
67
+ username: decoded.slice(0, separator),
68
+ password: decoded.slice(separator + 1)
69
+ };
70
+ } catch {
71
+ return null;
72
+ }
73
+ }
74
+ function timingSafeStringEqual(actual, expected) {
75
+ const actualBytes = basicAuthEncoder.encode(actual);
76
+ const expectedBytes = basicAuthEncoder.encode(expected);
77
+ let difference = actualBytes.length ^ expectedBytes.length;
78
+ for (let i = 0; i < expectedBytes.length; i++) difference |= (actualBytes[i] ?? 0) ^ expectedBytes[i];
79
+ return difference === 0;
80
+ }
81
+ function isVoidInternalPath(pathname) {
82
+ return pathname === "/__void" || pathname.startsWith("/__void/");
83
+ }
84
+ function basicAuthChallenge(realm, message) {
85
+ const escapedRealm = realm.replace(/["\\]/g, "\\$&");
86
+ return new Response(message, {
87
+ status: 401,
88
+ headers: {
89
+ "Cache-Control": "no-store",
90
+ "WWW-Authenticate": `Basic realm="${escapedRealm}", charset="UTF-8"`
91
+ }
92
+ });
93
+ }
94
+ function resolveBasicAuthOption(value, fallback) {
95
+ if (value === void 0) return fallback;
96
+ return typeof value === "function" ? value() : value;
97
+ }
98
+ /**
99
+ * Create Basic authentication middleware for temporary site gates and
100
+ * pre-launch protection.
101
+ *
102
+ * Void internal endpoints under `/__void` are always excluded so deploy-time
103
+ * migrations, prerendering, cron/queue dispatch, and remote binding helpers
104
+ * continue to reach Void's own internal-token checks.
105
+ */
106
+ function basicAuth(options) {
107
+ return defineMiddleware(async (c, next) => {
108
+ if (isVoidInternalPath(c.req.path)) {
109
+ await next();
110
+ return;
111
+ }
112
+ const username = resolveBasicAuthOption(options.username, "");
113
+ const password = resolveBasicAuthOption(options.password, "");
114
+ const credentials = parseBasicAuthHeader(c.req.raw.headers.get("Authorization"));
115
+ const usernameMatches = credentials && timingSafeStringEqual(credentials.username, username);
116
+ const passwordMatches = credentials && timingSafeStringEqual(credentials.password, password);
117
+ if (!usernameMatches || !passwordMatches) return basicAuthChallenge(resolveBasicAuthOption(options.realm, "Restricted"), resolveBasicAuthOption(options.message, "Authentication required"));
118
+ await next();
119
+ });
120
+ }
121
+ /**
122
+ * Identity function that provides type inference for scheduled jobs.
123
+ * At runtime it simply returns the function passed to it.
124
+ */
125
+ function defineScheduled(handler) {
126
+ return handler;
127
+ }
128
+ /**
129
+ * Identity function that provides type inference for SSR render entry.
130
+ * The second argument includes asset tags for client scripts/styles.
131
+ */
132
+ function defineRender(handler) {
133
+ return handler;
134
+ }
135
+ /**
136
+ * Identity function that provides type inference for page `head()` exports.
137
+ * At runtime it simply returns the function passed to it.
138
+ */
139
+ function defineHead(handler) {
140
+ return handler;
141
+ }
142
+ /**
143
+ * Identity function that provides type inference for queue consumers.
144
+ * At runtime it simply returns the function passed to it.
145
+ */
146
+ function defineQueue(handler) {
147
+ return handler;
148
+ }
149
+ //#endregion
150
+ export { defineMiddleware as a, defineScheduled as c, defineHead as i, basicAuth as n, defineQueue as o, defineHandler as r, defineRender as s, VoidAssetRewriteError as t };
@@ -0,0 +1,112 @@
1
+ //#region src/pages/head.ts
2
+ /**
3
+ * Merge head descriptors with precedence: page > middleware > config.
4
+ *
5
+ * - `title`: page wins; `titleTemplate` from config wraps it (`%s` replaced)
6
+ * - `meta`: page overrides entries with same `name`/`property`; others appended
7
+ * - `link`/`script`: concatenated (config first, then middleware, then page)
8
+ * - `htmlAttrs`/`bodyAttrs`: shallow merge, page wins conflicts
9
+ */
10
+ function resolveHead(configHead, middlewareHead, pageHead) {
11
+ if (!configHead && !middlewareHead && !pageHead) return;
12
+ const result = {};
13
+ const title = pageHead?.title ?? middlewareHead?.title ?? configHead?.title;
14
+ if (title !== void 0) {
15
+ const template = configHead?.titleTemplate;
16
+ result.title = template ? template.replace("%s", title) : title;
17
+ }
18
+ const metaMap = /* @__PURE__ */ new Map();
19
+ const metaOrder = [];
20
+ for (const layer of [
21
+ configHead,
22
+ middlewareHead,
23
+ pageHead
24
+ ]) {
25
+ if (!layer?.meta) continue;
26
+ for (const entry of layer.meta) {
27
+ const key = entry.charset ? "charset" : entry.property ? `property:${entry.property}` : `name:${entry.name ?? ""}`;
28
+ if (!metaMap.has(key)) metaOrder.push(key);
29
+ metaMap.set(key, entry);
30
+ }
31
+ }
32
+ if (metaMap.size > 0) result.meta = metaOrder.map((key) => metaMap.get(key));
33
+ const links = [];
34
+ for (const layer of [
35
+ configHead,
36
+ middlewareHead,
37
+ pageHead
38
+ ]) if (layer?.link) links.push(...layer.link);
39
+ if (links.length > 0) result.link = links;
40
+ const scripts = [];
41
+ for (const layer of [
42
+ configHead,
43
+ middlewareHead,
44
+ pageHead
45
+ ]) if (layer?.script) scripts.push(...layer.script);
46
+ if (scripts.length > 0) result.script = scripts;
47
+ const htmlAttrs = {};
48
+ let hasHtmlAttrs = false;
49
+ for (const layer of [
50
+ configHead,
51
+ middlewareHead,
52
+ pageHead
53
+ ]) if (layer?.htmlAttrs) {
54
+ Object.assign(htmlAttrs, layer.htmlAttrs);
55
+ hasHtmlAttrs = true;
56
+ }
57
+ if (hasHtmlAttrs) result.htmlAttrs = htmlAttrs;
58
+ const bodyAttrs = {};
59
+ let hasBodyAttrs = false;
60
+ for (const layer of [
61
+ configHead,
62
+ middlewareHead,
63
+ pageHead
64
+ ]) if (layer?.bodyAttrs) {
65
+ Object.assign(bodyAttrs, layer.bodyAttrs);
66
+ hasBodyAttrs = true;
67
+ }
68
+ if (hasBodyAttrs) result.bodyAttrs = bodyAttrs;
69
+ if (result.title === void 0 && !result.meta && !result.link && !result.script && !result.htmlAttrs && !result.bodyAttrs) return;
70
+ return result;
71
+ }
72
+ function escapeHtml(s) {
73
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
74
+ }
75
+ /** Serialize a HeadDescriptor to HTML tags for injection into `<head>`. */
76
+ function renderHeadToString(head) {
77
+ const parts = [];
78
+ if (head.title !== void 0) parts.push(`<title>${escapeHtml(head.title)}</title>`);
79
+ if (head.meta) for (const entry of head.meta) {
80
+ const attrs = [];
81
+ if (entry.charset) attrs.push(`charset="${escapeHtml(entry.charset)}"`);
82
+ if (entry.name) attrs.push(`name="${escapeHtml(entry.name)}"`);
83
+ if (entry.property) attrs.push(`property="${escapeHtml(entry.property)}"`);
84
+ if (entry.content !== void 0) attrs.push(`content="${escapeHtml(entry.content)}"`);
85
+ parts.push(`<meta ${attrs.join(" ")}>`);
86
+ }
87
+ if (head.link) for (const entry of head.link) {
88
+ const attrs = Object.entries(entry).filter(([, value]) => value != null).map(([key, value]) => `${key}="${escapeHtml(value)}"`).join(" ");
89
+ parts.push(`<link ${attrs}>`);
90
+ }
91
+ if (head.script) for (const entry of head.script) {
92
+ const { innerHTML, ...rest } = entry;
93
+ const attrs = Object.entries(rest).filter(([, value]) => value != null).map(([key, value]) => `${key}="${escapeHtml(value)}"`).join(" ");
94
+ if (innerHTML) parts.push(`<script${attrs ? " " + attrs : ""}>${innerHTML}<\/script>`);
95
+ else if (attrs) parts.push(`<script ${attrs}><\/script>`);
96
+ }
97
+ return parts.join("\n");
98
+ }
99
+ /** Serialize htmlAttrs to an attribute string (includes leading space). */
100
+ function renderHtmlAttrs(head) {
101
+ if (!head.htmlAttrs) return "";
102
+ const attrs = Object.entries(head.htmlAttrs).map(([key, value]) => `${key}="${escapeHtml(value)}"`).join(" ");
103
+ return attrs ? " " + attrs : "";
104
+ }
105
+ /** Serialize bodyAttrs to an attribute string (includes leading space). */
106
+ function renderBodyAttrs(head) {
107
+ if (!head.bodyAttrs) return "";
108
+ const attrs = Object.entries(head.bodyAttrs).map(([key, value]) => `${key}="${escapeHtml(value)}"`).join(" ");
109
+ return attrs ? " " + attrs : "";
110
+ }
111
+ //#endregion
112
+ export { resolveHead as i, renderHeadToString as n, renderHtmlAttrs as r, renderBodyAttrs as t };