void 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/{account-cmd-CdUll_35.mjs → account-cmd-B4i71m7k.mjs} +3 -3
  2. package/dist/{application-analysis-fEqoSeMp.mjs → application-analysis-DYdVoMAY.mjs} +8 -6
  3. package/dist/{application-routing-DAhNP4u3.mjs → application-routing-C8EqRDfv.mjs} +3 -1
  4. package/dist/{auth-link-C87vGXM-.mjs → auth-link-BKwHPbdv.mjs} +3 -3
  5. package/dist/{auth-router-6I81r-ix.mjs → auth-router-DqLx8E0F.mjs} +2 -2
  6. package/dist/{better-auth-shared-D-6z0q0f.mjs → better-auth-shared-7FM3Uk2N.mjs} +48 -2
  7. package/dist/{build-cmd-ex1g-j_e.mjs → build-cmd-Dy4psnt1.mjs} +1 -1
  8. package/dist/{cache-oHzrnY3z.mjs → cache-DV37S6dl.mjs} +1 -1
  9. package/dist/{cancel-deploy-viAMD0Q_.mjs → cancel-deploy-DMPyu1Vt.mjs} +1 -1
  10. package/dist/{cf-build-output-BhVxldCw.mjs → cf-build-output-Bapzc_8Z.mjs} +102 -1
  11. package/dist/cf-build-output-DlBkWdNU.mjs +1 -0
  12. package/dist/cli/cli.mjs +41 -32
  13. package/dist/cli/cloudflare-operation-process.mjs +27 -6
  14. package/dist/cli/env-schema-probe.mjs +2 -2
  15. package/dist/{client-BEkdj1kx.mjs → client-BEMtySaV.mjs} +8 -1
  16. package/dist/client-DyxPQnF_.mjs +1 -0
  17. package/dist/{cloudflare-cmd-DMzCv12s.mjs → cloudflare-cmd-BaqIigwI.mjs} +1 -1
  18. package/dist/{cloudflare-connect-CCRTVg-I.mjs → cloudflare-connect-pNLQmr_e.mjs} +1 -1
  19. package/dist/{cloudflare-operations-DsSaw2BT.mjs → cloudflare-operations-PCM4wucv.mjs} +1 -1
  20. package/dist/{cloudflare-operations-Dh9dEHJj.mjs → cloudflare-operations-vP3b5CQf.mjs} +3 -3
  21. package/dist/config-BTu1o3Dc.mjs +49 -0
  22. package/dist/{config-DQfHOKh9.d.mts → config-Du88-7Y8.d.mts} +2 -1
  23. package/dist/config-entry.d.mts +1 -1
  24. package/dist/{connect-k7R2rPVA.mjs → connect-DwVsBvVh.mjs} +4 -4
  25. package/dist/{create-project-DTuy-l0z.mjs → create-project-CgrnvzyA.mjs} +1 -1
  26. package/dist/{create-project-DV71ol5d.mjs → create-project-CjzbBlTv.mjs} +1 -1
  27. package/dist/{db-DVOkLH5X.mjs → db-rvo64snS.mjs} +13 -13
  28. package/dist/{delete-BbP5eopu.mjs → delete-DWX6dP4M.mjs} +1 -1
  29. package/dist/deploy-CtHE2A3R.mjs +2 -0
  30. package/dist/{deploy-7H32EnUs.mjs → deploy-hRPvw8ci.mjs} +229 -69
  31. package/dist/{deploy-managed-static-DlvcvnQT.mjs → deploy-managed-static-CDYA2p3L.mjs} +30 -14
  32. package/dist/{deploy-transport-BzGEj0Ge.mjs → deploy-transport-JCxw7QDi.mjs} +3 -3
  33. package/dist/deploy.mjs +4 -3
  34. package/dist/{dispatch-DoUnxTNo.mjs → dispatch-OVLeWW8K.mjs} +71 -2
  35. package/dist/{domain-CA2wBgra.mjs → domain-CH5iBD9Y.mjs} +2 -2
  36. package/dist/{email-DXpCc77w.mjs → email-CbTO1l78.mjs} +58 -9
  37. package/dist/{email-cloudflare-D03g2TkS.mjs → email-cloudflare-B8-pq_-W.mjs} +106 -5
  38. package/dist/{env-DgOQ9_8S.mjs → env-BBdw236G.mjs} +3 -3
  39. package/dist/{env-BJjULvL0.mjs → env-BaMz0j7H.mjs} +6 -1
  40. package/dist/{env-validation-BmsdCZEk.mjs → env-validation-BfBVvBNe.mjs} +1 -1
  41. package/dist/{env-validation-Dwq3PJzK.mjs → env-validation-XcukUlFM.mjs} +1 -1
  42. package/dist/{gen-BfmcIi2g.mjs → gen-CCx3t2Ju.mjs} +1 -1
  43. package/dist/gen-TgXy93Rr.mjs +1 -0
  44. package/dist/{github-cmd-CY9LUqLh.mjs → github-cmd-BzkRLkbg.mjs} +1 -1
  45. package/dist/{handler-BbkSPzGF.d.mts → handler-CQv5YDS0.d.mts} +1 -1
  46. package/dist/{help-CxSlPpzJ.mjs → help-CKbrhZha.mjs} +16 -1
  47. package/dist/help-qOZr3wng.mjs +1 -0
  48. package/dist/index.d.mts +2 -4
  49. package/dist/index.mjs +317 -122
  50. package/dist/{info-7VDlhtyy.mjs → info-oBm8yK8J.mjs} +2 -2
  51. package/dist/{init-DxYyOs4-.mjs → init-CBp_uMve.mjs} +217 -197
  52. package/dist/{link-Ddmod1dZ.mjs → link-Dt_QXmM4.mjs} +2 -2
  53. package/dist/{list-MogaugiO.mjs → list-DF6asTdt.mjs} +2 -2
  54. package/dist/{live-Bt8Y_0bg.d.mts → live-CXJ9yC98.d.mts} +1 -1
  55. package/dist/{local-d1-BHBnKWRb.mjs → local-d1-CUhH3qtj.mjs} +1 -1
  56. package/dist/{login-Cttnagmm.mjs → login-BjSyhXlT.mjs} +2 -2
  57. package/dist/login-Cdo8Aco1.mjs +1 -0
  58. package/dist/{logs-CAszUWZI.mjs → logs-DmvBl6xA.mjs} +2 -2
  59. package/dist/{migrate-DyT2jJ8y.mjs → migrate-BXRHpYwR.mjs} +1 -1
  60. package/dist/migrate-COPncCGx.mjs +1 -0
  61. package/dist/nitro.mjs +2 -2
  62. package/dist/{node-WB7c2N4L.mjs → node-DtD7ZiPf.mjs} +4 -4
  63. package/dist/{operator-args-UnE8Y2eK.mjs → operator-args-BsJIYXaT.mjs} +8 -1
  64. package/dist/operator-cmd-DDiX7Y3f.mjs +1 -0
  65. package/dist/{operator-cmd-skshjMGl.mjs → operator-cmd-DjZKGGgN.mjs} +4 -3
  66. package/dist/pages/client.d.mts +21 -4
  67. package/dist/pages/client.mjs +174 -35
  68. package/dist/pages/index.d.mts +18 -2
  69. package/dist/pages/index.mjs +2 -52
  70. package/dist/pages/islands-plugin.d.mts +1 -1
  71. package/dist/pages/islands-plugin.mjs +9 -3
  72. package/dist/pages/protocol.d.mts +2 -2
  73. package/dist/platform-args-BC8_hsDj.mjs +1 -0
  74. package/dist/{platform-args-DVbVClZl.mjs → platform-args-BMD2gjc_.mjs} +1 -1
  75. package/dist/{platform-auth-config-C-pm5Qzx.mjs → platform-auth-config-BgnuMbml.mjs} +3 -3
  76. package/dist/{platform-auth-protection-SHhvim1L.mjs → platform-auth-protection-NjRejttU.mjs} +2 -2
  77. package/dist/{platform-auth-recovery-DXVWs-wA.mjs → platform-auth-recovery-Ug12d9W5.mjs} +2 -2
  78. package/dist/{platform-cmd-PiNRkopU.mjs → platform-cmd-BYKLMPCn.mjs} +1 -1
  79. package/dist/{platform-cmd-D5I1beUX.mjs → platform-cmd-HByuZAO7.mjs} +4 -4
  80. package/dist/{platform-domain-jpmBfZeb.mjs → platform-domain-DLSQ8GF8.mjs} +2 -2
  81. package/dist/{platform-lifecycle-DyKmuNY6.mjs → platform-lifecycle-3dwFJmnq.mjs} +102 -40
  82. package/dist/{platform-lifecycle-DH3Yr1qQ.mjs → platform-lifecycle-BRqcxerG.mjs} +1 -1
  83. package/dist/{platform-management-7m-PLaPJ.mjs → platform-management-ZK6XcbCo.mjs} +1 -1
  84. package/dist/{platform-management--vDwSn35.mjs → platform-management-ZZ6bQM5j.mjs} +1 -1
  85. package/dist/{platform-recovery-BiNpZZab.mjs → platform-recovery-8vNE5dNN.mjs} +2 -2
  86. package/dist/{plugin-inference-DUjCd55H.mjs → plugin-inference-CeiB6BG5.mjs} +53 -18
  87. package/dist/{prepare-BcAE5Sdj.mjs → prepare-5BR7Splm.mjs} +1 -1
  88. package/dist/prepare-B3VrSF1Z.mjs +1 -0
  89. package/dist/{prepare-DA-17DhO.mjs → prepare-Dseww74N.mjs} +4 -4
  90. package/dist/{prerender-render-Cijv7UFo.mjs → prerender-render-CaShbHJ3.mjs} +13 -1
  91. package/dist/prerender-render.d.mts +1 -0
  92. package/dist/prerender-render.mjs +1 -1
  93. package/dist/{project-cmd-DA4K5faU.mjs → project-cmd-CjLNNxwe.mjs} +15 -15
  94. package/dist/{project-team-CQBNveX3.mjs → project-team-DE5drjcl.mjs} +1 -1
  95. package/dist/{project-token-CCalFyQf.mjs → project-token-XEYEXfiJ.mjs} +1 -1
  96. package/dist/{project-zero-trust-DPnkiEuT.mjs → project-zero-trust-6VPU8zmV.mjs} +1 -1
  97. package/dist/{protocol-BBDpJz3G.d.mts → protocol-BekmFxCI.d.mts} +2 -2
  98. package/dist/{provision-DtROpNNI.mjs → provision-B7UFrBH7.mjs} +1 -1
  99. package/dist/{provision-BFLCrnUp.mjs → provision-Chq0NRAV.mjs} +1 -1
  100. package/dist/{requests-BpH0kImL.mjs → requests-CG-Pj8ze.mjs} +1 -1
  101. package/dist/{rollback-CXS1tAa-.mjs → rollback-CIrm2txZ.mjs} +2 -2
  102. package/dist/{route-types-BZi26DVS.mjs → route-types--PAOzHlH.mjs} +49 -28
  103. package/dist/routes-stub.d.mts +22 -13
  104. package/dist/runtime/better-auth-mysql.mjs +1 -1
  105. package/dist/runtime/better-auth-pg.mjs +1 -1
  106. package/dist/runtime/better-auth.mjs +1 -1
  107. package/dist/runtime/handler.d.mts +1 -1
  108. package/dist/runtime/live-client.d.mts +1 -1
  109. package/dist/runtime/live.d.mts +1 -1
  110. package/dist/runtime/log.mjs +19 -1
  111. package/dist/runtime/routing.d.mts +2 -2
  112. package/dist/runtime/routing.mjs +4 -3
  113. package/dist/runtime/validator.d.mts +1 -1
  114. package/dist/runtime/ws-server.d.mts +1 -1
  115. package/dist/runtime/ws.d.mts +1 -1
  116. package/dist/{scan-8IzYXiU_.mjs → scan-N9WzdcAl.mjs} +302 -23
  117. package/dist/{secret-BbXHfLAt.mjs → secret-BL6g7mF5.mjs} +3 -3
  118. package/dist/static-asset-marker-Btf-6oCD.mjs +32 -0
  119. package/dist/{types-7AIz0OZu.d.mts → types-w72dljaA.d.mts} +6 -1
  120. package/dist/{version-metadata-tS39iW09.mjs → version-metadata-DmaZNTYW.mjs} +1 -1
  121. package/dist/worker-conditions-AWFRcFxR.mjs +11 -0
  122. package/dist/{wrangler-F96NnLyb.mjs → wrangler-CDiEBCdS.mjs} +2 -1
  123. package/dist/wrangler-DOPr4jyI.mjs +1 -0
  124. package/dist/{wrapper-D3sZyh2C.mjs → wrapper-CEiDeCqD.mjs} +6 -10
  125. package/dist/{ws-BH-im_tX.d.mts → ws-D1zWiB_P.d.mts} +1 -1
  126. package/docs/guide/auth.md +3 -1
  127. package/docs/guide/edge/static-assets.md +10 -0
  128. package/docs/guide/email/domains.md +1 -1
  129. package/docs/guide/email/receiving.md +2 -0
  130. package/docs/guide/email/sending.md +1 -1
  131. package/docs/guide/pages-routing/actions-and-forms.md +19 -13
  132. package/docs/guide/pages-routing/markdown.md +2 -0
  133. package/docs/guide/pages-routing/overview.md +34 -3
  134. package/docs/guide/platform/administration/email.md +18 -0
  135. package/docs/guide/platform/installation/prerequisites.md +9 -4
  136. package/docs/guide/platform/installation/uninstall.md +2 -0
  137. package/docs/guide/queues.md +13 -1
  138. package/docs/guide/quickstart.md +26 -1
  139. package/docs/guide/sandboxes.md +2 -2
  140. package/docs/guide/server-routing.md +38 -2
  141. package/docs/guide/type-safety.md +7 -7
  142. package/docs/guide/websockets.md +4 -2
  143. package/docs/reference/api/pages.md +4 -4
  144. package/docs/reference/cli/email.md +13 -0
  145. package/docs/reference/cli/platform-email.md +2 -2
  146. package/docs/reference/cli.md +2 -1
  147. package/docs/reference/structure.md +3 -1
  148. package/package.json +8 -7
  149. package/sandbox.Dockerfile +1 -1
  150. package/templates/assets/icons.svg +49 -0
  151. package/templates/assets/react.svg +1 -0
  152. package/templates/assets/solid.svg +1 -0
  153. package/templates/assets/stack.svg +35 -0
  154. package/templates/assets/svelte.svg +1 -0
  155. package/templates/assets/void.svg +5 -0
  156. package/templates/assets/vue.svg +1 -0
  157. package/dist/cf-build-output-BJHuSsVN.mjs +0 -1
  158. package/dist/client-BiRDZTSd.mjs +0 -1
  159. package/dist/config-CyUJzi3q.mjs +0 -32
  160. package/dist/deploy-CE0Ev0Ob.mjs +0 -2
  161. package/dist/gen-NrOlWZaG.mjs +0 -1
  162. package/dist/help-BeAFFE5C.mjs +0 -1
  163. package/dist/login-DgDwlKc_.mjs +0 -1
  164. package/dist/migrate-n49ZeS1X.mjs +0 -1
  165. package/dist/operator-cmd-d2MvJOrl.mjs +0 -1
  166. package/dist/parse-filename-DioPHiR9.mjs +0 -77
  167. package/dist/platform-args-kQrgxScY.mjs +0 -1
  168. package/dist/prepare-C4I0f--h.mjs +0 -1
  169. package/dist/wrangler-BLb3_luP.mjs +0 -1
