@voltro/cli 0.38.0 → 0.39.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 (170) hide show
  1. package/CHANGELOG.md +224 -0
  2. package/THIRD-PARTY-NOTICES.md +80 -45
  3. package/dist/{addCommand-BNeoeSxe.js → addCommand-C05L9tZh.js} +2 -2
  4. package/dist/addCommand-C3MdJG-a.js +2 -0
  5. package/dist/{agentsMd-mhQMF1bx.js → agentsMd-7zI2h5l9.js} +3 -3
  6. package/dist/agentsMd-BFCXh2gl.js +2 -0
  7. package/dist/apiBuild-2GvK8CUB.js +2 -0
  8. package/dist/{apiBuild-CvacV4zA.js → apiBuild-DGalUk9v.js} +3 -3
  9. package/dist/baselineCommand-CXv680Dc.js +2 -0
  10. package/dist/{baselineCommand-C6NMt-oa.js → baselineCommand-Ck2Xm8M7.js} +18 -18
  11. package/dist/bin.js +1 -1
  12. package/dist/{build-_LoTC1s0.js → build-CfF6t0UM.js} +107 -100
  13. package/dist/{capabilitiesCommand-nq_pz5xd.js → capabilitiesCommand-D5gucwYa.js} +8 -8
  14. package/dist/{checkCommand-wibtQx-N.js → checkCommand-BV56Pcc1.js} +1 -1
  15. package/dist/{checkCommand-Pjk5sBl2.js → checkCommand-CBtynBKW.js} +34 -34
  16. package/dist/{cloudCmd-NQSwe_Qk.js → cloudCmd-C42gaO8s.js} +16 -16
  17. package/dist/{clusterCmd-D5wsCmA_.js → clusterCmd-DrVFCzSj.js} +8 -4
  18. package/dist/{codegen-GYYcdpCg.js → codegen-CbpGCWLG.js} +1 -1
  19. package/dist/codegen-i8QGcHsi.js +2 -0
  20. package/dist/codegenCommand-W7SDdiAQ.js +129 -0
  21. package/dist/{codemodRunner-CXgQ-ecJ.js → codemodRunner-D-jTyvWo.js} +622 -551
  22. package/dist/{commands-DaZVi9wi.js → commands-BD9eBRY3.js} +48 -48
  23. package/dist/{connectionConfig-UFlIEiys.js → connectionConfig-Bk9IC7D0.js} +1 -1
  24. package/dist/{dashboardCommand-Dxy_kmoW.js → dashboardCommand-7qGylm0F.js} +3 -3
  25. package/dist/{dataCommand-D6-Ha2lf.js → dataCommand-C_F2DYxe.js} +14 -11
  26. package/dist/{dbCommand-C4UW8cVN.js → dbCommand-DSwGv9wS.js} +50 -49
  27. package/dist/dbCommand-DcqEyxju.js +2 -0
  28. package/dist/dev-alhkKoEX.js +3 -0
  29. package/dist/{dev-E7Eo5GHc.js → dev-gqpnzVhI.js} +2260 -2184
  30. package/dist/{dialectDriver-CgXnDfec.js → dialectDriver-czCHYpeH.js} +2 -1
  31. package/dist/{doctorCommand-gmDyALFL.js → doctorCommand-Bvs-BQrM.js} +242 -238
  32. package/dist/doctorCommand-CVXfRrng.js +2 -0
  33. package/dist/{dormancyCommand-CE6wG8lj.js → dormancyCommand-B-PPHc9Q.js} +1 -1
  34. package/dist/{e2eCmd-BRabZww-.js → e2eCmd-uFHig1hV.js} +8 -2
  35. package/dist/{embeddingsCommand-C3uAuf6N.js → embeddingsCommand-OKY6XjUf.js} +6 -6
  36. package/dist/{envCommand-DzuWh8ya.js → envCommand-B1-Zm85H.js} +19 -19
  37. package/dist/{evolveCommand-DPLqcYb2.js → evolveCommand-C4-NlFbd.js} +6 -8
  38. package/dist/{generateCommand-DbgcUpGw.js → generateCommand-CcyvH2ve.js} +1 -1
  39. package/dist/index.js +1 -1
  40. package/dist/{infoCommand-CmczGj_l.js → infoCommand-CTo8Jnhq.js} +7 -7
  41. package/dist/inspect-B7U7Cl_Z.js +1192 -0
  42. package/dist/inspect-DUze25t0.js +2 -0
  43. package/dist/{inspectCmd-EHFZ9yYu.js → inspectCmd-niF97fAq.js} +5 -5
  44. package/dist/inspectGateHint-BjnFubmH.js +7 -0
  45. package/dist/{logFileSink-C_D2wRN1.js → logFileSink-B4uP8pvf.js} +1 -1
  46. package/dist/{logsCmd-D36xK7Zu.js → logsCmd-B6oNsfaZ.js} +10 -7
  47. package/dist/{manifestBuild-hpPLaGxV.js → manifestBuild-BK42hu0k.js} +1 -1
  48. package/dist/manifestBuild-j0n109tt.js +2 -0
  49. package/dist/{metaCommands-CIoQNlaQ.js → metaCommands-DUYR--Ts.js} +1 -1
  50. package/dist/{migrate-RwgUWXfc.js → migrate-BnPw2zC8.js} +7 -4
  51. package/dist/{packageCommand-Cug_3Ogl.js → packageCommand-9SVyvsSo.js} +3 -2
  52. package/dist/{probeCommand-BPEpwT32.js → probeCommand-C9gazU0H.js} +35 -24
  53. package/dist/{projectScaffold-CxgtJvlb.js → projectScaffold-BEhhHjPr.js} +1 -1
  54. package/dist/{projectScaffold-DDgWbNLe.js → projectScaffold-BvhLOrLq.js} +17 -15
  55. package/dist/{runtimeTrace-6jfznSzr.js → runtimeTrace-DzZOCd94.js} +1 -1
  56. package/dist/{scheduleManifestCmd-D2x0CTTY.js → scheduleManifestCmd-kmWzrO_w.js} +6 -9
  57. package/dist/{sdkgen-CEJZZQUA.js → sdkgen-C4roLErM.js} +4 -4
  58. package/dist/{seedRunner-ZmLSqNe2.js → seedRunner-IdHEprqf.js} +1 -4
  59. package/dist/serveCommand-B6TATyCj.js +1770 -0
  60. package/dist/serveCommand-CNR0gI9V.js +2 -0
  61. package/dist/serveEntry.js +2 -2
  62. package/dist/{serverlessCommand-CfJZy6dS.js → serverlessCommand-DbJ7Plg9.js} +3 -3
  63. package/dist/{start-CidwCcjl.js → start-BNuTWdRd.js} +1 -1
  64. package/dist/{start-RCh6qKFe.js → start-ft_KzFTd.js} +257 -254
  65. package/dist/startEntry.js +1 -1
  66. package/dist/{test-DIQ0jlkQ.js → test-CLYXrZ2F.js} +1 -1
  67. package/dist/{tracesCmd-DStmCJPi.js → tracesCmd-DgtgOUdi.js} +7 -4
  68. package/dist/{typecheckCommand-BlsWiCNq.js → typecheckCommand-BuCtT92o.js} +7 -7
  69. package/dist/updateCommand-6FMU2klq.js +2 -0
  70. package/dist/{updateCommand-CmksX7m_.js → updateCommand-CHBmCB17.js} +5 -3
  71. package/dist/{webDev-BKdD7c_a.js → webDev-CTpSY-e_.js} +813 -775
  72. package/dist/webDev-id3I5PvG.js +2 -0
  73. package/dist/{webhookDiscovery-D7VaeMlz.js → webhookDiscovery-CphsQe59.js} +4 -6
  74. package/dist/{webhookDiscovery-CrGAfhIG.js → webhookDiscovery-il9ti-HE.js} +1 -1
  75. package/dist/{webhooksCommand-BHeaF1ZJ.js → webhooksCommand-BVvOtZ1B.js} +1 -1
  76. package/package.json +27 -21
  77. package/templates/AGENTS.md +2 -2
  78. package/templates/agent-docs/_index.md +2 -2
  79. package/templates/agent-docs/_manifest.json +2 -2
  80. package/templates/agent-docs/authentication.md +30 -0
  81. package/templates/agent-docs/cli.md +17 -13
  82. package/templates/agent-docs/data.md +44 -1
  83. package/templates/agent-docs/database/migrations.md +2 -2
  84. package/templates/agent-docs/database/seedsdialects.md +2 -2
  85. package/templates/agent-docs/deployment.md +21 -7
  86. package/templates/agent-docs/internationalization.md +10 -3
  87. package/templates/agent-docs/local-first-mobile.md +141 -20
  88. package/templates/agent-docs/plugins/mail.md +1 -1
  89. package/templates/agent-docs/plugins/ratelimit.md +1 -1
  90. package/templates/agent-docs/plugins.md +3 -1
  91. package/templates/agent-docs/releases.md +130 -1
  92. package/templates/agent-docs/routing.md +34 -2
  93. package/templates/agent-docs/templates/apibackends.md +1 -1
  94. package/templates/agent-docs/templates/mobile.md +1 -1
  95. package/templates/agent-docs/whats-new.md +181 -49
  96. package/templates/apps/api-ai/package.json +7 -7
  97. package/templates/apps/api-auth/package.json +8 -8
  98. package/templates/apps/api-backend/package.json +7 -7
  99. package/templates/apps/api-backend-deactivation/package.json +7 -7
  100. package/templates/apps/api-backend-mail/package.json +8 -8
  101. package/templates/apps/api-backend-mariadb/package.json +9 -9
  102. package/templates/apps/api-backend-sqlite/package.json +8 -8
  103. package/templates/apps/api-backend-storage/package.json +8 -8
  104. package/templates/apps/api-cms/package.json +10 -10
  105. package/templates/apps/api-collab/package.json +8 -8
  106. package/templates/apps/api-data-advanced/package.json +8 -8
  107. package/templates/apps/api-durable/package.json +8 -8
  108. package/templates/apps/api-feature-flags/package.json +9 -9
  109. package/templates/apps/api-governance/package.json +8 -8
  110. package/templates/apps/api-kv/package.json +8 -8
  111. package/templates/apps/api-moderation/package.json +8 -8
  112. package/templates/apps/api-observability/package.json +8 -8
  113. package/templates/apps/api-ratelimit/package.json +8 -8
  114. package/templates/apps/api-rbac/authz.ts +16 -1
  115. package/templates/apps/api-rbac/package.json +8 -8
  116. package/templates/apps/api-rest/package.json +7 -7
  117. package/templates/apps/api-saas/package.json +11 -11
  118. package/templates/apps/api-saas-starter/package.json +10 -10
  119. package/templates/apps/api-search/package.json +8 -8
  120. package/templates/apps/api-status/package.json +8 -8
  121. package/templates/apps/api-versioning/package.json +8 -8
  122. package/templates/apps/api-webhooks/package.json +9 -9
  123. package/templates/apps/changelog/package.json +6 -6
  124. package/templates/apps/edge-functions/package.json +2 -2
  125. package/templates/apps/frontend-admin/package.json +8 -8
  126. package/templates/apps/frontend-app/package.json +9 -9
  127. package/templates/apps/frontend-auth/package.json +8 -8
  128. package/templates/apps/frontend-blank/package.json +7 -7
  129. package/templates/apps/frontend-cms/package.json +9 -9
  130. package/templates/apps/frontend-collab/package.json +10 -10
  131. package/templates/apps/frontend-contact/package.json +7 -7
  132. package/templates/apps/frontend-dashboard/package.json +7 -7
  133. package/templates/apps/frontend-docs/package.json +7 -7
  134. package/templates/apps/frontend-i18n/package.json +6 -6
  135. package/templates/apps/frontend-landing/package.json +7 -7
  136. package/templates/apps/frontend-portal/package.json +8 -8
  137. package/templates/apps/frontend-saas/package.json +8 -8
  138. package/templates/apps/frontend-spa/package.json +7 -7
  139. package/templates/apps/frontend-ssr/package.json +7 -7
  140. package/templates/apps/frontend-ssr-api/package.json +8 -8
  141. package/templates/apps/frontend-static-blog/package.json +6 -6
  142. package/templates/apps/frontend-status/package.json +8 -8
  143. package/templates/apps/mobile-app/README.md +41 -17
  144. package/templates/apps/mobile-app/app.config.ts +1 -1
  145. package/templates/apps/mobile-app/package.json +15 -11
  146. package/templates/apps/mobile-app/src/app/_layout.tsx +44 -13
  147. package/templates/apps/mobile-app/src/app/index.tsx +1 -1
  148. package/templates/apps/mobile-app/src/app/settings.tsx +4 -1
  149. package/templates/apps/mobile-app/src/client.ts +74 -57
  150. package/templates/apps/mobile-app/src/lib/api.ts +4 -4
  151. package/templates/apps/mobile-app/src/lib/deeplinks.ts +6 -6
  152. package/templates/apps/mobile-app/src/persistence.ts +24 -3
  153. package/templates/apps/mobile-app/tsconfig.json +17 -3
  154. package/dist/addCommand-aXSQveak.js +0 -2
  155. package/dist/agentsMd-BTchIZku.js +0 -2
  156. package/dist/apiBuild-ttSDDOGp.js +0 -2
  157. package/dist/baselineCommand-Cfw2Afwm.js +0 -2
  158. package/dist/codegen-uYrrDzQv.js +0 -2
  159. package/dist/codegenCommand-C60m_LCp.js +0 -30
  160. package/dist/dbCommand-CC-qNzpz.js +0 -2
  161. package/dist/dev-CAOoXOkc.js +0 -3
  162. package/dist/doctorCommand-Cjl8Yii8.js +0 -2
  163. package/dist/inspect-CjTYzAs_.js +0 -1190
  164. package/dist/inspect-P4pxoMaV.js +0 -2
  165. package/dist/inspectGateHint-BF6608UT.js +0 -4
  166. package/dist/manifestBuild-COkJoyAr.js +0 -2
  167. package/dist/serveCommand-DNRF2nDI.js +0 -2
  168. package/dist/serveCommand-DnY4VS3D.js +0 -1767
  169. package/dist/updateCommand-B0J_T9Vs.js +0 -2
  170. package/dist/webDev-CcJfdSjl2.js +0 -2
@@ -2,39 +2,39 @@ 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 { h as i, m as a } from "./fileConventions-Cof68_BL.js";
6
- import { A as o, D as s, a as c, h as l, j as u, k as d } from "./inspect-CjTYzAs_.js";
7
- import { n as f } from "./agentsMd-mhQMF1bx.js";
8
- import { c as p, p as m, t as h } from "./renderModeScan-D7J1B7Kw.js";
9
- import { t as g } from "./pageConvention-cEiRxdab.js";
10
- import { i as _, n as v, r as y, t as b } from "./runtimeRegistry-DMeKfTHP.js";
11
- import { n as x } from "./logFileSink-C_D2wRN1.js";
12
- import { basename as S, dirname as C, join as w, relative as T, resolve as E } from "node:path";
13
- import { existsSync as D, promises as O, readFileSync as k, readdirSync as A, statSync as j, unwatchFile as M, watchFile as N } from "node:fs";
14
- import { fileURLToPath as P, pathToFileURL as F } from "node:url";
15
- import { addSink as I, createLogger as L, printReadyBlock as R } from "@voltro/logger";
16
- import { createRequire as ee } from "node:module";
17
- import { homedir as z } from "node:os";
18
- import { currentTraceContext as B, resolveSecret as V } from "@voltro/runtime";
19
- import { FRAMEWORK_ENV_CATALOG as te, appEnvEntries as H, checkEnvNaming as ne, formatEnvErrors as U, installEnvSnapshot as re, isEnvContract as W, pluginEnvEntries as ie, renderDotEnvExample as ae, resolveEnv as oe } from "@voltro/env";
20
- import { __installPublicEnv as G } from "@voltro/env/public";
21
- import { mkdir as se, writeFile as ce } from "node:fs/promises";
22
- import { createHash as le } from "node:crypto";
23
- import { spawn as ue } from "node:child_process";
24
- import { createConnection as K } from "node:net";
25
- import { PassThrough as de } from "node:stream";
5
+ import { A as i, _ as a, g as o, h as s, m as c, o as l } from "./fileConventions-Cof68_BL.js";
6
+ import { A as u, D as d, a as f, h as p, j as m, k as h } from "./inspect-B7U7Cl_Z.js";
7
+ import { n as g } from "./agentsMd-7zI2h5l9.js";
8
+ import { c as _, p as v, t as y } from "./renderModeScan-D7J1B7Kw.js";
9
+ import { t as b } from "./pageConvention-cEiRxdab.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 } from "node:path";
13
+ import { existsSync as j, promises as M, readFileSync as N, readdirSync as P, statSync as F, unwatchFile as I, watchFile as L } from "node:fs";
14
+ import { fileURLToPath as R, pathToFileURL as z } from "node:url";
15
+ import { addSink as B, createLogger as V, printReadyBlock as ee } from "@voltro/logger";
16
+ import { createRequire as te } from "node:module";
17
+ import { homedir as H } from "node:os";
18
+ import { currentTraceContext as U, resolveSecret as W } from "@voltro/runtime";
19
+ import { FRAMEWORK_ENV_CATALOG as ne, appEnvEntries as G, checkEnvNaming as re, formatEnvErrors as ie, installEnvSnapshot as K, isEnvContract as ae, pluginEnvEntries as oe, renderDotEnvExample as se, resolveEnv as ce } from "@voltro/env";
20
+ import { __installPublicEnv as le } from "@voltro/env/public";
21
+ import { mkdir as ue, writeFile as de } from "node:fs/promises";
22
+ import { createHash as q } from "node:crypto";
23
+ import { spawn as fe } from "node:child_process";
24
+ import { createConnection as pe } from "node:net";
25
+ import { PassThrough as me } from "node:stream";
26
26
  //#region src/buildToolImport.ts
