@voltro/cli 0.52.0 → 0.53.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 (195) hide show
  1. package/CHANGELOG.md +229 -0
  2. package/THIRD-PARTY-NOTICES.md +8311 -3318
  3. package/dist/{apiBuild-CSFI8QGq.js → apiBuild-CaPfoWku.js} +11 -5
  4. package/dist/apiBuild-DHtLXYx9.js +2 -0
  5. package/dist/bin.js +1 -1
  6. package/dist/build-D-OnvNMf.js +843 -0
  7. package/dist/{checkCommand-COmqc2cB.js → checkCommand-C5elt0tW.js} +6 -6
  8. package/dist/{checkCommand-2SbqzukH.js → checkCommand-D2ZduVlh.js} +1 -1
  9. package/dist/codegen-BWpt3VgF.js +2 -0
  10. package/dist/{codegen-VF479Cnb.js → codegen-FEk8AZHb.js} +2 -2
  11. package/dist/{codegenCommand-DCdG2JN-.js → codegenCommand-BOiWQ5hz.js} +4 -4
  12. package/dist/{codemodRunner-r7J9lIa7.js → codemodRunner-BjtB2lq6.js} +109 -11
  13. package/dist/{commands-Cc_nV8WI.js → commands-DyxAmhP0.js} +30 -30
  14. package/dist/{dashboardCommand-C-gKvwqh.js → dashboardCommand-BdKTyT13.js} +5 -5
  15. package/dist/{dataCommand-BgpBHnlB.js → dataCommand-Bab9X7s8.js} +2 -2
  16. package/dist/{dbCommand-sHedr-NJ.js → dbCommand-06O2finM.js} +277 -236
  17. package/dist/dbCommand-B1EXBC6f.js +2 -0
  18. package/dist/{dev-CRHoCEiy.js → dev-C6LGF4iY.js} +3006 -2426
  19. package/dist/{dev--A3nsxA3.js → dev-GjJWAYo2.js} +1 -1
  20. package/dist/doctorCommand-B0hX0tdz.js +2 -0
  21. package/dist/{doctorCommand-DtfJ3FA6.js → doctorCommand-etMkflRc.js} +101 -69
  22. package/dist/{dormancyCommand-Drn7o0No.js → dormancyCommand-UwZ1AZzB.js} +1 -1
  23. package/dist/{embeddingsCommand-Z-jO1fWN.js → embeddingsCommand-C70zWHwo.js} +1 -1
  24. package/dist/{envCommand-D4gCrrTZ.js → envCommand-dSyKvRkM.js} +18 -18
  25. package/dist/{evolveCommand-CMROeKeA.js → evolveCommand-CG0_ebO5.js} +2 -2
  26. package/dist/fileConventions-DASGEmj-.js +35 -0
  27. package/dist/{fileTaxonomy-DvDUV9wq.js → fileTaxonomy-B7uxipWS.js} +55 -55
  28. package/dist/fontPipeline-LxIHa1vo.js +2 -0
  29. package/dist/fontPipeline-Tsh8kZfA.js +152 -0
  30. package/dist/frameworkTableAssembly-C_7Z-rMs.js +2 -0
  31. package/dist/{frameworkTableAssembly-w-XnLa3q.js → frameworkTableAssembly-DKx3ba3S.js} +5 -5
  32. package/dist/imagePipeline-B_GVJgm6.js +2 -0
  33. package/dist/imagePipeline-CBZmjT4i.js +127 -0
  34. package/dist/index.js +1 -1
  35. package/dist/{infoCommand-DXM868o_.js → infoCommand-_53iOc_j.js} +1 -1
  36. package/dist/{inspect-CtL_xTbu.js → inspect-Bd8-9wsi.js} +1 -1
  37. package/dist/inspect-CuoDInfZ.js +2 -0
  38. package/dist/{inspectGateHint-BjnFubmH.js → inspectGateHint-4LxkNtrz.js} +1 -1
  39. package/dist/manifestBuild-C4-J1-m_.js +2 -0
  40. package/dist/{manifestBuild-CuU1VrSm.js → manifestBuild-Cqgsx2bM.js} +1 -1
  41. package/dist/{metaCommands-C6RFmF1r.js → metaCommands-Cn2oboG4.js} +8 -2
  42. package/dist/{migrate-D0F-eTlK.js → migrate-Cko9rswM.js} +2 -2
  43. package/dist/{pageConvention-CzUiSbtU.js → pageConvention-C938S8oC.js} +1 -1
  44. package/dist/{privacyCommand-DGdopOI6.js → privacyCommand-DWTQMC6R.js} +2 -2
  45. package/dist/{probeCommand-C9gazU0H.js → probeCommand-DkGGLknv.js} +83 -24
  46. package/dist/{renderModeScan-CcH2X1_D.js → renderModeScan-CUbOeOAg.js} +3 -1
  47. package/dist/{renderProfile-Ck32Fzxr.js → renderProfile-CskIgAfn.js} +2 -2
  48. package/dist/{runtimeTrace-BPQyCmC5.js → runtimeTrace-c0APJz7E.js} +1 -1
  49. package/dist/{sdkgen-Se88ifTd.js → sdkgen-BiQCgIEr.js} +1 -1
  50. package/dist/{serveCommand-DkP3OT0W.js → serveCommand-CueKQgzl.js} +869 -805
  51. package/dist/serveCommand-DsnrVN3U.js +2 -0
  52. package/dist/serveEntry.js +1 -1
  53. package/dist/start-BJzZLbt8.js +3 -0
  54. package/dist/start-ekPan8BT.js +1510 -0
  55. package/dist/startEntry.js +1 -1
  56. package/dist/{staticCommand-BwNEDlSU.js → staticCommand-xlSL-IWk.js} +1 -1
  57. package/dist/{test-f3amja6a.js → test-BWPQcRoB.js} +1 -1
  58. package/dist/updateCommand-Bqql_rsQ.js +2 -0
  59. package/dist/{updateCommand-BMk2e4ky.js → updateCommand-C_8I8Rzo.js} +139 -115
  60. package/dist/webDev-C7jWJ5dX.js +2 -0
  61. package/dist/{webDev-BgWL9gKV.js → webDev-oczpugbx.js} +1455 -922
  62. package/dist/{webhooksCommand-CoIO3jbj.js → webhooksCommand-4SVPDjKg.js} +1 -1
  63. package/package.json +60 -19
  64. package/templates/AGENTS.md +5 -3
  65. package/templates/agent-docs/_index.md +5 -3
  66. package/templates/agent-docs/_manifest.json +20 -4
  67. package/templates/agent-docs/ai.md +2 -2
  68. package/templates/agent-docs/authentication.md +1 -1
  69. package/templates/agent-docs/cli.md +2 -2
  70. package/templates/agent-docs/configuration.md +17 -0
  71. package/templates/agent-docs/data.md +470 -26
  72. package/templates/agent-docs/database/advancedqueries.md +7 -7
  73. package/templates/agent-docs/database/columntypes.md +2 -2
  74. package/templates/agent-docs/database/querying.md +1 -1
  75. package/templates/agent-docs/database/schema.md +1 -1
  76. package/templates/agent-docs/database/seedsdialects.md +1 -1
  77. package/templates/agent-docs/database/transactions.md +3 -3
  78. package/templates/agent-docs/deployment.md +8 -0
  79. package/templates/agent-docs/internationalization.md +2 -2
  80. package/templates/agent-docs/introduction.md +7 -1
  81. package/templates/agent-docs/local-first-mobile.md +102 -4
  82. package/templates/agent-docs/observability.md +2 -0
  83. package/templates/agent-docs/plugins/auth.md +1 -1
  84. package/templates/agent-docs/plugins/comments.md +142 -0
  85. package/templates/agent-docs/plugins/notifications.md +47 -4
  86. package/templates/agent-docs/plugins/presence.md +16 -3
  87. package/templates/agent-docs/plugins/prometheus.md +1 -1
  88. package/templates/agent-docs/plugins/queue.md +129 -0
  89. package/templates/agent-docs/plugins.md +11 -7
  90. package/templates/agent-docs/reference.md +16 -4
  91. package/templates/agent-docs/routing.md +527 -3
  92. package/templates/agent-docs/schema-driven-ui.md +214 -3
  93. package/templates/agent-docs/security.md +3 -3
  94. package/templates/agent-docs/whats-new.md +160 -66
  95. package/templates/apps/api-ai/package.json +6 -6
  96. package/templates/apps/api-auth/package.json +8 -8
  97. package/templates/apps/api-backend/package.json +7 -7
  98. package/templates/apps/api-backend-deactivation/package.json +7 -7
  99. package/templates/apps/api-backend-mail/package.json +8 -8
  100. package/templates/apps/api-backend-mariadb/package.json +9 -9
  101. package/templates/apps/api-backend-sqlite/package.json +8 -8
  102. package/templates/apps/api-backend-storage/package.json +8 -8
  103. package/templates/apps/api-cms/package.json +9 -9
  104. package/templates/apps/api-collab/package.json +8 -8
  105. package/templates/apps/api-data-advanced/package.json +8 -8
  106. package/templates/apps/api-durable/package.json +8 -8
  107. package/templates/apps/api-feature-flags/package.json +9 -9
  108. package/templates/apps/api-governance/package.json +8 -8
  109. package/templates/apps/api-kv/package.json +8 -8
  110. package/templates/apps/api-moderation/package.json +8 -8
  111. package/templates/apps/api-observability/package.json +8 -8
  112. package/templates/apps/api-ratelimit/package.json +8 -8
  113. package/templates/apps/api-rbac/package.json +8 -8
  114. package/templates/apps/api-rest/package.json +7 -7
  115. package/templates/apps/api-row-history/package.json +8 -8
  116. package/templates/apps/api-saas/package.json +10 -10
  117. package/templates/apps/api-saas-starter/package.json +10 -10
  118. package/templates/apps/api-search/package.json +8 -8
  119. package/templates/apps/api-status/package.json +8 -8
  120. package/templates/apps/api-webhooks/package.json +9 -9
  121. package/templates/apps/changelog/app.config.ts +26 -2
  122. package/templates/apps/changelog/content/releases/{0.1.0.mdx → v0-1-0.mdx} +0 -1
  123. package/templates/apps/changelog/content/releases/{0.2.0.mdx → v0-2-0.mdx} +0 -1
  124. package/templates/apps/changelog/package.json +8 -8
  125. package/templates/apps/changelog/src/collections/releases.collection.ts +48 -0
  126. package/templates/apps/changelog/src/globals.d.ts +1 -1
  127. package/templates/apps/changelog/src/locales/de.ts +1 -1
  128. package/templates/apps/changelog/src/locales/en.ts +1 -1
  129. package/templates/apps/changelog/src/pages/[locale]/[slug]/page.tsx +7 -4
  130. package/templates/apps/changelog/src/pages/[locale]/mirrors.test.tsx +13 -41
  131. package/templates/apps/changelog/src/pages/[slug]/page.test.tsx +26 -51
  132. package/templates/apps/changelog/src/pages/[slug]/page.tsx +21 -19
  133. package/templates/apps/changelog/src/pages/page.test.tsx +14 -37
  134. package/templates/apps/changelog/src/pages/page.tsx +18 -12
  135. package/templates/apps/edge-functions/package.json +2 -2
  136. package/templates/apps/frontend-admin/package.json +8 -8
  137. package/templates/apps/frontend-app/package.json +9 -9
  138. package/templates/apps/frontend-auth/package.json +8 -8
  139. package/templates/apps/frontend-blank/package.json +7 -7
  140. package/templates/apps/frontend-cms/package.json +9 -9
  141. package/templates/apps/frontend-collab/package.json +10 -10
  142. package/templates/apps/frontend-contact/package.json +7 -7
  143. package/templates/apps/frontend-dashboard/package.json +7 -7
  144. package/templates/apps/frontend-docs/content/docs/de/guides/first-page.md +4 -0
  145. package/templates/apps/frontend-docs/content/docs/de/intro/getting-started.md +4 -0
  146. package/templates/apps/frontend-docs/content/docs/en/guides/first-page.md +4 -0
  147. package/templates/apps/frontend-docs/content/docs/en/intro/getting-started.md +4 -0
  148. package/templates/apps/frontend-docs/package.json +8 -6
  149. package/templates/apps/frontend-docs/src/collections/docs.collection.ts +21 -0
  150. package/templates/apps/frontend-docs/src/locales/de.ts +0 -5
  151. package/templates/apps/frontend-docs/src/locales/en.ts +0 -5
  152. package/templates/apps/frontend-docs/src/pages/[locale]/docs/[...slug]/page.tsx +17 -9
  153. package/templates/apps/frontend-docs/src/pages/[locale]/mirrors.test.tsx +10 -5
  154. package/templates/apps/frontend-docs/src/pages/[locale]/page.tsx +8 -0
  155. package/templates/apps/frontend-docs/src/pages/docs/[...slug]/page.test.tsx +53 -15
  156. package/templates/apps/frontend-docs/src/pages/docs/[...slug]/page.tsx +27 -33
  157. package/templates/apps/frontend-docs/src/pages/page.test.tsx +17 -3
  158. package/templates/apps/frontend-docs/src/pages/page.tsx +16 -12
  159. package/templates/apps/frontend-i18n/package.json +6 -6
  160. package/templates/apps/frontend-landing/package.json +6 -6
  161. package/templates/apps/frontend-portal/package.json +8 -8
  162. package/templates/apps/frontend-saas/package.json +8 -8
  163. package/templates/apps/frontend-spa/package.json +7 -7
  164. package/templates/apps/frontend-ssr/package.json +7 -7
  165. package/templates/apps/frontend-ssr-api/package.json +8 -8
  166. package/templates/apps/frontend-static-blog/content/posts/cms-to-ssg.md +12 -0
  167. package/templates/apps/frontend-static-blog/content/posts/hello-static.md +12 -0
  168. package/templates/apps/frontend-static-blog/content/posts/islands-not-hydration.md +14 -0
  169. package/templates/apps/frontend-static-blog/package.json +8 -6
  170. package/templates/apps/frontend-static-blog/src/collections/posts.collection.ts +27 -0
  171. package/templates/apps/frontend-static-blog/src/pages/[locale]/blog/[slug]/page.tsx +7 -4
  172. package/templates/apps/frontend-static-blog/src/pages/[locale]/mirrors.test.tsx +7 -1
  173. package/templates/apps/frontend-static-blog/src/pages/blog/[slug]/page.test.tsx +19 -9
  174. package/templates/apps/frontend-static-blog/src/pages/blog/[slug]/page.tsx +19 -21
  175. package/templates/apps/frontend-static-blog/src/pages/page.test.tsx +18 -5
  176. package/templates/apps/frontend-static-blog/src/pages/page.tsx +21 -14
  177. package/templates/apps/frontend-status/package.json +8 -8
  178. package/templates/apps/mobile-app/package.json +4 -4
  179. package/dist/apiBuild-BYBpL7Pz.js +0 -2
  180. package/dist/build-CPgcMQug.js +0 -793
  181. package/dist/codegen-CctkDO-1.js +0 -2
  182. package/dist/dbCommand-DNb6yeOG.js +0 -2
  183. package/dist/doctorCommand-CqoWA2p5.js +0 -2
  184. package/dist/fileConventions-DOqD3lPS.js +0 -34
  185. package/dist/frameworkTableAssembly-C6ETawPR.js +0 -2
  186. package/dist/inspect-CuGDYES0.js +0 -2
  187. package/dist/manifestBuild-CPjhvM62.js +0 -2
  188. package/dist/serveCommand-DLc-BznW.js +0 -2
  189. package/dist/start-DfL3fOiN.js +0 -3
  190. package/dist/start-jw89Xbqy.js +0 -1339
  191. package/dist/updateCommand-5gFVfK5q.js +0 -2
  192. package/dist/webDev-CZbTsDcH.js +0 -2
  193. package/templates/apps/changelog/scripts/generate-rss.mjs +0 -38
  194. package/templates/apps/changelog/src/lib/releases.ts +0 -21
  195. package/templates/apps/frontend-static-blog/src/content/posts.ts +0 -64
@@ -2,40 +2,43 @@ import { t as e } from "./nodeEnvironment-cGFAj1J8.js";
2
2
  import { n as t } from "./loadEnv-D9nEOClM.js";
3
3
  import { t as n } from "./bootRefusal-pgvDxlrU.js";
4
4
  import { r } from "./appPort-B_HpJ_ck.js";
5
- import { A as i, _ as a, g as o, h as s, m as c, o as l } from "./fileConventions-DOqD3lPS.js";
6
- import { A as u, D as d, a as f, h as p, j as m, k as h } from "./inspect-CtL_xTbu.js";
5
+ import { _ as i, g as a, h as o, j as s, s as c, v as l } from "./fileConventions-DASGEmj-.js";
6
+ import { A as u, D as d, a as f, h as p, j as m, k as h } from "./inspect-Bd8-9wsi.js";
7
7
  import { n as g } from "./agentsMd-0l980yhL.js";
8
- import { c as _, p as v, t as y } from "./renderModeScan-CcH2X1_D.js";
9
- import { t as b } from "./pageConvention-CzUiSbtU.js";
10
- import { i as x, n as S, r as C, t as w } from "./runtimeRegistry-DMeKfTHP.js";
11
- import { n as T } from "./logFileSink-B4uP8pvf.js";
12
- import { basename as E, dirname as D, join as O, relative as k, resolve as A, sep as j } from "node:path";
13
- import { existsSync as M, promises as N, readFileSync as P, readdirSync as F, statSync as ee, unwatchFile as te, watchFile as ne } from "node:fs";
14
- import { fileURLToPath as re, pathToFileURL as I } from "node:url";
15
- import { addSink as L, createLogger as R, printReadyBlock as z } from "@voltro/logger";
16
- import { createRequire as ie } from "node:module";
17
- import { classifyRequestOrigin as B, currentTraceContext as V, resolveOriginGuardConfig as ae, resolveSecret as oe } from "@voltro/runtime";
18
- import { homedir as H } from "node:os";
19
- import { FRAMEWORK_ENV_CATALOG as se, appEnvEntries as U, checkEnvNaming as ce, formatEnvErrors as le, installEnvSnapshot as W, isEnvContract as ue, pluginEnvEntries as de, renderDotEnvExample as fe, resolveEnv as pe } from "@voltro/env";
20
- import { __installPublicEnv as me } from "@voltro/env/public";
21
- import { mkdir as G, writeFile as he } from "node:fs/promises";
22
- import { createHash as ge } from "node:crypto";
23
- import { spawn as _e } from "node:child_process";
24
- import { createConnection as K } from "node:net";
25
- import { FORM_FLASH_SCRIPT_ID as ve, FORM_KEY_FIELD as ye, FORM_PATH_PREFIX as be, FORM_PATH_PREFIX as xe, FORM_REDIRECT_FIELD as Se, formDataToInput as Ce, validateFields as we } from "@voltro/client/form";
26
- import { PassThrough as Te } from "node:stream";
8
+ import { c as _, f as v, p as y, t as b } from "./renderModeScan-CUbOeOAg.js";
9
+ import { a as x, c as S, d as C, f as w, i as T, l as E, o as D, p as O, r as k, s as A, t as j } from "./imagePipeline-CBZmjT4i.js";
10
+ import { d as M, n as N } from "./fontPipeline-Tsh8kZfA.js";
11
+ import { t as P } from "./pageConvention-C938S8oC.js";
12
+ import { i as ee, n as te, r as ne, t as re } from "./runtimeRegistry-DMeKfTHP.js";
13
+ import { n as ie } from "./logFileSink-B4uP8pvf.js";
14
+ import { basename as ae, dirname as F, join as I, relative as L, resolve as R, sep as z } from "node:path";
15
+ import { existsSync as B, promises as V, readFileSync as oe, readdirSync as H, statSync as U, unwatchFile as se, watchFile as ce } from "node:fs";
16
+ import { fileURLToPath as W, pathToFileURL as G } from "node:url";
17
+ import { addSink as le, createLogger as K, printReadyBlock as ue } from "@voltro/logger";
18
+ import { createRequire as q } from "node:module";
19
+ import { classifyRequestOrigin as de, currentTraceContext as fe, resolveOriginGuardConfig as pe, resolveSecret as me } from "@voltro/runtime";
20
+ import { homedir as he } from "node:os";
21
+ import { FRAMEWORK_ENV_CATALOG as ge, appEnvEntries as _e, checkEnvNaming as ve, formatEnvErrors as ye, installEnvSnapshot as be, isEnvContract as xe, pluginEnvEntries as Se, renderDotEnvExample as Ce, resolveEnv as we } from "@voltro/env";
22
+ import { __installPublicEnv as Te } from "@voltro/env/public";
23
+ import { mkdir as Ee, readFile as De, writeFile as J } from "node:fs/promises";
24
+ import { createHash as Oe, createHmac as ke, randomBytes as Ae, timingSafeEqual as je } from "node:crypto";
25
+ import { spawn as Me } from "node:child_process";
26
+ import { createConnection as Ne } from "node:net";
27
+ import { FORM_FLASH_SCRIPT_ID as Pe, FORM_KEY_FIELD as Fe, FORM_PATH_PREFIX as Ie, FORM_PATH_PREFIX as Le, FORM_REDIRECT_FIELD as Re, formDataToInput as ze, validateFields as Y } from "@voltro/client/form";
28
+ import { buildFeed as Be, contentArtifactPath as Ve, getCollection as He, getEntry as Ue, invalidateContentCache as We, registeredCollections as Ge, setContentRoot as Ke, validateReferences as qe } from "@voltro/content";
29
+ import { PassThrough as Je } from "node:stream";
27
30
  //#region src/buildToolImport.ts
28
- var Ee = (e) => {
31
+ var Ye = (e) => {
29
32
  let t = e;
30
33
  return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
31
- }, De = async (e, t) => {
34
+ }, Xe = async (e, t) => {
32
35
  try {
33
36
  return await t();
34
37
  } catch (t) {
35
- throw Ee(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
38
+ throw Ye(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
36
39
  }
37
- }, Oe = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", ke = (e, t) => t ? `${e} | undefined` : e, Ae = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${ke(t.tsType, t.optional)}`).join("\n"), je = async (e, t) => {
38
- let n = Ae(t, () => !0), r = `${Oe}
40
+ }, Ze = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", Qe = (e, t) => t ? `${e} | undefined` : e, $e = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${Qe(t.tsType, t.optional)}`).join("\n"), et = async (e, t) => {
41
+ let n = $e(t, () => !0), r = `${Ze}
39
42
  import '@voltro/env/server'
40
43
 
41
44
  declare module '@voltro/env/server' {
@@ -44,9 +47,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
44
47
  }
45
48
  }
46
49
  `;
47
- await he(O(e, "env.generated.d.ts"), r, "utf8");
48
- }, Me = async (e, t) => {
49
- let n = Ae(t, (e) => e === "public"), r = `${Oe}
50
+ await J(I(e, "env.generated.d.ts"), r, "utf8");
51
+ }, tt = async (e, t) => {
52
+ let n = $e(t, (e) => e === "public"), r = `${Ze}
50
53
  import '@voltro/env/public'
51
54
 
52
55
  declare module '@voltro/env/public' {
@@ -54,10 +57,10 @@ declare module '@voltro/env/public' {
54
57
  ${n.length > 0 ? n : " // (no public variables declared)"}
55
58
  }
56
59
  }
57
- `, i = O(e, "src");
58
- await G(i, { recursive: !0 }), await he(O(i, "voltro-env.d.ts"), r, "utf8");
59
- }, Ne = async (e, t) => {
60
- let n = `${Oe}
60
+ `, i = I(e, "src");
61
+ await Ee(i, { recursive: !0 }), await J(I(i, "voltro-env.d.ts"), r, "utf8");
62
+ }, nt = async (e, t) => {
63
+ let n = `${Ze}
61
64
  import { __installPublicEnv } from '@voltro/env/public'
62
65
 
63
66
  export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
@@ -65,14 +68,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
65
68
  // Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
66
69
  __installPublicEnv(publicEnvValues)
67
70
  `;
68
- await G(e, { recursive: !0 }), await he(O(e, "env.public.ts"), n, "utf8");
69
- }, Pe = async (e) => {
70
- let t = ue(e.rawEnv) ? e.rawEnv : void 0, n = await pe({
71
+ await Ee(e, { recursive: !0 }), await J(I(e, "env.public.ts"), n, "utf8");
72
+ }, rt = async (e) => {
73
+ let t = xe(e.rawEnv) ? e.rawEnv : void 0, n = await we({
71
74
  contract: t,
72
- resolveSecret: oe
73
- }), r = [...n.errors, ...ce(t, e.appType)];
74
- if (r.length > 0) throw Error(le(r));
75
- W(n.values), e.appType === "web" && me(n.publicValues);
75
+ resolveSecret: me
76
+ }), r = [...n.errors, ...ve(t, e.appType)];
77
+ if (r.length > 0) throw Error(ye(r));
78
+ be(n.values), e.appType === "web" && Te(n.publicValues);
76
79
  let i = t ? Object.keys(t.vars).length : 0;
77
80
  if (i > 0) {
78
81
  let r = Object.keys(n.publicValues).length;
@@ -84,20 +87,20 @@ __installPublicEnv(publicEnvValues)
84
87
  n.length > 0 && e.log.warn(`env: ${n.length} secret var(s) declared on a web app — secrets are reachable only from server-side render code and are NEVER bundled. Prefer declaring secrets on the api.`, { keys: n });
85
88
  }
86
89
  }
87
- return e.generateTypes && t && (e.appType === "api" ? await je(e.root, t) : await Me(e.root, t)), {
90
+ return e.generateTypes && t && (e.appType === "api" ? await et(e.root, t) : await tt(e.root, t)), {
88
91
  resolved: n,
89
92
  contract: t
90
93
  };
91
- }, q = (e) => {
92
- let t = U(e.contract), n = (e.plugins ?? []).flatMap((e) => de(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : se, i = /* @__PURE__ */ new Set(), a = [];
94
+ }, it = (e) => {
95
+ let t = _e(e.contract), n = (e.plugins ?? []).flatMap((e) => Se(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ge, i = /* @__PURE__ */ new Set(), a = [];
93
96
  for (let e of [
94
97
  ...t,
95
98
  ...n,
96
99
  ...r
97
100
  ]) i.has(e.key) || (i.add(e.key), a.push(e));
98
101
  return a;
99
- }, Fe = (e, t, n = (e) => process.env[e]) => {
100
- let r = q(t).map((e) => {
102
+ }, at = (e, t, n = (e) => process.env[e]) => {
103
+ let r = it(t).map((e) => {
101
104
  let t = n(e.key) !== void 0;
102
105
  return {
103
106
  ...e,
@@ -114,33 +117,33 @@ __installPublicEnv(publicEnvValues)
114
117
  missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
115
118
  }
116
119
  };
117
- }, Ie = (e, t) => {
118
- let n = q({
120
+ }, ot = (e, t) => {
121
+ let n = it({
119
122
  ...e,
120
123
  includeFramework: !1
121
124
  });
122
- return fe(n, {
125
+ return Ce(n, {
123
126
  includeFramework: e.includeFramework !== !1,
124
127
  ...t ? { header: t } : {}
125
128
  });
126
- }, Le = async (e, t) => {
129
+ }, st = async (e, t) => {
127
130
  let n = e;
128
131
  for (;;) {
129
- let e = O(n, "node_modules", t);
132
+ let e = I(n, "node_modules", t);
130
133
  try {
131
- if ((await N.stat(e)).isDirectory()) {
132
- let t = await N.realpath(e);
134
+ if ((await V.stat(e)).isDirectory()) {
135
+ let t = await V.realpath(e);
133
136
  return t.includes("/node_modules/") ? null : t;
134
137
  }
135
138
  } catch {}
136
- let r = D(n);
139
+ let r = F(n);
137
140
  if (r === n) return null;
138
141
  n = r;
139
142
  }
140
- }, Re = async (e) => {
143
+ }, ct = async (e) => {
141
144
  let t;
142
145
  try {
143
- let n = await N.readFile(O(e, "package.json"), "utf8"), r = JSON.parse(n);
146
+ let n = await V.readFile(I(e, "package.json"), "utf8"), r = JSON.parse(n);
144
147
  t = Object.keys({
145
148
  ...r.dependencies,
146
149
  ...r.devDependencies
@@ -149,11 +152,11 @@ __installPublicEnv(publicEnvValues)
149
152
  return [];
150
153
  }
151
154
  return (await Promise.all(t.map(async (t) => {
152
- let n = await Le(e, t);
155
+ let n = await st(e, t);
153
156
  if (n === null) return null;
154
- let r = O(n, "src");
157
+ let r = I(n, "src");
155
158
  try {
156
- if (!(await N.stat(r)).isDirectory()) return null;
159
+ if (!(await V.stat(r)).isDirectory()) return null;
157
160
  } catch {
158
161
  return null;
159
162
  }
@@ -162,11 +165,11 @@ __installPublicEnv(publicEnvValues)
162
165
  dir: r
163
166
  };
164
167
  }))).filter((e) => e !== null);
165
- }, ze = 500, Be = (e, t, n = {}) => {
168
+ }, lt = 500, ut = (e, t, n = {}) => {
166
169
  if (e.length === 0) return () => {};
167
- let r = (e) => n.root ? k(n.root, e) : e, i = !1, a = (e) => {
170
+ let r = (e) => n.root ? L(n.root, e) : e, i = !1, a = (e) => {
168
171
  i || (i = !0, t.warn(`.env changed (${r(e)}) — hard-restarting: process.env is read once at boot, a reload would keep stale values`, { file: r(e) }), Promise.resolve().then(() => n.onBeforeRestart?.()).catch((e) => t.warn(".env restart: onBeforeRestart failed (continuing)", {}, e)).finally(() => {
169
- let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
172
+ let e = Me(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
170
173
  stdio: "inherit",
171
174
  env: process.env,
172
175
  cwd: n.cwd ?? process.cwd()
@@ -180,22 +183,22 @@ __installPublicEnv(publicEnvValues)
180
183
  });
181
184
  }));
182
185
  };
183
- for (let t of e) ne(t, { interval: ze }, (e, n) => {
186
+ for (let t of e) ce(t, { interval: lt }, (e, n) => {
184
187
  e.mtimeMs !== n.mtimeMs && a(t);
185
188
  });
186
189
  return t.info("watching .env files for changes", {
187
190
  files: e.map(r),
188
- intervalMs: ze
191
+ intervalMs: lt
189
192
  }), () => {
190
- for (let t of e) te(t);
193
+ for (let t of e) se(t);
191
194
  };
192
- }, Ve = [{
195
+ }, dt = [{
193
196
  host: "127.0.0.1",
194
197
  family: "IPv4"
195
198
  }, {
196
199
  host: "::1",
197
200
  family: "IPv6"
198
- }], J = (e, t, n) => new Promise((r) => {
201
+ }], ft = (e, t, n) => new Promise((r) => {
199
202
  let i = !1, a = (e) => {
200
203
  if (!i) {
201
204
  i = !0;
@@ -204,15 +207,15 @@ __installPublicEnv(publicEnvValues)
204
207
  } catch {}
205
208
  r(e);
206
209
  }
207
- }, o = K({
210
+ }, o = Ne({
208
211
  host: e,
209
212
  port: t
210
213
  });
211
214
  o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
212
- }), He = async (e, t = 400) => ({ families: (await Promise.all(Ve.map(async (n) => ({
215
+ }), pt = async (e, t = 400) => ({ families: (await Promise.all(dt.map(async (n) => ({
213
216
  family: n.family,
214
- taken: await J(n.host, e, t)
215
- })))).filter((e) => e.taken).map((e) => e.family) }), Ue = (e, t, n) => [
217
+ taken: await ft(n.host, e, t)
218
+ })))).filter((e) => e.taken).map((e) => e.family) }), mt = (e, t, n) => [
216
219
  `${t}: port ${e} is already being served (${n.join(" + ")}).`,
217
220
  "",
218
221
  " Refusing to start. This is NOT a spurious check — a second listener can",
@@ -227,26 +230,26 @@ __installPublicEnv(publicEnvValues)
227
230
  "",
228
231
  " Then re-run. To use a different port instead, change `port` in",
229
232
  " app.config.ts."
230
- ].join("\n"), We = async (e, t) => {
231
- let { families: r } = await He(e);
232
- if (r.length !== 0) throw n(Ue(e, t, r));
233
- }, Ge = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Ke = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, qe = (e) => {
233
+ ].join("\n"), ht = async (e, t) => {
234
+ let { families: r } = await pt(e);
235
+ if (r.length !== 0) throw n(mt(e, t, r));
236
+ }, gt = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", _t = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, vt = (e) => {
234
237
  let t = [], n = e;
235
238
  for (let e = 0; e < 12; e++) {
236
- let e = O(n, "node_modules");
237
- M(e) && t.push(e);
238
- let r = D(n);
239
+ let e = I(n, "node_modules");
240
+ B(e) && t.push(e);
241
+ let r = F(n);
239
242
  if (r === n) break;
240
243
  n = r;
241
244
  }
242
245
  return t;
243
- }, Je = (e) => {
246
+ }, yt = (e) => {
244
247
  let t = /* @__PURE__ */ new Set([e]), n = e;
245
248
  for (let e = 0; e < 12; e++) {
246
249
  for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
247
250
  let r;
248
251
  try {
249
- r = P(O(n, e), "utf8");
252
+ r = oe(I(n, e), "utf8");
250
253
  } catch {
251
254
  continue;
252
255
  }
@@ -257,38 +260,38 @@ __installPublicEnv(publicEnvValues)
257
260
  if (i === "" || i.includes("*")) continue;
258
261
  let a;
259
262
  try {
260
- a = F(O(n, i), { withFileTypes: !0 });
263
+ a = H(I(n, i), { withFileTypes: !0 });
261
264
  } catch {
262
265
  continue;
263
266
  }
264
- for (let e of a) e.isDirectory() && t.add(O(n, i, e.name));
267
+ for (let e of a) e.isDirectory() && t.add(I(n, i, e.name));
265
268
  }
266
269
  }
267
270
  for (let e of ["packages", "apps"]) {
268
271
  let r;
269
272
  try {
270
- r = F(O(n, e), { withFileTypes: !0 });
273
+ r = H(I(n, e), { withFileTypes: !0 });
271
274
  } catch {
272
275
  continue;
273
276
  }
274
- for (let i of r) i.isDirectory() && t.add(O(n, e, i.name));
277
+ for (let i of r) i.isDirectory() && t.add(I(n, e, i.name));
275
278
  }
276
- let e = D(n);
279
+ let e = F(n);
277
280
  if (e === n) break;
278
281
  n = e;
279
282
  }
280
283
  return [...t];
281
- }, Ye = (e) => {
284
+ }, bt = (e) => {
282
285
  let t = [];
283
- for (let n of Je(e)) {
284
- let e = O(n, "node_modules", "@voltro"), r;
286
+ for (let n of yt(e)) {
287
+ let e = I(n, "node_modules", "@voltro"), r;
285
288
  try {
286
- r = F(e);
289
+ r = H(e);
287
290
  } catch {
288
291
  continue;
289
292
  }
290
293
  for (let n of r) {
291
- let r = O(e, n), i = Xe(r);
294
+ let r = I(e, n), i = xt(r);
292
295
  i !== void 0 && t.push({
293
296
  pkg: `@voltro/${n}`,
294
297
  version: i,
@@ -297,38 +300,38 @@ __installPublicEnv(publicEnvValues)
297
300
  }
298
301
  }
299
302
  return t;
300
- }, Xe = (e) => {
303
+ }, xt = (e) => {
301
304
  try {
302
- let t = JSON.parse(P(O(e, "package.json"), "utf8"));
305
+ let t = JSON.parse(oe(I(e, "package.json"), "utf8"));
303
306
  return typeof t.version == "string" ? t.version : void 0;
304
307
  } catch {
305
308
  return;
306
309
  }
307
- }, Ze = (e) => {
310
+ }, St = (e) => {
308
311
  let t = [], n;
309
312
  try {
310
- n = F(e);
313
+ n = H(e);
311
314
  } catch {
312
315
  return t;
313
316
  }
314
317
  for (let r of n) {
315
- if (r.startsWith(".") || Ke.test(r)) continue;
316
- let n = O(e, r);
318
+ if (r.startsWith(".") || _t.test(r)) continue;
319
+ let n = I(e, r);
317
320
  if (r.startsWith("@")) {
318
321
  let e;
319
322
  try {
320
- e = F(n);
323
+ e = H(n);
321
324
  } catch {
322
325
  continue;
323
326
  }
324
327
  for (let i of e) t.push({
325
328
  pkg: `${r}/${i}`,
326
- dir: O(n, i)
329
+ dir: I(n, i)
327
330
  });
328
331
  continue;
329
332
  }
330
333
  try {
331
- if (!ee(n).isDirectory()) continue;
334
+ if (!U(n).isDirectory()) continue;
332
335
  } catch {
333
336
  continue;
334
337
  }
@@ -338,25 +341,25 @@ __installPublicEnv(publicEnvValues)
338
341
  });
339
342
  }
340
343
  return t;
341
- }, Qe = (e) => {
344
+ }, Ct = (e) => {
342
345
  let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
343
- if (!Ge(e)) return;
346
+ if (!gt(e)) return;
344
347
  let i = t.get(e) ?? /* @__PURE__ */ new Map();
345
348
  i.has(n) || i.set(n, r), t.set(e, i);
346
349
  };
347
- for (let t of qe(e)) for (let { pkg: e, dir: r } of Ze(t)) {
348
- let t = Xe(r);
350
+ for (let t of vt(e)) for (let { pkg: e, dir: r } of St(t)) {
351
+ let t = xt(r);
349
352
  t !== void 0 && n(e, t, r);
350
353
  }
351
- for (let { pkg: t, version: r, dir: i } of Ye(e)) n(t, r, i);
354
+ for (let { pkg: t, version: r, dir: i } of bt(e)) n(t, r, i);
352
355
  let r = [];
353
356
  for (let [n, i] of t) i.size < 2 || r.push({
354
357
  pkg: n,
355
358
  versions: [...i.keys()].sort(),
356
- paths: [...i.values()].map((t) => k(e, t)).sort()
359
+ paths: [...i.values()].map((t) => L(e, t)).sort()
357
360
  });
358
361
  return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
359
- }, $e = (e) => {
362
+ }, wt = (e) => {
360
363
  if (e.length !== 0) return [
361
364
  `• ${e.length} package(s) resolved at more than one version:`,
362
365
  ...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
@@ -374,11 +377,11 @@ __installPublicEnv(publicEnvValues)
374
377
  " instrument), then reinstall. Do not silence the generated file — it is where",
375
378
  " a genuine mistake in your own descriptors surfaces."
376
379
  ].join("\n");
377
- }, et = (e) => {
380
+ }, Tt = (e) => {
378
381
  let t = /* @__PURE__ */ new Map();
379
- for (let n of qe(e)) for (let { pkg: e, dir: r } of Ze(n)) {
382
+ for (let n of vt(e)) for (let { pkg: e, dir: r } of St(n)) {
380
383
  if (!e.startsWith("@voltro/")) continue;
381
- let n = Xe(r);
384
+ let n = xt(r);
382
385
  n !== void 0 && !t.has(e) && t.set(e, n);
383
386
  }
384
387
  if (t.size < 2) return;
@@ -393,7 +396,7 @@ __installPublicEnv(publicEnvValues)
393
396
  version: t
394
397
  })).sort((e, t) => e.pkg.localeCompare(t.pkg))
395
398
  };
396
- }, tt = (e) => {
399
+ }, Et = (e) => {
397
400
  if (e !== void 0) return [
398
401
  `• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
399
402
  ...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
@@ -411,59 +414,59 @@ __installPublicEnv(publicEnvValues)
411
414
  " its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
412
415
  " which silently skips `@voltro/i18n` because the name contains digits."
413
416
  ].join("\n");
414
- }, nt = (e, t) => {
415
- let n = et(e);
417
+ }, Dt = (e, t) => {
418
+ let n = Tt(e);
416
419
  n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
417
420
  majority: n.majority,
418
421
  behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
419
422
  fix: "the framework ships in lockstep; bump the listed packages and reinstall"
420
423
  });