@@ -1,10 +1,10 @@
1
1
  import { a as join, l as toSlash, s as relative } from "./dist-ipQi0Q8y.mjs";
2
2
  import { n as readProjectPaths } from "./project-paths-DGu_QZ_Q.mjs";
3
3
  import { n as globSync } from "./dist-D15hFhP0.mjs";
4
+ import { d as deriveFromSource, g as ROUTE_EXTENSIONS, h as parseWebSocketFilename, m as parseRouteFilename, p as isRouteEnabledForEnvironment, t as pageFileEnvironment } from "./scan-N9WzdcAl.mjs";
4
5
  import { a as isObjectExpression, i as isMemberExpression, n as isIdentifier, r as isLiteral, t as isCallExpression } from "./ast-CsZ_q_gc.mjs";
5
6
  import { a as staticLiteral, n as bindingResolver, o as unwrapStaticExpression, r as walk } from "./ast-bindings-C3yaPs1y.mjs";
6
7
  import { n as resourceNameWords, t as isResourceName } from "./resource-name-C7LVpcRm.mjs";
7
- import { n as parseRouteFilename, r as parseWebSocketFilename, t as isRouteEnabledForEnvironment } from "./parse-filename-DioPHiR9.mjs";
8
8
  import { r as getSsrServerEntryPath } from "./entry-BEM8ZuGP.mjs";