27
- var fe = (e) => {
27
+ var J = (e) => {
28
28
  let t = e;
29
29
  return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
30
- }, pe = async (e, t) => {
30
+ }, he = async (e, t) => {
31
31
  try {
32
32
  return await t();
33
33
  } catch (t) {
34
- throw fe(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;
34
+ throw J(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;
35
35
  }
36
- }, me = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", q = (e, t) => t ? `${e} | undefined` : e, he = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${q(t.tsType, t.optional)}`).join("\n"), ge = async (e, t) => {
37
- let n = he(t, () => !0), r = `${me}
36
+ }, ge = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", _e = (e, t) => t ? `${e} | undefined` : e, ve = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${_e(t.tsType, t.optional)}`).join("\n"), ye = async (e, t) => {
37
+ let n = ve(t, () => !0), r = `${ge}
38
38
  import '@voltro/env/server'
39
39
 
40
40
  declare module '@voltro/env/server' {
@@ -43,9 +43,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
43
43
  }
44
44
  }
45
45
  `;
46
- await ce(w(e, "env.generated.d.ts"), r, "utf8");
47
- }, J = async (e, t) => {
48
- let n = he(t, (e) => e === "public"), r = `${me}
46
+ await de(O(e, "env.generated.d.ts"), r, "utf8");
47
+ }, be = async (e, t) => {
48
+ let n = ve(t, (e) => e === "public"), r = `${ge}
49
49
  import '@voltro/env/public'
50
50
 
51
51
  declare module '@voltro/env/public' {
@@ -53,10 +53,10 @@ declare module '@voltro/env/public' {
53
53
  ${n.length > 0 ? n : " // (no public variables declared)"}
54
54
  }
55
55
  }
56
- `, i = w(e, "src");
57
- await se(i, { recursive: !0 }), await ce(w(i, "voltro-env.d.ts"), r, "utf8");
58
- }, _e = async (e, t) => {
59
- let n = `${me}
56
+ `, i = O(e, "src");
57
+ await ue(i, { recursive: !0 }), await de(O(i, "voltro-env.d.ts"), r, "utf8");
58
+ }, xe = async (e, t) => {
59
+ let n = `${ge}
60
60
  import { __installPublicEnv } from '@voltro/env/public'
61
61
 
62
62
  export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
@@ -64,14 +64,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
64
64
  // Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
65
65
  __installPublicEnv(publicEnvValues)
66
66
  `;
67
- await se(e, { recursive: !0 }), await ce(w(e, "env.public.ts"), n, "utf8");
68
- }, ve = async (e) => {
69
- let t = W(e.rawEnv) ? e.rawEnv : void 0, n = await oe({
67
+ await ue(e, { recursive: !0 }), await de(O(e, "env.public.ts"), n, "utf8");
68
+ }, Se = async (e) => {
69
+ let t = ae(e.rawEnv) ? e.rawEnv : void 0, n = await ce({
70
70
  contract: t,
71
- resolveSecret: V
72
- }), r = [...n.errors, ...ne(t, e.appType)];
73
- if (r.length > 0) throw Error(U(r));
74
- re(n.values), e.appType === "web" && G(n.publicValues);
71
+ resolveSecret: W
72
+ }), r = [...n.errors, ...re(t, e.appType)];
73
+ if (r.length > 0) throw Error(ie(r));
74
+ K(n.values), e.appType === "web" && le(n.publicValues);
75
75
  let i = t ? Object.keys(t.vars).length : 0;
76
76
  if (i > 0) {
77
77
  let r = Object.keys(n.publicValues).length;
@@ -83,20 +83,20 @@ __installPublicEnv(publicEnvValues)
83
83
  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 });
84
84
  }
85
85
  }
86
- return e.generateTypes && t && (e.appType === "api" ? await ge(e.root, t) : await J(e.root, t)), {
86
+ return e.generateTypes && t && (e.appType === "api" ? await ye(e.root, t) : await be(e.root, t)), {
87
87
  resolved: n,
88
88
  contract: t
89
89
  };
90
- }, ye = (e) => {
91
- let t = H(e.contract), n = (e.plugins ?? []).flatMap((e) => ie(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : te, i = /* @__PURE__ */ new Set(), a = [];
90
+ }, Ce = (e) => {
91
+ let t = G(e.contract), n = (e.plugins ?? []).flatMap((e) => oe(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ne, i = /* @__PURE__ */ new Set(), a = [];
92
92
  for (let e of [
93
93
  ...t,
94
94
  ...n,
95
95
  ...r
96
96
  ]) i.has(e.key) || (i.add(e.key), a.push(e));
97
97
  return a;
98
- }, be = (e, t, n = (e) => process.env[e]) => {
99
- let r = ye(t).map((e) => {
98
+ }, we = (e, t, n = (e) => process.env[e]) => {
99
+ let r = Ce(t).map((e) => {
100
100
  let t = n(e.key) !== void 0;
101
101
  return {
102
102
  ...e,
@@ -113,30 +113,33 @@ __installPublicEnv(publicEnvValues)
113
113
  missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
114
114
  }
115
115
  };
116
- }, xe = (e, t) => ae(ye({
117
- ...e,
118
- includeFramework: !1
119
- }), {
120
- includeFramework: e.includeFramework !== !1,
121
- ...t ? { header: t } : {}
122
- }), Se = async (e, t) => {
116
+ }, Te = (e, t) => {
117
+ let n = Ce({
118
+ ...e,
119
+ includeFramework: !1
120
+ });
121
+ return se(n, {
122
+ includeFramework: e.includeFramework !== !1,
123
+ ...t ? { header: t } : {}
124
+ });
125
+ }, Ee = async (e, t) => {
123
126
  let n = e;
124
127
  for (;;) {
125
- let e = w(n, "node_modules", t);
128
+ let e = O(n, "node_modules", t);
126
129
  try {
127
- if ((await O.stat(e)).isDirectory()) {
128
- let t = await O.realpath(e);
130
+ if ((await M.stat(e)).isDirectory()) {
131
+ let t = await M.realpath(e);
129
132
  return t.includes("/node_modules/") ? null : t;
130
133
  }
131
134
  } catch {}
132
- let r = C(n);
135
+ let r = D(n);
133
136
  if (r === n) return null;
134
137
  n = r;
135
138
  }
136
- }, Ce = async (e) => {
139
+ }, De = async (e) => {
137
140
  let t;
138
141
  try {
139
- let n = await O.readFile(w(e, "package.json"), "utf8"), r = JSON.parse(n);
142
+ let n = await M.readFile(O(e, "package.json"), "utf8"), r = JSON.parse(n);
140
143
  t = Object.keys({
141
144
  ...r.dependencies,
142
145
  ...r.devDependencies
@@ -145,11 +148,11 @@ __installPublicEnv(publicEnvValues)
145
148
  return [];
146
149
  }
147
150
  return (await Promise.all(t.map(async (t) => {
148
- let n = await Se(e, t);
151
+ let n = await Ee(e, t);
149
152
  if (n === null) return null;
150
- let r = w(n, "src");
153
+ let r = O(n, "src");
151
154
  try {
152
- if (!(await O.stat(r)).isDirectory()) return null;
155
+ if (!(await M.stat(r)).isDirectory()) return null;
153
156
  } catch {
154
157
  return null;
155
158
  }
@@ -158,11 +161,11 @@ __installPublicEnv(publicEnvValues)
158
161
  dir: r
159
162
  };
160
163
  }))).filter((e) => e !== null);
161
- }, we = 500, Te = (e, t, n = {}) => {
164
+ }, Oe = 500, ke = (e, t, n = {}) => {
162
165
  if (e.length === 0) return () => {};
163
- let r = (e) => n.root ? T(n.root, e) : e, i = !1, a = (e) => {
166
+ let r = (e) => n.root ? k(n.root, e) : e, i = !1, a = (e) => {
164
167
  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(() => {
165
- let e = ue(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
168
+ let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
166
169
  stdio: "inherit",
167
170
  env: process.env,
168
171
  cwd: n.cwd ?? process.cwd()
@@ -176,22 +179,22 @@ __installPublicEnv(publicEnvValues)
176
179
  });
177
180
  }));
178
181
  };
179
- for (let t of e) N(t, { interval: we }, (e, n) => {
182
+ for (let t of e) L(t, { interval: Oe }, (e, n) => {
180
183
  e.mtimeMs !== n.mtimeMs && a(t);
181
184
  });
182
185
  return t.info("watching .env files for changes", {
183
186
  files: e.map(r),
184
- intervalMs: we
187
+ intervalMs: Oe
185
188
  }), () => {
186
- for (let t of e) M(t);
189
+ for (let t of e) I(t);
187
190
  };
188
- }, Ee = [{
191
+ }, Ae = [{
189
192
  host: "127.0.0.1",
190
193
  family: "IPv4"
191
194
  }, {
192
195
  host: "::1",
193
196
  family: "IPv6"
194
- }], De = (e, t, n) => new Promise((r) => {
197
+ }], je = (e, t, n) => new Promise((r) => {
195
198
  let i = !1, a = (e) => {
196
199
  if (!i) {
197
200
  i = !0;
@@ -200,15 +203,15 @@ __installPublicEnv(publicEnvValues)
200
203
  } catch {}
201
204
  r(e);
202
205
  }
203
- }, o = K({
206
+ }, o = pe({
204
207
  host: e,
205
208
  port: t
206
209
  });
207
210
  o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
208
- }), Oe = async (e, t = 400) => ({ families: (await Promise.all(Ee.map(async (n) => ({
211
+ }), Me = async (e, t = 400) => ({ families: (await Promise.all(Ae.map(async (n) => ({
209
212
  family: n.family,
210
- taken: await De(n.host, e, t)
211
- })))).filter((e) => e.taken).map((e) => e.family) }), ke = (e, t, n) => [
213
+ taken: await je(n.host, e, t)
214
+ })))).filter((e) => e.taken).map((e) => e.family) }), Ne = (e, t, n) => [
212
215
  `${t}: port ${e} is already being served (${n.join(" + ")}).`,
213
216
  "",
214
217
  " Refusing to start. This is NOT a spurious check — a second listener can",
@@ -223,26 +226,26 @@ __installPublicEnv(publicEnvValues)
223
226
  "",
224
227
  " Then re-run. To use a different port instead, change `port` in",
225
228
  " app.config.ts."
226
- ].join("\n"), Ae = async (e, t) => {
227
- let { families: r } = await Oe(e);
228
- if (r.length !== 0) throw n(ke(e, t, r));
229
- }, je = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Me = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Ne = (e) => {
229
+ ].join("\n"), Pe = async (e, t) => {
230
+ let { families: r } = await Me(e);
231
+ if (r.length !== 0) throw n(Ne(e, t, r));
232
+ }, Y = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Fe = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Ie = (e) => {
230
233
  let t = [], n = e;
231
234
  for (let e = 0; e < 12; e++) {
232
- let e = w(n, "node_modules");
233
- D(e) && t.push(e);
234
- let r = C(n);
235
+ let e = O(n, "node_modules");
236
+ j(e) && t.push(e);
237
+ let r = D(n);
235
238
  if (r === n) break;
236
239
  n = r;
237
240
  }
238
241
  return t;
239
- }, Pe = (e) => {
242
+ }, Le = (e) => {
240
243
  let t = /* @__PURE__ */ new Set([e]), n = e;
241
244
  for (let e = 0; e < 12; e++) {
242
245
  for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
243
246
  let r;
244
247
  try {
245
- r = k(w(n, e), "utf8");
248
+ r = N(O(n, e), "utf8");
246
249
  } catch {
247
250
  continue;
248
251
  }
@@ -253,38 +256,38 @@ __installPublicEnv(publicEnvValues)
253
256
  if (i === "" || i.includes("*")) continue;
254
257
  let a;
255
258
  try {
256
- a = A(w(n, i), { withFileTypes: !0 });
259
+ a = P(O(n, i), { withFileTypes: !0 });
257
260
  } catch {
258
261
  continue;
259
262
  }
260
- for (let e of a) e.isDirectory() && t.add(w(n, i, e.name));
263
+ for (let e of a) e.isDirectory() && t.add(O(n, i, e.name));
261
264
  }
262
265
  }
263
266
  for (let e of ["packages", "apps"]) {
264
267
  let r;
265
268
  try {
266
- r = A(w(n, e), { withFileTypes: !0 });
269
+ r = P(O(n, e), { withFileTypes: !0 });
267
270
  } catch {
268
271
  continue;
269
272
  }
270
- for (let i of r) i.isDirectory() && t.add(w(n, e, i.name));
273
+ for (let i of r) i.isDirectory() && t.add(O(n, e, i.name));
271
274
  }
272
- let e = C(n);
275
+ let e = D(n);
273
276
  if (e === n) break;
274
277
  n = e;
275
278
  }
276
279
  return [...t];
277
- }, Fe = (e) => {
280
+ }, Re = (e) => {
278
281
  let t = [];
279
- for (let n of Pe(e)) {
280
- let e = w(n, "node_modules", "@voltro"), r;
282
+ for (let n of Le(e)) {
283
+ let e = O(n, "node_modules", "@voltro"), r;
281
284
  try {
282
- r = A(e);
285
+ r = P(e);
283
286
  } catch {
284
287
  continue;
285
288
  }
286
289
  for (let n of r) {
287
- let r = w(e, n), i = Y(r);
290
+ let r = O(e, n), i = ze(r);
288
291
  i !== void 0 && t.push({
289
292
  pkg: `@voltro/${n}`,
290
293
  version: i,
@@ -293,38 +296,38 @@ __installPublicEnv(publicEnvValues)
293
296
  }
294
297
  }
295
298
  return t;
296
- }, Y = (e) => {
299
+ }, ze = (e) => {
297
300
  try {
298
- let t = JSON.parse(k(w(e, "package.json"), "utf8"));
301
+ let t = JSON.parse(N(O(e, "package.json"), "utf8"));
299
302
  return typeof t.version == "string" ? t.version : void 0;
300
303
  } catch {
301
304
  return;
302
305
  }
303
- }, Ie = (e) => {
306
+ }, Be = (e) => {
304
307
  let t = [], n;
305
308
  try {
306
- n = A(e);
309
+ n = P(e);
307
310
  } catch {
308
311
  return t;
309
312
  }
310
313
  for (let r of n) {
311
- if (r.startsWith(".") || Me.test(r)) continue;
312
- let n = w(e, r);
314
+ if (r.startsWith(".") || Fe.test(r)) continue;
315
+ let n = O(e, r);
313
316
  if (r.startsWith("@")) {
314
317
  let e;
315
318
  try {
316
- e = A(n);
319
+ e = P(n);
317
320
  } catch {
318
321
  continue;
319
322
  }
320
323
  for (let i of e) t.push({
321
324
  pkg: `${r}/${i}`,
322
- dir: w(n, i)
325
+ dir: O(n, i)
323
326
  });
324
327
  continue;
325
328
  }
326
329
  try {
327
- if (!j(n).isDirectory()) continue;
330
+ if (!F(n).isDirectory()) continue;
328
331
  } catch {
329
332
  continue;
330
333
  }
@@ -334,25 +337,25 @@ __installPublicEnv(publicEnvValues)
334
337
  });
335
338
  }
336
339
  return t;
337
- }, Le = (e) => {
340
+ }, Ve = (e) => {
338
341
  let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
339
- if (!je(e)) return;
342
+ if (!Y(e)) return;
340
343
  let i = t.get(e) ?? /* @__PURE__ */ new Map();
341
344
  i.has(n) || i.set(n, r), t.set(e, i);
342
345
  };
343
- for (let t of Ne(e)) for (let { pkg: e, dir: r } of Ie(t)) {
344
- let t = Y(r);
346
+ for (let t of Ie(e)) for (let { pkg: e, dir: r } of Be(t)) {
347
+ let t = ze(r);
345
348
  t !== void 0 && n(e, t, r);
346
349
  }
347
- for (let { pkg: t, version: r, dir: i } of Fe(e)) n(t, r, i);
350
+ for (let { pkg: t, version: r, dir: i } of Re(e)) n(t, r, i);
348
351
  let r = [];
349
352
  for (let [n, i] of t) i.size < 2 || r.push({
350
353
  pkg: n,
351
354
  versions: [...i.keys()].sort(),
352
- paths: [...i.values()].map((t) => T(e, t)).sort()
355
+ paths: [...i.values()].map((t) => k(e, t)).sort()
353
356
  });
354
357
  return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
355
- }, Re = (e) => {
358
+ }, He = (e) => {
356
359
  if (e.length !== 0) return [
357
360
  `• ${e.length} package(s) resolved at more than one version:`,
358
361
  ...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
@@ -370,11 +373,11 @@ __installPublicEnv(publicEnvValues)
370
373
  " instrument), then reinstall. Do not silence the generated file — it is where",
371
374
  " a genuine mistake in your own descriptors surfaces."
372
375
  ].join("\n");
373
- }, ze = (e) => {
376
+ }, Ue = (e) => {
374
377
  let t = /* @__PURE__ */ new Map();
375
- for (let n of Ne(e)) for (let { pkg: e, dir: r } of Ie(n)) {
378
+ for (let n of Ie(e)) for (let { pkg: e, dir: r } of Be(n)) {
376
379
  if (!e.startsWith("@voltro/")) continue;
377
- let n = Y(r);
380
+ let n = ze(r);
378
381
  n !== void 0 && !t.has(e) && t.set(e, n);
379
382
  }
380
383
  if (t.size < 2) return;
@@ -389,7 +392,7 @@ __installPublicEnv(publicEnvValues)
389
392
  version: t
390
393
  })).sort((e, t) => e.pkg.localeCompare(t.pkg))
391
394
  };
392
- }, Be = (e) => {
395
+ }, We = (e) => {
393
396
  if (e !== void 0) return [
394
397
  `• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
395
398
  ...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
@@ -407,84 +410,86 @@ __installPublicEnv(publicEnvValues)
407
410
  " its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
408
411
  " which silently skips `@voltro/i18n` because the name contains digits."
409
412
  ].join("\n");
410
- }, Ve = (e, t) => {
411
- let n = ze(e);
413
+ }, Ge = (e, t) => {
414
+ let n = Ue(e);
412
415
  n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
413
416
  majority: n.majority,
414
417
  behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
415
418
  fix: "the framework ships in lockstep; bump the listed packages and reinstall"
416
419
  });
417
- }, He = L({ scope: "vite" }), Ue = /\x1b\[[0-9;]*m/g, We = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ge = (e) => e.replace(Ue, "").replace(We, "").trim(), Ke = /proxy error/i, qe = [
420
+ }, Ke = V({ scope: "vite" }), qe = /\x1b\[[0-9;]*m/g, Je = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ye = (e) => e.replace(qe, "").replace(Je, "").trim(), Xe = /proxy error/i, Ze = [
418
421
  "ECONNREFUSED",
419
422
  "ECONNRESET",
420
423
  "ECONNABORTED",
421
424
  "EPIPE",
422
425
  "ETIMEDOUT"
423
- ], Je = (e, t = 0) => {
426
+ ], Qe = (e, t = 0) => {
424
427
  if (e == null || t > 5) return !1;
425
428
  let n = e;
426
- return typeof n.code == "string" && qe.includes(n.code) || typeof n.message == "string" && qe.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Je(e, t + 1)) ? !0 : Je(n.cause, t + 1);
427
- }, Ye = 4e3, Xe = () => {
429
+ return typeof n.code == "string" && Ze.includes(n.code) || typeof n.message == "string" && Ze.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Qe(e, t + 1)) ? !0 : Qe(n.cause, t + 1);
430
+ }, $e = 4e3, et = () => {
428
431
  let e = /* @__PURE__ */ new Set(), t = 0, n = {
429
432
  hasWarned: !1,
430
433
  info: (e) => {
431
- let t = Ge(e);
432
- t.length !== 0 && He.info(t);
434
+ let t = Ye(e);
435
+ t.length !== 0 && Ke.info(t);
433
436
  },
434
437
  warn: (e) => {
435
438
  n.hasWarned = !0;
436
- let t = Ge(e);
437
- t.length !== 0 && He.warn(t);
439
+ let t = Ye(e);
440
+ t.length !== 0 && Ke.warn(t);
438
441
  },
439
442
  warnOnce: (t) => {
440
- let r = Ge(t);
441
- e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && He.warn(r));
443
+ let r = Ye(t);
444
+ e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ke.warn(r));
442
445
  },
443
446
  error: (e, n) => {
444
- let r = Ge(e), i = n?.error;
447
+ let r = Ye(e), i = n?.error;
445
448
  if (r.length !== 0) {
446
- if (Ke.test(r) && Je(i)) {
449
+ if (Xe.test(r) && Qe(i)) {
447
450
  let e = Date.now();
448
- e - t > Ye && (t = e, He.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
451
+ e - t > $e && (t = e, Ke.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
449
452
  return;
450
453
  }
451
- He.error(r, {}, i);
454
+ Ke.error(r, {}, i);
452
455
  }
453
456
  },
454
457
  clearScreen: () => {},
455
458
  hasErrorLogged: (e) => !1
456
459
  };
457
460
  return n;
458
- }, Ze = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Qe = (e) => {
461
+ }, tt = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), nt = (e) => {
459
462
  try {
460
- let t = w(e, "tsconfig.json");
461
- if (!D(t)) return [];
462
- let n = JSON.parse(Ze(k(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = E(e, n.baseUrl ?? "."), a = [];
463
+ let t = O(e, "tsconfig.json");
464
+ if (!j(t)) return [];
465
+ let n = JSON.parse(tt(N(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = A(e, i), o = [];
463
466
  for (let [e, t] of Object.entries(r)) {
464
467
  let n = t[0];
465
468
  if (!n) continue;
466
469
  let r = n.replace(/\\/g, "/");
467
- if (!(r.includes("/@types/") || r.endsWith(".d.ts"))) if (e.endsWith("/*") && n.endsWith("/*")) {
468
- let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
469
- a.push({
470
- find: RegExp(`^${t}/(.*)$`),
471
- replacement: `${w(i, n.slice(0, -2))}/$1`
470
+ if (!(r.includes("/@types/") || r.endsWith(".d.ts"))) {
471
+ if (e.endsWith("/*") && n.endsWith("/*")) {
472
+ let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
473
+ o.push({
474
+ find: RegExp(`^${t}/(.*)$`),
475
+ replacement: `${O(a, n.slice(0, -2))}/$1`
476
+ });
477
+ } else o.push({
478
+ find: e,
479
+ replacement: O(a, n)
472
480
  });
473
- } else a.push({
474
- find: e,
475
- replacement: w(i, n)
476
- });
481
+ }
477
482
  }
478
- return a;
483
+ return o;
479
484
  } catch {
480
485
  return [];
481
486
  }
482
- }, $e = (e = process.env) => {
487
+ }, rt = (e = process.env) => {
483
488
  let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
484
489
  if (t === void 0 || t.trim() === "") return 4;
485
490
  let n = Number(t);
486
491
  return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
487
- }, et = (e) => {
492
+ }, it = (e) => {
488
493
  let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
489
494
  let e = r.shift();
490
495
  e ? e() : n--;
@@ -502,8 +507,8 @@ __installPublicEnv(publicEnvValues)
502
507
  return n;
503
508
  }
504
509
  };
505
- }, tt = (e) => {
506
- let t = et(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
510
+ }, at = (e) => {
511
+ let t = it(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
507
512
  return {
508
513
  load: (i, a) => {
509
514
  if (r.has(i)) return a();
@@ -533,7 +538,7 @@ __installPublicEnv(publicEnvValues)
533
538
  return r.size;
534
539
  }
535
540
  };
536
- }, nt = (e) => {
541
+ }, ot = (e) => {
537
542
  let t = [];
538
543
  for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
539
544
  name: n.slice(5, -2),
@@ -549,12 +554,12 @@ __installPublicEnv(publicEnvValues)
549
554
  optional: !1
550
555
  });
551
556
  return t;
552
- }, rt = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), it = async (e) => {
553
- let t = E(e);
557
+ }, st = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), ct = async (e) => {
558
+ let t = A(e);
554
559
  for (let e = 0; e < 4; e++) {
555
- let e = w(t, "project.json");
556
- if (D(e)) try {
557
- let n = await O.readFile(e, "utf8");
560
+ let e = O(t, "project.json");
561
+ if (j(e)) try {
562
+ let n = await M.readFile(e, "utf8");
558
563
  return {
559
564
  projectDir: t,
560
565
  manifest: JSON.parse(n)
@@ -562,38 +567,38 @@ __installPublicEnv(publicEnvValues)
562
567
  } catch {
563
568
  return null;
564
569
  }
565
- let n = C(t);
570
+ let n = D(t);
566
571
  if (n === t) break;
567
572
  t = n;
568
573
  }
569
574
  return null;
570
- }, at = async (e) => {
571
- let t = await it(e);
575
+ }, lt = async (e) => {
576
+ let t = await ct(e);
572
577
  if (!t) return [];
573
- let { projectDir: n, manifest: r } = t, i = S(e), a = r.apps ?? {}, o = [];
578
+ let { projectDir: n, manifest: r } = t, i = E(e), a = r.apps ?? {}, o = [];
574
579
  for (let [e, t] of Object.entries(a)) {
575
580
  if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
576
- let r = w(w(n, t.path ?? e), "src", "pages");
577
- if (!D(r)) continue;
578
- let a;
581
+ let r = O(n, t.path ?? e), a = O(r, "src", "pages");
582
+ if (!j(a)) continue;
583
+ let s;
579
584
  try {
580
- let { pages: e } = await $(r);
581
- a = e.map((e) => ({
585
+ let { pages: e } = await $(a);
586
+ s = e.map((e) => ({
582
587
  pattern: e.pattern,
583
- params: nt(e.pattern)
588
+ params: ot(e.pattern)
584
589
  }));
585
590
  } catch {
586
591
  continue;
587
592
  }
588
593
  o.push({
589
- key: rt(e),
594
+ key: st(e),
590
595
  origin: `http://localhost:${t.port}`,
591
596
  ...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
592
- routes: a
597
+ routes: s
593
598
  });
594
599
  }
595
600
  return o;
596
- }, ot = (e) => {
601
+ }, ut = (e) => {
597
602
  if (e.params.length === 0) return `'${e.pattern}'`;
598
603
  let t = e.pattern;
599
604
  for (let n of e.params) {
@@ -601,21 +606,21 @@ __installPublicEnv(publicEnvValues)
601
606
  t = t.replace(e, r);
602
607
  }
603
608
  return "`" + t + "`";
604
- }, st = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
609
+ }, dt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
605
610
  let t = "string";
606
611
  return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
607
- }).join("; ")} }`, ct = (e, t, n) => {
608
- let r = st(e), i = ot(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
612
+ }).join("; ")} }`, ft = (e, t, n) => {
613
+ let r = dt(e), i = ut(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
609
614
  return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
610
- }, lt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${ct(e, !1)},`).join("\n")}\n}`, ut = (e, t) => {
615
+ }, pt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${ft(e, !1)},`).join("\n")}\n}`, mt = (e, t) => {
611
616
  if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
612
- 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)}: ${ct(e, !0, i)},`);
617
+ 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)}: ${ft(e, !0, i)},`);
613
618
  return ` ${e.key}: {\n${a.join("\n")}\n },`;
614
- }, dt = async (e) => {
619
+ }, ht = async (e) => {
615
620
  let t = e.pages.map((e) => ({
616
621
  pattern: e.pattern,
617
- params: nt(e.pattern)
618
- })), n = await at(e.appRoot), r = [
622
+ params: ot(e.pattern)
623
+ })), n = await lt(e.appRoot), r = [
619
624
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
620
625
  "// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
621
626
  "// Type-safe route builders consumed by <Link to={...}>.",
@@ -624,50 +629,50 @@ __installPublicEnv(publicEnvValues)
624
629
  "",
625
630
  "type EmptyParams = Record<string, never>",
626
631
  ""
627
- ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${lt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => ut(e, i)).join("\n")}\n} as const\n`}`, o = w(e.appRoot, ".framework", "routes.generated.ts");
628
- await O.mkdir(C(o), { recursive: !0 });
632
+ ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${pt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => mt(e, i)).join("\n")}\n} as const\n`}`, o = O(e.appRoot, ".framework", "routes.generated.ts");
633
+ await M.mkdir(D(o), { recursive: !0 });
629
634
  let s = null;
