@voltro/cli 0.39.1 → 0.41.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 (110) hide show
  1. package/CHANGELOG.md +232 -0
  2. package/dist/agentsMd-Bu_XQgVf.js +2 -0
  3. package/dist/{agentsMd-7zI2h5l9.js → agentsMd-D6yD7IQv.js} +31 -14
  4. package/dist/{apiBuild-D9FB13_2.js → apiBuild-B_iH24qf.js} +2 -2
  5. package/dist/apiBuild-RM5W5YXk.js +2 -0
  6. package/dist/bin.js +1 -1
  7. package/dist/{build-DORV5mLM.js → build-DUdi6F_Q.js} +100 -97
  8. package/dist/{checkCommand-D9qK_gtA.js → checkCommand-B2RWrpWi.js} +1 -1
  9. package/dist/{checkCommand-Bf6oMao4.js → checkCommand-DWL2_PPR.js} +2 -2
  10. package/dist/{cloudCmd-C42gaO8s.js → cloudCmd-F4YJeqM3.js} +1 -1
  11. package/dist/{codegenCommand-CxOyKmc1.js → codegenCommand-DkjoJ30Q.js} +2 -2
  12. package/dist/{codemodRunner-D-jTyvWo.js → codemodRunner-sFuWDETH.js} +520 -357
  13. package/dist/{commands-D6aW_6AR.js → commands-D0VR1yBB.js} +32 -32
  14. package/dist/{dashboardCommand-CwTZh-XZ.js → dashboardCommand-Bro7Jwts.js} +3 -3
  15. package/dist/{dataCommand-Cc9RiLQZ.js → dataCommand-OKC5FscP.js} +183 -172
  16. package/dist/{dbCommand-DSwGv9wS.js → dbCommand-BHRamDsy.js} +441 -414
  17. package/dist/dbCommand-C9iE1pd9.js +2 -0
  18. package/dist/{dev-3mgc8c-H.js → dev-D4l_YOzI.js} +1570 -1570
  19. package/dist/{dev-CjJAasDs.js → dev-DuqBJC7g.js} +1 -1
  20. package/dist/doctorCommand-Bw3V4L1j.js +2 -0
  21. package/dist/{doctorCommand-oLuzc-aC.js → doctorCommand-TmZTAepc.js} +386 -280
  22. package/dist/{dormancyCommand-Bxe4WtHU.js → dormancyCommand-CUKhRmGG.js} +1 -1
  23. package/dist/{embeddingsCommand-CyNQkFIc.js → embeddingsCommand-Db-iQM3l.js} +1 -1
  24. package/dist/{envCommand-CAkSgBbh.js → envCommand-DQ_URZq9.js} +14 -14
  25. package/dist/{evolveCommand-CWhBoe_P.js → evolveCommand-CghRPrGO.js} +2 -2
  26. package/dist/index.js +1 -1
  27. package/dist/{infoCommand-CTo8Jnhq.js → infoCommand-BCs_ZFnl.js} +1 -1
  28. package/dist/{metaCommands-DUYR--Ts.js → metaCommands-CfRLra0s.js} +1 -1
  29. package/dist/{migrate-BnPw2zC8.js → migrate-DLtPv2_D.js} +1 -1
  30. package/dist/{projectScaffold-BEhhHjPr.js → projectScaffold-BIl97_E6.js} +1 -1
  31. package/dist/{projectScaffold-BvhLOrLq.js → projectScaffold-mIX_DpSe.js} +1 -1
  32. package/dist/{runtimeTrace-gNXeLf6H.js → runtimeTrace-jFKvOPBz.js} +1 -1
  33. package/dist/{sdkgen-C8zz10-X.js → sdkgen-COQqHB9V.js} +1 -1
  34. package/dist/{serveCommand-BpK8-m1N.js → serveCommand-Cba_M2Su.js} +656 -656
  35. package/dist/serveCommand-DRbYK646.js +2 -0
  36. package/dist/serveEntry.js +1 -1
  37. package/dist/{start-ft_KzFTd.js → start-BjcuFME_.js} +421 -361
  38. package/dist/{start-BNuTWdRd.js → start-fifc0xpW.js} +1 -1
  39. package/dist/startEntry.js +1 -1
  40. package/dist/updateCommand-B2alql9k.js +2 -0
  41. package/dist/{updateCommand-CHBmCB17.js → updateCommand-HZQVBU3T.js} +1 -1
  42. package/dist/webDev-D6QeXw3P.js +2 -0
  43. package/dist/{webDev-CTpSY-e_.js → webDev-Dk8lFUzf.js} +672 -501
  44. package/dist/{webhooksCommand-EccPZQZ4.js → webhooksCommand-D7ZpH7w0.js} +1 -1
  45. package/package.json +35 -17
  46. package/templates/AGENTS.md +1 -1
  47. package/templates/agent-docs/_index.md +1 -1
  48. package/templates/agent-docs/_manifest.json +1 -1
  49. package/templates/agent-docs/cli.md +6 -0
  50. package/templates/agent-docs/data.md +43 -0
  51. package/templates/agent-docs/plugins/governance.md +8 -0
  52. package/templates/agent-docs/routing.md +153 -0
  53. package/templates/agent-docs/security.md +24 -0
  54. package/templates/agent-docs/whats-new.md +49 -27
  55. package/templates/apps/api-ai/package.json +7 -7
  56. package/templates/apps/api-auth/package.json +8 -8
  57. package/templates/apps/api-backend/package.json +7 -7
  58. package/templates/apps/api-backend-deactivation/package.json +7 -7
  59. package/templates/apps/api-backend-mail/package.json +8 -8
  60. package/templates/apps/api-backend-mariadb/package.json +9 -9
  61. package/templates/apps/api-backend-sqlite/package.json +8 -8
  62. package/templates/apps/api-backend-storage/package.json +8 -8
  63. package/templates/apps/api-cms/package.json +10 -10
  64. package/templates/apps/api-collab/package.json +8 -8
  65. package/templates/apps/api-data-advanced/package.json +8 -8
  66. package/templates/apps/api-durable/package.json +8 -8
  67. package/templates/apps/api-durable/tests/orders.place.test.ts +17 -4
  68. package/templates/apps/api-feature-flags/package.json +9 -9
  69. package/templates/apps/api-governance/package.json +8 -8
  70. package/templates/apps/api-kv/package.json +8 -8
  71. package/templates/apps/api-moderation/package.json +8 -8
  72. package/templates/apps/api-observability/package.json +8 -8
  73. package/templates/apps/api-ratelimit/package.json +8 -8
  74. package/templates/apps/api-rbac/package.json +8 -8
  75. package/templates/apps/api-rest/package.json +7 -7
  76. package/templates/apps/api-saas/package.json +11 -11
  77. package/templates/apps/api-saas-starter/package.json +10 -10
  78. package/templates/apps/api-search/package.json +8 -8
  79. package/templates/apps/api-status/package.json +8 -8
  80. package/templates/apps/api-versioning/package.json +8 -8
  81. package/templates/apps/api-webhooks/package.json +9 -9
  82. package/templates/apps/changelog/package.json +6 -6
  83. package/templates/apps/changelog/src/pages/[slug]/page.test.tsx +8 -1
  84. package/templates/apps/edge-functions/package.json +2 -2
  85. package/templates/apps/frontend-admin/package.json +8 -8
  86. package/templates/apps/frontend-app/package.json +9 -9
  87. package/templates/apps/frontend-auth/package.json +8 -8
  88. package/templates/apps/frontend-blank/package.json +7 -7
  89. package/templates/apps/frontend-cms/package.json +9 -9
  90. package/templates/apps/frontend-collab/package.json +10 -10
  91. package/templates/apps/frontend-contact/package.json +7 -7
  92. package/templates/apps/frontend-dashboard/package.json +7 -7
  93. package/templates/apps/frontend-docs/package.json +7 -7
  94. package/templates/apps/frontend-i18n/package.json +6 -6
  95. package/templates/apps/frontend-landing/package.json +7 -7
  96. package/templates/apps/frontend-portal/package.json +8 -8
  97. package/templates/apps/frontend-saas/package.json +8 -8
  98. package/templates/apps/frontend-spa/package.json +7 -7
  99. package/templates/apps/frontend-ssr/package.json +7 -7
  100. package/templates/apps/frontend-ssr-api/package.json +8 -8
  101. package/templates/apps/frontend-static-blog/package.json +6 -6
  102. package/templates/apps/frontend-status/package.json +8 -8
  103. package/templates/apps/mobile-app/package.json +4 -4
  104. package/dist/agentsMd-BFCXh2gl.js +0 -2
  105. package/dist/apiBuild-BmR_bIxN.js +0 -2
  106. package/dist/dbCommand-DcqEyxju.js +0 -2
  107. package/dist/doctorCommand-Cghssndo.js +0 -2
  108. package/dist/serveCommand-CW-goXvh.js +0 -2
  109. package/dist/updateCommand-6FMU2klq.js +0 -2
  110. package/dist/webDev-id3I5PvG.js +0 -2
@@ -4,37 +4,37 @@ import { t as n } from "./bootRefusal-pgvDxlrU.js";
4
4
  import { r } from "./appPort-B_HpJ_ck.js";
5
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
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";
7
+ import { n as g } from "./agentsMd-D6yD7IQv.js";
8
8
  import { c as _, p as v, t as y } from "./renderModeScan-D7J1B7Kw.js";
9
9
  import { t as b } from "./pageConvention-cEiRxdab.js";
10
10
  import { i as x, n as S, r as C, t as w } from "./runtimeRegistry-DMeKfTHP.js";
11
11
  import { n as T } from "./logFileSink-B4uP8pvf.js";
12
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";
13
+ import { existsSync as j, promises as M, readFileSync as N, readdirSync as P, statSync as F, unwatchFile as ee, watchFile as I } from "node:fs";
14
+ import { fileURLToPath as te, pathToFileURL as L } from "node:url";
15
+ import { addSink as R, createLogger as z, printReadyBlock as ne } from "@voltro/logger";
16
+ import { createRequire as B } from "node:module";
17
+ import { homedir as V } from "node:os";
18
+ import { currentTraceContext as re, resolveSecret as H } from "@voltro/runtime";
19
+ import { FRAMEWORK_ENV_CATALOG as U, appEnvEntries as ie, checkEnvNaming as W, formatEnvErrors as ae, installEnvSnapshot as G, isEnvContract as oe, pluginEnvEntries as se, renderDotEnvExample as ce, resolveEnv as le } from "@voltro/env";
20
+ import { __installPublicEnv as ue } from "@voltro/env/public";
21
+ import { mkdir as de, writeFile as fe } from "node:fs/promises";
22
+ import { createHash as pe } from "node:crypto";
23
+ import { spawn as me } from "node:child_process";
24
+ import { createConnection as K } from "node:net";
25
+ import { PassThrough as he } from "node:stream";
26
26
  //#region src/buildToolImport.ts