9
9
  import { existsSync, readFileSync } from "node:fs";
10
10
  import { parseSync } from "vite";
@@ -30,9 +30,38 @@ function needsApplicationDatabase(bindings, migrationCount) {
30
30
  }
31
31
  //#endregion
32
32
  //#region src/shared/convention-files.ts
33
+ const WELL_KNOWN_DIR = ".well-known";
34
+ /** Include the convention directory's .well-known files when it is inside the scan directory. */
35
+ function conventionFileGlobs(scanDir, pattern, conventionDir = scanDir) {
36
+ const patterns = [pattern];
37
+ const conventionRelative = relative(scanDir, conventionDir);
38
+ if (conventionRelative !== ".." && !conventionRelative.startsWith("../")) patterns.push(join(conventionRelative, WELL_KNOWN_DIR, pattern));
39
+ return patterns;
40
+ }
41
+ function isConventionPath(filePath) {
42
+ return filePath.replace(/\\/g, "/").split("/").every((segment, index) => !segment.startsWith("_") && (!segment.startsWith(".") || index === 0 && segment === WELL_KNOWN_DIR));
43
+ }
44
+ /** Whether a path relative to routes/ participates in HTTP or WebSocket routing. */
45
+ function isRouteFile(filePath) {
46
+ return isConventionPath(filePath) && ROUTE_EXTENSIONS.some((ext) => filePath.endsWith(`.${ext}`));
47
+ }
33
48
  /** Handler files under `dir`, relative to it, skipping paths with a `_`-prefixed segment. */
49
+ function listFilesWithExtensions(dir, extensions) {
50
+ const suffix = `*.{${extensions.join(",")}}`;
51
+ return globSync(conventionFileGlobs(dir, `**/${suffix}`), { cwd: dir }).filter(isConventionPath);
52
+ }
53
+ /** Cron and queue handlers with .ts, .mts, .js, or .mjs extensions. */
34
54
  function listConventionFiles(dir) {
35
- return globSync(["**/*.{ts,mts,js,mjs}", ".well-known/**/*.{ts,mts,js,mjs}"], { cwd: dir }).filter((filePath) => !filePath.split("/").some((segment) => segment.startsWith("_")));
55
+ return listFilesWithExtensions(dir, [
56
+ "ts",
57
+ "mts",
58
+ "js",
59
+ "mjs"
60
+ ]);
61
+ }
62
+ /** HTTP and WebSocket handlers, also allowing .tsx and .jsx for JSX. */
63
+ function listRouteFiles(dir) {
64
+ return listFilesWithExtensions(dir, ROUTE_EXTENSIONS);
36
65
  }
37
66
  //#endregion
38
67
  //#region src/shared/resource-definition.ts
@@ -409,7 +438,7 @@ function mergeBindings(bindings) {
409
438
  }
410
439
  //#endregion
411
440
  //#region src/router/websocket.ts
412
- const WEBSOCKET_ROUTE_RE = /(?:\.(?:dev|prod))?\.ws\.(?:ts|mts|js|mjs)$/;
441
+ const WEBSOCKET_ROUTE_RE = new RegExp(`(?:\\.(?:dev|prod))?\\.ws\\.(?:${ROUTE_EXTENSIONS.join("|")})$`);
413
442
  function isWebSocketRouteFile(filePath) {
414
443
  return WEBSOCKET_ROUTE_RE.test(filePath.replace(/\\/g, "/"));
415
444
  }
@@ -420,7 +449,10 @@ function deriveWebSocketClassNameFromName(name) {
420
449
  return resourceNameWords(name).map((part) => part[0].toUpperCase() + part.slice(1)).join("") + "Ws";
421
450
  }
422
451
  function inferWebSocketResourceName(filePath) {
423
- const parts = filePath.replace(/\\/g, "/").replace(/\.(ts|mts|js|mjs)$/, "").split("/").filter((segment) => segment.length > 0 && !(segment.startsWith("(") && segment.endsWith(")"))).flatMap(identifierWords);
452
+ let normalized = filePath.replace(/\\/g, "/");
453
+ const extension = ROUTE_EXTENSIONS.find((ext) => normalized.endsWith(`.${ext}`));
454
+ if (extension) normalized = normalized.slice(0, -(extension.length + 1));
455
+ const parts = normalized.split("/").filter((segment) => segment.length > 0 && !(segment.startsWith("(") && segment.endsWith(")"))).flatMap(identifierWords);
424
456
  return parts.length > 0 ? parts.join("-") : "WebSocket";
425
457
  }
