@voltro/cli 0.40.0 → 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 (100) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/{apiBuild-C8xBEYbL.js → apiBuild-B_iH24qf.js} +2 -2
  3. package/dist/apiBuild-RM5W5YXk.js +2 -0
  4. package/dist/bin.js +1 -1
  5. package/dist/{build-CkhFGnKA.js → build-DUdi6F_Q.js} +150 -150
  6. package/dist/{checkCommand-QbHshOac.js → checkCommand-B2RWrpWi.js} +1 -1
  7. package/dist/{checkCommand-BcXJa2IS.js → checkCommand-DWL2_PPR.js} +2 -2
  8. package/dist/{codegenCommand-DF2OJh3O.js → codegenCommand-DkjoJ30Q.js} +2 -2
  9. package/dist/{codemodRunner-BcOvi4A2.js → codemodRunner-sFuWDETH.js} +520 -460
  10. package/dist/{commands-7Z7-HOE3.js → commands-D0VR1yBB.js} +22 -22
  11. package/dist/{dashboardCommand-CUycH6dR.js → dashboardCommand-Bro7Jwts.js} +5 -5
  12. package/dist/{dataCommand-By78lscK.js → dataCommand-OKC5FscP.js} +183 -172
  13. package/dist/{dbCommand-DSwGv9wS.js → dbCommand-BHRamDsy.js} +441 -414
  14. package/dist/dbCommand-C9iE1pd9.js +2 -0
  15. package/dist/{dev-Dh1NuYx1.js → dev-D4l_YOzI.js} +22 -22
  16. package/dist/{dev-D8JSKlBM.js → dev-DuqBJC7g.js} +1 -1
  17. package/dist/doctorCommand-Bw3V4L1j.js +2 -0
  18. package/dist/{doctorCommand-C-8-Z9D6.js → doctorCommand-TmZTAepc.js} +385 -279
  19. package/dist/{dormancyCommand-A79Odglm.js → dormancyCommand-CUKhRmGG.js} +1 -1
  20. package/dist/{embeddingsCommand-CoiyHfkY.js → embeddingsCommand-Db-iQM3l.js} +1 -1
  21. package/dist/{envCommand-B6d0s-jZ.js → envCommand-DQ_URZq9.js} +12 -12
  22. package/dist/{evolveCommand-BC5a9lxX.js → evolveCommand-CghRPrGO.js} +2 -2
  23. package/dist/index.js +1 -1
  24. package/dist/{infoCommand-ZqSVzJZ4.js → infoCommand-BCs_ZFnl.js} +1 -1
  25. package/dist/{migrate-BnPw2zC8.js → migrate-DLtPv2_D.js} +1 -1
  26. package/dist/{runtimeTrace-BslKJjDY.js → runtimeTrace-jFKvOPBz.js} +1 -1
  27. package/dist/{sdkgen-DQ8uEmmn.js → sdkgen-COQqHB9V.js} +1 -1
  28. package/dist/{serveCommand-Dqb9Ku1-.js → serveCommand-Cba_M2Su.js} +3 -3
  29. package/dist/serveCommand-DRbYK646.js +2 -0
  30. package/dist/serveEntry.js +1 -1
  31. package/dist/{start-dkNYKtgQ.js → start-BjcuFME_.js} +379 -343
  32. package/dist/{start-BA7txHhY.js → start-fifc0xpW.js} +1 -1
  33. package/dist/startEntry.js +1 -1
  34. package/dist/updateCommand-B2alql9k.js +2 -0
  35. package/dist/{updateCommand-eoGpZr3E.js → updateCommand-HZQVBU3T.js} +1 -1
  36. package/dist/webDev-D6QeXw3P.js +2 -0
  37. package/dist/{webDev-bybjZA0o.js → webDev-Dk8lFUzf.js} +642 -525
  38. package/dist/{webhooksCommand-DubZWNOx.js → webhooksCommand-D7ZpH7w0.js} +1 -1
  39. package/package.json +23 -17
  40. package/templates/AGENTS.md +1 -1
  41. package/templates/agent-docs/_index.md +1 -1
  42. package/templates/agent-docs/_manifest.json +1 -1
  43. package/templates/agent-docs/cli.md +6 -0
  44. package/templates/agent-docs/plugins/governance.md +8 -0
  45. package/templates/agent-docs/routing.md +141 -28
  46. package/templates/agent-docs/security.md +24 -0
  47. package/templates/agent-docs/whats-new.md +37 -121
  48. package/templates/apps/api-ai/package.json +7 -7
  49. package/templates/apps/api-auth/package.json +8 -8
  50. package/templates/apps/api-backend/package.json +7 -7
  51. package/templates/apps/api-backend-deactivation/package.json +7 -7
  52. package/templates/apps/api-backend-mail/package.json +8 -8
  53. package/templates/apps/api-backend-mariadb/package.json +9 -9
  54. package/templates/apps/api-backend-sqlite/package.json +8 -8
  55. package/templates/apps/api-backend-storage/package.json +8 -8
  56. package/templates/apps/api-cms/package.json +10 -10
  57. package/templates/apps/api-collab/package.json +8 -8
  58. package/templates/apps/api-data-advanced/package.json +8 -8
  59. package/templates/apps/api-durable/package.json +8 -8
  60. package/templates/apps/api-feature-flags/package.json +9 -9
  61. package/templates/apps/api-governance/package.json +8 -8
  62. package/templates/apps/api-kv/package.json +8 -8
  63. package/templates/apps/api-moderation/package.json +8 -8
  64. package/templates/apps/api-observability/package.json +8 -8
  65. package/templates/apps/api-ratelimit/package.json +8 -8
  66. package/templates/apps/api-rbac/package.json +8 -8
  67. package/templates/apps/api-rest/package.json +7 -7
  68. package/templates/apps/api-saas/package.json +11 -11
  69. package/templates/apps/api-saas-starter/package.json +10 -10
  70. package/templates/apps/api-search/package.json +8 -8
  71. package/templates/apps/api-status/package.json +8 -8
  72. package/templates/apps/api-versioning/package.json +8 -8
  73. package/templates/apps/api-webhooks/package.json +9 -9
  74. package/templates/apps/changelog/package.json +6 -6
  75. package/templates/apps/edge-functions/package.json +2 -2
  76. package/templates/apps/frontend-admin/package.json +8 -8
  77. package/templates/apps/frontend-app/package.json +9 -9
  78. package/templates/apps/frontend-auth/package.json +8 -8
  79. package/templates/apps/frontend-blank/package.json +7 -7
  80. package/templates/apps/frontend-cms/package.json +9 -9
  81. package/templates/apps/frontend-collab/package.json +10 -10
  82. package/templates/apps/frontend-contact/package.json +7 -7
  83. package/templates/apps/frontend-dashboard/package.json +7 -7
  84. package/templates/apps/frontend-docs/package.json +7 -7
  85. package/templates/apps/frontend-i18n/package.json +6 -6
  86. package/templates/apps/frontend-landing/package.json +7 -7
  87. package/templates/apps/frontend-portal/package.json +8 -8
  88. package/templates/apps/frontend-saas/package.json +8 -8
  89. package/templates/apps/frontend-spa/package.json +7 -7
  90. package/templates/apps/frontend-ssr/package.json +7 -7
  91. package/templates/apps/frontend-ssr-api/package.json +8 -8
  92. package/templates/apps/frontend-static-blog/package.json +6 -6
  93. package/templates/apps/frontend-status/package.json +8 -8
  94. package/templates/apps/mobile-app/package.json +4 -4
  95. package/dist/apiBuild-BIyGkym8.js +0 -2
  96. package/dist/dbCommand-DcqEyxju.js +0 -2
  97. package/dist/doctorCommand-FhQ7EVYL.js +0 -2
  98. package/dist/serveCommand-BmvEQCMS.js +0 -2
  99. package/dist/updateCommand-BauSVxPp.js +0 -2
  100. package/dist/webDev-CBbKs4dZ.js +0 -2