421
- }, rt = R({ scope: "vite" }), it = /\x1b\[[0-9;]*m/g, at = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, ot = (e) => e.replace(it, "").replace(at, "").trim(), st = /proxy error/i, ct = [
424
+ }, Ot = K({ scope: "vite" }), kt = /\x1b\[[0-9;]*m/g, At = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, jt = (e) => e.replace(kt, "").replace(At, "").trim(), Mt = /proxy error/i, Nt = [
422
425
  "ECONNREFUSED",
423
426
  "ECONNRESET",
424
427
  "ECONNABORTED",
425
428
  "EPIPE",
426
429
  "ETIMEDOUT"
427
- ], lt = (e, t = 0) => {
430
+ ], Pt = (e, t = 0) => {
428
431
  if (e == null || t > 5) return !1;
429
432
  let n = e;
430
- return typeof n.code == "string" && ct.includes(n.code) || typeof n.message == "string" && ct.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => lt(e, t + 1)) ? !0 : lt(n.cause, t + 1);
431
- }, ut = 4e3, dt = () => {
433
+ return typeof n.code == "string" && Nt.includes(n.code) || typeof n.message == "string" && Nt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Pt(e, t + 1)) ? !0 : Pt(n.cause, t + 1);
434
+ }, Ft = 4e3, It = () => {
432
435
  let e = /* @__PURE__ */ new Set(), t = 0, n = {
433
436
  hasWarned: !1,
434
437
  info: (e) => {
435
- let t = ot(e);
436
- t.length !== 0 && rt.info(t);
438
+ let t = jt(e);
439
+ t.length !== 0 && Ot.info(t);
437
440
  },
438
441
  warn: (e) => {
439
442
  n.hasWarned = !0;
440
- let t = ot(e);
441
- t.length !== 0 && rt.warn(t);
443
+ let t = jt(e);
444
+ t.length !== 0 && Ot.warn(t);
442
445
  },
443
446
  warnOnce: (t) => {
444
- let r = ot(t);
445
- e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && rt.warn(r));
447
+ let r = jt(t);
448
+ e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ot.warn(r));
446
449
  },
447
450
  error: (e, n) => {
448
- let r = ot(e), i = n?.error;
451
+ let r = jt(e), i = n?.error;
449
452
  if (r.length !== 0) {
450
- if (st.test(r) && lt(i)) {
453
+ if (Mt.test(r) && Pt(i)) {
451
454
  let e = Date.now();
452
- e - t > ut && (t = e, rt.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
455
+ e - t > Ft && (t = e, Ot.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
453
456
  return;
454
457
  }
455
- rt.error(r, {}, i);
458
+ Ot.error(r, {}, i);
456
459
  }
457
460
  },
458
461
  clearScreen: () => {},
459
462
  hasErrorLogged: (e) => !1
460
463
  };
461
464
  return n;
462
- }, ft = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), pt = (e) => {
465
+ }, Lt = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Rt = (e) => {
463
466
  try {
464
- let t = O(e, "tsconfig.json");
465
- if (!M(t)) return [];
466
- let n = JSON.parse(ft(P(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = A(e, i), o = [];
467
+ let t = I(e, "tsconfig.json");
468
+ if (!B(t)) return [];
469
+ let n = JSON.parse(Lt(oe(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = R(e, i), o = [];
467
470
  for (let [e, t] of Object.entries(r)) {
468
471
  let n = t[0];
469
472
  if (!n) continue;
@@ -473,11 +476,11 @@ __installPublicEnv(publicEnvValues)
473
476
  let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
474
477
  o.push({
475
478
  find: RegExp(`^${t}/(.*)$`),
476
- replacement: `${O(a, n.slice(0, -2))}/$1`
479
+ replacement: `${I(a, n.slice(0, -2))}/$1`
477
480
  });
478
481
  } else o.push({
479
482
  find: e,
480
- replacement: O(a, n)
483
+ replacement: I(a, n)
481
484
  });
482
485
  }
483
486
  }
@@ -485,12 +488,12 @@ __installPublicEnv(publicEnvValues)
485
488
  } catch {
486
489
  return [];
487
490
  }
488
- }, mt = (e = process.env) => {
491
+ }, zt = (e = process.env) => {
489
492
  let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
490
493
  if (t === void 0 || t.trim() === "") return 4;
491
494
  let n = Number(t);
492
495
  return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
493
- }, ht = (e) => {
496
+ }, Bt = (e) => {
494
497
  let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
495
498
  let e = r.shift();
496
499
  e ? e() : n--;
@@ -508,8 +511,8 @@ __installPublicEnv(publicEnvValues)
508
511
  return n;
509
512
  }
510
513
  };
511
- }, gt = (e) => {
512
- let t = ht(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
514
+ }, Vt = (e) => {
515
+ let t = Bt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
513
516
  return {
514
517
  load: (i, a) => {
515
518
  if (r.has(i)) return a();
@@ -539,19 +542,19 @@ __installPublicEnv(publicEnvValues)
539
542
  return r.size;
540
543
  }
541
544
  };
542
- }, _t = 1048576, vt = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), yt = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), bt = (e, t) => {
543
- let n = `<script type="application/json" id="${ve}">${yt(t)}<\/script>`;
545
+ }, Ht = 1048576, Ut = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), Wt = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), Gt = (e, t) => {
546
+ let n = `<script type="application/json" id="${Pe}">${Wt(t)}<\/script>`;
544
547
  return e.includes("</body>") ? e.replace("</body>", `${n}</body>`) : e + n;
545
- }, xt = (e) => {
546
- let t = Object.entries(e.errors).map(([e, t]) => `<li><strong>${vt(e)}</strong>: ${vt(t)}</li>`).join("");
547
- return `<!doctype html><html><head><meta charset="utf-8"><title>Form submission failed</title></head><body><h1>Submission failed</h1>${e.formError === void 0 ? "" : `<p>${vt(e.formError)}</p>`}<ul>${t}</ul><p><a href="javascript:history.back()">Go back</a> to correct the form.</p></body></html>`;
548
- }, Y = (e, t, n, r = "text/plain; charset=utf-8") => {
548
+ }, Kt = (e) => {
549
+ let t = Object.entries(e.errors).map(([e, t]) => `<li><strong>${Ut(e)}</strong>: ${Ut(t)}</li>`).join("");
550
+ return `<!doctype html><html><head><meta charset="utf-8"><title>Form submission failed</title></head><body><h1>Submission failed</h1>${e.formError === void 0 ? "" : `<p>${Ut(e.formError)}</p>`}<ul>${t}</ul><p><a href="javascript:history.back()">Go back</a> to correct the form.</p></body></html>`;
551
+ }, X = (e, t, n, r = "text/plain; charset=utf-8") => {
549
552
  e.statusCode = t, e.setHeader("content-type", r), e.end(n);
550
- }, St = (e, t, n) => {
551
- e.setHeader("cache-control", "no-store"), Y(e, t, n, "text/html; charset=utf-8");
552
- }, Ct = (e) => {
553
+ }, qt = (e, t, n) => {
554
+ e.setHeader("cache-control", "no-store"), X(e, t, n, "text/html; charset=utf-8");
555
+ }, Jt = (e) => {
553
556
  if (e !== void 0 && e !== "" && !(!e.startsWith("/") || e.startsWith("//") || e.includes("\\"))) return e;
554
- }, wt = (e) => {
557
+ }, Yt = (e) => {
555
558
  let t = e.referer;
556
559
  if (t !== void 0) try {
557
560
  let e = new URL(t);
@@ -559,10 +562,10 @@ __installPublicEnv(publicEnvValues)
559
562
  } catch {
560
563
  return;
561
564
  }
562
- }, Tt = (e) => new Promise((t) => {
565
+ }, Xt = (e) => new Promise((t) => {
563
566
  let n = [], r = 0;
564
567
  e.on("data", (i) => {
565
- if (r += i.length, r > _t) {
568
+ if (r += i.length, r > Ht) {
566
569
  e.removeAllListeners("data"), e.removeAllListeners("end"), t({ ok: !1 });
567
570
  return;
568
571
  }
@@ -571,32 +574,32 @@ __installPublicEnv(publicEnvValues)
571
574
  ok: !0,
572
575
  body: Buffer.concat(n).toString("utf8")
573
576
  })), e.on("error", () => t({ ok: !1 }));
574
- }), Et = (e) => {
577
+ }), Zt = (e) => {
575
578
  let t = {};
576
579
  for (let [n, r] of Object.entries(e.headers)) typeof r == "string" ? t[n.toLowerCase()] = r : Array.isArray(r) && (t[n.toLowerCase()] = r.join(", "));
577
580
  return t;
578
- }, Dt = (e) => {
579
- let t = e.originGuard ?? ae(void 0, process.env);
581
+ }, Qt = (e) => {
582
+ let t = e.originGuard ?? pe(void 0, process.env);
580
583
  return async (n, r, i) => {
581
584
  let a = (n.url ?? "/").split("?")[0];
582
- if (!a.startsWith(be)) return !1;
583
- if (n.method !== "POST") return r.setHeader("allow", "POST"), Y(r, 405, "method not allowed — a /form/* endpoint accepts native form POSTs only"), !0;
584
- let o = Et(n);
585
- if (!B({
585
+ if (!a.startsWith(Ie)) return !1;
586
+ if (n.method !== "POST") return r.setHeader("allow", "POST"), X(r, 405, "method not allowed — a /form/* endpoint accepts native form POSTs only"), !0;
587
+ let o = Zt(n);
588
+ if (!de({
586
589
  headers: o,
587
590
  config: t
588
- }).allowed) return Y(r, 403, "origin not allowed"), !0;
589
- if ((o["content-type"] ?? "").includes("multipart/form-data")) return Y(r, 415, "file uploads need JavaScript — the no-JS form path accepts application/x-www-form-urlencoded only"), !0;
590
- let s = await Tt(n);
591
- if (!s.ok) return Y(r, 413, `form body exceeds ${_t} bytes`), !0;
592
- let c = new URLSearchParams(s.body), l = decodeURIComponent(a.slice(be.length)), u = (await e.loadDescriptors())?.[l];
593
- if (u === void 0 || u.kind !== "mutation") return Y(r, 404, `no mutation '${l}' — /form/* serves declared mutations only`), !0;
594
- let d = c.get(ye) ?? l, f = Ct(c.get(Se) ?? void 0), p = [];
595
- for (let [e, t] of c) e !== ye && e !== Se && p.push([e, t]);
591
+ }).allowed) return X(r, 403, "origin not allowed"), !0;
592
+ if ((o["content-type"] ?? "").includes("multipart/form-data")) return X(r, 415, "file uploads need JavaScript — the no-JS form path accepts application/x-www-form-urlencoded only"), !0;
593
+ let s = await Xt(n);
594
+ if (!s.ok) return X(r, 413, `form body exceeds ${Ht} bytes`), !0;
595
+ let c = new URLSearchParams(s.body), l = decodeURIComponent(a.slice(Ie.length)), u = (await e.loadDescriptors())?.[l];
596
+ if (u === void 0 || u.kind !== "mutation") return X(r, 404, `no mutation '${l}' — /form/* serves declared mutations only`), !0;
597
+ let d = c.get(Fe) ?? l, f = Jt(c.get(Re) ?? void 0), p = [];
598
+ for (let [e, t] of c) e !== Fe && e !== Re && p.push([e, t]);
596
599
  let m = u.input;
597
- if (m === void 0) return Y(r, 404, `mutation '${l}' carries no input schema — the no-JS path cannot map its POST`), !0;
598
- let h = Ce(m, p), g = we(m, h), _ = async (t) => {
599
- let n = wt(o);
600
+ if (m === void 0) return X(r, 404, `mutation '${l}' carries no input schema — the no-JS path cannot map its POST`), !0;
601
+ let h = ze(m, p), g = Y(m, h), _ = async (t) => {
602
+ let n = Yt(o);
600
603
  if (n !== void 0) {
601
604
  if (i !== void 0) {
602
605
  i(n, t);
@@ -608,11 +611,11 @@ __installPublicEnv(publicEnvValues)
608
611
  flash: t
609
612
  });
610
613
  if (a !== void 0) {
611
- St(r, 422, bt(a, t));
614
+ qt(r, 422, Gt(a, t));
612
615
  return;
613
616
  }
614
617
  }
615
- St(r, 422, xt(t));
618
+ qt(r, 422, Kt(t));
616
619
  };
617
620
  if (!g.valid) return await _({
618
621
  formKey: d,
@@ -620,7 +623,7 @@ __installPublicEnv(publicEnvValues)
620
623
  errors: g.errors
621
624
  }), !0;
622
625
  let v = e.rpcQuery(o.cookie, o);
623
- if (v === void 0) return Y(r, 503, `api '${e.apiName ?? "?"}' has no server-side origin — the no-JS form path forwards over POST /rpc; set VOLTRO_API_ORIGIN (or apis.<name>.serverUrl) as for SSR loaders`), !0;
626
+ if (v === void 0) return X(r, 503, `api '${e.apiName ?? "?"}' has no server-side origin — the no-JS form path forwards over POST /rpc; set VOLTRO_API_ORIGIN (or apis.<name>.serverUrl) as for SSR loaders`), !0;
624
627
  try {
625
628
  await v(l, h);
626
629
  } catch (e) {
@@ -632,10 +635,10 @@ __installPublicEnv(publicEnvValues)
632
635
  formError: t?.message ?? t?._tag ?? "The server rejected this submission. Please try again."
633
636
  }), !0;
634
637
  }
635
- let y = f ?? wt(o) ?? "/";
638
+ let y = f ?? Yt(o) ?? "/";
636
639
  return r.statusCode = 303, r.setHeader("location", y), r.end(), !0;
637
640
  };