27
- var J = (e) => {
27
+ var ge = (e) => {
28
28
  let t = e;
29
29
  return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
30
- }, he = async (e, t) => {
30
+ }, _e = async (e, t) => {
31
31
  try {
32
32
  return await t();
33
33
  } catch (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;
34
+ throw ge(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
- }, 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}
36
+ }, q = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", ve = (e, t) => t ? `${e} | undefined` : e, ye = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${ve(t.tsType, t.optional)}`).join("\n"), be = async (e, t) => {
37
+ let n = ye(t, () => !0), r = `${q}
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 de(O(e, "env.generated.d.ts"), r, "utf8");
47
- }, be = async (e, t) => {
48
- let n = ve(t, (e) => e === "public"), r = `${ge}
46
+ await fe(O(e, "env.generated.d.ts"), r, "utf8");
47
+ }, xe = async (e, t) => {
48
+ let n = ye(t, (e) => e === "public"), r = `${q}
49
49
  import '@voltro/env/public'
50
50
 
51
51
  declare module '@voltro/env/public' {
@@ -54,9 +54,9 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
54
54
  }
55
55
  }
56
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}
57
+ await de(i, { recursive: !0 }), await fe(O(i, "voltro-env.d.ts"), r, "utf8");
58
+ }, Se = async (e, t) => {
59
+ let n = `${q}
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 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({
67
+ await de(e, { recursive: !0 }), await fe(O(e, "env.public.ts"), n, "utf8");
68
+ }, Ce = async (e) => {
69
+ let t = oe(e.rawEnv) ? e.rawEnv : void 0, n = await le({
70
70
  contract: t,
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);
71
+ resolveSecret: H
72
+ }), r = [...n.errors, ...W(t, e.appType)];
73
+ if (r.length > 0) throw Error(ae(r));
74
+ G(n.values), e.appType === "web" && ue(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 ye(e.root, t) : await be(e.root, t)), {
86
+ return e.generateTypes && t && (e.appType === "api" ? await be(e.root, t) : await xe(e.root, t)), {
87
87
  resolved: n,
88
88
  contract: t
89
89
  };
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 = [];
90
+ }, we = (e) => {
91
+ let t = ie(e.contract), n = (e.plugins ?? []).flatMap((e) => se(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : U, 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
- }, we = (e, t, n = (e) => process.env[e]) => {
99
- let r = Ce(t).map((e) => {
98
+ }, Te = (e, t, n = (e) => process.env[e]) => {
99
+ let r = we(t).map((e) => {
100
100
  let t = n(e.key) !== void 0;
101
101
  return {
102
102
  ...e,
@@ -113,16 +113,16 @@ __installPublicEnv(publicEnvValues)
113
113
  missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
114
114
  }
115
115
  };
116
- }, Te = (e, t) => {
117
- let n = Ce({
116
+ }, Ee = (e, t) => {
117
+ let n = we({
118
118
  ...e,
119
119
  includeFramework: !1
120
120
  });
121
- return se(n, {
121
+ return ce(n, {
122
122
  includeFramework: e.includeFramework !== !1,
123
123
  ...t ? { header: t } : {}
124
124
  });
125
- }, Ee = async (e, t) => {
125
+ }, J = async (e, t) => {
126
126
  let n = e;
127
127
  for (;;) {
128
128
  let e = O(n, "node_modules", t);
@@ -148,7 +148,7 @@ __installPublicEnv(publicEnvValues)
148
148
  return [];
149
149
  }
150
150
  return (await Promise.all(t.map(async (t) => {
151
- let n = await Ee(e, t);
151
+ let n = await J(e, t);
152
152
  if (n === null) return null;
153
153
  let r = O(n, "src");
154
154
  try {
@@ -165,7 +165,7 @@ __installPublicEnv(publicEnvValues)
165
165
  if (e.length === 0) return () => {};
166
166
  let r = (e) => n.root ? k(n.root, e) : e, i = !1, a = (e) => {
167
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(() => {
168
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
168
+ let e = me(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
169
169
  stdio: "inherit",
170
170
  env: process.env,
171
171
  cwd: n.cwd ?? process.cwd()
@@ -179,14 +179,14 @@ __installPublicEnv(publicEnvValues)
179
179
  });
180
180
  }));
181
181
  };
182
- for (let t of e) L(t, { interval: Oe }, (e, n) => {
182
+ for (let t of e) I(t, { interval: Oe }, (e, n) => {
183
183
  e.mtimeMs !== n.mtimeMs && a(t);
184
184
  });
185
185
  return t.info("watching .env files for changes", {
186
186
  files: e.map(r),
187
187
  intervalMs: Oe
188
188
  }), () => {
189
- for (let t of e) I(t);
189
+ for (let t of e) ee(t);
190
190
  };
191
191
  }, Ae = [{
192
192
  host: "127.0.0.1",
@@ -203,7 +203,7 @@ __installPublicEnv(publicEnvValues)
203
203
  } catch {}
204
204
  r(e);
205
205
  }
206
- }, o = pe({
206
+ }, o = K({
207
207
  host: e,
208
208
  port: t
209
209
  });
@@ -229,7 +229,7 @@ __installPublicEnv(publicEnvValues)
229
229
  ].join("\n"), Pe = async (e, t) => {
230
230
  let { families: r } = await Me(e);
231
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) => {
232
+ }, Fe = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Y = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Ie = (e) => {
233
233
  let t = [], n = e;
234
234
  for (let e = 0; e < 12; e++) {
235
235
  let e = O(n, "node_modules");
@@ -303,7 +303,7 @@ __installPublicEnv(publicEnvValues)
303
303
  } catch {
304
304
  return;
305
305
  }
306
- }, Be = (e) => {
306
+ }, X = (e) => {
307
307
  let t = [], n;
308
308
  try {
309
309
  n = P(e);
@@ -311,7 +311,7 @@ __installPublicEnv(publicEnvValues)
311
311
  return t;
312
312
  }
313
313
  for (let r of n) {
314
- if (r.startsWith(".") || Fe.test(r)) continue;
314
+ if (r.startsWith(".") || Y.test(r)) continue;
315
315
  let n = O(e, r);
316
316
  if (r.startsWith("@")) {
317
317
  let e;
@@ -337,13 +337,13 @@ __installPublicEnv(publicEnvValues)
337
337
  });
338
338
  }
339
339
  return t;
340
- }, Ve = (e) => {
340
+ }, Be = (e) => {
341
341
  let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
342
- if (!Y(e)) return;
342
+ if (!Fe(e)) return;
343
343
  let i = t.get(e) ?? /* @__PURE__ */ new Map();
344
344
  i.has(n) || i.set(n, r), t.set(e, i);
345
345
  };
346
- for (let t of Ie(e)) for (let { pkg: e, dir: r } of Be(t)) {
346
+ for (let t of Ie(e)) for (let { pkg: e, dir: r } of X(t)) {
347
347
  let t = ze(r);
348
348
  t !== void 0 && n(e, t, r);
349
349
  }
@@ -355,7 +355,7 @@ __installPublicEnv(publicEnvValues)
355
355
  paths: [...i.values()].map((t) => k(e, t)).sort()
356
356
  });
357
357
  return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
358
- }, He = (e) => {
358
+ }, Ve = (e) => {
359
359
  if (e.length !== 0) return [
360
360
  `• ${e.length} package(s) resolved at more than one version:`,
361
361
  ...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
@@ -373,9 +373,9 @@ __installPublicEnv(publicEnvValues)
373
373
  " instrument), then reinstall. Do not silence the generated file — it is where",
374
374
  " a genuine mistake in your own descriptors surfaces."
375
375
  ].join("\n");
376
- }, Ue = (e) => {
376
+ }, He = (e) => {
377
377
  let t = /* @__PURE__ */ new Map();
378
- for (let n of Ie(e)) for (let { pkg: e, dir: r } of Be(n)) {
378
+ for (let n of Ie(e)) for (let { pkg: e, dir: r } of X(n)) {
379
379
  if (!e.startsWith("@voltro/")) continue;
380
380
  let n = ze(r);
381
381
  n !== void 0 && !t.has(e) && t.set(e, n);
@@ -392,7 +392,7 @@ __installPublicEnv(publicEnvValues)
392
392
  version: t
393
393
  })).sort((e, t) => e.pkg.localeCompare(t.pkg))
394
394
  };
395
- }, We = (e) => {
395
+ }, Ue = (e) => {
396
396
  if (e !== void 0) return [
397
397
  `• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
398
398
  ...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
@@ -410,59 +410,59 @@ __installPublicEnv(publicEnvValues)
410
410
  " its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
411
411
  " which silently skips `@voltro/i18n` because the name contains digits."
412
412
  ].join("\n");
413
- }, Ge = (e, t) => {
414
- let n = Ue(e);
413
+ }, We = (e, t) => {
414
+ let n = He(e);
415
415
  n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
416
416
  majority: n.majority,
417
417
  behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
418
418
  fix: "the framework ships in lockstep; bump the listed packages and reinstall"
419
419
  });
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 = [
420
+ }, Ge = z({ scope: "vite" }), Ke = /\x1b\[[0-9;]*m/g, qe = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Je = (e) => e.replace(Ke, "").replace(qe, "").trim(), Ye = /proxy error/i, Xe = [
421
421
  "ECONNREFUSED",
422
422
  "ECONNRESET",
423
423
  "ECONNABORTED",
424
424
  "EPIPE",
425
425
  "ETIMEDOUT"
426
- ], Qe = (e, t = 0) => {
426
+ ], Ze = (e, t = 0) => {
427
427
  if (e == null || t > 5) return !1;
428
428
  let n = e;
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 = () => {
429
+ return typeof n.code == "string" && Xe.includes(n.code) || typeof n.message == "string" && Xe.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Ze(e, t + 1)) ? !0 : Ze(n.cause, t + 1);
430
+ }, Qe = 4e3, $e = () => {
431
431
  let e = /* @__PURE__ */ new Set(), t = 0, n = {
432
432
  hasWarned: !1,
433
433
  info: (e) => {
434
- let t = Ye(e);
435
- t.length !== 0 && Ke.info(t);
434
+ let t = Je(e);
435
+ t.length !== 0 && Ge.info(t);
436
436
  },
437
437
  warn: (e) => {
438
438
  n.hasWarned = !0;
439
- let t = Ye(e);
440
- t.length !== 0 && Ke.warn(t);
439
+ let t = Je(e);
440
+ t.length !== 0 && Ge.warn(t);
441
441
  },
442
442
  warnOnce: (t) => {
443
- let r = Ye(t);
444
- e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ke.warn(r));
443
+ let r = Je(t);
444
+ e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ge.warn(r));
445
445
  },
446
446
  error: (e, n) => {
447
- let r = Ye(e), i = n?.error;
447
+ let r = Je(e), i = n?.error;
448
448
  if (r.length !== 0) {
449
- if (Xe.test(r) && Qe(i)) {
449
+ if (Ye.test(r) && Ze(i)) {
450
450
  let e = Date.now();
451
- e - t > $e && (t = e, Ke.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
451
+ e - t > Qe && (t = e, Ge.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
452
452
  return;
453
453
  }
454
- Ke.error(r, {}, i);
454
+ Ge.error(r, {}, i);
455
455
  }
456
456
  },
457
457
  clearScreen: () => {},
458
458
  hasErrorLogged: (e) => !1
459
459
  };
460
460
  return n;
461
- }, tt = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), nt = (e) => {
461
+ }, et = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), tt = (e) => {
462
462
  try {
463
463
  let t = O(e, "tsconfig.json");
464
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 = [];
465
+ let n = JSON.parse(et(N(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = A(e, i), o = [];
466
466
  for (let [e, t] of Object.entries(r)) {
467
467
  let n = t[0];
468
468
  if (!n) continue;
@@ -484,12 +484,12 @@ __installPublicEnv(publicEnvValues)
484
484
  } catch {
485
485
  return [];
486
486
  }
487
- }, rt = (e = process.env) => {
487
+ }, nt = (e = process.env) => {
488
488
  let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
489
489
  if (t === void 0 || t.trim() === "") return 4;
490
490
  let n = Number(t);
491
491
  return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
492
- }, it = (e) => {
492
+ }, rt = (e) => {
493
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 = () => {
494
494
  let e = r.shift();
495
495
  e ? e() : n--;
@@ -507,8 +507,8 @@ __installPublicEnv(publicEnvValues)
507
507
  return n;
508
508
  }
509
509
  };
510
- }, at = (e) => {
511
- let t = it(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
510
+ }, it = (e) => {
511
+ let t = rt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
512
512
  return {
513
513
  load: (i, a) => {
514
514
  if (r.has(i)) return a();
@@ -538,7 +538,7 @@ __installPublicEnv(publicEnvValues)
538
538
  return r.size;
539
539
  }
540
540
  };
541
- }, ot = (e) => {
541
+ }, at = (e) => {
542
542
  let t = [];
543
543
  for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
544
544
  name: n.slice(5, -2),
@@ -554,7 +554,7 @@ __installPublicEnv(publicEnvValues)
554
554
  optional: !1
555
555
  });
556
556
  return t;
557
- }, st = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), ct = async (e) => {
557
+ }, ot = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), st = async (e) => {
558
558
  let t = A(e);
559
559
  for (let e = 0; e < 4; e++) {
560
560
  let e = O(t, "project.json");
@@ -572,8 +572,8 @@ __installPublicEnv(publicEnvValues)
572
572
  t = n;
573
573
  }
574
574
  return null;
575
- }, lt = async (e) => {
576
- let t = await ct(e);
575
+ }, ct = async (e) => {
576
+ let t = await st(e);
577
577
  if (!t) return [];
578
578
  let { projectDir: n, manifest: r } = t, i = E(e), a = r.apps ?? {}, o = [];
579
579
  for (let [e, t] of Object.entries(a)) {
@@ -582,23 +582,23 @@ __installPublicEnv(publicEnvValues)
582
582
  if (!j(a)) continue;
583
583
  let s;
584
584
  try {
585
- let { pages: e } = await $(a);
585
+ let { pages: e } = await Jr(a);
586
586
  s = e.map((e) => ({
587
587
  pattern: e.pattern,
588
- params: ot(e.pattern)
588
+ params: at(e.pattern)
589
589
  }));
590
590
  } catch {
591
591
  continue;
592
592
  }
593
593
  o.push({
594
- key: st(e),
594
+ key: ot(e),
595
595
  origin: `http://localhost:${t.port}`,
596
596
  ...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
597
597
  routes: s
598
598
  });
599
599
  }
600
600
  return o;
601
- }, ut = (e) => {
601
+ }, lt = (e) => {
602
602
  if (e.params.length === 0) return `'${e.pattern}'`;
603
603
  let t = e.pattern;
604
604
  for (let n of e.params) {
@@ -606,21 +606,21 @@ __installPublicEnv(publicEnvValues)
606
606
  t = t.replace(e, r);
607
607
  }
608
608
  return "`" + t + "`";
609
- }, dt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
609
+ }, ut = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
610
610
  let t = "string";
611
611
  return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
612
- }).join("; ")} }`, ft = (e, t, n) => {
613
- let r = dt(e), i = ut(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
612
+ }).join("; ")} }`, dt = (e, t, n) => {
613
+ let r = ut(e), i = lt(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
614
614
  return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
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) => {
615
+ }, ft = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${dt(e, !1)},`).join("\n")}\n}`, pt = (e, t) => {
616
616
  if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
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)},`);
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)}: ${dt(e, !0, i)},`);
618
618
  return ` ${e.key}: {\n${a.join("\n")}\n },`;
619
- }, ht = async (e) => {
619
+ }, mt = async (e) => {
620
620
  let t = e.pages.map((e) => ({
621
621
  pattern: e.pattern,
622
- params: ot(e.pattern)
623
- })), n = await lt(e.appRoot), r = [
622
+ params: at(e.pattern)
623
+ })), n = await ct(e.appRoot), r = [
624
624
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
625
625
  "// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
626
626
  "// Type-safe route builders consumed by <Link to={...}>.",
@@ -629,7 +629,7 @@ __installPublicEnv(publicEnvValues)
629
629
  "",
630
630
  "type EmptyParams = Record<string, never>",
631
631
  ""
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");
632
+ ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${ft(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => pt(e, i)).join("\n")}\n} as const\n`}`, o = O(e.appRoot, ".framework", "routes.generated.ts");
633
633
  await M.mkdir(D(o), { recursive: !0 });
634
634
  let s = null;
635
635
  try {
@@ -642,37 +642,37 @@ __installPublicEnv(publicEnvValues)
642
642
  path: o,
643
643
  wrote: !0
644
644
  });
645
- }, gt = (e) => {
645
+ }, ht = (e) => {
646
646
  if (e === "" || e === "/") return "/";
647
647
  let t = e.startsWith("/") ? e : `/${e}`;
648
648
  return t.endsWith("/") ? t.slice(0, -1) : t;
649
- }, _t = (e, t) => {
650
- let n = e.endsWith("/") ? e.slice(0, -1) : e, r = gt(t);
649
+ }, gt = (e, t) => {
650
+ let n = e.endsWith("/") ? e.slice(0, -1) : e, r = ht(t);
651
651
  return r === "/" ? `${n}/` : `${n}${r}`;
652
- }, vt = (e, t, n) => {
653
- let r = gt(e);
652
+ }, _t = (e, t, n) => {
653
+ let r = ht(e);
654
654
  return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
655
- }, yt = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), bt = (e) => {
655
+ }, vt = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;"), yt = (e) => {
656
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) => {
657
657
  if (!r) return "";
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")}`;
658
+ let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${vt(n)}" href="${vt(gt(t, _t(e, n, i)))}" />`);
659
+ return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${vt(gt(t, _t(e, i, i)))}" />`), `\n${n.join("\n")}`;
660
660
  };
661
661
  for (let e of n) {
662
662
  let n = r ?? [i];
663
663
  for (let r of n) {
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>`);
664
+ let n = gt(t, _t(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${vt(e.lastmod)}</lastmod>` : "";
665
+ o.set(n, ` <url>\n <loc>${vt(n)}</loc>${a}${s(e.path)}\n </url>`);
666
666
  }
667
667
  }
668
668
  let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