@@ -11,30 +11,30 @@ 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
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 L, pathToFileURL as R } from "node:url";
15
- import { addSink as te, createLogger as z, printReadyBlock as B } from "@voltro/logger";
16
- import { createRequire as V } from "node:module";
17
- import { homedir as ne } from "node:os";
18
- import { currentTraceContext as H, resolveSecret as U } from "@voltro/runtime";
19
- import { FRAMEWORK_ENV_CATALOG as W, appEnvEntries as re, checkEnvNaming as G, 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";
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: U
72
- }), r = [...n.errors, ...G(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 = re(e.contract), n = (e.plugins ?? []).flatMap((e) => oe(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : W, 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()
@@ -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 = z({ 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 = H();
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 = te((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 = H(), 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,7 +838,7 @@ __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";
@@ -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,
@@ -1166,7 +1166,7 @@ import {
1166
1166
  map: null
1167
1167
  };
1168
1168
  }
1169
- }), xn = z({ scope: "voltro:dashboard" }), Sn = V(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(ne(), ".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,8 +1534,58 @@ 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
- }, mr = (e) => {
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) => {
1539
1589
  let t = {};
1540
1590
  if (!e) return t;
1541
1591
  for (let n of e.split(";")) {
@@ -1549,52 +1599,81 @@ import {
1549
1599
  }
1550
1600
  }
1551
1601
  return t;
1552
- }, hr = (e) => {
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) => {
1553
1603
  let t = [`${e.name}=${encodeURIComponent(e.value)}`];
1554
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("; ");
1555
- }, gr = async (e, t = (e) => import(R(e).href)) => {
1556
- for (let n of ["middleware.ts", "middleware.tsx"]) try {
1557
- let r = (await t(O(e, n)))?.default;
1558
- if (typeof r == "function") return r;
1559
- if (r !== void 0) throw Error(`${n} must default-export a function; got ${typeof r}. It receives the request and returns \`{ headers?, setCookies? }\`.`);
1560
- } catch (e) {
1561
- let t = e?.code;
1562
- if (t === "ERR_MODULE_NOT_FOUND" || t === "MODULE_NOT_FOUND") continue;
1563
- throw e;
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;
1564
1631
  }
1565
- }, _r = async (e, t) => {
1566
- if (e === void 0) return {
1632
+ return [];
1633
+ }, jr = async (e, t, n) => {
1634
+ let r = {
1567
1635
  headers: t.headers,
1636
+ cookies: t.cookies,
1568
1637
  setCookies: []
1569
1638
  };
1570
- let n = await e(t);
1571
- return n ? {
1572
- headers: n.headers ? {
1573
- ...t.headers,
1574
- ...n.headers
1575
- } : t.headers,
1576
- setCookies: n.setCookies ?? []
1577
- } : {
1578
- headers: t.headers,
1579
- setCookies: []
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
1580
1659
  };
1581
- }, Z = z({ scope: "voltro:dev:web" }), vr = z({ scope: "vite" }), yr = await (async () => {
1660
+ }, Q = z({ scope: "voltro:dev:web" }), Mr = z({ scope: "vite" }), Nr = await (async () => {
1582
1661
  try {
1583
- let e = O(D(L(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");
1584
1663
  return JSON.parse(t).version ?? "0.0.0";
1585
1664
  } catch {
1586
1665
  return "0.0.0";
1587
1666
  }
1588
- })(), br = async () => {
1667
+ })(), Pr = async () => {
1589
1668
  try {
1590
- let e = D(L(import.meta.url)), t = A(e, "..", "..", "devtools");
1669
+ let e = D(te(import.meta.url)), t = A(e, "..", "..", "devtools");
1591
1670
  if (j(O(t, "package.json"))) return t;
1592
1671
  let n = A(e, "..", "..", "..", "devtools");
1593
1672
  return j(O(n, "package.json")) ? n : null;
1594
1673
  } catch {
1595
1674
  return null;
1596
1675
  }
1597
- }, xr = (e, t) => e.disableDevtools || !t ? [] : [
1676
+ }, Fr = (e, t) => e.disableDevtools || !t ? [] : [
1598
1677
  "",
1599
1678
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
1600
1679
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -1604,12 +1683,12 @@ import {
1604
1683
  " await import('@voltro/devtools/styles.css')",
1605
1684
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
1606
1685
  "}"
1607
- ], Sr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Cr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], wr = (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 ? [
1608
1687
  "",
1609
1688
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
1610
1689
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
1611
1690
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
1612
- ] : [], Tr = (e) => e.env ? ["import './env.public'"] : [], Er = (e) => {
1691
+ ] : [], zr = (e) => e.env ? ["import './env.public'"] : [], Br = (e) => {
1613
1692
  let t = [], n = A(e);
1614
1693
  for (;;) {
1615
1694
  j(O(n, "pnpm-workspace.yaml")) && t.push(n);
@@ -1618,14 +1697,14 @@ import {
1618
1697
  n = e;
1619
1698
  }
1620
1699
  return t;
1621
- }, Dr = b, Or = (e) => {
1700
+ }, Vr = b, Hr = (e) => {
1622
1701
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
1623
1702
  let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
1624
1703
  if (t) return `island-${t[1]}`;
1625
- }, kr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Ar = (e) => e.startsWith("(") && e.endsWith(")"), jr = (e) => e.filter((e) => !Ar(e)), Mr = (e) => {
1626
- let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Ar(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));
1627
1706
  return t.length === 0 ? "/" : "/" + t.join("/");
1628
- }, Nr = (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) => {
1629
1708
  let t = [], n = [], r = async (e, i) => {
1630
1709
  let a = [];
1631
1710
  try {
@@ -1633,17 +1712,17 @@ import {
1633
1712
  } catch {
1634
1713
  return;
1635
1714
  }
1636
- let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Dr(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("/");
1637
1716
  if (l.some((e) => s.has(e))) {
1638
1717
  let t = u.has("layout.tsx"), r = !1;
1639
1718
  if (t) try {
1640
1719
  let t = await M.readFile(O(e, "layout.tsx"), "utf8");
1641
- r = kr.test(t);
1720
+ r = Ur.test(t);
1642
1721
  } catch {}
1643
1722
  n.push({
1644
1723
  dir: d,
1645
1724
  chain: i,
1646
- contributesToUrl: i.length === 0 || !Ar(i[i.length - 1]),
1725
+ contributesToUrl: i.length === 0 || !Wr(i[i.length - 1]),
1647
1726
  hasLayout: t,
1648
1727
  hasLayoutLoader: r,
1649
1728
  hasError: u.has("error.tsx"),
@@ -1657,8 +1736,8 @@ import {
1657
1736
  let n = d ? `${d}/${e}` : e;
1658
1737
  t.push({
1659
1738
  file: n,
1660
- pattern: Mr(n),
1661
- ident: Nr(n),
1739
+ pattern: Kr(n),
1740
+ ident: qr(n),
1662
1741
  dirChain: i
1663
1742
  });
1664
1743
  }
@@ -1677,14 +1756,14 @@ import {
1677
1756
  dirs: a,
1678
1757
  orphanedSpecials: o
1679
1758
  };
1680
- }, Pr = (e, t) => {
1759
+ }, Yr = (e, t) => {
1681
1760
  let n = [];
1682
1761
  for (let r = 0; r <= t.length; r++) {
1683
1762
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
1684
1763
  a && n.push(a);
1685
1764
  }
1686
1765
  return n;
1687
- }, Fr = async (e) => {
1766
+ }, Xr = async (e) => {
1688
1767
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
1689
1768
  return {
1690
1769
  chain: await Promise.all(t.map(async (e, t) => {
@@ -1708,10 +1787,10 @@ import {
1708
1787
  })),
1709
1788
  segmentLoaderData: o
1710
1789
  };
1711
- }, Ir = (e) => {
1712
- let t = jr(e);
1790
+ }, Zr = (e) => {
1791
+ let t = Gr(e);
1713
1792
  return t.length === 0 ? "" : "/" + t.join("/");
1714
- }, Lr = [
1793
+ }, Qr = [
1715
1794
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
1716
1795
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
1717
1796
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -1804,7 +1883,7 @@ import {
1804
1883
  " _vdtErrorStart('Build error')",
1805
1884
  " })",
1806
1885
  "}"
1807
- ].join("\n"), Rr = (e) => {
1886
+ ].join("\n"), $r = (e) => {
1808
1887
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
1809
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, "\\$&"));
1810
1889
  let a = i.join("/");
@@ -1813,8 +1892,8 @@ import {
1813
1892
  paramNames: t,
1814
1893
  priority: n
1815
1894
  };
1816
- }, zr = (e) => e.map((e) => {
1817
- let { regex: t, paramNames: n, priority: r } = Rr(e.pattern);
1895
+ }, ei = (e) => e.map((e) => {
1896
+ let { regex: t, paramNames: n, priority: r } = $r(e.pattern);
1818
1897
  return {
1819
1898
  pattern: e.pattern,
1820
1899
  file: e.file,
@@ -1823,7 +1902,7 @@ import {
1823
1902
  paramNames: n,
1824
1903
  priority: r
1825
1904
  };
1826
- }).slice().sort((e, t) => e.priority - t.priority), Br = (e, t) => {
1905
+ }).slice().sort((e, t) => e.priority - t.priority), ti = (e, t) => {
1827
1906
  for (let n of t) {
1828
1907
  let t = n.regex.exec(e);
1829
1908
  if (!t) continue;
@@ -1835,9 +1914,9 @@ import {
1835
1914
  };
1836
1915
  }
1837
1916
  return null;
1838
- }, Vr = Ee, Hr = async (e) => {
1917
+ }, ni = J, ri = async (e) => {
1839
1918
  try {
1840
- let t = await import(R(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({
1841
1920
  kind: "api",
1842
1921
  configPort: typeof n == "number" ? n : void 0,
1843
1922
  env: {}
@@ -1851,7 +1930,7 @@ import {
1851
1930
  kind: "api",
1852
1931
  env: {}
1853
1932
  }).port };
1854
- }, Ur = (e, t) => ({
1933
+ }, ii = (e, t) => ({
1855
1934
  name: e,
1856
1935
  pkg: t.package,
1857
1936
  browserWsUrl: t.url,
@@ -1859,7 +1938,7 @@ import {
1859
1938
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
1860
1939
  ...t.headers ? { headers: t.headers } : {},
1861
1940
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1862
- }), Wr = (e, t, n) => {
1941
+ }), ai = (e, t, n) => {
1863
1942
  let r = t.transport?.wsPath ?? n.wsPath;
1864
1943
  return {
1865
1944
  name: e,
@@ -1871,7 +1950,7 @@ import {
1871
1950
  ...t.headers ? { headers: t.headers } : {},
1872
1951
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1873
1952
  };
1874
- }, Gr = (e) => {
1953
+ }, oi = (e) => {
1875
1954
  let t = /* @__PURE__ */ new Map();
1876
1955
  for (let n of e) {
1877
1956
  if (n.proxyTarget === void 0) continue;
@@ -1879,43 +1958,43 @@ import {
1879
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>.`);
1880
1959
  t.set(n.browserWsUrl, n.name);
1881
1960
  }
1882
- }, Kr = async (e, t) => {
1961
+ }, si = async (e, t) => {
1883
1962
  let n = Object.entries(t.apis ?? {}), r = [];
1884
1963
  for (let [t, i] of n) {
1885
1964
  if (i.url) {
1886
- r.push(Ur(t, i));
1965
+ r.push(ii(t, i));
1887
1966
  continue;
1888
1967
  }
1889
- let n = await Vr(e, i.package);
1968
+ let n = await ni(e, i.package);
1890
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.`);
1891
- r.push(Wr(t, i, await Hr(n)));
1970
+ r.push(ai(t, i, await ri(n)));
1892
1971
  }
1893
- return Gr(r), r;
1894
- }, qr = (e) => {
1972
+ return oi(r), r;
1973
+ }, ci = (e) => {
1895
1974
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
1896
1975
  let t = new URL(e);
1897
1976
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
1898
1977
  } catch {
1899
1978
  return;
1900
1979
  }
1901
- }, Jr = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, Yr = (e) => process.env[Jr(e)] ?? process.env.VOLTRO_API_ORIGIN, Xr = (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) => {
1902
1981
  if (!e) return;
1903
- let n = Yr(e.name) ?? e.serverOrigin;
1982
+ let n = ui(e.name) ?? e.serverOrigin;
1904
1983
  if (n) {
1905
- let e = qr(n);
1984
+ let e = ci(n);
1906
1985
  if (e) return e;
1907
1986
  }
1908
1987
  if (t?.allowDevProxy && e.proxyTarget) {
1909
- let t = qr(e.proxyTarget);
1988
+ let t = ci(e.proxyTarget);
1910
1989
  if (t) return t;
1911
1990
  }
1912
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return qr(e.browserWsUrl);
1913
- }, Zr = (e, t, n) => {
1991
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ci(e.browserWsUrl);
1992
+ }, fi = (e, t, n) => {
1914
1993
  if (!e) {
1915
1994
  if (n?.apiName === void 0) return;
1916
1995
  let e = n.apiName;
1917
1996
  return async () => {
1918
- 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 ${Jr(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.`);
1919
1998
  };
1920
1999
  }
1921
2000
  return async (r, i) => {
@@ -1938,7 +2017,7 @@ import {
1938
2017
  });
1939
2018
  } catch (t) {
1940
2019
  let i = t?.cause?.code ?? String(t?.message ?? t);
1941
- throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Jr(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 });
1942
2021
  }
1943
2022
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
1944
2023
  let s = await o.json();
@@ -1968,8 +2047,8 @@ import {
1968
2047
  }
1969
2048
  if (u) return l;
1970
2049
  };
1971
- }, Qr = async (e, t, n, r = {}) => {
1972
- 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 br() !== 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" ? [
1973
2052
  " <script>",
1974
2053
  " (function () {",
1975
2054
  " var root = document.documentElement",
@@ -2007,9 +2086,9 @@ import {
2007
2086
  " </body>",
2008
2087
  "</html>",
2009
2088
  ""
2010
- ].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);
2011
2090
  await y(l, u);
2012
- 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.`);
2013
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'`);
2014
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"));
2015
2094
  let g = n.map((e) => {
@@ -2020,16 +2099,16 @@ import {
2020
2099
  let n = u.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
2021
2100
  for (let e of d) {
2022
2101
  let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
2023
- 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'`);
2024
2103
  }
2025
2104
  let i = u.map((e) => {
2026
- let t = Pr(d, e.dirChain).map((e) => {
2105
+ let t = Yr(d, e.dirChain).map((e) => {
2027
2106
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2028
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(", ")} }`;
2029
2108
  }).join(",\n");
2030
2109
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
2031
2110
  }), a = d.filter((e) => e.hasNotFound).map((e) => {
2032
- let t = Ir(e.chain), n = Pr(d, e.chain).map((e) => {
2111
+ let t = Zr(e.chain), n = Yr(d, e.chain).map((e) => {
2033
2112
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2034
2113
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
2035
2114
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
@@ -2037,23 +2116,23 @@ import {
2037
2116
  }), s = [], c = [], l = [], f = [], p = [], m = [];
2038
2117
  for (let e of d) {
2039
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);
2040
- 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({
2041
2120
  relPath: t,
2042
2121
  kind: "layout",
2043
2122
  slotKey: e.dir
2044
- })) : e.hasLayout && (c.push(` ${a}: ${Q(e.dir, "Layout")},`), s.push({
2123
+ })) : e.hasLayout && (c.push(` ${a}: ${$(e.dir, "Layout")},`), s.push({
2045
2124
  relPath: t,
2046
2125
  kind: "layout",
2047
2126
  slotKey: e.dir
2048
- })), e.hasError && (f.push(` ${a}: ${Q(e.dir, "Error")},`), s.push({
2127
+ })), e.hasError && (f.push(` ${a}: ${$(e.dir, "Error")},`), s.push({
2049
2128
  relPath: n,
2050
2129
  kind: "error",
2051
2130
  slotKey: e.dir
2052
- })), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
2131
+ })), e.hasPending && (p.push(` ${a}: ${$(e.dir, "Pending")},`), s.push({
2053
2132
  relPath: r,
2054
2133
  kind: "pending",
2055
2134
  slotKey: e.dir
2056
- })), e.hasNotFound && (m.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
2135
+ })), e.hasNotFound && (m.push(` ${a}: ${$(e.dir, "NotFound")},`), s.push({
2057
2136
  relPath: i,
2058
2137
  kind: "notFound",
2059
2138
  slotKey: e.dir
@@ -2068,7 +2147,7 @@ import {
2068
2147
  let n = JSON.stringify(e.slotKey);
2069
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 }`;
2070
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";
2071
- 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(", ")}]`);
2072
2151
  let E = w ? [
2073
2152
  "import { I18nProvider } from '@voltro/i18n'",
2074
2153
  "import { resolveLocale } from '@voltro/i18n/server'",
@@ -2285,14 +2364,14 @@ import {
2285
2364
  "// resolved apis map. Side-effect only — no local component definitions —",
2286
2365
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2287
2366
  "",
2288
- ...Tr(t),
2367
+ ...zr(t),
2289
2368
  "import { mount } from '@voltro/web'",
2290
2369
  ...h,
2291
2370
  "import { App } from './app'",
2292
2371
  "import { preloadCurrentRoute } from './routeTable'",
2293
- ...Cr(t),
2294
- ...xr(t, o),
2295
- ...wr(t),
2372
+ ...Lr(t),
2373
+ ...Fr(t, o),
2374
+ ...Rr(t),
2296
2375
  "",
2297
2376
  "// Preload the current route's page chunk BEFORE hydration so the first",
2298
2377
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2309,10 +2388,10 @@ import {
2309
2388
  " apis: {",
2310
2389
  ...g,
2311
2390
  " },",
2312
- ...Sr(t, o),
2391
+ ...Ir(t, o),
2313
2392
  "})",
2314
2393
  "",
2315
- Lr
2394
+ Qr
2316
2395
  ].join("\n");
2317
2396
  } else _ = "", v = "", b = [
2318
2397
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2320,25 +2399,25 @@ import {
2320
2399
  "// and calls mount(). Side-effect only, no component definitions, so the",
2321
2400
  "// user's component file remains the Fast Refresh boundary.",
2322
2401
  "",
2323
- ...Tr(t),
2402
+ ...zr(t),
2324
2403
  "import { mount } from '@voltro/web'",
2325
2404
  ...h,
2326
2405
  "import App from '../src/App'",
2327
- ...Cr(t),
2328
- ...xr(t, o),
2329
- ...wr(t),
2406
+ ...Lr(t),
2407
+ ...Fr(t, o),
2408
+ ...Rr(t),
2330
2409
  "",
2331
2410
  "mount(App, {",
2332
2411
  " apis: {",
2333
2412
  ...g,
2334
2413
  " },",
2335
- ...Sr(t, o),
2414
+ ...Ir(t, o),
2336
2415
  "})",
2337
2416
  "",
2338
- Lr
2417
+ Qr
2339
2418
  ].join("\n");
2340
2419
  let x = O(e, ".framework");
2341
- 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 }));
2342
2421
  let S = O(e, ".gitignore"), C = "";
2343
2422
  try {
2344
2423
  C = await M.readFile(S, "utf8");
@@ -2349,41 +2428,41 @@ import {
2349
2428
  try {
2350
2429
  await M.appendFile(S, `${e}${E.join("\n")}\n`, "utf8");
2351
2430
  } catch (e) {
2352
- 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) });
2353
2432
  }
2354
2433
  }
2355
- }, $r = async (e, t) => {
2434
+ }, mi = async (e, t) => {
2356
2435
  try {
2357
2436
  let n = D(e), r = O(n, "project.json");
2358
2437
  if (!j(r)) return;
2359
2438
  let i = await M.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
2360
2439
  for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
2361
2440
  if (s.length === 0) return;
2362
- 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", {
2363
2442
  port: t,
2364
2443
  conflicts: s,
2365
2444
  projectJson: r
2366
2445
  });
2367
2446
  } catch {}
2368
- }, ei = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), ti = async (e, t = {}) => {
2369
- let n = ei(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");
2370
2449
  try {
2371
- let e = (await import(R(r).href)).default;
2450
+ let e = (await import(L(r).href)).default;
2372
2451
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2373
2452
  } catch {
2374
2453
  return null;
2375
2454
  }
2376
- }, ni = async (e) => {
2377
- let n = await ti(e, { preferSource: !0 });
2455
+ }, _i = async (e) => {
2456
+ let n = await gi(e, { preferSource: !0 });
2378
2457
  if (!n) return {
2379
2458
  ran: !1,
2380
2459
  exitCode: 0
2381
2460
  };
2382
2461
  ln();
2383
- let i = Ct();
2384
- Vt(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), Ge(e, Z);
2385
- let a = await Kr(e, n);
2386
- 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", {
2387
2466
  name: e.name,
2388
2467
  pkg: e.pkg,
2389
2468
  ...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
@@ -2391,17 +2470,17 @@ import {
2391
2470
  g(e).then((e) => {
2392
2471
  for (let t of e.files) if (t.action === "created") {
2393
2472
  let e = t.path.split("/").pop() ?? t.path;
2394
- Z.info(`${e} seeded`, { path: t.path });
2473
+ Q.info(`${e} seeded`, { path: t.path });
2395
2474
  }
2396
2475
  }).catch(() => {});
2397
- let { resolved: o } = await Se({
2476
+ let { resolved: o } = await Ce({
2398
2477
  rawEnv: n.env,
2399
2478
  appType: "web",
2400
2479
  root: e,
2401
- log: Z,
2480
+ log: Q,
2402
2481
  generateTypes: !0
2403
2482
  }), s = o.publicValues;
2404
- await Qr(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: [
2405
2484
  "index.html",
2406
2485
  ".framework/main.tsx",
2407
2486
  ...n.env ? [".framework/env.public.ts"] : []
@@ -2412,7 +2491,7 @@ import {
2412
2491
  env: process.env,
2413
2492
  dashboardPin: process.env[Tn] === "1"
2414
2493
  });
2415
- for (let e of c.warnings) Z.warn(e);
2494
+ for (let e of c.warnings) Q.warn(e);
2416
2495
  let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
2417
2496
  await x({
2418
2497
  id: b,
@@ -2422,22 +2501,22 @@ import {
2422
2501
  pid: process.pid,
2423
2502
  status: "booting",
2424
2503
  logFile: D.path
2425
- }).catch(() => {}), await $r(e, l);
2426
- 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 = {
2427
2506
  dirs: P,
2428
- ssrRoutes: zr(N)
2507
+ ssrRoutes: ei(N)
2429
2508
  }, ee = P.map((e) => ({
2430
2509
  dir: e.dir,
2431
2510
  hasLayout: e.hasLayout,
2432
2511
  hasError: e.hasError,
2433
2512
  hasPending: e.hasPending,
2434
2513
  hasNotFound: e.hasNotFound
2435
- })), I = await ht({
2514
+ })), I = await mt({
2436
2515
  appRoot: e,
2437
2516
  pages: N
2438
2517
  });
2439
- I.wrote && Z.debug("routes codegen wrote", { path: k(e, I.path) });
2440
- let L = await he("vite", () => import("vite")), R = (await import("@vitejs/plugin-react")).default, te = (await import("@tailwindcss/vite")).default, z = O(e, ".framework"), V = O(e, "src"), ne = /* @__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([
2441
2520
  ".framework",
2442
2521
  "node_modules",
2443
2522
  "dist",
@@ -2445,156 +2524,166 @@ import {
2445
2524
  ".vite",
2446
2525
  ".turbo",
2447
2526
  ".cache"
2448
- ]), H = {
2527
+ ]), re = {
2449
2528
  name: "framework:watch-app-sources",
2450
2529
  async configureServer(t) {
2451
2530
  try {
2452
- let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !ne.has(e.name));
2531
+ let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !V.has(e.name));
2453
2532
  for (let r of n) t.watcher.add(O(e, r.name));
2454
- n.length === 0 && t.watcher.add(V);
2533
+ n.length === 0 && t.watcher.add(B);
2455
2534
  } catch {
2456
- t.watcher.add(V);
2535
+ t.watcher.add(B);
2457
2536
  }
2458
2537
  for (let n of await De(e)) t.watcher.add(n.dir);
2459
2538
  }
2460
- }, U = O(e, "src", "pages"), W = (e) => e.endsWith(".tsx") && (e === U || e.startsWith(U + "/")), re = (e) => e === U || e.startsWith(U + "/"), G = 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) => {
2461
2540
  try {
2462
2541
  let r = Date.now();
2463
- await Qr(e, n, a, s);
2464
- let { pages: i, dirs: o } = await $(U);
2465
- await ht({
2542
+ await pi(e, n, a, s);
2543
+ let { pages: i, dirs: o } = await Jr(H);
2544
+ await mt({
2466
2545
  appRoot: e,
2467
2546
  pages: i
2468
- }), F.dirs = o, F.ssrRoutes = zr(i), Z.info("page tree regenerated", {
2547
+ }), F.dirs = o, F.ssrRoutes = ei(i), Q.info("page tree regenerated", {
2469
2548
  reason: t,
2470
2549
  ms: Date.now() - r,
2471
2550
  routes: F.ssrRoutes.length
2472
2551
  });
2552
+ for (let e of Sr(X, F.ssrRoutes.map((e) => e.pattern))) Q.error(`middleware.ts: ${e.message}`);
2473
2553
  } catch (e) {
2474
- Z.error("page tree regen failed", { reason: t }, e);
2554
+ Q.error("page tree regen failed", { reason: t }, e);
2475
2555
  }
2476
- }, ie = {
2556
+ }, ae = {
2477
2557
  name: "framework:regenerate-on-page-tree-change",
2478
2558
  configureServer(t) {
2479
2559
  let n = null, r = [], i = (e) => {
2480
2560
  r.push(e), n && clearTimeout(n), n = setTimeout(() => {
2481
2561
  n = null;
2482
2562
  let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
2483
- r.length = 0, G(e);
2563
+ r.length = 0, W(e);
2484
2564
  }, 50);
2485
2565
  };
2486
2566
  t.watcher.on("add", (t) => {
2487
- W(t) && i(`add ${k(e, t)}`);
2567
+ U(t) && i(`add ${k(e, t)}`);
2488
2568
  }), t.watcher.on("unlink", (t) => {
2489
- W(t) && i(`unlink ${k(e, t)}`);
2569
+ U(t) && i(`unlink ${k(e, t)}`);
2490
2570
  }), t.watcher.on("addDir", (t) => {
2491
- re(t) && i(`addDir ${k(e, t)}`);
2571
+ ie(t) && i(`addDir ${k(e, t)}`);
2492
2572
  }), t.watcher.on("unlinkDir", (t) => {
2493
- re(t) && i(`unlinkDir ${k(e, t)}`);
2573
+ ie(t) && i(`unlinkDir ${k(e, t)}`);
2494
2574
  });
2495
2575
  }
2496
- }, K = O(e, "app.config.ts"), oe = (e) => {
2497
- if (!ae(e.env)) return "";
2576
+ }, G = O(e, "app.config.ts"), se = (e) => {
2577
+ if (!oe(e.env)) return "";
2498
2578
  let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
2499
2579
  return `${String(e.env.publicPrefix)}|${t.join(",")}`;
2500
- }, se = (e, t) => {
2580
+ }, ce = (e, t) => {
2501
2581
  let n = [];
2502
- 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;
2503
- }, 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 = {
2504
2597
  name: "framework:watch-app-config",
2505
2598
  async configureServer(n) {
2506
- n.watcher.add(K), Z.info("watching app.config.ts for changes", { path: k(e, K) });
2507
- 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 () => {
2508
2608
  try {
2509
2609
  try {
2510
- let e = n.moduleGraph.getModuleById(K);
2610
+ let e = n.moduleGraph.getModuleById(G);
2511
2611
  e && n.moduleGraph.invalidateModule(e);
2512
2612
  } catch {}
2513
- let e = (await n.ssrLoadModule(K, { fixStacktrace: !0 })).default;
2514
- 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);
2515
2615
  } catch (e) {
2516
- 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;
2517
2617
  }
2518
- }, i = null, a = () => {
2519
- i && clearTimeout(i), i = setTimeout(() => {
2520
- i = null, o();
2618
+ }, o = null, s = () => {
2619
+ o && clearTimeout(o), o = setTimeout(() => {
2620
+ o = null, c();
2521
2621
  }, 100);
2522
- }, o = async () => {
2523
- let t = await r();
2622
+ }, c = async () => {
2623
+ let t = await a();
2524
2624
  if (!t) {
2525
- Z.info("app.config.ts onConfigChange: load returned null — skipping");
2625
+ Q.info("app.config.ts onConfigChange: load returned null — skipping");
2526
2626
  return;
2527
2627
  }
2528
- if (Z.info("app.config.ts onConfigChange: loaded", {
2628
+ if (Q.info("app.config.ts onConfigChange: loaded", {
2529
2629
  theme: t.theme,
2530
2630
  port: t.port,
2531
2631
  name: t.name
2532
- }), JSON.stringify(t) === JSON.stringify(ce)) {
2533
- 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?)");
2534
2634
  return;
2535
2635
  }
2536
- let i = se(ce, t);
2537
- if (i.length > 0) {
2538
- 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 });
2539
2639
  try {
2540
2640
  await n.close();
2541
2641
  } catch {}
2542
- let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
2543
- stdio: "inherit",
2544
- env: process.env,
2545
- cwd: process.cwd()
2546
- }), t = (t) => {
2547
- e.kill(t);
2548
- }, r = () => t("SIGINT"), a = () => t("SIGTERM");
2549
- process.on("SIGINT", r), process.on("SIGTERM", a), e.on("exit", (e, t) => {
2550
- process.off("SIGINT", r), process.off("SIGTERM", a), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
2551
- }), e.on("error", (e) => {
2552
- Z.error("restart spawn failed", {}, e), process.exit(1);
2553
- });
2642
+ de();
2554
2643
  return;
2555
2644
  }
2556
2645
  try {
2557
2646
  let r = Date.now();
2558
- await Qr(e, t, await Kr(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({
2559
2648
  type: "full-reload",
2560
2649
  path: "*"
2561
- }), Z.info("app.config.ts soft-regen", {
2650
+ }), Q.info("app.config.ts soft-regen", {
2562
2651
  ms: Date.now() - r,
2563
2652
  reload: "full"
2564
2653
  });
2565
2654
  } catch (e) {
2566
- Z.error("app.config.ts soft-regen failed", {}, e);
2655
+ Q.error("app.config.ts soft-regen failed", {}, e);
2567
2656
  }
2568
- }, 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;
2569
2658
  n.watcher.on("change", (e) => {
2570
- 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());
2571
2660
  }), n.watcher.on("add", (e) => {
2572
- 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());
2573
2662
  });
2574
2663
  try {
2575
2664
  let { watchFile: e } = await import("node:fs");
2576
- e(K, { interval: 500 }, (e, t) => {
2577
- e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
2578
- }), 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 });
2579
2668
  } catch (e) {
2580
- Z.warn("app.config.ts polling watcher could not attach", {}, e);
2669
+ Q.warn("app.config.ts polling watcher could not attach", {}, e);
2581
2670
  }
2582
- ke(t, Z, {
2671
+ ke(t, Q, {
2583
2672
  root: e,
2584
2673
  onBeforeRestart: () => n.close()
2585
2674
  });
2586
2675
  }
2587
- }, de = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, pe = {
2676
+ }, pe = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, K = 0, he = {
2588
2677
  name: "framework:suppress-api-hmr",
2589
2678
  handleHotUpdate(e) {
2590
- if (q += 1, de.test(e.file)) return [];
2679
+ if (K += 1, pe.test(e.file)) return [];
2591
2680
  }
2592
- }, me = {
2681
+ }, ge = {
2593
2682
  name: "framework:reoptimize-on-rpcgroup-change",
2594
2683
  async configureServer(t) {
2595
2684
  let n = [];
2596
2685
  for (let r of a) {
2597
- let i = await Vr(e, r.pkg);
2686
+ let i = await ni(e, r.pkg);
2598
2687
  if (i) {
2599
2688
  n.push(i);
2600
2689
  try {
@@ -2610,14 +2699,14 @@ import {
2610
2699
  if (o) return;
2611
2700
  let e = await pr(n);
2612
2701
  if (e !== void 0 && e !== r) {
2613
- 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)");
2614
2703
  try {
2615
2704
  await M.rm(O(z, ".vite", "deps"), {
2616
2705
  recursive: !0,
2617
2706
  force: !0
2618
2707
  }), await t.restart(!0);
2619
2708
  } catch (e) {
2620
- o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
2709
+ o = !1, Q.error("rpcGroup re-optimize failed", {}, e);
2621
2710
  }
2622
2711
  }
2623
2712
  }, c = (e) => {
@@ -2628,7 +2717,7 @@ import {
2628
2717
  };
2629
2718
  t.watcher.on("change", c), t.watcher.on("add", c);
2630
2719
  }
2631
- }, J = {}, ge = (e) => (t) => {
2720
+ }, q = {}, ve = (e) => (t) => {
2632
2721
  t.on("proxyReq", (t, n) => {
2633
2722
  sn(t, n, {
2634
2723
  target: e,
@@ -2640,36 +2729,36 @@ import {
2640
2729
  };
2641
2730
  for (let e of a) {
2642
2731
  if (!e.proxyTarget) continue;
2643
- J[e.browserWsUrl] = {
2732
+ q[e.browserWsUrl] = {
2644
2733
  target: e.proxyTarget,
2645
2734
  ws: !0,
2646
2735
  changeOrigin: !0,
2647
2736
  ...e.wsPath ? {} : { rewrite: () => "/ws" }
2648
2737
  };
2649
2738
  let t = e.proxyTarget.replace(/^ws/, "http");
2650
- J[`/_voltro/api/${e.name}`] = {
2739
+ q[`/_voltro/api/${e.name}`] = {
2651
2740
  target: t,
2652
2741
  changeOrigin: !0,
2653
2742
  rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
2654
- configure: ge(t)
2743
+ configure: ve(t)
2655
2744
  };
2656
2745
  }
2657
2746
  for (let [e, t] of Object.entries(n.proxies ?? {})) {
2658
- if (J[e]) {
2659
- 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 });
2660
2749
  continue;
2661
2750
  }
2662
- J[e] = {
2751
+ q[e] = {
2663
2752
  target: t.target,
2664
2753
  changeOrigin: t.changeOrigin ?? !0,
2665
2754
  ...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
2666
- }, Z.info(`proxy ${e} → ${t.target}`, {
2755
+ }, Q.info(`proxy ${e} → ${t.target}`, {
2667
2756
  prefix: e,
2668
2757
  target: t.target,
2669
2758
  ...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
2670
2759
  });
2671
2760
  }
2672
- let _e = {
2761
+ let ye = {
2673
2762
  name: "framework:inspect",
2674
2763
  configureServer(t) {
2675
2764
  let r = null, a = async () => {
@@ -2692,7 +2781,7 @@ import {
2692
2781
  hasGetStaticPaths: typeof i.getStaticPaths == "function"
2693
2782
  });
2694
2783
  } catch (e) {
2695
- 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);
2696
2785
  }
2697
2786
  return r = n, n;
2698
2787
  };
@@ -2714,7 +2803,7 @@ import {
2714
2803
  if (t.method !== "GET" && t.method !== "HEAD") return r();
2715
2804
  let { pathname: i } = Hn(t.url ?? "/");
2716
2805
  if (i !== "/robots.txt" || j(O(e, "public", "robots.txt"))) return r();
2717
- 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 }));
2718
2807
  }), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
2719
2808
  let r = e.url ?? "", i = r.split("?")[0];
2720
2809
  if (i === "/api/dashboard/proxy") {
@@ -2805,7 +2894,7 @@ import {
2805
2894
  for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
2806
2895
  let c = o.split("?")[0];
2807
2896
  if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
2808
- let e = d(s.origin), n = en(o, It(), s);
2897
+ let e = d(s.origin), n = en(o, Ft(), s);
2809
2898
  t.statusCode = n.status, t.setHeader("content-type", n.contentType);
2810
2899
  for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
2811
2900
  t.end(n.body);
@@ -2854,14 +2943,14 @@ import {
2854
2943
  for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
2855
2944
  t.flushHeaders?.(), t.write("retry: 5000\n\n");
2856
2945
  let a = o.indexOf("?");
2857
- 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));
2858
2947
  let c = i.subscribe((e) => {
2859
2948
  try {
2860
- t.write(wt(e));
2949
+ t.write(Ct(e));
2861
2950
  } catch {}
2862
2951
  }), l = setInterval(() => {
2863
2952
  try {
2864
- t.write(Tt());
2953
+ t.write(wt());
2865
2954
  } catch {}
2866
2955
  }, 15e3), p = () => {
2867
2956
  clearInterval(l), c();
@@ -2874,7 +2963,7 @@ import {
2874
2963
  kind: "web",
2875
2964
  meta: {
2876
2965
  name: n.name ?? "(unnamed)",
2877
- voltroVersion: yr,
2966
+ voltroVersion: Nr,
2878
2967
  port: l,
2879
2968
  mode: "dev",
2880
2969
  apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
@@ -2892,7 +2981,7 @@ import {
2892
2981
  size: 0,
2893
2982
  entries: []
2894
2983
  }),
2895
- 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 })
2896
2985
  }, c = p(o, i, s, { method: e.method ?? "GET" });
2897
2986
  if (c === null) return r();
2898
2987
  t.statusCode = c.status, t.setHeader("content-type", c.contentType);
@@ -2903,7 +2992,7 @@ import {
2903
2992
  }
2904
2993
  });
2905
2994
  }
2906
- }, ve = n.name === "voltroDashboard" ? {
2995
+ }, be = n.name === "voltroDashboard" ? {
2907
2996
  name: "framework:dashboard-registry",
2908
2997
  configureServer(e) {
2909
2998
  e.middlewares.use(async (e, t, n) => {
@@ -2916,12 +3005,12 @@ import {
2916
3005
  }
2917
3006
  });
2918
3007
  }
2919
- } : 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) => {
2920
3009
  let o = Yn(i, a, t) ?? "";
2921
- if (Z.error(`${t} render failed`, {
3010
+ if (Q.error(`${t} render failed`, {
2922
3011
  pathname: n,
2923
3012
  pattern: r,
2924
- cause: Dt(i) + o
3013
+ cause: Et(i) + o
2925
3014
  }), e.headersSent) {
2926
3015
  e.end();
2927
3016
  return;
@@ -2929,24 +3018,24 @@ import {
2929
3018
  e.writeHead(500, {
2930
3019
  "content-type": "text/plain; charset=utf-8",
2931
3020
  "x-voltro-rendered-by": `${t}-failed`,
2932
- "x-voltro-ssr-generation": String(q)
3021
+ "x-voltro-ssr-generation": String(K)
2933
3022
  });
2934
- 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`;
2935
- e.end(`${t} render failed for ${n}\n\n${Dt(i)}\n${o}\n${s}`);
2936
- }, xe = rt(), Ce = at({
2937
- limit: xe,
2938
- onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
2939
- 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`, {
2940
3029
  id: e,
2941
3030
  ms: t,
2942
3031
  ...n ? { failed: !0 } : {}
2943
3032
  })
2944
3033
  });
2945
- Z.debug(`ssr cold-compile concurrency ${xe}`, { concurrency: xe });
2946
- 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 = {
2947
3036
  name: "framework:ssr",
2948
3037
  configureServer(t) {
2949
- 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 = () => {
2950
3039
  if (i !== void 0) return i;
2951
3040
  let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
2952
3041
  return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
@@ -2955,7 +3044,7 @@ import {
2955
3044
  let t = (await r(O(e, "src", "locales", `${i}.ts`))).default;
2956
3045
  t !== void 0 && (s[i] = n(i, t, a));
2957
3046
  } catch (e) {
2958
- 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);
2959
3048
  }
2960
3049
  if (o = Object.keys(s).length > 0, Object.keys(s).length === 0) {
2961
3050
  let { resolveLocale: e } = await r("@voltro/i18n/server");
@@ -2981,18 +3070,37 @@ import {
2981
3070
  let u = i.url ?? "/";
2982
3071
  u.indexOf("?");
2983
3072
  let { pathname: d, search: f } = Hn(u);
2984
- 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();
2985
- let p = Br(d, F.ssrRoutes);
2986
- if (!p) return l();
2987
- let m = !ye.has(p.route.pattern), h = Date.now();
2988
- m && Z.info(`ssr compiling ${p.route.pattern}`, {
2989
- 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,
2990
3098
  pathname: d
2991
3099
  });
2992
- let g = {}, v = async (e, t) => {
3100
+ let v = {}, y = async (e, t) => {
2993
3101
  let n = Date.now(), r = await t();
2994
- return g[e] = (g[e] ?? 0) + (Date.now() - n), r;
2995
- }, y = async (e, n, r) => {
3102
+ return v[e] = (v[e] ?? 0) + (Date.now() - n), r;
3103
+ }, b = async (e, n, r) => {
2996
3104
  let i = await t.moduleGraph.getModuleById(e);
2997
3105
  if (!(!i || n.has(e))) {
2998
3106
  if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
@@ -3000,137 +3108,141 @@ import {
3000
3108
  r.includes(e) || r.push(e);
3001
3109
  return;
3002
3110
  }
3003
- 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);
3004
3112
  }
3005
- }, b = !1;
3113
+ }, x = !1;
3006
3114
  try {
3007
- let x = await v("loadPage", async () => await r(O(e, "src", "pages", p.route.file))), S = _(x, O("src", "pages", p.route.file)), C = Pr(F.dirs, p.route.dirChain), w = S === "spa" && C.some((e) => e.hasLayout);
3008
- if (S !== "ssr" && S !== "isr" && !w) return l();
3009
- let T = {};
3010
- for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? T[e] = t : Array.isArray(t) && (T[e] = t.join(", "));
3011
- let E = await _r(Le, {
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
+ }), {
3012
3123
  pathname: d,
3013
3124
  search: f,
3014
- headers: T,
3015
- cookies: mr(T.cookie)
3016
- });
3017
- for (let e of E.setCookies) c.appendHeader?.("set-cookie", hr(e));
3018
- let D = Zr(Xr(a[0], { allowDevProxy: !0 }), E.headers.cookie, {
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, {
3019
3131
  apiName: a[0]?.name,
3020
- headers: E.headers
3021
- }), k = new AbortController(), A = () => k.abort();
3022
- c.once("close", A);
3023
- let j = null, M = [], N = {};
3132
+ headers: D.headers
3133
+ }), j = new AbortController(), M = () => j.abort();
3134
+ c.once("close", M);
3135
+ let N = null, P = [], ee = {};
3024
3136
  try {
3025
- (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: M, segmentLoaderData: N} = await v("loadChain", () => Fr({
3026
- entries: C,
3137
+ (await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: P, segmentLoaderData: ee} = await y("loadChain", () => Xr({
3138
+ entries: w,
3027
3139
  loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
3028
3140
  loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
3029
3141
  loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
3030
3142
  ctx: {
3031
- params: p.params,
3143
+ params: m.params,
3032
3144
  pathname: d,
3033
3145
  search: f,
3034
- signal: k.signal,
3035
- headers: T,
3036
- query: D,
3146
+ signal: j.signal,
3147
+ headers: k,
3148
+ query: A,
3037
3149
  isServer: !0
3038
3150
  }
3039
3151
  }));
3040
- let t = x.loader;
3041
- typeof t == "function" && !w && (j = await v("loader", () => t({
3042
- params: p.params,
3152
+ let t = S.loader;
3153
+ typeof t == "function" && !T && (N = await y("loader", () => t({
3154
+ params: m.params,
3043
3155
  pathname: d,
3044
3156
  search: f,
3045
- signal: k.signal,
3046
- headers: T,
3047
- query: D,
3157
+ signal: j.signal,
3158
+ headers: k,
3159
+ query: A,
3048
3160
  isServer: !0
3049
3161
  })));
3050
3162
  } finally {
3051
- c.off("close", A);
3163
+ c.off("close", M);
3052
3164
  }
3053
- let P = await v("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
3054
- w || await cr({
3055
- pageMod: x,
3056
- params: p.params,
3057
- query: D,
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,
3058
3170
  apiName: a[0]?.name,
3059
- seed: P.seedPreloadedSubscription,
3060
- seedFailure: P.seedPreloadedSubscriptionFailure,
3061
- 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", {
3062
3174
  tag: e,
3063
3175
  apiName: t,
3064
3176
  pathname: d
3065
3177
  }, n)
3066
3178
  });
3067
- let ee = {
3068
- pattern: p.route.pattern,
3069
- Component: x.default,
3070
- meta: x.meta,
3071
- loader: x.loader,
3072
- ErrorBoundary: x.ErrorBoundary,
3073
- Pending: x.Pending,
3074
- renderMode: S,
3075
- chain: M
3076
- }, I = {
3077
- cookies: P.parseCookieHeader(T.cookie),
3078
- 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,
3079
3191
  url: u
3080
- }, L = x.interactive ?? "full", R = (await s())(T.cookie, T["accept-language"]);
3081
- b = R !== void 0 && o;
3082
- let te = R ? {
3083
- outerWrap: R.outerWrap,
3084
- locale: R.locale
3085
- } : {}, z = w ? zn({
3086
- helpers: P,
3087
- page: `src/pages/${p.route.file}`,
3088
- 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,
3089
3201
  delivery: "stream",
3090
3202
  renderInput: {
3091
- descriptor: ee,
3092
- params: p.params,
3203
+ descriptor: te,
3204
+ params: m.params,
3093
3205
  pathname: d,
3094
3206
  search: f,
3095
- segmentLoaderData: N,
3096
- requestContext: I,
3097
- ...te
3207
+ segmentLoaderData: ee,
3208
+ requestContext: L,
3209
+ ...ne
3098
3210
  }
3099
- }) : null, B = w ? null : Rn({
3100
- helpers: P,
3101
- page: `src/pages/${p.route.file}`,
3211
+ }) : null, V = T ? null : Rn({
3212
+ helpers: I,
3213
+ page: `src/pages/${m.route.file}`,
3102
3214
  pathname: d,
3103
- renderMode: S,
3104
- interactive: L,
3105
- loaderData: j,
3106
- segmentLoaderData: N,
3107
- pageLoaderRan: typeof x.loader == "function"
3108
- }), V = [];
3109
- 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 () => {
3110
3222
  let t = /* @__PURE__ */ new Set(), n = [
3111
- O(e, "src", "pages", p.route.file),
3112
- ...C.flatMap((t) => [
3223
+ O(e, "src", "pages", m.route.file),
3224
+ ...w.flatMap((t) => [
3113
3225
  ...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
3114
3226
  ...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
3115
3227
  ...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
3116
3228
  ]),
3117
3229
  O(e, ".framework", "main.tsx")
3118
3230
  ];
3119
- for (let e of n) await y(e, t, V);
3231
+ for (let e of n) await b(e, t, re);
3120
3232
  });
3121
- let ne = await v("readShell", Ee), H = await v("transformShell", () => t.transformIndexHtml(u, ne)), U = V.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), W = R?.locale ?? I.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", re = Date.now();
3122
- if (z) {
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();
3234
+ if (B) {
3123
3235
  let e = (e) => Vn({
3124
- helpers: P,
3125
- prepared: z,
3236
+ helpers: I,
3237
+ prepared: B,
3126
3238
  meta: e,
3127
- interactive: L,
3128
- extra: [U]
3239
+ interactive: R,
3240
+ extra: [ie]
3129
3241
  });
3130
- if (z.hasDeferred) ar({
3242
+ if (B.hasDeferred) ar({
3131
3243
  res: c,
3132
3244
  shell: nr({
3133
- shell: H,
3245
+ shell: U,
3134
3246
  inlineModuleScriptsAsync: !0
3135
3247
  }),
3136
3248
  htmlLang: W,
@@ -3139,42 +3251,42 @@ import {
3139
3251
  "x-voltro-rendered-by": "spa-shell-dev"
3140
3252
  },
3141
3253
  headInjection: e,
3142
- render: (e) => P.renderPageToStream({
3143
- ...z.renderInput,
3254
+ render: (e) => I.renderPageToStream({
3255
+ ...B.renderInput,
3144
3256
  ...e
3145
3257
  }),
3146
3258
  onShellError: (e) => {
3147
- be(c, "spa-shell-dev", d, p.route.pattern, e, b);
3259
+ Se(c, "spa-shell-dev", d, m.route.pattern, e, x);
3148
3260
  }
3149
3261
  });
3150
3262
  else {
3151
3263
  let t = Bn({
3152
- helpers: P,
3153
- prepared: z
3154
- }), 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}"`);
3264
+ helpers: I,
3265
+ prepared: B
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}"`);
3155
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);
3156
3268
  }
3157
- } else if (B) {
3269
+ } else if (V) {
3158
3270
  let e = (e) => [
3159
- U,
3160
- P.renderMetaToHtml(e),
3161
- `<meta name="voltro-interactive" content="${L}" />`,
3162
- ...B.hasDeferred ? [P.renderDeferredRegistryScript()] : [],
3163
- P.renderRouterStateScript(B.stateInput)
3271
+ ie,
3272
+ I.renderMetaToHtml(e),
3273
+ `<meta name="voltro-interactive" content="${R}" />`,
3274
+ ...V.hasDeferred ? [I.renderDeferredRegistryScript()] : [],
3275
+ I.renderRouterStateScript(V.stateInput)
3164
3276
  ].filter((e) => e.length > 0).join("\n "), t = {
3165
- descriptor: ee,
3166
- params: p.params,
3277
+ descriptor: te,
3278
+ params: m.params,
3167
3279
  pathname: d,
3168
3280
  search: f,
3169
- loaderData: B.loaderData,
3170
- segmentLoaderData: B.segmentLoaderData,
3171
- requestContext: I,
3172
- ...te
3281
+ loaderData: V.loaderData,
3282
+ segmentLoaderData: V.segmentLoaderData,
3283
+ requestContext: L,
3284
+ ...ne
3173
3285
  };
3174
- if (S === "ssr" && L === "full") ar({
3286
+ if (C === "ssr" && R === "full") ar({
3175
3287
  res: c,
3176
3288
  shell: nr({
3177
- shell: H,
3289
+ shell: U,
3178
3290
  inlineModuleScriptsAsync: !0
3179
3291
  }),
3180
3292
  htmlLang: W,
@@ -3183,39 +3295,39 @@ import {
3183
3295
  "x-voltro-rendered-by": "ssr-dev"
3184
3296
  },
3185
3297
  headInjection: e,
3186
- render: (e) => P.renderPageToStream({
3298
+ render: (e) => I.renderPageToStream({
3187
3299
  ...t,
3188
3300
  ...e
3189
3301
  }),
3190
3302
  onShellError: (e) => {
3191
- be(c, "ssr-dev", d, p.route.pattern, e, b);
3303
+ Se(c, "ssr-dev", d, m.route.pattern, e, x);
3192
3304
  }
3193
3305
  });
3194
3306
  else {
3195
- let { html: n, meta: r } = P.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}"`);
3196
3308
  c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
3197
3309
  }
3198
3310
  }
3199
- g.render = Date.now() - re;
3200
- let G = Date.now() - h;
3201
- m ? (ye.add(p.route.pattern), Z.info(`ssr compiled ${p.route.pattern} in ${G}ms`, {
3202
- 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,
3203
3315
  pathname: d,
3204
3316
  elapsedMs: G,
3205
3317
  cold: !0,
3206
- phases: g
3207
- })) : G > 200 && Z.info(`ssr rendered ${d} in ${G}ms`, {
3208
- pattern: p.route.pattern,
3318
+ phases: v
3319
+ })) : G > 200 && Q.info(`ssr rendered ${d} in ${G}ms`, {
3320
+ pattern: m.route.pattern,
3209
3321
  pathname: d,
3210
3322
  elapsedMs: G,
3211
3323
  cold: !1,
3212
- phases: g
3324
+ phases: v
3213
3325
  });
3214
3326
  } catch (e) {
3215
3327
  if (In(e)) {
3216
- Z.error("ssr-dev render refused", {
3328
+ Q.error("ssr-dev render refused", {
3217
3329
  pathname: d,
3218
- pattern: p.route.pattern
3330
+ pattern: m.route.pattern
3219
3331
  }, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
3220
3332
  return;
3221
3333
  }
@@ -3226,14 +3338,14 @@ import {
3226
3338
  c.end(t.body);
3227
3339
  return;
3228
3340
  }
3229
- be(c, "ssr-dev", d, p.route.pattern, e, b);
3341
+ Se(c, "ssr-dev", d, m.route.pattern, e, x);
3230
3342
  }
3231
3343
  });
3232
3344
  }
3233
- }, Ae = Date.now(), je = L.version ?? "?", Me = await br(), 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 () => {
3234
3346
  let t = [];
3235
3347
  for (let n of a) {
3236
- let r = await Vr(e, n.pkg);
3348
+ let r = await ni(e, n.pkg);
3237
3349
  r && t.push(r);
3238
3350
  }
3239
3351
  let n = await pr(t);
@@ -3247,14 +3359,19 @@ import {
3247
3359
  await M.writeFile(r, n);
3248
3360
  } catch {}
3249
3361
  return !0;
3250
- })(), Le = await gr(e);
3251
- Le !== void 0 && Z.info("middleware.ts loaded renews credentials before each SSR render"), Ie && Z.info("rpcGroup changed since last bootforcing 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");
3252
3369
  try {
3253
3370
  await Pe(l, "voltro dev (web)");
3254
3371
  } catch (e) {
3255
- Z.error(String(e.message ?? e)), process.exit(1);
3372
+ Q.error(String(e.message ?? e)), process.exit(1);
3256
3373
  }
3257
- await (await L.createServer({
3374
+ await (await te.createServer({
3258
3375
  root: z,
3259
3376
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3260
3377
  ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
@@ -3266,12 +3383,12 @@ import {
3266
3383
  "@voltro/i18n"
3267
3384
  ],
3268
3385
  alias: [
3269
- ...Me ? [{
3386
+ ...Ne ? [{
3270
3387
  find: "@voltro/devtools/styles.css",
3271
- replacement: O(Me, "src/styles.css")
3388
+ replacement: O(Ne, "src/styles.css")
3272
3389
  }, {
3273
3390
  find: "@voltro/devtools",
3274
- replacement: O(Me, "src/index.ts")
3391
+ replacement: O(Ne, "src/index.ts")
3275
3392
  }] : [],
3276
3393
  ...Y ? [
3277
3394
  {
@@ -3291,49 +3408,49 @@ import {
3291
3408
  replacement: O(Y, "src/index.ts")
3292
3409
  }
3293
3410
  ] : [],
3294
- ...nt(e)
3411
+ ...tt(e)
3295
3412
  ]
3296
3413
  },
3297
3414
  optimizeDeps: {
3298
- include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Fe],
3299
- force: Ie
3415
+ include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
3416
+ force: Le
3300
3417
  },
3301
- customLogger: et(),
3418
+ customLogger: $e(),
3302
3419
  plugins: [
3303
3420
  bn(O(e, "src", "pages")),
3421
+ L(),
3304
3422
  R(),
3305
- te(),
3306
- H,
3307
- ie,
3308
- ue,
3309
- pe,
3310
- me,
3311
- _e,
3312
- Oe,
3313
- ...ve ? [ve] : []
3423
+ re,
3424
+ ae,
3425
+ fe,
3426
+ he,
3427
+ ge,
3428
+ ye,
3429
+ Ae,
3430
+ ...be ? [be] : []
3314
3431
  ],
3315
3432
  server: {
3316
3433
  port: l,
3317
3434
  strictPort: !0,
3318
3435
  host: !0,
3319
3436
  allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
3320
- proxy: J,
3321
- fs: { allow: [e, ...Er(e)] }
3437
+ proxy: q,
3438
+ fs: { allow: [e, ...Br(e)] }
3322
3439
  },
3323
3440
  appType: "spa",
3324
3441
  cacheDir: O(z, ".vite"),
3325
3442
  publicDir: O(e, "public")
3326
- })).listen(), vr.info(`v${je} ready in ${Date.now() - Ae}ms`, {
3327
- version: je,
3328
- bootMs: Date.now() - Ae
3329
- }), 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}`, {
3330
3447
  port: l,
3331
3448
  app: n.name ?? "(unnamed)"
3332
3449
  });
3333
- 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}`, {
3334
3451
  api: e.name,
3335
3452
  target: e.proxyTarget
3336
- }), 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 }));
3337
3454
  try {
3338
3455
  await x({
3339
3456
  id: b,
@@ -3347,7 +3464,7 @@ import {
3347
3464
  let t = wn(e);
3348
3465
  if (t) {
3349
3466
  let e = await Pn({ dashboardAppPath: t });
3350
- 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 });
3351
3468
  }
3352
3469
  setInterval(() => {
3353
3470
  x({
@@ -3365,32 +3482,32 @@ import {
3365
3482
  };
3366
3483
  process.on("SIGINT", n), process.on("SIGTERM", n);
3367
3484
  } catch (e) {
3368
- Z.warn("runtime-registry write failed", {}, e);
3485
+ Q.warn("runtime-registry write failed", {}, e);
3369
3486
  }
3370
- return B({
3487
+ return ne({
3371
3488
  app: n.name ?? "unnamed",
3372
3489
  kind: "web",
3373
3490
  url: `http://localhost:${l}`,
3374
- bootMs: Date.now() - Ae
3491
+ bootMs: Date.now() - je
3375
3492
  }), new Promise(() => {});
3376
- }, ri = async (t) => {
3493
+ }, vi = async (t) => {
3377
3494
  e("serve");
3378
- let n = await ti(t);
3495
+ let n = await gi(t);
3379
3496
  if (!n) return {
3380
3497
  ran: !1,
3381
3498
  exitCode: 0
3382
3499
  };
3383
- let i = Date.now(), a = Z.child("serve");
3500
+ let i = Date.now(), a = Q.child("serve");
3384
3501
  a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
3385
- let o = await Kr(t, n);
3502
+ let o = await si(t, n);
3386
3503
  for (let e of o) a.info("api wired", {
3387
3504
  name: e.name,
3388
3505
  pkg: e.pkg
3389
3506
  });
3390
- await Qr(t, n, o);
3507
+ await pi(t, n, o);
3391
3508
  {
3392
- let { pages: e } = await $(O(t, "src", "pages"));
3393
- await ht({
3509
+ let { pages: e } = await Jr(O(t, "src", "pages"));
3510
+ await mt({
3394
3511
  appRoot: t,
3395
3512
  pages: e
3396
3513
  });
@@ -3399,12 +3516,12 @@ import {
3399
3516
  kind: "web",
3400
3517
  configPort: n.port,
3401
3518
  env: process.env
3402
- }).port, c = await he("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
3403
- 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({
3404
3521
  root: u,
3405
3522
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3406
3523
  plugins: [l()],
3407
- customLogger: et(),
3524
+ customLogger: $e(),
3408
3525
  resolve: { dedupe: [
3409
3526
  "react",
3410
3527
  "react-dom",
@@ -3413,7 +3530,7 @@ import {
3413
3530
  ] },
3414
3531
  build: {
3415
3532
  outDir: "dist",
3416
- rollupOptions: { output: { manualChunks: Or } }
3533
+ rollupOptions: { output: { manualChunks: Hr } }
3417
3534
  },
3418
3535
  publicDir: O(t, "public")
3419
3536
  });
@@ -3426,7 +3543,7 @@ import {
3426
3543
  label: "Local",
3427
3544
  url: e
3428
3545
  })) ?? [];
3429
- return B({
3546
+ return ne({
3430
3547
  app: n.name ?? "unnamed",
3431
3548
  kind: "preview",
3432
3549
  url: f,
@@ -3435,4 +3552,4 @@ import {
3435
3552
  }), new Promise(() => {});
3436
3553
  };
3437
3554
  //#endregion
3438
- export { nt as $, Rn as A, en as B, _r as C, nr as D, rr as E, Tn as F, wt as G, Jt as H, Cn as I, xt as J, Ct as K, Pn as L, Bn as M, Vn as N, ar as O, Hn as P, rt as Q, wn as R, mr as S, cr as T, Vt as U, Xt as V, It as W, ht as X, bt as Y, at as Z, ri as _, Fr as a, Pe as at, Qr as b, Mr as c, De as ct, ti as d, Se as dt, Ve as et, Kr as f, be as ft, ni as g, Jr as h, Zr as i, Ge as it, zn as j, In as k, Q as l, we as lt, Wr as m, he as mt, Xr as n, He as nt, ei as o, ke as ot, Ur as p, ye as pt, Tt as q, Gr as r, We as rt, Pr as s, Ee as st, kr as t, Ue as tt, Nr as u, Te as ut, Or as v, hr as w, gr as x, $ as y, on 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 };