638
- }, Ot = /^\s*(?:import|export)\s[^;'"]*?['"]([^'"]+)['"]/gm, kt = [
641
+ }, $t = /^\s*(?:import|export)\s[^;'"]*?['"]([^'"]+)['"]/gm, en = [
639
642
  "",
640
643
  ".tsx",
641
644
  ".ts",
@@ -643,87 +646,87 @@ __installPublicEnv(publicEnvValues)
643
646
  ".js",
644
647
  "/index.tsx",
645
648
  "/index.ts"
646
- ], At = (e) => /\.island\.(tsx|ts|jsx|js)$/.test(e), jt = ["@voltro/web", "@voltro/i18n"], Mt = ["@voltro/client", "@voltro/ui"], Nt = (e, t) => e === t || e.startsWith(`${t}/`), Pt = (e) => e !== "@voltro/web/islands" && jt.some((t) => Nt(e, t)), Ft = (e) => {
649
+ ], tn = (e) => /\.island\.(tsx|ts|jsx|js)$/.test(e), nn = ["@voltro/web", "@voltro/i18n"], rn = ["@voltro/client", "@voltro/ui"], an = (e, t) => e === t || e.startsWith(`${t}/`), on = (e) => e !== "@voltro/web/islands" && nn.some((t) => an(e, t)), sn = (e) => {
647
650
  let t = [];
648
- for (let n of e.matchAll(Ot)) t.push(n[1]);
651
+ for (let n of e.matchAll($t)) t.push(n[1]);
649
652
  return t;
650
- }, It = async (e, t) => {
651
- let n = A(D(e), t);
652
- for (let e of kt) {
653
+ }, cn = async (e, t) => {
654
+ let n = R(F(e), t);
655
+ for (let e of en) {
653
656
  let t = n + e;
654
657
  try {
655
- if ((await N.stat(t)).isFile()) return t;
658
+ if ((await V.stat(t)).isFile()) return t;
656
659
  } catch {}
657
660
  }
658
- }, Lt = async (e, t) => {
659
- let n = O(e, "src", "pages", t), r = /* @__PURE__ */ new Set(), i = [], a = !1, o = [], s = async (t, n) => {
661
+ }, ln = async (e, t) => {
662
+ let n = I(e, "src", "pages", t), r = /* @__PURE__ */ new Set(), i = [], a = !1, o = [], s = async (t, n) => {
660
663
  let c = `${t}\u0000${n ? "i" : "p"}`;
661
664
  if (r.has(c)) return;
662
665
  r.add(c);
663
666
  let l;
664
667
  try {
665
- l = await N.readFile(t, "utf8");
668
+ l = await V.readFile(t, "utf8");
666
669
  } catch {
667
670
  return;
668
671
  }
669
- for (let r of Ft(l)) {
672
+ for (let r of sn(l)) {
670
673
  if (n) {
671
- if (Pt(r)) {
672
- o.push([k(e, t).split(j).join("/"), r]);
674
+ if (on(r)) {
675
+ o.push([L(e, t).split(z).join("/"), r]);
673
676
  continue;
674
677
  }
675
- if (Mt.some((e) => Nt(r, e))) {
678
+ if (rn.some((e) => an(r, e))) {
676
679
  a = !0;
677
680
  continue;
678
681
  }
679
682
  }
680
683
  if (!r.startsWith(".")) continue;
681
- let c = await It(t, r);
684
+ let c = await cn(t, r);
682
685
  if (c === void 0) continue;
683
- let l = n || At(c);
684
- if (!n && At(c)) {
685
- let t = k(e, c).split(j).join("/");
686
+ let l = n || tn(c);
687
+ if (!n && tn(c)) {
688
+ let t = L(e, c).split(z).join("/");
686
689
  i.includes(t) || i.push(t);
687
690
  }
688
691
  await s(c, l);
689
692
  }
690
693
  };
691
- return await s(n, At(n)), At(n) && i.unshift(k(e, n).split(j).join("/")), {
694
+ return await s(n, tn(n)), tn(n) && i.unshift(L(e, n).split(z).join("/")), {
692
695
  islandFiles: i,
693
696
  usesClient: a,
694
697
  violations: o
695
698
  };
696
- }, Rt = (e) => {
699
+ }, un = (e) => {
697
700
  let t = /^export const interactive\s*=\s*['"](full|islands|none)['"]/m.exec(e);
698
701
  return t === null ? void 0 : t[1];
699
- }, zt = (e) => {
702
+ }, dn = (e) => {
700
703
  let t = e.indexOf("</head>"), n = t === -1 ? e : e.slice(0, t), r = [];
701
704
  for (let e of n.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)) {
702
705
  let t = e[1] ?? "";
703
706
  /\bsrc\s*=/.test(t) || /type\s*=\s*["']module["']/.test(t) || r.push(e[0]);
704
707
  }
705
708
  return r.map((e) => ` ${e}`).join("\n");
706
- }, Bt = (e) => [...e.matchAll(/<link\b[^>]*\brel\s*=\s*["']stylesheet["'][^>]*>/gi)].map((e) => e[0]), Vt = (e, t) => {
707
- let n = Bt(t).filter((t) => !e.includes(t));
709
+ }, fn = (e) => [...e.matchAll(/<link\b[^>]*\brel\s*=\s*["']stylesheet["'][^>]*>/gi)].map((e) => e[0]), pn = (e, t) => {
710
+ let n = fn(t).filter((t) => !e.includes(t));
708
711
  if (n.length === 0) return e;
709
712
  let r = n.map((e) => ` ${e}`).join("\n");
710
713
  return e.includes("</head>") ? e.replace("</head>", `${r}\n </head>`) : e + r;
711
- }, Ht = (e) => {
714
+ }, mn = (e) => {
712
715
  let t = e.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
713
716
  return t === "" ? "root" : t;
714
- }, Ut = class extends Error {
717
+ }, hn = class extends Error {
715
718
  constructor(e, t) {
716
719
  let n = t.map(([e, t]) => ` ${e} imports '${t}'`).join("\n");
717
720
  super(`interactive: 'islands' page '${e}' has island code importing the framework barrel:\n${n}\n\nAn island hydrates in its own provider-less root — router hooks, <Link> and useT() throw there, and the '@voltro/web' barrel additionally pulls the Effect runtime into the slim islands entry (the bytes this mode exists to shed).\n\nFix: import island()/hydration APIs from '@voltro/web/islands' (the react-only subpath), move router/i18n-dependent UI out of the island, and keep island files to react + relative browser-safe imports. '@voltro/client' IS allowed — a useSubscription island gets the client boot automatically.`), this.name = "IslandsEntryViolation";
718
721
  }
719
- }, Wt = async (e) => {
720
- let t = O(e.webRoot, ".framework", "island-shells"), n = [];
722
+ }, gn = async (e) => {
723
+ let t = I(e.webRoot, ".framework", "island-shells"), n = [];
721
724
  if (e.pages.length === 0) return n;
722
- await N.mkdir(t, { recursive: !0 });
725
+ await V.mkdir(t, { recursive: !0 });
723
726
  for (let r of e.pages) {
724
- let i = await Lt(e.webRoot, r.file);
725
- if (i.violations.length > 0) throw new Ut(r.pattern, i.violations);
726
- let a = Ht(r.pattern), o = `island-shells/${a}.tsx`, s = `island-shells/${a}.html`, c = i.islandFiles.map((e) => `import '../../${e}'`).join("\n"), l = i.usesClient ? [
727
+ let i = await ln(e.webRoot, r.file);
728
+ if (i.violations.length > 0) throw new hn(r.pattern, i.violations);
729
+ let a = mn(r.pattern), o = `island-shells/${a}.tsx`, s = `island-shells/${a}.html`, c = i.islandFiles.map((e) => `import '../../${e}'`).join("\n"), l = i.usesClient ? [
727
730
  `// GENERATED by voltro — the islands entry for '${r.pattern}' (client boot:`,
728
731
  "// an island here imports @voltro/client, so the roots get a live runtime).",
729
732
  ...e.apiImports ?? [],
@@ -759,7 +762,7 @@ __installPublicEnv(publicEnvValues)
759
762
  "</html>",
760
763
  ""
761
764
  ].join("\n");
762
- await N.writeFile(O(t, `${a}.tsx`), l), await N.writeFile(O(t, `${a}.html`), u), n.push({
765
+ await V.writeFile(I(t, `${a}.tsx`), l), await V.writeFile(I(t, `${a}.html`), u), n.push({
763
766
  pattern: r.pattern,
764
767
  name: a,
765
768
  htmlFile: s,
@@ -768,12 +771,398 @@ __installPublicEnv(publicEnvValues)
768
771
  });
769
772
  }
770
773
  return n;
771
- }, Gt = class extends Error {
774
+ }, _n = K({ scope: "voltro:images" }), vn = /[?&]image(?:&|$)/, yn = /\.(png|jpe?g|webp|avif)(\?|$)/i, bn = {
775
+ avif: "image/avif",
776
+ webp: "image/webp",
777
+ jpeg: "image/jpeg",
778
+ png: "image/png"
779
+ }, xn = (e) => Oe("sha256").update(e).digest("hex").slice(0, 12), Sn = (e) => `export default ${JSON.stringify(e)}\n`, Cn = (e) => {
780
+ let t = e.config ?? j, n = x(e.root), r = /* @__PURE__ */ new Map(), i = "/", a = !1;
781
+ return {
782
+ name: "voltro:image-assets",
783
+ enforce: "pre",
784
+ configResolved(e) {
785
+ i = e.base, a = e.command === "build";
786
+ },
787
+ async load(o) {
788
+ if (!vn.test(o) || !yn.test(o)) return null;
789
+ let s = o.split("?")[0], c = s, l = await E(c);
790
+ if (l === null && s.startsWith("/") && (c = I(e.root, s.slice(1)), l = await E(c)), l === null && this.error(`?image import points at a file that does not exist or is unreadable: ${s}`), await S() === null) {
791
+ w(_n);
792
+ let t;
793
+ if (a || e.urlMode === "build-urls") {
794
+ let e = `assets/${xn(c)}${c.slice(c.lastIndexOf("."))}`;
795
+ a && this.emitFile({
796
+ type: "asset",
797
+ fileName: e,
798
+ source: Buffer.from(l)
799
+ }), t = `${i}${e}`;
800
+ } else t = `/@fs${c}`;
801
+ return Sn({
802
+ src: t,
803
+ width: 0,
804
+ height: 0,
805
+ blurDataURL: "",
806
+ srcSet: "",
807
+ sources: []
808
+ });
809
+ }
810
+ if (a || e.urlMode === "build-urls") {
811
+ let e = await T({
812
+ sourceBytes: l,
813
+ cacheDir: n,
814
+ config: t
815
+ });
816
+ e === null && this.error(`?image import is not a raster image sharp can read: ${c}`);
817
+ let r = /* @__PURE__ */ new Map();
818
+ for (let t of e.variants) {
819
+ let e = t.format === "jpeg" ? "jpg" : t.format, n = `assets/${t.hash}.${e}`;
820
+ a && this.emitFile({
821
+ type: "asset",
822
+ fileName: n,
823
+ source: Buffer.from(t.bytes)
824
+ }), r.set(`${t.format}:${t.width}`, `${i}${n}`);
825
+ }
826
+ let o = (t) => e.widths.map((e) => `${r.get(`${t}:${e}`)} ${e}w`).join(", ");
827
+ return Sn({
828
+ src: r.get(`${e.fallbackFormat}:${e.widths[e.widths.length - 1]}`),
829
+ width: e.width,
830
+ height: e.height,
831
+ blurDataURL: e.blurDataURL,
832
+ srcSet: o(e.fallbackFormat),
833
+ sources: t.formats.map((e) => ({
834
+ type: bn[e],
835
+ srcSet: o(e)
836
+ }))
837
+ });
838
+ }
839
+ let u = await A(l);
840
+ u === null && this.error(`?image import is not a raster image sharp can read: ${c}`);
841
+ let d = Oe("sha256").update(l).digest("hex").slice(0, 16), f = await k(l, d, n), p = xn(c);
842
+ r.set(p, c);
843
+ let m = O(u.width), h = u.format === "png" ? "png" : "jpeg", g = (e, t) => `/_voltro/image/${p}?w=${e}&f=${t}`, _ = (e) => m.map((t) => `${g(t, e)} ${t}w`).join(", ");
844
+ return Sn({
845
+ src: g(m[m.length - 1], h),
846
+ width: u.width,
847
+ height: u.height,
848
+ blurDataURL: f ?? "",
849
+ srcSet: _(h),
850
+ sources: t.formats.map((e) => ({
851
+ type: bn[e],
852
+ srcSet: _(e)
853
+ }))
854
+ });
855
+ },
856
+ configureServer(e) {
857
+ e.middlewares.use("/_voltro/image", (e, i, a) => {
858
+ (async () => {
859
+ let a = new URL(e.url ?? "/", "http://localhost"), o = a.pathname.replace(/^\//, ""), s = r.get(o);
860
+ if (s === void 0) {
861
+ i.statusCode = 404, i.end("unknown image asset");
862
+ return;
863
+ }
864
+ let c = Number(a.searchParams.get("w")), l = a.searchParams.get("f") ?? "";
865
+ if (!Number.isInteger(c) || c <= 0 || c > 8192 || bn[l] === void 0) {
866
+ i.statusCode = 400, i.end("bad transform params");
867
+ return;
868
+ }
869
+ let u = await E(s);
870
+ if (u === null) {
871
+ i.statusCode = 404, i.end("source asset gone");
872
+ return;
873
+ }
874
+ let d = Oe("sha256").update(u).digest("hex").slice(0, 16), f = await C({
875
+ sourceBytes: u,
876
+ sourceHash: d,
877
+ width: c,
878
+ format: l,
879
+ quality: t.quality,
880
+ cacheDir: n
881
+ });
882
+ if (f === null) {
883
+ w(_n), i.statusCode = 200, i.setHeader("content-type", bn[l] ?? "application/octet-stream"), i.end(Buffer.from(u));
884
+ return;
885
+ }
886
+ i.statusCode = 200, i.setHeader("content-type", bn[l]), i.setHeader("cache-control", "max-age=31536000, immutable"), i.end(Buffer.from(f));
887
+ })().catch((e) => {
888
+ _n.warn("image transform failed", {}, e), a();
889
+ });
890
+ });
891
+ }
892
+ };
893
+ }, wn = K({ scope: "voltro:fonts" }), Tn = /* @__PURE__ */ new Map(), En = async (e, t) => {
894
+ if (t === void 0 || t.length === 0) return null;
895
+ let n = Tn.get(e);
896
+ return n === void 0 && (n = N(t, async (t) => new Uint8Array(await De(I(e, t)))).then((e) => {
897
+ for (let t of e.warnings) M(t, wn);
898
+ return e;
899
+ }), Tn.set(e, n)), n;
900
+ }, Dn = {
901
+ woff2: "font/woff2",
902
+ woff: "font/woff",
903
+ otf: "font/otf",
904
+ ttf: "font/ttf"
905
+ }, On = (e, t) => ({
906
+ name: "voltro:font-assets",
907
+ configureServer(n) {
908
+ n.middlewares.use("/assets/fonts", (n, r, i) => {
909
+ (async () => {
910
+ let a = await En(e, t), o = (n.url ?? "/").replace(/^\//, "").split("?")[0], s = a?.files.find((e) => e.fileName === `assets/fonts/${o}`);
911
+ if (s === void 0) {
912
+ i();
913
+ return;
914
+ }
915
+ let c = o.slice(o.lastIndexOf(".") + 1);
916
+ r.statusCode = 200, r.setHeader("content-type", Dn[c] ?? "application/octet-stream"), r.setHeader("cache-control", "max-age=31536000, immutable"), r.end(Buffer.from(s.bytes));
917
+ })().catch(() => i());
918
+ });
919
+ }
920
+ }), kn = K({ scope: "voltro:content" }), An = (e) => {
921
+ Ke(e);
922
+ }, jn = async (e, t) => {
923
+ let n = await He(e.collection, e.locale === void 0 ? {} : { locale: e.locale });
924
+ return Be(n, {
925
+ title: e.title,
926
+ siteUrl: t,
927
+ ...e.description === void 0 ? {} : { description: e.description },
928
+ feedPath: e.path,
929
+ item: e.item
930
+ });
931
+ }, Mn = async (e, t, n) => {
932
+ if (t.length !== 0) {
933
+ if (n === void 0 || n === "") throw Error("config.feeds needs seo.siteUrl — RSS links must be absolute. Set seo: { siteUrl } in app.config.ts.");
934
+ for (let r of t) {
935
+ let t = await jn(r, n), i = I(e, r.path.replace(/^\/+/, ""));
936
+ await Ee(F(i), { recursive: !0 }), await J(i, t), kn.info(`feed: ${r.path} (${r.collection})`);
937
+ }
938
+ }
939
+ }, Nn = async (e, t) => {
940
+ let n = await He(e, t === void 0 ? {} : { locale: t });
941
+ return JSON.stringify(n.map(({ html: e, body: t, headings: n, ...r }) => r));
942
+ }, Pn = async (e, t, n) => {
943
+ let r = await Ue(e, t, n === void 0 ? {} : { locale: n });
944
+ if (r === null) return null;
945
+ let { body: i, ...a } = r;
946
+ return JSON.stringify(a);
947
+ }, Fn = async (e) => {
948
+ await qe();
949
+ let t = 0;
950
+ for (let n of Ge()) {
951
+ let r = n.i18n?.locales ?? [void 0];
952
+ for (let i of r) {
953
+ let r = await Nn(n.name, i), a = I(e, Ve(n.name, i));
954
+ await Ee(F(a), { recursive: !0 }), await J(a, r), t += 1;
955
+ let o = JSON.parse(r);
956
+ for (let { slug: r } of o) {
957
+ let a = await Pn(n.name, r, i);
958
+ if (a === null) continue;
959
+ let o = I(e, Ve(n.name, i, r));
960
+ await Ee(F(o), { recursive: !0 }), await J(o, a), t += 1;
961
+ }
962
+ }
963
+ }
964
+ return t > 0 && kn.info(`content: ${t} artifact(s) into dist/assets/content`), t;
965
+ }, In = async (e) => {
966
+ let t = /^\/assets\/content\/([A-Za-z0-9_-]+)(?:\.([A-Za-z0-9-]+))?\/(.+)$/.exec(e);
967
+ if (t === null) return null;
968
+ let [, n, r, i] = t;
969
+ if (Ge().every((e) => e.name !== n)) return null;
970
+ try {
971
+ if (i === "index.json") return {
972
+ status: 200,
973
+ body: await Nn(n, r)
974
+ };
975
+ let e = await Pn(n, i.replace(/\.json$/, ""), r);
976
+ return e === null ? {
977
+ status: 404,
978
+ body: "\"not found\""
979
+ } : {
980
+ status: 200,
981
+ body: e
982
+ };
983
+ } catch (t) {
984
+ return kn.warn("content request failed", { pathname: e }, t), {
985
+ status: 500,
986
+ body: "\"content error\""
987
+ };
988
+ }
989
+ }, Ln = async (e) => {
990
+ let { readdir: t } = await import("node:fs/promises"), n = [], r;
991
+ try {
992
+ r = await t(e, { withFileTypes: !0 });
993
+ } catch {
994
+ return n;
995
+ }
996
+ for (let t of r) {
997
+ if (t.name.startsWith(".") || t.name === "node_modules") continue;
998
+ let r = I(e, t.name);
999
+ t.isDirectory() ? n.push(...await Ln(r)) : /\.collection\.tsx?$/.test(t.name) && n.push(r);
1000
+ }
1001
+ return n;
1002
+ }, Rn = (e, t = [], n) => ({
1003
+ name: "voltro:content",
1004
+ configureServer(r) {
1005
+ let i = null, a = () => (i ??= (async () => {
1006
+ for (let t of await Ln(I(e, "src"))) try {
1007
+ await r.ssrLoadModule(t);
1008
+ } catch (e) {
1009
+ kn.warn("failed to load collection module", { file: t }, e);
1010
+ }
1011
+ })(), i);
1012
+ r.watcher.add(I(e, "content")), r.watcher.on("all", (t, n) => {
1013
+ typeof n == "string" && n.startsWith(I(e, "content")) && (We(), r.ws.send({ type: "full-reload" }));
1014
+ });
1015
+ for (let e of t) r.middlewares.use(e.path, (t, r) => {
1016
+ (async () => {
1017
+ await a();
1018
+ let t = await jn(e, n ?? "http://localhost");
1019
+ r.setHeader("content-type", "application/rss+xml"), r.end(t);
1020
+ })().catch((t) => {
1021
+ kn.warn("feed render failed", { path: e.path }, t), r.statusCode = 500, r.end("feed error");
1022
+ });
1023
+ });
1024
+ r.middlewares.use("/assets/content", (e, t, n) => {
1025
+ (async () => {
1026
+ await a();
1027
+ let r = await In(`/assets/content${(e.url ?? "/").split("?")[0]}`);
1028
+ if (r === null) {
1029
+ n();
1030
+ return;
1031
+ }
1032
+ t.statusCode = r.status, t.setHeader("content-type", "application/json"), t.end(r.body);
1033
+ })().catch(() => n());
1034
+ });
1035
+ }
1036
+ }), zn, Bn = async () => {
1037
+ if (zn !== void 0) return zn;
1038
+ try {
1039
+ let e = await import("satori");
1040
+ zn = e.default ?? e;
1041
+ } catch {
1042
+ zn = null;
1043
+ }
1044
+ return zn;
1045
+ }, Vn, Hn = async () => {
1046
+ if (Vn !== void 0) return Vn;
1047
+ try {
1048
+ Vn = await import("@resvg/resvg-js");
1049
+ } catch {
1050
+ Vn = null;
1051
+ }
1052
+ return Vn;
1053
+ }, Un = async (e, t) => {
1054
+ if (t === void 0 || t.length === 0) throw Error("ogImage needs a declared font: satori cannot render text without a font buffer, and there is no bundled default (that would ship a license artifact most projects replace). Declare one in app.config.ts — fonts: [{ family: 'Inter', src: [{ path: 'src/fonts/Inter.woff2' }] }] — see the Fonts docs.");
1055
+ let n = [];
1056
+ for (let r of t) for (let t of r.src) {
1057
+ let i = await De(I(e, t.path)), a = typeof t.weight == "number" ? t.weight : void 0;
1058
+ n.push({
1059
+ name: r.family,
1060
+ data: i.buffer.slice(i.byteOffset, i.byteOffset + i.byteLength),
1061
+ ...a === void 0 ? {} : { weight: a },
1062
+ ...t.style === void 0 ? {} : { style: t.style }
1063
+ });
1064
+ }
1065
+ return n;
1066
+ }, Wn = async (e) => {
1067
+ let t = await Bn(), n = await Hn();
1068
+ if (t === null || n === null) {
1069
+ let e = [t === null ? "satori" : null, n === null ? "@resvg/resvg-js" : null].filter((e) => e !== null).join(" + ");
1070
+ throw Error(`ogImage cannot render: ${e} is not loadable. Both ship as optional dependencies of @voltro/cli — if your installer omitted optional dependencies, run \`pnpm add -D satori @resvg/resvg-js\` in this app.`);
1071
+ }
1072
+ let r = await t(e.element, {
1073
+ width: e.width ?? 1200,
1074
+ height: e.height ?? 630,
1075
+ fonts: e.fonts.map((e) => ({
1076
+ ...e,
1077
+ data: e.data
1078
+ }))
1079
+ });
1080
+ return {
1081
+ svg: r,
1082
+ png: new Uint8Array(new n.Resvg(r).render().asPng())
1083
+ };
1084
+ }, Gn = (e, t, n, r) => `${e}\u0000${t}\u0000${n}\u0000${r}`, Kn = (e, t) => ke("sha256", e).update(t).digest("hex"), qn = () => {
1085
+ let e = process.env.VOLTRO_OG_SECRET;
1086
+ return e !== void 0 && e !== "" ? {
1087
+ secret: e,
1088
+ fromEnv: !0
1089
+ } : {
1090
+ secret: Ae(32).toString("hex"),
1091
+ fromEnv: !1
1092
+ };
1093
+ }, Jn = "/_voltro/og", Yn = (e) => {
1094
+ let t = e.ttlMs ?? 36e5, n, r = () => (n ??= Un(e.root, e.fonts), n);
1095
+ return {
1096
+ signOgUrl: ({ pattern: t, params: n, tenant: r, locale: i }) => {
1097
+ let a = JSON.stringify(n), o = r ?? "", s = i ?? "", c = Kn(e.secret, Gn(t, a, o, s));
1098
+ return `${Jn}?${new URLSearchParams({
1099
+ route: t,
1100
+ p: a,
1101
+ ...o === "" ? {} : { t: o },
1102
+ ...s === "" ? {} : { l: s },
1103
+ sig: c
1104
+ }).toString()}`;
1105
+ },
1106
+ handle: async (n) => {
1107
+ if (n.pathname !== "/_voltro/og") return null;
1108
+ let i = n.searchParams.get("route") ?? "", a = n.searchParams.get("p") ?? "{}", o = n.searchParams.get("t") ?? "", s = n.searchParams.get("l") ?? "", c = n.searchParams.get("sig") ?? "", l = Kn(e.secret, Gn(i, a, o, s)), u = Buffer.from(c, "utf8"), d = Buffer.from(l, "utf8");
1109
+ if (u.length !== d.length || !je(u, d)) return {
1110
+ status: 403,
1111
+ headers: { "content-type": "text/plain" },
1112
+ body: new TextEncoder().encode("bad signature")
1113
+ };
1114
+ if (!e.isOgSsrRoute(i)) return {
1115
+ status: 404,
1116
+ headers: { "content-type": "text/plain" },
1117
+ body: new TextEncoder().encode("no such og route")
1118
+ };
1119
+ let f = `og:${i}|p=${a}${o === "" ? "" : `|tenant=${o}`}${s === "" ? "" : `|lang=${s}`}`, p = e.cache.get(f), m = Date.now();
1120
+ if (p !== void 0 && p.expiresAt > m) return {
1121
+ status: 200,
1122
+ headers: {
1123
+ "content-type": "image/png",
1124
+ "x-voltro-og-cache": "HIT"
1125
+ },
1126
+ body: new Uint8Array(Buffer.from(p.html, "base64"))
1127
+ };
1128
+ let h = (await e.getPageModule(i))?.ogImage;
1129
+ if (typeof h != "function") return {
1130
+ status: 404,
1131
+ headers: { "content-type": "text/plain" },
1132
+ body: new TextEncoder().encode("page has no ogImage")
1133
+ };
1134
+ let { png: g } = await Wn({
1135
+ element: await h({
1136
+ params: JSON.parse(a),
1137
+ loaderData: void 0,
1138
+ ...s === "" ? { locale: "en" } : { locale: s },
1139
+ ...o === "" ? {} : { tenant: o }
1140
+ }),
1141
+ fonts: await r()
1142
+ }), _ = e.cache.generation(f);
1143
+ return e.cache.set(f, {
1144
+ html: Buffer.from(g).toString("base64"),
1145
+ renderedAt: m,
1146
+ expiresAt: m + t,
1147
+ servableUntil: m + t,
1148
+ revalidateMs: t,
1149
+ staleWhileRevalidateMs: 0
1150
+ }, { ifGeneration: _ }), {
1151
+ status: 200,
1152
+ headers: {
1153
+ "content-type": "image/png",
1154
+ "x-voltro-og-cache": "MISS"
1155
+ },
1156
+ body: g
1157
+ };
1158
+ }
1159
+ };
1160
+ }, Xn = class extends Error {
772
1161
  _voltroDeferral = !0;
773
1162
  constructor(e) {
774
1163
  super(e), this.name = "DeferralNotSupportedError";
775
1164
  }
776
- }, Kt = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, qt = (e) => {
1165
+ }, Zn = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Qn = (e) => {
777
1166
  if (!(e instanceof Error)) return;
778
1167
  let t = e._voltroControl;
779
1168
  if (t === "redirect") {
@@ -795,7 +1184,7 @@ __installPublicEnv(publicEnvValues)
795
1184
  },
796
1185
  body: "not found"
797
1186
  };
798
- }, Jt = (e) => {
1187
+ }, $n = (e) => {
799
1188
  let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
800
1189
  for (let [n, o] of Object.entries(e.segmentLoaderData)) {
801
1190
  let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
@@ -807,10 +1196,11 @@ __installPublicEnv(publicEnvValues)
807
1196
  page: e.page,
808
1197
  renderMode: e.renderMode,
809
1198
  interactive: e.interactive,
810
- ...e.layoutShell ? { layoutShell: e.layoutShell } : {}
1199
+ ...e.layoutShell ? { layoutShell: e.layoutShell } : {},
1200
+ ...e.ppr === !0 ? { ppr: !0 } : {}
811
1201
  });
812
1202
  } catch (e) {
813
- throw new Gt(e instanceof Error ? e.message : String(e));
1203
+ throw new Xn(e instanceof Error ? e.message : String(e));
814
1204
  }
815
1205
  return {
816
1206
  loaderData: n.renderData,
@@ -826,8 +1216,8 @@ __installPublicEnv(publicEnvValues)
826
1216
  ...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
827
1217
  }
828
1218
  };
829
- }, Yt = (e) => {
830
- let { helpers: t, renderInput: n } = e, r = Jt({
1219
+ }, er = (e) => {
1220
+ let { helpers: t, renderInput: n } = e, r = $n({
831
1221
  helpers: t,
832
1222
  page: e.page,
833
1223
  pathname: n.pathname,
@@ -848,22 +1238,22 @@ __installPublicEnv(publicEnvValues)
848
1238
  stateScript: t.renderRouterStateScript(r.stateInput),
849
1239
  hasDeferred: r.hasDeferred
850
1240
  };
851
- }, Xt = (e) => {
1241
+ }, tr = (e) => {
852
1242
  let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
853
1243
  return {
854
1244
  body: t,
855
1245
  meta: n
856
1246
  };
857
- }, Zt = (e) => [
1247
+ }, nr = (e) => [
858
1248
  ...e.extra ?? [],
859
1249
  e.helpers.renderMetaToHtml(e.meta),
860
1250
  `<meta name="voltro-interactive" content="${e.interactive}" />`,
861
1251
  ...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
862
1252
  e.prepared.stateScript
863
- ].filter((e) => e.length > 0).join("\n "), Qt = (e, t) => {
1253
+ ].filter((e) => e.length > 0).join("\n "), rr = (e, t) => {
864
1254
  let n = t.replace(/[^A-Za-z0-9+/=_-]/g, "");
865
1255
  return e.replace(/<script(?![^>]*\bnonce=)/gi, `<script nonce="${n}"`);
866
- }, $t = (e) => {
1256
+ }, ir = (e) => {
867
1257
  let t = e.indexOf("?");
868
1258
  return t === -1 ? {
869
1259
  pathname: e || "/",
@@ -872,7 +1262,7 @@ __installPublicEnv(publicEnvValues)
872
1262
  pathname: e.slice(0, t) || "/",
873
1263
  search: e.slice(t)
874
1264
  };
875
- }, en = (e) => {
1265
+ }, ar = (e) => {
876
1266
  let t = [];
877
1267
  for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
878
1268
  name: n.slice(5, -2),
@@ -888,12 +1278,12 @@ __installPublicEnv(publicEnvValues)
888
1278
  optional: !1
889
1279
  });
890
1280
  return t;
891
- }, tn = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), nn = async (e) => {
892
- let t = A(e);
1281
+ }, or = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), sr = async (e) => {
1282
+ let t = R(e);
893
1283
  for (let e = 0; e < 4; e++) {
894
- let e = O(t, "project.json");
895
- if (M(e)) try {
896
- let n = await N.readFile(e, "utf8");
1284
+ let e = I(t, "project.json");
1285
+ if (B(e)) try {
1286
+ let n = await V.readFile(e, "utf8");
897
1287
  return {
898
1288
  projectDir: t,
899
1289
  manifest: JSON.parse(n)
@@ -901,38 +1291,38 @@ __installPublicEnv(publicEnvValues)
901
1291
  } catch {
902
1292
  return null;
903
1293
  }
904
- let n = D(t);
1294
+ let n = F(t);
905
1295
  if (n === t) break;
906
1296
  t = n;
907
1297
  }
908
1298
  return null;
909
- }, rn = async (e) => {
910
- let t = await nn(e);
1299
+ }, cr = async (e) => {
1300
+ let t = await sr(e);
911
1301
  if (!t) return [];
912
- let { projectDir: n, manifest: r } = t, i = E(e), a = r.apps ?? {}, o = [];
1302
+ let { projectDir: n, manifest: r } = t, i = ae(e), a = r.apps ?? {}, o = [];
913
1303
  for (let [e, t] of Object.entries(a)) {
914
1304
  if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
915
- let r = O(n, t.path ?? e), a = O(r, "src", "pages");
916
- if (!M(a)) continue;
1305
+ let r = I(n, t.path ?? e), a = I(r, "src", "pages");
1306
+ if (!B(a)) continue;
917
1307
  let s;
918
1308
  try {
919
- let { pages: e } = await $(a);
1309
+ let { pages: e } = await ro(a);
920
1310
  s = e.map((e) => ({
921
1311
  pattern: e.pattern,
922
- params: en(e.pattern)
1312
+ params: ar(e.pattern)
923
1313
  }));
924
1314
  } catch {
925
1315
  continue;
926
1316
  }
927
1317
  o.push({
928
- key: tn(e),
1318
+ key: or(e),
929
1319
  origin: `http://localhost:${t.port}`,
930
1320
  ...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
931
1321
  routes: s
932
1322
  });
933
1323
  }
934
1324
  return o;
935
- }, an = (e) => {
1325
+ }, lr = (e) => {
936
1326
  if (e.params.length === 0) return `'${e.pattern}'`;
937
1327
  let t = e.pattern;
938
1328
  for (let n of e.params) {
@@ -940,21 +1330,21 @@ __installPublicEnv(publicEnvValues)
940
1330
  t = t.replace(e, r);
941
1331
  }
942
1332
  return "`" + t + "`";
943
- }, on = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
1333
+ }, ur = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
944
1334
  let t = "string";
945
1335
  return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
946
- }).join("; ")} }`, sn = (e, t, n) => {
947
- let r = on(e), i = an(e), a = t ? "VoltroExternalUrl" : e.search === void 0 ? "VoltroRouteUrl" : `VoltroRouteUrl<Schema.Schema.Type<typeof ${e.search.alias}>>`, o = t && n ? `${n} + ` : "";
1336
+ }).join("; ")} }`, dr = (e, t, n) => {
1337
+ let r = ur(e), i = lr(e), a = t ? "VoltroExternalUrl" : e.search === void 0 ? "VoltroRouteUrl" : `VoltroRouteUrl<Schema.Schema.Type<typeof ${e.search.alias}>>`, o = t && n ? `${n} + ` : "";
948
1338
  return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
949
- }, cn = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${sn(e, !1)},`).join("\n")}\n}`, ln = (e, t) => {
1339
+ }, fr = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${dr(e, !1)},`).join("\n")}\n}`, pr = (e, t) => {
950
1340
  if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
951
- let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${sn(e, !0, i)},`);
1341
+ let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${dr(e, !0, i)},`);
952
1342
  return ` ${e.key}: {\n${a.join("\n")}\n },`;
953
- }, un = async (e) => {
1343
+ }, mr = async (e) => {
954
1344
  let t = await Promise.all(e.pages.map(async (t) => {
955
1345
  let n;
956
1346
  try {
957
- let r = await N.readFile(O(e.appRoot, "src", "pages", t.file), "utf8");
1347
+ let r = await V.readFile(I(e.appRoot, "src", "pages", t.file), "utf8");
958
1348
  /^export const searchParams\b/m.test(r) && (n = {
959
1349
  alias: `SP_${t.ident}`,
960
1350
  specifier: `../src/pages/${t.file.replace(/\.tsx?$/, "")}`
@@ -962,10 +1352,10 @@ __installPublicEnv(publicEnvValues)
962
1352
  } catch {}
963
1353
  return {
964
1354
  pattern: t.pattern,
965
- params: en(t.pattern),
1355
+ params: ar(t.pattern),
966
1356
  ...n === void 0 ? {} : { search: n }
967
1357
  };
968
- })), n = await rn(e.appRoot), r = t.filter((e) => e.search !== void 0).sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => `import type { searchParams as ${e.search.alias} } from '${e.search.specifier}'`), i = [
1358
+ })), n = await cr(e.appRoot), r = t.filter((e) => e.search !== void 0).sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => `import type { searchParams as ${e.search.alias} } from '${e.search.specifier}'`), i = [
969
1359
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
970
1360
  "// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
971
1361
  "// Type-safe route builders consumed by <Link to={...}>.",
@@ -981,50 +1371,50 @@ __installPublicEnv(publicEnvValues)
981
1371
  "",
982
1372
  "type EmptyParams = Record<string, never>",
983
1373
  ""
984
- ].join("\n"), a = e.mode ?? "dev", o = `${i}\n${`export const routes = ${cn(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => ln(e, a)).join("\n")}\n} as const\n`}`, s = O(e.appRoot, ".framework", "routes.generated.ts");
985
- await N.mkdir(D(s), { recursive: !0 });
1374
+ ].join("\n"), a = e.mode ?? "dev", o = `${i}\n${`export const routes = ${fr(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => pr(e, a)).join("\n")}\n} as const\n`}`, s = I(e.appRoot, ".framework", "routes.generated.ts");
1375
+ await V.mkdir(F(s), { recursive: !0 });
986
1376
  let c = null;
987
1377
  try {
988
- c = await N.readFile(s, "utf8");
1378
+ c = await V.readFile(s, "utf8");
989
1379
  } catch {}
990
1380
  return c === o ? {
991
1381
  path: s,
992
1382
  wrote: !1
993
- } : (await N.writeFile(s, o, "utf8"), {
1383
+ } : (await V.writeFile(s, o, "utf8"), {
994
1384
  path: s,
995
1385
  wrote: !0
996
1386
  });
997
- }, dn = (e) => {
1387
+ }, hr = (e) => {
998
1388
  if (e === "" || e === "/") return "/";
999
1389
  let t = e.startsWith("/") ? e : `/${e}`;
1000
1390
  return t.endsWith("/") ? t.slice(0, -1) : t;
1001
- }, fn = (e, t) => {
1002
- let n = e.endsWith("/") ? e.slice(0, -1) : e, r = dn(t);
1391
+ }, gr = (e, t) => {
1392
+ let n = e.endsWith("/") ? e.slice(0, -1) : e, r = hr(t);
1003
1393
  return r === "/" ? `${n}/` : `${n}${r}`;
1004
- }, pn = (e, t, n) => {
1005
- let r = dn(e);
1394
+ }, _r = (e, t, n) => {
1395
+ let r = hr(e);
1006
1396
  return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
1007
- }, mn = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), hn = (e) => {
1397
+ }, vr = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), yr = (e) => {
1008
1398
  let { siteUrl: t, entries: n } = e, r = e.locales && e.locales.length > 1 ? e.locales : void 0, i = e.defaultLocale ?? r?.[0] ?? "en", a = r !== void 0, o = /* @__PURE__ */ new Map(), s = (e) => {
1009
1399
  if (!r) return "";
1010
- let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${mn(n)}" href="${mn(fn(t, pn(e, n, i)))}" />`);
1011
- return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${mn(fn(t, pn(e, i, i)))}" />`), `\n${n.join("\n")}`;
1400
+ let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${vr(n)}" href="${vr(gr(t, _r(e, n, i)))}" />`);
1401
+ return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${vr(gr(t, _r(e, i, i)))}" />`), `\n${n.join("\n")}`;
1012
1402
  };
1013
1403
  for (let e of n) {
1014
1404
  let n = r ?? [i];
1015
1405
  for (let r of n) {
1016
- let n = fn(t, pn(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${mn(e.lastmod)}</lastmod>` : "";
1017
- o.set(n, ` <url>\n <loc>${mn(n)}</loc>${a}${s(e.path)}\n </url>`);
1406
+ let n = gr(t, _r(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${vr(e.lastmod)}</lastmod>` : "";
1407
+ o.set(n, ` <url>\n <loc>${vr(n)}</loc>${a}${s(e.path)}\n </url>`);
1018
1408
  }
1019
1409
  }
1020
1410
  let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
1021
1411
  return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset${a ? " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"" : " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\""}>\n${c}\n</urlset>\n`;
1022
- }, gn = (e) => {
1412
+ }, br = (e) => {
1023
1413
  if (!e.indexable) return "User-agent: *\nDisallow: /\n";
1024
1414
  let t = ["User-agent: *", "Allow: /"];
1025
- for (let n of e.disallow ?? []) t.push(`Disallow: ${dn(n)}`);
1415
+ for (let n of e.disallow ?? []) t.push(`Disallow: ${hr(n)}`);
1026
1416
  return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
1027
- }, _n = 256, vn = (e = _n) => {
1417
+ }, xr = 256, Sr = (e = xr) => {
1028
1418
  let t = [], n = /* @__PURE__ */ new Set();
1029
1419
  return {
1030
1420
  emit(r, i) {
@@ -1047,18 +1437,18 @@ __installPublicEnv(publicEnvValues)
1047
1437
  return t.slice();
1048
1438
  }
1049
1439
  };
1050
- }, yn = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, bn = () => `: keep-alive ${Date.now()}\n\n`, xn = 8e3, Sn = (e, t = xn) => {
1051
- let n = wn(e);
1440
+ }, Cr = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, wr = () => `: keep-alive ${Date.now()}\n\n`, Tr = 8e3, Er = (e, t = Tr) => {
1441
+ let n = Or(e);
1052
1442
  return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
1053
- }, Cn = 4, wn = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
1443
+ }, Dr = 4, Or = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
1054
1444
  if (e instanceof Error) {
1055
1445
  let r = e.stack ?? `${e.name}: ${e.message}`;
1056
1446
  if (n.has(e)) return `${r}\n [cycle]`;
1057
1447
  n.add(e);
1058
1448
  let i = [];
1059
- if (t < Cn) {
1060
- if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Tn(wn(a, t + 1, n))}`);
1061
- else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Tn(wn(e.cause, t + 1, n))}`);
1449
+ if (t < Dr) {
1450
+ if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${kr(Or(a, t + 1, n))}`);
1451
+ else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${kr(Or(e.cause, t + 1, n))}`);
1062
1452
  }
1063
1453
  return r + i.join("");
1064
1454
  }
@@ -1067,30 +1457,30 @@ __installPublicEnv(publicEnvValues)
1067
1457
  } catch {
1068
1458
  return "[unstringifiable thrown value]";
1069
1459
  }
1070
- }, Tn = (e) => {
1460
+ }, kr = (e) => {
1071
1461
  let t = e.split("\n");
1072
1462
  return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
1073
- }, En = {
1463
+ }, Ar = {
1074
1464
  trace: 0,
1075
1465
  debug: 1,
1076
1466
  info: 2,
1077
1467
  warn: 3,
1078
1468
  error: 4,
1079
1469
  fatal: 5
1080
- }, Dn = 2e3, On = 200, kn = class {
1470
+ }, jr = 2e3, Mr = 200, Nr = class {
1081
1471
  capacity;
1082
1472
  buffer = [];
1083
- constructor(e = Dn) {
1473
+ constructor(e = jr) {
1084
1474
  this.capacity = e;
1085
1475
  }
1086
1476
  append(e) {
1087
1477
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
1088
1478
  }
1089
1479
  query(e = {}) {
1090
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? On, this.capacity), i = e.minLevel === void 0 ? En.trace : En[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
1480
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Mr, this.capacity), i = e.minLevel === void 0 ? Ar.trace : Ar[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
1091
1481
  for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
1092
1482
  let r = this.buffer[e];
1093
- r.ts < t || r.ts > n || En[r.level] < i || (o === void 0 || r.source === o) && (a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || (c === void 0 || r.fields.traceId === c) && l.push(r));
1483
+ r.ts < t || r.ts > n || Ar[r.level] < i || (o === void 0 || r.source === o) && (a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || (c === void 0 || r.fields.traceId === c) && l.push(r));
1094
1484
  }
1095
1485
  return l.reverse();
1096
1486
  }
@@ -1103,7 +1493,7 @@ __installPublicEnv(publicEnvValues)
1103
1493
  clear() {
1104
1494
  this.buffer = [];
1105
1495
  }
1106
- }, An = null, jn = () => (An === null && (An = new kn()), An), Mn = (e) => {
1496
+ }, Pr = null, Fr = () => (Pr === null && (Pr = new Nr()), Pr), Ir = (e) => {
1107
1497
  if (typeof e == "string") return e;
1108
1498
  if (e instanceof Error) return e.message;
1109
1499
  try {
@@ -1111,28 +1501,28 @@ __installPublicEnv(publicEnvValues)
1111
1501
  } catch {
1112
1502
  return String(e);
1113
1503
  }
1114
- }, Nn = 8e3, Pn = (e) => typeof e == "string" ? e.length <= Nn ? e : `${e.slice(0, Nn)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Sn(e, Nn), Fn = (e, t) => {
1504
+ }, Lr = 8e3, Rr = (e) => typeof e == "string" ? e.length <= Lr ? e : `${e.slice(0, Lr)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Er(e, Lr), zr = (e, t) => {
1115
1505
  try {
1116
1506
  e(...t);
1117
1507
  } catch (n) {
1118
1508
  try {
1119
- e(...t.map(Pn)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Nn} chars per argument.`);
1509
+ e(...t.map(Rr)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Lr} chars per argument.`);
1120
1510
  } catch {
1121
1511
  e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
1122
1512
  }
1123
1513
  }
1124
- }, In = (e) => {
1514
+ }, Br = (e) => {
1125
1515
  let t = {
1126
1516
  log: console.log.bind(console),
1127
1517
  info: console.info.bind(console),
1128
1518
  warn: console.warn.bind(console),
1129
1519
  error: console.error.bind(console),
1130
1520
  debug: console.debug.bind(console)
1131
- }, n = jn(), r = !1, i = (i) => (...a) => {
1132
- if (Fn(t[i], a), !r) {
1521
+ }, n = Fr(), r = !1, i = (i) => (...a) => {
1522
+ if (zr(t[i], a), !r) {
1133
1523
  r = !0;
1134
1524
  try {
1135
- let t = a.length > 0 ? Mn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = V();
1525
+ let t = a.length > 0 ? Ir(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = fe();
1136
1526
  e.emit("log", {
1137
1527
  level: i,
1138
1528
  message: r,
@@ -1159,7 +1549,7 @@ __installPublicEnv(publicEnvValues)
1159
1549
  }
1160
1550
  };
1161
1551
  console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
1162
- let a = L((t) => {
1552
+ let a = le((t) => {
1163
1553
  if (!r) {
1164
1554
  r = !0;
1165
1555
  try {
@@ -1170,7 +1560,7 @@ __installPublicEnv(publicEnvValues)
1170
1560
  argsCount: 1,
1171
1561
  ...t.scope === void 0 ? {} : { scope: t.scope }
1172
1562
  });
1173
- let a = V(), o = a !== void 0 && t.fields.traceId === void 0 ? {
1563
+ let a = fe(), o = a !== void 0 && t.fields.traceId === void 0 ? {
1174
1564
  ...t.fields,
1175
1565
  traceId: a.traceId
1176
1566
  } : t.fields;
@@ -1190,24 +1580,24 @@ __installPublicEnv(publicEnvValues)
1190
1580
  return () => {
1191
1581
  console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
1192
1582
  };
1193
- }, Ln = 2e3, Rn = 8, zn = 1e3, Bn = 200, Vn = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Hn = (e) => {
1583
+ }, Vr = 2e3, Hr = 8, Ur = 1e3, Wr = 200, Gr = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Kr = (e) => {
1194
1584
  switch (e) {
1195
1585
  case "error": return "error";
1196
1586
  case "warn": return "warn";
1197
1587
  case "debug": return "debug";
1198
1588
  default: return "info";
1199
1589
  }
1200
- }, Un = R({ scope: "client" }), Wn = (e, t) => {
1590
+ }, qr = K({ scope: "client" }), Jr = (e, t) => {
1201
1591
  let n;
1202
1592
  try {
1203
1593
  n = JSON.parse(e);
1204
1594
  } catch {
1205
- return Gn(400, { error: "invalid JSON body" });
1595
+ return Yr(400, { error: "invalid JSON body" });
1206
1596
  }
1207
- if (typeof n != "object" || !n) return Gn(400, { error: "body must be a JSON object" });
1597
+ if (typeof n != "object" || !n) return Yr(400, { error: "body must be a JSON object" });
1208
1598
  let r = n;
1209
- if (!Array.isArray(r.entries)) return Gn(400, { error: "entries must be an array" });
1210
- let i = typeof r.app == "string" ? Vn(r.app, 120) : void 0, a = typeof r.page == "string" ? Vn(r.page, 200) : void 0, o = typeof r.ua == "string" ? Vn(r.ua, 200) : void 0, s = r.entries.slice(0, Bn), c = 0;
1599
+ if (!Array.isArray(r.entries)) return Yr(400, { error: "entries must be an array" });
1600
+ let i = typeof r.app == "string" ? Gr(r.app, 120) : void 0, a = typeof r.page == "string" ? Gr(r.page, 200) : void 0, o = typeof r.ua == "string" ? Gr(r.ua, 200) : void 0, s = r.entries.slice(0, Wr), c = 0;
1211
1601
  for (let e of s) {
1212
1602
  if (typeof e != "object" || !e) continue;
1213
1603
  let n = e;
@@ -1218,7 +1608,7 @@ __installPublicEnv(publicEnvValues)
1218
1608
  "warn",
1219
1609
  "error",
1220
1610
  "debug"
1221
- ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Vn(n.message, Ln), u = Array.isArray(n.args) ? n.args.slice(0, Rn).filter((e) => typeof e == "string").map((e) => Vn(e, zn)) : void 0, d = typeof n.stack == "string" ? Vn(n.stack, Ln) : void 0;
1611
+ ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Gr(n.message, Vr), u = Array.isArray(n.args) ? n.args.slice(0, Hr).filter((e) => typeof e == "string").map((e) => Gr(e, Ur)) : void 0, d = typeof n.stack == "string" ? Gr(n.stack, Vr) : void 0;
1222
1612
  t.emit("clientLog", {
1223
1613
  ts: s,
1224
1614
  level: r,
@@ -1233,35 +1623,35 @@ __installPublicEnv(publicEnvValues)
1233
1623
  ...i === void 0 ? {} : { app: i },
1234
1624
  ...a === void 0 ? {} : { page: a },
1235
1625
  ...u !== void 0 && u.length > 0 ? { args: u } : {}
1236
- }, p = Hn(r);
1237
- (p === "error" || p === "warn") && d !== void 0 ? Un[p](l, f, { stack: d }) : Un[p](l, {
1626
+ }, p = Kr(r);
1627
+ (p === "error" || p === "warn") && d !== void 0 ? qr[p](l, f, { stack: d }) : qr[p](l, {
1238
1628
  ...f,
1239
1629
  ...d === void 0 ? {} : { stack: d }
1240
1630
  }), c++;
1241
1631
  }
1242
- return Gn(202, {
1632
+ return Yr(202, {
1243
1633
  accepted: c,
1244
1634
  dropped: r.entries.length - c
1245
1635
  });
1246
- }, Gn = (e, t) => ({
1636
+ }, Yr = (e, t) => ({
1247
1637
  status: e,
1248
1638
  contentType: "application/json; charset=utf-8",
1249
1639
  body: JSON.stringify(t)
1250
- }), Kn = "/_voltro/inspect/clientLog", qn = [
1640
+ }), Xr = "/_voltro/inspect/clientLog", Zr = [
1251
1641
  "trace",
1252
1642
  "debug",
1253
1643
  "info",
1254
1644
  "warn",
1255
1645
  "error",
1256
1646
  "fatal"
1257
- ], Jn = {
1647
+ ], Qr = {
1258
1648
  trace: "TRACE",
1259
1649
  debug: "DEBUG",
1260
1650
  info: "INFO ",
1261
1651
  warn: "WARN ",
1262
1652
  error: "ERROR",
1263
1653
  fatal: "FATAL"
1264
- }, Yn = (e) => qn.includes(e), Xn = (e, t, n = {}) => {
1654
+ }, $r = (e) => Zr.includes(e), ei = (e, t, n = {}) => {
1265
1655
  if (u()) return {
1266
1656
  status: 503,
1267
1657
  contentType: "application/json",
@@ -1292,7 +1682,7 @@ __installPublicEnv(publicEnvValues)
1292
1682
  Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
1293
1683
  }
1294
1684
  let d = a.get("level");
1295
- d !== null && Yn(d) && (o.minLevel = d);
1685
+ d !== null && $r(d) && (o.minLevel = d);
1296
1686
  let p = a.get("source");
1297
1687
  (p === "server" || p === "client") && (o.source = p);
1298
1688
  let m = a.get("scope");
@@ -1305,7 +1695,7 @@ __installPublicEnv(publicEnvValues)
1305
1695
  if ((a.get("format") ?? "json") === "text") return {
1306
1696
  status: 200,
1307
1697
  contentType: "text/plain; charset=utf-8",
1308
- body: _.map(Zn).join("\n") + (_.length > 0 ? "\n" : "")
1698
+ body: _.map(ti).join("\n") + (_.length > 0 ? "\n" : "")
1309
1699
  };
1310
1700
  let v = {
1311
1701
  capturedAt: Date.now(),
@@ -1319,40 +1709,40 @@ __installPublicEnv(publicEnvValues)
1319
1709
  contentType: "application/json; charset=utf-8",
1320
1710
  body: JSON.stringify(v)
1321
1711
  };
1322
- }, Zn = (e) => {
1323
- let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = $n(e.fields);
1324
- return `${n}:${r}:${i}.${a} ${Jn[e.level]} ${o} ${e.message}${s}`;
1325
- }, Qn = 80, $n = (e) => {
1712
+ }, ti = (e) => {
1713
+ let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = ri(e.fields);
1714
+ return `${n}:${r}:${i}.${a} ${Qr[e.level]} ${o} ${e.message}${s}`;
1715
+ }, ni = 80, ri = (e) => {
1326
1716
  let t = Object.entries(e);
1327
1717
  if (t.length === 0) return "";
1328
1718
  let n = [];
1329
1719
  for (let [e, r] of t) {
1330
1720
  if (r === void 0) continue;
1331
- let t = er(r);
1721
+ let t = ii(r);
1332
1722
  n.push(`${e}=${t}`);
1333
1723
  }
1334
1724
  return n.length > 0 ? " " + n.join(" ") : "";
1335
- }, er = (e) => {
1725
+ }, ii = (e) => {
1336
1726
  if (typeof e == "string") {
1337
- let t = e.length > Qn ? e.slice(0, Qn) + "…" : e;
1727
+ let t = e.length > ni ? e.slice(0, ni) + "…" : e;
1338
1728
  return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
1339
1729
  }
1340
1730
  if (e === null) return "null";
1341
1731
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1342
1732
  try {
1343
1733
  let t = JSON.stringify(e);
1344
- return t.length > Qn ? t.slice(0, Qn) + "…" : t;
1734
+ return t.length > ni ? t.slice(0, ni) + "…" : t;
1345
1735
  } catch {
1346
1736
  return "[unserialisable]";
1347
1737
  }
1348
- }, tr = "/_voltro/inspect/logs", nr = (e, t, n) => {
1738
+ }, ai = "/_voltro/inspect/logs", oi = (e, t, n) => {
1349
1739
  if (t.headers.authorization !== void 0) return !1;
1350
1740
  let { token: r } = n;
1351
1741
  if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
1352
1742
  e.setHeader("authorization", `Bearer ${r}`);
1353
1743
  let i = n.writeToken;
1354
1744
  return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
1355
- }, rr = [{
1745
+ }, si = [{
1356
1746
  match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
1357
1747
  handle: (e, t) => {
1358
1748
  let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
@@ -1364,13 +1754,13 @@ __installPublicEnv(publicEnvValues)
1364
1754
  });
1365
1755
  } else t.info(n);
1366
1756
  }
1367
- }], ir = () => {
1757
+ }], ci = () => {
1368
1758
  let e = {
1369
1759
  warn: console.warn.bind(console),
1370
1760
  error: console.error.bind(console)
1371
- }, t = R({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1761
+ }, t = K({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1372
1762
  if (!n) {
1373
- for (let e of rr) if (e.match(i[0])) {
1763
+ for (let e of si) if (e.match(i[0])) {
1374
1764
  n = !0;
1375
1765
  try {
1376
1766
  e.handle(i, t);
@@ -1385,7 +1775,7 @@ __installPublicEnv(publicEnvValues)
1385
1775
  return console.warn = r("warn"), console.error = r("error"), () => {
1386
1776
  console.warn = e.warn, console.error = e.error;
1387
1777
  };
1388
- }, ar = {
1778
+ }, li = {
1389
1779
  loader: "it runs on the server, and the router caches its result per route + params",
1390
1780
  renderMode: "it picks the server render strategy",
1391
1781
  dynamic: "it picks the server render strategy",
@@ -1395,8 +1785,10 @@ __installPublicEnv(publicEnvValues)
1395
1785
  staleWhileRevalidate: "it sets the ISR stale-while-revalidate window",
1396
1786
  cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
1397
1787
  interactive: "it decides how much client JS the server ships",
1398
- tenantAware: "it is part of the server-side cache key"
1399
- }, or = Object.keys(ar), sr = "virtual:voltro-route-refresh", cr = `\0${sr}`, lr = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, ur = () => `
1788
+ tenantAware: "it is part of the server-side cache key",
1789
+ ogImage: "the server renders it into the og:image PNG",
1790
+ ppr: "it switches the isr path to partial prerendering (cached shell + per-request holes)"
1791
+ }, ui = Object.keys(li), di = "virtual:voltro-route-refresh", fi = `\0${di}`, pi = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, mi = () => `
1400
1792
  // GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
1401
1793
 
1402
1794
  /** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
@@ -1425,11 +1817,11 @@ const stableForm = (value) => {
1425
1817
  * readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
1426
1818
  * one of THESE cannot be hot-applied: the server already ran with the old
1427
1819
  * value. Everything else a page exports is plain client-side data. */
1428
- const serverRelevantExports = ${JSON.stringify(or)}
1820
+ const serverRelevantExports = ${JSON.stringify(ui)}
1429
1821
 
1430
1822
  /** Name → the server step that already consumed it, so the reload message can
1431
1823
  * say WHY rather than just WHAT. Injected from the same single source. */
1432
- const serverExportEffect = ${JSON.stringify(ar)}
1824
+ const serverExportEffect = ${JSON.stringify(li)}
1433
1825
 
1434
1826
  /** The reason \`name\` forces a reload, for the console line. */
1435
1827
  export const serverEffectOf = (name) =>
@@ -1472,7 +1864,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
1472
1864
  const previousHook = globalThis.__getReactRefreshIgnoredExports
1473
1865
  globalThis.__getReactRefreshIgnoredExports = (args) =>
1474
1866
  ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
1475
- `, dr = (e) => `
1867
+ `, hi = (e) => `
1476
1868
  if (import.meta.hot) {
1477
1869
  // Self-import to read our OWN exports, the same technique the react plugin
1478
1870
  // uses; the namespace is only complete after evaluation, hence the promise.
@@ -1499,97 +1891,97 @@ import {
1499
1891
  registerRouteModule as __voltro_registerRouteModule,
1500
1892
  routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
1501
1893
  serverEffectOf as __voltro_serverEffect,
1502
- } from '${sr}'
1503
- `, fr = (e) => e.replace(/\\/g, "/"), pr = (e, t) => {
1504
- let [n = "", r] = fr(e).split("?");
1505
- if (!n.endsWith(".tsx") || r !== void 0 && lr.test(r)) return !1;
1506
- let i = fr(t).replace(/\/$/, "");
1507
- return n.startsWith(`${i}/`) ? c.test(n) || s.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
1508
- }, mr = (e, t, n) => pr(t, n) ? `${e}${dr(fr(t).split("?")[0] ?? t)}` : null, hr = (e) => ({
1894
+ } from '${di}'
1895
+ `, gi = (e) => e.replace(/\\/g, "/"), _i = (e, t) => {
1896
+ let [n = "", r] = gi(e).split("?");
1897
+ if (!n.endsWith(".tsx") || r !== void 0 && pi.test(r)) return !1;
1898
+ let i = gi(t).replace(/\/$/, "");
1899
+ return n.startsWith(`${i}/`) ? o.test(n) || a.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
1900
+ }, vi = (e, t, n) => _i(t, n) ? `${e}${hi(gi(t).split("?")[0] ?? t)}` : null, yi = (e) => ({
1509
1901
  name: "voltro:route-fast-refresh",
1510
1902
  enforce: "pre",
1511
- resolveId: (e) => e === "virtual:voltro-route-refresh" ? cr : void 0,
1512
- load: (e) => e === cr ? ur() : void 0,
1903
+ resolveId: (e) => e === "virtual:voltro-route-refresh" ? fi : void 0,
1904
+ load: (e) => e === fi ? mi() : void 0,
1513
1905
  transform: (t, n, r) => {
1514
1906
  if (r?.ssr === !0) return null;
1515
- let i = mr(t, n, e);
1907
+ let i = vi(t, n, e);
1516
1908
  return i === null ? null : {
1517
1909
  code: i,
1518
1910
  map: null
1519
1911
  };
1520
1912
  }
1521
- }), gr = R({ scope: "voltro:dashboard" }), _r = ie(import.meta.url), vr = 5179, yr = (e) => {
1913
+ }), bi = K({ scope: "voltro:dashboard" }), xi = q(import.meta.url), Si = 5179, Ci = (e) => {
1522
1914
  let t = process.env.VOLTRO_DASHBOARD_PATH;
1523
- if (t && M(O(A(t), "app.config.ts"))) return A(t);
1915
+ if (t && B(I(R(t), "app.config.ts"))) return R(t);
1524
1916
  try {
1525
- let e = D(_r.resolve("@voltro/dashboard/package.json"));
1526
- if (M(O(e, "app.config.ts"))) return e;
1917
+ let e = F(xi.resolve("@voltro/dashboard/package.json"));
1918
+ if (B(I(e, "app.config.ts"))) return e;
1527
1919
  } catch {}
1528
- let n = O("voltro-devtools", "apps", "dashboard"), r = A(e);
1920
+ let n = I("voltro-devtools", "apps", "dashboard"), r = R(e);
1529
1921
  for (let e = 0; e < 10; e++) {
1530
- let e = O(r, n);
1531
- if (M(O(e, "app.config.ts"))) return e;
1532
- let t = D(r);
1922
+ let e = I(r, n);
1923
+ if (B(I(e, "app.config.ts"))) return e;
1924
+ let t = F(r);
1533
1925
  if (t === r) break;
1534
1926
  r = t;
1535
1927
  }
1536
1928
  return null;
1537
- }, br = "VOLTRO_IS_DASHBOARD", xr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1538
- let i = K({
1929
+ }, wi = "VOLTRO_IS_DASHBOARD", Ti = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1930
+ let i = Ne({
1539
1931
  port: e,
1540
1932
  host: t
1541
1933
  }), a = !1, o = (e) => {
1542
1934
  a || (a = !0, i.destroy(), r(e));
1543
1935
  };
1544
1936
  i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
1545
- }), Sr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Cr = () => process.env[br] === "1", wr = () => process.stdout.isTTY === !0, Tr = O(H(), ".voltro", "dashboard-launch.lock"), Er = 1e4, Dr = async () => {
1937
+ }), Ei = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Di = () => process.env[wi] === "1", Oi = () => process.stdout.isTTY === !0, ki = I(he(), ".voltro", "dashboard-launch.lock"), Ai = 1e4, ji = async () => {
1546
1938
  try {
1547
- await N.mkdir(D(Tr), { recursive: !0 });
1548
- let e = await N.open(Tr, "wx");
1939
+ await V.mkdir(F(ki), { recursive: !0 });
1940
+ let e = await V.open(ki, "wx");
1549
1941
  return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
1550
1942
  } catch {
1551
1943
  try {
1552
- let e = await N.stat(Tr);
1553
- if (Date.now() - e.mtimeMs > Er) return await N.unlink(Tr).catch(() => void 0), Dr();
1944
+ let e = await V.stat(ki);
1945
+ if (Date.now() - e.mtimeMs > Ai) return await V.unlink(ki).catch(() => void 0), ji();
1554
1946
  } catch {}
1555
1947
  return !1;
1556
1948
  }
1557
- }, Or = async () => {
1949
+ }, Mi = async () => {
1558
1950
  try {
1559
- await N.unlink(Tr);
1951
+ await V.unlink(ki);
1560
1952
  } catch {}
1561
- }, kr = async (e) => {
1953
+ }, Ni = async (e) => {
1562
1954
  let t = e.port ?? 5179;
1563
- if (Sr()) return {
1955
+ if (Ei()) return {
1564
1956
  status: "skipped",
1565
1957
  reason: "disabled by flag/env",
1566
1958
  port: t
1567
1959
  };
1568
- if (Cr()) return {
1960
+ if (Di()) return {
1569
1961
  status: "skipped",
1570
1962
  reason: "this process IS the dashboard",
1571
1963
  port: t
1572
1964
  };
1573
- if (!wr()) return {
1965
+ if (!Oi()) return {
1574
1966
  status: "skipped",
1575
1967
  reason: "stdout is not a TTY (CI/smoke)",
1576
1968
  port: t
1577
1969
  };
1578
- if (!await Dr()) return {
1970
+ if (!await ji()) return {
1579
1971
  status: "skipped",
1580
1972
  reason: "another voltro process is currently launching the dashboard",
1581
1973
  port: t
1582
1974
  };
1583
- if (await xr(t)) return await Or(), {
1975
+ if (await Ti(t)) return await Mi(), {
1584
1976
  status: "already-running",
1585
1977
  port: t
1586
1978
  };
1587
1979
  let n = e.voltroBin;
1588
1980
  if (!n) {
1589
1981
  let e = process.argv[1];
1590
- n = e && e.endsWith("/src/bin.ts") ? O(D(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1982
+ n = e && e.endsWith("/src/bin.ts") ? I(F(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1591
1983
  }
1592
- let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = M(r), a = i ? "start" : "dev", o = _e(process.execPath, [
1984
+ let r = I(e.dashboardAppPath, ".framework", "dist", "index.html"), i = B(r), a = i ? "start" : "dev", o = Me(process.execPath, [
1593
1985
  n,
1594
1986
  a,
1595
1987
  e.dashboardAppPath
@@ -1597,7 +1989,7 @@ import {
1597
1989
  stdio: "ignore",
1598
1990
  env: {
1599
1991
  ...process.env,
1600
- [br]: "1",
1992
+ [wi]: "1",
1601
1993
  VOLTRO_DASHBOARD_PORT: String(t)
1602
1994
  }
1603
1995
  });
@@ -1605,19 +1997,19 @@ import {
1605
1997
  if (o.exitCode === null && o.signalCode === null) try {
1606
1998
  o.kill("SIGTERM");
1607
1999
  } catch {}
1608
- }), gr.info(`auto-launching dashboard at http://localhost:${t}`, {
2000
+ }), bi.info(`auto-launching dashboard at http://localhost:${t}`, {
1609
2001
  port: t,
1610
2002
  mode: a,
1611
2003
  prebuilt: i
1612
- }), i || gr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), gr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1613
- Or();
2004
+ }), i || bi.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), bi.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
2005
+ Mi();
1614
2006
  }, 4e3).unref(), {
1615
2007
  status: "launched",
1616
2008
  port: t
1617
2009
  };