669
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`;
670
- }, xt = (e) => {
670
+ }, bt = (e) => {
671
671
  if (!e.indexable) return "User-agent: *\nDisallow: /\n";
672
672
  let t = ["User-agent: *", "Allow: /"];
673
- for (let n of e.disallow ?? []) t.push(`Disallow: ${gt(n)}`);
673
+ for (let n of e.disallow ?? []) t.push(`Disallow: ${ht(n)}`);
674
674
  return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
675
- }, St = 256, Ct = (e = St) => {
675
+ }, xt = 256, St = (e = xt) => {
676
676
  let t = [], n = /* @__PURE__ */ new Set();
677
677
  return {
678
678
  emit(r, i) {
@@ -695,18 +695,18 @@ __installPublicEnv(publicEnvValues)
695
695
  return t.slice();
696
696
  }
697
697
  };
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);
698
+ }, Ct = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, wt = () => `: keep-alive ${Date.now()}\n\n`, Tt = 8e3, Et = (e, t = Tt) => {
699
+ let n = Ot(e);
700
700
  return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
701
- }, Ot = 4, kt = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
701
+ }, Dt = 4, Ot = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
702
702
  if (e instanceof Error) {
703
703
  let r = e.stack ?? `${e.name}: ${e.message}`;
704
704
  if (n.has(e)) return `${r}\n [cycle]`;
705
705
  n.add(e);
706
706
  let i = [];
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))}`);
707
+ if (t < Dt) {
708
+ if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${kt(Ot(a, t + 1, n))}`);
709
+ else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${kt(Ot(e.cause, t + 1, n))}`);
710
710
  }
711
711
  return r + i.join("");
712
712
  }
@@ -715,30 +715,30 @@ __installPublicEnv(publicEnvValues)
715
715
  } catch {
716
716
  return "[unstringifiable thrown value]";
717
717
  }
718
- }, At = (e) => {
718
+ }, kt = (e) => {
719
719
  let t = e.split("\n");
720
720
  return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
721
- }, jt = {
721
+ }, At = {
722
722
  trace: 0,
723
723
  debug: 1,
724
724
  info: 2,
725
725
  warn: 3,
726
726
  error: 4,
727
727
  fatal: 5
728
- }, Mt = 2e3, Nt = 200, Pt = class {
728
+ }, jt = 2e3, Mt = 200, Nt = class {
729
729
  capacity;
730
730
  buffer = [];
731
- constructor(e = Mt) {
731
+ constructor(e = jt) {
732
732
  this.capacity = e;
733
733
  }
734
734
  append(e) {
735
735
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
736
736
  }
737
737
  query(e = {}) {
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 = [];
738
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Mt, this.capacity), i = e.minLevel === void 0 ? At.trace : At[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
739
739
  for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
740
740
  let r = this.buffer[e];
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));
741
+ r.ts < t || r.ts > n || At[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));
742
742
  }
743
743
  return l.reverse();
744
744
  }
@@ -751,7 +751,7 @@ __installPublicEnv(publicEnvValues)
751
751
  clear() {
752
752
  this.buffer = [];
753
753
  }