630
635
  try {
631
- s = await O.readFile(o, "utf8");
636
+ s = await M.readFile(o, "utf8");
632
637
  } catch {}
633
638
  return s === a ? {
634
639
  path: o,
635
640
  wrote: !1
636
- } : (await O.writeFile(o, a, "utf8"), {
641
+ } : (await M.writeFile(o, a, "utf8"), {
637
642
  path: o,
638
643
  wrote: !0
639
644
  });
640
- }, ft = (e) => {
645
+ }, gt = (e) => {
641
646
  if (e === "" || e === "/") return "/";
642
647
  let t = e.startsWith("/") ? e : `/${e}`;
643
648
  return t.endsWith("/") ? t.slice(0, -1) : t;
644
- }, pt = (e, t) => {
645
- let n = e.endsWith("/") ? e.slice(0, -1) : e, r = ft(t);
649
+ }, _t = (e, t) => {
650
+ let n = e.endsWith("/") ? e.slice(0, -1) : e, r = gt(t);
646
651
  return r === "/" ? `${n}/` : `${n}${r}`;
647
- }, mt = (e, t, n) => {
648
- let r = ft(e);
652
+ }, vt = (e, t, n) => {
653
+ let r = gt(e);
649
654
  return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
650
- }, ht = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), gt = (e) => {
655
+ }, yt = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), bt = (e) => {
651
656
  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) => {
652
657
  if (!r) return "";
653
- let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${ht(n)}" href="${ht(pt(t, mt(e, n, i)))}" />`);
654
- return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${ht(pt(t, mt(e, i, i)))}" />`), `\n${n.join("\n")}`;
658
+ let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${yt(n)}" href="${yt(_t(t, vt(e, n, i)))}" />`);
659
+ return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${yt(_t(t, vt(e, i, i)))}" />`), `\n${n.join("\n")}`;
655
660
  };
656
661
  for (let e of n) {
657
662
  let n = r ?? [i];
658
663
  for (let r of n) {
659
- let n = pt(t, mt(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${ht(e.lastmod)}</lastmod>` : "";
660
- o.set(n, ` <url>\n <loc>${ht(n)}</loc>${a}${s(e.path)}\n </url>`);
664
+ let n = _t(t, vt(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${yt(e.lastmod)}</lastmod>` : "";
665
+ o.set(n, ` <url>\n <loc>${yt(n)}</loc>${a}${s(e.path)}\n </url>`);
661
666
  }
662
667
  }
663
668
  let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
664
669
  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`;
665
- }, _t = (e) => {
670
+ }, xt = (e) => {
666
671
  if (!e.indexable) return "User-agent: *\nDisallow: /\n";
667
672
  let t = ["User-agent: *", "Allow: /"];
668
- for (let n of e.disallow ?? []) t.push(`Disallow: ${ft(n)}`);
673
+ for (let n of e.disallow ?? []) t.push(`Disallow: ${gt(n)}`);
669
674
  return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
670
- }, vt = 256, yt = (e = vt) => {
675
+ }, St = 256, Ct = (e = St) => {
671
676
  let t = [], n = /* @__PURE__ */ new Set();
672
677
  return {
673
678
  emit(r, i) {
@@ -690,17 +695,19 @@ __installPublicEnv(publicEnvValues)
690
695
  return t.slice();
691
696
  }
692
697
  };
693
- }, bt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, xt = () => `: keep-alive ${Date.now()}\n\n`, St = 8e3, Ct = (e, t = St) => {
694
- let n = Tt(e);
698
+ }, wt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Tt = () => `: keep-alive ${Date.now()}\n\n`, Et = 8e3, Dt = (e, t = Et) => {
699
+ let n = kt(e);
695
700
  return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
696
- }, wt = 4, Tt = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
701
+ }, Ot = 4, kt = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
697
702
  if (e instanceof Error) {
698
703
  let r = e.stack ?? `${e.name}: ${e.message}`;
699
704
  if (n.has(e)) return `${r}\n [cycle]`;
700
705
  n.add(e);
701
706
  let i = [];
702
- if (t < wt) if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Et(Tt(a, t + 1, n))}`);
703
- else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Et(Tt(e.cause, t + 1, n))}`);
707
+ if (t < Ot) {
708
+ if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${At(kt(a, t + 1, n))}`);
709
+ else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${At(kt(e.cause, t + 1, n))}`);
710
+ }
704
711
  return r + i.join("");
705
712
  }
706
713
  try {
@@ -708,30 +715,30 @@ __installPublicEnv(publicEnvValues)
708
715
  } catch {
709
716
  return "[unstringifiable thrown value]";
710
717
  }
711
- }, Et = (e) => {
718
+ }, At = (e) => {
712
719
  let t = e.split("\n");
713
720
  return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
714
- }, Dt = {
721
+ }, jt = {
715
722
  trace: 0,
716
723
  debug: 1,
717
724
  info: 2,
718
725
  warn: 3,
719
726
  error: 4,
720
727
  fatal: 5
721
- }, Ot = 2e3, kt = 200, At = class {
728
+ }, Mt = 2e3, Nt = 200, Pt = class {
722
729
  capacity;
723
730
  buffer = [];
724
- constructor(e = Ot) {
731
+ constructor(e = Mt) {
725
732
  this.capacity = e;
726
733
  }
727
734
  append(e) {
728
735
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
729
736
  }
730
737
  query(e = {}) {
731
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? kt, this.capacity), i = e.minLevel === void 0 ? Dt.trace : Dt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
738
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Nt, this.capacity), i = e.minLevel === void 0 ? jt.trace : jt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
732
739
  for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
733
740
  let r = this.buffer[e];
734
- r.ts < t || r.ts > n || Dt[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);
741
+ r.ts < t || r.ts > n || jt[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));
735
742
  }
736
743
  return l.reverse();
737
744
  }
@@ -744,7 +751,7 @@ __installPublicEnv(publicEnvValues)
744
751
  clear() {
745
752
  this.buffer = [];
746
753
  }
747
- }, jt = null, Mt = () => (jt === null && (jt = new At()), jt), Nt = (e) => {
754
+ }, Ft = null, It = () => (Ft === null && (Ft = new Pt()), Ft), Lt = (e) => {
748
755
  if (typeof e == "string") return e;
749
756
  if (e instanceof Error) return e.message;
750
757
  try {
@@ -752,28 +759,28 @@ __installPublicEnv(publicEnvValues)
752
759
  } catch {
753
760
  return String(e);
754
761
  }
755
- }, Pt = 8e3, Ft = (e) => typeof e == "string" ? e.length <= Pt ? e : `${e.slice(0, Pt)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Ct(e, Pt), It = (e, t) => {
762
+ }, Rt = 8e3, zt = (e) => typeof e == "string" ? e.length <= Rt ? e : `${e.slice(0, Rt)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Dt(e, Rt), Bt = (e, t) => {
756
763
  try {
757
764
  e(...t);
758
765
  } catch (n) {
759
766
  try {
760
- e(...t.map(Ft)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Pt} chars per argument.`);
767
+ e(...t.map(zt)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Rt} chars per argument.`);
761
768
  } catch {
762
769
  e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
763
770
  }
764
771
  }
765
- }, Lt = (e) => {
772
+ }, Vt = (e) => {
766
773
  let t = {
767
774
  log: console.log.bind(console),
768
775
  info: console.info.bind(console),
769
776
  warn: console.warn.bind(console),
770
777
  error: console.error.bind(console),
771
778
  debug: console.debug.bind(console)
772
- }, n = Mt(), r = !1, i = (i) => (...a) => {
773
- if (It(t[i], a), !r) {
779
+ }, n = It(), r = !1, i = (i) => (...a) => {
780
+ if (Bt(t[i], a), !r) {
774
781
  r = !0;
775
782
  try {
776
- let t = a.length > 0 ? Nt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = B();
783
+ let t = a.length > 0 ? Lt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = U();
777
784
  e.emit("log", {
778
785
  level: i,
779
786
  message: r,
@@ -800,7 +807,7 @@ __installPublicEnv(publicEnvValues)
800
807
  }
801
808
  };
802
809
  console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
803
- let a = I((t) => {
810
+ let a = B((t) => {
804
811
  if (!r) {
805
812
  r = !0;
806
813
  try {
@@ -811,7 +818,7 @@ __installPublicEnv(publicEnvValues)
811
818
  argsCount: 1,
812
819
  ...t.scope === void 0 ? {} : { scope: t.scope }
813
820
  });
814
- let a = B(), o = a !== void 0 && t.fields.traceId === void 0 ? {
821
+ let a = U(), o = a !== void 0 && t.fields.traceId === void 0 ? {
815
822
  ...t.fields,
816
823
  traceId: a.traceId
817
824
  } : t.fields;
@@ -831,24 +838,24 @@ __installPublicEnv(publicEnvValues)
831
838
  return () => {
832
839
  console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
833
840
  };
834
- }, Rt = 2e3, zt = 8, Bt = 1e3, Vt = 200, X = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Ht = (e) => {
841
+ }, Ht = 2e3, Ut = 8, Wt = 1e3, Gt = 200, X = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Kt = (e) => {
835
842
  switch (e) {
836
843
  case "error": return "error";
837
844
  case "warn": return "warn";
838
845
  case "debug": return "debug";
839
846
  default: return "info";
840
847
  }
841
- }, Ut = L({ scope: "client" }), Wt = (e, t) => {
848
+ }, qt = V({ scope: "client" }), Jt = (e, t) => {
842
849
  let n;
843
850
  try {
844
851
  n = JSON.parse(e);
845
852
  } catch {
846
- return Gt(400, { error: "invalid JSON body" });
853
+ return Yt(400, { error: "invalid JSON body" });
847
854
  }
848
- if (typeof n != "object" || !n) return Gt(400, { error: "body must be a JSON object" });
855
+ if (typeof n != "object" || !n) return Yt(400, { error: "body must be a JSON object" });
849
856
  let r = n;
850
- if (!Array.isArray(r.entries)) return Gt(400, { error: "entries must be an array" });
851
- let i = typeof r.app == "string" ? X(r.app, 120) : void 0, a = typeof r.page == "string" ? X(r.page, 200) : void 0, o = typeof r.ua == "string" ? X(r.ua, 200) : void 0, s = r.entries.slice(0, Vt), c = 0;
857
+ if (!Array.isArray(r.entries)) return Yt(400, { error: "entries must be an array" });
858
+ let i = typeof r.app == "string" ? X(r.app, 120) : void 0, a = typeof r.page == "string" ? X(r.page, 200) : void 0, o = typeof r.ua == "string" ? X(r.ua, 200) : void 0, s = r.entries.slice(0, Gt), c = 0;
852
859
  for (let e of s) {
853
860
  if (typeof e != "object" || !e) continue;
854
861
  let n = e;
@@ -859,7 +866,7 @@ __installPublicEnv(publicEnvValues)
859
866
  "warn",
860
867
  "error",
861
868
  "debug"
862
- ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = X(n.message, Rt), u = Array.isArray(n.args) ? n.args.slice(0, zt).filter((e) => typeof e == "string").map((e) => X(e, Bt)) : void 0, d = typeof n.stack == "string" ? X(n.stack, Rt) : void 0;
869
+ ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = X(n.message, Ht), u = Array.isArray(n.args) ? n.args.slice(0, Ut).filter((e) => typeof e == "string").map((e) => X(e, Wt)) : void 0, d = typeof n.stack == "string" ? X(n.stack, Ht) : void 0;
863
870
  t.emit("clientLog", {
864
871
  ts: s,
865
872
  level: r,
@@ -874,41 +881,41 @@ __installPublicEnv(publicEnvValues)
874
881
  ...i === void 0 ? {} : { app: i },
875
882
  ...a === void 0 ? {} : { page: a },
876
883
  ...u !== void 0 && u.length > 0 ? { args: u } : {}
877
- }, p = Ht(r);
878
- (p === "error" || p === "warn") && d !== void 0 ? Ut[p](l, f, { stack: d }) : Ut[p](l, {
884
+ }, p = Kt(r);
885
+ (p === "error" || p === "warn") && d !== void 0 ? qt[p](l, f, { stack: d }) : qt[p](l, {
879
886
  ...f,
880
887
  ...d === void 0 ? {} : { stack: d }
881
888
  }), c++;
882
889
  }
883
- return Gt(202, {
890
+ return Yt(202, {
884
891
  accepted: c,
885
892
  dropped: r.entries.length - c
886
893
  });
887
- }, Gt = (e, t) => ({
894
+ }, Yt = (e, t) => ({
888
895
  status: e,
889
896
  contentType: "application/json; charset=utf-8",
890
897
  body: JSON.stringify(t)
891
- }), Kt = "/_voltro/inspect/clientLog", qt = [
898
+ }), Xt = "/_voltro/inspect/clientLog", Zt = [
892
899
  "trace",
893
900
  "debug",
894
901
  "info",
895
902
  "warn",
896
903
  "error",
897
904
  "fatal"
898
- ], Jt = {
905
+ ], Qt = {
899
906
  trace: "TRACE",
900
907
  debug: "DEBUG",
901
908
  info: "INFO ",
902
909
  warn: "WARN ",
903
910
  error: "ERROR",
904
911
  fatal: "FATAL"
905
- }, Yt = (e) => qt.includes(e), Xt = (e, t, n = {}) => {
906
- if (o()) return {
912
+ }, $t = (e) => Zt.includes(e), en = (e, t, n = {}) => {
913
+ if (u()) return {
907
914
  status: 503,
908
915
  contentType: "application/json",
909
916
  body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" })
910
917
  };
911
- let r = c(n, "GET");
918
+ let r = f(n, "GET");
912
919
  if (!r.ok) return {
913
920
  status: 401,
914
921
  contentType: "application/json",
@@ -917,36 +924,36 @@ __installPublicEnv(publicEnvValues)
917
924
  reason: r.reason
918
925
  })
919
926
  };
920
- let i = e.indexOf("?"), a = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), s = {}, l = a.get("since");
921
- if (l !== null) {
922
- let e = Number(l);
923
- Number.isFinite(e) && (s.since = e);
927
+ let i = e.indexOf("?"), a = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), o = {}, s = a.get("since");
928
+ if (s !== null) {
929
+ let e = Number(s);
930
+ Number.isFinite(e) && (o.since = e);
924
931
  }
925
- let u = a.get("until");
926
- if (u !== null) {
927
- let e = Number(u);
928
- Number.isFinite(e) && (s.until = e);
932
+ let c = a.get("until");
933
+ if (c !== null) {
934
+ let e = Number(c);
935
+ Number.isFinite(e) && (o.until = e);
929
936
  }
930
- let d = a.get("max");
931
- if (d !== null) {
932
- let e = Number(d);
933
- Number.isFinite(e) && e > 0 && (s.max = Math.floor(e));
937
+ let l = a.get("max");
938
+ if (l !== null) {
939
+ let e = Number(l);
940
+ Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
934
941
  }
935
- let f = a.get("level");
936
- f !== null && Yt(f) && (s.minLevel = f);
942
+ let d = a.get("level");
943
+ d !== null && $t(d) && (o.minLevel = d);
937
944
  let p = a.get("source");
938
- (p === "server" || p === "client") && (s.source = p);
945
+ (p === "server" || p === "client") && (o.source = p);
939
946
  let m = a.get("scope");
940
- m !== null && m.length > 0 && (s.scope = m);
947
+ m !== null && m.length > 0 && (o.scope = m);
941
948
  let h = a.get("filter");
942
- h !== null && h.length > 0 && (s.filter = h);
949
+ h !== null && h.length > 0 && (o.filter = h);
943
950
  let g = a.get("trace");
944
- g !== null && g.length > 0 && (s.traceId = g);
945
- let _ = t.query(s);
951
+ g !== null && g.length > 0 && (o.traceId = g);
952
+ let _ = t.query(o);
946
953
  if ((a.get("format") ?? "json") === "text") return {
947
954
  status: 200,
948
955
  contentType: "text/plain; charset=utf-8",
949
- body: _.map(Zt).join("\n") + (_.length > 0 ? "\n" : "")
956
+ body: _.map(tn).join("\n") + (_.length > 0 ? "\n" : "")
950
957
  };
951
958
  let v = {
952
959
  capturedAt: Date.now(),
@@ -960,40 +967,40 @@ __installPublicEnv(publicEnvValues)
960
967
  contentType: "application/json; charset=utf-8",
961
968
  body: JSON.stringify(v)
962
969
  };
963
- }, Zt = (e) => {
964
- 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 = $t(e.fields);
965
- return `${n}:${r}:${i}.${a} ${Jt[e.level]} ${o} ${e.message}${s}`;
966
- }, Qt = 80, $t = (e) => {
970
+ }, tn = (e) => {
971
+ 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 = rn(e.fields);
972
+ return `${n}:${r}:${i}.${a} ${Qt[e.level]} ${o} ${e.message}${s}`;
973
+ }, nn = 80, rn = (e) => {
967
974
  let t = Object.entries(e);
968
975
  if (t.length === 0) return "";
969
976
  let n = [];
970
977
  for (let [e, r] of t) {
971
978
  if (r === void 0) continue;
972
- let t = en(r);
979
+ let t = an(r);
973
980
  n.push(`${e}=${t}`);
974
981
  }
975
982
  return n.length > 0 ? " " + n.join(" ") : "";
976
- }, en = (e) => {
983
+ }, an = (e) => {
977
984
  if (typeof e == "string") {
978
- let t = e.length > Qt ? e.slice(0, Qt) + "…" : e;
985
+ let t = e.length > nn ? e.slice(0, nn) + "…" : e;
979
986
  return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
980
987
  }
981
988
  if (e === null) return "null";
982
989
  if (typeof e == "number" || typeof e == "boolean") return String(e);
983
990
  try {
984
991
  let t = JSON.stringify(e);
985
- return t.length > Qt ? t.slice(0, Qt) + "…" : t;
992
+ return t.length > nn ? t.slice(0, nn) + "…" : t;
986
993
  } catch {
987
994
  return "[unserialisable]";
988
995
  }
989
- }, tn = "/_voltro/inspect/logs", nn = (e, t, n) => {
996
+ }, on = "/_voltro/inspect/logs", sn = (e, t, n) => {
990
997
  if (t.headers.authorization !== void 0) return !1;
991
998
  let { token: r } = n;
992
999
  if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
993
1000
  e.setHeader("authorization", `Bearer ${r}`);
994
1001
  let i = n.writeToken;
995
1002
  return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
996
- }, rn = [{
1003
+ }, cn = [{
997
1004
  match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
998
1005
  handle: (e, t) => {
999
1006
  let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
@@ -1005,13 +1012,13 @@ __installPublicEnv(publicEnvValues)
1005
1012
  });
1006
1013
  } else t.info(n);
1007
1014
  }
1008
- }], an = () => {
1015
+ }], ln = () => {
1009
1016
  let e = {
1010
1017
  warn: console.warn.bind(console),
1011
1018
  error: console.error.bind(console)
1012
- }, t = L({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1019
+ }, t = V({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1013
1020
  if (!n) {
1014
- for (let e of rn) if (e.match(i[0])) {
1021
+ for (let e of cn) if (e.match(i[0])) {
1015
1022
  n = !0;
1016
1023
  try {
1017
1024
  e.handle(i, t);
@@ -1026,7 +1033,7 @@ __installPublicEnv(publicEnvValues)
1026
1033
  return console.warn = r("warn"), console.error = r("error"), () => {
1027
1034
  console.warn = e.warn, console.error = e.error;
1028
1035
  };
1029
- }, on = {
1036
+ }, un = {
1030
1037
  loader: "it runs on the server, and the router caches its result per route + params",
1031
1038
  renderMode: "it picks the server render strategy",
1032
1039
  dynamic: "it picks the server render strategy",
@@ -1037,7 +1044,7 @@ __installPublicEnv(publicEnvValues)
1037
1044
  cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
1038
1045
  interactive: "it decides how much client JS the server ships",
1039
1046
  tenantAware: "it is part of the server-side cache key"
1040
- }, sn = Object.keys(on), cn = "virtual:voltro-route-refresh", ln = `\0${cn}`, un = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, dn = () => `
1047
+ }, dn = Object.keys(un), fn = "virtual:voltro-route-refresh", pn = `\0${fn}`, mn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, hn = () => `
1041
1048
  // GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
1042
1049
 
1043
1050
  /** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
@@ -1066,11 +1073,11 @@ const stableForm = (value) => {
1066
1073
  * readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
1067
1074
  * one of THESE cannot be hot-applied: the server already ran with the old
1068
1075
  * value. Everything else a page exports is plain client-side data. */
1069
- const serverRelevantExports = ${JSON.stringify(sn)}
1076
+ const serverRelevantExports = ${JSON.stringify(dn)}
1070
1077
 
1071
1078
  /** Name → the server step that already consumed it, so the reload message can
1072
1079
  * say WHY rather than just WHAT. Injected from the same single source. */
1073
- const serverExportEffect = ${JSON.stringify(on)}
1080
+ const serverExportEffect = ${JSON.stringify(un)}
1074
1081
 
1075
1082
  /** The reason \`name\` forces a reload, for the console line. */
1076
1083
  export const serverEffectOf = (name) =>
@@ -1113,7 +1120,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
1113
1120
  const previousHook = globalThis.__getReactRefreshIgnoredExports
1114
1121
  globalThis.__getReactRefreshIgnoredExports = (args) =>
1115
1122
  ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
1116
- `, fn = (e) => `
1123
+ `, gn = (e) => `
1117
1124
  if (import.meta.hot) {
1118
1125
  // Self-import to read our OWN exports, the same technique the react plugin
1119
1126
  // uses; the namespace is only complete after evaluation, hence the promise.
@@ -1140,128 +1147,128 @@ import {
1140
1147
  registerRouteModule as __voltro_registerRouteModule,
1141
1148
  routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
1142
1149
  serverEffectOf as __voltro_serverEffect,
1143
- } from '${cn}'
1144
- `, pn = (e) => e.replace(/\\/g, "/"), mn = (e, t) => {
1145
- let [n = "", r] = pn(e).split("?");
1146
- if (!n.endsWith(".tsx") || r !== void 0 && un.test(r)) return !1;
1147
- let o = pn(t).replace(/\/$/, "");
1148
- return n.startsWith(`${o}/`) ? a.test(n) || i.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
1149
- }, hn = (e, t, n) => mn(t, n) ? `${e}${fn(pn(t).split("?")[0] ?? t)}` : null, gn = (e) => ({
1150
+ } from '${fn}'
1151
+ `, _n = (e) => e.replace(/\\/g, "/"), vn = (e, t) => {
1152
+ let [n = "", r] = _n(e).split("?");
1153
+ if (!n.endsWith(".tsx") || r !== void 0 && mn.test(r)) return !1;
1154
+ let i = _n(t).replace(/\/$/, "");
1155
+ return n.startsWith(`${i}/`) ? c.test(n) || s.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
1156
+ }, yn = (e, t, n) => vn(t, n) ? `${e}${gn(_n(t).split("?")[0] ?? t)}` : null, bn = (e) => ({
1150
1157
  name: "voltro:route-fast-refresh",
1151
1158
  enforce: "pre",
1152
- resolveId: (e) => e === "virtual:voltro-route-refresh" ? ln : void 0,
1153
- load: (e) => e === ln ? dn() : void 0,
1159
+ resolveId: (e) => e === "virtual:voltro-route-refresh" ? pn : void 0,
1160
+ load: (e) => e === pn ? hn() : void 0,
1154
1161
  transform: (t, n, r) => {
1155
1162
  if (r?.ssr === !0) return null;
1156
- let i = hn(t, n, e);
1163
+ let i = yn(t, n, e);
1157
1164
  return i === null ? null : {
1158
1165
  code: i,
1159
1166
  map: null
1160
1167
  };
1161
1168
  }
1162
- }), _n = L({ scope: "voltro:dashboard" }), vn = ee(import.meta.url), yn = 5179, bn = (e) => {
1169
+ }), xn = V({ scope: "voltro:dashboard" }), Sn = te(import.meta.url), Cn = 5179, wn = (e) => {
1163
1170
  let t = process.env.VOLTRO_DASHBOARD_PATH;
1164
- if (t && D(w(E(t), "app.config.ts"))) return E(t);
1171
+ if (t && j(O(A(t), "app.config.ts"))) return A(t);
1165
1172
  try {
1166
- let e = C(vn.resolve("@voltro/dashboard/package.json"));
1167
- if (D(w(e, "app.config.ts"))) return e;
1173
+ let e = D(Sn.resolve("@voltro/dashboard/package.json"));
1174
+ if (j(O(e, "app.config.ts"))) return e;
1168
1175
  } catch {}
1169
- let n = w("voltro-devtools", "apps", "dashboard"), r = E(e);
1176
+ let n = O("voltro-devtools", "apps", "dashboard"), r = A(e);
1170
1177
  for (let e = 0; e < 10; e++) {
1171
- let e = w(r, n);
1172
- if (D(w(e, "app.config.ts"))) return e;
1173
- let t = C(r);
1178
+ let e = O(r, n);
1179
+ if (j(O(e, "app.config.ts"))) return e;
1180
+ let t = D(r);
1174
1181
  if (t === r) break;
1175
1182
  r = t;
1176
1183
  }
1177
1184
  return null;
1178
- }, xn = "VOLTRO_IS_DASHBOARD", Sn = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1179
- let i = K({
1185
+ }, Tn = "VOLTRO_IS_DASHBOARD", En = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1186
+ let i = pe({
1180
1187
  port: e,
1181
1188
  host: t
1182
1189
  }), a = !1, o = (e) => {
1183
1190
  a || (a = !0, i.destroy(), r(e));
1184
1191
  };
1185
1192
  i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
1186
- }), Cn = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), wn = () => process.env[xn] === "1", Tn = () => process.stdout.isTTY === !0, En = w(z(), ".voltro", "dashboard-launch.lock"), Dn = 1e4, On = async () => {
1193
+ }), Dn = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), On = () => process.env[Tn] === "1", kn = () => process.stdout.isTTY === !0, An = O(H(), ".voltro", "dashboard-launch.lock"), jn = 1e4, Mn = async () => {
1187
1194
  try {
1188
- await O.mkdir(C(En), { recursive: !0 });
1189
- let e = await O.open(En, "wx");
1195
+ await M.mkdir(D(An), { recursive: !0 });
1196
+ let e = await M.open(An, "wx");
1190
1197
  return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
1191
1198
  } catch {
1192
1199
  try {
1193
- let e = await O.stat(En);
1194
- if (Date.now() - e.mtimeMs > Dn) return await O.unlink(En).catch(() => void 0), On();
1200
+ let e = await M.stat(An);
1201
+ if (Date.now() - e.mtimeMs > jn) return await M.unlink(An).catch(() => void 0), Mn();
1195
1202
  } catch {}
1196
1203
  return !1;
1197
1204
  }
1198
- }, kn = async () => {
1205
+ }, Nn = async () => {
1199
1206
  try {
1200
- await O.unlink(En);
1207
+ await M.unlink(An);
1201
1208
  } catch {}
1202
- }, An = async (e) => {
1209
+ }, Pn = async (e) => {
1203
1210
  let t = e.port ?? 5179;
1204
- if (Cn()) return {
1211
+ if (Dn()) return {
1205
1212
  status: "skipped",
1206
1213
  reason: "disabled by flag/env",
1207
1214
  port: t
1208
1215
  };
1209
- if (wn()) return {
1216
+ if (On()) return {
1210
1217
  status: "skipped",
1211
1218
  reason: "this process IS the dashboard",
1212
1219
  port: t
1213
1220
  };
1214
- if (!Tn()) return {
1221
+ if (!kn()) return {
1215
1222
  status: "skipped",
1216
1223
  reason: "stdout is not a TTY (CI/smoke)",
1217
1224
  port: t
1218
1225
  };
1219
- if (!await On()) return {
1226
+ if (!await Mn()) return {
1220
1227
  status: "skipped",
1221
1228
  reason: "another voltro process is currently launching the dashboard",
1222
1229
  port: t
1223
1230
  };
1224
- if (await Sn(t)) return await kn(), {
1231
+ if (await En(t)) return await Nn(), {
1225
1232
  status: "already-running",
1226
1233
  port: t
1227
1234
  };
1228
1235
  let n = e.voltroBin;
1229
1236
  if (!n) {
1230
1237
  let e = process.argv[1];
1231
- n = e && e.endsWith("/src/bin.ts") ? w(C(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1238
+ n = e && e.endsWith("/src/bin.ts") ? O(D(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1232
1239
  }
1233
- let r = D(w(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = ue(process.execPath, [
1240
+ let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = j(r), a = i ? "start" : "dev", o = fe(process.execPath, [
1234
1241
  n,
1235
- i,
1242
+ a,
1236
1243
  e.dashboardAppPath
1237
1244
  ], {
1238
1245
  stdio: "ignore",
1239
1246
  env: {
1240
1247
  ...process.env,
1241
- [xn]: "1",
1248
+ [Tn]: "1",
1242
1249
  VOLTRO_DASHBOARD_PORT: String(t)
1243
1250
  }
1244
1251
  });
1245
1252
  return process.on("exit", () => {
1246
- if (a.exitCode === null && a.signalCode === null) try {
1247
- a.kill("SIGTERM");
1253
+ if (o.exitCode === null && o.signalCode === null) try {
1254
+ o.kill("SIGTERM");
1248
1255
  } catch {}
1249
- }), _n.info(`auto-launching dashboard at http://localhost:${t}`, {
1256
+ }), xn.info(`auto-launching dashboard at http://localhost:${t}`, {
1250
1257
  port: t,
1251
- mode: i,
1252
- prebuilt: r
1253
- }), r || _n.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), _n.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1254
- kn();
1258
+ mode: a,
1259
+ prebuilt: i
1260
+ }), i || xn.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), xn.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1261
+ Nn();
1255
1262
  }, 4e3).unref(), {
1256
1263
  status: "launched",
1257
1264
  port: t
1258
1265
  };