1618
- }, Ar = /Could not find required `intl` object/, jr = "__voltro_i18n_instances__", Mr = (e = globalThis) => {
2010
+ }, Pi = /Could not find required `intl` object/, Fi = "__voltro_i18n_instances__", Ii = (e = globalThis) => {
1619
2011
  try {
1620
- let t = e[jr]?.records;
2012
+ let t = e[Fi]?.records;
1621
2013
  return t === void 0 || t.length === 0 ? void 0 : {
1622
2014
  instances: t.length,
1623
2015
  reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
@@ -1626,7 +2018,7 @@ import {
1626
2018
  } catch {
1627
2019
  return;
1628
2020
  }
1629
- }, Nr = (e, t) => [
2021
+ }, Li = (e, t) => [
1630
2022
  "",
1631
2023
  "── voltro diagnosis ───────────────────────────────────────────────────",
1632
2024
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1644,7 +2036,7 @@ import {
1644
2036
  " versions on disk; this counts instances in the running process, and one",
1645
2037
  " file loaded down two paths is two instances.",
1646
2038
  "───────────────────────────────────────────────────────────────────────"
1647
- ].join("\n"), Pr = (e, t) => [
2039
+ ].join("\n"), Ri = (e, t) => [
1648
2040
  "",
1649
2041
  "── voltro diagnosis ───────────────────────────────────────────────────",
1650
2042
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1660,7 +2052,7 @@ import {
1660
2052
  " direct import can land on a second copy that this count does not see —",
1661
2053
  " it counts what @voltro/i18n is bound to.",
1662
2054
  "───────────────────────────────────────────────────────────────────────"
1663
- ].join("\n"), Fr = (e) => [
2055
+ ].join("\n"), zi = (e) => [
1664
2056
  "",
1665
2057
  "── voltro diagnosis ───────────────────────────────────────────────────",
1666
2058
  `${e} DID wrap this render in <I18nProvider> — the framework`,
@@ -1676,37 +2068,37 @@ import {
1676
2068
  " Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
1677
2069
  " the duplication here is of module instances in one process.",
1678
2070
  "───────────────────────────────────────────────────────────────────────"
1679
- ].join("\n"), Ir = (e, t, n, r = Mr()) => {
2071
+ ].join("\n"), Bi = (e, t, n, r = Ii()) => {
1680
2072
  if (!t) return;
1681
2073
  let i = String(e?.message ?? e);
1682
- if (Ar.test(i)) return r === void 0 ? Fr(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Nr(n, r) : Pr(n, r);
1683
- }, Lr = "<div id=\"root\"></div>", Rr = "<div id=\"root\">", zr = "</div>", Br = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Vr = /\bsrc=["']([^"']+)["']/i, Hr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Ur = (e) => {
1684
- let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Br, (e) => {
1685
- let r = Vr.exec(e)?.[1];
2074
+ if (Pi.test(i)) return r === void 0 ? zi(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Li(n, r) : Ri(n, r);
2075
+ }, Vi = "<div id=\"root\"></div>", Hi = "<div id=\"root\">", Ui = "</div>", Wi = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Gi = /\bsrc=["']([^"']+)["']/i, Ki = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, qi = (e) => {
2076
+ let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Wi, (e) => {
2077
+ let r = Gi.exec(e)?.[1];
1686
2078
  return r === void 0 || t(r) ? e : (n.push(r), "");
1687
2079
  });
1688
- e.inlineModuleScriptsAsync && (r = r.replace(Hr, "<script async$1>"));
1689
- let i = r.indexOf(Lr);
1690
- if (i === -1) throw Error(`[voltro] the generated shell has no \`${Lr}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
2080
+ e.inlineModuleScriptsAsync && (r = r.replace(Ki, "<script async$1>"));
2081
+ let i = r.indexOf(Vi);
2082
+ if (i === -1) throw Error(`[voltro] the generated shell has no \`${Vi}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
1691
2083
  return {
1692
- head: `${r.slice(0, i)}${Rr}`,
1693
- tail: `${zr}${r.slice(i + 21)}`,
2084
+ head: `${r.slice(0, i)}${Hi}`,
2085
+ tail: `${Ui}${r.slice(i + 21)}`,
1694
2086
  bootstrapModules: n
1695
2087
  };
1696
- }, Wr = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), Gr = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Kr = (e, t) => {
1697
- let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${Gr(t.timeZone)}"`, t.renderedAt === void 0 ? "" : ` data-voltro-now="${t.renderedAt}"`].join("");
1698
- return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${Gr(t.lang)}"${n}`);
1699
- }, qr = (e) => Kr(Wr(e.head, e.headInjection), e.documentAttrs), Jr = (e) => {
2088
+ }, Ji = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), Yi = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Xi = (e, t) => {
2089
+ let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${Yi(t.timeZone)}"`, t.renderedAt === void 0 ? "" : ` data-voltro-now="${t.renderedAt}"`].join("");
2090
+ return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${Yi(t.lang)}"${n}`);
2091
+ }, Zi = (e) => Xi(Ji(e.head, e.headInjection), e.documentAttrs), Qi = (e) => {
1700
2092
  let { res: t, shell: n, documentAttrs: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
1701
2093
  if (s || !o || a === null) return;
1702
2094
  s = !0, t.statusCode = e.statusCode ?? 200;
1703
2095
  for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
1704
- t.flushHeaders?.(), t.write(qr({
2096
+ t.flushHeaders?.(), t.write(Zi({
1705
2097
  head: n.head,
1706
2098
  headInjection: i(a.meta),
1707
2099
  documentAttrs: r
1708
2100
  }));
1709
- let c = new Te();
2101
+ let c = new Je();
1710
2102
  c.pipe(t, { end: !1 }), c.on("end", () => {
1711
2103
  t.end(n.tail);
1712
2104
  }), a.stream.pipe(c);
@@ -1731,16 +2123,16 @@ import {
1731
2123
  return;
1732
2124
  }
1733
2125
  c();
1734
- }, Yr = (e) => Array.isArray(e.preload) && e.preload.length > 0, Xr = (e, t) => typeof e == "string" ? {
2126
+ }, $i = (e) => Array.isArray(e.preload) && e.preload.length > 0, ea = (e, t) => typeof e == "string" ? {
1735
2127
  tag: e,
1736
2128
  input: {}
1737
2129
  } : {
1738
2130
  tag: e.tag,
1739
2131
  input: e.input?.(t) ?? {}
1740
- }, Zr = async (e) => {
2132
+ }, ta = async (e) => {
1741
2133
  let { pageMod: t, params: n, query: r, apiName: i, seed: a, seedFailure: o, onError: s } = e;
1742
- if (Yr(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
1743
- let { tag: t, input: c } = Xr(e, n);
2134
+ if ($i(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
2135
+ let { tag: t, input: c } = ea(e, n);
1744
2136
  try {
1745
2137
  a(i, t, c, await r(t, c));
1746
2138
  } catch (e) {
@@ -1750,62 +2142,62 @@ import {
1750
2142
  }, e);
1751
2143
  }
1752
2144
  }
1753
- }, Qr = (e) => a.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : o.test(e) || l.test(e) || i.test(e), $r = /* @__PURE__ */ new Set([
2145
+ }, na = (e) => l.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : i.test(e) || c.test(e) || s.test(e), ra = /* @__PURE__ */ new Set([
1754
2146
  "node_modules",
1755
2147
  "dist",
1756
2148
  ".framework",
1757
2149
  ".git"
1758
- ]), ei = async (e) => {
2150
+ ]), ia = async (e) => {
1759
2151
  let t = [], n = async (e) => {
1760
2152
  let r;
1761
2153
  try {
1762
- r = await N.readdir(e, { withFileTypes: !0 });
2154
+ r = await V.readdir(e, { withFileTypes: !0 });
1763
2155
  } catch {
1764
2156
  return;
1765
2157
  }
1766
2158
  for (let i of r) if (!(i.name.startsWith(".") && i.isDirectory())) {
1767
2159
  if (i.isDirectory()) {
1768
- if ($r.has(i.name)) continue;
1769
- await n(O(e, i.name));
1770
- } else Qr(i.name) && t.push(O(e, i.name));
2160
+ if (ra.has(i.name)) continue;
2161
+ await n(I(e, i.name));
2162
+ } else na(i.name) && t.push(I(e, i.name));
1771
2163
  }
1772
2164
  };
1773
2165
  return await n(e), t.sort();
1774
- }, ti = async (e) => {
1775
- let t = ge("sha1");
1776
- for (let n of await ei(e)) {
2166
+ }, aa = async (e) => {
2167
+ let t = Oe("sha1");
2168
+ for (let n of await ia(e)) {
1777
2169
  t.update(n.slice(e.length)), t.update("\0");
1778
2170
  try {
1779
- t.update(await N.readFile(n));
2171
+ t.update(await V.readFile(n));
1780
2172
  } catch {}
1781
2173
  t.update("\0");
1782
2174
  }
1783
2175
  try {
1784
- t.update(await N.readFile(O(e, "rpcGroup.generated.ts")));
2176
+ t.update(await V.readFile(I(e, "rpcGroup.generated.ts")));
1785
2177
  } catch {}
1786
2178
  return t.digest("hex");
1787
- }, ni = async (e) => {
2179
+ }, oa = async (e) => {
1788
2180
  if (e.length === 0) return;
1789
2181
  let t = [];
1790
- for (let n of [...e].sort()) t.push(await ti(n));
1791
- return ge("sha1").update(t.join("\0")).digest("hex");
1792
- }, ri = (e) => typeof e == "object" && !!e && e._tag === "VoltroMiddleware" && typeof e.run == "function", ii = ["middleware.ts", "middleware.tsx"], ai = (e) => {
2182
+ for (let n of [...e].sort()) t.push(await aa(n));
2183
+ return Oe("sha1").update(t.join("\0")).digest("hex");
2184
+ }, sa = (e) => typeof e == "object" && !!e && e._tag === "VoltroMiddleware" && typeof e.run == "function", ca = ["middleware.ts", "middleware.tsx"], la = (e) => {
1793
2185
  let t = e.replace(/\/+$/, "");
1794
2186
  return t === "" ? "/" : t;
1795
- }, X = (e, t) => {
1796
- let n = ai(e);
2187
+ }, Z = (e, t) => {
2188
+ let n = la(e);
1797
2189
  if (n === "/") return !0;
1798
- let r = ai(t);
2190
+ let r = la(t);
1799
2191
  return r === n || r.startsWith(`${n}/`);
1800
- }, oi = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, si = (e, t) => {
2192
+ }, ua = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, da = (e, t) => {
1801
2193
  if (e === void 0) return !0;
1802
- let n = oi(e.under), r = e.routes ?? [];
1803
- return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) => X(e, t)) ? !(e.except ?? []).some((e) => e === t || X(e, t)) : !1;
1804
- }, ci = (e) => {
2194
+ let n = ua(e.under), r = e.routes ?? [];
2195
+ return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) => Z(e, t)) ? !(e.except ?? []).some((e) => e === t || Z(e, t)) : !1;
2196
+ }, fa = (e) => {
1805
2197
  if (e?.assets !== !0) return [];
1806
- let t = oi(e.under);
2198
+ let t = ua(e.under);
1807
2199
  return t.length > 0 ? t : (e.routes ?? []).length > 0 ? [] : ["/"];
1808
- }, li = (e, t) => ci(e).some((e) => X(e, t)) ? !(e?.except ?? []).some((e) => X(e, t)) : !1, ui = (e, t) => e.find(({ middleware: e }) => t.route === void 0 ? li(e.match, t.pathname) : si(e.match, t.route))?.middleware, di = (e, t) => {
2200
+ }, pa = (e, t) => fa(e).some((e) => Z(e, t)) ? !(e?.except ?? []).some((e) => Z(e, t)) : !1, ma = (e, t) => e.find(({ middleware: e }) => t.route === void 0 ? pa(e.match, t.pathname) : da(e.match, t.route))?.middleware, ha = (e, t) => {
1809
2201
  let n = [];
1810
2202
  for (let { exportName: r, middleware: i } of e) {
1811
2203
  let e = i.match;
@@ -1813,13 +2205,13 @@ import {
1813
2205
  kind: "dead-matcher",
1814
2206
  message: `\`${r}\` matches routes: ['${i}'], which is not a route in this app. Route patterns are spelled as the router spells them, e.g. \`/notes/[id]\`.`
1815
2207
  });
1816
- if (e?.assets !== !0) for (let [i, a] of [["under", oi(e?.under)], ["except", e?.except ?? []]]) for (let e of a) t.some((t) => X(e, t)) || n.push({
2208
+ if (e?.assets !== !0) for (let [i, a] of [["under", ua(e?.under)], ["except", e?.except ?? []]]) for (let e of a) t.some((t) => Z(e, t)) || n.push({
1817
2209
  kind: "dead-matcher",
1818
2210
  message: `\`${r}\` matches ${i}: ['${e}'], which covers no route in this app. ` + (i === "except" ? "An `except` that excludes nothing is a rule that reads as active and is not." : "Add `assets: true` if you meant a path the router does not serve.")
1819
2211
  });
1820
2212
  }
1821
2213
  for (let r = 0; r < e.length; r += 1) for (let i = r + 1; i < e.length; i += 1) {
1822
- let a = e[r], o = e[i], s = t.find((e) => si(a.middleware.match, e) && si(o.middleware.match, e));
2214
+ let a = e[r], o = e[i], s = t.find((e) => da(a.middleware.match, e) && da(o.middleware.match, e));
1823
2215
  if (s !== void 0) {
1824
2216
  n.push({
1825
2217
  kind: "overlap",
@@ -1828,7 +2220,7 @@ import {
1828
2220
  continue;
1829
2221
  }
1830
2222
  {
1831
- let e = ci(a.middleware.match), t = ci(o.middleware.match), r = e.some((e) => t.some((t) => X(e, t) || X(t, e))), i = (a.middleware.match?.except ?? []).some((e) => t.length > 0 && t.every((t) => X(e, t))) || (o.middleware.match?.except ?? []).some((t) => e.length > 0 && e.every((e) => X(t, e)));
2223
+ let e = fa(a.middleware.match), t = fa(o.middleware.match), r = e.some((e) => t.some((t) => Z(e, t) || Z(t, e))), i = (a.middleware.match?.except ?? []).some((e) => t.length > 0 && t.every((t) => Z(e, t))) || (o.middleware.match?.except ?? []).some((t) => e.length > 0 && e.every((e) => Z(t, e)));
1832
2224
  r && !i && n.push({
1833
2225
  kind: "overlap",
1834
2226
  message: `\`${a.exportName}\` and \`${o.exportName}\` both declare \`assets: true\` over overlapping paths. A non-page request would match both, and there is no route to tell them apart.`
@@ -1836,10 +2228,10 @@ import {
1836
2228
  }
1837
2229
  }
1838
2230
  return n;
1839
- }, fi = (e, t) => {
1840
- let r = di(e, t);
2231
+ }, ga = (e, t) => {
2232
+ let r = ha(e, t);
1841
2233
  if (r.length !== 0) throw n(`middleware.ts: ${r.length} problem(s)\n\n` + r.map((e) => ` • ${e.message}`).join("\n\n"));
1842
- }, pi = (e) => {
2234
+ }, _a = (e) => {
1843
2235
  let t = {};
1844
2236
  if (!e) return t;
1845
2237
  for (let n of e.split(";")) {
@@ -1853,20 +2245,20 @@ import {
1853
2245
  }
1854
2246
  }
1855
2247
  return t;
1856
- }, mi = (e) => Object.entries(e).map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join("; "), hi = /(^|[-_.])(auth[-_.]?token|session|access[-_.]?token)([-_.]|$)|^sb-.*-auth-token$/i, gi = (e) => e.httpOnly === void 0 && hi.test(e.name), _i = (e) => {
2248
+ }, va = (e) => Object.entries(e).map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join("; "), ya = /(^|[-_.])(auth[-_.]?token|session|access[-_.]?token)([-_.]|$)|^sb-.*-auth-token$/i, ba = (e) => e.httpOnly === void 0 && ya.test(e.name), xa = (e) => {
1857
2249
  let t = [`${e.name}=${encodeURIComponent(e.value)}`];
1858
2250
  return t.push(`Path=${e.path ?? "/"}`), e.maxAge !== void 0 && t.push(`Max-Age=${Math.trunc(e.maxAge)}`), e.httpOnly !== !1 && t.push("HttpOnly"), e.secure === !0 && t.push("Secure"), t.push(`SameSite=${e.sameSite ?? "lax"}`), t.join("; ");
1859
- }, vi = (e) => e.length === 0 ? {} : { "set-cookie": e.map(_i) }, yi = async (e, t = (e) => import(I(e).href)) => {
1860
- for (let r of ii) {
2251
+ }, Sa = (e) => e.length === 0 ? {} : { "set-cookie": e.map(xa) }, Ca = async (e, t = (e) => import(G(e).href)) => {
2252
+ for (let r of ca) {
1861
2253
  let i;
1862
2254
  try {
1863
- i = await t(O(e, r));
2255
+ i = await t(I(e, r));
1864
2256
  } catch (e) {
1865
2257
  let t = e?.code;
1866
2258
  if (t === "ERR_MODULE_NOT_FOUND" || t === "MODULE_NOT_FOUND") continue;
1867
2259
  throw e;
1868
2260
  }
1869
- let a = Object.entries(i ?? {}), o = a.filter((e) => ri(e[1])).map(([e, t]) => ({
2261
+ let a = Object.entries(i ?? {}), o = a.filter((e) => sa(e[1])).map(([e, t]) => ({
1870
2262
  exportName: e,
1871
2263
  middleware: t
1872
2264
  }));
@@ -1884,7 +2276,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
1884
2276
  return o;
1885
2277
  }
1886
2278
  return [];
1887
- }, bi = async (e, t, n) => {
2279
+ }, wa = async (e, t, n) => {
1888
2280
  let r = {
1889
2281
  headers: t.headers,
1890
2282
  cookies: t.cookies,
@@ -1895,7 +2287,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
1895
2287
  let i = await e.run(t);
1896
2288
  if (!i) return r;
1897
2289
  let a = i.setCookies ?? [];
1898
- if (n !== void 0) for (let e of a) gi(e) && n(e);
2290
+ if (n !== void 0) for (let e of a) ba(e) && n(e);
1899
2291
  let o = i.headers ? {
1900
2292
  ...t.headers,
1901
2293
  ...i.headers
@@ -1909,25 +2301,25 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
1909
2301
  };
1910
2302
  let l = { ...t.cookies };
1911
2303
  for (let e of a) e.maxAge !== void 0 && e.maxAge <= 0 ? delete l[e.name] : l[e.name] = e.value;
1912
- return i.headers?.cookie === void 0 && (o.cookie = mi(l)), {
2304
+ return i.headers?.cookie === void 0 && (o.cookie = va(l)), {
1913
2305
  headers: o,
1914
2306
  cookies: l,
1915
2307
  setCookies: a,
1916
2308
  responseHeaders: s,
1917
2309
  ...c
1918
2310
  };
1919
- }, xi = /* @__PURE__ */ new Set(["voltro:locale"]), Si = /* @__PURE__ */ new Set(["authorization", "cookie"]), Ci = (e) => {
2311
+ }, Ta = /* @__PURE__ */ new Set(["voltro:locale"]), Ea = /* @__PURE__ */ new Set(["authorization", "cookie"]), Da = (e) => {
1920
2312
  let t = e.split(";").map((e) => e.trim()).filter((e) => {
1921
2313
  let t = e.indexOf("="), n = (t === -1 ? e : e.slice(0, t)).trim();
1922
- return xi.has(n);
2314
+ return Ta.has(n);
1923
2315
  });
1924
2316
  return t.length > 0 ? t.join("; ") : void 0;
1925
- }, wi = (e) => {
2317
+ }, Oa = (e) => {
1926
2318
  let t = {};
1927
2319
  for (let [n, r] of Object.entries(e)) if (!n.startsWith("x-voltro-")) {
1928
- if (Si.has(n)) {
2320
+ if (Ea.has(n)) {
1929
2321
  if (n === "cookie") {
1930
- let e = Ci(r);
2322
+ let e = Da(r);
1931
2323
  e !== void 0 && (t.cookie = e);
1932
2324
  }
1933
2325
  continue;
@@ -1935,27 +2327,78 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
1935
2327
  t[n] = r;
1936
2328
  }
1937
2329
  return t;
1938
- }, Ti = (e) => {
2330
+ }, ka = (e) => {
1939
2331
  let t = {};
1940
- for (let [n, r] of Object.entries(e)) xi.has(n) && (t[n] = r);
2332
+ for (let [n, r] of Object.entries(e)) Ta.has(n) && (t[n] = r);
1941
2333
  return t;
1942
- }, Z = R({ scope: "voltro:dev:web" }), Ei = R({ scope: "vite" }), Di = await (async () => {
2334
+ }, Aa = ["cookie", "authorization"], ja = (e) => Aa.includes(e) || e.startsWith("x-voltro-"), Ma = ["voltro:locale"], Na = class extends Error {
2335
+ constructor(e, t, n) {
2336
+ super(`[voltro] ppr page '${n}': the SHELL render read the ${e} '${t}'. A ppr shell is CACHED and served to every visitor, so it must be computed without credentials — there is no way to prove request-independence by inspection, so the read itself is the error. Move this read into a deferred hole (the second argument of defer(), which runs per request with the full context), or drop ppr and use renderMode 'ssr'.`), this.name = "PprShellCredentialAccessError";
2337
+ }
2338
+ }, Pa = (e, t) => new Proxy({ ...e }, { get(e, n, r) {
2339
+ if (typeof n == "string" && ja(n)) throw new Na("header", n, t);
2340
+ return Reflect.get(e, n, r);
2341
+ } }), Fa = (e, t) => new Proxy({ ...e }, { get(e, n, r) {
2342
+ if (typeof n == "string" && !Ma.includes(n) && !(n in Object.prototype)) throw new Na("cookie", n, t);
2343
+ return Reflect.get(e, n, r);
2344
+ } }), Ia = Symbol.for("@voltro/cli/ppr:metrics"), La = () => {
2345
+ let e = globalThis;
2346
+ return e[Ia] ??= {
2347
+ shellServes: 0,
2348
+ holePasses: 0,
2349
+ holeSettles: 0,
2350
+ holeErrors: 0,
2351
+ holeLatencyMsLast: 0,
2352
+ holeLatencyMsMax: 0
2353
+ };
2354
+ }, Ra = async (e) => {
2355
+ let t = La();
2356
+ t.holePasses += 1;
2357
+ let n = Date.now(), r = () => e.res.destroyed === !0 || e.res.writableEnded === !0;
2358
+ try {
2359
+ let n = await e.loader(e.ctx), i = e.helpers.prepareDeferredLoaderData(n, "page"), a = i.deferredIds;
2360
+ if (a === void 0) {
2361
+ r() || e.res.end();
2362
+ return;
2363
+ }
2364
+ let o = i.renderData;
2365
+ await Promise.all(Object.entries(a).map(async ([n, i]) => {
2366
+ let a = await o[n];
2367
+ t.holeSettles += 1, !r() && e.res.write(`<script>${e.helpers.deferredSettleScript(i, a)}<\/script>`);
2368
+ }));
2369
+ } catch (n) {
2370
+ t.holeErrors += 1, e.log.warn("ppr hole pass failed — holes stay on their fallbacks", { page: e.page }, n);
2371
+ } finally {
2372
+ let i = Date.now() - n;
2373
+ t.holeLatencyMsLast = i, i > t.holeLatencyMsMax && (t.holeLatencyMsMax = i), r() || e.res.end();
2374
+ }
2375
+ }, za = (e, t) => {
2376
+ if (e.deferredSegmentIds !== void 0) throw Error(`[voltro] ppr page '${t}': a LAYOUT loader in its chain uses defer(). ppr appends holes for the PAGE loader only — move the deferred field into the page loader, or return the value directly from the layout.`);
2377
+ }, Q = K({ scope: "voltro:dev:web" }), Ba = K({ scope: "vite" }), Va = await (async () => {
1943
2378
  try {
1944
- let e = O(D(re(import.meta.url)), "..", "package.json"), t = await N.readFile(e, "utf8");
2379
+ let e = I(F(W(import.meta.url)), "..", "package.json"), t = await V.readFile(e, "utf8");
1945
2380
  return JSON.parse(t).version ?? "0.0.0";
1946
2381
  } catch {
1947
2382
  return "0.0.0";
1948
2383
  }
1949
- })(), Oi = async () => {
2384
+ })(), Ha = (e, t) => {
2385
+ let n;
2386
+ for (let r of e) {
2387
+ if (!r.hasNotFound) continue;
2388
+ let e = "/" + r.dir.split("/").filter((e) => e !== "" && !/^\(.*\)$/.test(e)).join("/"), i = e === "/" ? "/" : e;
2389
+ i !== "/" && !(t === i || t.startsWith(i + "/")) || (n === void 0 || r.dir.length > n.dir.length) && (n = r);
2390
+ }
2391
+ return n;
2392
+ }, Ua = async () => {
1950
2393
  try {
1951
- let e = D(re(import.meta.url)), t = A(e, "..", "..", "devtools");
1952
- if (M(O(t, "package.json"))) return t;
1953
- let n = A(e, "..", "..", "..", "devtools");
1954
- return M(O(n, "package.json")) ? n : null;
2394
+ let e = F(W(import.meta.url)), t = R(e, "..", "..", "devtools");
2395
+ if (B(I(t, "package.json"))) return t;
2396
+ let n = R(e, "..", "..", "..", "devtools");
2397
+ return B(I(n, "package.json")) ? n : null;
1955
2398
  } catch {
1956
2399
  return null;
1957
2400
  }
1958
- }, ki = (e, t) => e.disableDevtools || !t ? [] : [
2401
+ }, Wa = (e, t) => e.disableDevtools || !t ? [] : [
1959
2402
  "",
1960
2403
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
1961
2404
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -1965,85 +2408,85 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
1965
2408
  " await import('@voltro/devtools/styles.css')",
1966
2409
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
1967
2410
  "}"
1968
- ], Ai = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ji = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Mi = (e) => e.sentry ? [
2411
+ ], Ga = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Ka = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], qa = (e) => e.sentry ? [
1969
2412
  "",
1970
2413
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
1971
2414
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
1972
2415
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
1973
- ] : [], Ni = (e) => e.env ? ["import './env.public'"] : [], Pi = (e) => {
1974
- let t = [], n = A(e);
2416
+ ] : [], Ja = (e) => e.env ? ["import './env.public'"] : [], Ya = (e) => {
2417
+ let t = [], n = R(e);
1975
2418
  for (;;) {
1976
- M(O(n, "pnpm-workspace.yaml")) && t.push(n);
1977
- let e = D(n);
2419
+ B(I(n, "pnpm-workspace.yaml")) && t.push(n);
2420
+ let e = F(n);
1978
2421
  if (e === n) break;
1979
2422
  n = e;
1980
2423
  }
1981
2424
  return t;
1982
- }, Fi = b, Ii = (e) => {
2425
+ }, Xa = P, Za = (e) => {
1983
2426
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
1984
- }, Li = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Ri = (e) => e.startsWith("(") && e.endsWith(")"), zi = (e) => e.filter((e) => !Ri(e)), Bi = (e) => {
1985
- let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Ri(e));
2427
+ }, Qa = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, $a = (e) => e.startsWith("(") && e.endsWith(")"), eo = (e) => e.filter((e) => !$a(e)), to = (e) => {
2428
+ let t = e.replace(o, "").split("/").filter(Boolean).filter((e) => !$a(e));
1986
2429
  return t.length === 0 ? "/" : "/" + t.join("/");
1987
- }, Vi = (e) => `${e.replace(c, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
2430
+ }, no = (e) => `${e.replace(o, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, $ = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, ro = async (e) => {
1988
2431
  let t = [], n = [], r = async (e, i) => {
1989
- let a = [];
2432
+ let s = [];
1990
2433
  try {
1991
- a = await N.readdir(e, { withFileTypes: !0 });
2434
+ s = await V.readdir(e, { withFileTypes: !0 });
1992
2435
  } catch {
1993
2436
  return;
1994
2437
  }
1995
- let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Fi(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
1996
- if (l.some((e) => s.has(e))) {
2438
+ let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Xa(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
2439
+ if (l.some((e) => a.has(e))) {
1997
2440
  let t = u.has("layout.tsx"), r = !1;
1998
2441
  if (t) try {
1999
- let t = await N.readFile(O(e, "layout.tsx"), "utf8");
2000
- r = Li.test(t);
2442
+ let t = await V.readFile(I(e, "layout.tsx"), "utf8");
2443
+ r = Qa.test(t);
2001
2444
  } catch {}
2002
2445
  n.push({
2003
2446
  dir: d,
2004
2447
  chain: i,
2005
- contributesToUrl: i.length === 0 || !Ri(i[i.length - 1]),
2448
+ contributesToUrl: i.length === 0 || !$a(i[i.length - 1]),
2006
2449
  hasLayout: t,
2007
2450
  hasLayoutLoader: r,
2008
2451
  hasError: u.has("error.tsx"),
2009
2452
  hasPending: u.has("loading.tsx"),
2010
2453
  hasNotFound: u.has("not-found.tsx"),
2011
- specialFiles: l.filter((e) => s.has(e))
2454
+ specialFiles: l.filter((e) => a.has(e))
2012
2455
  });
2013
2456
  }
2014
2457
  for (let e of l) {
2015
- if (!c.test(e)) continue;
2458
+ if (!o.test(e)) continue;
2016
2459
  let n = d ? `${d}/${e}` : e;
2017
2460
  t.push({
2018
2461
  file: n,
2019
- pattern: Bi(n),
2020
- ident: Vi(n),
2462
+ pattern: to(n),
2463
+ ident: no(n),
2021
2464
  dirChain: i
2022
2465
  });
2023
2466
  }
2024
- for (let t of o) await r(O(e, t), [...i, t]);
2467
+ for (let t of c) await r(I(e, t), [...i, t]);
2025
2468
  };
2026
2469
  await r(e, []), t.sort((e, t) => e.file < t.file ? -1 : 1);
2027
2470
  let i = /* @__PURE__ */ new Set();
2028
2471
  for (let e of t) for (let t = e.dirChain.length; t >= 0; t--) i.add(e.dirChain.slice(0, t).join("/"));
2029
- let a = [], o = [];
2030
- for (let { specialFiles: e, ...t } of n) i.has(t.dir) ? a.push(t) : o.push({
2472
+ let s = [], c = [];
2473
+ for (let { specialFiles: e, ...t } of n) i.has(t.dir) ? s.push(t) : c.push({
2031
2474
  dir: t.dir,
2032
2475
  files: e
2033
2476
  });
2034
2477
  return {
2035
2478
  pages: t,
2036
- dirs: a,
2037
- orphanedSpecials: o
2479
+ dirs: s,
2480
+ orphanedSpecials: c
2038
2481
  };
2039
- }, Hi = (e, t) => {
2482
+ }, io = (e, t) => {
2040
2483
  let n = [];
2041
2484
  for (let r = 0; r <= t.length; r++) {
2042
2485
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
2043
2486
  a && n.push(a);
2044
2487
  }
2045
2488
  return n;
2046
- }, Ui = async (e) => {
2489
+ }, ao = async (e) => {
2047
2490
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
2048
2491
  return {
2049
2492
  chain: await Promise.all(t.map(async (e, t) => {
@@ -2067,10 +2510,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2067
2510
  })),
2068
2511
  segmentLoaderData: o
2069
2512
  };
2070
- }, Wi = (e) => {
2071
- let t = zi(e);
2513
+ }, oo = (e) => {
2514
+ let t = eo(e);
2072
2515
  return t.length === 0 ? "" : "/" + t.join("/");
2073
- }, Gi = [
2516
+ }, so = [
2074
2517
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
2075
2518
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
2076
2519
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -2163,7 +2606,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2163
2606
  " _vdtErrorStart('Build error')",
2164
2607
  " })",
2165
2608
  "}"
2166
- ].join("\n"), Ki = (e) => {
2609
+ ].join("\n"), co = (e) => {
2167
2610
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
2168
2611
  for (let e of r) e.startsWith("[[...") && e.endsWith("]]") ? (i.push("(.*)"), t.push(e.slice(5, -2)), n += 2) : e.startsWith("[...") && e.endsWith("]") ? (i.push("(.+)"), t.push(e.slice(4, -1)), n += 3) : e.startsWith("[") && e.endsWith("]") ? (i.push("([^/]+)"), t.push(e.slice(1, -1)), n += 1) : i.push(e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
2169
2612
  let a = i.join("/");
@@ -2172,8 +2615,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2172
2615
  paramNames: t,
2173
2616
  priority: n
2174
2617
  };
2175
- }, qi = (e) => e.map((e) => {
2176
- let { regex: t, paramNames: n, priority: r } = Ki(e.pattern);
2618
+ }, lo = (e) => e.map((e) => {
2619
+ let { regex: t, paramNames: n, priority: r } = co(e.pattern);
2177
2620
  return {
2178
2621
  pattern: e.pattern,
2179
2622
  file: e.file,
@@ -2182,7 +2625,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2182
2625
  paramNames: n,
2183
2626
  priority: r
2184
2627
  };
2185
- }).slice().sort((e, t) => e.priority - t.priority), Ji = (e, t) => {
2628
+ }).slice().sort((e, t) => e.priority - t.priority), uo = (e, t) => {
2186
2629
  for (let n of t) {
2187
2630
  let t = n.regex.exec(e);
2188
2631
  if (!t) continue;
@@ -2194,9 +2637,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2194
2637
  };
2195
2638
  }
2196
2639
  return null;
2197
- }, Yi = Le, Xi = async (e) => {
2640
+ }, fo = st, po = async (e) => {
2198
2641
  try {
2199
- let t = await import(I(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
2642
+ let t = await import(G(I(e, "app.config.ts")).href), n = t.default?.port, i = r({
2200
2643
  kind: "api",
2201
2644
  configPort: typeof n == "number" ? n : void 0,
2202
2645
  env: {}
@@ -2210,7 +2653,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2210
2653
  kind: "api",
2211
2654
  env: {}
2212
2655
  }).port };
2213
- }, Zi = (e, t) => ({
2656
+ }, mo = (e, t) => ({
2214
2657
  name: e,
2215
2658
  pkg: t.package,
2216
2659
  browserWsUrl: t.url,
@@ -2218,7 +2661,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2218
2661
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
2219
2662
  ...t.headers ? { headers: t.headers } : {},
2220
2663
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
2221
- }), Qi = (e, t, n) => {
2664
+ }), ho = (e, t, n) => {
2222
2665
  let r = t.transport?.wsPath ?? n.wsPath;
2223
2666
  return {
2224
2667
  name: e,
@@ -2230,7 +2673,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2230
2673
  ...t.headers ? { headers: t.headers } : {},
2231
2674
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
2232
2675
  };
2233
- }, $i = (e) => {
2676
+ }, go = (e) => {
2234
2677
  let t = /* @__PURE__ */ new Map();
2235
2678
  for (let n of e) {
2236
2679
  if (n.proxyTarget === void 0) continue;
@@ -2238,43 +2681,43 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2238
2681
  if (e) throw Error(`[voltro] api ${JSON.stringify(n.name)} and ${JSON.stringify(e)} both resolve the same-origin WS path ${JSON.stringify(n.browserWsUrl)}. A custom transport.wsPath must be unique per origin (one api per origin may use a fixed path). Give each a distinct wsPath, or drop the override to use the default /ws/<name>.`);
2239
2682
  t.set(n.browserWsUrl, n.name);
2240
2683
  }
2241
- }, ea = async (e, t) => {
2684
+ }, _o = async (e, t) => {
2242
2685
  let n = Object.entries(t.apis ?? {}), r = [];
2243
2686
  for (let [t, i] of n) {
2244
2687
  if (i.url) {
2245
- r.push(Zi(t, i));
2688
+ r.push(mo(t, i));
2246
2689
  continue;
2247
2690
  }
2248
- let n = await Yi(e, i.package);
2691
+ let n = await fo(e, i.package);
2249
2692
  if (!n) throw Error(`[voltro dev] api ${JSON.stringify(t)} (package ${JSON.stringify(i.package)}) is not a workspace dep and has no \`url\` set in app.config.ts. External apis need an explicit \`url\` because the framework can't discover their dev port.`);
2250
- r.push(Qi(t, i, await Xi(n)));
2693
+ r.push(ho(t, i, await po(n)));
2251
2694
  }
2252
- return $i(r), r;
2253
- }, ta = (e) => {
2695
+ return go(r), r;
2696
+ }, vo = (e) => {
2254
2697
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
2255
2698
  let t = new URL(e);
2256
2699
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
2257
2700
  } catch {
2258
2701
  return;
2259
2702
  }
2260
- }, na = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ra = (e) => process.env[na(e)] ?? process.env.VOLTRO_API_ORIGIN, ia = (e, t) => {
2703
+ }, yo = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, bo = (e) => process.env[yo(e)] ?? process.env.VOLTRO_API_ORIGIN, xo = (e, t) => {
2261
2704
  if (!e) return;
2262
- let n = ra(e.name) ?? e.serverOrigin;
2705
+ let n = bo(e.name) ?? e.serverOrigin;
2263
2706
  if (n) {
2264
- let e = ta(n);
2707
+ let e = vo(n);
2265
2708
  if (e) return e;
2266
2709
  }
2267
2710
  if (t?.allowDevProxy && e.proxyTarget) {
2268
- let t = ta(e.proxyTarget);
2711
+ let t = vo(e.proxyTarget);
2269
2712
  if (t) return t;
2270
2713
  }
2271
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ta(e.browserWsUrl);
2272
- }, aa = (e, t, n) => {
2714
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return vo(e.browserWsUrl);
2715
+ }, So = (e, t, n) => {
2273
2716
  if (!e) {
2274
2717
  if (n?.apiName === void 0) return;
2275
2718
  let e = n.apiName;
2276
2719
  return async () => {
2277
- throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${na(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
2720
+ throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${yo(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
2278
2721
  };
2279
2722
  }
2280
2723
  return async (r, i) => {
@@ -2297,7 +2740,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2297
2740
  });
2298
2741
  } catch (t) {
2299
2742
  let i = t?.cause?.code ?? String(t?.message ?? t);
2300
- throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${na(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
2743
+ throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${yo(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
2301
2744
  }
2302
2745
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
2303
2746
  let s = await o.json();
@@ -2327,7 +2770,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2327
2770
  }
2328
2771
  if (u) return l;
2329
2772
  };
2330
- }, oa = (e, t) => {
2773
+ }, Co = (e, t) => {
2331
2774
  let n = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, r = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, i = e.map((e) => `import { appGroup as ${n(e.name)}, appDescriptors as ${r(e.name)} } from '${e.pkg}/rpcGroup'`);
2332
2775
  e.some((e) => e.hasAuthHeaders) && (i.push(`import __voltroAppConfig from '${t}'`), i.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
2333
2776
  let a = (e) => {
@@ -2339,8 +2782,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2339
2782
  entryLines: e.map((e) => ` ${JSON.stringify(e.name)}: { ${a(e).join(", ")} },`),
2340
2783
  providerEntryLines: e.map((e) => ` { name: ${JSON.stringify(e.name)}, ${a(e).join(", ")} },`)
2341
2784
  };
2342
- }, sa = async (e, t, n, r = {}) => {
2343
- let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = M(O(e, "node_modules", "@voltro", "devtools", "package.json")) || await Oi() !== null, s = t.theme === "system" ? [
2785
+ }, wo = async (e, t, n, r = {}) => {
2786
+ let i = t.title ?? t.name ?? "app";
2787
+ An(e);
2788
+ let a = await En(e, t.fonts), o = a === null ? [] : [...a.preloads.map((e) => ` <link rel="preload" as="font" type="font/${e.endsWith(".woff2") ? "woff2" : e.endsWith(".woff") ? "woff" : e.endsWith(".otf") ? "otf" : "ttf"}" href="${e}" crossorigin />`), ` <style data-voltro-fonts>${a.css}</style>`], s = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", c = B(I(e, "node_modules", "@voltro", "devtools", "package.json")) || await Ua() !== null, l = t.theme === "system" ? [
2344
2789
  " <script>",
2345
2790
  " (function () {",
2346
2791
  " var root = document.documentElement",
@@ -2361,7 +2806,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2361
2806
  " }",
2362
2807
  " })()",
2363
2808
  " <\/script>"
2364
- ].join("\n") : "", c = t.timeZone === "viewer" ? [
2809
+ ].join("\n") : "", u = t.timeZone === "viewer" ? [
2365
2810
  " <script>",
2366
2811
  " (function () {",
2367
2812
  " try {",
@@ -2373,17 +2818,18 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2373
2818
  " } catch (e) {}",
2374
2819
  " })()",
2375
2820
  " <\/script>"
2376
- ].join("\n") : "", l = [
2821
+ ].join("\n") : "", d = [
2377
2822
  "<!doctype html>",
2378
2823
  "<!-- GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot. -->",
2379
- `<html lang="en"${a}>`,
2824
+ `<html lang="en"${s}>`,
2380
2825
  " <head>",
2381
2826
  " <meta charset=\"UTF-8\" />",
2382
2827
  " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />",
2383
2828
  ` <title>${i}</title>`,
2384
2829
  " <link rel=\"icon\" type=\"image/svg+xml\" href=\"/favicon.svg\" />",
2385
- ...s ? [s] : [],
2386
- ...c ? [c] : [],
2830
+ ...o,
2831
+ ...l ? [l] : [],
2832
+ ...u ? [u] : [],
2387
2833
  " </head>",
2388
2834
  " <body>",
2389
2835
  " <div id=\"root\"></div>",
@@ -2391,70 +2837,70 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2391
2837
  " </body>",
2392
2838
  "</html>",
2393
2839
  ""
2394
- ].join("\n"), u = O(e, "src", "pages"), { pages: d, dirs: f, orphanedSpecials: p } = await $(u);
2395
- await y(u, d);
2396
- for (let e of p) Z.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
2397
- let { imports: m, entryLines: h } = oa(n, "../app.config"), g, _, v;
2398
- if (d.length > 0) {
2399
- let n = d.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
2400
- for (let e of f) {
2840
+ ].join("\n"), f = I(e, "src", "pages"), { pages: p, dirs: m, orphanedSpecials: h } = await ro(f);
2841
+ await b(f, p);
2842
+ for (let e of h) Q.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
2843
+ let { imports: g, entryLines: _ } = Co(n, "../app.config"), v, y, x;
2844
+ if (p.length > 0) {
2845
+ let n = p.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
2846
+ for (let e of m) {
2401
2847
  let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
2402
- e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
2848
+ e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${$(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${$(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${$(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${$(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${$(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
2403
2849
  }
2404
- let i = d.map((e) => {
2405
- let t = Hi(f, e.dirChain).map((e) => {
2850
+ let i = p.map((e) => {
2851
+ let t = io(m, e.dirChain).map((e) => {
2406
2852
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2407
2853
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasLayoutLoader && t.push(`loader: refs.layoutLoaders[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), e.hasPending && t.push(`Pending: refs.pendings[${n}]`), ` { ${t.join(", ")} }`;
2408
2854
  }).join(",\n");
2409
2855
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
2410
- }), a = f.filter((e) => e.hasNotFound).map((e) => {
2411
- let t = Wi(e.chain), n = Hi(f, e.chain).map((e) => {
2856
+ }), a = m.filter((e) => e.hasNotFound).map((e) => {
2857
+ let t = oo(e.chain), n = io(m, e.chain).map((e) => {
2412
2858
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2413
2859
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
2414
2860
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
2415
2861
  return ` {\n prefix: ${JSON.stringify(t)},\n Component: refs.notFounds[${JSON.stringify(e.dir)}],${r}\n },`;
2416
- }), s = [], c = [], l = [], u = [], p = [], y = [];
2417
- for (let e of f) {
2862
+ }), o = [], s = [], l = [], u = [], d = [], f = [];
2863
+ for (let e of m) {
2418
2864
  let t = e.dir === "" ? "../src/pages/layout.tsx" : `../src/pages/${e.dir}/layout.tsx`, n = e.dir === "" ? "../src/pages/error.tsx" : `../src/pages/${e.dir}/error.tsx`, r = e.dir === "" ? "../src/pages/loading.tsx" : `../src/pages/${e.dir}/loading.tsx`, i = e.dir === "" ? "../src/pages/not-found.tsx" : `../src/pages/${e.dir}/not-found.tsx`, a = JSON.stringify(e.dir);
2419
- e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${Q(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${Q(e.dir, "Layout")}Mod.loader,`), s.push({
2865
+ e.hasLayout && e.hasLayoutLoader ? (s.push(` ${a}: ${$(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${$(e.dir, "Layout")}Mod.loader,`), o.push({
2420
2866
  relPath: t,
2421
2867
  kind: "layout",
2422
2868
  slotKey: e.dir
2423
- })) : e.hasLayout && (c.push(` ${a}: ${Q(e.dir, "Layout")},`), s.push({
2869
+ })) : e.hasLayout && (s.push(` ${a}: ${$(e.dir, "Layout")},`), o.push({
2424
2870
  relPath: t,
2425
2871
  kind: "layout",
2426
2872
  slotKey: e.dir
2427
- })), e.hasError && (u.push(` ${a}: ${Q(e.dir, "Error")},`), s.push({
2873
+ })), e.hasError && (u.push(` ${a}: ${$(e.dir, "Error")},`), o.push({
2428
2874
  relPath: n,
2429
2875
  kind: "error",
2430
2876
  slotKey: e.dir
2431
- })), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
2877
+ })), e.hasPending && (d.push(` ${a}: ${$(e.dir, "Pending")},`), o.push({
2432
2878
  relPath: r,
2433
2879
  kind: "pending",
2434
2880
  slotKey: e.dir
2435
- })), e.hasNotFound && (y.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
2881
+ })), e.hasNotFound && (f.push(` ${a}: ${$(e.dir, "NotFound")},`), o.push({
2436
2882
  relPath: i,
2437
2883
  kind: "notFound",
2438
2884
  slotKey: e.dir
2439
2885
  }));
2440
2886
  }
2441
- for (let e of d) s.push({
2887
+ for (let e of p) o.push({
2442
2888
  relPath: `../src/pages/${e.file}`,
2443
2889
  kind: "page",
2444
2890
  slotKey: e.pattern
2445
2891
  });
2446
- let b = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
2892
+ let h = o.map((e) => ` ${JSON.stringify(e.relPath)},`), b = o.map((e, t) => {
2447
2893
  let n = JSON.stringify(e.slotKey);
2448
2894
  return e.kind === "page" ? ` if (newMods[${t}] && refs.pages[${n}] !== undefined) { refs.pages[${n}] = newMods[${t}]; changed = true }` : ` if (newMods[${t}]?.default) { refs.${e.kind === "layout" ? "layouts" : e.kind === "error" ? "errors" : e.kind === "pending" ? "pendings" : "notFounds"}[${n}] = newMods[${t}].default;${e.kind === "layout" ? ` refs.layoutLoaders[${n}] = newMods[${t}].loader;` : ""} changed = true }`;
2449
- }), S = t.locales ?? [], C = S.length > 0 && S.every((t) => M(O(e, "src", "locales", `${t}.ts`)) || M(O(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en", E = t.router?.viewTransitions === !0 ? " viewTransitions" : "";
2450
- if (S.length > 0 && !C && Z.info(`i18n: locales [${S.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), S.length > 0 && !S.includes(T)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${T}' must be one of locales [${S.join(", ")}]`);
2895
+ }), S = t.locales ?? [], C = S.length > 0 && S.every((t) => B(I(e, "src", "locales", `${t}.ts`)) || B(I(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en", E = t.router?.viewTransitions === !0 ? " viewTransitions" : "";
2896
+ if (S.length > 0 && !C && Q.info(`i18n: locales [${S.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), S.length > 0 && !S.includes(T)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${T}' must be one of locales [${S.join(", ")}]`);
2451
2897
  let D = w ? [
2452
2898
  "import { I18nProvider } from '@voltro/i18n'",
2453
2899
  "import { resolveLocale } from '@voltro/i18n/server'",
2454
2900
  "import { useServerRequest } from '@voltro/web'",
2455
2901
  ...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
2456
2902
  ] : [];
2457
- _ = [
2903
+ y = [
2458
2904
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2459
2905
  "// Routes + per-page chain + not-found scopes assembled from src/pages/.",
2460
2906
  "//",
@@ -2488,7 +2934,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2488
2934
  " pages: Record<string, unknown>",
2489
2935
  "} = {",
2490
2936
  " layouts: {",
2491
- ...c,
2937
+ ...s,
2492
2938
  " },",
2493
2939
  " layoutLoaders: {",
2494
2940
  ...l,
@@ -2497,10 +2943,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2497
2943
  ...u,
2498
2944
  " },",
2499
2945
  " pendings: {",
2500
- ...p,
2946
+ ...d,
2501
2947
  " },",
2502
2948
  " notFounds: {",
2503
- ...y,
2949
+ ...f,
2504
2950
  " },",
2505
2951
  " pages: {},",
2506
2952
  "}",
@@ -2565,17 +3011,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2565
3011
  "if (import.meta.hot) {",
2566
3012
  " import.meta.hot.accept(",
2567
3013
  " [",
2568
- ...b,
3014
+ ...h,
2569
3015
  " ],",
2570
3016
  " (newMods: Array<Record<string, unknown> | undefined>) => {",
2571
3017
  " let changed = false",
2572
- ...x,
3018
+ ...b,
2573
3019
  " if (changed) bump()",
2574
3020
  " },",
2575
3021
  " )",
2576
3022
  "}",
2577
3023
  ""
2578
- ].join("\n"), g = [
3024
+ ].join("\n"), v = [
2579
3025
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2580
3026
  "// The app's root component. It exports `App` and NOTHING ELSE: react-refresh",
2581
3027
  "// only accepts a module whose every export is a component, and a module it",
@@ -2690,20 +3136,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2690
3136
  ] : [` return <Router routes={routes} notFounds={notFounds}${E} />`],
2691
3137
  "}",
2692
3138
  ""
2693
- ].join("\n"), v = [
3139
+ ].join("\n"), x = [
2694
3140
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2695
3141
  "// Entry: imports the generated App component and calls mount() with the",
2696
3142
  "// resolved apis map. Side-effect only — no local component definitions —",
2697
3143
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2698
3144
  "",
2699
- ...Ni(t),
3145
+ ...Ja(t),
2700
3146
  "import { mount } from '@voltro/web'",
2701
- ...m,
3147
+ ...g,
2702
3148
  "import { App } from './app'",
2703
3149
  "import { preloadCurrentRoute } from './routeTable'",
2704
- ...ji(t),
2705
- ...ki(t, o),
2706
- ...Mi(t),
3150
+ ...Ka(t),
3151
+ ...Wa(t, c),
3152
+ ...qa(t),
2707
3153
  "",
2708
3154
  "// Preload the current route's page chunk BEFORE hydration so the first",
2709
3155
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2718,83 +3164,93 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2718
3164
  "",
2719
3165
  "mount(App, {",
2720
3166
  " apis: {",
2721
- ...h,
3167
+ ..._,
2722
3168
  " },",
2723
- ...Ai(t, o),
3169
+ ...Ga(t, c),
2724
3170
  "})",
2725
3171
  "",
2726
- Gi
3172
+ so
2727
3173
  ].join("\n");
2728
- } else g = "", _ = "", v = [
3174
+ } else v = "", y = "", x = [
2729
3175
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2730
3176
  "// The user's root component lives at ../src/App.tsx; this file imports it",
2731
3177
  "// and calls mount(). Side-effect only, no component definitions, so the",
2732
3178
  "// user's component file remains the Fast Refresh boundary.",
2733
3179
  "",
2734
- ...Ni(t),
3180
+ ...Ja(t),
2735
3181
  "import { mount } from '@voltro/web'",
2736
- ...m,
3182
+ ...g,
2737
3183
  "import App from '../src/App'",
2738
- ...ji(t),
2739
- ...ki(t, o),
2740
- ...Mi(t),
3184
+ ...Ka(t),
3185
+ ...Wa(t, c),
3186
+ ...qa(t),
2741
3187
  "",
2742
3188
  "mount(App, {",
2743
3189
  " apis: {",
2744
- ...h,
3190
+ ..._,
2745
3191
  " },",
2746
- ...Ai(t, o),
3192
+ ...Ga(t, c),
2747
3193
  "})",
2748
3194
  "",
2749
- Gi
3195
+ so
2750
3196
  ].join("\n");
2751
- let b = O(e, ".framework");
2752
- await N.mkdir(b, { recursive: !0 }), t.env ? await Ne(b, r) : await N.rm(O(b, "env.public.ts"), { force: !0 }), await N.writeFile(O(b, "index.html"), l, "utf8"), await N.writeFile(O(b, "main.tsx"), v, "utf8"), g ? (await N.writeFile(O(b, "app.tsx"), g, "utf8"), await N.writeFile(O(b, "routeTable.ts"), _, "utf8")) : (await N.rm(O(b, "app.tsx"), { force: !0 }), await N.rm(O(b, "routeTable.ts"), { force: !0 }));
2753
- let x = O(e, ".gitignore"), S = "";
3197
+ let S = I(e, ".framework");
3198
+ await V.mkdir(S, { recursive: !0 }), t.env ? await nt(S, r) : await V.rm(I(S, "env.public.ts"), { force: !0 }), await V.writeFile(I(S, "index.html"), d, "utf8"), await V.writeFile(I(S, "main.tsx"), x, "utf8"), v ? (await V.writeFile(I(S, "app.tsx"), v, "utf8"), await V.writeFile(I(S, "routeTable.ts"), y, "utf8")) : (await V.rm(I(S, "app.tsx"), { force: !0 }), await V.rm(I(S, "routeTable.ts"), { force: !0 }));
3199
+ let C = I(e, ".gitignore"), w = "";
2754
3200
  try {
2755
- S = await N.readFile(x, "utf8");
3201
+ w = await V.readFile(C, "utf8");
2756
3202
  } catch {}
2757
- let C = ["/.framework/"], w = new Set(S.split("\n").map((e) => e.trim())), T = C.filter((e) => !w.has(e));
2758
- if (T.length > 0) {
2759
- let e = S === "" || S.endsWith("\n") ? "" : "\n";
3203
+ let T = ["/.framework/"], E = new Set(w.split("\n").map((e) => e.trim())), D = T.filter((e) => !E.has(e));
3204
+ if (D.length > 0) {
3205
+ let e = w === "" || w.endsWith("\n") ? "" : "\n";
2760
3206
  try {
2761
- await N.appendFile(x, `${e}${T.join("\n")}\n`, "utf8");
3207
+ await V.appendFile(C, `${e}${D.join("\n")}\n`, "utf8");
2762
3208
  } catch (e) {
2763
- Z.warn(`could not add ${T.join(", ")} to ${x} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
3209
+ Q.warn(`could not add ${D.join(", ")} to ${C} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
2764
3210
  }
2765
3211
  }
2766
- }, ca = async (e, t) => {
3212
+ }, To = async (e, t) => {
2767
3213
  try {
2768
- let n = D(e), r = O(n, "project.json");
2769
- if (!M(r)) return;
2770
- let i = await N.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
3214
+ let n = F(e), r = I(n, "project.json");
3215
+ if (!B(r)) return;
3216
+ let i = await V.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
2771
3217
  for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
2772
3218
  if (s.length === 0) return;
2773
- Z.warn("sibling app(s) claim the same port — only one boots", {
3219
+ Q.warn("sibling app(s) claim the same port — only one boots", {
2774
3220
  port: t,
2775
3221
  conflicts: s,
2776
3222
  projectJson: r
2777
3223
  });
2778
3224
  } catch {}
2779
- }, la = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), ua = async (e, t = {}) => {
2780
- let n = la(e), r = t.preferSource !== !0 && M(n) ? n : O(e, "app.config.ts");
3225
+ }, Eo = (e) => I(e, ".framework", "dist", "server", "appConfig.js"), Do = async (e, t = {}) => {
3226
+ let n = Eo(e), r = t.preferSource !== !0 && B(n) ? n : I(e, "app.config.ts");
2781
3227
  try {
2782
- let e = (await import(I(r).href)).default;
3228
+ let e = (await import(G(r).href)).default;
2783
3229
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2784
3230
  } catch {
2785
3231
  return null;
2786
3232
  }
2787
- }, da = async (e) => {
2788
- let n = await ua(e, { preferSource: !0 });
3233
+ }, Oo = (e) => {
3234
+ let t = e.restRoutes;
3235
+ if (t !== void 0 && t.length !== 0) return `app.config.ts declares ${t.length} restRoute(s) on a type:'web' app — REST routes mount on the API process and were silently ignored here, so a health probe hitting one gets the SPA shell (200) and a POST gets 404.\n Move them to the API app's app.config.ts (they mount under the api origin), and call them there;\n for same-origin paths in front of the web app, terminate them at your ingress/proxy instead.`;
3236
+ }, ko = async (e) => {
3237
+ let n = await Do(e, { preferSource: !0 });
2789
3238
  if (!n) return {
2790
3239
  ran: !1,
2791
3240
  exitCode: 0
2792
3241
  };
2793
- ir();
2794
- let i = vn();
2795
- In(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), nt(e, Z);
2796
- let a = await ea(e, n);
2797
- for (let e of a) Z.info("api wired", {
3242
+ {
3243
+ let e = Oo(n);
3244
+ if (e !== void 0) return Q.error(`voltro dev (web): refusing to boot ${e}`), {
3245
+ ran: !0,
3246
+ exitCode: 1
3247
+ };
3248
+ }
3249
+ ci();
3250
+ let i = Sr();
3251
+ Br(i), Q.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), Dt(e, Q);
3252
+ let a = await _o(e, n);
3253
+ for (let e of a) Q.info("api wired", {
2798
3254
  name: e.name,
2799
3255
  pkg: e.pkg,
2800
3256
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
@@ -2802,17 +3258,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2802
3258
  g(e).then((e) => {
2803
3259
  for (let t of e.files) if (t.action === "created") {
2804
3260
  let e = t.path.split("/").pop() ?? t.path;
2805
- Z.info(`${e} seeded`, { path: t.path });
3261
+ Q.info(`${e} seeded`, { path: t.path });
2806
3262
  }
2807
3263
  }).catch(() => {});
2808
- let { resolved: o } = await Pe({
3264
+ let { resolved: o } = await rt({
2809
3265
  rawEnv: n.env,
2810
3266
  appType: "web",
2811
3267
  root: e,
2812
- log: Z,
3268
+ log: Q,
2813
3269
  generateTypes: !0
2814
3270
  }), s = o.publicValues;
2815
- await sa(e, n, a, s), Z.debug("generated framework entry files", { files: [
3271
+ await wo(e, n, a, s), Q.debug("generated framework entry files", { files: [
2816
3272
  "index.html",
2817
3273
  ".framework/main.tsx",
2818
3274
  ...n.env ? [".framework/env.public.ts"] : []
@@ -2821,34 +3277,46 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2821
3277
  kind: "web",
2822
3278
  configPort: n.port,
2823
3279
  env: process.env,
2824
- dashboardPin: process.env[br] === "1"
3280
+ dashboardPin: process.env[wi] === "1"
2825
3281
  });
2826
- for (let e of c.warnings) Z.warn(e);
2827
- let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
2828
- await x({
2829
- id: b,
2830
- name: y,
3282
+ for (let e of c.warnings) Q.warn(e);
3283
+ let l = c.port, b = n.name ?? "unnamed", x = re("web", b, l), S = ie(b);
3284
+ await ee({
3285
+ id: x,
3286
+ name: b,
2831
3287
  kind: "web",
2832
3288
  url: `http://localhost:${l}`,
2833
3289
  pid: process.pid,
2834
3290
  status: "booting",
2835
- logFile: D.path
2836
- }).catch(() => {}), await ca(e, l);
2837
- let { pages: j, dirs: P } = await $(O(e, "src", "pages")), F = {
2838
- dirs: P,
2839
- ssrRoutes: qi(j)
2840
- }, ee = P.map((e) => ({
3291
+ logFile: S.path
3292
+ }).catch(() => {}), await To(e, l);
3293
+ let { pages: C, dirs: w } = await ro(I(e, "src", "pages")), T = null, E = n.fonts !== void 0 && n.fonts.length > 0 ? Yn({
3294
+ root: e,
3295
+ fonts: n.fonts,
3296
+ cache: v(),
3297
+ secret: qn().secret,
3298
+ isOgSsrRoute: (e) => O.ssrRoutes.some((t) => t.pattern === e),
3299
+ getPageModule: async (e) => {
3300
+ let t = O.ssrRoutes.find((t) => t.pattern === e);
3301
+ if (t === void 0 || T === null) return null;
3302
+ let n = await T(t.file), r = _(n, t.file);
3303
+ return r === "ssr" || r === "isr" ? n : null;
3304
+ }
3305
+ }) : null, O = {
3306
+ dirs: w,
3307
+ ssrRoutes: lo(C)
3308
+ }, k = w.map((e) => ({
2841
3309
  dir: e.dir,
2842
3310
  hasLayout: e.hasLayout,
2843
3311
  hasError: e.hasError,
2844
3312
  hasPending: e.hasPending,
2845
3313
  hasNotFound: e.hasNotFound
2846
- })), te = await un({
3314
+ })), A = await mr({
2847
3315
  appRoot: e,
2848
- pages: j
3316
+ pages: C
2849
3317
  });
2850
- te.wrote && Z.debug("routes codegen wrote", { path: k(e, te.path) });
2851
- let ne = await De("vite", () => import("vite")), re = (await import("@vitejs/plugin-react")).default, I = (await import("@tailwindcss/vite")).default, L = O(e, ".framework"), R = O(e, "src"), ie = /* @__PURE__ */ new Set([
3318
+ A.wrote && Q.debug("routes codegen wrote", { path: L(e, A.path) });
3319
+ let j = await Xe("vite", () => import("vite")), M = (await import("@vitejs/plugin-react")).default, N = (await import("@tailwindcss/vite")).default, P = I(e, ".framework"), F = I(e, "src"), z = /* @__PURE__ */ new Set([
2852
3320
  ".framework",
2853
3321
  "node_modules",
2854
3322
  "dist",
@@ -2856,64 +3324,64 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2856
3324
  ".vite",
2857
3325
  ".turbo",
2858
3326
  ".cache"
2859
- ]), B = {
3327
+ ]), oe = {
2860
3328
  name: "framework:watch-app-sources",
2861
3329
  async configureServer(t) {
2862
3330
  try {
2863
- let n = (await N.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !ie.has(e.name));
2864
- for (let r of n) t.watcher.add(O(e, r.name));
2865
- n.length === 0 && t.watcher.add(R);
3331
+ let n = (await V.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !z.has(e.name));
3332
+ for (let r of n) t.watcher.add(I(e, r.name));
3333
+ n.length === 0 && t.watcher.add(F);
2866
3334
  } catch {
2867
- t.watcher.add(R);
3335
+ t.watcher.add(F);
2868
3336
  }
2869
- for (let n of await Re(e)) t.watcher.add(n.dir);
3337
+ for (let n of await ct(e)) t.watcher.add(n.dir);
2870
3338
  }
2871
- }, V = O(e, "src", "pages"), ae = (e) => e.endsWith(".tsx") && (e === V || e.startsWith(V + "/")), oe = (e) => e === V || e.startsWith(V + "/"), H = async (t) => {
3339
+ }, H = I(e, "src", "pages"), U = (e) => e.endsWith(".tsx") && (e === H || e.startsWith(H + "/")), se = (e) => e === H || e.startsWith(H + "/"), ce = async (t) => {
2872
3340
  try {
2873
3341
  let r = Date.now();
2874
- await sa(e, n, a, s);
2875
- let { pages: i, dirs: o } = await $(V);
2876
- await un({
3342
+ await wo(e, n, a, s);
3343
+ let { pages: i, dirs: o } = await ro(H);
3344
+ await mr({
2877
3345
  appRoot: e,
2878
3346
  pages: i
2879
- }), F.dirs = o, F.ssrRoutes = qi(i), Z.info("page tree regenerated", {
3347
+ }), O.dirs = o, O.ssrRoutes = lo(i), Q.info("page tree regenerated", {
2880
3348
  reason: t,
2881
3349
  ms: Date.now() - r,
2882
- routes: F.ssrRoutes.length
3350
+ routes: O.ssrRoutes.length
2883
3351
  });
2884
- for (let e of di(J, F.ssrRoutes.map((e) => e.pattern))) Z.error(`middleware.ts: ${e.message}`);
3352
+ for (let e of ha(Y, O.ssrRoutes.map((e) => e.pattern))) Q.error(`middleware.ts: ${e.message}`);
2885
3353
  } catch (e) {
2886
- Z.error("page tree regen failed", { reason: t }, e);
3354
+ Q.error("page tree regen failed", { reason: t }, e);
2887
3355
  }
2888
- }, se = {
3356
+ }, W = {
2889
3357
  name: "framework:regenerate-on-page-tree-change",
2890
3358
  configureServer(t) {
2891
3359
  let n = null, r = [], i = (e) => {
2892
3360
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2893
3361
  n = null;
2894
3362
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2895
- r.length = 0, H(e);
3363
+ r.length = 0, ce(e);
2896
3364
  }, 50);
2897
3365
  };
2898
3366
  t.watcher.on("add", (t) => {
2899
- ae(t) && i(`add ${k(e, t)}`);
3367
+ U(t) && i(`add ${L(e, t)}`);
2900
3368
  }), t.watcher.on("unlink", (t) => {
2901
- ae(t) && i(`unlink ${k(e, t)}`);
3369
+ U(t) && i(`unlink ${L(e, t)}`);
2902
3370
  }), t.watcher.on("addDir", (t) => {
2903
- oe(t) && i(`addDir ${k(e, t)}`);
3371
+ se(t) && i(`addDir ${L(e, t)}`);
2904
3372
  }), t.watcher.on("unlinkDir", (t) => {
2905
- oe(t) && i(`unlinkDir ${k(e, t)}`);
3373
+ se(t) && i(`unlinkDir ${L(e, t)}`);
2906
3374
  });
2907
3375
  }
2908
- }, U = O(e, "app.config.ts"), ce = (e) => {
2909
- if (!ue(e.env)) return "";
3376
+ }, G = I(e, "app.config.ts"), le = (e) => {
3377
+ if (!xe(e.env)) return "";
2910
3378
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2911
3379
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2912
- }, le = (e, t) => {
3380
+ }, K = (e, t) => {
2913
3381
  let n = [];
2914
- return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), ce(e) !== ce(t) && n.push("env"), n;
2915
- }, W = n, de = A(U), fe = () => {
2916
- let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
3382
+ return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), le(e) !== le(t) && n.push("env"), n;
3383
+ }, q = n, de = R(G), fe = () => {
3384
+ let e = Me(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2917
3385
  stdio: "inherit",
2918
3386
  env: process.env,
2919
3387
  cwd: process.cwd()
@@ -2923,29 +3391,29 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2923
3391
  process.on("SIGINT", n), process.on("SIGTERM", r), e.on("exit", (e, t) => {
2924
3392
  process.off("SIGINT", n), process.off("SIGTERM", r), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2925
3393
  }), e.on("error", (e) => {
2926
- Z.error("restart spawn failed", {}, e), process.exit(1);
3394
+ Q.error("restart spawn failed", {}, e), process.exit(1);
2927
3395
  });
2928
3396
  }, pe = {
2929
3397
  name: "framework:watch-app-config",
2930
3398
  async configureServer(n) {
2931
- n.watcher.add(U), Z.info("watching app.config.ts for changes", { path: k(e, U) });
2932
- let r = ii.map((t) => O(e, t)), i = new Set(r.map((e) => A(e)));
3399
+ n.watcher.add(G), Q.info("watching app.config.ts for changes", { path: L(e, G) });
3400
+ let r = ca.map((t) => I(e, t)), i = new Set(r.map((e) => R(e)));
2933
3401
  for (let e of r) n.watcher.add(e);
2934
3402
  n.watcher.on("all", (t, r) => {
2935
- i.has(A(r)) && (Z.warn("middleware.ts changed — restarting (it is loaded once per boot)", { path: k(e, r) }), n.close().catch(() => void 0).then(() => {
3403
+ i.has(R(r)) && (Q.warn("middleware.ts changed — restarting (it is loaded once per boot)", { path: L(e, r) }), n.close().catch(() => void 0).then(() => {
2936
3404
  fe();
2937
3405
  }));
2938
3406
  });
2939
3407
  let a = async () => {
2940
3408
  try {
2941
3409
  try {
2942
- let e = n.moduleGraph.getModuleById(U);
3410
+ let e = n.moduleGraph.getModuleById(G);
2943
3411
  e && n.moduleGraph.invalidateModule(e);
2944
3412
  } catch {}
2945
- let e = (await n.ssrLoadModule(U, { fixStacktrace: !0 })).default;
2946
- return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Z.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
3413
+ let e = (await n.ssrLoadModule(G, { fixStacktrace: !0 })).default;
3414
+ return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Q.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
2947
3415
  } catch (e) {
2948
- return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
3416
+ return Q.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
2949
3417
  }
2950
3418
  }, o = null, s = () => {
2951
3419
  o && clearTimeout(o), o = setTimeout(() => {
@@ -2954,20 +3422,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2954
3422
  }, c = async () => {
2955
3423
  let t = await a();
2956
3424
  if (!t) {
2957
- Z.info("app.config.ts onConfigChange: load returned null — skipping");
3425
+ Q.info("app.config.ts onConfigChange: load returned null — skipping");
2958
3426
  return;
2959
3427
  }
2960
- if (Z.info("app.config.ts onConfigChange: loaded", {
3428
+ if (Q.info("app.config.ts onConfigChange: loaded", {
2961
3429
  theme: t.theme,
2962
3430
  port: t.port,
2963
3431
  name: t.name
2964
- }), JSON.stringify(t) === JSON.stringify(W)) {
2965
- Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
3432
+ }), JSON.stringify(t) === JSON.stringify(q)) {
3433
+ Q.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2966
3434
  return;
2967
3435
  }
2968
- let r = le(W, t);
3436
+ let r = K(q, t);
2969
3437
  if (r.length > 0) {
2970
- Z.warn("app.config.ts changed — hard restart required", { fields: r });
3438
+ Q.warn("app.config.ts changed — hard restart required", { fields: r });
2971
3439
  try {
2972
3440
  await n.close();
2973
3441
  } catch {}
@@ -2976,82 +3444,82 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
2976
3444
  }
2977
3445
  try {
2978
3446
  let r = Date.now();
2979
- await sa(e, t, await ea(e, t)), W = t, n.ws && n.ws.send({
3447
+ await wo(e, t, await _o(e, t)), q = t, n.ws && n.ws.send({
2980
3448
  type: "full-reload",
2981
3449
  path: "*"
2982
- }), Z.info("app.config.ts soft-regen", {
3450
+ }), Q.info("app.config.ts soft-regen", {
2983
3451
  ms: Date.now() - r,
2984
3452
  reload: "full"
2985
3453
  });
2986
3454
  } catch (e) {
2987
- Z.error("app.config.ts soft-regen failed", {}, e);
3455
+ Q.error("app.config.ts soft-regen failed", {}, e);
2988
3456
  }
2989
- }, l = (e) => E(e) === "app.config.ts" ? e === U || A(e) === de : !1;
3457
+ }, l = (e) => ae(e) === "app.config.ts" ? e === G || R(e) === de : !1;
2990
3458
  n.watcher.on("change", (e) => {
2991
- l(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), s());
3459
+ l(e) && (Q.info("app.config.ts change event (chokidar)", { file: e }), s());
2992
3460
  }), n.watcher.on("add", (e) => {
2993
- l(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), s());
3461
+ l(e) && (Q.info("app.config.ts add event (chokidar)", { file: e }), s());
2994
3462
  });
2995
3463
  try {
2996
3464
  let { watchFile: e } = await import("node:fs");
2997
- e(U, { interval: 500 }, (e, t) => {
2998
- e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
2999
- }), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
3465
+ e(G, { interval: 500 }, (e, t) => {
3466
+ e.mtimeMs !== t.mtimeMs && (Q.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
3467
+ }), Q.info("app.config.ts polling watcher attached", { intervalMs: 500 });
3000
3468
  } catch (e) {
3001
- Z.warn("app.config.ts polling watcher could not attach", {}, e);
3469
+ Q.warn("app.config.ts polling watcher could not attach", {}, e);
3002
3470
  }
3003
- Be(t, Z, {
3471
+ ut(t, Q, {
3004
3472
  root: e,
3005
3473
  onBeforeRestart: () => n.close()
3006
3474
  });
3007
3475
  }
3008
- }, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, G = 0, he = {
3476
+ }, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, he = 0, ge = {
3009
3477
  name: "framework:suppress-api-hmr",
3010
3478
  handleHotUpdate(e) {
3011
- if (G += 1, me.test(e.file)) return [];
3479
+ if (he += 1, me.test(e.file)) return [];
3012
3480
  }
3013
- }, ge = {
3481
+ }, _e = {
3014
3482
  name: "framework:reoptimize-on-rpcgroup-change",
3015
3483
  async configureServer(t) {
3016
3484
  let n = [];
3017
3485
  for (let r of a) {
3018
- let i = await Yi(e, r.pkg);
3486
+ let i = await fo(e, r.pkg);
3019
3487
  if (i) {
3020
3488
  n.push(i);
3021
3489
  try {
3022
- t.watcher.add(O(i, "rpcGroup.generated.ts"));
3490
+ t.watcher.add(I(i, "rpcGroup.generated.ts"));
3023
3491
  } catch {}
3024
- for (let e of await ei(i)) try {
3492
+ for (let e of await ia(i)) try {
3025
3493
  t.watcher.add(e);
3026
3494
  } catch {}
3027
3495
  }
3028
3496
  }
3029
3497
  if (n.length === 0) return;
3030
- let r = await ni(n), i = null, o = !1, s = async () => {
3498
+ let r = await oa(n), i = null, o = !1, s = async () => {
3031
3499
  if (o) return;
3032
- let e = await ni(n);
3500
+ let e = await oa(n);
3033
3501
  if (e !== void 0 && e !== r) {
3034
- r = e, o = !0, Z.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
3502
+ r = e, o = !0, Q.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
3035
3503
  try {
3036
- await N.rm(O(L, ".vite", "deps"), {
3504
+ await V.rm(I(P, ".vite", "deps"), {
3037
3505
  recursive: !0,
3038
3506
  force: !0
3039
3507
  }), await t.restart(!0);
3040
3508
  } catch (e) {
3041
- o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
3509
+ o = !1, Q.error("rpcGroup re-optimize failed", {}, e);
3042
3510
  }
3043
3511
  }
3044
3512
  }, c = (e) => {
3045
- let t = A(e);
3046
- !Qr(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
3513
+ let t = R(e);
3514
+ !na(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
3047
3515
  s();
3048
3516
  }, 120));
3049
3517
  };
3050
3518
  t.watcher.on("change", c), t.watcher.on("add", c);
3051
3519
  }
3052
- }, K = {}, ve = (e) => (t) => {
3520
+ }, ve = {}, ye = (e) => (t) => {
3053
3521
  t.on("proxyReq", (t, n) => {
3054
- nr(t, n, {
3522
+ oi(t, n, {
3055
3523
  target: e,
3056
3524
  token: process.env.VOLTRO_INSPECT_TOKEN,
3057
3525
  writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
@@ -3061,59 +3529,59 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3061
3529
  };
3062
3530
  for (let e of a) {
3063
3531
  if (!e.proxyTarget) continue;
3064
- K[e.browserWsUrl] = {
3532
+ ve[e.browserWsUrl] = {
3065
3533
  target: e.proxyTarget,
3066
3534
  ws: !0,
3067
3535
  changeOrigin: !0,
3068
3536
  ...e.wsPath ? {} : { rewrite: () => "/ws" }
3069
3537
  };
3070
3538
  let t = e.proxyTarget.replace(/^ws/, "http");
3071
- K[`/_voltro/api/${e.name}`] = {
3539
+ ve[`/_voltro/api/${e.name}`] = {
3072
3540
  target: t,
3073
3541
  changeOrigin: !0,
3074
3542
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
3075
- configure: ve(t)
3543
+ configure: ye(t)
3076
3544
  };
3077
3545
  }
3078
3546
  for (let [e, t] of Object.entries(n.proxies ?? {})) {
3079
- if (K[e]) {
3080
- Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
3547
+ if (ve[e]) {
3548
+ Q.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
3081
3549
  continue;
3082
3550
  }
3083
- K[e] = {
3551
+ ve[e] = {
3084
3552
  target: t.target,
3085
3553
  changeOrigin: t.changeOrigin ?? !0,
3086
3554
  ...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
3087
- }, Z.info(`proxy ${e} → ${t.target}`, {
3555
+ }, Q.info(`proxy ${e} → ${t.target}`, {
3088
3556
  prefix: e,
3089
3557
  target: t.target,
3090
3558
  ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
3091
3559
  });
3092
3560
  }
3093
- let ye = {
3561
+ let be = {
3094
3562
  name: "framework:inspect",
3095
3563
  configureServer(t) {
3096
3564
  let r = null, a = async () => {
3097
3565
  if (r !== null) return r;
3098
3566
  let n = [];
3099
- for (let r of j) try {
3100
- let i = await t.ssrLoadModule(O(e, "src", "pages", r.file));
3567
+ for (let r of C) try {
3568
+ let i = await t.ssrLoadModule(I(e, "src", "pages", r.file));
3101
3569
  n.push({
3102
3570
  pattern: r.pattern,
3103
3571
  file: r.file,
3104
3572
  dirChain: r.dirChain,
3105
- renderMode: _(i, O("src", "pages", r.file)),
3573
+ renderMode: _(i, I("src", "pages", r.file)),
3106
3574
  interactive: i.interactive ?? "full",
3107
3575
  tenantAware: i.tenantAware === !0,
3108
- revalidateMs: v(i.revalidate),
3109
- staleWhileRevalidateMs: v(i.staleWhileRevalidate) ?? 0,
3576
+ revalidateMs: y(i.revalidate),
3577
+ staleWhileRevalidateMs: y(i.staleWhileRevalidate) ?? 0,
3110
3578
  cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
3111
3579
  hasLoader: typeof i.loader == "function",
3112
3580
  hasMeta: i.meta != null,
3113
3581
  hasGetStaticPaths: typeof i.getStaticPaths == "function"
3114
3582
  });
3115
3583
  } catch (e) {
3116
- Z.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
3584
+ Q.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
3117
3585
  }
3118
3586
  return r = n, n;
3119
3587
  };
@@ -3133,9 +3601,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3133
3601
  }), n();
3134
3602
  }), t.middlewares.use((t, n, r) => {
3135
3603
  if (t.method !== "GET" && t.method !== "HEAD") return r();
3136
- let { pathname: i } = $t(t.url ?? "/");
3137
- if (i !== "/robots.txt" || M(O(e, "public", "robots.txt"))) return r();
3138
- n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(gn({ indexable: !1 }));
3604
+ let { pathname: i } = ir(t.url ?? "/");
3605
+ if (i !== "/robots.txt" || B(I(e, "public", "robots.txt"))) return r();
3606
+ n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(br({ indexable: !1 }));
3139
3607
  }), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
3140
3608
  let r = e.url ?? "", i = r.split("?")[0];
3141
3609
  if (i === "/api/dashboard/proxy") {
@@ -3226,7 +3694,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3226
3694
  for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
3227
3695
  let c = o.split("?")[0];
3228
3696
  if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
3229
- let e = d(s.origin), n = Xn(o, jn(), s);
3697
+ let e = d(s.origin), n = ei(o, Fr(), s);
3230
3698
  t.statusCode = n.status, t.setHeader("content-type", n.contentType);
3231
3699
  for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
3232
3700
  t.end(n.body);
@@ -3244,7 +3712,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3244
3712
  e.setEncoding("utf-8"), e.on("data", (e) => {
3245
3713
  r += e;
3246
3714
  }), e.on("end", () => {
3247
- let e = Wn(r, i);
3715
+ let e = Jr(r, i);
3248
3716
  t.statusCode = e.status, t.setHeader("content-type", e.contentType);
3249
3717
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
3250
3718
  t.end(e.body);
@@ -3275,14 +3743,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3275
3743
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
3276
3744
  t.flushHeaders?.(), t.write("retry: 5000\n\n");
3277
3745
  let a = o.indexOf("?");
3278
- if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(yn(e));
3746
+ if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(Cr(e));
3279
3747
  let c = i.subscribe((e) => {
3280
3748
  try {
3281
- t.write(yn(e));
3749
+ t.write(Cr(e));
3282
3750
  } catch {}
3283
3751
  }), l = setInterval(() => {
3284
3752
  try {
3285
- t.write(bn());
3753
+ t.write(wr());
3286
3754
  } catch {}
3287
3755
  }, 15e3), p = () => {
3288
3756
  clearInterval(l), c();
@@ -3295,7 +3763,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3295
3763
  kind: "web",
3296
3764
  meta: {
3297
3765
  name: n.name ?? "(unnamed)",
3298
- voltroVersion: Di,
3766
+ voltroVersion: Va,
3299
3767
  port: l,
3300
3768
  mode: "dev",
3301
3769
  apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
@@ -3307,13 +3775,13 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3307
3775
  })
3308
3776
  },
3309
3777
  routes: await a(),
3310
- dirs: ee,
3778
+ dirs: k,
3311
3779
  cache: () => ({
3312
3780
  backend: "memory",
3313
3781
  size: 0,
3314
3782
  entries: []
3315
3783
  }),
3316
- env: () => Fe(n.name ?? "app", { contract: ue(n.env) ? n.env : void 0 })
3784
+ env: () => at(n.name ?? "app", { contract: xe(n.env) ? n.env : void 0 })
3317
3785
  }, c = p(o, i, s, { method: e.method ?? "GET" });
3318
3786
  if (c === null) return r();
3319
3787
  t.statusCode = c.status, t.setHeader("content-type", c.contentType);
@@ -3324,25 +3792,25 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3324
3792
  }
3325
3793
  });
3326
3794
  }
3327
- }, be = n.name === "voltroDashboard" ? {
3795
+ }, Se = n.name === "voltroDashboard" ? {
3328
3796
  name: "framework:dashboard-registry",
3329
3797
  configureServer(e) {
3330
3798
  e.middlewares.use(async (e, t, n) => {
3331
3799
  if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
3332
3800
  try {
3333
- let e = await S();
3801
+ let e = await te();
3334
3802
  t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
3335
3803
  } catch (e) {
3336
3804
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
3337
3805
  }
3338
3806
  });
3339
3807
  }
3340
- } : null, Se = /* @__PURE__ */ new Set(), Ce = (e, t, n, r, i, a = !1) => {
3341
- let o = Ir(i, a, t) ?? "";
3342
- if (Z.error(`${t} render failed`, {
3808
+ } : null, Ce = /* @__PURE__ */ new Set(), we = (e, t, n, r, i, a = !1) => {
3809
+ let o = Bi(i, a, t) ?? "";
3810
+ if (Q.error(`${t} render failed`, {
3343
3811
  pathname: n,
3344
3812
  pattern: r,
3345
- cause: Sn(i) + o
3813
+ cause: Er(i) + o
3346
3814
  }), e.headersSent) {
3347
3815
  e.end();
3348
3816
  return;
@@ -3350,33 +3818,33 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3350
3818
  e.writeHead(500, {
3351
3819
  "content-type": "text/plain; charset=utf-8",
3352
3820
  "x-voltro-rendered-by": `${t}-failed`,
3353
- "x-voltro-ssr-generation": String(G)
3821
+ "x-voltro-ssr-generation": String(he)
3354
3822
  });
3355
- let s = G === 0 ? "" : `\n[voltro] this process has absorbed ${G} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
3356
- e.end(`${t} render failed for ${n}\n\n${Sn(i)}\n${o}\n${s}`);
3357
- }, we = mt(), Te = gt({
3358
- limit: we,
3359
- onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
3360
- onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
3823
+ let s = he === 0 ? "" : `\n[voltro] this process has absorbed ${he} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
3824
+ e.end(`${t} render failed for ${n}\n\n${Er(i)}\n${o}\n${s}`);
3825
+ }, Te = zt(), Ee = Vt({
3826
+ limit: Te,
3827
+ onColdStart: (e) => Q.debug("ssr cold-compile start", { id: e }),
3828
+ onColdEnd: (e, { durationMs: t, failed: n }) => Q.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
3361
3829
  id: e,
3362
3830
  ms: t,
3363
3831
  ...n ? { failed: !0 } : {}
3364
3832
  })
3365
3833
  });
3366
- Z.debug(`ssr cold-compile concurrency ${we}`, { concurrency: we });
3367
- let Ee = null, Oe = async () => (Ee === null && (Ee = await N.readFile(O(e, ".framework", "index.html"), "utf8")), Ee), ke = {
3834
+ Q.debug(`ssr cold-compile concurrency ${Te}`, { concurrency: Te });
3835
+ let De = null, J = async () => (De === null && (De = await V.readFile(I(e, ".framework", "index.html"), "utf8")), De), Oe = {
3368
3836
  name: "framework:ssr",
3369
3837
  configureServer(t) {
3370
- let r = (e) => Te.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
3838
+ let r = (e) => Ee.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
3371
3839
  if (i !== void 0) return i;
3372
3840
  let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
3373
3841
  return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
3374
3842
  let [{ makeSsgWrap: i }, { makeSsrI18nResolver: s }] = await Promise.all([r("@voltro/i18n"), r("@voltro/i18n/server")]), c = {};
3375
- for (let n of t) if (M(O(e, "src", "locales", `${n}.ts`))) try {
3376
- let t = (await r(O(e, "src", "locales", `${n}.ts`))).default;
3843
+ for (let n of t) if (B(I(e, "src", "locales", `${n}.ts`))) try {
3844
+ let t = (await r(I(e, "src", "locales", `${n}.ts`))).default;
3377
3845
  t !== void 0 && (c[n] = i(n, t, a));
3378
3846
  } catch (e) {
3379
- Z.warn("locale catalog failed to load for SSR", { locale: n }, e);
3847
+ Q.warn("locale catalog failed to load for SSR", { locale: n }, e);
3380
3848
  }
3381
3849
  if (o = Object.keys(c).length > 0, Object.keys(c).length === 0) {
3382
3850
  let { resolveLocale: e, resolveTimeZone: i } = await r("@voltro/i18n/server");
@@ -3403,62 +3871,88 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3403
3871
  defaultTimeZone: n.defaultTimeZone ?? null
3404
3872
  });
3405
3873
  })(), i);
3406
- }, c = Dt({
3874
+ }, c = Qt({
3407
3875
  apiName: a[0]?.name,
3408
- apiOrigin: ia(a[0], { allowDevProxy: !0 }),
3876
+ apiOrigin: xo(a[0], { allowDevProxy: !0 }),
3409
3877
  loadDescriptors: async () => {
3410
3878
  let e = a[0];
3411
3879
  if (e !== void 0) return (await r(`${e.pkg}/rpcGroup`)).appDescriptors;
3412
3880
  },
3413
- rpcQuery: (e, t) => aa(ia(a[0], { allowDevProxy: !0 }), e, {
3881
+ rpcQuery: (e, t) => So(xo(a[0], { allowDevProxy: !0 }), e, {
3414
3882
  apiName: a[0]?.name,
3415
3883
  headers: t
3416
3884
  }),
3417
3885
  renderErrorPage: async () => void 0
3418
3886
  });
3419
3887
  t.middlewares.use((e, t, n) => {
3420
- if (!(e.url ?? "/").split("?")[0].startsWith(xe)) return n();
3888
+ if (!(e.url ?? "/").split("?")[0].startsWith(Le)) return n();
3421
3889
  c(e, t, (t, r) => {
3422
3890
  e.url = t, e.method = "GET", e.__voltroFormFlash = r, n();
3423
3891
  }).then((e) => {
3424
3892
  e || n();
3425
3893
  });
3894
+ }), T = async (n) => await t.ssrLoadModule(I(e, "src", "pages", n)), t.middlewares.use(async (e, t, n) => {
3895
+ let r = e.url ?? "/";
3896
+ if (!r.startsWith("/_voltro/og") || E === null) return n();
3897
+ try {
3898
+ let e = await E.handle(new URL(r, "http://localhost"));
3899
+ if (e === null) return n();
3900
+ t.statusCode = e.status;
3901
+ for (let [n, r] of Object.entries(e.headers)) t.setHeader(n, r);
3902
+ t.end(Buffer.from(e.body));
3903
+ } catch (e) {
3904
+ t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`og render error: ${e.message}`);
3905
+ }
3426
3906
  }), t.middlewares.use(async (i, c, l) => {
3427
3907
  if (i.method !== "GET" && i.method !== "HEAD") return l();
3428
3908
  let u = i.url ?? "/";
3429
3909
  u.indexOf("?");
3430
- let { pathname: d, search: f } = $t(u), p = i.__voltroFormFlash;
3910
+ let { pathname: d, search: f } = ir(u), p = i.__voltroFormFlash;
3431
3911
  if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt") return l();
3432
3912
  let m = async () => {
3433
- if (J.length === 0) return;
3434
- let e = ui(J, {
3913
+ if (Y.length === 0) return;
3914
+ let e = ma(Y, {
3435
3915
  route: void 0,
3436
3916
  pathname: d
3437
3917
  });
3438
3918
  if (e === void 0) return;
3439
3919
  let t = {};
3440
3920
  for (let [e, n] of Object.entries(i.headers ?? {})) typeof n == "string" ? t[e] = n : Array.isArray(n) && (t[e] = n.join(", "));
3441
- let n = await bi(e, {
3921
+ let n = await wa(e, {
3442
3922
  pathname: d,
3443
3923
  search: f,
3444
3924
  headers: t,
3445
- cookies: pi(t.cookie),
3925
+ cookies: _a(t.cookie),
3446
3926
  route: void 0
3447
3927
  });
3448
- for (let e of n.setCookies) c.appendHeader("set-cookie", _i(e));
3928
+ for (let e of n.setCookies) c.appendHeader("set-cookie", xa(e));
3449
3929
  };
3450
3930
  if (/\.[a-z0-9]+$/i.test(d)) return await m(), l();
3451
- let h = Ji(d, F.ssrRoutes);
3452
- if (!h) return await m(), l();
3453
- let g = !Se.has(h.route.pattern), v = Date.now();
3454
- g && Z.info(`ssr compiling ${h.route.pattern}`, {
3931
+ let h = uo(d, O.ssrRoutes), g = !1;
3932
+ if (!h) {
3933
+ let e = Ha(O.dirs, d);
3934
+ if (e === void 0) return await m(), l();
3935
+ g = !0, h = {
3936
+ route: {
3937
+ pattern: "<not-found>",
3938
+ file: e.dir === "" ? "not-found.tsx" : `${e.dir}/not-found.tsx`,
3939
+ dirChain: e.chain,
3940
+ regex: /^$/,
3941
+ paramNames: [],
3942
+ priority: 2 ** 53 - 1
3943
+ },
3944
+ params: {}
3945
+ };
3946
+ }
3947
+ let v = !Ce.has(h.route.pattern), y = Date.now();
3948
+ v && Q.info(`ssr compiling ${h.route.pattern}`, {
3455
3949
  pattern: h.route.pattern,
3456
3950
  pathname: d
3457
3951
  });
3458
- let y = {}, b = async (e, t) => {
3952
+ let b = {}, x = async (e, t) => {
3459
3953
  let n = Date.now(), r = await t();
3460
- return y[e] = (y[e] ?? 0) + (Date.now() - n), r;
3461
- }, x = async (e, n, r) => {
3954
+ return b[e] = (b[e] ?? 0) + (Date.now() - n), r;
3955
+ }, S = async (e, n, r) => {
3462
3956
  let i = await t.moduleGraph.getModuleById(e);
3463
3957
  if (!(!i || n.has(e))) {
3464
3958
  if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
@@ -3466,293 +3960,326 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3466
3960
  r.includes(e) || r.push(e);
3467
3961
  return;
3468
3962
  }
3469
- for (let e of i.importedModules ?? []) e.id && await x(e.id, n, r);
3963
+ for (let e of i.importedModules ?? []) e.id && await S(e.id, n, r);
3470
3964
  }
3471
- }, S = !1;
3965
+ }, C = !1;
3472
3966
  try {
3473
- let C = await b("loadPage", async () => await r(O(e, "src", "pages", h.route.file))), w = _(C, O("src", "pages", h.route.file)), T = Hi(F.dirs, h.route.dirChain), E = w === "spa" && T.some((e) => e.hasLayout), D = C.interactive ?? "full";
3474
- if (w !== "ssr" && w !== "isr" && !E && D !== "islands") return await m(), l();
3475
- let k = {};
3476
- for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? k[e] = t : Array.isArray(t) && (k[e] = t.join(", "));
3477
- let A = await bi(ui(J, {
3967
+ let w = await x("loadPage", async () => await r(I(e, "src", "pages", h.route.file))), T = g ? "ssr" : _(w, I("src", "pages", h.route.file)), D = io(O.dirs, h.route.dirChain), k = T === "spa" && D.some((e) => e.hasLayout), A = w.interactive ?? "full";
3968
+ if (T !== "ssr" && T !== "isr" && !k && A !== "islands") return await m(), l();
3969
+ let j = {};
3970
+ for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? j[e] = t : Array.isArray(t) && (j[e] = t.join(", "));
3971
+ let M = await wa(ma(Y, {
3478
3972
  route: h.route.pattern,
3479
3973
  pathname: d
3480
3974
  }), {
3481
3975
  pathname: d,
3482
3976
  search: f,
3483
- headers: k,
3484
- cookies: pi(k.cookie),
3977
+ headers: j,
3978
+ cookies: _a(j.cookie),
3485
3979
  route: h.route.pattern
3486
- }, Ve);
3487
- for (let e of A.setCookies) c.appendHeader("set-cookie", _i(e));
3488
- for (let [e, t] of Object.entries(A.responseHeaders)) c.setHeader(e, t);
3489
- if (w === "isr" && A.cspNonce !== void 0) throw Error(`page '${h.route.pattern}' is renderMode 'isr' while middleware.ts mints a cspNonce — an isr render is CACHED and a cached nonce is a lie the browser enforces. Use renderMode 'ssr' for nonce'd pages, or a hash-based CSP for isr.`);
3490
- let j = w === "isr" ? wi(A.headers) : A.headers, M = aa(ia(a[0], { allowDevProxy: !0 }), j.cookie, {
3980
+ }, ze);
3981
+ for (let e of M.setCookies) c.appendHeader("set-cookie", xa(e));
3982
+ for (let [e, t] of Object.entries(M.responseHeaders)) c.setHeader(e, t);
3983
+ if (T === "isr" && M.cspNonce !== void 0) throw Error(`page '${h.route.pattern}' is renderMode 'isr' while middleware.ts mints a cspNonce — an isr render is CACHED and a cached nonce is a lie the browser enforces. Use renderMode 'ssr' for nonce'd pages, or a hash-based CSP for isr.`);
3984
+ let N = T === "isr" ? Oa(M.headers) : M.headers, P = T === "isr" && w.ppr === !0, ee = P ? Pa(N, h.route.pattern) : N, te = So(xo(a[0], { allowDevProxy: !0 }), N.cookie, {
3491
3985
  apiName: a[0]?.name,
3492
- headers: j
3493
- }), P = new AbortController(), ee = () => P.abort();
3494
- c.once("close", ee);
3495
- let te = null, ne = [], re = {};
3986
+ headers: N
3987
+ }), ne = new AbortController(), re = () => ne.abort();
3988
+ c.once("close", re);
3989
+ let ie = null, ae = [], F = {};
3496
3990
  try {
3497
- (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: ne, segmentLoaderData: re} = await b("loadChain", () => Ui({
3498
- entries: T,
3499
- loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
3500
- loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
3501
- loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
3991
+ (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: ae, segmentLoaderData: F} = await x("loadChain", () => ao({
3992
+ entries: D,
3993
+ loadLayout: (t) => r(I(e, "src", "pages", t.dir, "layout.tsx")),
3994
+ loadError: (t) => r(I(e, "src", "pages", t.dir, "error.tsx")),
3995
+ loadPending: (t) => r(I(e, "src", "pages", t.dir, "loading.tsx")),
3502
3996
  ctx: {
3503
3997
  params: h.params,
3504
3998
  pathname: d,
3505
3999
  search: f,
3506
- signal: P.signal,
3507
- headers: j,
3508
- query: M,
4000
+ signal: ne.signal,
4001
+ headers: ee,
4002
+ query: te,
3509
4003
  isServer: !0
3510
4004
  }
3511
4005
  }));
3512
- let t = C.loader;
3513
- typeof t == "function" && !E && (te = await b("loader", () => t({
4006
+ let t = w.loader;
4007
+ typeof t == "function" && !k && (ie = await x("loader", () => t({
3514
4008
  params: h.params,
3515
4009
  pathname: d,
3516
4010
  search: f,
3517
- signal: P.signal,
3518
- headers: j,
3519
- query: M,
4011
+ signal: ne.signal,
4012
+ headers: ee,
4013
+ query: te,
3520
4014
  isServer: !0
3521
4015
  })));
3522
4016
  } finally {
3523
- c.off("close", ee);
4017
+ c.off("close", re);
3524
4018
  }
3525
- let I = await b("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
3526
- E || await Zr({
3527
- pageMod: C,
4019
+ let L = await x("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
4020
+ k || await ta({
4021
+ pageMod: w,
3528
4022
  params: h.params,
3529
- query: M,
4023
+ query: te,
3530
4024
  apiName: a[0]?.name,
3531
- seed: I.seedPreloadedSubscription,
3532
- seedFailure: I.seedPreloadedSubscriptionFailure,
3533
- onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
4025
+ seed: L.seedPreloadedSubscription,
4026
+ seedFailure: L.seedPreloadedSubscriptionFailure,
4027
+ onError: ({ tag: e, apiName: t }, n) => Q.warn("preload seed failed", {
3534
4028
  tag: e,
3535
4029
  apiName: t,
3536
4030
  pathname: d
3537
4031
  }, n)
3538
4032
  });
3539
- let L = {
4033
+ let R = {
3540
4034
  pattern: h.route.pattern,
3541
- Component: C.default,
3542
- meta: C.meta,
3543
- loader: C.loader,
3544
- ErrorBoundary: C.ErrorBoundary,
3545
- Pending: C.Pending,
3546
- renderMode: w,
3547
- chain: ne
3548
- }, R = {
3549
- cookies: w === "isr" ? Ti(A.cookies) : A.cookies,
3550
- headers: j,
4035
+ Component: w.default,
4036
+ meta: w.meta,
4037
+ loader: w.loader,
4038
+ ErrorBoundary: w.ErrorBoundary,
4039
+ Pending: w.Pending,
4040
+ renderMode: T,
4041
+ chain: ae
4042
+ }, z = {
4043
+ cookies: P ? Fa(ka(M.cookies), h.route.pattern) : T === "isr" ? ka(M.cookies) : M.cookies,
4044
+ headers: ee,
3551
4045
  url: u,
3552
4046
  ...p === void 0 ? {} : { formFlash: p }
3553
- }, z = (await s())(j.cookie, j["accept-language"]);
3554
- S = z !== void 0 && o;
3555
- let ie = z ? {
3556
- outerWrap: z.outerWrap,
3557
- locale: z.locale
3558
- } : {}, B = E ? Yt({
3559
- helpers: I,
4047
+ }, B = (await s())(N.cookie, N["accept-language"]);
4048
+ C = B !== void 0 && o;
4049
+ let oe = B ? {
4050
+ outerWrap: B.outerWrap,
4051
+ locale: B.locale
4052
+ } : {}, H = k ? er({
4053
+ helpers: L,
3560
4054
  page: `src/pages/${h.route.file}`,
3561
- interactive: D,
4055
+ interactive: A,
3562
4056
  delivery: "stream",
3563
4057
  renderInput: {
3564
- descriptor: L,
4058
+ descriptor: R,
3565
4059
  params: h.params,
3566
4060
  pathname: d,
3567
4061
  search: f,
3568
- segmentLoaderData: re,
3569
- requestContext: R,
3570
- ...ie
4062
+ segmentLoaderData: F,
4063
+ requestContext: z,
4064
+ ...oe
3571
4065
  }
3572
- }) : null, V = E ? null : Jt({
3573
- helpers: I,
4066
+ }) : null, U = k ? null : $n({
4067
+ helpers: L,
3574
4068
  page: `src/pages/${h.route.file}`,
3575
4069
  pathname: d,
3576
- renderMode: w,
3577
- interactive: D,
3578
- loaderData: te,
3579
- segmentLoaderData: re,
3580
- pageLoaderRan: typeof C.loader == "function"
3581
- }), ae = [];
3582
- await b("collectCss", async () => {
4070
+ renderMode: T,
4071
+ interactive: A,
4072
+ loaderData: ie,
4073
+ segmentLoaderData: F,
4074
+ pageLoaderRan: typeof w.loader == "function",
4075
+ ...P ? { ppr: !0 } : {}
4076
+ });
4077
+ P && U !== null && za(U.stateInput, h.route.pattern);
4078
+ let se = [];
4079
+ await x("collectCss", async () => {
3583
4080
  let t = /* @__PURE__ */ new Set(), n = [
3584
- O(e, "src", "pages", h.route.file),
3585
- ...T.flatMap((t) => [
3586
- ...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
3587
- ...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
3588
- ...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
4081
+ I(e, "src", "pages", h.route.file),
4082
+ ...D.flatMap((t) => [
4083
+ ...t.hasLayout ? [I(e, "src", "pages", t.dir, "layout.tsx")] : [],
4084
+ ...t.hasError ? [I(e, "src", "pages", t.dir, "error.tsx")] : [],
4085
+ ...t.hasPending ? [I(e, "src", "pages", t.dir, "loading.tsx")] : []
3589
4086
  ]),
3590
- O(e, ".framework", "main.tsx")
4087
+ I(e, ".framework", "main.tsx")
3591
4088
  ];
3592
- for (let e of n) await x(e, t, ae);
4089
+ for (let e of n) await S(e, t, se);
3593
4090
  });
3594
- let oe = (D === "islands" ? await b("islandsEntry", async () => {
3595
- let t = oa(a, "../../app.config"), n = (await Wt({
4091
+ let ce = (A === "islands" ? await x("islandsEntry", async () => {
4092
+ let t = Co(a, "../../app.config"), n = (await gn({
3596
4093
  webRoot: e,
3597
4094
  pages: [{
3598
4095
  pattern: h.route.pattern,
3599
4096
  file: h.route.file
3600
4097
  }],
3601
- headSnippets: zt(await Oe()),
4098
+ headSnippets: dn(await J()),
3602
4099
  apiImports: t.imports,
3603
4100
  apiEntriesLiteral: `[\n${t.providerEntryLines.join("\n")}\n ]`
3604
4101
  }))[0];
3605
- return n === void 0 ? void 0 : await N.readFile(O(e, ".framework", n.htmlFile), "utf8");
3606
- }) : void 0) ?? await b("readShell", Oe), H = await b("transformShell", () => t.transformIndexHtml(u, oe)), se = ae.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), U = z?.locale ?? R.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", ce = Date.now(), le = {
3607
- lang: U,
3608
- ...z?.timeZone === void 0 ? {} : { timeZone: z.timeZone },
3609
- renderedAt: ce
4102
+ return n === void 0 ? void 0 : await V.readFile(I(e, ".framework", n.htmlFile), "utf8");
4103
+ }) : void 0) ?? await x("readShell", J), W = await x("transformShell", () => t.transformIndexHtml(u, ce)), G = se.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), le = B?.locale ?? z.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", K = Date.now(), ue = {
4104
+ lang: le,
4105
+ ...B?.timeZone === void 0 ? {} : { timeZone: B.timeZone },
4106
+ renderedAt: K
3610
4107
  };
3611
- if (B) {
3612
- let e = (e) => Zt({
3613
- helpers: I,
3614
- prepared: B,
4108
+ if (H) {
4109
+ let e = (e) => nr({
4110
+ helpers: L,
4111
+ prepared: H,
3615
4112
  meta: e,
3616
- interactive: D,
3617
- extra: [se]
4113
+ interactive: A,
4114
+ extra: [G]
3618
4115
  });
3619
- if (B.hasDeferred) Jr({
4116
+ if (H.hasDeferred) Qi({
3620
4117
  res: c,
3621
- shell: Ur({
3622
- shell: H,
4118
+ shell: qi({
4119
+ shell: W,
3623
4120
  inlineModuleScriptsAsync: !0
3624
4121
  }),
3625
- documentAttrs: le,
4122
+ documentAttrs: ue,
3626
4123
  headers: {
3627
4124
  "content-type": "text/html; charset=utf-8",
3628
4125
  "x-voltro-rendered-by": "spa-shell-dev"
3629
4126
  },
3630
4127
  headInjection: e,
3631
- render: (e) => I.renderPageToStream({
3632
- ...B.renderInput,
4128
+ render: (e) => L.renderPageToStream({
4129
+ ...H.renderInput,
3633
4130
  ...e
3634
4131
  }),
3635
4132
  onShellError: (e) => {
3636
- Ce(c, "spa-shell-dev", d, h.route.pattern, e, S);
4133
+ we(c, "spa-shell-dev", d, h.route.pattern, e, C);
3637
4134
  }
3638
4135
  });
3639
4136
  else {
3640
- let t = Xt({
3641
- helpers: I,
3642
- prepared: B
3643
- }), n = Kr(H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`), le);
4137
+ let t = tr({
4138
+ helpers: L,
4139
+ prepared: H
4140
+ }), n = Xi(W.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`), ue);
3644
4141
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
3645
4142
  }
3646
- } else if (V) {
3647
- let e = (e) => [
3648
- se,
3649
- I.renderMetaToHtml(e),
3650
- `<meta name="voltro-interactive" content="${D}" />`,
3651
- ...V.hasDeferred ? [I.renderDeferredRegistryScript()] : [],
3652
- I.renderRouterStateScript(V.stateInput)
3653
- ].filter((e) => e.length > 0).join("\n "), t = {
3654
- descriptor: L,
4143
+ } else if (U) {
4144
+ let e = (e) => {
4145
+ if (E === null || T !== "ssr" && T !== "isr" || typeof w.ogImage != "function" || e.includes("og:image")) return "";
4146
+ let t = i.headers["x-tenant"], n = E.signOgUrl({
4147
+ pattern: h.route.pattern,
4148
+ params: h.params,
4149
+ ...typeof t == "string" ? { tenant: t } : {}
4150
+ });
4151
+ return `<meta property="og:image" content="${n}" /><meta name="twitter:image" content="${n}" /><meta name="twitter:card" content="summary_large_image" />`;
4152
+ }, t = (t) => [
4153
+ G,
4154
+ L.renderMetaToHtml(t) + e(L.renderMetaToHtml(t)),
4155
+ `<meta name="voltro-interactive" content="${A}" />`,
4156
+ ...U.hasDeferred ? [L.renderDeferredRegistryScript()] : [],
4157
+ L.renderRouterStateScript(U.stateInput)
4158
+ ].filter((e) => e.length > 0).join("\n "), n = {
4159
+ descriptor: R,
3655
4160
  params: h.params,
3656
4161
  pathname: d,
3657
4162
  search: f,
3658
- loaderData: V.loaderData,
3659
- segmentLoaderData: V.segmentLoaderData,
3660
- requestContext: R,
3661
- ...ie
4163
+ loaderData: U.loaderData,
4164
+ segmentLoaderData: U.segmentLoaderData,
4165
+ requestContext: z,
4166
+ ...oe
3662
4167
  };
3663
- if (w === "ssr" && D === "full" && p === void 0) Jr({
4168
+ if (T === "ssr" && A === "full" && p === void 0) Qi({
3664
4169
  res: c,
3665
- shell: Ur({
3666
- shell: H,
4170
+ shell: qi({
4171
+ shell: W,
3667
4172
  inlineModuleScriptsAsync: !0
3668
4173
  }),
3669
- documentAttrs: le,
4174
+ documentAttrs: ue,
3670
4175
  headers: {
3671
4176
  "content-type": "text/html; charset=utf-8",
3672
4177
  "x-voltro-rendered-by": "ssr-dev"
3673
4178
  },
3674
- headInjection: e,
3675
- render: (e) => I.renderPageToStream({
3676
- ...t,
4179
+ headInjection: t,
4180
+ render: (e) => L.renderPageToStream({
4181
+ ...n,
3677
4182
  ...e,
3678
- ...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce }
4183
+ ...M.cspNonce === void 0 ? {} : { nonce: M.cspNonce }
3679
4184
  }),
3680
4185
  onShellError: (e) => {
3681
- Ce(c, "ssr-dev", d, h.route.pattern, e, S);
4186
+ we(c, "ssr-dev", d, h.route.pattern, e, C);
3682
4187
  }
3683
4188
  });
3684
4189
  else {
3685
- let { html: n, meta: r } = I.renderPageToHtml(t), i = Kr(H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`), le);
3686
- c.statusCode = p === void 0 ? 200 : 422, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), p !== void 0 && c.setHeader("cache-control", "no-store");
3687
- let a = p === void 0 ? i : bt(i, p);
3688
- c.end(A.cspNonce === void 0 ? a : Qt(a, A.cspNonce));
4190
+ let { html: e, meta: r } = L.renderPageToHtml(n), i = Xi(W.replace("<div id=\"root\"></div>", `<div id="root">${e}</div>`).replace("</head>", ` ${t(r)}\n </head>`), ue);
4191
+ c.statusCode = p === void 0 ? g ? 404 : 200 : 422, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", g ? "ssr-not-found" : "ssr-dev"), p !== void 0 && c.setHeader("cache-control", "no-store");
4192
+ let o = p === void 0 ? i : Gt(i, p);
4193
+ if (P && p === void 0 && typeof w.loader == "function") {
4194
+ c.setHeader("x-voltro-ppr", "shell+holes"), c.write(o);
4195
+ let e = So(xo(a[0], { allowDevProxy: !0 }), M.headers.cookie, {
4196
+ apiName: a[0]?.name,
4197
+ headers: M.headers
4198
+ }), t = new AbortController();
4199
+ await Ra({
4200
+ loader: w.loader,
4201
+ ctx: {
4202
+ params: h.params,
4203
+ pathname: d,
4204
+ search: f,
4205
+ signal: t.signal,
4206
+ headers: M.headers,
4207
+ query: e,
4208
+ isServer: !0
4209
+ },
4210
+ res: c,
4211
+ helpers: L,
4212
+ page: h.route.pattern,
4213
+ log: Q
4214
+ });
4215
+ } else c.end(M.cspNonce === void 0 ? o : rr(o, M.cspNonce));
3689
4216
  }
3690
4217
  }
3691
- y.render = Date.now() - ce;
3692
- let W = Date.now() - v;
3693
- g ? (Se.add(h.route.pattern), Z.info(`ssr compiled ${h.route.pattern} in ${W}ms`, {
4218
+ b.render = Date.now() - K;
4219
+ let q = Date.now() - y;
4220
+ v ? (Ce.add(h.route.pattern), Q.info(`ssr compiled ${h.route.pattern} in ${q}ms`, {
3694
4221
  pattern: h.route.pattern,
3695
4222
  pathname: d,
3696
- elapsedMs: W,
4223
+ elapsedMs: q,
3697
4224
  cold: !0,
3698
- phases: y
3699
- })) : W > 200 && Z.info(`ssr rendered ${d} in ${W}ms`, {
4225
+ phases: b
4226
+ })) : q > 200 && Q.info(`ssr rendered ${d} in ${q}ms`, {
3700
4227
  pattern: h.route.pattern,
3701
4228
  pathname: d,
3702
- elapsedMs: W,
4229
+ elapsedMs: q,
3703
4230
  cold: !1,
3704
- phases: y
4231
+ phases: b
3705
4232
  });
3706
4233
  } catch (e) {
3707
- if (Kt(e)) {
3708
- Z.error("ssr-dev render refused", {
4234
+ if (Zn(e)) {
4235
+ Q.error("ssr-dev render refused", {
3709
4236
  pathname: d,
3710
4237
  pattern: h.route.pattern
3711
4238
  }, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
3712
4239
  return;
3713
4240
  }
3714
- let t = qt(e);
4241
+ let t = Qn(e);
3715
4242
  if (t) {
3716
4243
  c.statusCode = t.status;
3717
4244
  for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
3718
4245
  c.end(t.body);
3719
4246
  return;
3720
4247
  }
3721
- Ce(c, "ssr-dev", d, h.route.pattern, e, S);
4248
+ we(c, "ssr-dev", d, h.route.pattern, e, C);
3722
4249
  }
3723
4250
  });
3724
4251
  }
3725
- }, Ae = Date.now(), je = ne.version ?? "?", Me = await Oi(), Ne = O(e, "node_modules", "@voltro", "ui-shadcn"), q = M(O(Ne, "package.json")) ? Ne : null, Ie = [], Le = await (async () => {
4252
+ }, ke = Date.now(), Ae = j.version ?? "?", je = await Ua(), Ne = I(e, "node_modules", "@voltro", "ui-shadcn"), Pe = B(I(Ne, "package.json")) ? Ne : null, Fe = [], Ie = await (async () => {
3726
4253
  let t = [];
3727
4254
  for (let n of a) {
3728
- let r = await Yi(e, n.pkg);
4255
+ let r = await fo(e, n.pkg);
3729
4256
  r && t.push(r);
3730
4257
  }
3731
- let n = await ni(t);
4258
+ let n = await oa(t);
3732
4259
  if (n === void 0) return !1;
3733
- let r = O(L, ".voltro-rpcgroup-optimize"), i = "";
4260
+ let r = I(P, ".voltro-rpcgroup-optimize"), i = "";
3734
4261
  try {
3735
- i = (await N.readFile(r, "utf8")).trim();
4262
+ i = (await V.readFile(r, "utf8")).trim();
3736
4263
  } catch {}
3737
4264
  if (i === n) return !1;
3738
4265
  try {
3739
- await N.writeFile(r, n);
4266
+ await V.writeFile(r, n);
3740
4267
  } catch {}
3741
4268
  return !0;
3742
- })(), ze = /* @__PURE__ */ new Set(), Ve = (e) => {
3743
- ze.has(e.name) || (ze.add(e.name), Z.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
4269
+ })(), Re = /* @__PURE__ */ new Set(), ze = (e) => {
4270
+ Re.has(e.name) || (Re.add(e.name), Q.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
3744
4271
  cookie: e.name,
3745
4272
  hint: "If your IdP client reads this from `document.cookie` (Supabase's `createBrowserClient` does), pass `httpOnly: false`. Otherwise the SSR render succeeds and the user is signed out at the first client-side call. Set `httpOnly: true` explicitly to silence this."
3746
4273
  }));
3747
- }, J = await yi(e);
3748
- J.length > 0 && Z.info(`middleware.ts loaded — ${J.length} middleware(s): ` + J.map((e) => e.exportName).join(", ")), fi(J, F.ssrRoutes.map((e) => e.pattern)), Le && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
4274
+ }, Y = await Ca(e);
4275
+ Y.length > 0 && Q.info(`middleware.ts loaded — ${Y.length} middleware(s): ` + Y.map((e) => e.exportName).join(", ")), ga(Y, O.ssrRoutes.map((e) => e.pattern)), Ie && Q.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3749
4276
  try {
3750
- await We(l, "voltro dev (web)");
4277
+ await ht(l, "voltro dev (web)");
3751
4278
  } catch (e) {
3752
- Z.error(String(e.message ?? e)), process.exit(1);
4279
+ Q.error(String(e.message ?? e)), process.exit(1);
3753
4280
  }
3754
- await (await ne.createServer({
3755
- root: L,
4281
+ await (await j.createServer({
4282
+ root: P,
3756
4283
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3757
4284
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
3758
4285
  resolve: {
@@ -3763,131 +4290,137 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3763
4290
  "@voltro/i18n"
3764
4291
  ],
3765
4292
  alias: [
3766
- ...Me ? [{
4293
+ ...je ? [{
3767
4294
  find: "@voltro/devtools/styles.css",
3768
- replacement: O(Me, "src/styles.css")
4295
+ replacement: I(je, "src/styles.css")
3769
4296
  }, {
3770
4297
  find: "@voltro/devtools",
3771
- replacement: O(Me, "src/index.ts")
4298
+ replacement: I(je, "src/index.ts")
3772
4299
  }] : [],
3773
- ...q ? [
4300
+ ...Pe ? [
3774
4301
  {
3775
4302
  find: "@voltro/ui-shadcn/tokens.css",
3776
- replacement: O(q, "src/tokens.css")
4303
+ replacement: I(Pe, "src/tokens.css")
3777
4304
  },
3778
4305
  {
3779
4306
  find: "@voltro/ui-shadcn/cn",
3780
- replacement: O(q, "src/cn.ts")
4307
+ replacement: I(Pe, "src/cn.ts")
3781
4308
  },
3782
4309
  {
3783
4310
  find: "@voltro/ui-shadcn/brand",
3784
- replacement: O(q, "src/brand/voltroLogo.tsx")
4311
+ replacement: I(Pe, "src/brand/voltroLogo.tsx")
3785
4312
  },
3786
4313
  {
3787
4314
  find: "@voltro/ui-shadcn",
3788
- replacement: O(q, "src/index.ts")
4315
+ replacement: I(Pe, "src/index.ts")
3789
4316
  }
3790
4317
  ] : [],
3791
- ...pt(e)
4318
+ ...Rt(e)
3792
4319
  ]
3793
4320
  },
3794
4321
  optimizeDeps: {
3795
- include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3796
- force: Le
4322
+ include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Fe],
4323
+ force: Ie
3797
4324
  },
3798
- customLogger: dt(),
4325
+ customLogger: It(),
3799
4326
  plugins: [
3800
- hr(O(e, "src", "pages")),
3801
- re(),
3802
- I(),
3803
- B,
3804
- se,
4327
+ yi(I(e, "src", "pages")),
4328
+ Cn({
4329
+ root: e,
4330
+ config: D(n.images)
4331
+ }),
4332
+ On(e, n.fonts),
4333
+ Rn(e, n.feeds ?? [], n.seo?.siteUrl),
4334
+ M(),
4335
+ N(),
4336
+ oe,
4337
+ W,
3805
4338
  pe,
3806
- he,
3807
4339
  ge,
3808
- ye,
3809
- ke,
3810
- ...be ? [be] : []
4340
+ _e,
4341
+ be,
4342
+ Oe,
4343
+ ...Se ? [Se] : []
3811
4344
  ],
3812
4345
  server: {
3813
4346
  port: l,
3814
4347
  strictPort: !0,
3815
4348
  host: !0,
3816
4349
  allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
3817
- proxy: K,
3818
- fs: { allow: [e, ...Pi(e)] }
4350
+ proxy: ve,
4351
+ fs: { allow: [e, ...Ya(e)] }
3819
4352
  },
3820
4353
  appType: "spa",
3821
- cacheDir: O(L, ".vite"),
3822
- publicDir: O(e, "public")
3823
- })).listen(), Ei.info(`v${je} ready in ${Date.now() - Ae}ms`, {
3824
- version: je,
3825
- bootMs: Date.now() - Ae
3826
- }), Z.info(`listening on http://localhost:${l}`, {
4354
+ cacheDir: I(P, ".vite"),
4355
+ publicDir: I(e, "public")
4356
+ })).listen(), Ba.info(`v${Ae} ready in ${Date.now() - ke}ms`, {
4357
+ version: Ae,
4358
+ bootMs: Date.now() - ke
4359
+ }), Q.info(`listening on http://localhost:${l}`, {
3827
4360
  port: l,
3828
4361
  app: n.name ?? "(unnamed)"
3829
4362
  });
3830
- for (let e of a) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
4363
+ for (let e of a) e.proxyTarget && (Q.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3831
4364
  api: e.name,
3832
4365
  target: e.proxyTarget
3833
- }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
4366
+ }), Q.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3834
4367
  try {
3835
- await x({
3836
- id: b,
3837
- name: y,
4368
+ await ee({
4369
+ id: x,
4370
+ name: b,
3838
4371
  kind: "web",
3839
4372
  url: `http://localhost:${l}`,
3840
4373
  pid: process.pid,
3841
4374
  status: "live",
3842
- logFile: D.path
4375
+ logFile: S.path
3843
4376
  });
3844
- let t = yr(e);
4377
+ let t = Ci(e);
3845
4378
  if (t) {
3846
- let e = await kr({ dashboardAppPath: t });
3847
- e.status === "launched" ? Z.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Z.debug(`dashboard already running on :${e.port}`, { port: e.port });
4379
+ let e = await Ni({ dashboardAppPath: t });
4380
+ e.status === "launched" ? Q.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Q.debug(`dashboard already running on :${e.port}`, { port: e.port });
3848
4381
  }
3849
4382
  setInterval(() => {
3850
- x({
3851
- id: b,
3852
- name: y,
4383
+ ee({
4384
+ id: x,
4385
+ name: b,
3853
4386
  kind: "web",
3854
4387
  url: `http://localhost:${l}`,
3855
4388
  pid: process.pid,
3856
4389
  status: "live",
3857
- logFile: D.path
4390
+ logFile: S.path
3858
4391
  }).catch(() => {});
3859
4392
  }, 1e4).unref();
3860
4393
  let n = () => {
3861
- C(b), D.dispose();
4394
+ ne(x), S.dispose();
3862
4395
  };
3863
4396
  process.on("SIGINT", n), process.on("SIGTERM", n);
3864
4397
  } catch (e) {
3865
- Z.warn("runtime-registry write failed", {}, e);
4398
+ Q.warn("runtime-registry write failed", {}, e);
3866
4399
  }
3867
- return z({
4400
+ return ue({
3868
4401
  app: n.name ?? "unnamed",
3869
4402
  kind: "web",
3870
4403
  url: `http://localhost:${l}`,
3871
- bootMs: Date.now() - Ae
4404
+ bootMs: Date.now() - ke
3872
4405
  }), new Promise(() => {});
3873
- }, fa = async (t) => {
4406
+ }, Ao = async (t) => {
3874
4407
  e("serve");
3875
- let n = await ua(t);
4408
+ let n = await Do(t);
3876
4409
  if (!n) return {
3877
4410
  ran: !1,
3878
4411
  exitCode: 0
3879
4412
  };
3880
- let i = Date.now(), a = Z.child("serve");
4413
+ let i = Date.now(), a = Q.child("serve");
3881
4414
  a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
3882
- let o = await ea(t, n);
4415
+ let o = await _o(t, n);
3883
4416
  for (let e of o) a.info("api wired", {
3884
4417
  name: e.name,
3885
4418
  pkg: e.pkg
3886
4419
  });
3887
- await sa(t, n, o);
4420
+ await wo(t, n, o);
3888
4421
  {
3889
- let { pages: e } = await $(O(t, "src", "pages"));
3890
- await un({
4422
+ let { pages: e } = await ro(I(t, "src", "pages"));
4423
+ await mr({
3891
4424
  appRoot: t,
3892
4425
  pages: e
3893
4426
  });
@@ -3896,12 +4429,12 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3896
4429
  kind: "web",
3897
4430
  configPort: n.port,
3898
4431
  env: process.env
3899
- }).port, c = await De("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
3900
- Z.info("running production build"), await c.build({
4432
+ }).port, c = await Xe("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = I(t, ".framework");
4433
+ Q.info("running production build"), await c.build({
3901
4434
  root: u,
3902
4435
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3903
4436
  plugins: [l()],
3904
- customLogger: dt(),
4437
+ customLogger: It(),
3905
4438
  resolve: { dedupe: [
3906
4439
  "react",
3907
4440
  "react-dom",
@@ -3910,9 +4443,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3910
4443
  ] },
3911
4444
  build: {
3912
4445
  outDir: "dist",
3913
- rollupOptions: { output: { manualChunks: Ii } }
4446
+ rollupOptions: { output: { manualChunks: Za } }
3914
4447
  },
3915
- publicDir: O(t, "public")
4448
+ publicDir: I(t, "public")
3916
4449
  });
3917
4450
  let d = (await c.preview({
3918
4451
  root: u,
@@ -3923,7 +4456,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3923
4456
  label: "Local",
3924
4457
  url: e
3925
4458
  })) ?? [];
3926
- return z({
4459
+ return ue({
3927
4460
  app: n.name ?? "unnamed",
3928
4461
  kind: "preview",
3929
4462
  url: f,
@@ -3932,4 +4465,4 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
3932
4465
  }), new Promise(() => {});
3933
4466
  };
3934
4467
  //#endregion
3935
- export { Kt as $, ui as A, De as At, yr as B, wi as C, Le as Ct, di as D, Pe as Dt, yi as E, Ie as Et, Ur as F, In as G, Xn as H, Jr as I, vn as J, jn as K, br as L, Zr as M, Kr as N, pi as O, Me as Ot, Wr as P, un as Q, vr as R, Ti as S, Be as St, vi as T, Fe as Tt, Kn as U, tr as V, Wn as W, gn as X, bn as Y, hn as Z, da as _, et as _t, aa as a, Qt as at, $ as b, nt as bt, Hi as c, Ht as ct, Vi as d, xe as dt, Jt as et, ua as f, Dt as ft, na as g, Qe as gt, Qi as h, pt as ht, oa as i, $t as it, _i as j, bi as k, je as kt, Bi as l, Rt as lt, Zi as m, mt, ia as n, Xt as nt, Ui as o, Wt as ot, ea as p, gt as pt, yn as q, $i as r, Zt as rt, la as s, zt as st, Li as t, Yt as tt, Q as u, Vt as ut, fa as v, $e as vt, fi as w, Re as wt, sa as x, We as xt, Ii as y, tt as yt, kr as z };
4468
+ export { Fr as $, Oa as A, Vt as At, Xi as B, st as Bt, wo as C, gn as Ct, Fa as D, pn as Dt, La as E, un as Et, _a as F, wt as Ft, Si as G, tt as Gt, qi as H, at as Ht, wa as I, Et as It, ai as J, Ni as K, et as Kt, ma as L, Dt as Lt, Sa as M, Rt as Mt, Ca as N, Ct as Nt, Pa as O, Le as Ot, ha as P, Tt as Pt, Br as Q, xa as R, ht as Rt, Oo as S, Cn as St, za as T, mn as Tt, Qi as U, ot as Ut, Ji as V, ct as Vt, wi as W, rt as Wt, Xr as X, ei as Y, Jr as Z, yo as _, Wn as _t, Co as a, mr as at, Za as b, An as bt, Eo as c, er as ct, $ as d, ir as dt, Cr as et, no as f, rr as ft, ho as g, Un as gt, mo as h, qn as ht, Ha as i, yr as it, ga as j, zt as jt, ka as k, Qt as kt, io as l, tr as lt, _o as m, Yn as mt, xo as n, wr as nt, So as o, Zn as ot, Do as p, Jn as pt, Ci as q, Xe as qt, go as r, br as rt, ao as s, $n as st, Qa as t, Sr as tt, to as u, nr as ut, ko as v, Fn as vt, Ra as w, dn as wt, ro as x, En as xt, Ao as y, Mn as yt, ta as z, ut as zt };