426
458
  function deriveWebSocketClassName(filePath) {
@@ -471,7 +503,7 @@ function parseWebSocketFiles(root, files, paths = readProjectPaths(root), enviro
471
503
  return routes;
472
504
  }
473
505
  function scanWebSocketRoutesSync(root, paths = readProjectPaths(root), environment) {
474
- return parseWebSocketFiles(root, listConventionFiles(paths.routesDir), paths, environment);
506
+ return parseWebSocketFiles(root, listRouteFiles(paths.routesDir), paths, environment);
475
507
  }
476
508
  function isWebSocketPatternFile(filePath) {
477
509
  return isWebSocketRouteFile(filePath);
@@ -589,26 +621,32 @@ function inferProjectBindings(root, options, scanDirs) {
589
621
  const allBindings = [];
590
622
  const scannedFiles = /* @__PURE__ */ new Set();
591
623
  const routesPrefix = `${toSlash(paths.routesDir).replace(/\/$/, "")}/`;
624
+ const pagesDir = toSlash(paths.pagesDir);
625
+ const pagesPrefix = pagesDir.endsWith("/") ? pagesDir : `${pagesDir}/`;
626
+ const scanSourceFiles = (dirPath) => globSync(conventionFileGlobs(dirPath, SOURCE_GLOB, paths.routesDir), {
627
+ cwd: dirPath,
628
+ absolute: true
629
+ });
592
630
  const addFile = (file) => {
593
631
  const normalizedFile = toSlash(file);
594
632
  if (scannedFiles.has(normalizedFile)) return;
595
633
  scannedFiles.add(normalizedFile);
596
- if (options?.environment && normalizedFile.startsWith(routesPrefix) && /\.(?:ts|mts|js|mjs)$/.test(normalizedFile)) {
597
- const routePath = relative(paths.routesDir, normalizedFile);
634
+ const routePath = normalizedFile.startsWith(routesPrefix) ? normalizedFile.slice(routesPrefix.length) : void 0;
635
+ if (options?.environment && routePath !== void 0 && isRouteFile(routePath)) {
598
636
  const route = isWebSocketPatternFile(routePath) ? parseWebSocketFilename(routePath) : parseRouteFilename(routePath);
599
637
  if (!isRouteEnabledForEnvironment(route, options.environment)) return;
600
638
  }
601
- const code = readFileSync(file, "utf-8");
602
- allBindings.push(inferBindingsFromFile(file, code));
639
+ if (options?.environment && options.filterPages && normalizedFile.startsWith(pagesPrefix)) {
640
+ const env = pageFileEnvironment(normalizedFile.slice(pagesPrefix.length));
641
+ if (!isRouteEnabledForEnvironment({ env }, options.environment)) return;
642
+ }
643
+ allBindings.push(deriveFromSource(file, "bindings", (code) => inferBindingsFromFile(file, code)));
603
644
  };
604
645
  for (const dir of dirs) {
605
646
  const dirPath = join(root, dir);
606
647
  let files;
607
648
  try {
608
- files = globSync(SOURCE_GLOB, {
609
- cwd: dirPath,
610
- absolute: true
611
- });
649
+ files = scanSourceFiles(dirPath);
612
650
  } catch {
613
651
  continue;
614
652
  }
@@ -622,10 +660,7 @@ function inferProjectBindings(root, options, scanDirs) {
622
660
  const srcPath = paths.sourceDir ? paths.sourceRoot : join(root, "src");
623
661
  let srcFiles;
624
662
  try {
625
- srcFiles = globSync(SOURCE_GLOB, {
626
- cwd: srcPath,
627
- absolute: true
628
- });
663
+ srcFiles = scanSourceFiles(srcPath);
629
664
  } catch {
630
665
  srcFiles = [];
631
666
  }
@@ -634,4 +669,4 @@ function inferProjectBindings(root, options, scanDirs) {
634
669
  return applyBindingOverrides(mergeBindings(allBindings), options?.bindings);
635
670
  }
636
671
  //#endregion
637
- export { deriveWebSocketClassNameFromName as a, scanWebSocketRoutesSync as c, readResourceDefinition as d, listConventionFiles as f, inferProjectBindings as i, inferBindingsFromSource as l, needsApplicationDatabase as m, FRAMEWORK_SCAN_DIRS as n, inferWebSocketResourceName as o, applyBindingOverrides as p, detectFramework as r, isWebSocketPatternFile as s, DEFAULT_SCAN_DIRS as t, staticModuleReferences as u };
672
+ export { deriveWebSocketClassNameFromName as a, scanWebSocketRoutesSync as c, readResourceDefinition as d, listConventionFiles as f, needsApplicationDatabase as h, inferProjectBindings as i, inferBindingsFromSource as l, applyBindingOverrides as m, FRAMEWORK_SCAN_DIRS as n, inferWebSocketResourceName as o, listRouteFiles as p, detectFramework as r, isWebSocketPatternFile as s, DEFAULT_SCAN_DIRS as t, staticModuleReferences as u };
@@ -1,6 +1,6 @@
1
1
  import { L as log } from "./dist-Cor9XGoz.mjs";
2
2
  import { m as printSuccess, p as note } from "./output-BpgYODYx.mjs";
3
- import { t as prepareProject } from "./prepare-DA-17DhO.mjs";
3
+ import { t as prepareProject } from "./prepare-Dseww74N.mjs";
4
4
  //#region src/cli/prepare.ts
5
5
  async function runPrepareCommand(root) {
6
6
  console.log();
@@ -0,0 +1 @@
1
+ export { t as prepareProject } from "./prepare-Dseww74N.mjs";
@@ -1,13 +1,13 @@
1
1
  import { a as join } from "./dist-ipQi0Q8y.mjs";
2
- import { n as loadVoidAuthConfig } from "./config-CyUJzi3q.mjs";
2
+ import { i as loadVoidAuthConfig } from "./config-BTu1o3Dc.mjs";
3
3
  import { c as getDatabaseCasing, p as readConfig } from "./config-DHgSEWT7.mjs";
4
4
  import { n as ensureProjectTsconfig, r as writeFileIfChanged } from "./project-tsconfig-Itv1f4WC.mjs";
5
5
  import { n as generateDbDts } from "./db-types-NGxPwnlt.mjs";
6
6
  import { t as discoverSchema } from "./discover-LaV0tbIu.mjs";
7
- import { o as loadLocalEnv } from "./env-BJjULvL0.mjs";
7
+ import { s as loadLocalEnv } from "./env-BaMz0j7H.mjs";
8
8
  import { n as findEnvFileForPaths, r as generateEnvTypes } from "./env-types-BicfKBhV.mjs";
9
- import { t as analyzeApplication } from "./application-routing-DAhNP4u3.mjs";
10
- import { n as generateQueueTypes, t as generateRouteTypes } from "./route-types-BZi26DVS.mjs";
9
+ import { t as analyzeApplication } from "./application-routing-C8EqRDfv.mjs";
10
+ import { n as generateQueueTypes, t as generateRouteTypes } from "./route-types--PAOzHlH.mjs";
11
11
  import { n as generateVoidAuthDrizzleSchema, t as generateVoidAuthDatabaseModule } from "./drizzle-BQfyvQKX.mjs";
12
12
  import { existsSync, rmSync } from "node:fs";
13
13
  import { fileURLToPath } from "node:url";
@@ -3,6 +3,11 @@ import { mkdirSync, writeFileSync } from "node:fs";
3
3
  import { extractPageDataFromHtml } from "@void/isr/core";
4
4
  //#region src/prerender-render.ts
5
5
  const PAGE_DATA_SCRIPT_ID = "__VOID_PAGE_DATA__";
6
+ function assertNoPrerenderFailures(failed) {
7
+ if (failed.length === 0) return;
8
+ const details = failed.map(({ path, error }) => ` ${path}: ${error}`).join("\n");
9
+ throw new Error(`${failed.length} page(s) failed to prerender:\n${details}`);
10
+ }
6
11
  function outputFileForPath(path) {
7
12
  return path === "/" ? "index.html" : `${path.slice(1)}.html`;
8
13
  }
@@ -93,6 +98,13 @@ async function renderPrerenderPaths(paths, clientDir, fetchPath, fetchPageData,
93
98
  try {
94
99
  const response = await fetchPath(path);
95
100
  const html = await response.text();
101
+ if ([
102
+ 301,
103
+ 302,
104
+ 303,
105
+ 307,
106
+ 308
107
+ ].includes(response.status) && response.headers.get("Location")) continue;
96
108
  if (!response.ok) {
97
109
  const error = `HTTP ${response.status}`;
98
110
  result.failed.push({
@@ -133,4 +145,4 @@ async function renderPrerenderPaths(paths, clientDir, fetchPath, fetchPageData,
133
145
  };
134
146
  }
135
147
  //#endregion
136
- export { readPrerenderPathsResponse as n, renderPrerenderPaths as r, outputFileForPath as t };
148
+ export { renderPrerenderPaths as i, outputFileForPath as n, readPrerenderPathsResponse as r, assertNoPrerenderFailures as t };
@@ -6,6 +6,7 @@ export type PrerenderResult = {
6
6
  error: string;
7
7
  }>;
8
8
  };
9
+ export declare function assertNoPrerenderFailures(failed: PrerenderResult["failed"]): void;
9
10
  export declare function outputFileForPath(path: string): string;
10
11
  export declare function readPrerenderPathsResponse(response: Response): Promise<Array<string>>;
11
12
  /** Shared renderer for local Workers and the isolated Node prerender child. */
@@ -1 +1 @@
1
- export { t as outputFileForPath, n as readPrerenderPathsResponse, r as renderPrerenderPaths } from "./prerender-render-Cijv7UFo.mjs";
1
+ export { t as assertNoPrerenderFailures, n as outputFileForPath, r as readPrerenderPathsResponse, i as renderPrerenderPaths } from "./prerender-render-CaShbHJ3.mjs";
@@ -1,7 +1,7 @@
1
1
  import { n as readDeploymentPlatform } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken, s as getSiteDomain } from "./auth-B6iOCjKI.mjs";
3
3
  import { H as outro, L as log } from "./dist-Cor9XGoz.mjs";
4
- import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
4
+ import { r as PlatformClient } from "./client-BEMtySaV.mjs";
5
5
  import { _ as tablePrefix, f as import_picocolors, i as dim, l as formatUrl, o as formatCount } from "./output-BpgYODYx.mjs";
6
6
  //#region src/cli/projects.ts
7
7
  async function runProjectsCommand(root) {
@@ -38,77 +38,77 @@ async function runProjectsCommand(root) {
38
38
  async function runProjectCommand(root, args) {
39
39
  const cloudflare = readDeploymentPlatform(root) === "cloudflare";
40
40
  if (args.subcommand === "status") {
41
- const { runListCommand } = await import("./list-MogaugiO.mjs");
41
+ const { runListCommand } = await import("./list-DF6asTdt.mjs");
42
42
  return runListCommand(root, args.name || void 0);
43
43
  }
44
44
  if (args.subcommand === "link") {
45
45
  if (cloudflare) throw new Error("project: Direct Cloudflare apps are identified by cloudflare.name in void.config.ts and do not need linking.");
46
- const { runLink } = await import("./link-Ddmod1dZ.mjs");
46
+ const { runLink } = await import("./link-Dt_QXmM4.mjs");
47
47
  return runLink(root, args.name || void 0);
48
48
  }
49
49
  if (args.subcommand === "list") {
50
50
  if (cloudflare) {
51
- const { runListCommand } = await import("./list-MogaugiO.mjs");
51
+ const { runListCommand } = await import("./list-DF6asTdt.mjs");
52
52
  return runListCommand(root);
53
53
  }
54
54
  return runProjectsCommand(root);
55
55
  }
56
56
  if (args.subcommand === "token") {
57
57
  if (cloudflare) throw new Error("project: CI deploy credentials are available only for Void platform projects.");
58
- const { runProjectTokenCommand } = await import("./project-token-CCalFyQf.mjs");
58
+ const { runProjectTokenCommand } = await import("./project-token-XEYEXfiJ.mjs");
59
59
  return runProjectTokenCommand(root, args);
60
60
  }
61
61
  if (args.subcommand === "team") {
62
62
  if (args.action === "") {
63
- const { printHelpPage } = await import("./help-BeAFFE5C.mjs");
63
+ const { printHelpPage } = await import("./help-qOZr3wng.mjs");
64
64
  printHelpPage(["project", "team"]);
65
65
  return;
66
66
  }
67
67
  const accountInvitationAction = args.action === "pending" || args.action === "accept" || args.action === "decline";
68
68
  if (cloudflare && !accountInvitationAction) throw new Error("project: Teams are available only for projects hosted on a Void platform, not direct Cloudflare deployments.");
69
- const { runProjectTeamCommand } = await import("./project-team-CQBNveX3.mjs");
69
+ const { runProjectTeamCommand } = await import("./project-team-DE5drjcl.mjs");
70
70
  return runProjectTeamCommand(root, args);
71
71
  }
72
72
  if (args.subcommand === "zero-trust") {
73
73
  if (cloudflare) throw new Error("project: Zero Trust overrides are available only for projects hosted on a Void platform.");
74
74
  if (args.action === "") {
75
- const { printHelpPage } = await import("./help-BeAFFE5C.mjs");
75
+ const { printHelpPage } = await import("./help-qOZr3wng.mjs");
76
76
  printHelpPage(["project", "zero-trust"]);
77
77
  return;
78
78
  }
79
79
  const action = args.action;
80
- const { runProjectZeroTrustCommand } = await import("./project-zero-trust-DPnkiEuT.mjs");
80
+ const { runProjectZeroTrustCommand } = await import("./project-zero-trust-6VPU8zmV.mjs");
81
81
  return runProjectZeroTrustCommand(root, {
82
82
  ...args,
83
83
  action
84
84
  });
85
85
  }
86
86
  if (args.subcommand === "logs") {
87
- const { runLogsCommand } = await import("./logs-CAszUWZI.mjs");
87
+ const { runLogsCommand } = await import("./logs-DmvBl6xA.mjs");
88
88
  return runLogsCommand(root, args.filter, args.range, args.deployment || void 0, args.level || void 0);
89
89
  }
90
90
  if (args.subcommand === "requests") {
91
91
  if (cloudflare) throw new Error("project: Historical request analytics require the Void platform. Use `void project logs` for a live Cloudflare tail.");
92
- const { runRequestsCommand } = await import("./requests-BpH0kImL.mjs");
92
+ const { runRequestsCommand } = await import("./requests-CG-Pj8ze.mjs");
93
93
  return runRequestsCommand(root, args.range, args.status || void 0);
94
94
  }
95
95
  if (args.subcommand === "rollback") {
96
- const { runRollbackCommand } = await import("./rollback-CXS1tAa-.mjs");
96
+ const { runRollbackCommand } = await import("./rollback-CIrm2txZ.mjs");
97
97
  return runRollbackCommand(root, args.deployId || void 0, args.platform);
98
98
  }
99
99
  if (args.subcommand === "cancel") {
100
100
  if (cloudflare) throw new Error("project: Direct Cloudflare deploys activate only after readiness succeeds, so there is no remote build to cancel.");
101
- const { runCancelDeployCommand } = await import("./cancel-deploy-viAMD0Q_.mjs");
101
+ const { runCancelDeployCommand } = await import("./cancel-deploy-DMPyu1Vt.mjs");
102
102
  return runCancelDeployCommand(root, args.deployId || void 0);
103
103
  }
104
104
  if (args.subcommand === "delete") {
105
105
  if (cloudflare) throw new Error("project: Refusing to delete Cloudflare resources through this command. Direct deployments are additive and existing resources may be shared.");
106
- const { runDeleteCommand } = await import("./delete-BbP5eopu.mjs");
106
+ const { runDeleteCommand } = await import("./delete-DWX6dP4M.mjs");
107
107
  return runDeleteCommand(root, args.name || void 0, { force: args.force });
108
108
  }
109
109
  if (args.subcommand === "purge-cache") {
110
110
  if (cloudflare) throw new Error("project: `void project purge-cache` is available only for projects hosted on a Void platform. For a direct Cloudflare deploy, redeploy or purge the configured ISR KV namespace.");
111
- const { runPurgeCacheCommand } = await import("./cache-oHzrnY3z.mjs");
111
+ const { runPurgeCacheCommand } = await import("./cache-DV37S6dl.mjs");
112
112
  return runPurgeCacheCommand(root, args.projectSlug || void 0);
113
113
  }
114
114
  }
@@ -1,7 +1,7 @@
1
1
  import { r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken, i as getAccountCredential } from "./auth-B6iOCjKI.mjs";
3
3
  import { H as outro, L as log } from "./dist-Cor9XGoz.mjs";
4
- import { c as platformErrorMessage, n as PlatformApiError, r as PlatformClient, s as parsePlatformErrorBody } from "./client-BEkdj1kx.mjs";
4
+ import { c as platformErrorMessage, n as PlatformApiError, r as PlatformClient, s as parsePlatformErrorBody } from "./client-BEMtySaV.mjs";
5
5
  import { h as sanitizeTerminalText, l as formatUrl, m as printSuccess, o as formatCount, p as note } from "./output-BpgYODYx.mjs";
6
6
  import { r as requireProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-Xoi6eTWY.mjs";
7
7
  //#region src/cli/project-team.ts
@@ -1,7 +1,7 @@
1
1
  import { r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken } from "./auth-B6iOCjKI.mjs";
3
3
  import { H as outro, L as log } from "./dist-Cor9XGoz.mjs";
4
- import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
4
+ import { r as PlatformClient } from "./client-BEMtySaV.mjs";
5
5
  import { _ as tablePrefix, i as dim, m as printSuccess } from "./output-BpgYODYx.mjs";
6
6
  import { r as requireProjectBySlug } from "./resolve-project-Xoi6eTWY.mjs";
7
7
  //#region src/cli/project-token.ts
@@ -1,7 +1,7 @@
1
1
  import { r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken } from "./auth-B6iOCjKI.mjs";
3
3
  import { H as outro, L as log } from "./dist-Cor9XGoz.mjs";
4
- import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
4
+ import { r as PlatformClient } from "./client-BEMtySaV.mjs";
5
5
  import { h as sanitizeTerminalText, m as printSuccess, p as note } from "./output-BpgYODYx.mjs";
6
6
  import { r as requireProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-Xoi6eTWY.mjs";
7
7
  //#region src/cli/project-zero-trust.ts
@@ -1,6 +1,6 @@
1
1
  import { n as HeadDescriptor, t as HeadConfig } from "./head-C8K_iGe6.mjs";
2
- import { a as PageRenderMode, t as DevCssAsset } from "./types-7AIz0OZu.mjs";
3
- import { n as CloudBindings, r as CloudContext } from "./handler-BbkSPzGF.mjs";
2
+ import { a as PageRenderMode, t as DevCssAsset } from "./types-w72dljaA.mjs";
3
+ import { n as CloudBindings, r as CloudContext } from "./handler-CQv5YDS0.mjs";
4
4
  //#region src/pages/protocol.d.ts
5
5
  /** Escape characters that are unsafe inside inline <script> tags to prevent XSS. */
6
6
  declare function safeJsonStringify(value: unknown): string;
@@ -1,6 +1,6 @@
1
1
  import { a as join, c as resolve$2, n as dirname, o as normalize, t as basename } from "./dist-ipQi0Q8y.mjs";
2
2
  import { i as voidWarn, r as voidLog } from "./log-BMwmN5Ae.mjs";
3
- import { M as writeProvisionedWranglerConfig, _ as persistMaterializedWranglerConfig, s as assertNoDuplicateMembers, y as readProvisionedBindingEntry } from "./wrangler-F96NnLyb.mjs";
3
+ import { M as writeProvisionedWranglerConfig, _ as persistMaterializedWranglerConfig, s as assertNoDuplicateMembers, y as readProvisionedBindingEntry } from "./wrangler-CDiEBCdS.mjs";
4
4
  import { n as scanWranglerDotenvKeys } from "./dotenv-CNazY3-w.mjs";
5
5
  import { l as resolveCloudflareOperationArgv, n as decodeCloudflareOperationResult, r as encodeCloudflareOperation } from "./cloudflare-process-8jEYIeim.mjs";
6
6
  import { createRequire } from "node:module";
@@ -1 +1 @@
1
- export { f as isRealD1Id, p as isRealHyperdriveId } from "./provision-DtROpNNI.mjs";
1
+ export { f as isRealD1Id, p as isRealHyperdriveId } from "./provision-B7UFrBH7.mjs";
@@ -1,7 +1,7 @@
1
1
  import { r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken } from "./auth-B6iOCjKI.mjs";
3
3
  import { H as outro, L as log } from "./dist-Cor9XGoz.mjs";
4
- import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
4
+ import { r as PlatformClient } from "./client-BEMtySaV.mjs";
5
5
  import { f as import_picocolors, i as dim } from "./output-BpgYODYx.mjs";
6
6
  //#region src/cli/requests.ts
7
7
  async function runRequestsCommand(root, range, status) {
@@ -1,7 +1,7 @@
1
1
  import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
2
2
  import { c as getToken } from "./auth-B6iOCjKI.mjs";
3
3
  import { A as confirm, H as outro, K as select, L as log, O as cancel, tt as isCancel } from "./dist-Cor9XGoz.mjs";
4
- import { r as PlatformClient } from "./client-BEkdj1kx.mjs";
4
+ import { r as PlatformClient } from "./client-BEMtySaV.mjs";
5
5
  import { c as formatRelativeTime, i as dim, m as printSuccess, o as formatCount, r as createSpinner } from "./output-BpgYODYx.mjs";
6
6
  //#region src/cli/rollback.ts
7
7
  async function runRollbackCommand(root, deployId, explicitPlatform) {
@@ -74,7 +74,7 @@ async function runRollbackCommand(root, deployId, explicitPlatform) {
74
74
  }
75
75
  }
76
76
  async function runCloudflareRollback(root, deployId, restorePlatformFlag) {
77
- const { activateCloudflareExistingVersion, readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-DsSaw2BT.mjs");
77
+ const { activateCloudflareExistingVersion, readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-PCM4wucv.mjs");
78
78
  const context = resolveCloudflareOperationContext(root);
79
79
  const status = await readCloudflareWorkerStatus(context);
80
80
  const deployedVersionIds = new Set(status.deployedVersionIds);
@@ -99,19 +99,29 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir) {
99
99
  lines.push(" action: never;");
100
100
  lines.push(" };");
101
101
  lines.push("");
102
+ lines.push(" type PageActionBody<P> = [Extract<P, { body: unknown }>] extends [never]");
103
+ lines.push(" ? Record<string, unknown>");
104
+ lines.push(" : Extract<P, { body: unknown }>[\"body\"];");
105
+ lines.push("");
106
+ lines.push(" type PageNamedActionBody<P, K> = P extends { actions: infer A }");
107
+ lines.push(" ? K extends keyof A");
108
+ lines.push(" ? A[K] extends { body: infer B }");
109
+ lines.push(" ? B");
110
+ lines.push(" : Record<string, unknown>");
111
+ lines.push(" : never");
112
+ lines.push(" : never;");
113
+ lines.push("");
114
+ lines.push(" type PageActionUrl<K extends string, P> = P extends { body: any }");
115
+ lines.push(" ? K");
116
+ lines.push(" : P extends { actions: infer A }");
117
+ lines.push(" ? `${K}?${keyof A & string}`");
118
+ lines.push(" : never;");
119
+ lines.push("");
102
120
  lines.push(" export type ResolveActionBody<U extends string> =");
103
121
  lines.push(" ParseActionUrl<U>[\"base\"] extends keyof PageActionMap");
104
122
  lines.push(" ? ParseActionUrl<U>[\"action\"] extends never");
105
- lines.push(" ? PageActionMap[ParseActionUrl<U>[\"base\"]] extends { body: infer B }");
106
- lines.push(" ? B");
107
- lines.push(" : Record<string, unknown>");
108
- lines.push(" : PageActionMap[ParseActionUrl<U>[\"base\"]] extends { actions: infer A }");
109
- lines.push(" ? ParseActionUrl<U>[\"action\"] extends keyof A");
110
- lines.push(" ? A[ParseActionUrl<U>[\"action\"]] extends { body: infer B }");
111
- lines.push(" ? B");
112
- lines.push(" : Record<string, unknown>");
113
- lines.push(" : never");
114
- lines.push(" : never");
123
+ lines.push(" ? PageActionBody<PageActionMap[ParseActionUrl<U>[\"base\"]]>");
124
+ lines.push(" : PageNamedActionBody<PageActionMap[ParseActionUrl<U>[\"base\"]], ParseActionUrl<U>[\"action\"]>");
115
125
  lines.push(" : Record<string, unknown>;");
116
126
  lines.push("");
117
127
  lines.push(" export type ResolveActionParams<U extends string> =");
@@ -122,20 +132,20 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir) {
122
132
  lines.push(" : never;");
123
133
  lines.push("");
124
134
  lines.push(" export type HasActionParams<U extends string> =");
125
- lines.push(" ResolveActionParams<U> extends Record<string, string> ? true : false;");
135
+ lines.push(" [ResolveActionParams<U>] extends [never]");
136
+ lines.push(" ? false");
137
+ lines.push(" : ResolveActionParams<U> extends Record<string, string> ? true : false;");
138
+ lines.push("");
139
+ lines.push(" type ActionFormBaseOptions = { resetOnSuccess?: boolean };");
126
140
  lines.push("");
127
- lines.push(" export type ActionFormOptions<U extends string> =");
128
- lines.push(" HasActionParams<U> extends true ? { params: ResolveActionParams<U> } : { params?: never };");
141
+ lines.push(" export type ActionFormOptions<U extends string> = ActionFormBaseOptions &");
142
+ lines.push(" (HasActionParams<U> extends true");
143
+ lines.push(" ? { params: ResolveActionParams<U> }");
144
+ lines.push(" : { params?: never });");
129
145
  lines.push("");
130
- lines.push(" export type ActionUrl =");
131
- lines.push(" | {");
132
- lines.push(" [K in keyof PageActionMap]: PageActionMap[K] extends { body: any } ? K : never;");
133
- lines.push(" }[keyof PageActionMap]");
134
- lines.push(" | {");
135
- lines.push(" [K in keyof PageActionMap]: PageActionMap[K] extends { actions: infer A }");
136
- lines.push(" ? `${K & string}?${keyof A & string}`");
137
- lines.push(" : never;");
138
- lines.push(" }[keyof PageActionMap]");
146
+ lines.push(" export type ActionUrl = {");
147
+ lines.push(" [K in keyof PageActionMap]: PageActionUrl<K & string, PageActionMap[K]>;");
148
+ lines.push(" }[keyof PageActionMap]");
139
149
  lines.push("");
140
150
  lines.push(" interface RouteMap {");
141
151
  const routesByPattern = /* @__PURE__ */ new Map();
@@ -190,25 +200,36 @@ function generateRouteTypes(scan, routesDir, outDir, pagesDir) {
190
200
  const actionPages = scan.pages.pages.filter((p) => p.methods.includes("action") || p.methods.includes("actions"));
191
201
  if (actionPages.length > 0 && pagesDir) {
192
202
  lines.push(" interface PageActionMap {");
203
+ const bodiesByPattern = /* @__PURE__ */ new Map();
193
204
  for (const page of actionPages) {
194
205
  const hasAction = page.methods.includes("action");
195
206
  const hasActions = page.methods.includes("actions");
196
207
  if (hasAction && hasActions) throw new Error(`pages: Page '${page.pattern}' exports both "action" and "actions". Use one or the other.`);
197
- lines.push(` ${JSON.stringify(page.pattern)}: {`);
208
+ const body = [];
198
209
  const importPath = relative(outDir, `${pagesDir}/${page.serverPath}`);
199
210
  if (hasActions) {
200
211
  const actionsImport = `(typeof import(${JSON.stringify(importPath)}))["actions"]`;
201
- lines.push(` actions: { [K in keyof ${actionsImport}]: {`);
202
- lines.push(` body: ExtractInput<${actionsImport}[K]["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
203
- lines.push(" } };");
212
+ body.push(` actions: { [K in keyof ${actionsImport}]: {`);
213
+ body.push(` body: ExtractInput<${actionsImport}[K]["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
214
+ body.push(" } };");
204
215
  } else {
205
216
  const importExpr = `(typeof import(${JSON.stringify(importPath)}))["action"]`;
206
- lines.push(` body: ExtractInput<${importExpr}["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
217
+ body.push(` body: ExtractInput<${importExpr}["__validators"]> extends { body: infer B } ? B : Record<string, unknown>;`);
207
218
  }
208
219
  if (page.params.length > 0) {
209
220
  const paramsType = page.params.map((p) => `${p}: string`).join("; ");
210
- lines.push(` params: { ${paramsType} };`);
221
+ body.push(` params: { ${paramsType} };`);
211
222
  }
223
+ const bodies = bodiesByPattern.get(page.pattern);
224
+ if (bodies) bodies.push(body);
225
+ else bodiesByPattern.set(page.pattern, [body]);
226
+ }
227
+ for (const [pattern, bodies] of bodiesByPattern) {
228
+ lines.push(` ${JSON.stringify(pattern)}: {`);
229
+ bodies.forEach((body, index) => {
230
+ if (index > 0) lines.push(" } | {");
231
+ lines.push(...body);
232
+ });
212
233
  lines.push(" };");
213
234
  }
214
235
  lines.push(" }");
@@ -26,29 +26,38 @@ export type ParseActionUrl<U extends string> = U extends `${infer Base}?${infer
26
26
  action: never;
27
27
  };
28
28
  /** Resolve body type for a useForm URL (single action or named action) */
29
- export type ResolveActionBody<U extends string> = ParseActionUrl<U>["base"] extends keyof PageActionMap ? ParseActionUrl<U>["action"] extends never ? PageActionMap[ParseActionUrl<U>["base"]] extends {
30
- body: infer B;
31
- } ? B : Record<string, unknown> : PageActionMap[ParseActionUrl<U>["base"]] extends {
29
+ type PageActionBody<P> = [Extract<P, {
30
+ body: unknown;
31
+ }>] extends [never] ? Record<string, unknown> : Extract<P, {
32
+ body: unknown;
33
+ }>["body"];
34
+ type PageNamedActionBody<P, K> = P extends {
32
35
  actions: infer A;
33
- } ? ParseActionUrl<U>["action"] extends keyof A ? A[ParseActionUrl<U>["action"]] extends {
36
+ } ? K extends keyof A ? A[K] extends {
34
37
  body: infer B;
35
- } ? B : Record<string, unknown> : never : never : Record<string, unknown>;
38
+ } ? B : Record<string, unknown> : never : never;
39
+ export type ResolveActionBody<U extends string> = ParseActionUrl<U>["base"] extends keyof PageActionMap ? ParseActionUrl<U>["action"] extends never ? PageActionBody<PageActionMap[ParseActionUrl<U>["base"]]> : PageNamedActionBody<PageActionMap[ParseActionUrl<U>["base"]], ParseActionUrl<U>["action"]> : Record<string, unknown>;
36
40
  /** Resolve params type */
37
41
  export type ResolveActionParams<U extends string> = ParseActionUrl<U>["base"] extends keyof PageActionMap ? PageActionMap[ParseActionUrl<U>["base"]] extends {
38
42
  params: infer P;
39
43
  } ? P : never : never;
40
44
  /** Has params check */
41
- export type HasActionParams<U extends string> = ResolveActionParams<U> extends Record<string, string> ? true : false;
45
+ export type HasActionParams<U extends string> = [ResolveActionParams<U>] extends [never] ? false : ResolveActionParams<U> extends Record<string, string> ? true : false;
46
+ type ActionFormBaseOptions = {
47
+ resetOnSuccess?: boolean;
48
+ };
42
49
  /** Form options type (requires params for dynamic routes) */
43
- export type ActionFormOptions<U extends string> = HasActionParams<U> extends true ? {
50
+ export type ActionFormOptions<U extends string> = ActionFormBaseOptions & (HasActionParams<U> extends true ? {
44
51
  params: ResolveActionParams<U>;
45
52
  } : {
46
53
  params?: never;
47
- };
48
- /** Valid useForm URLs — single-action pages + "page?name" combos + default actions */
49
- export type ActionUrl = { [K in keyof PageActionMap]: PageActionMap[K] extends {
54
+ });
55
+ type PageActionUrl<K extends string, P> = P extends {
50
56
  body: unknown;
51
- } ? K : never; }[keyof PageActionMap] | { [K in keyof PageActionMap]: PageActionMap[K] extends {
57
+ } ? K : P extends {
52
58
  actions: infer A;
53
- } ? `${K & string}?${keyof A & string}` : never; }[keyof PageActionMap];
54
- //#endregion
59
+ } ? `${K}?${keyof A & string}` : never;
60
+ /** Valid useForm URLs — single-action pages + "page?name" combos + default actions */
61
+ export type ActionUrl = { [K in keyof PageActionMap]: PageActionUrl<K & string, PageActionMap[K]>; }[keyof PageActionMap];
62
+ //#endregion
63
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { i as mysqlMigrationRunner, t as applyMySqlAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
2
- import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
2
+ import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-7FM3Uk2N.mjs";
3
3
  //#region src/runtime/better-auth-mysql.ts
4
4
  async function applyMigrations(env, migrationSchema) {
5
5
  const { createConnection } = await import("mysql2/promise");
@@ -1,5 +1,5 @@
1
1
  import { a as pgMigrationRunner, n as applyPgAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
2
- import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
2
+ import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-7FM3Uk2N.mjs";
3
3
  import { t as disablePgPassFallback } from "../pg-J2HbZIkX.mjs";
4
4
  //#region src/runtime/better-auth-pg.ts
5
5
  async function applyMigrations(env, migrationSchema) {
@@ -1,5 +1,5 @@
1
1
  import { r as applySqliteAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
2
- import { t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
2
+ import { t as createVoidAuthRuntime } from "../better-auth-shared-7FM3Uk2N.mjs";
3
3
  //#region src/runtime/better-auth.ts
4
4
  async function applyMigrations(env, migrationSchema) {
5
5
  const database = env.DB;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="@cloudflare/workers-types" />
2
- import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-BbkSPzGF.mjs";
2
+ import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-CQv5YDS0.mjs";
3
3
  export { BasicAuthOptions, CloudBindings, CloudContext, CloudContextVariables, CloudEnv, type Deferred, type HandlerInput, type InferProps, QueueBatch, QueueMessage, QueueRetryOptions, RenderAssetTags, TypedHandler, TypedQueueHandler, ValidationError, type ValidatorSlots, VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled };
@@ -1,4 +1,4 @@
1
- import { t as LiveClientEvent } from "../live-Bt8Y_0bg.mjs";
1
+ import { t as LiveClientEvent } from "../live-CXJ9yC98.mjs";
2
2
  //#region src/runtime/live-client.d.ts
3
3
  export type LiveSubscribeOptions<Data = unknown> = {
4
4
  id: string;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="@cloudflare/workers-types" />
2
- import { _ as __getLiveBindingName, a as LiveControlErrorCode, b as defineLiveStream, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as __setLiveDev } from "../live-Bt8Y_0bg.mjs";
2
+ import { _ as __getLiveBindingName, a as LiveControlErrorCode, b as defineLiveStream, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as __setLiveDev } from "../live-CXJ9yC98.mjs";
3
3
  export { LiveClientEvent, LiveConnectHookContext, LiveConnectOptions, LiveControlError, LiveControlErrorCode, LiveControlOperation, LiveControlOperationResult, LiveControlOptions, LiveControlRequest, LiveControlResponse, LiveHookContext, LiveLimits, LivePublishOptions, LiveStream, LiveStreamOptions, LiveSubscribeHookContext, __getLiveBindingName, __setLiveBindingName, __setLiveDev, defineLiveStream };