1259
- }, jn = class extends Error {
1266
+ }, Fn = class extends Error {
1260
1267
  _voltroDeferral = !0;
1261
1268
  constructor(e) {
1262
1269
  super(e), this.name = "DeferralNotSupportedError";
1263
1270
  }
1264
- }, Mn = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Nn = (e) => {
1271
+ }, In = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Ln = (e) => {
1265
1272
  if (!(e instanceof Error)) return;
1266
1273
  let t = e._voltroControl;
1267
1274
  if (t === "redirect") {
@@ -1283,7 +1290,7 @@ import {
1283
1290
  },
1284
1291
  body: "not found"
1285
1292
  };
1286
- }, Pn = (e) => {
1293
+ }, Rn = (e) => {
1287
1294
  let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
1288
1295
  for (let [n, o] of Object.entries(e.segmentLoaderData)) {
1289
1296
  let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
@@ -1298,7 +1305,7 @@ import {
1298
1305
  ...e.layoutShell ? { layoutShell: e.layoutShell } : {}
1299
1306
  });
1300
1307
  } catch (e) {
1301
- throw new jn(e instanceof Error ? e.message : String(e));
1308
+ throw new Fn(e instanceof Error ? e.message : String(e));
1302
1309
  }
1303
1310
  return {
1304
1311
  loaderData: n.renderData,
@@ -1314,8 +1321,8 @@ import {
1314
1321
  ...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
1315
1322
  }
1316
1323
  };