754
- }, Ft = null, It = () => (Ft === null && (Ft = new Pt()), Ft), Lt = (e) => {
754
+ }, Pt = null, Ft = () => (Pt === null && (Pt = new Nt()), Pt), It = (e) => {
755
755
  if (typeof e == "string") return e;
756
756
  if (e instanceof Error) return e.message;
757
757
  try {
@@ -759,28 +759,28 @@ __installPublicEnv(publicEnvValues)
759
759
  } catch {
760
760
  return String(e);
761
761
  }
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) => {
762
+ }, Lt = 8e3, Rt = (e) => typeof e == "string" ? e.length <= Lt ? e : `${e.slice(0, Lt)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Et(e, Lt), zt = (e, t) => {
763
763
  try {
764
764
  e(...t);
765
765
  } catch (n) {
766
766
  try {
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.`);
767
+ e(...t.map(Rt)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Lt} chars per argument.`);
768
768
  } catch {
769
769
  e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
770
770
  }
771
771
  }
772
- }, Vt = (e) => {
772
+ }, Bt = (e) => {
773
773
  let t = {
774
774
  log: console.log.bind(console),
775
775
  info: console.info.bind(console),
776
776
  warn: console.warn.bind(console),
777
777
  error: console.error.bind(console),
778
778
  debug: console.debug.bind(console)
779
- }, n = It(), r = !1, i = (i) => (...a) => {
780
- if (Bt(t[i], a), !r) {
779
+ }, n = Ft(), r = !1, i = (i) => (...a) => {
780
+ if (zt(t[i], a), !r) {
781
781
  r = !0;
782
782
  try {
783
- let t = a.length > 0 ? Lt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = U();
783
+ let t = a.length > 0 ? It(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = re();
784
784
  e.emit("log", {
785
785
  level: i,
786
786
  message: r,
@@ -807,7 +807,7 @@ __installPublicEnv(publicEnvValues)
807
807
  }
808
808
  };
809
809
  console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
810
- let a = B((t) => {
810
+ let a = R((t) => {
811
811
  if (!r) {
812
812
  r = !0;
813
813
  try {
@@ -818,7 +818,7 @@ __installPublicEnv(publicEnvValues)
818
818
  argsCount: 1,
819
819
  ...t.scope === void 0 ? {} : { scope: t.scope }
820
820
  });
821
- let a = U(), o = a !== void 0 && t.fields.traceId === void 0 ? {
821
+ let a = re(), o = a !== void 0 && t.fields.traceId === void 0 ? {
822
822
  ...t.fields,
823
823
  traceId: a.traceId
824
824
  } : t.fields;
@@ -838,14 +838,14 @@ __installPublicEnv(publicEnvValues)
838
838
  return () => {
839
839
  console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
840
840
  };
841
- }, Ht = 2e3, Ut = 8, Wt = 1e3, Gt = 200, X = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Kt = (e) => {
841
+ }, Vt = 2e3, Ht = 8, Ut = 1e3, Wt = 200, Gt = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Kt = (e) => {
842
842
  switch (e) {
843
843
  case "error": return "error";
844
844
  case "warn": return "warn";
845
845
  case "debug": return "debug";
846
846
  default: return "info";
847
847
  }
848
- }, qt = V({ scope: "client" }), Jt = (e, t) => {
848
+ }, qt = z({ scope: "client" }), Jt = (e, t) => {
849
849
  let n;
850
850
  try {
851
851
  n = JSON.parse(e);
@@ -855,7 +855,7 @@ __installPublicEnv(publicEnvValues)
855
855
  if (typeof n != "object" || !n) return Yt(400, { error: "body must be a JSON object" });
856
856
  let r = n;
857
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;
858
+ let i = typeof r.app == "string" ? Gt(r.app, 120) : void 0, a = typeof r.page == "string" ? Gt(r.page, 200) : void 0, o = typeof r.ua == "string" ? Gt(r.ua, 200) : void 0, s = r.entries.slice(0, Wt), c = 0;
859
859
  for (let e of s) {
860
860
  if (typeof e != "object" || !e) continue;
861
861
  let n = e;
@@ -866,7 +866,7 @@ __installPublicEnv(publicEnvValues)
866
866
  "warn",
867
867
  "error",
868
868
  "debug"
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;
869
+ ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Gt(n.message, Vt), u = Array.isArray(n.args) ? n.args.slice(0, Ht).filter((e) => typeof e == "string").map((e) => Gt(e, Ut)) : void 0, d = typeof n.stack == "string" ? Gt(n.stack, Vt) : void 0;
870
870
  t.emit("clientLog", {
871
871
  ts: s,
872
872
  level: r,
@@ -1016,7 +1016,7 @@ __installPublicEnv(publicEnvValues)
1016
1016
  let e = {
1017
1017
  warn: console.warn.bind(console),
1018
1018
  error: console.error.bind(console)
1019
- }, t = V({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1019
+ }, t = z({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1020
1020
  if (!n) {
1021
1021
  for (let e of cn) if (e.match(i[0])) {
1022
1022
  n = !0;
@@ -1166,7 +1166,7 @@ import {
1166
1166
  map: null
1167
1167
  };
1168
1168
  }
1169
- }), xn = V({ scope: "voltro:dashboard" }), Sn = te(import.meta.url), Cn = 5179, wn = (e) => {
1169
+ }), xn = z({ scope: "voltro:dashboard" }), Sn = B(import.meta.url), Cn = 5179, wn = (e) => {
1170
1170
  let t = process.env.VOLTRO_DASHBOARD_PATH;
1171
1171
  if (t && j(O(A(t), "app.config.ts"))) return A(t);
1172
1172
  try {
@@ -1183,14 +1183,14 @@ import {
1183
1183
  }
1184
1184
  return null;
1185
1185
  }, Tn = "VOLTRO_IS_DASHBOARD", En = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1186
- let i = pe({
1186
+ let i = K({
1187
1187
  port: e,
1188
1188
  host: t
1189
1189
  }), a = !1, o = (e) => {
1190
1190
  a || (a = !0, i.destroy(), r(e));
1191
1191
  };
1192
1192
  i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
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 () => {
1193
+ }), Dn = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), On = () => process.env[Tn] === "1", kn = () => process.stdout.isTTY === !0, An = O(V(), ".voltro", "dashboard-launch.lock"), jn = 1e4, Mn = async () => {
1194
1194
  try {
1195
1195
  await M.mkdir(D(An), { recursive: !0 });
1196
1196
  let e = await M.open(An, "wx");
@@ -1237,7 +1237,7 @@ import {
1237
1237
  let e = process.argv[1];
1238
1238
  n = e && e.endsWith("/src/bin.ts") ? O(D(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
1239
1239
  }
1240
- let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = j(r), a = i ? "start" : "dev", o = fe(process.execPath, [
1240
+ let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = j(r), a = i ? "start" : "dev", o = me(process.execPath, [
1241
1241
  n,
1242
1242
  a,
1243
1243
  e.dashboardAppPath
@@ -1452,7 +1452,7 @@ import {
1452
1452
  headInjection: i(a.meta),
1453
1453
  htmlLang: r
1454
1454
  }));
1455
- let c = new me();
1455
+ let c = new he();
1456
1456
  c.pipe(t, { end: !1 }), c.on("end", () => {
1457
1457
  t.end(n.tail);
1458
1458
  }), a.stream.pipe(c);
@@ -1518,7 +1518,7 @@ import {
1518
1518
  };
1519
1519
  return await n(e), t.sort();
1520
1520
  }, fr = async (e) => {
1521
- let t = q("sha1");
1521
+ let t = pe("sha1");
1522
1522
  for (let n of await dr(e)) {
1523
1523
  t.update(n.slice(e.length)), t.update("\0");
1524
1524
  try {
@@ -1534,24 +1534,146 @@ import {
1534
1534
  if (e.length === 0) return;
1535
1535
  let t = [];
1536
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 () => {
1537
+ return pe("sha1").update(t.join("\0")).digest("hex");
1538
+ }, mr = (e) => typeof e == "object" && !!e && e._tag === "VoltroMiddleware" && typeof e.run == "function", hr = ["middleware.ts", "middleware.tsx"], gr = (e) => {
1539
+ let t = e.replace(/\/+$/, "");
1540
+ return t === "" ? "/" : t;
1541
+ }, Z = (e, t) => {
1542
+ let n = gr(e);
1543
+ if (n === "/") return !0;
1544
+ let r = gr(t);
1545
+ return r === n || r.startsWith(`${n}/`);
1546
+ }, _r = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, vr = (e, t) => {
1547
+ if (e === void 0) return !0;
1548
+ let n = _r(e.under), r = e.routes ?? [];
1549
+ return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) => Z(e, t)) ? !(e.except ?? []).some((e) => e === t || Z(e, t)) : !1;
1550
+ }, yr = (e) => {
1551
+ if (e?.assets !== !0) return [];
1552
+ let t = _r(e.under);
1553
+ return t.length > 0 ? t : (e.routes ?? []).length > 0 ? [] : ["/"];
1554
+ }, br = (e, t) => yr(e).some((e) => Z(e, t)) ? !(e?.except ?? []).some((e) => Z(e, t)) : !1, xr = (e, t) => e.find(({ middleware: e }) => t.route === void 0 ? br(e.match, t.pathname) : vr(e.match, t.route))?.middleware, Sr = (e, t) => {
1555
+ let n = [];
1556
+ for (let { exportName: r, middleware: i } of e) {
1557
+ let e = i.match;
1558
+ for (let i of e?.routes ?? []) t.includes(i) || n.push({
1559
+ kind: "dead-matcher",
1560
+ message: `\`${r}\` matches routes: ['${i}'], which is not a route in this app. Route patterns are spelled as the router spells them, e.g. \`/notes/[id]\`.`
1561
+ });
1562
+ if (e?.assets !== !0) for (let [i, a] of [["under", _r(e?.under)], ["except", e?.except ?? []]]) for (let e of a) t.some((t) => Z(e, t)) || n.push({
1563
+ kind: "dead-matcher",
1564
+ message: `\`${r}\` matches ${i}: ['${e}'], which covers no route in this app. ` + (i === "except" ? "An `except` that excludes nothing is a rule that reads as active and is not." : "Add `assets: true` if you meant a path the router does not serve.")
1565
+ });
1566
+ }
1567
+ for (let r = 0; r < e.length; r += 1) for (let i = r + 1; i < e.length; i += 1) {
1568
+ let a = e[r], o = e[i], s = t.find((e) => vr(a.middleware.match, e) && vr(o.middleware.match, e));
1569
+ if (s !== void 0) {
1570
+ n.push({
1571
+ kind: "overlap",
1572
+ message: `\`${a.exportName}\` and \`${o.exportName}\` both match ${s}. A route may have at most one middleware — two hooks writing one \`authorization\` header have no defined winner. Narrow one with \`except\`, or fold them into one middleware that branches on \`req.route\`.`
1573
+ });
1574
+ continue;
1575
+ }
1576
+ {
1577
+ let e = yr(a.middleware.match), t = yr(o.middleware.match), r = e.some((e) => t.some((t) => Z(e, t) || Z(t, e))), i = (a.middleware.match?.except ?? []).some((e) => t.length > 0 && t.every((t) => Z(e, t))) || (o.middleware.match?.except ?? []).some((t) => e.length > 0 && e.every((e) => Z(t, e)));
1578
+ r && !i && n.push({
1579
+ kind: "overlap",
1580
+ message: `\`${a.exportName}\` and \`${o.exportName}\` both declare \`assets: true\` over overlapping paths. A non-page request would match both, and there is no route to tell them apart.`
1581
+ });
1582
+ }
1583
+ }
1584
+ return n;
1585
+ }, Cr = (e, t) => {
1586
+ let r = Sr(e, t);
1587
+ if (r.length !== 0) throw n(`middleware.ts: ${r.length} problem(s)\n\n` + r.map((e) => ` • ${e.message}`).join("\n\n"));
1588
+ }, wr = (e) => {
1589
+ let t = {};
1590
+ if (!e) return t;
1591
+ for (let n of e.split(";")) {
1592
+ let e = n.indexOf("=");
1593
+ if (e <= 0) continue;
1594
+ let r = n.slice(0, e).trim();
1595
+ if (r !== "") try {
1596
+ t[r] = decodeURIComponent(n.slice(e + 1).trim());
1597
+ } catch {
1598
+ t[r] = n.slice(e + 1).trim();
1599
+ }
1600
+ }
1601
+ return t;
1602
+ }, Tr = (e) => Object.entries(e).map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join("; "), Er = /(^|[-_.])(auth[-_.]?token|session|access[-_.]?token)([-_.]|$)|^sb-.*-auth-token$/i, Dr = (e) => e.httpOnly === void 0 && Er.test(e.name), Or = (e) => {
1603
+ let t = [`${e.name}=${encodeURIComponent(e.value)}`];
1604
+ return t.push(`Path=${e.path ?? "/"}`), e.maxAge !== void 0 && t.push(`Max-Age=${Math.trunc(e.maxAge)}`), e.httpOnly !== !1 && t.push("HttpOnly"), e.secure === !0 && t.push("Secure"), t.push(`SameSite=${e.sameSite ?? "lax"}`), t.join("; ");
1605
+ }, kr = (e) => e.length === 0 ? {} : { "set-cookie": e.map(Or) }, Ar = async (e, t = (e) => import(L(e).href)) => {
1606
+ for (let r of hr) {
1607
+ let i;
1608
+ try {
1609
+ i = await t(O(e, r));
1610
+ } catch (e) {
1611
+ let t = e?.code;
1612
+ if (t === "ERR_MODULE_NOT_FOUND" || t === "MODULE_NOT_FOUND") continue;
1613
+ throw e;
1614
+ }
1615
+ let a = Object.entries(i ?? {}), o = a.filter((e) => mr(e[1])).map(([e, t]) => ({
1616
+ exportName: e,
1617
+ middleware: t
1618
+ }));
1619
+ if (o.length > 0) return o;
1620
+ let s = a.find(([, e]) => typeof e == "function");
1621
+ if (s !== void 0) {
1622
+ let [e] = s;
1623
+ throw n(`${r} exports \`${e}\` as a bare function, which is not a middleware. Wrap it:\n\n import { defineMiddleware } from '@voltro/web/middleware'
1624
+
1625
+ export const ${e === "default" ? "session" : e} = defineMiddleware({\n match: { under: '/app' }, // omit to run on every route
1626
+ run: async (req) => { /* … */ },\n })
1627
+
1628
+ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report where a middleware runs without executing it.`);
1629
+ }
1630
+ return o;
1631
+ }
1632
+ return [];
1633
+ }, jr = async (e, t, n) => {
1634
+ let r = {
1635
+ headers: t.headers,
1636
+ cookies: t.cookies,
1637
+ setCookies: []
1638
+ };
1639
+ if (e === void 0) return r;
1640
+ let i = await e.run(t);
1641
+ if (!i) return r;
1642
+ let a = i.setCookies ?? [];
1643
+ if (n !== void 0) for (let e of a) Dr(e) && n(e);
1644
+ let o = i.headers ? {
1645
+ ...t.headers,
1646
+ ...i.headers
1647
+ } : { ...t.headers };
1648
+ if (a.length === 0) return {
1649
+ headers: o,
1650
+ cookies: t.cookies,
1651
+ setCookies: a
1652
+ };
1653
+ let s = { ...t.cookies };
1654
+ for (let e of a) e.maxAge !== void 0 && e.maxAge <= 0 ? delete s[e.name] : s[e.name] = e.value;
1655
+ return i.headers?.cookie === void 0 && (o.cookie = Tr(s)), {
1656
+ headers: o,
1657
+ cookies: s,
1658
+ setCookies: a
1659
+ };
1660
+ }, Q = z({ scope: "voltro:dev:web" }), Mr = z({ scope: "vite" }), Nr = await (async () => {
1539
1661
  try {
1540
- let e = O(D(R(import.meta.url)), "..", "package.json"), t = await M.readFile(e, "utf8");
1662
+ let e = O(D(te(import.meta.url)), "..", "package.json"), t = await M.readFile(e, "utf8");
1541
1663
  return JSON.parse(t).version ?? "0.0.0";
1542
1664
  } catch {
1543
1665
  return "0.0.0";
1544
1666
  }
1545
- })(), gr = async () => {
1667
+ })(), Pr = async () => {
1546
1668
  try {
1547
- let e = D(R(import.meta.url)), t = A(e, "..", "..", "devtools");
1669
+ let e = D(te(import.meta.url)), t = A(e, "..", "..", "devtools");
1548
1670
  if (j(O(t, "package.json"))) return t;
1549
1671
  let n = A(e, "..", "..", "..", "devtools");
1550
1672
  return j(O(n, "package.json")) ? n : null;
1551
1673
  } catch {
1552
1674
  return null;
1553
1675
  }
1554
- }, _r = (e, t) => e.disableDevtools || !t ? [] : [
1676
+ }, Fr = (e, t) => e.disableDevtools || !t ? [] : [
1555
1677
  "",
1556
1678
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
1557
1679
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -1561,12 +1683,12 @@ import {
1561
1683
  " await import('@voltro/devtools/styles.css')",
1562
1684
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
1563
1685
  "}"
1564
- ], vr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], yr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], br = (e) => e.sentry ? [
1686
+ ], Ir = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Lr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Rr = (e) => e.sentry ? [
1565
1687
  "",
1566
1688
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
1567
1689
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
1568
1690
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
1569
- ] : [], xr = (e) => e.env ? ["import './env.public'"] : [], Sr = (e) => {
1691
+ ] : [], zr = (e) => e.env ? ["import './env.public'"] : [], Br = (e) => {
1570
1692
  let t = [], n = A(e);
1571
1693
  for (;;) {
1572
1694
  j(O(n, "pnpm-workspace.yaml")) && t.push(n);
@@ -1575,14 +1697,14 @@ import {
1575
1697
  n = e;
1576
1698
  }
1577
1699
  return t;
1578
- }, Cr = b, wr = (e) => {
1700
+ }, Vr = b, Hr = (e) => {
1579
1701
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
1580
1702
  let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
1581
1703
  if (t) return `island-${t[1]}`;
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));
1704
+ }, Ur = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Wr = (e) => e.startsWith("(") && e.endsWith(")"), Gr = (e) => e.filter((e) => !Wr(e)), Kr = (e) => {
1705
+ let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Wr(e));
1584
1706
  return t.length === 0 ? "/" : "/" + t.join("/");
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) => {
1707
+ }, qr = (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`, $ = (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}`, Jr = async (e) => {
1586
1708
  let t = [], n = [], r = async (e, i) => {
1587
1709
  let a = [];
1588
1710
  try {
@@ -1590,17 +1712,17 @@ import {
1590
1712
  } catch {
1591
1713
  return;
1592
1714
  }
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("/");
1715
+ let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Vr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
1594
1716
  if (l.some((e) => s.has(e))) {
1595
1717
  let t = u.has("layout.tsx"), r = !1;
1596
1718
  if (t) try {
1597
1719
  let t = await M.readFile(O(e, "layout.tsx"), "utf8");
1598
- r = Tr.test(t);
1720
+ r = Ur.test(t);
1599
1721
  } catch {}
1600
1722
  n.push({
1601
1723
  dir: d,
1602
1724
  chain: i,
1603
- contributesToUrl: i.length === 0 || !Er(i[i.length - 1]),
1725
+ contributesToUrl: i.length === 0 || !Wr(i[i.length - 1]),
1604
1726
  hasLayout: t,
1605
1727
  hasLayoutLoader: r,
1606
1728
  hasError: u.has("error.tsx"),
@@ -1614,8 +1736,8 @@ import {
1614
1736
  let n = d ? `${d}/${e}` : e;
1615
1737
  t.push({
1616
1738
  file: n,
1617
- pattern: Or(n),
1618
- ident: kr(n),
1739
+ pattern: Kr(n),
1740
+ ident: qr(n),
1619
1741
  dirChain: i
1620
1742
  });
1621
1743
  }
@@ -1634,14 +1756,14 @@ import {
1634
1756
  dirs: a,
1635
1757
  orphanedSpecials: o
1636
1758
  };
1637
- }, Ar = (e, t) => {
1759
+ }, Yr = (e, t) => {
1638
1760
  let n = [];
1639
1761
  for (let r = 0; r <= t.length; r++) {
1640
1762
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
1641
1763
  a && n.push(a);
1642
1764
  }
1643
1765
  return n;
1644
- }, jr = async (e) => {
1766
+ }, Xr = async (e) => {
1645
1767
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
1646
1768
  return {
1647
1769
  chain: await Promise.all(t.map(async (e, t) => {
@@ -1665,10 +1787,10 @@ import {
1665
1787
  })),
1666
1788
  segmentLoaderData: o
1667
1789
  };
1668
- }, Mr = (e) => {
1669
- let t = Dr(e);
1790
+ }, Zr = (e) => {
1791
+ let t = Gr(e);
1670
1792
  return t.length === 0 ? "" : "/" + t.join("/");
1671
- }, Nr = [
1793
+ }, Qr = [
1672
1794
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
1673
1795
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
1674
1796
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -1761,7 +1883,7 @@ import {
1761
1883
  " _vdtErrorStart('Build error')",
1762
1884
  " })",
1763
1885
  "}"
1764
- ].join("\n"), Pr = (e) => {
1886
+ ].join("\n"), $r = (e) => {
1765
1887
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
1766
1888
  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, "\\$&"));
1767
1889
  let a = i.join("/");
@@ -1770,8 +1892,8 @@ import {
1770
1892
  paramNames: t,
1771
1893
  priority: n
1772
1894
  };
1773
- }, Fr = (e) => e.map((e) => {
1774
- let { regex: t, paramNames: n, priority: r } = Pr(e.pattern);
1895
+ }, ei = (e) => e.map((e) => {
1896
+ let { regex: t, paramNames: n, priority: r } = $r(e.pattern);
1775
1897
  return {
1776
1898
  pattern: e.pattern,
1777
1899
  file: e.file,
@@ -1780,7 +1902,7 @@ import {
1780
1902
  paramNames: n,
1781
1903
  priority: r
1782
1904
  };
1783
- }).slice().sort((e, t) => e.priority - t.priority), Ir = (e, t) => {
1905
+ }).slice().sort((e, t) => e.priority - t.priority), ti = (e, t) => {
1784
1906
  for (let n of t) {
1785
1907
  let t = n.regex.exec(e);
1786
1908
  if (!t) continue;
@@ -1792,9 +1914,9 @@ import {
1792
1914
  };
1793
1915
  }
1794
1916
  return null;
1795
- }, Lr = Ee, Rr = async (e) => {
1917
+ }, ni = J, ri = async (e) => {
1796
1918
  try {
1797
- let t = await import(z(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
1919
+ let t = await import(L(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
1798
1920
  kind: "api",
1799
1921
  configPort: typeof n == "number" ? n : void 0,
1800
1922
  env: {}
@@ -1808,7 +1930,7 @@ import {
1808
1930
  kind: "api",
1809
1931
  env: {}
1810
1932
  }).port };
1811
- }, zr = (e, t) => ({
1933
+ }, ii = (e, t) => ({
1812
1934
  name: e,
1813
1935
  pkg: t.package,
1814
1936
  browserWsUrl: t.url,
@@ -1816,7 +1938,7 @@ import {
1816
1938
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
1817
1939
  ...t.headers ? { headers: t.headers } : {},
1818
1940
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1819
- }), Br = (e, t, n) => {
1941
+ }), ai = (e, t, n) => {
1820
1942
  let r = t.transport?.wsPath ?? n.wsPath;
1821
1943
  return {
1822
1944
  name: e,
@@ -1828,7 +1950,7 @@ import {
1828
1950
  ...t.headers ? { headers: t.headers } : {},
1829
1951
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1830
1952
  };
1831
- }, Vr = (e) => {
1953
+ }, oi = (e) => {
1832
1954
  let t = /* @__PURE__ */ new Map();
1833
1955
  for (let n of e) {
1834
1956
  if (n.proxyTarget === void 0) continue;
@@ -1836,43 +1958,43 @@ import {
1836
1958
  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>.`);
1837
1959
  t.set(n.browserWsUrl, n.name);
1838
1960
  }
1839
- }, Hr = async (e, t) => {
1961
+ }, si = async (e, t) => {
1840
1962
  let n = Object.entries(t.apis ?? {}), r = [];
1841
1963
  for (let [t, i] of n) {
1842
1964
  if (i.url) {
1843
- r.push(zr(t, i));
1965
+ r.push(ii(t, i));
1844
1966
  continue;
1845
1967
  }
1846
- let n = await Lr(e, i.package);
1968
+ let n = await ni(e, i.package);
1847
1969
  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.`);
1848
- r.push(Br(t, i, await Rr(n)));
1970
+ r.push(ai(t, i, await ri(n)));
1849
1971
  }
1850
- return Vr(r), r;
1851
- }, Ur = (e) => {
1972
+ return oi(r), r;
1973
+ }, ci = (e) => {
1852
1974
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
1853
1975
  let t = new URL(e);
1854
1976
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
1855
1977
  } catch {
1856
1978
  return;
1857
1979
  }
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) => {
1980
+ }, li = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ui = (e) => process.env[li(e)] ?? process.env.VOLTRO_API_ORIGIN, di = (e, t) => {
1859
1981
  if (!e) return;
1860
- let n = Gr(e.name) ?? e.serverOrigin;
1982
+ let n = ui(e.name) ?? e.serverOrigin;
1861
1983
  if (n) {
1862
- let e = Ur(n);
1984
+ let e = ci(n);
1863
1985
  if (e) return e;
1864
1986
  }
1865
1987
  if (t?.allowDevProxy && e.proxyTarget) {
1866
- let t = Ur(e.proxyTarget);
1988
+ let t = ci(e.proxyTarget);
1867
1989
  if (t) return t;
1868
1990
  }
1869
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Ur(e.browserWsUrl);
1870
- }, qr = (e, t, n) => {
1991
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ci(e.browserWsUrl);
1992
+ }, fi = (e, t, n) => {
1871
1993
  if (!e) {
1872
1994
  if (n?.apiName === void 0) return;
1873
1995
  let e = n.apiName;
1874
1996
  return async () => {
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.`);
1997
+ 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 ${li(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.`);
1876
1998
  };
1877
1999
  }
1878
2000
  return async (r, i) => {
@@ -1888,13 +2010,14 @@ import {
1888
2010
  method: "POST",
1889
2011
  headers: {
1890
2012
  "content-type": "application/json",
1891
- ...t ? { cookie: t } : {}
2013
+ ...t ? { cookie: t } : {},
2014
+ ...Object.fromEntries(Object.entries(n?.headers ?? {}).filter(([e]) => e === "authorization" || e.startsWith("x-voltro-") || e === "x-tenant"))
1892
2015
  },
1893
2016
  body: JSON.stringify(a)
1894
2017
  });
1895
2018
  } catch (t) {
1896
2019
  let i = t?.cause?.code ?? String(t?.message ?? 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 });
2020
+ throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${li(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 });
1898
2021
  }
1899
2022
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
1900
2023
  let s = await o.json();
@@ -1924,8 +2047,8 @@ import {
1924
2047
  }
1925
2048
  if (u) return l;
1926
2049
  };
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" ? [
2050
+ }, pi = async (e, t, n, r = {}) => {
2051
+ 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 Pr() !== null, s = t.theme === "system" ? [
1929
2052
  " <script>",
1930
2053
  " (function () {",
1931
2054
  " var root = document.documentElement",
@@ -1963,9 +2086,9 @@ import {
1963
2086
  " </body>",
1964
2087
  "</html>",
1965
2088
  ""
1966
- ].join("\n"), l = O(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
2089
+ ].join("\n"), l = O(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await Jr(l);
1967
2090
  await y(l, u);
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.`);
2091
+ for (let e of f) Q.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
1969
2092
  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
2093
  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
2094
  let g = n.map((e) => {
@@ -1976,16 +2099,16 @@ import {
1976
2099
  let n = u.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
1977
2100
  for (let e of d) {
1978
2101
  let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
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'`);
2102
+ e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${$(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${$(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${$(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${$(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${$(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
1980
2103
  }
1981
2104
  let i = u.map((e) => {
1982
- let t = Ar(d, e.dirChain).map((e) => {
2105
+ let t = Yr(d, e.dirChain).map((e) => {
1983
2106
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
1984
2107
  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(", ")} }`;
1985
2108
  }).join(",\n");
1986
2109
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
1987
2110
  }), a = d.filter((e) => e.hasNotFound).map((e) => {
1988
- let t = Mr(e.chain), n = Ar(d, e.chain).map((e) => {
2111
+ let t = Zr(e.chain), n = Yr(d, e.chain).map((e) => {
1989
2112
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
1990
2113
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
1991
2114
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
@@ -1993,23 +2116,23 @@ import {
1993
2116
  }), s = [], c = [], l = [], f = [], p = [], m = [];
1994
2117
  for (let e of d) {
1995
2118
  let t = e.dir === "" ? "../src/pages/layout.tsx" : `../src/pages/${e.dir}/layout.tsx`, n = e.dir === "" ? "../src/pages/error.tsx" : `../src/pages/${e.dir}/error.tsx`, r = e.dir === "" ? "../src/pages/loading.tsx" : `../src/pages/${e.dir}/loading.tsx`, i = e.dir === "" ? "../src/pages/not-found.tsx" : `../src/pages/${e.dir}/not-found.tsx`, a = JSON.stringify(e.dir);
1996
- e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${Q(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${Q(e.dir, "Layout")}Mod.loader,`), s.push({
2119
+ e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${$(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${$(e.dir, "Layout")}Mod.loader,`), s.push({
1997
2120
  relPath: t,
1998
2121
  kind: "layout",
1999
2122
  slotKey: e.dir
2000
- })) : e.hasLayout && (c.push(` ${a}: ${Q(e.dir, "Layout")},`), s.push({
2123
+ })) : e.hasLayout && (c.push(` ${a}: ${$(e.dir, "Layout")},`), s.push({
2001
2124
  relPath: t,
2002
2125
  kind: "layout",
2003
2126
  slotKey: e.dir
2004
- })), e.hasError && (f.push(` ${a}: ${Q(e.dir, "Error")},`), s.push({
2127
+ })), e.hasError && (f.push(` ${a}: ${$(e.dir, "Error")},`), s.push({
2005
2128
  relPath: n,
2006
2129
  kind: "error",
2007
2130
  slotKey: e.dir
2008
- })), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
2131
+ })), e.hasPending && (p.push(` ${a}: ${$(e.dir, "Pending")},`), s.push({
2009
2132
  relPath: r,
2010
2133
  kind: "pending",
2011
2134
  slotKey: e.dir
2012
- })), e.hasNotFound && (m.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
2135
+ })), e.hasNotFound && (m.push(` ${a}: ${$(e.dir, "NotFound")},`), s.push({
2013
2136
  relPath: i,
2014
2137
  kind: "notFound",
2015
2138
  slotKey: e.dir
@@ -2024,7 +2147,7 @@ import {
2024
2147
  let n = JSON.stringify(e.slotKey);
2025
2148
  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 }`;
2026
2149
  }), 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(", ")}]`);
2150
+ if (S.length > 0 && !C && Q.info(`i18n: locales [${S.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), S.length > 0 && !S.includes(T)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${T}' must be one of locales [${S.join(", ")}]`);
2028
2151
  let E = w ? [
2029
2152
  "import { I18nProvider } from '@voltro/i18n'",
2030
2153
  "import { resolveLocale } from '@voltro/i18n/server'",
@@ -2241,14 +2364,14 @@ import {
2241
2364
  "// resolved apis map. Side-effect only — no local component definitions —",
2242
2365
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2243
2366
  "",
2244
- ...xr(t),
2367
+ ...zr(t),
2245
2368
  "import { mount } from '@voltro/web'",
2246
2369
  ...h,
2247
2370
  "import { App } from './app'",
2248
2371
  "import { preloadCurrentRoute } from './routeTable'",
2249
- ...yr(t),
2250
- ..._r(t, o),
2251
- ...br(t),
2372
+ ...Lr(t),
2373
+ ...Fr(t, o),
2374
+ ...Rr(t),
2252
2375
  "",
2253
2376
  "// Preload the current route's page chunk BEFORE hydration so the first",
2254
2377
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2265,10 +2388,10 @@ import {
2265
2388
  " apis: {",
2266
2389
  ...g,
2267
2390
  " },",
2268
- ...vr(t, o),
2391
+ ...Ir(t, o),
2269
2392
  "})",
2270
2393
  "",
2271
- Nr
2394
+ Qr
2272
2395
  ].join("\n");
2273
2396
  } else _ = "", v = "", b = [
2274
2397
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2276,25 +2399,25 @@ import {
2276
2399
  "// and calls mount(). Side-effect only, no component definitions, so the",
2277
2400
  "// user's component file remains the Fast Refresh boundary.",
2278
2401
  "",
2279
- ...xr(t),
2402
+ ...zr(t),
2280
2403
  "import { mount } from '@voltro/web'",
2281
2404
  ...h,
2282
2405
  "import App from '../src/App'",
2283
- ...yr(t),
2284
- ..._r(t, o),
2285
- ...br(t),
2406
+ ...Lr(t),
2407
+ ...Fr(t, o),
2408
+ ...Rr(t),
2286
2409
  "",
2287
2410
  "mount(App, {",
2288
2411
  " apis: {",
2289
2412
  ...g,
2290
2413
  " },",
2291
- ...vr(t, o),
2414
+ ...Ir(t, o),
2292
2415
  "})",
2293
2416
  "",
2294
- Nr
2417
+ Qr
2295
2418
  ].join("\n");
2296
2419
  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 }));
2420
+ await M.mkdir(x, { recursive: !0 }), t.env ? await Se(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
2421
  let S = O(e, ".gitignore"), C = "";
2299
2422
  try {
2300
2423
  C = await M.readFile(S, "utf8");
@@ -2305,41 +2428,41 @@ import {
2305
2428
  try {
2306
2429
  await M.appendFile(S, `${e}${E.join("\n")}\n`, "utf8");
2307
2430
  } catch (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) });
2431
+ Q.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) });
2309
2432
  }
2310
2433
  }
2311
- }, Yr = async (e, t) => {
2434
+ }, mi = async (e, t) => {
2312
2435
  try {
2313
2436
  let n = D(e), r = O(n, "project.json");
2314
2437
  if (!j(r)) return;
2315
2438
  let i = await M.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
2316
2439
  for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
2317
2440
  if (s.length === 0) return;
2318
- Z.warn("sibling app(s) claim the same port — only one boots", {
2441
+ Q.warn("sibling app(s) claim the same port — only one boots", {
2319
2442
  port: t,
2320
2443
  conflicts: s,
2321
2444
  projectJson: r
2322
2445
  });
2323
2446
  } catch {}
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");
2447
+ }, hi = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), gi = async (e, t = {}) => {
2448
+ let n = hi(e), r = t.preferSource !== !0 && j(n) ? n : O(e, "app.config.ts");
2326
2449
  try {
2327
- let e = (await import(z(r).href)).default;
2450
+ let e = (await import(L(r).href)).default;
2328
2451
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2329
2452
  } catch {
2330
2453
  return null;
2331
2454
  }
2332
- }, Qr = async (e) => {
2333
- let n = await Zr(e, { preferSource: !0 });
2455
+ }, _i = async (e) => {
2456
+ let n = await gi(e, { preferSource: !0 });
2334
2457
  if (!n) return {
2335
2458
  ran: !1,
2336
2459
  exitCode: 0
2337
2460
  };
2338
2461
  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);
2342
- for (let e of a) Z.info("api wired", {
2462
+ let i = St();
2463
+ Bt(i), Q.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), We(e, Q);
2464
+ let a = await si(e, n);
2465
+ for (let e of a) Q.info("api wired", {
2343
2466
  name: e.name,
2344
2467
  pkg: e.pkg,
2345
2468
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
@@ -2347,17 +2470,17 @@ import {
2347
2470
  g(e).then((e) => {
2348
2471
  for (let t of e.files) if (t.action === "created") {
2349
2472
  let e = t.path.split("/").pop() ?? t.path;
2350
- Z.info(`${e} seeded`, { path: t.path });
2473
+ Q.info(`${e} seeded`, { path: t.path });
2351
2474
  }
2352
2475
  }).catch(() => {});
2353
- let { resolved: o } = await Se({
2476
+ let { resolved: o } = await Ce({
2354
2477
  rawEnv: n.env,
2355
2478
  appType: "web",
2356
2479
  root: e,
2357
- log: Z,
2480
+ log: Q,
2358
2481
  generateTypes: !0
2359
2482
  }), s = o.publicValues;
2360
- await Jr(e, n, a, s), Z.debug("generated framework entry files", { files: [
2483
+ await pi(e, n, a, s), Q.debug("generated framework entry files", { files: [
2361
2484
  "index.html",
2362
2485
  ".framework/main.tsx",
2363
2486
  ...n.env ? [".framework/env.public.ts"] : []
@@ -2368,7 +2491,7 @@ import {
2368
2491
  env: process.env,
2369
2492
  dashboardPin: process.env[Tn] === "1"
2370
2493
  });
2371
- for (let e of c.warnings) Z.warn(e);
2494
+ for (let e of c.warnings) Q.warn(e);
2372
2495
  let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
2373
2496
  await x({
2374
2497
  id: b,
@@ -2378,22 +2501,22 @@ import {
2378
2501
  pid: process.pid,
2379
2502
  status: "booting",
2380
2503
  logFile: D.path
2381
- }).catch(() => {}), await Yr(e, l);
2382
- let { pages: N, dirs: P } = await $(O(e, "src", "pages")), F = {
2504
+ }).catch(() => {}), await mi(e, l);
2505
+ let { pages: N, dirs: P } = await Jr(O(e, "src", "pages")), F = {
2383
2506
  dirs: P,
2384
- ssrRoutes: Fr(N)
2385
- }, I = P.map((e) => ({
2507
+ ssrRoutes: ei(N)
2508
+ }, ee = P.map((e) => ({
2386
2509
  dir: e.dir,
2387
2510
  hasLayout: e.hasLayout,
2388
2511
  hasError: e.hasError,
2389
2512
  hasPending: e.hasPending,
2390
2513
  hasNotFound: e.hasNotFound
2391
- })), L = await ht({
2514
+ })), I = await mt({
2392
2515
  appRoot: e,
2393
2516
  pages: N
2394
2517
  });
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([
2518
+ I.wrote && Q.debug("routes codegen wrote", { path: k(e, I.path) });
2519
+ let te = await _e("vite", () => import("vite")), L = (await import("@vitejs/plugin-react")).default, R = (await import("@tailwindcss/vite")).default, z = O(e, ".framework"), B = O(e, "src"), V = /* @__PURE__ */ new Set([
2397
2520
  ".framework",
2398
2521
  "node_modules",
2399
2522
  "dist",
@@ -2401,156 +2524,166 @@ import {
2401
2524
  ".vite",
2402
2525
  ".turbo",
2403
2526
  ".cache"
2404
- ]), U = {
2527
+ ]), re = {
2405
2528
  name: "framework:watch-app-sources",
2406
2529
  async configureServer(t) {
2407
2530
  try {
2408
- let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
2531
+ let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !V.has(e.name));
2409
2532
  for (let r of n) t.watcher.add(O(e, r.name));
2410
- n.length === 0 && t.watcher.add(te);
2533
+ n.length === 0 && t.watcher.add(B);
2411
2534
  } catch {
2412
- t.watcher.add(te);
2535
+ t.watcher.add(B);
2413
2536
  }
2414
2537
  for (let n of await De(e)) t.watcher.add(n.dir);
2415
2538
  }
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) => {
2539
+ }, H = O(e, "src", "pages"), U = (e) => e.endsWith(".tsx") && (e === H || e.startsWith(H + "/")), ie = (e) => e === H || e.startsWith(H + "/"), W = async (t) => {
2417
2540
  try {
2418
2541
  let r = Date.now();
2419
- await Jr(e, n, a, s);
2420
- let { pages: i, dirs: o } = await $(W);
2421
- await ht({
2542
+ await pi(e, n, a, s);
2543
+ let { pages: i, dirs: o } = await Jr(H);
2544
+ await mt({
2422
2545
  appRoot: e,
2423
2546
  pages: i
2424
- }), F.dirs = o, F.ssrRoutes = Fr(i), Z.info("page tree regenerated", {
2547
+ }), F.dirs = o, F.ssrRoutes = ei(i), Q.info("page tree regenerated", {
2425
2548
  reason: t,
2426
2549
  ms: Date.now() - r,
2427
2550
  routes: F.ssrRoutes.length
2428
2551
  });
2552
+ for (let e of Sr(X, F.ssrRoutes.map((e) => e.pattern))) Q.error(`middleware.ts: ${e.message}`);
2429
2553
  } catch (e) {
2430
- Z.error("page tree regen failed", { reason: t }, e);
2554
+ Q.error("page tree regen failed", { reason: t }, e);
2431
2555
  }
2432
- }, ie = {
2556
+ }, ae = {
2433
2557
  name: "framework:regenerate-on-page-tree-change",
2434
2558
  configureServer(t) {
2435
2559
  let n = null, r = [], i = (e) => {
2436
2560
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2437
2561
  n = null;
2438
2562
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2439
- r.length = 0, re(e);
2563
+ r.length = 0, W(e);
2440
2564
  }, 50);
2441
2565
  };
2442
2566
  t.watcher.on("add", (t) => {
2443
- ne(t) && i(`add ${k(e, t)}`);
2567
+ U(t) && i(`add ${k(e, t)}`);
2444
2568
  }), t.watcher.on("unlink", (t) => {
2445
- ne(t) && i(`unlink ${k(e, t)}`);
2569
+ U(t) && i(`unlink ${k(e, t)}`);
2446
2570
  }), t.watcher.on("addDir", (t) => {
2447
- G(t) && i(`addDir ${k(e, t)}`);
2571
+ ie(t) && i(`addDir ${k(e, t)}`);
2448
2572
  }), t.watcher.on("unlinkDir", (t) => {
2449
- G(t) && i(`unlinkDir ${k(e, t)}`);
2573
+ ie(t) && i(`unlinkDir ${k(e, t)}`);
2450
2574
  });
2451
2575
  }
2452
- }, K = O(e, "app.config.ts"), oe = (e) => {
2453
- if (!ae(e.env)) return "";
2576
+ }, G = O(e, "app.config.ts"), se = (e) => {
2577
+ if (!oe(e.env)) return "";
2454
2578
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2455
2579
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2456
- }, se = (e, t) => {
2580
+ }, ce = (e, t) => {
2457
2581
  let n = [];
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 = {
2582
+ 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;
2583
+ }, le = n, ue = A(G), de = () => {
2584
+ let e = me(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2585
+ stdio: "inherit",
2586
+ env: process.env,
2587
+ cwd: process.cwd()
2588
+ }), t = (t) => {
2589
+ e.kill(t);
2590
+ }, n = () => t("SIGINT"), r = () => t("SIGTERM");
2591
+ process.on("SIGINT", n), process.on("SIGTERM", r), e.on("exit", (e, t) => {
2592
+ process.off("SIGINT", n), process.off("SIGTERM", r), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2593
+ }), e.on("error", (e) => {
2594
+ Q.error("restart spawn failed", {}, e), process.exit(1);
2595
+ });
2596
+ }, fe = {
2460
2597
  name: "framework:watch-app-config",
2461
2598
  async configureServer(n) {
2462
- n.watcher.add(K), Z.info("watching app.config.ts for changes", { path: k(e, K) });
2463
- let r = async () => {
2599
+ n.watcher.add(G), Q.info("watching app.config.ts for changes", { path: k(e, G) });
2600
+ let r = hr.map((t) => O(e, t)), i = new Set(r.map((e) => A(e)));
2601
+ for (let e of r) n.watcher.add(e);
2602
+ n.watcher.on("all", (t, r) => {
2603
+ i.has(A(r)) && (Q.warn("middleware.ts changed — restarting (it is loaded once per boot)", { path: k(e, r) }), n.close().catch(() => void 0).then(() => {
2604
+ de();
2605
+ }));
2606
+ });
2607
+ let a = async () => {
2464
2608
  try {
2465
2609
  try {
2466
- let e = n.moduleGraph.getModuleById(K);
2610
+ let e = n.moduleGraph.getModuleById(G);
2467
2611
  e && n.moduleGraph.invalidateModule(e);
2468
2612
  } catch {}
2469
- let e = (await n.ssrLoadModule(K, { fixStacktrace: !0 })).default;
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);
2613
+ let e = (await n.ssrLoadModule(G, { fixStacktrace: !0 })).default;
2614
+ return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Q.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
2471
2615
  } catch (e) {
2472
- return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
2616
+ return Q.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
2473
2617
  }
2474
- }, i = null, a = () => {
2475
- i && clearTimeout(i), i = setTimeout(() => {
2476
- i = null, o();
2618
+ }, o = null, s = () => {
2619
+ o && clearTimeout(o), o = setTimeout(() => {
2620
+ o = null, c();
2477
2621
  }, 100);
2478
- }, o = async () => {
2479
- let t = await r();
2622
+ }, c = async () => {
2623
+ let t = await a();
2480
2624
  if (!t) {
2481
- Z.info("app.config.ts onConfigChange: load returned null — skipping");
2625
+ Q.info("app.config.ts onConfigChange: load returned null — skipping");
2482
2626
  return;
2483
2627
  }
2484
- if (Z.info("app.config.ts onConfigChange: loaded", {
2628
+ if (Q.info("app.config.ts onConfigChange: loaded", {
2485
2629
  theme: t.theme,
2486
2630
  port: t.port,
2487
2631
  name: t.name
2488
- }), JSON.stringify(t) === JSON.stringify(ce)) {
2489
- Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2632
+ }), JSON.stringify(t) === JSON.stringify(le)) {
2633
+ Q.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
2490
2634
  return;
2491
2635
  }
2492
- let i = se(ce, t);
2493
- if (i.length > 0) {
2494
- Z.warn("app.config.ts changed — hard restart required", { fields: i });
2636
+ let r = ce(le, t);
2637
+ if (r.length > 0) {
2638
+ Q.warn("app.config.ts changed — hard restart required", { fields: r });
2495
2639
  try {
2496
2640
  await n.close();
2497
2641
  } catch {}
2498
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2499
- stdio: "inherit",
2500
- env: process.env,
2501
- cwd: process.cwd()
2502
- }), t = (t) => {
2503
- e.kill(t);
2504
- }, r = () => t("SIGINT"), a = () => t("SIGTERM");
2505
- process.on("SIGINT", r), process.on("SIGTERM", a), e.on("exit", (e, t) => {
2506
- process.off("SIGINT", r), process.off("SIGTERM", a), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2507
- }), e.on("error", (e) => {
2508
- Z.error("restart spawn failed", {}, e), process.exit(1);
2509
- });
2642
+ de();
2510
2643
  return;
2511
2644
  }
2512
2645
  try {
2513
2646
  let r = Date.now();
2514
- await Jr(e, t, await Hr(e, t)), ce = t, n.ws && n.ws.send({
2647
+ await pi(e, t, await si(e, t)), le = t, n.ws && n.ws.send({
2515
2648
  type: "full-reload",
2516
2649
  path: "*"
2517
- }), Z.info("app.config.ts soft-regen", {
2650
+ }), Q.info("app.config.ts soft-regen", {
2518
2651
  ms: Date.now() - r,
2519
2652
  reload: "full"
2520
2653
  });
2521
2654
  } catch (e) {
2522
- Z.error("app.config.ts soft-regen failed", {}, e);
2655
+ Q.error("app.config.ts soft-regen failed", {}, e);
2523
2656
  }
2524
- }, s = (e) => E(e) === "app.config.ts" ? e === K || A(e) === le : !1;
2657
+ }, l = (e) => E(e) === "app.config.ts" ? e === G || A(e) === ue : !1;
2525
2658
  n.watcher.on("change", (e) => {
2526
- s(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), a());
2659
+ l(e) && (Q.info("app.config.ts change event (chokidar)", { file: e }), s());
2527
2660
  }), n.watcher.on("add", (e) => {
2528
- s(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), a());
2661
+ l(e) && (Q.info("app.config.ts add event (chokidar)", { file: e }), s());
2529
2662
  });
2530
2663
  try {
2531
2664
  let { watchFile: e } = await import("node:fs");
2532
- e(K, { interval: 500 }, (e, t) => {
2533
- e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
2534
- }), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
2665
+ e(G, { interval: 500 }, (e, t) => {
2666
+ e.mtimeMs !== t.mtimeMs && (Q.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
2667
+ }), Q.info("app.config.ts polling watcher attached", { intervalMs: 500 });
2535
2668
  } catch (e) {
2536
- Z.warn("app.config.ts polling watcher could not attach", {}, e);
2669
+ Q.warn("app.config.ts polling watcher could not attach", {}, e);
2537
2670
  }
2538
- ke(t, Z, {
2671
+ ke(t, Q, {
2539
2672
  root: e,
2540
2673
  onBeforeRestart: () => n.close()
2541
2674
  });
2542
2675
  }
2543
- }, de = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, pe = {
2676
+ }, pe = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, K = 0, he = {
2544
2677
  name: "framework:suppress-api-hmr",
2545
2678
  handleHotUpdate(e) {
2546
- if (q += 1, de.test(e.file)) return [];
2679
+ if (K += 1, pe.test(e.file)) return [];
2547
2680
  }
2548
- }, me = {
2681
+ }, ge = {
2549
2682
  name: "framework:reoptimize-on-rpcgroup-change",
2550
2683
  async configureServer(t) {
2551
2684
  let n = [];
2552
2685
  for (let r of a) {
2553
- let i = await Lr(e, r.pkg);
2686
+ let i = await ni(e, r.pkg);
2554
2687
  if (i) {
2555
2688
  n.push(i);
2556
2689
  try {
@@ -2566,14 +2699,14 @@ import {
2566
2699
  if (o) return;
2567
2700
  let e = await pr(n);
2568
2701
  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)");
2702
+ r = e, o = !0, Q.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
2570
2703
  try {
2571
- await M.rm(O(V, ".vite", "deps"), {
2704
+ await M.rm(O(z, ".vite", "deps"), {
2572
2705
  recursive: !0,
2573
2706
  force: !0
2574
2707
  }), await t.restart(!0);
2575
2708
  } catch (e) {
2576
- o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2709
+ o = !1, Q.error("rpcGroup re-optimize failed", {}, e);
2577
2710
  }
2578
2711
  }
2579
2712
  }, c = (e) => {
@@ -2584,7 +2717,7 @@ import {
2584
2717
  };
2585
2718
  t.watcher.on("change", c), t.watcher.on("add", c);
2586
2719
  }
2587
- }, J = {}, ge = (e) => (t) => {
2720
+ }, q = {}, ve = (e) => (t) => {
2588
2721
  t.on("proxyReq", (t, n) => {
2589
2722
  sn(t, n, {
2590
2723
  target: e,
@@ -2596,36 +2729,36 @@ import {
2596
2729
  };
2597
2730
  for (let e of a) {
2598
2731
  if (!e.proxyTarget) continue;
2599
- J[e.browserWsUrl] = {
2732
+ q[e.browserWsUrl] = {
2600
2733
  target: e.proxyTarget,
2601
2734
  ws: !0,
2602
2735
  changeOrigin: !0,
2603
2736
  ...e.wsPath ? {} : { rewrite: () => "/ws" }
2604
2737
  };
2605
2738
  let t = e.proxyTarget.replace(/^ws/, "http");
2606
- J[`/_voltro/api/${e.name}`] = {
2739
+ q[`/_voltro/api/${e.name}`] = {
2607
2740
  target: t,
2608
2741
  changeOrigin: !0,
2609
2742
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
2610
- configure: ge(t)
2743
+ configure: ve(t)
2611
2744
  };
2612
2745
  }
2613
2746
  for (let [e, t] of Object.entries(n.proxies ?? {})) {
2614
- if (J[e]) {
2615
- Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
2747
+ if (q[e]) {
2748
+ Q.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
2616
2749
  continue;
2617
2750
  }
2618
- J[e] = {
2751
+ q[e] = {
2619
2752
  target: t.target,
2620
2753
  changeOrigin: t.changeOrigin ?? !0,
2621
2754
  ...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
2622
- }, Z.info(`proxy ${e} → ${t.target}`, {
2755
+ }, Q.info(`proxy ${e} → ${t.target}`, {
2623
2756
  prefix: e,
2624
2757
  target: t.target,
2625
2758
  ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
2626
2759
  });
2627
2760
  }
2628
- let _e = {
2761
+ let ye = {
2629
2762
  name: "framework:inspect",
2630
2763
  configureServer(t) {
2631
2764
  let r = null, a = async () => {
@@ -2648,7 +2781,7 @@ import {
2648
2781
  hasGetStaticPaths: typeof i.getStaticPaths == "function"
2649
2782
  });
2650
2783
  } catch (e) {
2651
- Z.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
2784
+ Q.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
2652
2785
  }
2653
2786
  return r = n, n;
2654
2787
  };
@@ -2670,7 +2803,7 @@ import {
2670
2803
  if (t.method !== "GET" && t.method !== "HEAD") return r();
2671
2804
  let { pathname: i } = Hn(t.url ?? "/");
2672
2805
  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 }));
2806
+ n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(bt({ indexable: !1 }));
2674
2807
  }), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
2675
2808
  let r = e.url ?? "", i = r.split("?")[0];
2676
2809
  if (i === "/api/dashboard/proxy") {
@@ -2761,7 +2894,7 @@ import {
2761
2894
  for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
2762
2895
  let c = o.split("?")[0];
2763
2896
  if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
2764
- let e = d(s.origin), n = en(o, It(), s);
2897
+ let e = d(s.origin), n = en(o, Ft(), s);
2765
2898
  t.statusCode = n.status, t.setHeader("content-type", n.contentType);
2766
2899
  for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
2767
2900
  t.end(n.body);
@@ -2810,14 +2943,14 @@ import {
2810
2943
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2811
2944
  t.flushHeaders?.(), t.write("retry: 5000\n\n");
2812
2945
  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));
2946
+ if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(Ct(e));
2814
2947
  let c = i.subscribe((e) => {
2815
2948
  try {
2816
- t.write(wt(e));
2949
+ t.write(Ct(e));
2817
2950
  } catch {}
2818
2951
  }), l = setInterval(() => {
2819
2952
  try {
2820
- t.write(Tt());
2953
+ t.write(wt());
2821
2954
  } catch {}
2822
2955
  }, 15e3), p = () => {
2823
2956
  clearInterval(l), c();
@@ -2830,7 +2963,7 @@ import {
2830
2963
  kind: "web",
2831
2964
  meta: {
2832
2965
  name: n.name ?? "(unnamed)",
2833
- voltroVersion: hr,
2966
+ voltroVersion: Nr,
2834
2967
  port: l,
2835
2968
  mode: "dev",
2836
2969
  apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
@@ -2842,13 +2975,13 @@ import {
2842
2975
  })
2843
2976
  },
2844
2977
  routes: await a(),
2845
- dirs: I,
2978
+ dirs: ee,
2846
2979
  cache: () => ({
2847
2980
  backend: "memory",
2848
2981
  size: 0,
2849
2982
  entries: []
2850
2983
  }),
2851
- env: () => we(n.name ?? "app", { contract: ae(n.env) ? n.env : void 0 })
2984
+ env: () => Te(n.name ?? "app", { contract: oe(n.env) ? n.env : void 0 })
2852
2985
  }, c = p(o, i, s, { method: e.method ?? "GET" });
2853
2986
  if (c === null) return r();
2854
2987
  t.statusCode = c.status, t.setHeader("content-type", c.contentType);
@@ -2859,7 +2992,7 @@ import {
2859
2992
  }
2860
2993
  });
2861
2994
  }
2862
- }, ve = n.name === "voltroDashboard" ? {
2995
+ }, be = n.name === "voltroDashboard" ? {
2863
2996
  name: "framework:dashboard-registry",
2864
2997
  configureServer(e) {
2865
2998
  e.middlewares.use(async (e, t, n) => {
@@ -2872,12 +3005,12 @@ import {
2872
3005
  }
2873
3006
  });
2874
3007
  }
2875
- } : null, ye = /* @__PURE__ */ new Set(), be = (e, t, n, r, i, a = !1) => {
3008
+ } : null, xe = /* @__PURE__ */ new Set(), Se = (e, t, n, r, i, a = !1) => {
2876
3009
  let o = Yn(i, a, t) ?? "";
2877
- if (Z.error(`${t} render failed`, {
3010
+ if (Q.error(`${t} render failed`, {
2878
3011
  pathname: n,
2879
3012
  pattern: r,
2880
- cause: Dt(i) + o
3013
+ cause: Et(i) + o
2881
3014
  }), e.headersSent) {
2882
3015
  e.end();
2883
3016
  return;
@@ -2885,24 +3018,24 @@ import {
2885
3018
  e.writeHead(500, {
2886
3019
  "content-type": "text/plain; charset=utf-8",
2887
3020
  "x-voltro-rendered-by": `${t}-failed`,
2888
- "x-voltro-ssr-generation": String(q)
3021
+ "x-voltro-ssr-generation": String(K)
2889
3022
  });
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`;
2891
- e.end(`${t} render failed for ${n}\n\n${Dt(i)}\n${o}\n${s}`);
2892
- }, xe = rt(), Ce = at({
2893
- limit: xe,
2894
- onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
2895
- onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
3023
+ let s = K === 0 ? "" : `\n[voltro] this process has absorbed ${K} 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`;
3024
+ e.end(`${t} render failed for ${n}\n\n${Et(i)}\n${o}\n${s}`);
3025
+ }, we = nt(), Ee = it({
3026
+ limit: we,
3027
+ onColdStart: (e) => Q.debug("ssr cold-compile start", { id: e }),
3028
+ onColdEnd: (e, { durationMs: t, failed: n }) => Q.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
2896
3029
  id: e,
2897
3030
  ms: t,
2898
3031
  ...n ? { failed: !0 } : {}
2899
3032
  })
2900
3033
  });
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 = {
3034
+ Q.debug(`ssr cold-compile concurrency ${we}`, { concurrency: we });
3035
+ let J = null, Oe = async () => (J === null && (J = await M.readFile(O(e, ".framework", "index.html"), "utf8")), J), Ae = {
2903
3036
  name: "framework:ssr",
2904
3037
  configureServer(t) {
2905
- let r = (e) => Ce.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
3038
+ let r = (e) => Ee.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
2906
3039
  if (i !== void 0) return i;
2907
3040
  let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
2908
3041
  return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
@@ -2911,7 +3044,7 @@ import {
2911
3044
  let t = (await r(O(e, "src", "locales", `${i}.ts`))).default;
2912
3045
  t !== void 0 && (s[i] = n(i, t, a));
2913
3046
  } catch (e) {
2914
- Z.warn("locale catalog failed to load for SSR", { locale: i }, e);
3047
+ Q.warn("locale catalog failed to load for SSR", { locale: i }, e);
2915
3048
  }
2916
3049
  if (o = Object.keys(s).length > 0, Object.keys(s).length === 0) {
2917
3050
  let { resolveLocale: e } = await r("@voltro/i18n/server");
@@ -2937,18 +3070,37 @@ import {
2937
3070
  let u = i.url ?? "/";
2938
3071
  u.indexOf("?");
2939
3072
  let { pathname: d, search: f } = Hn(u);
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();
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,
3073
+ if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt") return l();
3074
+ let p = async () => {
3075
+ if (X.length === 0) return;
3076
+ let e = xr(X, {
3077
+ route: void 0,
3078
+ pathname: d
3079
+ });
3080
+ if (e === void 0) return;
3081
+ let t = {};
3082
+ for (let [e, n] of Object.entries(i.headers ?? {})) typeof n == "string" ? t[e] = n : Array.isArray(n) && (t[e] = n.join(", "));
3083
+ let n = await jr(e, {
3084
+ pathname: d,
3085
+ search: f,
3086
+ headers: t,
3087
+ cookies: wr(t.cookie),
3088
+ route: void 0
3089
+ });
3090
+ for (let e of n.setCookies) c.appendHeader("set-cookie", Or(e));
3091
+ };
3092
+ if (/\.[a-z0-9]+$/i.test(d)) return await p(), l();
3093
+ let m = ti(d, F.ssrRoutes);
3094
+ if (!m) return await p(), l();
3095
+ let h = !xe.has(m.route.pattern), g = Date.now();
3096
+ h && Q.info(`ssr compiling ${m.route.pattern}`, {
3097
+ pattern: m.route.pattern,
2946
3098
  pathname: d
2947
3099
  });
2948
- let g = {}, v = async (e, t) => {
3100
+ let v = {}, y = async (e, t) => {
2949
3101
  let n = Date.now(), r = await t();
2950
- return g[e] = (g[e] ?? 0) + (Date.now() - n), r;
2951
- }, y = async (e, n, r) => {
3102
+ return v[e] = (v[e] ?? 0) + (Date.now() - n), r;
3103
+ }, b = async (e, n, r) => {
2952
3104
  let i = await t.moduleGraph.getModuleById(e);
2953
3105
  if (!(!i || n.has(e))) {
2954
3106
  if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
@@ -2956,127 +3108,141 @@ import {
2956
3108
  r.includes(e) || r.push(e);
2957
3109
  return;
2958
3110
  }
2959
- for (let e of i.importedModules ?? []) e.id && await y(e.id, n, r);
3111
+ for (let e of i.importedModules ?? []) e.id && await b(e.id, n, r);
2960
3112
  }
2961
- }, b = !1;
3113
+ }, x = !1;
2962
3114
  try {
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();
2968
- c.once("close", k);
2969
- let A = null, j = [], M = {};
3115
+ let S = await y("loadPage", async () => await r(O(e, "src", "pages", m.route.file))), C = _(S, O("src", "pages", m.route.file)), w = Yr(F.dirs, m.route.dirChain), T = C === "spa" && w.some((e) => e.hasLayout);
3116
+ if (C !== "ssr" && C !== "isr" && !T) return await p(), l();
3117
+ let E = {};
3118
+ for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
3119
+ let D = await jr(xr(X, {
3120
+ route: m.route.pattern,
3121
+ pathname: d
3122
+ }), {
3123
+ pathname: d,
3124
+ search: f,
3125
+ headers: E,
3126
+ cookies: wr(E.cookie),
3127
+ route: m.route.pattern
3128
+ }, ze);
3129
+ for (let e of D.setCookies) c.appendHeader("set-cookie", Or(e));
3130
+ let k = D.headers, A = fi(di(a[0], { allowDevProxy: !0 }), D.headers.cookie, {
3131
+ apiName: a[0]?.name,
3132
+ headers: D.headers
3133
+ }), j = new AbortController(), M = () => j.abort();
3134
+ c.once("close", M);
3135
+ let N = null, P = [], ee = {};
2970
3136
  try {
2971
- (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => jr({
2972
- entries: C,
3137
+ (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: P, segmentLoaderData: ee} = await y("loadChain", () => Xr({
3138
+ entries: w,
2973
3139
  loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
2974
3140
  loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
2975
3141
  loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
2976
3142
  ctx: {
2977
- params: p.params,
3143
+ params: m.params,
2978
3144
  pathname: d,
2979
3145
  search: f,
2980
- signal: D.signal,
2981
- headers: T,
2982
- query: E,
3146
+ signal: j.signal,
3147
+ headers: k,
3148
+ query: A,
2983
3149
  isServer: !0
2984
3150
  }
2985
3151
  }));
2986
- let t = x.loader;
2987
- typeof t == "function" && !w && (A = await v("loader", () => t({
2988
- params: p.params,
3152
+ let t = S.loader;
3153
+ typeof t == "function" && !T && (N = await y("loader", () => t({
3154
+ params: m.params,
2989
3155
  pathname: d,
2990
3156
  search: f,
2991
- signal: D.signal,
2992
- headers: T,
2993
- query: E,
3157
+ signal: j.signal,
3158
+ headers: k,
3159
+ query: A,
2994
3160
  isServer: !0
2995
3161
  })));
2996
3162
  } finally {
2997
- c.off("close", k);
3163
+ c.off("close", M);
2998
3164
  }
2999
- let N = await v("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
3000
- w || await cr({
3001
- pageMod: x,
3002
- params: p.params,
3003
- query: E,
3165
+ let I = await y("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
3166
+ T || await cr({
3167
+ pageMod: S,
3168
+ params: m.params,
3169
+ query: A,
3004
3170
  apiName: a[0]?.name,
3005
- seed: N.seedPreloadedSubscription,
3006
- seedFailure: N.seedPreloadedSubscriptionFailure,
3007
- onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
3171
+ seed: I.seedPreloadedSubscription,
3172
+ seedFailure: I.seedPreloadedSubscriptionFailure,
3173
+ onError: ({ tag: e, apiName: t }, n) => Q.warn("preload seed failed", {
3008
3174
  tag: e,
3009
3175
  apiName: t,
3010
3176
  pathname: d
3011
3177
  }, n)
3012
3178
  });
3013
- let P = {
3014
- pattern: p.route.pattern,
3015
- Component: x.default,
3016
- meta: x.meta,
3017
- loader: x.loader,
3018
- ErrorBoundary: x.ErrorBoundary,
3019
- Pending: x.Pending,
3020
- renderMode: S,
3021
- chain: j
3022
- }, I = {
3023
- cookies: N.parseCookieHeader(T.cookie),
3024
- headers: T,
3179
+ let te = {
3180
+ pattern: m.route.pattern,
3181
+ Component: S.default,
3182
+ meta: S.meta,
3183
+ loader: S.loader,
3184
+ ErrorBoundary: S.ErrorBoundary,
3185
+ Pending: S.Pending,
3186
+ renderMode: C,
3187
+ chain: P
3188
+ }, L = {
3189
+ cookies: D.cookies,
3190
+ headers: k,
3025
3191
  url: u
3026
- }, L = x.interactive ?? "full", R = (await s())(T.cookie, T["accept-language"]);
3027
- b = R !== void 0 && o;
3028
- let z = R ? {
3029
- outerWrap: R.outerWrap,
3030
- locale: R.locale
3031
- } : {}, B = w ? zn({
3032
- helpers: N,
3033
- page: `src/pages/${p.route.file}`,
3034
- interactive: L,
3192
+ }, R = S.interactive ?? "full", z = (await s())(k.cookie, k["accept-language"]);
3193
+ x = z !== void 0 && o;
3194
+ let ne = z ? {
3195
+ outerWrap: z.outerWrap,
3196
+ locale: z.locale
3197
+ } : {}, B = T ? zn({
3198
+ helpers: I,
3199
+ page: `src/pages/${m.route.file}`,
3200
+ interactive: R,
3035
3201
  delivery: "stream",
3036
3202
  renderInput: {
3037
- descriptor: P,
3038
- params: p.params,
3203
+ descriptor: te,
3204
+ params: m.params,
3039
3205
  pathname: d,
3040
3206
  search: f,
3041
- segmentLoaderData: M,
3042
- requestContext: I,
3043
- ...z
3207
+ segmentLoaderData: ee,
3208
+ requestContext: L,
3209
+ ...ne
3044
3210
  }
3045
- }) : null, V = w ? null : Rn({
3046
- helpers: N,
3047
- page: `src/pages/${p.route.file}`,
3211
+ }) : null, V = T ? null : Rn({
3212
+ helpers: I,
3213
+ page: `src/pages/${m.route.file}`,
3048
3214
  pathname: d,
3049
- renderMode: S,
3050
- interactive: L,
3051
- loaderData: A,
3052
- segmentLoaderData: M,
3053
- pageLoaderRan: typeof x.loader == "function"
3054
- }), ee = [];
3055
- await v("collectCss", async () => {
3215
+ renderMode: C,
3216
+ interactive: R,
3217
+ loaderData: N,
3218
+ segmentLoaderData: ee,
3219
+ pageLoaderRan: typeof S.loader == "function"
3220
+ }), re = [];
3221
+ await y("collectCss", async () => {
3056
3222
  let t = /* @__PURE__ */ new Set(), n = [
3057
- O(e, "src", "pages", p.route.file),
3058
- ...C.flatMap((t) => [
3223
+ O(e, "src", "pages", m.route.file),
3224
+ ...w.flatMap((t) => [
3059
3225
  ...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
3060
3226
  ...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
3061
3227
  ...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
3062
3228
  ]),
3063
3229
  O(e, ".framework", "main.tsx")
3064
3230
  ];
3065
- for (let e of n) await y(e, t, ee);
3231
+ for (let e of n) await b(e, t, re);
3066
3232
  });
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();
3233
+ let H = await y("readShell", Oe), U = await y("transformShell", () => t.transformIndexHtml(u, H)), ie = re.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), W = z?.locale ?? L.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", ae = Date.now();
3068
3234
  if (B) {
3069
3235
  let e = (e) => Vn({
3070
- helpers: N,
3236
+ helpers: I,
3071
3237
  prepared: B,
3072
3238
  meta: e,
3073
- interactive: L,
3074
- extra: [U]
3239
+ interactive: R,
3240
+ extra: [ie]
3075
3241
  });
3076
3242
  if (B.hasDeferred) ar({
3077
3243
  res: c,
3078
3244
  shell: nr({
3079
- shell: H,
3245
+ shell: U,
3080
3246
  inlineModuleScriptsAsync: !0
3081
3247
  }),
3082
3248
  htmlLang: W,
@@ -3085,42 +3251,42 @@ import {
3085
3251
  "x-voltro-rendered-by": "spa-shell-dev"
3086
3252
  },
3087
3253
  headInjection: e,
3088
- render: (e) => N.renderPageToStream({
3254
+ render: (e) => I.renderPageToStream({
3089
3255
  ...B.renderInput,
3090
3256
  ...e
3091
3257
  }),
3092
3258
  onShellError: (e) => {
3093
- be(c, "spa-shell-dev", d, p.route.pattern, e, b);
3259
+ Se(c, "spa-shell-dev", d, m.route.pattern, e, x);
3094
3260
  }
3095
3261
  });
3096
3262
  else {
3097
3263
  let t = Bn({
3098
- helpers: N,
3264
+ helpers: I,
3099
3265
  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}"`);
3266
+ }), n = U.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}"`);
3101
3267
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
3102
3268
  }
3103
3269
  } else if (V) {
3104
3270
  let e = (e) => [
3105
- U,
3106
- N.renderMetaToHtml(e),
3107
- `<meta name="voltro-interactive" content="${L}" />`,
3108
- ...V.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
3109
- N.renderRouterStateScript(V.stateInput)
3271
+ ie,
3272
+ I.renderMetaToHtml(e),
3273
+ `<meta name="voltro-interactive" content="${R}" />`,
3274
+ ...V.hasDeferred ? [I.renderDeferredRegistryScript()] : [],
3275
+ I.renderRouterStateScript(V.stateInput)
3110
3276
  ].filter((e) => e.length > 0).join("\n "), t = {
3111
- descriptor: P,
3112
- params: p.params,
3277
+ descriptor: te,
3278
+ params: m.params,
3113
3279
  pathname: d,
3114
3280
  search: f,
3115
3281
  loaderData: V.loaderData,
3116
3282
  segmentLoaderData: V.segmentLoaderData,
3117
- requestContext: I,
3118
- ...z
3283
+ requestContext: L,
3284
+ ...ne
3119
3285
  };
3120
- if (S === "ssr" && L === "full") ar({
3286
+ if (C === "ssr" && R === "full") ar({
3121
3287
  res: c,
3122
3288
  shell: nr({
3123
- shell: H,
3289
+ shell: U,
3124
3290
  inlineModuleScriptsAsync: !0
3125
3291
  }),
3126
3292
  htmlLang: W,
@@ -3129,39 +3295,39 @@ import {
3129
3295
  "x-voltro-rendered-by": "ssr-dev"
3130
3296
  },
3131
3297
  headInjection: e,
3132
- render: (e) => N.renderPageToStream({
3298
+ render: (e) => I.renderPageToStream({
3133
3299
  ...t,
3134
3300
  ...e
3135
3301
  }),
3136
3302
  onShellError: (e) => {
3137
- be(c, "ssr-dev", d, p.route.pattern, e, b);
3303
+ Se(c, "ssr-dev", d, m.route.pattern, e, x);
3138
3304
  }
3139
3305
  });
3140
3306
  else {
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}"`);
3307
+ let { html: n, meta: r } = I.renderPageToHtml(t), i = U.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${W}"`);
3142
3308
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
3143
3309
  }
3144
3310
  }
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,
3311
+ v.render = Date.now() - ae;
3312
+ let G = Date.now() - g;
3313
+ h ? (xe.add(m.route.pattern), Q.info(`ssr compiled ${m.route.pattern} in ${G}ms`, {
3314
+ pattern: m.route.pattern,
3149
3315
  pathname: d,
3150
3316
  elapsedMs: G,
3151
3317
  cold: !0,
3152
- phases: g
3153
- })) : G > 200 && Z.info(`ssr rendered ${d} in ${G}ms`, {
3154
- pattern: p.route.pattern,
3318
+ phases: v
3319
+ })) : G > 200 && Q.info(`ssr rendered ${d} in ${G}ms`, {
3320
+ pattern: m.route.pattern,
3155
3321
  pathname: d,
3156
3322
  elapsedMs: G,
3157
3323
  cold: !1,
3158
- phases: g
3324
+ phases: v
3159
3325
  });
3160
3326
  } catch (e) {
3161
3327
  if (In(e)) {
3162
- Z.error("ssr-dev render refused", {
3328
+ Q.error("ssr-dev render refused", {
3163
3329
  pathname: d,
3164
- pattern: p.route.pattern
3330
+ pattern: m.route.pattern
3165
3331
  }, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
3166
3332
  return;
3167
3333
  }
@@ -3172,19 +3338,19 @@ import {
3172
3338
  c.end(t.body);
3173
3339
  return;
3174
3340
  }
3175
- be(c, "ssr-dev", d, p.route.pattern, e, b);
3341
+ Se(c, "ssr-dev", d, m.route.pattern, e, x);
3176
3342
  }
3177
3343
  });
3178
3344
  }
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 () => {
3345
+ }, je = Date.now(), Me = te.version ?? "?", Ne = await Pr(), Fe = O(e, "node_modules", "@voltro", "ui-shadcn"), Y = j(O(Fe, "package.json")) ? Fe : null, Ie = [], Le = await (async () => {
3180
3346
  let t = [];
3181
3347
  for (let n of a) {
3182
- let r = await Lr(e, n.pkg);
3348
+ let r = await ni(e, n.pkg);
3183
3349
  r && t.push(r);
3184
3350
  }
3185
3351
  let n = await pr(t);
3186
3352
  if (n === void 0) return !1;
3187
- let r = O(V, ".voltro-rpcgroup-optimize"), i = "";
3353
+ let r = O(z, ".voltro-rpcgroup-optimize"), i = "";
3188
3354
  try {
3189
3355
  i = (await M.readFile(r, "utf8")).trim();
3190
3356
  } catch {}
@@ -3193,15 +3359,20 @@ import {
3193
3359
  await M.writeFile(r, n);
3194
3360
  } catch {}
3195
3361
  return !0;
3196
- })();
3197
- Ie && Z.info("rpcGroup changed since last boot forcing a dep re-optimize so the browser loads the current api client");
3362
+ })(), Re = /* @__PURE__ */ new Set(), ze = (e) => {
3363
+ Re.has(e.name) || (Re.add(e.name), Q.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default a browser SDK cannot read it`, {
3364
+ cookie: e.name,
3365
+ hint: "If your IdP client reads this from `document.cookie` (Supabase's `createBrowserClient` does), pass `httpOnly: false`. Otherwise the SSR render succeeds and the user is signed out at the first client-side call. Set `httpOnly: true` explicitly to silence this."
3366
+ }));
3367
+ }, X = await Ar(e);
3368
+ X.length > 0 && Q.info(`middleware.ts loaded — ${X.length} middleware(s): ` + X.map((e) => e.exportName).join(", ")), Cr(X, F.ssrRoutes.map((e) => e.pattern)), Le && Q.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
3198
3369
  try {
3199
3370
  await Pe(l, "voltro dev (web)");
3200
3371
  } catch (e) {
3201
- Z.error(String(e.message ?? e)), process.exit(1);
3372
+ Q.error(String(e.message ?? e)), process.exit(1);
3202
3373
  }
3203
- await (await R.createServer({
3204
- root: V,
3374
+ await (await te.createServer({
3375
+ root: z,
3205
3376
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3206
3377
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
3207
3378
  resolve: {
@@ -3212,12 +3383,12 @@ import {
3212
3383
  "@voltro/i18n"
3213
3384
  ],
3214
3385
  alias: [
3215
- ...Me ? [{
3386
+ ...Ne ? [{
3216
3387
  find: "@voltro/devtools/styles.css",
3217
- replacement: O(Me, "src/styles.css")
3388
+ replacement: O(Ne, "src/styles.css")
3218
3389
  }, {
3219
3390
  find: "@voltro/devtools",
3220
- replacement: O(Me, "src/index.ts")
3391
+ replacement: O(Ne, "src/index.ts")
3221
3392
  }] : [],
3222
3393
  ...Y ? [
3223
3394
  {
@@ -3237,49 +3408,49 @@ import {
3237
3408
  replacement: O(Y, "src/index.ts")
3238
3409
  }
3239
3410
  ] : [],
3240
- ...nt(e)
3411
+ ...tt(e)
3241
3412
  ]
3242
3413
  },
3243
3414
  optimizeDeps: {
3244
- include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Fe],
3245
- force: Ie
3415
+ include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3416
+ force: Le
3246
3417
  },
3247
- customLogger: et(),
3418
+ customLogger: $e(),
3248
3419
  plugins: [
3249
3420
  bn(O(e, "src", "pages")),
3250
- z(),
3251
- B(),
3252
- U,
3253
- ie,
3254
- ue,
3255
- pe,
3256
- me,
3257
- _e,
3258
- Oe,
3259
- ...ve ? [ve] : []
3421
+ L(),
3422
+ R(),
3423
+ re,
3424
+ ae,
3425
+ fe,
3426
+ he,
3427
+ ge,
3428
+ ye,
3429
+ Ae,
3430
+ ...be ? [be] : []
3260
3431
  ],
3261
3432
  server: {
3262
3433
  port: l,
3263
3434
  strictPort: !0,
3264
3435
  host: !0,
3265
3436
  allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
3266
- proxy: J,
3267
- fs: { allow: [e, ...Sr(e)] }
3437
+ proxy: q,
3438
+ fs: { allow: [e, ...Br(e)] }
3268
3439
  },
3269
3440
  appType: "spa",
3270
- cacheDir: O(V, ".vite"),
3441
+ cacheDir: O(z, ".vite"),
3271
3442
  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}`, {
3443
+ })).listen(), Mr.info(`v${Me} ready in ${Date.now() - je}ms`, {
3444
+ version: Me,
3445
+ bootMs: Date.now() - je
3446
+ }), Q.info(`listening on http://localhost:${l}`, {
3276
3447
  port: l,
3277
3448
  app: n.name ?? "(unnamed)"
3278
3449
  });
3279
- for (let e of a) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3450
+ for (let e of a) e.proxyTarget && (Q.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
3280
3451
  api: e.name,
3281
3452
  target: e.proxyTarget
3282
- }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3453
+ }), Q.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3283
3454
  try {
3284
3455
  await x({
3285
3456
  id: b,
@@ -3293,7 +3464,7 @@ import {
3293
3464
  let t = wn(e);
3294
3465
  if (t) {
3295
3466
  let e = await Pn({ dashboardAppPath: t });
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 });
3467
+ e.status === "launched" ? Q.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Q.debug(`dashboard already running on :${e.port}`, { port: e.port });
3297
3468
  }
3298
3469
  setInterval(() => {
3299
3470
  x({
@@ -3311,32 +3482,32 @@ import {
3311
3482
  };
3312
3483
  process.on("SIGINT", n), process.on("SIGTERM", n);
3313
3484
  } catch (e) {
3314
- Z.warn("runtime-registry write failed", {}, e);
3485
+ Q.warn("runtime-registry write failed", {}, e);
3315
3486
  }
3316
- return ee({
3487
+ return ne({
3317
3488
  app: n.name ?? "unnamed",
3318
3489
  kind: "web",
3319
3490
  url: `http://localhost:${l}`,
3320
- bootMs: Date.now() - Ae
3491
+ bootMs: Date.now() - je
3321
3492
  }), new Promise(() => {});
3322
- }, $r = async (t) => {
3493
+ }, vi = async (t) => {
3323
3494
  e("serve");
3324
- let n = await Zr(t);
3495
+ let n = await gi(t);
3325
3496
  if (!n) return {
3326
3497
  ran: !1,
3327
3498
  exitCode: 0
3328
3499
  };
3329
- let i = Date.now(), a = Z.child("serve");
3500
+ let i = Date.now(), a = Q.child("serve");
3330
3501
  a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
3331
- let o = await Hr(t, n);
3502
+ let o = await si(t, n);
3332
3503
  for (let e of o) a.info("api wired", {
3333
3504
  name: e.name,
3334
3505
  pkg: e.pkg
3335
3506
  });
3336
- await Jr(t, n, o);
3507
+ await pi(t, n, o);
3337
3508
  {
3338
- let { pages: e } = await $(O(t, "src", "pages"));
3339
- await ht({
3509
+ let { pages: e } = await Jr(O(t, "src", "pages"));
3510
+ await mt({
3340
3511
  appRoot: t,
3341
3512
  pages: e
3342
3513
  });
@@ -3345,12 +3516,12 @@ import {
3345
3516
  kind: "web",
3346
3517
  configPort: n.port,
3347
3518
  env: process.env
3348
- }).port, c = await he("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
3349
- Z.info("running production build"), await c.build({
3519
+ }).port, c = await _e("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
3520
+ Q.info("running production build"), await c.build({
3350
3521
  root: u,
3351
3522
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3352
3523
  plugins: [l()],
3353
- customLogger: et(),
3524
+ customLogger: $e(),
3354
3525
  resolve: { dedupe: [
3355
3526
  "react",
3356
3527
  "react-dom",
@@ -3359,7 +3530,7 @@ import {
3359
3530
  ] },
3360
3531
  build: {
3361
3532
  outDir: "dist",
3362
- rollupOptions: { output: { manualChunks: wr } }
3533
+ rollupOptions: { output: { manualChunks: Hr } }
3363
3534
  },
3364
3535
  publicDir: O(t, "public")
3365
3536
  });
@@ -3372,7 +3543,7 @@ import {
3372
3543
  label: "Local",
3373
3544
  url: e
3374
3545
  })) ?? [];
3375
- return ee({
3546
+ return ne({
3376
3547
  app: n.name ?? "unnamed",
3377
3548
  kind: "preview",
3378
3549
  url: f,
@@ -3381,4 +3552,4 @@ import {
3381
3552
  }), new Promise(() => {});
3382
3553
  };
3383
3554
  //#endregion
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 };
3555
+ export { yt as $, rr as A, Cn as B, Ar as C, xr as D, jr as E, zn as F, Xt as G, wn as H, Bn as I, Ft as J, Jt as K, Vn as L, ar as M, In as N, Or as O, Rn as P, bt as Q, Hn as R, kr as S, wr as T, on as U, Pn as V, en as W, St as X, Ct as Y, wt as Z, vi as _, be as _t, Xr as a, He as at, pi as b, Kr as c, We as ct, gi as d, J as dt, mt as et, si as f, De as ft, _i as g, xe as gt, li as h, Ce as ht, fi as i, Be as it, nr as j, cr as k, $ as l, Pe as lt, ai as m, Ee as mt, di as n, nt, hi as o, Ve as ot, ii as p, Te as pt, Bt as q, oi as r, tt as rt, Yr as s, Ue as st, Ur as t, it as tt, qr as u, ke as ut, Hr as v, _e as vt, Sr as w, Cr as x, Jr as y, Tn as z };