1317
- }, Fn = (e) => {
1318
- let { helpers: t, renderInput: n } = e, r = Pn({
1324
+ }, zn = (e) => {
1325
+ let { helpers: t, renderInput: n } = e, r = Rn({
1319
1326
  helpers: t,
1320
1327
  page: e.page,
1321
1328
  pathname: n.pathname,
@@ -1336,19 +1343,19 @@ import {
1336
1343
  stateScript: t.renderRouterStateScript(r.stateInput),
1337
1344
  hasDeferred: r.hasDeferred
1338
1345
  };
1339
- }, In = (e) => {
1346
+ }, Bn = (e) => {
1340
1347
  let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
1341
1348
  return {
1342
1349
  body: t,
1343
1350
  meta: n
1344
1351
  };
1345
- }, Ln = (e) => [
1352
+ }, Vn = (e) => [
1346
1353
  ...e.extra ?? [],
1347
1354
  e.helpers.renderMetaToHtml(e.meta),
1348
1355
  `<meta name="voltro-interactive" content="${e.interactive}" />`,
1349
1356
  ...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
1350
1357
  e.prepared.stateScript
1351
- ].filter((e) => e.length > 0).join("\n "), Rn = (e) => {
1358
+ ].filter((e) => e.length > 0).join("\n "), Hn = (e) => {
1352
1359
  let t = e.indexOf("?");
1353
1360
  return t === -1 ? {
1354
1361
  pathname: e || "/",
@@ -1357,9 +1364,9 @@ import {
1357
1364
  pathname: e.slice(0, t) || "/",
1358
1365
  search: e.slice(t)
1359
1366
  };
1360
- }, zn = /Could not find required `intl` object/, Bn = "__voltro_i18n_instances__", Vn = (e = globalThis) => {
1367
+ }, Un = /Could not find required `intl` object/, Wn = "__voltro_i18n_instances__", Gn = (e = globalThis) => {
1361
1368
  try {
1362
- let t = e[Bn]?.records;
1369
+ let t = e[Wn]?.records;
1363
1370
  return t === void 0 || t.length === 0 ? void 0 : {
1364
1371
  instances: t.length,
1365
1372
  reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
@@ -1368,7 +1375,7 @@ import {
1368
1375
  } catch {
1369
1376
  return;
1370
1377
  }
1371
- }, Hn = (e, t) => [
1378
+ }, Kn = (e, t) => [
1372
1379
  "",
1373
1380
  "── voltro diagnosis ───────────────────────────────────────────────────",
1374
1381
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1386,7 +1393,7 @@ import {
1386
1393
  " versions on disk; this counts instances in the running process, and one",
1387
1394
  " file loaded down two paths is two instances.",
1388
1395
  "───────────────────────────────────────────────────────────────────────"
1389
- ].join("\n"), Un = (e, t) => [
1396
+ ].join("\n"), qn = (e, t) => [
1390
1397
  "",
1391
1398
  "── voltro diagnosis ───────────────────────────────────────────────────",
1392
1399
  `${e} DID wrap this render in <I18nProvider>, and this process`,
@@ -1402,7 +1409,7 @@ import {
1402
1409
  " direct import can land on a second copy that this count does not see —",
1403
1410
  " it counts what @voltro/i18n is bound to.",
1404
1411
  "───────────────────────────────────────────────────────────────────────"
1405
- ].join("\n"), Wn = (e) => [
1412
+ ].join("\n"), Jn = (e) => [
1406
1413
  "",
1407
1414
  "── voltro diagnosis ───────────────────────────────────────────────────",
1408
1415
  `${e} DID wrap this render in <I18nProvider> — the framework`,
@@ -1418,34 +1425,34 @@ import {
1418
1425
  " Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
1419
1426
  " the duplication here is of module instances in one process.",
1420
1427
  "───────────────────────────────────────────────────────────────────────"
1421
- ].join("\n"), Gn = (e, t, n, r = Vn()) => {
1428
+ ].join("\n"), Yn = (e, t, n, r = Gn()) => {
1422
1429
  if (!t) return;
1423
1430
  let i = String(e?.message ?? e);
1424
- if (zn.test(i)) return r === void 0 ? Wn(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Hn(n, r) : Un(n, r);
1425
- }, Kn = "<div id=\"root\"></div>", qn = "<div id=\"root\">", Jn = "</div>", Yn = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Xn = /\bsrc=["']([^"']+)["']/i, Zn = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Qn = (e) => {
1426
- let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Yn, (e) => {
1427
- let r = Xn.exec(e)?.[1];
1431
+ if (Un.test(i)) return r === void 0 ? Jn(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Kn(n, r) : qn(n, r);
1432
+ }, Xn = "<div id=\"root\"></div>", Zn = "<div id=\"root\">", Qn = "</div>", $n = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, er = /\bsrc=["']([^"']+)["']/i, tr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, nr = (e) => {
1433
+ let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace($n, (e) => {
1434
+ let r = er.exec(e)?.[1];
1428
1435
  return r === void 0 || t(r) ? e : (n.push(r), "");
1429
1436
  });
1430
- e.inlineModuleScriptsAsync && (r = r.replace(Zn, "<script async$1>"));
1431
- let i = r.indexOf(Kn);
1432
- if (i === -1) throw Error(`[voltro] the generated shell has no \`${Kn}\` 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.`);
1437
+ e.inlineModuleScriptsAsync && (r = r.replace(tr, "<script async$1>"));
1438
+ let i = r.indexOf(Xn);
1439
+ if (i === -1) throw Error(`[voltro] the generated shell has no \`${Xn}\` 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.`);
1433
1440
  return {
1434
- head: `${r.slice(0, i)}${qn}`,
1435
- tail: `${Jn}${r.slice(i + 21)}`,
1441
+ head: `${r.slice(0, i)}${Zn}`,
1442
+ tail: `${Qn}${r.slice(i + 21)}`,
1436
1443
  bootstrapModules: n
1437
1444
  };
1438
- }, $n = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), er = (e) => $n(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), tr = (e) => {
1445
+ }, rr = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), ir = (e) => rr(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), ar = (e) => {
1439
1446
  let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
1440
1447
  if (s || !o || a === null) return;
1441
1448
  s = !0, t.statusCode = e.statusCode ?? 200;
1442
1449
  for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
1443
- t.flushHeaders?.(), t.write(er({
1450
+ t.flushHeaders?.(), t.write(ir({
1444
1451
  head: n.head,
1445
1452
  headInjection: i(a.meta),
1446
1453
  htmlLang: r
1447
1454
  }));
1448
- let c = new de();
1455
+ let c = new me();
1449
1456
  c.pipe(t, { end: !1 }), c.on("end", () => {
1450
1457
  t.end(n.tail);
1451
1458
  }), a.stream.pipe(c);
@@ -1470,42 +1477,81 @@ import {
1470
1477
  return;
1471
1478
  }
1472
1479
  c();
1473
- }, nr = (e) => Array.isArray(e.preload) && e.preload.length > 0, rr = (e, t) => typeof e == "string" ? {
1480
+ }, or = (e) => Array.isArray(e.preload) && e.preload.length > 0, sr = (e, t) => typeof e == "string" ? {
1474
1481
  tag: e,
1475
1482
  input: {}
1476
1483
  } : {
1477
1484
  tag: e.tag,
1478
1485
  input: e.input?.(t) ?? {}
1479
- }, ir = async (e) => {
1480
- let { pageMod: t, params: n, query: r, apiName: i, seed: a, onError: o } = e;
1481
- if (nr(t) && !(r === void 0 || i === void 0)) for (let e of t.preload) {
1482
- let { tag: t, input: s } = rr(e, n);
1486
+ }, cr = async (e) => {
1487
+ let { pageMod: t, params: n, query: r, apiName: i, seed: a, seedFailure: o, onError: s } = e;
1488
+ if (or(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
1489
+ let { tag: t, input: c } = sr(e, n);
1483
1490
  try {
1484
- a(i, t, s, await r(t, s));
1491
+ a(i, t, c, await r(t, c));
1485
1492
  } catch (e) {
1486
- o?.({
1493
+ o(i, t, c), s?.({
1487
1494
  tag: t,
1488
1495
  apiName: i
1489
1496
  }, e);
1490
1497
  }
1491
1498
  }
1492
- }, Z = L({ scope: "voltro:dev:web" }), ar = L({ scope: "vite" }), or = await (async () => {
1499
+ }, lr = (e) => a.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : o.test(e) || l.test(e) || i.test(e), ur = /* @__PURE__ */ new Set([
1500
+ "node_modules",
1501
+ "dist",
1502
+ ".framework",
1503
+ ".git"
1504
+ ]), dr = async (e) => {
1505
+ let t = [], n = async (e) => {
1506
+ let r;
1507
+ try {
1508
+ r = await M.readdir(e, { withFileTypes: !0 });
1509
+ } catch {
1510
+ return;
1511
+ }
1512
+ for (let i of r) if (!(i.name.startsWith(".") && i.isDirectory())) {
1513
+ if (i.isDirectory()) {
1514
+ if (ur.has(i.name)) continue;
1515
+ await n(O(e, i.name));
1516
+ } else lr(i.name) && t.push(O(e, i.name));
1517
+ }
1518
+ };
1519
+ return await n(e), t.sort();
1520
+ }, fr = async (e) => {
1521
+ let t = q("sha1");
1522
+ for (let n of await dr(e)) {
1523
+ t.update(n.slice(e.length)), t.update("\0");
1524
+ try {
1525
+ t.update(await M.readFile(n));
1526
+ } catch {}
1527
+ t.update("\0");
1528
+ }
1529
+ try {
1530
+ t.update(await M.readFile(O(e, "rpcGroup.generated.ts")));
1531
+ } catch {}
1532
+ return t.digest("hex");
1533
+ }, pr = async (e) => {
1534
+ if (e.length === 0) return;
1535
+ let t = [];
1536
+ for (let n of [...e].sort()) t.push(await fr(n));
1537
+ return q("sha1").update(t.join("\0")).digest("hex");
1538
+ }, Z = V({ scope: "voltro:dev:web" }), mr = V({ scope: "vite" }), hr = await (async () => {
1493
1539
  try {
1494
- let e = w(C(P(import.meta.url)), "..", "package.json"), t = await O.readFile(e, "utf8");
1540
+ let e = O(D(R(import.meta.url)), "..", "package.json"), t = await M.readFile(e, "utf8");
1495
1541
  return JSON.parse(t).version ?? "0.0.0";
1496
1542
  } catch {
1497
1543
  return "0.0.0";
1498
1544
  }
1499
- })(), sr = async () => {
1545
+ })(), gr = async () => {
1500
1546
  try {
1501
- let e = C(P(import.meta.url)), t = E(e, "..", "..", "devtools");
1502
- if (D(w(t, "package.json"))) return t;
1503
- let n = E(e, "..", "..", "..", "devtools");
1504
- return D(w(n, "package.json")) ? n : null;
1547
+ let e = D(R(import.meta.url)), t = A(e, "..", "..", "devtools");
1548
+ if (j(O(t, "package.json"))) return t;
1549
+ let n = A(e, "..", "..", "..", "devtools");
1550
+ return j(O(n, "package.json")) ? n : null;
1505
1551
  } catch {
1506
1552
  return null;
1507
1553
  }
1508
- }, cr = (e, t) => e.disableDevtools || !t ? [] : [
1554
+ }, _r = (e, t) => e.disableDevtools || !t ? [] : [
1509
1555
  "",
1510
1556
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
1511
1557
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -1515,87 +1561,87 @@ import {
1515
1561
  " await import('@voltro/devtools/styles.css')",
1516
1562
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
1517
1563
  "}"
1518
- ], lr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ur = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], dr = (e) => e.sentry ? [
1564
+ ], vr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], yr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], br = (e) => e.sentry ? [
1519
1565
  "",
1520
1566
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
1521
1567
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
1522
1568
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
1523
- ] : [], fr = (e) => e.env ? ["import './env.public'"] : [], pr = (e) => {
1524
- let t = [], n = E(e);
1569
+ ] : [], xr = (e) => e.env ? ["import './env.public'"] : [], Sr = (e) => {
1570
+ let t = [], n = A(e);
1525
1571
  for (;;) {
1526
- D(w(n, "pnpm-workspace.yaml")) && t.push(n);
1527
- let e = C(n);
1572
+ j(O(n, "pnpm-workspace.yaml")) && t.push(n);
1573
+ let e = D(n);
1528
1574
  if (e === n) break;
1529
1575
  n = e;
1530
1576
  }
1531
1577
  return t;
1532
- }, mr = g, hr = (e) => {
1578
+ }, Cr = b, wr = (e) => {
1533
1579
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
1534
1580
  let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
1535
1581
  if (t) return `island-${t[1]}`;
1536
- }, gr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, _r = (e) => e.startsWith("(") && e.endsWith(")"), vr = (e) => e.filter((e) => !_r(e)), yr = (e) => {
1537
- let t = e.replace(a, "").split("/").filter(Boolean).filter((e) => !_r(e));
1582
+ }, Tr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Er = (e) => e.startsWith("(") && e.endsWith(")"), Dr = (e) => e.filter((e) => !Er(e)), Or = (e) => {
1583
+ let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Er(e));
1538
1584
  return t.length === 0 ? "/" : "/" + t.join("/");
1539
- }, br = (e) => `${e.replace(a, "").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) => {
1540
- let t = [], n = [], r = async (e, o) => {
1541
- let s = [];
1585
+ }, kr = (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) => {
1586
+ let t = [], n = [], r = async (e, i) => {
1587
+ let a = [];
1542
1588
  try {
1543
- s = await O.readdir(e, { withFileTypes: !0 });
1589
+ a = await M.readdir(e, { withFileTypes: !0 });
1544
1590
  } catch {
1545
1591
  return;
1546
1592
  }
1547
- let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !mr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
1548
- if (l.some((e) => i.has(e))) {
1593
+ let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Cr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
1594
+ if (l.some((e) => s.has(e))) {
1549
1595
  let t = u.has("layout.tsx"), r = !1;
1550
1596
  if (t) try {
1551
- let t = await O.readFile(w(e, "layout.tsx"), "utf8");
1552
- r = gr.test(t);
1597
+ let t = await M.readFile(O(e, "layout.tsx"), "utf8");
1598
+ r = Tr.test(t);
1553
1599
  } catch {}
1554
1600
  n.push({
1555
1601
  dir: d,
1556
- chain: o,
1557
- contributesToUrl: o.length === 0 || !_r(o[o.length - 1]),
1602
+ chain: i,
1603
+ contributesToUrl: i.length === 0 || !Er(i[i.length - 1]),
1558
1604
  hasLayout: t,
1559
1605
  hasLayoutLoader: r,
1560
1606
  hasError: u.has("error.tsx"),
1561
1607
  hasPending: u.has("loading.tsx"),
1562
1608
  hasNotFound: u.has("not-found.tsx"),
1563
- specialFiles: l.filter((e) => i.has(e))
1609
+ specialFiles: l.filter((e) => s.has(e))
1564
1610
  });
1565
1611
  }
1566
1612
  for (let e of l) {
1567
- if (!a.test(e)) continue;
1613
+ if (!c.test(e)) continue;
1568
1614
  let n = d ? `${d}/${e}` : e;
1569
1615
  t.push({
1570
1616
  file: n,
1571
- pattern: yr(n),
1572
- ident: br(n),
1573
- dirChain: o
1617
+ pattern: Or(n),
1618
+ ident: kr(n),
1619
+ dirChain: i
1574
1620
  });
1575
1621
  }
1576
- for (let t of c) await r(w(e, t), [...o, t]);
1622
+ for (let t of o) await r(O(e, t), [...i, t]);
1577
1623
  };
1578
1624
  await r(e, []), t.sort((e, t) => e.file < t.file ? -1 : 1);
1579
- let o = /* @__PURE__ */ new Set();
1580
- for (let e of t) for (let t = e.dirChain.length; t >= 0; t--) o.add(e.dirChain.slice(0, t).join("/"));
1581
- let s = [], c = [];
1582
- for (let { specialFiles: e, ...t } of n) o.has(t.dir) ? s.push(t) : c.push({
1625
+ let i = /* @__PURE__ */ new Set();
1626
+ for (let e of t) for (let t = e.dirChain.length; t >= 0; t--) i.add(e.dirChain.slice(0, t).join("/"));
1627
+ let a = [], o = [];
1628
+ for (let { specialFiles: e, ...t } of n) i.has(t.dir) ? a.push(t) : o.push({
1583
1629
  dir: t.dir,
1584
1630
  files: e
1585
1631
  });
1586
1632
  return {
1587
1633
  pages: t,
1588
- dirs: s,
1589
- orphanedSpecials: c
1634
+ dirs: a,
1635
+ orphanedSpecials: o
1590
1636
  };
1591
- }, xr = (e, t) => {
1637
+ }, Ar = (e, t) => {
1592
1638
  let n = [];
1593
1639
  for (let r = 0; r <= t.length; r++) {
1594
1640
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
1595
1641
  a && n.push(a);
1596
1642
  }
1597
1643
  return n;
1598
- }, Sr = async (e) => {
1644
+ }, jr = async (e) => {
1599
1645
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
1600
1646
  return {
1601
1647
  chain: await Promise.all(t.map(async (e, t) => {
@@ -1608,7 +1654,8 @@ import {
1608
1654
  search: a.search,
1609
1655
  signal: a.signal,
1610
1656
  headers: a.headers,
1611
- query: a.query
1657
+ query: a.query,
1658
+ isServer: !0
1612
1659
  }));
1613
1660
  }
1614
1661
  return e.hasError && (s.Error = (await r(e)).default), e.hasPending && (s.Pending = (await i(e)).default), {
@@ -1618,10 +1665,10 @@ import {
1618
1665
  })),
1619
1666
  segmentLoaderData: o
1620
1667
  };
1621
- }, Cr = (e) => {
1622
- let t = vr(e);
1668
+ }, Mr = (e) => {
1669
+ let t = Dr(e);
1623
1670
  return t.length === 0 ? "" : "/" + t.join("/");
1624
- }, wr = [
1671
+ }, Nr = [
1625
1672
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
1626
1673
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
1627
1674
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -1714,7 +1761,7 @@ import {
1714
1761
  " _vdtErrorStart('Build error')",
1715
1762
  " })",
1716
1763
  "}"
1717
- ].join("\n"), Tr = (e) => {
1764
+ ].join("\n"), Pr = (e) => {
1718
1765
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
1719
1766
  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, "\\$&"));
1720
1767
  let a = i.join("/");
@@ -1723,8 +1770,8 @@ import {
1723
1770
  paramNames: t,
1724
1771
  priority: n
1725
1772
  };
1726
- }, Er = (e) => e.map((e) => {
1727
- let { regex: t, paramNames: n, priority: r } = Tr(e.pattern);
1773
+ }, Fr = (e) => e.map((e) => {
1774
+ let { regex: t, paramNames: n, priority: r } = Pr(e.pattern);
1728
1775
  return {
1729
1776
  pattern: e.pattern,
1730
1777
  file: e.file,
@@ -1733,7 +1780,7 @@ import {
1733
1780
  paramNames: n,
1734
1781
  priority: r
1735
1782
  };
1736
- }).slice().sort((e, t) => e.priority - t.priority), Dr = (e, t) => {
1783
+ }).slice().sort((e, t) => e.priority - t.priority), Ir = (e, t) => {
1737
1784
  for (let n of t) {
1738
1785
  let t = n.regex.exec(e);
1739
1786
  if (!t) continue;
@@ -1745,9 +1792,9 @@ import {
1745
1792
  };
1746
1793
  }
1747
1794
  return null;
1748
- }, Or = Se, kr = async (e) => {
1795
+ }, Lr = Ee, Rr = async (e) => {
1749
1796
  try {
1750
- let t = await import(F(w(e, "app.config.ts")).href), n = t.default?.port, i = r({
1797
+ let t = await import(z(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
1751
1798
  kind: "api",
1752
1799
  configPort: typeof n == "number" ? n : void 0,
1753
1800
  env: {}
@@ -1761,7 +1808,7 @@ import {
1761
1808
  kind: "api",
1762
1809
  env: {}
1763
1810
  }).port };
1764
- }, Ar = (e, t) => ({
1811
+ }, zr = (e, t) => ({
1765
1812
  name: e,
1766
1813
  pkg: t.package,
1767
1814
  browserWsUrl: t.url,
@@ -1769,7 +1816,7 @@ import {
1769
1816
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
1770
1817
  ...t.headers ? { headers: t.headers } : {},
1771
1818
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1772
- }), jr = (e, t, n) => {
1819
+ }), Br = (e, t, n) => {
1773
1820
  let r = t.transport?.wsPath ?? n.wsPath;
1774
1821
  return {
1775
1822
  name: e,
@@ -1781,7 +1828,7 @@ import {
1781
1828
  ...t.headers ? { headers: t.headers } : {},
1782
1829
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1783
1830
  };
1784
- }, Mr = (e) => {
1831
+ }, Vr = (e) => {
1785
1832
  let t = /* @__PURE__ */ new Map();
1786
1833
  for (let n of e) {
1787
1834
  if (n.proxyTarget === void 0) continue;
@@ -1789,43 +1836,43 @@ import {
1789
1836
  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>.`);
1790
1837
  t.set(n.browserWsUrl, n.name);
1791
1838
  }
1792
- }, Nr = async (e, t) => {
1839
+ }, Hr = async (e, t) => {
1793
1840
  let n = Object.entries(t.apis ?? {}), r = [];
1794
1841
  for (let [t, i] of n) {
1795
1842
  if (i.url) {
1796
- r.push(Ar(t, i));
1843
+ r.push(zr(t, i));
1797
1844
  continue;
1798
1845
  }
1799
- let n = await Or(e, i.package);
1846
+ let n = await Lr(e, i.package);
1800
1847
  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.`);
1801
- r.push(jr(t, i, await kr(n)));
1848
+ r.push(Br(t, i, await Rr(n)));
1802
1849
  }
1803
- return Mr(r), r;
1804
- }, Pr = (e) => {
1850
+ return Vr(r), r;
1851
+ }, Ur = (e) => {
1805
1852
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
1806
1853
  let t = new URL(e);
1807
1854
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
1808
1855
  } catch {
1809
1856
  return;
1810
1857
  }
1811
- }, Fr = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, Ir = (e) => process.env[Fr(e)] ?? process.env.VOLTRO_API_ORIGIN, Lr = (e, t) => {
1858
+ }, Wr = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, Gr = (e) => process.env[Wr(e)] ?? process.env.VOLTRO_API_ORIGIN, Kr = (e, t) => {
1812
1859
  if (!e) return;
1813
- let n = Ir(e.name) ?? e.serverOrigin;
1860
+ let n = Gr(e.name) ?? e.serverOrigin;
1814
1861
  if (n) {
1815
- let e = Pr(n);
1862
+ let e = Ur(n);
1816
1863
  if (e) return e;
1817
1864
  }
1818
1865
  if (t?.allowDevProxy && e.proxyTarget) {
1819
- let t = Pr(e.proxyTarget);
1866
+ let t = Ur(e.proxyTarget);
1820
1867
  if (t) return t;
1821
1868
  }
1822
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Pr(e.browserWsUrl);
1823
- }, Rr = (e, t, n) => {
1869
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Ur(e.browserWsUrl);
1870
+ }, qr = (e, t, n) => {
1824
1871
  if (!e) {
1825
1872
  if (n?.apiName === void 0) return;
1826
1873
  let e = n.apiName;
1827
1874
  return async () => {
1828
- 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 ${Fr(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.`);
1875
+ 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 ${Wr(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.`);
1829
1876
  };
1830
1877
  }
1831
1878
  return async (r, i) => {
@@ -1847,7 +1894,7 @@ import {
1847
1894
  });
1848
1895
  } catch (t) {
1849
1896
  let i = t?.cause?.code ?? String(t?.message ?? t);
1850
- throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Fr(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 });
1897
+ throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Wr(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 });
1851
1898
  }
1852
1899
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
1853
1900
  let s = await o.json();
@@ -1867,7 +1914,7 @@ import {
1867
1914
  }, l, u = !1;
1868
1915
  for (let e of s) {
1869
1916
  if (e._tag === "ClientProtocolError") throw Error(`[loader.query] ${r}: protocol error ${JSON.stringify(e.error)}`);
1870
- if (!(e.requestId !== void 0 && String(e.requestId) !== "0")) {
1917
+ if (e.requestId === void 0 || String(e.requestId) === "0") {
1871
1918
  if (e._tag === "Chunk" && e.values && e.values.length > 0 && !u && (l = c(e.values[0]), u = !0), e._tag === "Defect") throw Error(`[loader.query] ${r}: defect ${JSON.stringify(e)}`);
1872
1919
  if (e._tag === "Exit" && e.exit) {
1873
1920
  if (e.exit._tag === "Failure") throw Error(`[loader.query] ${r}: rpc failed ${JSON.stringify(e.exit.cause ?? e.exit)}`);
@@ -1877,8 +1924,8 @@ import {
1877
1924
  }
1878
1925
  if (u) return l;
1879
1926
  };
1880
- }, zr = async (e, t, n, r = {}) => {
1881
- let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = D(w(e, "node_modules", "@voltro", "devtools", "package.json")) || await sr() !== null, s = t.theme === "system" ? [
1927
+ }, Jr = async (e, t, n, r = {}) => {
1928
+ let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = j(O(e, "node_modules", "@voltro", "devtools", "package.json")) || await gr() !== null, s = t.theme === "system" ? [
1882
1929
  " <script>",
1883
1930
  " (function () {",
1884
1931
  " var root = document.documentElement",
@@ -1916,15 +1963,15 @@ import {
1916
1963
  " </body>",
1917
1964
  "</html>",
1918
1965
  ""
1919
- ].join("\n"), l = w(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
1920
- await h(l, u);
1966
+ ].join("\n"), l = O(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
1967
+ await y(l, u);
1921
1968
  for (let e of f) 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.`);
1922
- let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, g = n.map((e) => `import { appGroup as ${p(e.name)}, appDescriptors as ${m(e.name)} } from '${e.pkg}/rpcGroup'`);
1923
- n.some((e) => e.hasAuthHeaders) && (g.push("import __voltroAppConfig from '../app.config'"), g.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
1924
- let _ = n.map((e) => {
1969
+ let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, h = n.map((e) => `import { appGroup as ${p(e.name)}, appDescriptors as ${m(e.name)} } from '${e.pkg}/rpcGroup'`);
1970
+ n.some((e) => e.hasAuthHeaders) && (h.push("import __voltroAppConfig from '../app.config'"), h.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
1971
+ let g = n.map((e) => {
1925
1972
  let t = [`group: ${p(e.name)}`];
1926
1973
  return t.push(`descriptors: ${m(e.name)}`), t.push(`wsUrl: ${JSON.stringify(e.browserWsUrl)}`), e.hasAuthHeaders ? t.push(`headers: __voltroAuthHeaders?.[${JSON.stringify(e.name)}]?.authHeaders`) : e.headers && t.push(`headers: ${JSON.stringify(e.headers)}`), ` ${JSON.stringify(e.name)}: { ${t.join(", ")} },`;
1927
- }), v, y, b;
1974
+ }), _, v, b;
1928
1975
  if (u.length > 0) {
1929
1976
  let n = u.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
1930
1977
  for (let e of d) {
@@ -1932,13 +1979,13 @@ import {
1932
1979
  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'`);
1933
1980
  }
1934
1981
  let i = u.map((e) => {
1935
- let t = xr(d, e.dirChain).map((e) => {
1982
+ let t = Ar(d, e.dirChain).map((e) => {
1936
1983
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
1937
1984
  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(", ")} }`;
1938
1985
  }).join(",\n");
1939
1986
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
1940
1987
  }), a = d.filter((e) => e.hasNotFound).map((e) => {
1941
- let t = Cr(e.chain), n = xr(d, e.chain).map((e) => {
1988
+ let t = Mr(e.chain), n = Ar(d, e.chain).map((e) => {
1942
1989
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
1943
1990
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
1944
1991
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
@@ -1973,18 +2020,18 @@ import {
1973
2020
  kind: "page",
1974
2021
  slotKey: e.pattern
1975
2022
  });
1976
- let h = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
2023
+ let y = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
1977
2024
  let n = JSON.stringify(e.slotKey);
1978
2025
  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 }`;
1979
- }), S = t.locales ?? [], C = S.length > 0 && S.every((t) => D(w(e, "src", "locales", `${t}.ts`)) || D(w(e, "src", "locales", `${t}.tsx`))), T = C, E = t.defaultLocale ?? S[0] ?? "en";
1980
- 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(E)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${E}' must be one of locales [${S.join(", ")}]`);
1981
- let O = T ? [
2026
+ }), S = t.locales ?? [], C = S.length > 0 && S.every((t) => j(O(e, "src", "locales", `${t}.ts`)) || j(O(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en";
2027
+ 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(", ")}]`);
2028
+ let E = w ? [
1982
2029
  "import { I18nProvider } from '@voltro/i18n'",
1983
2030
  "import { resolveLocale } from '@voltro/i18n/server'",
1984
2031
  "import { useServerRequest } from '@voltro/web'",
1985
2032
  ...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
1986
2033
  ] : [];
1987
- y = [
2034
+ v = [
1988
2035
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
1989
2036
  "// Routes + per-page chain + not-found scopes assembled from src/pages/.",
1990
2037
  "//",
@@ -2095,7 +2142,7 @@ import {
2095
2142
  "if (import.meta.hot) {",
2096
2143
  " import.meta.hot.accept(",
2097
2144
  " [",
2098
- ...h,
2145
+ ...y,
2099
2146
  " ],",
2100
2147
  " (newMods: Array<Record<string, unknown> | undefined>) => {",
2101
2148
  " let changed = false",
@@ -2105,7 +2152,7 @@ import {
2105
2152
  " )",
2106
2153
  "}",
2107
2154
  ""
2108
- ].join("\n"), v = [
2155
+ ].join("\n"), _ = [
2109
2156
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2110
2157
  "// The app's root component. It exports `App` and NOTHING ELSE: react-refresh",
2111
2158
  "// only accepts a module whose every export is a component, and a module it",
@@ -2116,16 +2163,16 @@ import {
2116
2163
  "",
2117
2164
  "import { useMemo, useSyncExternalStore } from 'react'",
2118
2165
  "import { Router } from '@voltro/web'",
2119
- ...O,
2166
+ ...E,
2120
2167
  "import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
2121
2168
  "",
2122
- ...T ? [
2169
+ ...w ? [
2123
2170
  `// i18n auto-wiring (config.locales = [${S.map((e) => JSON.stringify(e)).join(", ")}]).`,
2124
2171
  "const I18N_CATALOGS: Record<string, import('@voltro/i18n').MessageCatalog> = {",
2125
2172
  ...S.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
2126
2173
  "}",
2127
2174
  `const I18N_SUPPORTED: ReadonlyArray<string> = [${S.map((e) => JSON.stringify(e)).join(", ")}]`,
2128
- `const I18N_DEFAULT = ${JSON.stringify(E)}`,
2175
+ `const I18N_DEFAULT = ${JSON.stringify(T)}`,
2129
2176
  "",
2130
2177
  "const pickI18nLocale = (ssr: ReturnType<typeof useServerRequest>): string => {",
2131
2178
  " if (ssr) {",
@@ -2176,7 +2223,7 @@ import {
2176
2223
  " const v = useSyncExternalStore(subscribe, getVersion, getVersion)",
2177
2224
  " const routes = useMemo(() => buildRoutes(), [v])",
2178
2225
  " const notFounds = useMemo(() => buildNotFounds(), [v])",
2179
- ...T ? [
2226
+ ...w ? [
2180
2227
  " const ssr = useServerRequest()",
2181
2228
  " const locale = pickI18nLocale(ssr)",
2182
2229
  " const messages = I18N_CATALOGS[locale] ?? I18N_CATALOGS[I18N_DEFAULT]!",
@@ -2194,14 +2241,14 @@ import {
2194
2241
  "// resolved apis map. Side-effect only — no local component definitions —",
2195
2242
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2196
2243
  "",
2197
- ...fr(t),
2244
+ ...xr(t),
2198
2245
  "import { mount } from '@voltro/web'",
2199
- ...g,
2246
+ ...h,
2200
2247
  "import { App } from './app'",
2201
2248
  "import { preloadCurrentRoute } from './routeTable'",
2202
- ...ur(t),
2203
- ...cr(t, o),
2204
- ...dr(t),
2249
+ ...yr(t),
2250
+ ..._r(t, o),
2251
+ ...br(t),
2205
2252
  "",
2206
2253
  "// Preload the current route's page chunk BEFORE hydration so the first",
2207
2254
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2216,137 +2263,137 @@ import {
2216
2263
  "",
2217
2264
  "mount(App, {",
2218
2265
  " apis: {",
2219
- ..._,
2266
+ ...g,
2220
2267
  " },",
2221
- ...lr(t, o),
2268
+ ...vr(t, o),
2222
2269
  "})",
2223
2270
  "",
2224
- wr
2271
+ Nr
2225
2272
  ].join("\n");
2226
- } else v = "", y = "", b = [
2273
+ } else _ = "", v = "", b = [
2227
2274
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
2228
2275
  "// The user's root component lives at ../src/App.tsx; this file imports it",
2229
2276
  "// and calls mount(). Side-effect only, no component definitions, so the",
2230
2277
  "// user's component file remains the Fast Refresh boundary.",
2231
2278
  "",
2232
- ...fr(t),
2279
+ ...xr(t),
2233
2280
  "import { mount } from '@voltro/web'",
2234
- ...g,
2281
+ ...h,
2235
2282
  "import App from '../src/App'",
2236
- ...ur(t),
2237
- ...cr(t, o),
2238
- ...dr(t),
2283
+ ...yr(t),
2284
+ ..._r(t, o),
2285
+ ...br(t),
2239
2286
  "",
2240
2287
  "mount(App, {",
2241
2288
  " apis: {",
2242
- ..._,
2289
+ ...g,
2243
2290
  " },",
2244
- ...lr(t, o),
2291
+ ...vr(t, o),
2245
2292
  "})",
2246
2293
  "",
2247
- wr
2294
+ Nr
2248
2295
  ].join("\n");
2249
- let x = w(e, ".framework");
2250
- await O.mkdir(x, { recursive: !0 }), t.env ? await _e(x, r) : await O.rm(w(x, "env.public.ts"), { force: !0 }), await O.writeFile(w(x, "index.html"), c, "utf8"), await O.writeFile(w(x, "main.tsx"), b, "utf8"), v ? (await O.writeFile(w(x, "app.tsx"), v, "utf8"), await O.writeFile(w(x, "routeTable.ts"), y, "utf8")) : (await O.rm(w(x, "app.tsx"), { force: !0 }), await O.rm(w(x, "routeTable.ts"), { force: !0 }));
2251
- let S = w(e, ".gitignore"), C = "";
2296
+ let x = O(e, ".framework");
2297
+ await M.mkdir(x, { recursive: !0 }), t.env ? await xe(x, r) : await M.rm(O(x, "env.public.ts"), { force: !0 }), await M.writeFile(O(x, "index.html"), c, "utf8"), await M.writeFile(O(x, "main.tsx"), b, "utf8"), _ ? (await M.writeFile(O(x, "app.tsx"), _, "utf8"), await M.writeFile(O(x, "routeTable.ts"), v, "utf8")) : (await M.rm(O(x, "app.tsx"), { force: !0 }), await M.rm(O(x, "routeTable.ts"), { force: !0 }));
2298
+ let S = O(e, ".gitignore"), C = "";
2252
2299
  try {
2253
- C = await O.readFile(S, "utf8");
2300
+ C = await M.readFile(S, "utf8");
2254
2301
  } catch {}
2255
- let T = ["/.framework/"], E = new Set(C.split("\n").map((e) => e.trim())), k = T.filter((e) => !E.has(e));
2256
- if (k.length > 0) {
2302
+ let w = ["/.framework/"], T = new Set(C.split("\n").map((e) => e.trim())), E = w.filter((e) => !T.has(e));
2303
+ if (E.length > 0) {
2257
2304
  let e = C === "" || C.endsWith("\n") ? "" : "\n";
2258
2305
  try {
2259
- await O.appendFile(S, `${e}${k.join("\n")}\n`, "utf8");
2306
+ await M.appendFile(S, `${e}${E.join("\n")}\n`, "utf8");
2260
2307
  } catch (e) {
2261
- Z.warn(`could not add ${k.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
2308
+ Z.warn(`could not add ${E.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
2262
2309
  }
2263
2310
  }
2264
- }, Br = async (e, t) => {
2311
+ }, Yr = async (e, t) => {
2265
2312
  try {
2266
- let n = w(C(e), "project.json");
2267
- if (!D(n)) return;
2268
- let r = await O.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
2269
- for (let [e, n] of Object.entries(i)) e !== a && n.port === t && o.push(e);
2270
- if (o.length === 0) return;
2313
+ let n = D(e), r = O(n, "project.json");
2314
+ if (!j(r)) return;
2315
+ let i = await M.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
2316
+ for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
2317
+ if (s.length === 0) return;
2271
2318
  Z.warn("sibling app(s) claim the same port — only one boots", {
2272
2319
  port: t,
2273
- conflicts: o,
2274
- projectJson: n
2320
+ conflicts: s,
2321
+ projectJson: r
2275
2322
  });
2276
2323
  } catch {}
2277
- }, Vr = (e) => w(e, ".framework", "dist", "server", "appConfig.js"), Hr = async (e, t = {}) => {
2278
- let n = Vr(e), r = t.preferSource !== !0 && D(n) ? n : w(e, "app.config.ts");
2324
+ }, Xr = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), Zr = async (e, t = {}) => {
2325
+ let n = Xr(e), r = t.preferSource !== !0 && j(n) ? n : O(e, "app.config.ts");
2279
2326
  try {
2280
- let e = (await import(F(r).href)).default;
2327
+ let e = (await import(z(r).href)).default;
2281
2328
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2282
2329
  } catch {
2283
2330
  return null;
2284
2331
  }
2285
- }, Ur = async (e) => {
2286
- let n = await Hr(e, { preferSource: !0 });
2332
+ }, Qr = async (e) => {
2333
+ let n = await Zr(e, { preferSource: !0 });
2287
2334
  if (!n) return {
2288
2335
  ran: !1,
2289
2336
  exitCode: 0
2290
2337
  };
2291
- an();
2292
- let i = yt();
2293
- Lt(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), Ve(e, Z);
2294
- let a = await Nr(e, n);
2338
+ ln();
2339
+ let i = Ct();
2340
+ Vt(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), Ge(e, Z);
2341
+ let a = await Hr(e, n);
2295
2342
  for (let e of a) Z.info("api wired", {
2296
2343
  name: e.name,
2297
2344
  pkg: e.pkg,
2298
2345
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
2299
2346
  });
2300
- f(e).then((e) => {
2347
+ g(e).then((e) => {
2301
2348
  for (let t of e.files) if (t.action === "created") {
2302
2349
  let e = t.path.split("/").pop() ?? t.path;
2303
2350
  Z.info(`${e} seeded`, { path: t.path });
2304
2351
  }
2305
2352
  }).catch(() => {});
2306
- let { resolved: h } = await ve({
2353
+ let { resolved: o } = await Se({
2307
2354
  rawEnv: n.env,
2308
2355
  appType: "web",
2309
2356
  root: e,
2310
2357
  log: Z,
2311
2358
  generateTypes: !0
2312
- }), g = h.publicValues;
2313
- await zr(e, n, a, g), Z.debug("generated framework entry files", { files: [
2359
+ }), s = o.publicValues;
2360
+ await Jr(e, n, a, s), Z.debug("generated framework entry files", { files: [
2314
2361
  "index.html",
2315
2362
  ".framework/main.tsx",
2316
2363
  ...n.env ? [".framework/env.public.ts"] : []
2317
2364
  ] });
2318
- let C = r({
2365
+ let c = r({
2319
2366
  kind: "web",
2320
2367
  configPort: n.port,
2321
2368
  env: process.env,
2322
- dashboardPin: process.env[xn] === "1"
2369
+ dashboardPin: process.env[Tn] === "1"
2323
2370
  });
2324
- for (let e of C.warnings) Z.warn(e);
2325
- let k = C.port, A = n.name ?? "unnamed", j = b("web", A, k), M = x(A);
2326
- await _({
2327
- id: j,
2328
- name: A,
2371
+ for (let e of c.warnings) Z.warn(e);
2372
+ let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
2373
+ await x({
2374
+ id: b,
2375
+ name: y,
2329
2376
  kind: "web",
2330
- url: `http://localhost:${k}`,
2377
+ url: `http://localhost:${l}`,
2331
2378
  pid: process.pid,
2332
2379
  status: "booting",
2333
- logFile: M.path
2334
- }).catch(() => {}), await Br(e, k);
2335
- let { pages: N, dirs: P } = await $(w(e, "src", "pages")), F = {
2380
+ logFile: D.path
2381
+ }).catch(() => {}), await Yr(e, l);
2382
+ let { pages: N, dirs: P } = await $(O(e, "src", "pages")), F = {
2336
2383
  dirs: P,
2337
- ssrRoutes: Er(N)
2384
+ ssrRoutes: Fr(N)
2338
2385
  }, I = P.map((e) => ({
2339
2386
  dir: e.dir,
2340
2387
  hasLayout: e.hasLayout,
2341
2388
  hasError: e.hasError,
2342
2389
  hasPending: e.hasPending,
2343
2390
  hasNotFound: e.hasNotFound
2344
- })), L = await dt({
2391
+ })), L = await ht({
2345
2392
  appRoot: e,
2346
2393
  pages: N
2347
2394
  });
2348
- L.wrote && Z.debug("routes codegen wrote", { path: T(e, L.path) });
2349
- let ee = await pe("vite", () => import("vite")), z = (await import("@vitejs/plugin-react")).default, B = (await import("@tailwindcss/vite")).default, V = w(e, ".framework"), te = w(e, "src"), H = /* @__PURE__ */ new Set([
2395
+ L.wrote && Z.debug("routes codegen wrote", { path: k(e, L.path) });
2396
+ let R = await he("vite", () => import("vite")), z = (await import("@vitejs/plugin-react")).default, B = (await import("@tailwindcss/vite")).default, V = O(e, ".framework"), te = O(e, "src"), H = /* @__PURE__ */ new Set([
2350
2397
  ".framework",
2351
2398
  "node_modules",
2352
2399
  "dist",
@@ -2354,27 +2401,27 @@ import {
2354
2401
  ".vite",
2355
2402
  ".turbo",
2356
2403
  ".cache"
2357
- ]), ne = {
2404
+ ]), U = {
2358
2405
  name: "framework:watch-app-sources",
2359
2406
  async configureServer(t) {
2360
2407
  try {
2361
- let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
2362
- for (let r of n) t.watcher.add(w(e, r.name));
2408
+ let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
2409
+ for (let r of n) t.watcher.add(O(e, r.name));
2363
2410
  n.length === 0 && t.watcher.add(te);
2364
2411
  } catch {
2365
2412
  t.watcher.add(te);
2366
2413
  }
2367
- for (let n of await Ce(e)) t.watcher.add(n.dir);
2414
+ for (let n of await De(e)) t.watcher.add(n.dir);
2368
2415
  }
2369
- }, U = w(e, "src", "pages"), re = (e) => e.endsWith(".tsx") && (e === U || e.startsWith(U + "/")), ie = (e) => e === U || e.startsWith(U + "/"), ae = async (t) => {
2416
+ }, W = O(e, "src", "pages"), ne = (e) => e.endsWith(".tsx") && (e === W || e.startsWith(W + "/")), G = (e) => e === W || e.startsWith(W + "/"), re = async (t) => {
2370
2417
  try {
2371
2418
  let r = Date.now();
2372
- await zr(e, n, a, g);
2373
- let { pages: i, dirs: o } = await $(U);
2374
- await dt({
2419
+ await Jr(e, n, a, s);
2420
+ let { pages: i, dirs: o } = await $(W);
2421
+ await ht({
2375
2422
  appRoot: e,
2376
2423
  pages: i
2377
- }), F.dirs = o, F.ssrRoutes = Er(i), Z.info("page tree regenerated", {
2424
+ }), F.dirs = o, F.ssrRoutes = Fr(i), Z.info("page tree regenerated", {
2378
2425
  reason: t,
2379
2426
  ms: Date.now() - r,
2380
2427
  routes: F.ssrRoutes.length
@@ -2382,44 +2429,44 @@ import {
2382
2429
  } catch (e) {
2383
2430
  Z.error("page tree regen failed", { reason: t }, e);
2384
2431
  }
2385
- }, oe = {
2432
+ }, ie = {
2386
2433
  name: "framework:regenerate-on-page-tree-change",
2387
2434
  configureServer(t) {
2388
2435
  let n = null, r = [], i = (e) => {
2389
2436
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2390
2437
  n = null;
2391
2438
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2392
- r.length = 0, ae(e);
2439
+ r.length = 0, re(e);
2393
2440
  }, 50);
2394
2441
  };
2395
2442
  t.watcher.on("add", (t) => {
2396
- re(t) && i(`add ${T(e, t)}`);
2443
+ ne(t) && i(`add ${k(e, t)}`);
2397
2444
  }), t.watcher.on("unlink", (t) => {
2398
- re(t) && i(`unlink ${T(e, t)}`);
2445
+ ne(t) && i(`unlink ${k(e, t)}`);
2399
2446
  }), t.watcher.on("addDir", (t) => {
2400
- ie(t) && i(`addDir ${T(e, t)}`);
2447
+ G(t) && i(`addDir ${k(e, t)}`);
2401
2448
  }), t.watcher.on("unlinkDir", (t) => {
2402
- ie(t) && i(`unlinkDir ${T(e, t)}`);
2449
+ G(t) && i(`unlinkDir ${k(e, t)}`);
2403
2450
  });
2404
2451
  }
2405
- }, G = w(e, "app.config.ts"), se = (e) => {
2406
- if (!W(e.env)) return "";
2452
+ }, K = O(e, "app.config.ts"), oe = (e) => {
2453
+ if (!ae(e.env)) return "";
2407
2454
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2408
2455
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2409
- }, ce = (e, t) => {
2456
+ }, se = (e, t) => {
2410
2457
  let n = [];
2411
- 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"), se(e) !== se(t) && n.push("env"), n;
2412
- }, K = n, de = E(G), fe = {
2458
+ 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"), oe(e) !== oe(t) && n.push("env"), n;
2459
+ }, ce = n, le = A(K), ue = {
2413
2460
  name: "framework:watch-app-config",
2414
2461
  async configureServer(n) {
2415
- n.watcher.add(G), Z.info("watching app.config.ts for changes", { path: T(e, G) });
2462
+ n.watcher.add(K), Z.info("watching app.config.ts for changes", { path: k(e, K) });
2416
2463
  let r = async () => {
2417
2464
  try {
2418
2465
  try {
2419
- let e = n.moduleGraph.getModuleById(G);
2466
+ let e = n.moduleGraph.getModuleById(K);
2420
2467
  e && n.moduleGraph.invalidateModule(e);
2421
2468
  } catch {}
2422
- let e = (await n.ssrLoadModule(G, { fixStacktrace: !0 })).default;
2469
+ let e = (await n.ssrLoadModule(K, { fixStacktrace: !0 })).default;
2423
2470
  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);
2424
2471
  } catch (e) {
2425
2472
  return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
@@ -2438,17 +2485,17 @@ import {
2438
2485
  theme: t.theme,
2439
2486
  port: t.port,
2440
2487
  name: t.name
2441
- }), JSON.stringify(t) === JSON.stringify(K)) {
2488
+ }), JSON.stringify(t) === JSON.stringify(ce)) {
2442
2489
  Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2443
2490
  return;
2444
2491
  }
2445
- let i = ce(K, t);
2492
+ let i = se(ce, t);
2446
2493
  if (i.length > 0) {
2447
2494
  Z.warn("app.config.ts changed — hard restart required", { fields: i });
2448
2495
  try {
2449
2496
  await n.close();
2450
2497
  } catch {}
2451
- let e = ue(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2498
+ let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2452
2499
  stdio: "inherit",
2453
2500
  env: process.env,
2454
2501
  cwd: process.cwd()
@@ -2464,7 +2511,7 @@ import {
2464
2511
  }
2465
2512
  try {
2466
2513
  let r = Date.now();
2467
- await zr(e, t, await Nr(e, t)), K = t, n.ws && n.ws.send({
2514
+ await Jr(e, t, await Hr(e, t)), ce = t, n.ws && n.ws.send({
2468
2515
  type: "full-reload",
2469
2516
  path: "*"
2470
2517
  }), Z.info("app.config.ts soft-regen", {
@@ -2474,7 +2521,7 @@ import {
2474
2521
  } catch (e) {
2475
2522
  Z.error("app.config.ts soft-regen failed", {}, e);
2476
2523
  }
2477
- }, s = (e) => S(e) === "app.config.ts" ? e === G || E(e) === de : !1;
2524
+ }, s = (e) => E(e) === "app.config.ts" ? e === K || A(e) === le : !1;
2478
2525
  n.watcher.on("change", (e) => {
2479
2526
  s(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), a());
2480
2527
  }), n.watcher.on("add", (e) => {
@@ -2482,78 +2529,68 @@ import {
2482
2529
  });
2483
2530
  try {
2484
2531
  let { watchFile: e } = await import("node:fs");
2485
- e(G, { interval: 500 }, (e, t) => {
2532
+ e(K, { interval: 500 }, (e, t) => {
2486
2533
  e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
2487
2534
  }), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
2488
2535
  } catch (e) {
2489
2536
  Z.warn("app.config.ts polling watcher could not attach", {}, e);
2490
2537
  }
2491
- Te(t, Z, {
2538
+ ke(t, Z, {
2492
2539
  root: e,
2493
2540
  onBeforeRestart: () => n.close()
2494
2541
  });
2495
2542
  }
2496
- }, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, he = {
2543
+ }, de = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, pe = {
2497
2544
  name: "framework:suppress-api-hmr",
2498
2545
  handleHotUpdate(e) {
2499
- if (q += 1, me.test(e.file)) return [];
2546
+ if (q += 1, de.test(e.file)) return [];
2500
2547
  }
2501
- }, ge = {
2548
+ }, me = {
2502
2549
  name: "framework:reoptimize-on-rpcgroup-change",
2503
2550
  async configureServer(t) {
2504
- let n = /* @__PURE__ */ new Map();
2551
+ let n = [];
2505
2552
  for (let r of a) {
2506
- if (!r.proxyTarget) continue;
2507
- let i = await Or(e, r.pkg);
2508
- if (!i) continue;
2509
- let a = w(i, "rpcGroup.generated.ts");
2510
- try {
2511
- n.set(a, await O.readFile(a, "utf8"));
2512
- } catch {
2513
- n.set(a, "");
2514
- }
2515
- try {
2516
- t.watcher.add(a);
2517
- } catch {}
2518
- }
2519
- if (n.size === 0) return;
2520
- let r = null, i = !1, o = async () => {
2521
- if (i) return;
2522
- let r = null;
2523
- for (let [e, t] of n) {
2524
- let i;
2553
+ let i = await Lr(e, r.pkg);
2554
+ if (i) {
2555
+ n.push(i);
2525
2556
  try {
2526
- i = await O.readFile(e, "utf8");
2527
- } catch {
2528
- continue;
2529
- }
2530
- i !== t && (n.set(e, i), r = e);
2557
+ t.watcher.add(O(i, "rpcGroup.generated.ts"));
2558
+ } catch {}
2559
+ for (let e of await dr(i)) try {
2560
+ t.watcher.add(e);
2561
+ } catch {}
2531
2562
  }
2532
- if (r !== null) {
2533
- i = !0, Z.info(`rpcGroup changed (${T(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
2563
+ }
2564
+ if (n.length === 0) return;
2565
+ let r = await pr(n), i = null, o = !1, s = async () => {
2566
+ if (o) return;
2567
+ let e = await pr(n);
2568
+ if (e !== void 0 && e !== r) {
2569
+ r = e, o = !0, Z.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
2534
2570
  try {
2535
- await O.rm(w(V, ".vite", "deps"), {
2571
+ await M.rm(O(V, ".vite", "deps"), {
2536
2572
  recursive: !0,
2537
2573
  force: !0
2538
2574
  }), await t.restart(!0);
2539
2575
  } catch (e) {
2540
- i = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2576
+ o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2541
2577
  }
2542
2578
  }
2543
- }, s = (e) => {
2544
- n.has(E(e)) && (r && clearTimeout(r), r = setTimeout(() => {
2545
- o();
2579
+ }, c = (e) => {
2580
+ let t = A(e);
2581
+ !lr(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
2582
+ s();
2546
2583
  }, 120));
2547
2584
  };
2548
- t.watcher.on("change", s), t.watcher.on("add", s);
2585
+ t.watcher.on("change", c), t.watcher.on("add", c);
2549
2586
  }
2550
- }, J = {}, _e = (e) => (t) => {
2587
+ }, J = {}, ge = (e) => (t) => {
2551
2588
  t.on("proxyReq", (t, n) => {
2552
- nn(t, n, {
2589
+ sn(t, n, {
2553
2590
  target: e,
2554
2591
  token: process.env.VOLTRO_INSPECT_TOKEN,
2555
2592
  writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
2556
- isLoopback: u
2593
+ isLoopback: m
2557
2594
  });
2558
2595
  });
2559
2596
  };
@@ -2570,7 +2607,7 @@ import {
2570
2607
  target: t,
2571
2608
  changeOrigin: !0,
2572
2609
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
2573
- configure: _e(t)
2610
+ configure: ge(t)
2574
2611
  };
2575
2612
  }
2576
2613
  for (let [e, t] of Object.entries(n.proxies ?? {})) {
@@ -2588,23 +2625,23 @@ import {
2588
2625
  ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
2589
2626
  });
2590
2627
  }
2591
- let ye = {
2628
+ let _e = {
2592
2629
  name: "framework:inspect",
2593
2630
  configureServer(t) {
2594
2631
  let r = null, a = async () => {
2595
2632
  if (r !== null) return r;
2596
2633
  let n = [];
2597
2634
  for (let r of N) try {
2598
- let i = await t.ssrLoadModule(w(e, "src", "pages", r.file));
2635
+ let i = await t.ssrLoadModule(O(e, "src", "pages", r.file));
2599
2636
  n.push({
2600
2637
  pattern: r.pattern,
2601
2638
  file: r.file,
2602
2639
  dirChain: r.dirChain,
2603
- renderMode: p(i, w("src", "pages", r.file)),
2640
+ renderMode: _(i, O("src", "pages", r.file)),
2604
2641
  interactive: i.interactive ?? "full",
2605
2642
  tenantAware: i.tenantAware === !0,
2606
- revalidateMs: m(i.revalidate),
2607
- staleWhileRevalidateMs: m(i.staleWhileRevalidate) ?? 0,
2643
+ revalidateMs: v(i.revalidate),
2644
+ staleWhileRevalidateMs: v(i.staleWhileRevalidate) ?? 0,
2608
2645
  cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
2609
2646
  hasLoader: typeof i.loader == "function",
2610
2647
  hasMeta: i.meta != null,
@@ -2631,9 +2668,9 @@ import {
2631
2668
  }), n();
2632
2669
  }), t.middlewares.use((t, n, r) => {
2633
2670
  if (t.method !== "GET" && t.method !== "HEAD") return r();
2634
- let { pathname: i } = Rn(t.url ?? "/");
2635
- if (i !== "/robots.txt" || D(w(e, "public", "robots.txt"))) return r();
2636
- n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(_t({ indexable: !1 }));
2671
+ let { pathname: i } = Hn(t.url ?? "/");
2672
+ if (i !== "/robots.txt" || j(O(e, "public", "robots.txt"))) return r();
2673
+ n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(xt({ indexable: !1 }));
2637
2674
  }), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
2638
2675
  let r = e.url ?? "", i = r.split("?")[0];
2639
2676
  if (i === "/api/dashboard/proxy") {
@@ -2642,13 +2679,13 @@ import {
2642
2679
  t.statusCode = 400, t.end("missing ?target=");
2643
2680
  return;
2644
2681
  }
2645
- if (!d(n)) {
2682
+ if (!h(n)) {
2646
2683
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
2647
2684
  return;
2648
2685
  }
2649
2686
  try {
2650
2687
  let r = { accept: String(e.headers.accept ?? "application/json") };
2651
- e.headers.authorization ? r.authorization = String(e.headers.authorization) : u(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
2688
+ e.headers.authorization ? r.authorization = String(e.headers.authorization) : m(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
2652
2689
  let i;
2653
2690
  if (e.method && e.method !== "GET" && e.method !== "HEAD") {
2654
2691
  let t = [];
@@ -2675,7 +2712,7 @@ import {
2675
2712
  t.statusCode = 400, t.end("missing ?target=");
2676
2713
  return;
2677
2714
  }
2678
- if (!d(n)) {
2715
+ if (!h(n)) {
2679
2716
  t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
2680
2717
  return;
2681
2718
  }
@@ -2687,7 +2724,7 @@ import {
2687
2724
  method: "GET",
2688
2725
  headers: {
2689
2726
  accept: "text/event-stream",
2690
- ...e.headers.authorization ? { authorization: String(e.headers.authorization) } : u(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
2727
+ ...e.headers.authorization ? { authorization: String(e.headers.authorization) } : m(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
2691
2728
  },
2692
2729
  signal: i.signal
2693
2730
  });
@@ -2718,21 +2755,21 @@ import {
2718
2755
  }
2719
2756
  n();
2720
2757
  }), t.middlewares.use(async (e, t, r) => {
2721
- let u = e.url ?? "";
2722
- if (!u.startsWith("/_voltro/inspect")) return r();
2723
- let d = {};
2724
- for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (d[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
2725
- let f = u.split("?")[0];
2726
- if (e.method === "GET" && (f === "/_voltro/inspect/logs" || u.startsWith("/_voltro/inspect/logs?"))) {
2727
- let e = s(d.origin), n = Xt(u, Mt(), d);
2758
+ let o = e.url ?? "";
2759
+ if (!o.startsWith("/_voltro/inspect")) return r();
2760
+ let s = {};
2761
+ for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
2762
+ let c = o.split("?")[0];
2763
+ if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
2764
+ let e = d(s.origin), n = en(o, It(), s);
2728
2765
  t.statusCode = n.status, t.setHeader("content-type", n.contentType);
2729
2766
  for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
2730
2767
  t.end(n.body);
2731
2768
  return;
2732
2769
  }
2733
- if (e.method === "POST" && f === "/_voltro/inspect/clientLog") {
2734
- let n = s(d.origin);
2735
- if (o()) {
2770
+ if (e.method === "POST" && c === "/_voltro/inspect/clientLog") {
2771
+ let n = d(s.origin);
2772
+ if (u()) {
2736
2773
  t.statusCode = 503, t.setHeader("content-type", "application/json");
2737
2774
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2738
2775
  t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
@@ -2742,7 +2779,7 @@ import {
2742
2779
  e.setEncoding("utf-8"), e.on("data", (e) => {
2743
2780
  r += e;
2744
2781
  }), e.on("end", () => {
2745
- let e = Wt(r, i);
2782
+ let e = Jt(r, i);
2746
2783
  t.statusCode = e.status, t.setHeader("content-type", e.contentType);
2747
2784
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2748
2785
  t.end(e.body);
@@ -2751,15 +2788,15 @@ import {
2751
2788
  });
2752
2789
  return;
2753
2790
  }
2754
- if (f === "/_voltro/inspect/stream") {
2755
- let n = s(d.origin);
2756
- if (o()) {
2791
+ if (c === "/_voltro/inspect/stream") {
2792
+ let n = d(s.origin);
2793
+ if (u()) {
2757
2794
  t.statusCode = 503, t.setHeader("content-type", "application/json");
2758
2795
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2759
2796
  t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
2760
2797
  return;
2761
2798
  }
2762
- let r = c(d, "GET");
2799
+ let r = f(s, "GET");
2763
2800
  if (!r.ok) {
2764
2801
  t.statusCode = 401, t.setHeader("content-type", "application/json");
2765
2802
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
@@ -2772,29 +2809,29 @@ import {
2772
2809
  t.statusCode = 200, t.setHeader("content-type", "text/event-stream; charset=utf-8"), t.setHeader("cache-control", "no-cache, no-transform"), t.setHeader("connection", "keep-alive"), t.setHeader("x-accel-buffering", "no");
2773
2810
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2774
2811
  t.flushHeaders?.(), t.write("retry: 5000\n\n");
2775
- let a = u.indexOf("?");
2776
- if (!(a !== -1 && new URLSearchParams(u.slice(a + 1)).get("live") === "1")) for (let e of i.buffered()) t.write(bt(e));
2777
- let l = i.subscribe((e) => {
2812
+ let a = o.indexOf("?");
2813
+ if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(wt(e));
2814
+ let c = i.subscribe((e) => {
2778
2815
  try {
2779
- t.write(bt(e));
2816
+ t.write(wt(e));
2780
2817
  } catch {}
2781
- }), f = setInterval(() => {
2818
+ }), l = setInterval(() => {
2782
2819
  try {
2783
- t.write(xt());
2820
+ t.write(Tt());
2784
2821
  } catch {}
2785
2822
  }, 15e3), p = () => {
2786
- clearInterval(f), l();
2823
+ clearInterval(l), c();
2787
2824
  };
2788
2825
  e.on("close", p), t.on("close", p);
2789
2826
  return;
2790
2827
  }
2791
2828
  try {
2792
- let i = l(u, {
2829
+ let i = {
2793
2830
  kind: "web",
2794
2831
  meta: {
2795
2832
  name: n.name ?? "(unnamed)",
2796
- voltroVersion: or,
2797
- port: k,
2833
+ voltroVersion: hr,
2834
+ port: l,
2798
2835
  mode: "dev",
2799
2836
  apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
2800
2837
  let n = {
@@ -2811,36 +2848,36 @@ import {
2811
2848
  size: 0,
2812
2849
  entries: []
2813
2850
  }),
2814
- env: () => be(n.name ?? "app", { contract: W(n.env) ? n.env : void 0 })
2815
- }, d, { method: e.method ?? "GET" });
2816
- if (i === null) return r();
2817
- t.statusCode = i.status, t.setHeader("content-type", i.contentType);
2818
- for (let [e, n] of Object.entries(i.headers ?? {})) t.setHeader(e, n);
2819
- t.end(i.body);
2851
+ env: () => we(n.name ?? "app", { contract: ae(n.env) ? n.env : void 0 })
2852
+ }, c = p(o, i, s, { method: e.method ?? "GET" });
2853
+ if (c === null) return r();
2854
+ t.statusCode = c.status, t.setHeader("content-type", c.contentType);
2855
+ for (let [e, n] of Object.entries(c.headers ?? {})) t.setHeader(e, n);
2856
+ t.end(c.body);
2820
2857
  } catch (e) {
2821
2858
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`inspect handler error: ${e.message}`);
2822
2859
  }
2823
2860
  });
2824
2861
  }
2825
- }, xe = n.name === "voltroDashboard" ? {
2862
+ }, ve = n.name === "voltroDashboard" ? {
2826
2863
  name: "framework:dashboard-registry",
2827
2864
  configureServer(e) {
2828
2865
  e.middlewares.use(async (e, t, n) => {
2829
2866
  if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
2830
2867
  try {
2831
- let e = await v();
2868
+ let e = await S();
2832
2869
  t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
2833
2870
  } catch (e) {
2834
2871
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
2835
2872
  }
2836
2873
  });
2837
2874
  }
2838
- } : null, Se = /* @__PURE__ */ new Set(), we = (e, t, n, r, i, a = !1) => {
2839
- let o = Gn(i, a, t) ?? "";
2875
+ } : null, ye = /* @__PURE__ */ new Set(), be = (e, t, n, r, i, a = !1) => {
2876
+ let o = Yn(i, a, t) ?? "";
2840
2877
  if (Z.error(`${t} render failed`, {
2841
2878
  pathname: n,
2842
2879
  pattern: r,
2843
- cause: Ct(i) + o
2880
+ cause: Dt(i) + o
2844
2881
  }), e.headersSent) {
2845
2882
  e.end();
2846
2883
  return;
@@ -2851,9 +2888,9 @@ import {
2851
2888
  "x-voltro-ssr-generation": String(q)
2852
2889
  });
2853
2890
  let s = q === 0 ? "" : `\n[voltro] this process has absorbed ${q} 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`;
2854
- e.end(`${t} render failed for ${n}\n\n${Ct(i)}\n${o}\n${s}`);
2855
- }, Ee = $e(), De = tt({
2856
- limit: Ee,
2891
+ e.end(`${t} render failed for ${n}\n\n${Dt(i)}\n${o}\n${s}`);
2892
+ }, xe = rt(), Ce = at({
2893
+ limit: xe,
2857
2894
  onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
2858
2895
  onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
2859
2896
  id: e,
@@ -2861,17 +2898,17 @@ import {
2861
2898
  ...n ? { failed: !0 } : {}
2862
2899
  })
2863
2900
  });
2864
- Z.debug(`ssr cold-compile concurrency ${Ee}`, { concurrency: Ee });
2865
- let Oe = null, ke = async () => (Oe === null && (Oe = await O.readFile(w(e, ".framework", "index.html"), "utf8")), Oe), je = {
2901
+ Z.debug(`ssr cold-compile concurrency ${xe}`, { concurrency: xe });
2902
+ let Te = null, Ee = async () => (Te === null && (Te = await M.readFile(O(e, ".framework", "index.html"), "utf8")), Te), Oe = {
2866
2903
  name: "framework:ssr",
2867
2904
  configureServer(t) {
2868
- let r = (e) => De.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
2905
+ let r = (e) => Ce.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
2869
2906
  if (i !== void 0) return i;
2870
2907
  let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
2871
2908
  return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
2872
2909
  let [{ makeSsgWrap: n }, { makeSsrI18nResolver: i }] = await Promise.all([r("@voltro/i18n"), r("@voltro/i18n/server")]), s = {};
2873
- for (let i of t) if (D(w(e, "src", "locales", `${i}.ts`))) try {
2874
- let t = (await r(w(e, "src", "locales", `${i}.ts`))).default;
2910
+ for (let i of t) if (j(O(e, "src", "locales", `${i}.ts`))) try {
2911
+ let t = (await r(O(e, "src", "locales", `${i}.ts`))).default;
2875
2912
  t !== void 0 && (s[i] = n(i, t, a));
2876
2913
  } catch (e) {
2877
2914
  Z.warn("locale catalog failed to load for SSR", { locale: i }, e);
@@ -2899,18 +2936,18 @@ import {
2899
2936
  if (i.method !== "GET" && i.method !== "HEAD") return l();
2900
2937
  let u = i.url ?? "/";
2901
2938
  u.indexOf("?");
2902
- let { pathname: d, search: f } = Rn(u);
2939
+ let { pathname: d, search: f } = Hn(u);
2903
2940
  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" || /\.[a-z0-9]+$/i.test(d)) return l();
2904
- let m = Dr(d, F.ssrRoutes);
2905
- if (!m) return l();
2906
- let h = !Se.has(m.route.pattern), g = Date.now();
2907
- h && Z.info(`ssr compiling ${m.route.pattern}`, {
2908
- pattern: m.route.pattern,
2941
+ let p = Ir(d, F.ssrRoutes);
2942
+ if (!p) return l();
2943
+ let m = !ye.has(p.route.pattern), h = Date.now();
2944
+ m && Z.info(`ssr compiling ${p.route.pattern}`, {
2945
+ pattern: p.route.pattern,
2909
2946
  pathname: d
2910
2947
  });
2911
- let _ = {}, v = async (e, t) => {
2948
+ let g = {}, v = async (e, t) => {
2912
2949
  let n = Date.now(), r = await t();
2913
- return _[e] = (_[e] ?? 0) + (Date.now() - n), r;
2950
+ return g[e] = (g[e] ?? 0) + (Date.now() - n), r;
2914
2951
  }, y = async (e, n, r) => {
2915
2952
  let i = await t.moduleGraph.getModuleById(e);
2916
2953
  if (!(!i || n.has(e))) {
@@ -2923,47 +2960,50 @@ import {
2923
2960
  }
2924
2961
  }, b = !1;
2925
2962
  try {
2926
- let x = await v("loadPage", async () => await r(w(e, "src", "pages", m.route.file))), S = p(x, w("src", "pages", m.route.file)), C = xr(F.dirs, m.route.dirChain), T = S === "spa" && C.some((e) => e.hasLayout);
2927
- if (S !== "ssr" && S !== "isr" && !T) return l();
2928
- let E = {};
2929
- for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
2930
- let D = Rr(Lr(a[0], { allowDevProxy: !0 }), E.cookie, { apiName: a[0]?.name }), O = new AbortController(), k = () => O.abort();
2963
+ let x = await v("loadPage", async () => await r(O(e, "src", "pages", p.route.file))), S = _(x, O("src", "pages", p.route.file)), C = Ar(F.dirs, p.route.dirChain), w = S === "spa" && C.some((e) => e.hasLayout);
2964
+ if (S !== "ssr" && S !== "isr" && !w) return l();
2965
+ let T = {};
2966
+ for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? T[e] = t : Array.isArray(t) && (T[e] = t.join(", "));
2967
+ let E = qr(Kr(a[0], { allowDevProxy: !0 }), T.cookie, { apiName: a[0]?.name }), D = new AbortController(), k = () => D.abort();
2931
2968
  c.once("close", k);
2932
2969
  let A = null, j = [], M = {};
2933
2970
  try {
2934
- (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Sr({
2971
+ (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => jr({
2935
2972
  entries: C,
2936
- loadLayout: (t) => r(w(e, "src", "pages", t.dir, "layout.tsx")),
2937
- loadError: (t) => r(w(e, "src", "pages", t.dir, "error.tsx")),
2938
- loadPending: (t) => r(w(e, "src", "pages", t.dir, "loading.tsx")),
2973
+ loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
2974
+ loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
2975
+ loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
2939
2976
  ctx: {
2940
- params: m.params,
2977
+ params: p.params,
2941
2978
  pathname: d,
2942
2979
  search: f,
2943
- signal: O.signal,
2944
- headers: E,
2945
- query: D
2980
+ signal: D.signal,
2981
+ headers: T,
2982
+ query: E,
2983
+ isServer: !0
2946
2984
  }
2947
2985
  }));
2948
2986
  let t = x.loader;
2949
- typeof t == "function" && !T && (A = await v("loader", () => t({
2950
- params: m.params,
2987
+ typeof t == "function" && !w && (A = await v("loader", () => t({
2988
+ params: p.params,
2951
2989
  pathname: d,
2952
2990
  search: f,
2953
- signal: O.signal,
2954
- headers: E,
2955
- query: D
2991
+ signal: D.signal,
2992
+ headers: T,
2993
+ query: E,
2994
+ isServer: !0
2956
2995
  })));
2957
2996
  } finally {
2958
2997
  c.off("close", k);
2959
2998
  }
2960
2999
  let N = await v("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
2961
- T || await ir({
3000
+ w || await cr({
2962
3001
  pageMod: x,
2963
- params: m.params,
2964
- query: D,
3002
+ params: p.params,
3003
+ query: E,
2965
3004
  apiName: a[0]?.name,
2966
3005
  seed: N.seedPreloadedSubscription,
3006
+ seedFailure: N.seedPreloadedSubscriptionFailure,
2967
3007
  onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
2968
3008
  tag: e,
2969
3009
  apiName: t,
@@ -2971,7 +3011,7 @@ import {
2971
3011
  }, n)
2972
3012
  });
2973
3013
  let P = {
2974
- pattern: m.route.pattern,
3014
+ pattern: p.route.pattern,
2975
3015
  Component: x.default,
2976
3016
  meta: x.meta,
2977
3017
  loader: x.loader,
@@ -2980,110 +3020,110 @@ import {
2980
3020
  renderMode: S,
2981
3021
  chain: j
2982
3022
  }, I = {
2983
- cookies: N.parseCookieHeader(E.cookie),
2984
- headers: E,
3023
+ cookies: N.parseCookieHeader(T.cookie),
3024
+ headers: T,
2985
3025
  url: u
2986
- }, L = x.interactive ?? "full", R = (await s())(E.cookie, E["accept-language"]);
3026
+ }, L = x.interactive ?? "full", R = (await s())(T.cookie, T["accept-language"]);
2987
3027
  b = R !== void 0 && o;
2988
- let ee = R ? {
3028
+ let z = R ? {
2989
3029
  outerWrap: R.outerWrap,
2990
3030
  locale: R.locale
2991
- } : {}, z = T ? Fn({
3031
+ } : {}, B = w ? zn({
2992
3032
  helpers: N,
2993
- page: `src/pages/${m.route.file}`,
3033
+ page: `src/pages/${p.route.file}`,
2994
3034
  interactive: L,
2995
3035
  delivery: "stream",
2996
3036
  renderInput: {
2997
3037
  descriptor: P,
2998
- params: m.params,
3038
+ params: p.params,
2999
3039
  pathname: d,
3000
3040
  search: f,
3001
3041
  segmentLoaderData: M,
3002
3042
  requestContext: I,
3003
- ...ee
3043
+ ...z
3004
3044
  }
3005
- }) : null, B = T ? null : Pn({
3045
+ }) : null, V = w ? null : Rn({
3006
3046
  helpers: N,
3007
- page: `src/pages/${m.route.file}`,
3047
+ page: `src/pages/${p.route.file}`,
3008
3048
  pathname: d,
3009
3049
  renderMode: S,
3010
3050
  interactive: L,
3011
3051
  loaderData: A,
3012
3052
  segmentLoaderData: M,
3013
3053
  pageLoaderRan: typeof x.loader == "function"
3014
- }), V = [];
3054
+ }), ee = [];
3015
3055
  await v("collectCss", async () => {
3016
3056
  let t = /* @__PURE__ */ new Set(), n = [
3017
- w(e, "src", "pages", m.route.file),
3057
+ O(e, "src", "pages", p.route.file),
3018
3058
  ...C.flatMap((t) => [
3019
- ...t.hasLayout ? [w(e, "src", "pages", t.dir, "layout.tsx")] : [],
3020
- ...t.hasError ? [w(e, "src", "pages", t.dir, "error.tsx")] : [],
3021
- ...t.hasPending ? [w(e, "src", "pages", t.dir, "loading.tsx")] : []
3059
+ ...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
3060
+ ...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
3061
+ ...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
3022
3062
  ]),
3023
- w(e, ".framework", "main.tsx")
3063
+ O(e, ".framework", "main.tsx")
3024
3064
  ];
3025
- for (let e of n) await y(e, t, V);
3065
+ for (let e of n) await y(e, t, ee);
3026
3066
  });
3027
- let te = await v("readShell", ke), H = await v("transformShell", () => t.transformIndexHtml(u, te)), ne = V.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), U = R?.locale ?? I.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", re = Date.now();
3028
- if (z) {
3029
- let e = (e) => Ln({
3067
+ let te = await v("readShell", Ee), H = await v("transformShell", () => t.transformIndexHtml(u, te)), U = ee.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), W = R?.locale ?? I.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", ne = Date.now();
3068
+ if (B) {
3069
+ let e = (e) => Vn({
3030
3070
  helpers: N,
3031
- prepared: z,
3071
+ prepared: B,
3032
3072
  meta: e,
3033
3073
  interactive: L,
3034
- extra: [ne]
3074
+ extra: [U]
3035
3075
  });
3036
- if (z.hasDeferred) tr({
3076
+ if (B.hasDeferred) ar({
3037
3077
  res: c,
3038
- shell: Qn({
3078
+ shell: nr({
3039
3079
  shell: H,
3040
3080
  inlineModuleScriptsAsync: !0
3041
3081
  }),
3042
- htmlLang: U,
3082
+ htmlLang: W,
3043
3083
  headers: {
3044
3084
  "content-type": "text/html; charset=utf-8",
3045
3085
  "x-voltro-rendered-by": "spa-shell-dev"
3046
3086
  },
3047
3087
  headInjection: e,
3048
3088
  render: (e) => N.renderPageToStream({
3049
- ...z.renderInput,
3089
+ ...B.renderInput,
3050
3090
  ...e
3051
3091
  }),
3052
3092
  onShellError: (e) => {
3053
- we(c, "spa-shell-dev", d, m.route.pattern, e, b);
3093
+ be(c, "spa-shell-dev", d, p.route.pattern, e, b);
3054
3094
  }
3055
3095
  });
3056
3096
  else {
3057
- let t = In({
3097
+ let t = Bn({
3058
3098
  helpers: N,
3059
- prepared: z
3060
- }), n = H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${U}"`);
3099
+ prepared: B
3100
+ }), n = H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${W}"`);
3061
3101
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
3062
3102
  }
3063
- } else if (B) {
3103
+ } else if (V) {
3064
3104
  let e = (e) => [
3065
- ne,
3105
+ U,
3066
3106
  N.renderMetaToHtml(e),
3067
3107
  `<meta name="voltro-interactive" content="${L}" />`,
3068
- ...B.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3069
- N.renderRouterStateScript(B.stateInput)
3108
+ ...V.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3109
+ N.renderRouterStateScript(V.stateInput)
3070
3110
  ].filter((e) => e.length > 0).join("\n "), t = {
3071
3111
  descriptor: P,
3072
- params: m.params,
3112
+ params: p.params,
3073
3113
  pathname: d,
3074
3114
  search: f,
3075
- loaderData: B.loaderData,
3076
- segmentLoaderData: B.segmentLoaderData,
3115
+ loaderData: V.loaderData,
3116
+ segmentLoaderData: V.segmentLoaderData,
3077
3117
  requestContext: I,
3078
- ...ee
3118
+ ...z
3079
3119
  };
3080
- if (S === "ssr" && L === "full") tr({
3120
+ if (S === "ssr" && L === "full") ar({
3081
3121
  res: c,
3082
- shell: Qn({
3122
+ shell: nr({
3083
3123
  shell: H,
3084
3124
  inlineModuleScriptsAsync: !0
3085
3125
  }),
3086
- htmlLang: U,
3126
+ htmlLang: W,
3087
3127
  headers: {
3088
3128
  "content-type": "text/html; charset=utf-8",
3089
3129
  "x-voltro-rendered-by": "ssr-dev"
@@ -3094,75 +3134,73 @@ import {
3094
3134
  ...e
3095
3135
  }),
3096
3136
  onShellError: (e) => {
3097
- we(c, "ssr-dev", d, m.route.pattern, e, b);
3137
+ be(c, "ssr-dev", d, p.route.pattern, e, b);
3098
3138
  }
3099
3139
  });
3100
3140
  else {
3101
- let { html: n, meta: r } = N.renderPageToHtml(t), i = H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${U}"`);
3141
+ let { html: n, meta: r } = N.renderPageToHtml(t), i = H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${W}"`);
3102
3142
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
3103
3143
  }
3104
3144
  }
3105
- _.render = Date.now() - re;
3106
- let W = Date.now() - g;
3107
- h ? (Se.add(m.route.pattern), Z.info(`ssr compiled ${m.route.pattern} in ${W}ms`, {
3108
- pattern: m.route.pattern,
3145
+ g.render = Date.now() - ne;
3146
+ let G = Date.now() - h;
3147
+ m ? (ye.add(p.route.pattern), Z.info(`ssr compiled ${p.route.pattern} in ${G}ms`, {
3148
+ pattern: p.route.pattern,
3109
3149
  pathname: d,
3110
- elapsedMs: W,
3150
+ elapsedMs: G,
3111
3151
  cold: !0,
3112
- phases: _
3113
- })) : W > 200 && Z.info(`ssr rendered ${d} in ${W}ms`, {
3114
- pattern: m.route.pattern,
3152
+ phases: g
3153
+ })) : G > 200 && Z.info(`ssr rendered ${d} in ${G}ms`, {
3154
+ pattern: p.route.pattern,
3115
3155
  pathname: d,
3116
- elapsedMs: W,
3156
+ elapsedMs: G,
3117
3157
  cold: !1,
3118
- phases: _
3158
+ phases: g
3119
3159
  });
3120
3160
  } catch (e) {
3121
- if (Mn(e)) {
3161
+ if (In(e)) {
3122
3162
  Z.error("ssr-dev render refused", {
3123
3163
  pathname: d,
3124
- pattern: m.route.pattern
3164
+ pattern: p.route.pattern
3125
3165
  }, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
3126
3166
  return;
3127
3167
  }
3128
- let t = Nn(e);
3168
+ let t = Ln(e);
3129
3169
  if (t) {
3130
3170
  c.statusCode = t.status;
3131
3171
  for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
3132
3172
  c.end(t.body);
3133
3173
  return;
3134
3174
  }
3135
- we(c, "ssr-dev", d, m.route.pattern, e, b);
3175
+ be(c, "ssr-dev", d, p.route.pattern, e, b);
3136
3176
  }
3137
3177
  });
3138
3178
  }
3139
- }, Me = Date.now(), Ne = ee.version ?? "?", Pe = await sr(), Fe = w(e, "node_modules", "@voltro", "ui-shadcn"), Y = D(w(Fe, "package.json")) ? Fe : null, Ie = [], Le = await (async () => {
3179
+ }, Ae = Date.now(), je = R.version ?? "?", Me = await gr(), Ne = O(e, "node_modules", "@voltro", "ui-shadcn"), Y = j(O(Ne, "package.json")) ? Ne : null, Fe = [], Ie = await (async () => {
3140
3180
  let t = [];
3141
3181
  for (let n of a) {
3142
- if (!n.proxyTarget) continue;
3143
- let r = await Or(e, n.pkg);
3144
- if (r) try {
3145
- t.push(await O.readFile(w(r, "rpcGroup.generated.ts"), "utf8"));
3146
- } catch {}
3182
+ let r = await Lr(e, n.pkg);
3183
+ r && t.push(r);
3147
3184
  }
3148
- if (t.length === 0) return !1;
3149
- let n = le("sha1").update(t.join("\0")).digest("hex"), r = w(V, ".voltro-rpcgroup-optimize"), i = "";
3185
+ let n = await pr(t);
3186
+ if (n === void 0) return !1;
3187
+ let r = O(V, ".voltro-rpcgroup-optimize"), i = "";
3150
3188
  try {
3151
- i = (await O.readFile(r, "utf8")).trim();
3189
+ i = (await M.readFile(r, "utf8")).trim();
3152
3190
  } catch {}
3153
3191
  if (i === n) return !1;
3154
3192
  try {
3155
- await O.writeFile(r, n);
3193
+ await M.writeFile(r, n);
3156
3194
  } catch {}
3157
3195
  return !0;
3158
3196
  })();
3159
- Le && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3197
+ Ie && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3160
3198
  try {
3161
- await Ae(k, "voltro dev (web)");
3199
+ await Pe(l, "voltro dev (web)");
3162
3200
  } catch (e) {
3163
3201
  Z.error(String(e.message ?? e)), process.exit(1);
3164
3202
  }
3165
- await (await ee.createServer({
3203
+ await (await R.createServer({
3166
3204
  root: V,
3167
3205
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3168
3206
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
@@ -3174,68 +3212,68 @@ import {
3174
3212
  "@voltro/i18n"
3175
3213
  ],
3176
3214
  alias: [
3177
- ...Pe ? [{
3215
+ ...Me ? [{
3178
3216
  find: "@voltro/devtools/styles.css",
3179
- replacement: w(Pe, "src/styles.css")
3217
+ replacement: O(Me, "src/styles.css")
3180
3218
  }, {
3181
3219
  find: "@voltro/devtools",
3182
- replacement: w(Pe, "src/index.ts")
3220
+ replacement: O(Me, "src/index.ts")
3183
3221
  }] : [],
3184
3222
  ...Y ? [
3185
3223
  {
3186
3224
  find: "@voltro/ui-shadcn/tokens.css",
3187
- replacement: w(Y, "src/tokens.css")
3225
+ replacement: O(Y, "src/tokens.css")
3188
3226
  },
3189
3227
  {
3190
3228
  find: "@voltro/ui-shadcn/cn",
3191
- replacement: w(Y, "src/cn.ts")
3229
+ replacement: O(Y, "src/cn.ts")
3192
3230
  },
3193
3231
  {
3194
3232
  find: "@voltro/ui-shadcn/brand",
3195
- replacement: w(Y, "src/brand/voltroLogo.tsx")
3233
+ replacement: O(Y, "src/brand/voltroLogo.tsx")
3196
3234
  },
3197
3235
  {
3198
3236
  find: "@voltro/ui-shadcn",
3199
- replacement: w(Y, "src/index.ts")
3237
+ replacement: O(Y, "src/index.ts")
3200
3238
  }
3201
3239
  ] : [],
3202
- ...Qe(e)
3240
+ ...nt(e)
3203
3241
  ]
3204
3242
  },
3205
3243
  optimizeDeps: {
3206
- include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3207
- force: Le
3244
+ include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Fe],
3245
+ force: Ie
3208
3246
  },
3209
- customLogger: Xe(),
3247
+ customLogger: et(),
3210
3248
  plugins: [
3211
- gn(w(e, "src", "pages")),
3249
+ bn(O(e, "src", "pages")),
3212
3250
  z(),
3213
3251
  B(),
3214
- ne,
3215
- oe,
3216
- fe,
3217
- he,
3218
- ge,
3219
- ye,
3220
- je,
3221
- ...xe ? [xe] : []
3252
+ U,
3253
+ ie,
3254
+ ue,
3255
+ pe,
3256
+ me,
3257
+ _e,
3258
+ Oe,
3259
+ ...ve ? [ve] : []
3222
3260
  ],
3223
3261
  server: {
3224
- port: k,
3262
+ port: l,
3225
3263
  strictPort: !0,
3226
3264
  host: !0,
3227
3265
  allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
3228
3266
  proxy: J,
3229
- fs: { allow: [e, ...pr(e)] }
3267
+ fs: { allow: [e, ...Sr(e)] }
3230
3268
  },
3231
3269
  appType: "spa",
3232
- cacheDir: w(V, ".vite"),
3233
- publicDir: w(e, "public")
3234
- })).listen(), ar.info(`v${Ne} ready in ${Date.now() - Me}ms`, {
3235
- version: Ne,
3236
- bootMs: Date.now() - Me
3237
- }), Z.info(`listening on http://localhost:${k}`, {
3238
- port: k,
3270
+ cacheDir: O(V, ".vite"),
3271
+ publicDir: O(e, "public")
3272
+ })).listen(), mr.info(`v${je} ready in ${Date.now() - Ae}ms`, {
3273
+ version: je,
3274
+ bootMs: Date.now() - Ae
3275
+ }), Z.info(`listening on http://localhost:${l}`, {
3276
+ port: l,
3239
3277
  app: n.name ?? "(unnamed)"
3240
3278
  });
3241
3279
  for (let e of a) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
@@ -3243,62 +3281,62 @@ import {
3243
3281
  target: e.proxyTarget
3244
3282
  }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3245
3283
  try {
3246
- await _({
3247
- id: j,
3248
- name: A,
3284
+ await x({
3285
+ id: b,
3286
+ name: y,
3249
3287
  kind: "web",
3250
- url: `http://localhost:${k}`,
3288
+ url: `http://localhost:${l}`,
3251
3289
  pid: process.pid,
3252
3290
  status: "live",
3253
- logFile: M.path
3291
+ logFile: D.path
3254
3292
  });
3255
- let t = bn(e);
3293
+ let t = wn(e);
3256
3294
  if (t) {
3257
- let e = await An({ dashboardAppPath: t });
3295
+ let e = await Pn({ dashboardAppPath: t });
3258
3296
  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 });
3259
3297
  }
3260
3298
  setInterval(() => {
3261
- _({
3262
- id: j,
3263
- name: A,
3299
+ x({
3300
+ id: b,
3301
+ name: y,
3264
3302
  kind: "web",
3265
- url: `http://localhost:${k}`,
3303
+ url: `http://localhost:${l}`,
3266
3304
  pid: process.pid,
3267
3305
  status: "live",
3268
- logFile: M.path
3306
+ logFile: D.path
3269
3307
  }).catch(() => {});
3270
3308
  }, 1e4).unref();
3271
3309
  let n = () => {
3272
- y(j), M.dispose();
3310
+ C(b), D.dispose();
3273
3311
  };
3274
3312
  process.on("SIGINT", n), process.on("SIGTERM", n);
3275
3313
  } catch (e) {
3276
3314
  Z.warn("runtime-registry write failed", {}, e);
3277
3315
  }
3278
- return R({
3316
+ return ee({
3279
3317
  app: n.name ?? "unnamed",
3280
3318
  kind: "web",
3281
- url: `http://localhost:${k}`,
3282
- bootMs: Date.now() - Me
3319
+ url: `http://localhost:${l}`,
3320
+ bootMs: Date.now() - Ae
3283
3321
  }), new Promise(() => {});
3284
- }, Wr = async (t) => {
3322
+ }, $r = async (t) => {
3285
3323
  e("serve");
3286
- let n = await Hr(t);
3324
+ let n = await Zr(t);
3287
3325
  if (!n) return {
3288
3326
  ran: !1,
3289
3327
  exitCode: 0
3290
3328
  };
3291
3329
  let i = Date.now(), a = Z.child("serve");
3292
3330
  a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
3293
- let o = await Nr(t, n);
3331
+ let o = await Hr(t, n);
3294
3332
  for (let e of o) a.info("api wired", {
3295
3333
  name: e.name,
3296
3334
  pkg: e.pkg
3297
3335
  });
3298
- await zr(t, n, o);
3336
+ await Jr(t, n, o);
3299
3337
  {
3300
- let { pages: e } = await $(w(t, "src", "pages"));
3301
- await dt({
3338
+ let { pages: e } = await $(O(t, "src", "pages"));
3339
+ await ht({
3302
3340
  appRoot: t,
3303
3341
  pages: e
3304
3342
  });
@@ -3307,12 +3345,12 @@ import {
3307
3345
  kind: "web",
3308
3346
  configPort: n.port,
3309
3347
  env: process.env
3310
- }).port, c = await pe("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = w(t, ".framework");
3348
+ }).port, c = await he("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
3311
3349
  Z.info("running production build"), await c.build({
3312
3350
  root: u,
3313
3351
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3314
3352
  plugins: [l()],
3315
- customLogger: Xe(),
3353
+ customLogger: et(),
3316
3354
  resolve: { dedupe: [
3317
3355
  "react",
3318
3356
  "react-dom",
@@ -3321,9 +3359,9 @@ import {
3321
3359
  ] },
3322
3360
  build: {
3323
3361
  outDir: "dist",
3324
- rollupOptions: { output: { manualChunks: hr } }
3362
+ rollupOptions: { output: { manualChunks: wr } }
3325
3363
  },
3326
- publicDir: w(t, "public")
3364
+ publicDir: O(t, "public")
3327
3365
  });
3328
3366
  let d = (await c.preview({
3329
3367
  root: u,
@@ -3334,7 +3372,7 @@ import {
3334
3372
  label: "Local",
3335
3373
  url: e
3336
3374
  })) ?? [];
3337
- return R({
3375
+ return ee({
3338
3376
  app: n.name ?? "unnamed",
3339
3377
  kind: "preview",
3340
3378
  url: f,
@@ -3343,4 +3381,4 @@ import {
3343
3381
  }), new Promise(() => {});
3344
3382
  };
3345
3383
  //#endregion
3346
- export { Be as $, Rn as A, Mt as B, Qn as C, Fn as D, Pn as E, tn as F, gt as G, yt as H, Xt as I, $e as J, dt as K, Kt as L, yn as M, An as N, In as O, bn as P, Re as Q, Wt as R, $n as S, Mn as T, xt as U, bt as V, _t as W, Le as X, Qe as Y, ze as Z, Wr as _, Sr as a, xe as at, zr as b, yr as c, ge as ct, Hr as d, Ve as et, Nr as f, Ur as g, Fr as h, Rr as i, be as it, xn as j, Ln as k, Q as l, pe as lt, jr as m, Lr as n, Te as nt, Vr as o, ve as ot, Ar as p, tt as q, Mr as r, Ce as rt, xr as s, J as st, gr as t, Ae as tt, br as u, hr as v, tr as w, ir as x, $ as y, Lt as z };
3384
+ export { We as $, Hn as A, It as B, nr as C, zn as D, Rn as E, on as F, bt as G, Ct as H, en as I, rt as J, ht as K, Xt as L, Cn as M, Pn as N, Bn as O, wn as P, He as Q, Jt as R, rr as S, In as T, Tt as U, wt as V, xt as W, Ve as X, nt as Y, Ue as Z, $r as _, jr as a, we as at, Jr as b, Or as c, be as ct, Zr as d, Ge as et, Hr as f, Qr as g, Wr as h, qr as i, De as it, Tn as j, Vn as k, Q as l, ye as lt, Br as m, Kr as n, ke as nt, Xr as o, Te as ot, zr as p, at as q, Vr as r, Ee as rt, Ar as s, Se as st, Tr as t, Pe as tt, kr as u, he as ut, wr as v, ar as w, cr as x, $ as y, Vt as z };