@voltro/cli 0.54.0 → 0.55.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 (119) hide show
  1. package/CHANGELOG.md +142 -2
  2. package/dist/{apiBuild-DTWp0S_q.js → apiBuild-CMvLJM_K.js} +2 -2
  3. package/dist/apiBuild-Cl0IDx8c.js +2 -0
  4. package/dist/bin.js +1 -1
  5. package/dist/{build-D4ygSbnV.js → build-S0QOzqPT.js} +10 -10
  6. package/dist/{checkCommand-L7DTlpIF.js → checkCommand-DNkY5kwF.js} +1 -1
  7. package/dist/{checkCommand-Dg1G7Gwd.js → checkCommand-fbj9GDjN.js} +5 -5
  8. package/dist/codegen-CN6vMM4J.js +2 -0
  9. package/dist/{codegen-DSLM8Su9.js → codegen-SIepQtUl.js} +74 -63
  10. package/dist/{codegenCommand-CG_Vx4lc.js → codegenCommand-3TDJezom.js} +10 -9
  11. package/dist/{codemodRunner-Cd4xkC6u.js → codemodRunner-C2zxZUIw.js} +55 -0
  12. package/dist/{commands-6Kzi92Np.js → commands-BBYJ7Q3B.js} +24 -24
  13. package/dist/{dashboardCommand-Cq1PWvI1.js → dashboardCommand-D2kmyCLL.js} +3 -3
  14. package/dist/{dataCommand-DYzW8vkv.js → dataCommand-BEPPQiTl.js} +266 -194
  15. package/dist/dbCommand-BTyBGhIA.js +2 -0
  16. package/dist/{dbCommand-B4NWZtGL.js → dbCommand-DZTmOFT4.js} +1 -1
  17. package/dist/{dev-CmuvUKRq.js → dev-Ca_A_S9v.js} +2182 -2157
  18. package/dist/{dev-cKUiZZsB.js → dev-DfVZaoys.js} +1 -1
  19. package/dist/{doctorCommand-DCiFVMtZ.js → doctorCommand-CGZJK_4o.js} +15 -15
  20. package/dist/doctorCommand-djmqEcDC.js +2 -0
  21. package/dist/{dormancyCommand-w1TrmgYP.js → dormancyCommand-DY2rYpTa.js} +1 -1
  22. package/dist/{embeddingsCommand-CMgPyRTr.js → embeddingsCommand-BoCqZsgp.js} +1 -1
  23. package/dist/{envCommand-Cyynmcfa.js → envCommand-Bxy2fOjc.js} +2 -2
  24. package/dist/{evolveCommand-BwvQ8dVH.js → evolveCommand-BsbZ-XDg.js} +2 -2
  25. package/dist/frameworkTableAssembly-Df2Ymp2f.js +2 -0
  26. package/dist/{frameworkTableAssembly-D7LJuALW.js → frameworkTableAssembly-Do-cf6RJ.js} +92 -98
  27. package/dist/index.js +1 -1
  28. package/dist/{infoCommand-DlYlUPqs.js → infoCommand-EmM3jPKD.js} +1 -1
  29. package/dist/{inspect-Bd8-9wsi.js → inspect-DCqILJ1G.js} +4 -0
  30. package/dist/inspect-DGJwpOAb.js +2 -0
  31. package/dist/interruptedReplace-CwnkBb2X.js +41 -0
  32. package/dist/interruptedReplace-qzmFI020.js +2 -0
  33. package/dist/manifestBuild-CJ2zvPvT.js +2 -0
  34. package/dist/{manifestBuild-Cqgsx2bM.js → manifestBuild-DjX5MoXy.js} +1 -1
  35. package/dist/{migrate-BK_Bbx-_.js → migrate-CGFZS-1a.js} +2 -2
  36. package/dist/{probeCommand-_C0YU207.js → probeCommand-Bs3iVBSL.js} +1 -1
  37. package/dist/{runtimeTrace-CGWx1Q6l.js → runtimeTrace-C1BTpHGQ.js} +1 -1
  38. package/dist/{sdkgen-CDGHQUFj.js → sdkgen-CXMwLg9n.js} +1 -1
  39. package/dist/{serveCommand-Bje09q1v.js → serveCommand-C7IrCD58.js} +840 -838
  40. package/dist/serveCommand-Cjt5S9hD.js +2 -0
  41. package/dist/serveEntry.js +1 -1
  42. package/dist/{start-B0bnJgxI.js → start-DH7cat4-.js} +1 -1
  43. package/dist/{start-Clz-1BHB.js → start-EOV7s1NZ.js} +486 -476
  44. package/dist/startEntry.js +1 -1
  45. package/dist/{test-D_kW4KMj.js → test-DO27-x2P.js} +1 -1
  46. package/dist/{updateCommand-CRJlAOaM.js → updateCommand-C_jN1w18.js} +1 -1
  47. package/dist/updateCommand-nnFjDbl4.js +2 -0
  48. package/dist/{webDev-DlvZO30c.js → webDev-1XpVnYkW.js} +1 -1
  49. package/dist/{webDev-DSI9SOhs.js → webDev-B7vNj4Bq.js} +502 -494
  50. package/dist/{webhooksCommand-BvzXNHji.js → webhooksCommand-B1LVcyO3.js} +1 -1
  51. package/package.json +31 -19
  52. package/templates/AGENTS.md +1 -1
  53. package/templates/agent-docs/_index.md +1 -1
  54. package/templates/agent-docs/authentication.md +49 -6
  55. package/templates/agent-docs/cli.md +94 -11
  56. package/templates/agent-docs/data.md +64 -13
  57. package/templates/agent-docs/plugins.md +46 -8
  58. package/templates/agent-docs/reference.md +5 -3
  59. package/templates/agent-docs/routing.md +18 -0
  60. package/templates/agent-docs/schema-driven-ui.md +125 -0
  61. package/templates/agent-docs/whats-new.md +76 -133
  62. package/templates/apps/api-ai/package.json +6 -6
  63. package/templates/apps/api-auth/package.json +8 -8
  64. package/templates/apps/api-backend/package.json +7 -7
  65. package/templates/apps/api-backend-deactivation/package.json +7 -7
  66. package/templates/apps/api-backend-mail/package.json +8 -8
  67. package/templates/apps/api-backend-mariadb/package.json +9 -9
  68. package/templates/apps/api-backend-sqlite/package.json +8 -8
  69. package/templates/apps/api-backend-storage/package.json +8 -8
  70. package/templates/apps/api-cms/package.json +9 -9
  71. package/templates/apps/api-collab/package.json +8 -8
  72. package/templates/apps/api-data-advanced/package.json +8 -8
  73. package/templates/apps/api-durable/package.json +8 -8
  74. package/templates/apps/api-feature-flags/package.json +9 -9
  75. package/templates/apps/api-governance/package.json +8 -8
  76. package/templates/apps/api-kv/package.json +8 -8
  77. package/templates/apps/api-moderation/package.json +8 -8
  78. package/templates/apps/api-observability/package.json +8 -8
  79. package/templates/apps/api-ratelimit/package.json +8 -8
  80. package/templates/apps/api-rbac/package.json +8 -8
  81. package/templates/apps/api-rest/package.json +7 -7
  82. package/templates/apps/api-row-history/package.json +8 -8
  83. package/templates/apps/api-saas/package.json +11 -11
  84. package/templates/apps/api-saas-starter/package.json +10 -10
  85. package/templates/apps/api-search/package.json +8 -8
  86. package/templates/apps/api-status/package.json +8 -8
  87. package/templates/apps/api-webhooks/package.json +9 -9
  88. package/templates/apps/changelog/package.json +7 -7
  89. package/templates/apps/edge-functions/package.json +2 -2
  90. package/templates/apps/frontend-admin/package.json +8 -8
  91. package/templates/apps/frontend-app/package.json +9 -9
  92. package/templates/apps/frontend-auth/package.json +8 -8
  93. package/templates/apps/frontend-blank/package.json +7 -7
  94. package/templates/apps/frontend-cms/package.json +9 -9
  95. package/templates/apps/frontend-collab/package.json +10 -10
  96. package/templates/apps/frontend-contact/package.json +7 -7
  97. package/templates/apps/frontend-dashboard/package.json +7 -7
  98. package/templates/apps/frontend-docs/package.json +8 -8
  99. package/templates/apps/frontend-i18n/package.json +6 -6
  100. package/templates/apps/frontend-landing/package.json +7 -7
  101. package/templates/apps/frontend-portal/package.json +8 -8
  102. package/templates/apps/frontend-saas/package.json +8 -8
  103. package/templates/apps/frontend-spa/package.json +7 -7
  104. package/templates/apps/frontend-ssr/package.json +7 -7
  105. package/templates/apps/frontend-ssr-api/package.json +8 -8
  106. package/templates/apps/frontend-static-blog/package.json +8 -8
  107. package/templates/apps/frontend-status/package.json +8 -8
  108. package/templates/apps/mobile-app/package.json +4 -4
  109. package/dist/apiBuild-CeUN55uk.js +0 -2
  110. package/dist/codegen-DjgxEOnD.js +0 -2
  111. package/dist/dbCommand-CSFWs9ev.js +0 -2
  112. package/dist/doctorCommand-J3qu4E0Y.js +0 -2
  113. package/dist/frameworkTableAssembly-IPD1pUnZ.js +0 -2
  114. package/dist/inspect-CuoDInfZ.js +0 -2
  115. package/dist/interruptedReplace-C3O3M1MM.js +0 -28
  116. package/dist/interruptedReplace-CvmiAM9K.js +0 -2
  117. package/dist/manifestBuild-C4-J1-m_.js +0 -2
  118. package/dist/serveCommand-BiPe8BJm.js +0 -2
  119. package/dist/updateCommand-CIoVDKnj.js +0 -2
@@ -1,32 +1,32 @@
1
1
  import { i as e, t } from "./nodeEnvironment-cGFAj1J8.js";
2
2
  import { r as n } from "./appPort-B_HpJ_ck.js";
3
- import { $ as r, A as i, At as a, B as o, C as s, D as c, E as l, F as u, G as d, H as f, I as ee, J as p, K as m, Kt as h, L as te, M as g, Mt as _, N as ne, O as re, Ot as v, R as y, S as b, T as x, Tt as S, U as C, Ut as ie, V as w, W as ae, X as oe, Y as T, Z as E, at as D, bt as O, ct as se, et as ce, ht as le, i as ue, j as de, jt as k, k as fe, kt as A, l as pe, lt as me, m as he, mt as j, n as M, nt as N, o as ge, ot as P, p as _e, q as F, s as I, st as ve, w as ye, x as be, z as xe } from "./webDev-DSI9SOhs.js";
4
- import { o as Se, t as Ce } from "./connectionConfig-Bk9IC7D0.js";
5
- import { A as L, D as we, a as Te, h as Ee, j as De, k as Oe } from "./inspect-Bd8-9wsi.js";
6
- import { n as ke, r as Ae, t as je } from "./inspectMetrics-CGF94puw.js";
7
- import { a as Me, c as R, d as Ne, f as Pe, l as Fe, p as z, u as Ie } from "./renderModeScan-43yQ2opo.js";
8
- import { i as Le, n as Re, r as ze, t as Be } from "./runtimeRegistry-DMeKfTHP.js";
9
- import { n as Ve } from "./logFileSink-B4uP8pvf.js";
10
- import { t as He } from "./bootTiming-BdyP9nYw.js";
11
- import { dirname as B, extname as V, join as H, resolve as Ue } from "node:path";
12
- import { promises as U } from "node:fs";
13
- import { fileURLToPath as We, pathToFileURL as W } from "node:url";
14
- import { createLogger as G, printReadyBlock as Ge } from "@voltro/logger";
15
- import { Effect as Ke } from "effect";
16
- import { maybeCompress as K, snapshotMetricsSync as qe } from "@voltro/runtime";
17
- import { createHash as q } from "node:crypto";
18
- import { resolveBroadcastProvider as Je } from "@voltro/plugin-broadcast";
19
- import { createServer as Ye } from "node:http";
3
+ import { $ as r, A as i, At as a, B as o, C as s, D as c, E as l, F as u, G as d, H as f, I as ee, J as te, K as p, Kt as m, L as ne, M as h, Mt as g, N as re, O as ie, Ot as _, R as v, S as y, T as b, Tt as x, U as S, Ut as ae, V as C, W as oe, X as se, Y as w, Z as T, at as E, bt as D, ct as ce, et as le, ht as ue, i as de, j as fe, jt as O, k as pe, kt as k, l as me, lt as he, m as ge, mt as A, n as j, nt as M, o as _e, ot as N, p as ve, q as P, s as F, st as ye, w as be, x as xe, z as Se } from "./webDev-B7vNj4Bq.js";
4
+ import { o as Ce, t as we } from "./connectionConfig-Bk9IC7D0.js";
5
+ import { A as I, D as Te, a as Ee, h as De, j as Oe, k as ke } from "./inspect-DCqILJ1G.js";
6
+ import { n as Ae, r as je, t as Me } from "./inspectMetrics-CGF94puw.js";
7
+ import { a as Ne, c as L, d as Pe, f as Fe, l as Ie, p as R, u as Le } from "./renderModeScan-43yQ2opo.js";
8
+ import { i as Re, n as ze, r as Be, t as Ve } from "./runtimeRegistry-DMeKfTHP.js";
9
+ import { n as He } from "./logFileSink-B4uP8pvf.js";
10
+ import { t as Ue } from "./bootTiming-BdyP9nYw.js";
11
+ import { dirname as z, extname as B, join as V, resolve as We } from "node:path";
12
+ import { promises as H } from "node:fs";
13
+ import { fileURLToPath as Ge, pathToFileURL as U } from "node:url";
14
+ import { createLogger as W, printReadyBlock as Ke } from "@voltro/logger";
15
+ import { Effect as qe } from "effect";
16
+ import { maybeCompress as G, snapshotMetricsSync as Je } from "@voltro/runtime";
17
+ import { createHash as K } from "node:crypto";
18
+ import { resolveBroadcastProvider as Ye } from "@voltro/plugin-broadcast";
19
+ import { createServer as Xe } from "node:http";
20
20
  //#region src/httpResponseWrite.ts
21
- var Xe = (e) => `W/"${q("md5").update(e).digest("hex")}"`, Ze = (e) => {
21
+ var Ze = (e) => `W/"${K("md5").update(e).digest("hex")}"`, Qe = (e) => {
22
22
  let { response: t, status: n, headers: r, body: i, requestHeaders: a } = e, o = r["cache-control"], s = (typeof o == "string" ? o : "").toLowerCase();
23
23
  if (i === void 0 || n !== 200 || s.includes("no-store")) return !1;
24
- let c = r["content-type"], l = typeof c == "string" ? c : void 0, u = Xe(i), d = a["if-none-match"];
24
+ let c = r["content-type"], l = typeof c == "string" ? c : void 0, u = Ze(i), d = a["if-none-match"];
25
25
  if (d !== void 0 && d.split(",").some((e) => e.trim() === u)) return t.writeHead(304, {
26
26
  ...r,
27
27
  etag: u
28
28
  }), t.end(), !0;
29
- let f = K({
29
+ let f = G({
30
30
  body: typeof i == "string" ? new TextEncoder().encode(i) : new Uint8Array(i),
31
31
  contentType: l,
32
32
  acceptEncoding: a["accept-encoding"],
@@ -37,7 +37,7 @@ var Xe = (e) => `W/"${q("md5").update(e).digest("hex")}"`, Ze = (e) => {
37
37
  etag: u
38
38
  };
39
39
  return f.compressed && delete ee["content-length"], t.writeHead(n, ee), t.end(Buffer.from(f.bytes)), !0;
40
- }, J = G({ scope: "voltro:start:cdc" }), Qe = (e) => (t) => {
40
+ }, q = W({ scope: "voltro:start:cdc" }), $e = (e) => (t) => {
41
41
  let n = 0;
42
42
  for (let [r, i] of e.tableSubscriptionsByPattern) {
43
43
  if (!i.includes(t)) continue;
@@ -48,15 +48,15 @@ var Xe = (e) => `W/"${q("md5").update(e).digest("hex")}"`, Ze = (e) => {
48
48
  }));
49
49
  }
50
50
  return n;
51
- }, $e = () => Ce() ? Se() : null, et = (e) => {
52
- let t = e.channel ?? "framework_changes", n = e.revalidateChannel ?? "voltro_revalidate", r = Qe(e), i = null, a = null;
51
+ }, et = () => we() ? Ce() : null, tt = (e) => {
52
+ let t = e.channel ?? "framework_changes", n = e.revalidateChannel ?? "voltro_revalidate", r = $e(e), i = null, a = null;
53
53
  return {
54
54
  start: async () => {
55
55
  let o = e.tableSubscriptionsByPattern.size > 0, s = e.onRevalidate !== void 0;
56
- if (!o && !s) return J.debug("skipped — no pages declare cacheInvalidatesOn and no revalidation handler is wired"), !1;
57
- let c = $e();
58
- if (!c && !o) return J.debug("no database configured — the revalidation LISTEN line is unavailable"), !1;
59
- if (!c) return J.warn(`${e.tableSubscriptionsByPattern.size} route(s) declare \`cacheInvalidatesOn\` and will NOT be invalidated live — no database is configured for this web process. Set DB_URL (or DB_HOST / PG_HOST) so the CDC listener can connect; until then those routes go stale until their \`revalidate\` window expires.`, { routes: [...e.tableSubscriptionsByPattern.keys()] }), !1;
56
+ if (!o && !s) return q.debug("skipped — no pages declare cacheInvalidatesOn and no revalidation handler is wired"), !1;
57
+ let c = et();
58
+ if (!c && !o) return q.debug("no database configured — the revalidation LISTEN line is unavailable"), !1;
59
+ if (!c) return q.warn(`${e.tableSubscriptionsByPattern.size} route(s) declare \`cacheInvalidatesOn\` and will NOT be invalidated live — no database is configured for this web process. Set DB_URL (or DB_HOST / PG_HOST) so the CDC listener can connect; until then those routes go stale until their \`revalidate\` window expires.`, { routes: [...e.tableSubscriptionsByPattern.keys()] }), !1;
60
60
  i = new (await (import("pg"))).default.Client(c), await i.connect(), a = (i) => {
61
61
  if (i.channel === n && i.payload && e.onRevalidate) {
62
62
  e.onRevalidate(i.payload);
@@ -67,18 +67,18 @@ var Xe = (e) => `W/"${q("md5").update(e).digest("hex")}"`, Ze = (e) => {
67
67
  try {
68
68
  a = JSON.parse(i.payload);
69
69
  } catch (e) {
70
- J.warn("bad CDC payload", {}, e);
70
+ q.warn("bad CDC payload", {}, e);
71
71
  return;
72
72
  }
73
73
  let o = r(a.table);
74
- o > 0 && J.info(`${a.op} on '${a.table}' → dropped ${o} cache entries`, {
74
+ o > 0 && q.info(`${a.op} on '${a.table}' → dropped ${o} cache entries`, {
75
75
  op: a.op,
76
76
  table: a.table,
77
77
  dropped: o
78
78
  });
79
79
  }, i.on("notification", a), o && await i.query(`LISTEN ${t}`), s && await i.query(`LISTEN ${n}`);
80
80
  let l = [...o ? [t] : [], ...s ? [n] : []];
81
- return J.info(`LISTEN ${l.join(", ")}`, {
81
+ return q.info(`LISTEN ${l.join(", ")}`, {
82
82
  channels: l,
83
83
  ..."connectionString" in c ? { target: c.connectionString.replace(/\/\/[^@/]*@/, "//") } : {
84
84
  host: c.host,
@@ -96,7 +96,7 @@ var Xe = (e) => `W/"${q("md5").update(e).digest("hex")}"`, Ze = (e) => {
96
96
  }
97
97
  }
98
98
  };
99
- }, Y = G({ scope: "voltro:start:isr-cache" }), tt = "voltro_isr_cache", X = (e) => `
99
+ }, J = W({ scope: "voltro:start:isr-cache" }), nt = "voltro_isr_cache", Y = (e) => `
100
100
  CREATE TABLE IF NOT EXISTS ${e} (
101
101
  cache_key TEXT PRIMARY KEY,
102
102
  html TEXT NOT NULL,
@@ -107,9 +107,9 @@ CREATE TABLE IF NOT EXISTS ${e} (
107
107
  stale_while_revalidate_ms BIGINT NOT NULL DEFAULT 0
108
108
  );
109
109
  CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
110
- `, nt = (e) => {
111
- let t = e.tableName ?? tt, { client: n } = e, r = /* @__PURE__ */ new Map(), i = !1, a = (async () => {
112
- i || (i = !0, await n.query(X(t)));
110
+ `, rt = (e) => {
111
+ let t = e.tableName ?? nt, { client: n } = e, r = /* @__PURE__ */ new Map(), i = !1, a = (async () => {
112
+ i || (i = !0, await n.query(Y(t)));
113
113
  })().then(async () => {
114
114
  let e = await n.query(`SELECT * FROM ${t}`);
115
115
  for (let t of e.rows) r.set(t.cache_key, {
@@ -121,10 +121,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
121
121
  staleWhileRevalidateMs: Number(t.stale_while_revalidate_ms)
122
122
  });
123
123
  }).catch((e) => {
124
- Y.warn("postgres bootstrap failed", {}, e);
124
+ J.warn("postgres bootstrap failed", {}, e);
125
125
  }), o = (e, t) => {
126
126
  a.then(() => n.query(e, t)).catch((e) => {
127
- Y.warn("postgres write failed", {}, e);
127
+ J.warn("postgres write failed", {}, e);
128
128
  });
129
129
  }, s = /* @__PURE__ */ new Map(), c = (e) => {
130
130
  s.set(e, (s.get(e) ?? 0) + 1);
@@ -175,21 +175,21 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
175
175
  return Array.from(r.entries());
176
176
  }
177
177
  };
178
- }, Z = G({ scope: "voltro:start:revalidate" }), rt = (e) => {
178
+ }, X = W({ scope: "voltro:start:revalidate" }), it = (e) => {
179
179
  try {
180
180
  let t = JSON.parse(e);
181
181
  return (t.kind === "path" || t.kind === "table" || t.kind === "tag") && typeof t.value == "string" && t.value.length > 0 && (t.tenant === void 0 || typeof t.tenant == "string") ? {
182
182
  kind: t.kind,
183
183
  value: t.value,
184
184
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
185
- } : (Z.warn("bad revalidation payload (shape)", { payload: e }), null);
185
+ } : (X.warn("bad revalidation payload (shape)", { payload: e }), null);
186
186
  } catch {
187
- return Z.warn("bad revalidation payload (not JSON)", { payload: e }), null;
187
+ return X.warn("bad revalidation payload (not JSON)", { payload: e }), null;
188
188
  }
189
- }, it = (e, t) => {
189
+ }, at = (e, t) => {
190
190
  if (t.kind === "table" || t.kind === "tag") {
191
191
  let n = e.tableSink(t.value);
192
- return Z.info(`revalidate ${t.kind} '${t.value}' → dropped ${n} cache entries`, {
192
+ return X.info(`revalidate ${t.kind} '${t.value}' → dropped ${n} cache entries`, {
193
193
  kind: t.kind,
194
194
  value: t.value,
195
195
  dropped: n
@@ -198,7 +198,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
198
198
  let n = t.value, r = (e) => t.tenant === void 0 || e.split("|").includes(`tenant=${t.tenant}`), i = e.regexByPattern.get(n);
199
199
  if (i !== void 0) {
200
200
  let a = e.renderModeByPattern.get(n);
201
- if (a !== "isr") return Z.error(`revalidatePath('${n}') targets a '${a ?? "unknown"}' route — only \`renderMode: 'isr'\` routes have cache entries to drop. Static HTML is a build artifact this process never re-renders; rebuild to change it.`, {
201
+ if (a !== "isr") return X.error(`revalidatePath('${n}') targets a '${a ?? "unknown"}' route — only \`renderMode: 'isr'\` routes have cache entries to drop. Static HTML is a build artifact this process never re-renders; rebuild to change it.`, {
202
202
  path: n,
203
203
  renderMode: a ?? "unknown"
204
204
  }), 0;
@@ -206,34 +206,34 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
206
206
  let t = e.split("|")[0] ?? e;
207
207
  return i.test(t) && r(e);
208
208
  });
209
- return Z.info(`revalidate path pattern '${n}' → dropped ${o} cache entries`, {
209
+ return X.info(`revalidate path pattern '${n}' → dropped ${o} cache entries`, {
210
210
  path: n,
211
211
  dropped: o,
212
212
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
213
213
  }), o;
214
214
  }
215
215
  let a = [...e.regexByPattern.entries()].find(([, e]) => e.test(n));
216
- if (a === void 0) return Z.error(`revalidatePath('${n}') matches no declared route — nothing was dropped. Pass a declared route pattern (e.g. /blog/[slug]) or a concrete path of one.`, { path: n }), 0;
216
+ if (a === void 0) return X.error(`revalidatePath('${n}') matches no declared route — nothing was dropped. Pass a declared route pattern (e.g. /blog/[slug]) or a concrete path of one.`, { path: n }), 0;
217
217
  let o = e.renderModeByPattern.get(a[0]);
218
- if (o !== "isr") return Z.error(`revalidatePath('${n}') targets a '${o ?? "unknown"}' route (${a[0]}) — only \`renderMode: 'isr'\` routes have cache entries to drop.`, {
218
+ if (o !== "isr") return X.error(`revalidatePath('${n}') targets a '${o ?? "unknown"}' route (${a[0]}) — only \`renderMode: 'isr'\` routes have cache entries to drop.`, {
219
219
  path: n,
220
220
  route: a[0],
221
221
  renderMode: o ?? "unknown"
222
222
  }), 0;
223
223
  let s = e.cache.invalidateBy((e) => (e.split("|")[0] ?? e) === n && r(e));
224
- return Z.info(`revalidate path '${n}' → dropped ${s} cache entries`, {
224
+ return X.info(`revalidate path '${n}' → dropped ${s} cache entries`, {
225
225
  path: n,
226
226
  dropped: s,
227
227
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
228
228
  }), s;
229
- }, Q = G({ scope: "voltro:start" }), at = await (async () => {
229
+ }, Z = W({ scope: "voltro:start" }), ot = await (async () => {
230
230
  try {
231
- let e = H(B(We(import.meta.url)), "..", "package.json"), t = await U.readFile(e, "utf8");
231
+ let e = V(z(Ge(import.meta.url)), "..", "package.json"), t = await H.readFile(e, "utf8");
232
232
  return JSON.parse(t).version ?? "0.0.0";
233
233
  } catch {
234
234
  return "0.0.0";
235
235
  }
236
- })(), ot = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", st = (e) => e instanceof Error && e._voltroControl === "not-found", ct = {
236
+ })(), st = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", ct = (e) => e instanceof Error && e._voltroControl === "not-found", lt = {
237
237
  ".html": "text/html; charset=utf-8",
238
238
  ".js": "application/javascript",
239
239
  ".mjs": "application/javascript",
@@ -251,13 +251,13 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
251
251
  ".woff": "font/woff",
252
252
  ".woff2": "font/woff2",
253
253
  ".txt": "text/plain; charset=utf-8"
254
- }, lt = (e) => ct[V(e).toLowerCase()] ?? "application/octet-stream", ut = (e) => e.replace(/<script\b(?=[^>]*\btype="module")(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<script\b(?=[^>]*\bsrc=)(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<link\b[^>]*\brel="modulepreload"[^>]*>/gi, ""), dt = async (e) => {
254
+ }, ut = (e) => lt[B(e).toLowerCase()] ?? "application/octet-stream", dt = (e) => e.replace(/<script\b(?=[^>]*\btype="module")(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<script\b(?=[^>]*\bsrc=)(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<link\b[^>]*\brel="modulepreload"[^>]*>/gi, ""), ft = async (e) => {
255
255
  try {
256
- return await U.stat(e), !0;
256
+ return await H.stat(e), !0;
257
257
  } catch {
258
258
  return !1;
259
259
  }
260
- }, ft = (e) => {
260
+ }, pt = (e) => {
261
261
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
262
262
  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, "\\$&"));
263
263
  let a = i.join("/");
@@ -266,8 +266,8 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
266
266
  paramNames: t,
267
267
  priority: n
268
268
  };
269
- }, pt = (e) => e.map((e) => {
270
- let { regex: t, paramNames: n, priority: r } = ft(e.pattern);
269
+ }, mt = (e) => e.map((e) => {
270
+ let { regex: t, paramNames: n, priority: r } = pt(e.pattern);
271
271
  return {
272
272
  pattern: e.pattern,
273
273
  file: e.file,
@@ -276,7 +276,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
276
276
  paramNames: n,
277
277
  priority: r
278
278
  };
279
- }).slice().sort((e, t) => e.priority - t.priority), mt = (e, t) => {
279
+ }).slice().sort((e, t) => e.priority - t.priority), ht = (e, t) => {
280
280
  for (let n of t) {
281
281
  let t = n.regex.exec(e);
282
282
  if (!t) continue;
@@ -288,261 +288,271 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
288
288
  };
289
289
  }
290
290
  return null;
291
- }, ht = null, gt = async (e) => {
292
- let { provider: t, route: n, params: r, pathname: a, dirs: s, shellTemplate: d, requestHeaders: h, requestUrl: _ = "", apiOrigin: ne, apiName: re } = e, { search: v } = oe(_), y = await ee(te(e.middlewares ?? [], {
291
+ }, gt = null, _t, vt = (e, t) => t === void 0 ? Promise.resolve() : (_t ??= (async () => {
292
+ try {
293
+ let n = await e.getHelpers(), r = n.apiDescriptors?.[t];
294
+ if (r === void 0) return;
295
+ let i = n.registerSsrApiDescriptors;
296
+ if (i === void 0) return;
297
+ i(t, await r());
298
+ } catch {}
299
+ })(), _t), yt = async (e) => {
300
+ let { provider: t, route: n, params: r, pathname: a, dirs: s, shellTemplate: d, requestHeaders: m, requestUrl: g = "", apiOrigin: re, apiName: ie } = e;
301
+ await vt(t, ie);
302
+ let { search: _ } = se(g), v = await ee(ne(e.middlewares ?? [], {
293
303
  route: n.pattern,
294
304
  pathname: a
295
305
  }), {
296
306
  pathname: a,
297
- search: v,
298
- headers: h,
299
- cookies: u(h.cookie),
307
+ search: _,
308
+ headers: m,
309
+ cookies: u(m.cookie),
300
310
  route: n.pattern
301
- }, e.onCookieWarning), b = await t.getPage(n.pattern, n.file), S = e.forceSsrRender === !0 ? "ssr" : R(b, n.file), ie = S === "isr" && b.ppr === !0, E = S === "isr" && e.holesOnly !== !0 ? i(y.headers) : y.headers, D = ge(ne, E.cookie, {
302
- apiName: re,
303
- headers: E
311
+ }, e.onCookieWarning), y = await t.getPage(n.pattern, n.file), x = e.forceSsrRender === !0 ? "ssr" : L(y, n.file), ae = x === "isr" && y.ppr === !0, T = x === "isr" && e.holesOnly !== !0 ? i(v.headers) : v.headers, E = _e(re, T.cookie, {
312
+ apiName: ie,
313
+ headers: T
304
314
  });
305
315
  if (e.holesOnly === !0) {
306
- if (typeof b.loader != "function") return null;
316
+ if (typeof y.loader != "function") return null;
307
317
  let e = new AbortController();
308
318
  return {
309
319
  holes: {
310
- loader: b.loader,
320
+ loader: y.loader,
311
321
  ctx: {
312
322
  params: r,
313
323
  pathname: a,
314
- search: v,
324
+ search: _,
315
325
  signal: e.signal,
316
- headers: E,
317
- query: D,
326
+ headers: T,
327
+ query: E,
318
328
  isServer: !0
319
329
  },
320
330
  helpers: await t.getHelpers(),
321
331
  page: n.pattern
322
332
  },
323
- setCookies: y.setCookies
333
+ setCookies: v.setCookies
324
334
  };
325
335
  }
326
- let O = S === "spa" && pe(s, n.dirChain).some((e) => e.hasLayout);
327
- if (S !== "ssr" && S !== "isr" && !O) return null;
328
- let se = pe(s, n.dirChain), ce = {}, le = null, ue, de = new AbortController(), k = ie ? c(E, n.pattern) : E;
336
+ let D = x === "spa" && me(s, n.dirChain).some((e) => e.hasLayout);
337
+ if (x !== "ssr" && x !== "isr" && !D) return null;
338
+ let ce = me(s, n.dirChain), le = {}, ue = null, de, fe = new AbortController(), O = ae ? c(T, n.pattern) : T;
329
339
  try {
330
- (await t.getHelpers()).beginStoreSeeds(), {chain: ue, segmentLoaderData: ce} = await I({
331
- entries: se,
340
+ (await t.getHelpers()).beginStoreSeeds(), {chain: de, segmentLoaderData: le} = await F({
341
+ entries: ce,
332
342
  loadLayout: (e) => t.getLayout(e.dir),
333
343
  loadError: (e) => t.getError(e.dir),
334
344
  loadPending: (e) => t.getPending(e.dir),
335
345
  ctx: {
336
346
  params: r,
337
347
  pathname: a,
338
- search: v,
339
- signal: de.signal,
340
- headers: k,
341
- query: D,
348
+ search: _,
349
+ signal: fe.signal,
350
+ headers: O,
351
+ query: E,
342
352
  isServer: !0
343
353
  }
344
- }), typeof b.loader == "function" && !O && (le = await b.loader({
354
+ }), typeof y.loader == "function" && !D && (ue = await y.loader({
345
355
  params: r,
346
356
  pathname: a,
347
- search: v,
348
- signal: de.signal,
349
- headers: k,
350
- query: D,
357
+ search: _,
358
+ signal: fe.signal,
359
+ headers: O,
360
+ query: E,
351
361
  isServer: !0
352
362
  }));
353
363
  } catch (e) {
354
- if (ot(e)) return {
364
+ if (st(e)) return {
355
365
  control: "redirect",
356
366
  status: e.status,
357
367
  location: e.location,
358
- setCookies: y.setCookies,
359
- responseHeaders: y.responseHeaders
368
+ setCookies: v.setCookies,
369
+ responseHeaders: v.responseHeaders
360
370
  };
361
- if (st(e)) return {
371
+ if (ct(e)) return {
362
372
  control: "not-found",
363
- setCookies: y.setCookies,
364
- responseHeaders: y.responseHeaders
373
+ setCookies: v.setCookies,
374
+ responseHeaders: v.responseHeaders
365
375
  };
366
376
  throw e;
367
377
  }
368
- let A = await t.getHelpers();
369
- O || await xe({
370
- pageMod: b,
378
+ let k = await t.getHelpers();
379
+ D || await Se({
380
+ pageMod: y,
371
381
  params: r,
372
- query: D,
373
- apiName: re,
374
- seed: A.seedPreloadedSubscription,
375
- seedFailure: A.seedPreloadedSubscriptionFailure,
376
- onError: ({ tag: e, apiName: t }, n) => Q.warn("preload seed failed", {
382
+ query: E,
383
+ apiName: ie,
384
+ seed: k.seedPreloadedSubscription,
385
+ seedFailure: k.seedPreloadedSubscriptionFailure,
386
+ onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
377
387
  tag: e,
378
388
  apiName: t,
379
389
  pathname: a
380
390
  }, n)
381
391
  });
382
- let me = {
392
+ let he = {
383
393
  pattern: n.pattern,
384
- Component: b.default,
385
- meta: b.meta,
386
- loader: b.loader,
387
- ErrorBoundary: b.ErrorBoundary,
388
- Pending: b.Pending,
389
- renderMode: S,
390
- chain: ue
394
+ Component: y.default,
395
+ meta: y.meta,
396
+ loader: y.loader,
397
+ ErrorBoundary: y.ErrorBoundary,
398
+ Pending: y.Pending,
399
+ renderMode: x,
400
+ chain: de
391
401
  };
392
- if (S === "isr" && y.cspNonce !== void 0) throw Error(`page '${n.pattern}' is renderMode 'isr' while middleware.ts mints a cspNonce — an isr render is CACHED and a cached nonce is a lie the browser enforces. Use renderMode 'ssr' for nonce'd pages, or a hash-based CSP for isr.`);
393
- let he = {
394
- cookies: ie ? l(fe(y.cookies), n.pattern) : S === "isr" ? fe(y.cookies) : y.cookies,
395
- headers: k,
396
- url: _,
402
+ if (x === "isr" && v.cspNonce !== void 0) throw Error(`page '${n.pattern}' is renderMode 'isr' while middleware.ts mints a cspNonce — an isr render is CACHED and a cached nonce is a lie the browser enforces. Use renderMode 'ssr' for nonce'd pages, or a hash-based CSP for isr.`);
403
+ let ge = {
404
+ cookies: ae ? l(pe(v.cookies), n.pattern) : x === "isr" ? pe(v.cookies) : v.cookies,
405
+ headers: O,
406
+ url: g,
397
407
  ...e.formFlash === void 0 ? {} : { formFlash: e.formFlash }
398
- }, j = A.i18n?.resolve(E.cookie, E["accept-language"]), M = {
399
- lang: j?.locale ?? he.cookies["voltro:locale"] ?? "en",
400
- ...j?.timeZone === void 0 ? {} : { timeZone: j.timeZone },
408
+ }, A = k.i18n?.resolve(T.cookie, T["accept-language"]), j = {
409
+ lang: A?.locale ?? ge.cookies["voltro:locale"] ?? "en",
410
+ ...A?.timeZone === void 0 ? {} : { timeZone: A.timeZone },
401
411
  renderedAt: Date.now()
402
- }, N = b.interactive ?? "full";
403
- if (O) {
404
- let e = F({
405
- helpers: A,
412
+ }, M = y.interactive ?? "full";
413
+ if (D) {
414
+ let e = P({
415
+ helpers: k,
406
416
  page: n.pattern,
407
- interactive: N,
417
+ interactive: M,
408
418
  delivery: "stream",
409
419
  renderInput: {
410
- descriptor: me,
420
+ descriptor: he,
411
421
  params: r,
412
422
  pathname: a,
413
- search: v,
414
- segmentLoaderData: ce,
415
- requestContext: he,
416
- ...j ? {
417
- outerWrap: j.outerWrap,
418
- locale: j.locale
423
+ search: _,
424
+ segmentLoaderData: le,
425
+ requestContext: ge,
426
+ ...A ? {
427
+ outerWrap: A.outerWrap,
428
+ locale: A.locale
419
429
  } : {}
420
430
  }
421
- }), t = (t) => T({
422
- helpers: A,
431
+ }), t = (t) => w({
432
+ helpers: k,
423
433
  prepared: e,
424
434
  meta: t,
425
- interactive: N
435
+ interactive: M
426
436
  });
427
437
  if (e.hasDeferred) {
428
438
  let n = f({ shell: d });
429
439
  return {
430
440
  renderMode: "spa",
431
- setCookies: y.setCookies,
432
- responseHeaders: y.responseHeaders,
433
- stream: (r) => ae({
441
+ setCookies: v.setCookies,
442
+ responseHeaders: v.responseHeaders,
443
+ stream: (r) => oe({
434
444
  res: r,
435
445
  shell: n,
436
- documentAttrs: M,
446
+ documentAttrs: j,
437
447
  headers: {
438
- ...y.responseHeaders,
448
+ ...v.responseHeaders,
439
449
  "content-type": "text/html; charset=utf-8",
440
450
  "x-voltro-rendered-by": "spa",
441
- ...g(y.setCookies)
451
+ ...h(v.setCookies)
442
452
  },
443
453
  headInjection: t,
444
- ...y.cspNonce === void 0 ? {} : { nonce: y.cspNonce },
445
- render: (t) => A.renderPageToStream({
454
+ ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce },
455
+ render: (t) => k.renderPageToStream({
446
456
  ...e.renderInput,
447
457
  ...t,
448
- ...y.cspNonce === void 0 ? {} : { nonce: y.cspNonce }
458
+ ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce }
449
459
  }),
450
460
  onShellError: (e) => {
451
- Q.error("spa layout shell render failed", { pathname: a }, e), r.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), r.end("server error");
461
+ Z.error("spa layout shell render failed", { pathname: a }, e), r.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), r.end("server error");
452
462
  }
453
463
  })
454
464
  };
455
465
  }
456
- let i = p({
457
- helpers: A,
466
+ let i = te({
467
+ helpers: k,
458
468
  prepared: e
459
- }), s = o(w(d.replace("<div id=\"root\"></div>", `<div id="root">${i.body}</div>`), t(i.meta)), M);
469
+ }), s = o(C(d.replace("<div id=\"root\"></div>", `<div id="root">${i.body}</div>`), t(i.meta)), j);
460
470
  return {
461
- html: y.cspNonce === void 0 ? s : C(s, y.cspNonce),
471
+ html: v.cspNonce === void 0 ? s : S(s, v.cspNonce),
462
472
  renderMode: "spa",
463
473
  revalidateMs: null,
464
- setCookies: y.setCookies,
465
- responseHeaders: y.responseHeaders
474
+ setCookies: v.setCookies,
475
+ responseHeaders: v.responseHeaders
466
476
  };
467
477
  }
468
- let P = m({
469
- helpers: A,
478
+ let N = p({
479
+ helpers: k,
470
480
  page: n.pattern,
471
481
  pathname: a,
472
- renderMode: S,
473
- interactive: N,
474
- loaderData: le,
475
- segmentLoaderData: ce,
476
- pageLoaderRan: typeof b.loader == "function",
477
- ...ie ? { ppr: !0 } : {}
482
+ renderMode: x,
483
+ interactive: M,
484
+ loaderData: ue,
485
+ segmentLoaderData: le,
486
+ pageLoaderRan: typeof y.loader == "function",
487
+ ...ae ? { ppr: !0 } : {}
478
488
  });
479
- ie && x(P.stateInput, n.pattern);
480
- let _e = {
481
- descriptor: me,
489
+ ae && b(N.stateInput, n.pattern);
490
+ let ve = {
491
+ descriptor: he,
482
492
  params: r,
483
493
  pathname: a,
484
- search: v,
485
- loaderData: P.loaderData,
486
- segmentLoaderData: P.segmentLoaderData,
487
- requestContext: he,
488
- ...j ? {
489
- outerWrap: j.outerWrap,
490
- locale: j.locale
494
+ search: _,
495
+ loaderData: N.loaderData,
496
+ segmentLoaderData: N.segmentLoaderData,
497
+ requestContext: ge,
498
+ ...A ? {
499
+ outerWrap: A.outerWrap,
500
+ locale: A.locale
491
501
  } : {}
492
- }, ve = (t) => {
493
- if (ht === null || S !== "ssr" && S !== "isr" || typeof b.ogImage != "function" || t.includes("og:image")) return "";
494
- let r = E["x-tenant"], i = ht.signOgUrl({
502
+ }, ye = (t) => {
503
+ if (gt === null || x !== "ssr" && x !== "isr" || typeof y.ogImage != "function" || t.includes("og:image")) return "";
504
+ let r = T["x-tenant"], i = gt.signOgUrl({
495
505
  pattern: n.pattern,
496
506
  params: e.params,
497
507
  ...r === void 0 ? {} : { tenant: r }
498
508
  });
499
509
  return `<meta property="og:image" content="${i}" /><meta name="twitter:image" content="${i}" /><meta name="twitter:card" content="summary_large_image" />`;
500
- }, ye = (e) => [
501
- A.renderMetaToHtml(e) + ve(A.renderMetaToHtml(e)),
502
- `<meta name="voltro-interactive" content="${N}" />`,
503
- ...P.hasDeferred ? [A.renderDeferredRegistryScript()] : [],
504
- A.renderRouterStateScript(P.stateInput)
510
+ }, be = (e) => [
511
+ k.renderMetaToHtml(e) + ye(k.renderMetaToHtml(e)),
512
+ `<meta name="voltro-interactive" content="${M}" />`,
513
+ ...N.hasDeferred ? [k.renderDeferredRegistryScript()] : [],
514
+ k.renderRouterStateScript(N.stateInput)
505
515
  ].filter((e) => e.length > 0).join("\n ");
506
- if (S === "ssr" && N === "full" && e.buffered !== !0) {
516
+ if (x === "ssr" && M === "full" && e.buffered !== !0) {
507
517
  let e = f({ shell: d });
508
518
  return {
509
519
  renderMode: "ssr",
510
- setCookies: y.setCookies,
511
- stream: (t) => ae({
520
+ setCookies: v.setCookies,
521
+ stream: (t) => oe({
512
522
  res: t,
513
523
  shell: e,
514
- documentAttrs: M,
524
+ documentAttrs: j,
515
525
  headers: {
516
- ...y.responseHeaders,
526
+ ...v.responseHeaders,
517
527
  "content-type": "text/html; charset=utf-8",
518
528
  "x-voltro-rendered-by": "ssr",
519
- ...g(y.setCookies)
529
+ ...h(v.setCookies)
520
530
  },
521
- headInjection: ye,
522
- ...y.cspNonce === void 0 ? {} : { nonce: y.cspNonce },
523
- render: (e) => A.renderPageToStream({
524
- ..._e,
531
+ headInjection: be,
532
+ ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce },
533
+ render: (e) => k.renderPageToStream({
534
+ ...ve,
525
535
  ...e,
526
- ...y.cspNonce === void 0 ? {} : { nonce: y.cspNonce }
536
+ ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce }
527
537
  }),
528
538
  onShellError: (e) => {
529
- Q.error("ssr shell render failed", { pathname: a }, e), t.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), t.end("server error");
539
+ Z.error("ssr shell render failed", { pathname: a }, e), t.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), t.end("server error");
530
540
  }
531
541
  })
532
542
  };
533
543
  }
534
- let { html: be, meta: Se } = A.renderPageToHtml(_e), Ce = ye(Se), L = o(w(d.replace("<div id=\"root\"></div>", `<div id="root">${be}</div>`), Ce), M);
535
- N === "none" && (L = ut(L));
536
- let we = S === "isr" ? z(b.revalidate) : null;
544
+ let { html: xe, meta: Ce } = k.renderPageToHtml(ve), we = be(Ce), I = o(C(d.replace("<div id=\"root\"></div>", `<div id="root">${xe}</div>`), we), j);
545
+ M === "none" && (I = dt(I));
546
+ let Te = x === "isr" ? R(y.revalidate) : null;
537
547
  return {
538
- html: y.cspNonce === void 0 ? L : C(L, y.cspNonce),
539
- renderMode: S,
540
- revalidateMs: we,
541
- setCookies: y.setCookies,
542
- responseHeaders: y.responseHeaders
548
+ html: v.cspNonce === void 0 ? I : S(I, v.cspNonce),
549
+ renderMode: x,
550
+ revalidateMs: Te,
551
+ setCookies: v.setCookies,
552
+ responseHeaders: v.responseHeaders
543
553
  };
544
- }, $ = (e) => e === "" ? "/" : e, _t = async (e) => {
545
- let t = await import(W(e).href);
554
+ }, Q = (e) => e === "" ? "/" : e, bt = async (e) => {
555
+ let t = await import(U(e).href);
546
556
  return {
547
557
  kind: "bundle",
548
558
  getPageMeta: () => t.pageMeta,
@@ -552,18 +562,18 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
552
562
  return typeof r == "function" ? await r() : r;
553
563
  },
554
564
  async getLayout(e) {
555
- let n = t.layouts[$(e)];
556
- if (!n) throw Error(`[voltro start] ssr bundle missing layout for dir ${$(e)}`);
565
+ let n = t.layouts[Q(e)];
566
+ if (!n) throw Error(`[voltro start] ssr bundle missing layout for dir ${Q(e)}`);
557
567
  return typeof n == "function" ? await n() : n;
558
568
  },
559
569
  async getError(e) {
560
- let n = t.errors[$(e)];
561
- if (!n) throw Error(`[voltro start] ssr bundle missing error for dir ${$(e)}`);
570
+ let n = t.errors[Q(e)];
571
+ if (!n) throw Error(`[voltro start] ssr bundle missing error for dir ${Q(e)}`);
562
572
  return typeof n == "function" ? await n() : n;
563
573
  },
564
574
  async getPending(e) {
565
- let n = t.pendings[$(e)];
566
- if (!n) throw Error(`[voltro start] ssr bundle missing pending for dir ${$(e)}`);
575
+ let n = t.pendings[Q(e)];
576
+ if (!n) throw Error(`[voltro start] ssr bundle missing pending for dir ${Q(e)}`);
567
577
  return typeof n == "function" ? await n() : n;
568
578
  },
569
579
  async getHelpers() {
@@ -571,8 +581,8 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
571
581
  },
572
582
  async close() {}
573
583
  };
574
- }, vt = async (e, t) => {
575
- let n = await h("vite", () => import("vite")), r = (await import("@vitejs/plugin-react")).default, i = (await import("@tailwindcss/vite")).default, a = await n.createServer({
584
+ }, xt = async (e, t) => {
585
+ let n = await m("vite", () => import("vite")), r = (await import("@vitejs/plugin-react")).default, i = (await import("@tailwindcss/vite")).default, a = await n.createServer({
576
586
  root: t,
577
587
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
578
588
  plugins: [r(), i()],
@@ -589,10 +599,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
589
599
  },
590
600
  appType: "custom",
591
601
  logLevel: "warn"
592
- }), o = H(e, "src", "pages"), s = (e) => e === "" ? o : H(o, e), c = k({
593
- limit: _(),
594
- onColdStart: (e) => Q.debug("ssr cold-compile start", { id: e }),
595
- onColdEnd: (e, { durationMs: t, failed: n }) => Q.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
602
+ }), o = V(e, "src", "pages"), s = (e) => e === "" ? o : V(o, e), c = O({
603
+ limit: g(),
604
+ onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
605
+ onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
596
606
  id: e,
597
607
  ms: t,
598
608
  ...n ? { failed: !0 } : {}
@@ -601,16 +611,16 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
601
611
  return {
602
612
  kind: "middleware",
603
613
  async getPage(e, t) {
604
- return l(H(o, t));
614
+ return l(V(o, t));
605
615
  },
606
616
  async getLayout(e) {
607
- return l(H(s(e), "layout.tsx"));
617
+ return l(V(s(e), "layout.tsx"));
608
618
  },
609
619
  async getError(e) {
610
- return l(H(s(e), "error.tsx"));
620
+ return l(V(s(e), "error.tsx"));
611
621
  },
612
622
  async getPending(e) {
613
- return l(H(s(e), "loading.tsx"));
623
+ return l(V(s(e), "loading.tsx"));
614
624
  },
615
625
  async getHelpers() {
616
626
  return await l("@voltro/web/ssr");
@@ -619,173 +629,173 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
619
629
  await a.close();
620
630
  }
621
631
  };
622
- }, yt = async (t) => {
623
- let i = He(), o = await _e(t);
632
+ }, $ = async (t) => {
633
+ let i = Ue(), o = await ve(t);
624
634
  if (!o) return {
625
635
  ran: !1,
626
636
  exitCode: 0
627
637
  };
628
- if (o.type !== "web") return Q.error("only web apps are supported by `voltro start`"), {
638
+ if (o.type !== "web") return Z.error("only web apps are supported by `voltro start`"), {
629
639
  ran: !0,
630
640
  exitCode: 1
631
641
  };
632
642
  {
633
- let e = b(o);
634
- if (e !== void 0) return Q.error(`voltro start: refusing to boot — ${e}`), {
643
+ let e = y(o);
644
+ if (e !== void 0) return Z.error(`voltro start: refusing to boot — ${e}`), {
635
645
  ran: !0,
636
646
  exitCode: 1
637
647
  };
638
648
  }
639
- let { resolved: c } = await ie({
649
+ let { resolved: c } = await ae({
640
650
  rawEnv: o.env,
641
651
  appType: "web",
642
652
  root: t,
643
- log: Q,
653
+ log: Z,
644
654
  generateTypes: !1
645
655
  }), l = c.publicValues;
646
656
  i.mark("config");
647
- let f = se();
648
- D(f), Q.info("booting voltro start", { app: o.name ?? "(unnamed)" });
649
- let p = n({
657
+ let f = ce();
658
+ E(f), Z.info("booting voltro start", { app: o.name ?? "(unnamed)" });
659
+ let te = n({
650
660
  kind: "web",
651
661
  configPort: o.port,
652
662
  env: process.env,
653
- dashboardPin: process.env[E] === "1"
663
+ dashboardPin: process.env[T] === "1"
654
664
  });
655
- for (let e of p.warnings) Q.warn(e);
656
- let m = p.port, h = H(t, ".framework"), g = H(h, "dist"), _ = H(g, "index.html");
657
- if (!await dt(_)) return Q.error("no built dist found — run `voltro build` first", { distDir: g }), {
665
+ for (let e of te.warnings) Z.warn(e);
666
+ let p = te.port, m = V(t, ".framework"), h = V(m, "dist"), g = V(h, "index.html");
667
+ if (!await ft(g)) return Z.error("no built dist found — run `voltro build` first", { distDir: h }), {
658
668
  ran: !0,
659
669
  exitCode: 1
660
670
  };
661
- let x = o.name ?? "unnamed", C = Be("web", x, m), w = Ve(x);
662
- await Le({
663
- id: C,
664
- name: x,
671
+ let b = o.name ?? "unnamed", S = Ve("web", b, p), C = He(b);
672
+ await Re({
673
+ id: S,
674
+ name: b,
665
675
  kind: "web",
666
- url: `http://localhost:${m}`,
676
+ url: `http://localhost:${p}`,
667
677
  pid: process.pid,
668
678
  status: "booting",
669
- logFile: w.path
679
+ logFile: C.path
670
680
  }).catch(() => {});
671
- let ae = H(g, "_voltro", "shell.html"), T = await dt(ae) ? await U.readFile(ae, "utf8") : await U.readFile(_, "utf8"), k = await he(t, o), fe = ke(o), F = M(k[0]), I = k[0]?.name, xe = /* @__PURE__ */ new Set(), R = (e) => {
672
- xe.has(e.name) || (xe.add(e.name), Q.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
681
+ let oe = V(h, "_voltro", "shell.html"), w = await ft(oe) ? await H.readFile(oe, "utf8") : await H.readFile(g, "utf8"), O = await ge(t, o), pe = Ae(o), P = j(O[0]), F = O[0]?.name, Se = /* @__PURE__ */ new Set(), L = (e) => {
682
+ Se.has(e.name) || (Se.add(e.name), Z.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
673
683
  cookie: e.name,
674
684
  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."
675
685
  }));
676
- }, z = await ne(t);
677
- z.length > 0 && Q.info(`middleware.ts loaded — ${z.length} middleware(s): ` + z.map((e) => e.exportName).join(", "));
678
- let B, V = null, Ue = process.env.SSR_CACHE === "postgres";
679
- if (Ue && Ce()) V = new (await (import("pg"))).default.Client(Se()), await V.connect(), B = nt({ client: V }), Q.info("isr cache backend: postgres", { table: "voltro_isr_cache" });
680
- else if (Ue) {
686
+ }, R = await re(t);
687
+ R.length > 0 && Z.info(`middleware.ts loaded — ${R.length} middleware(s): ` + R.map((e) => e.exportName).join(", "));
688
+ let z, B = null, We = process.env.SSR_CACHE === "postgres";
689
+ if (We && we()) B = new (await (import("pg"))).default.Client(Ce()), await B.connect(), z = rt({ client: B }), Z.info("isr cache backend: postgres", { table: "voltro_isr_cache" });
690
+ else if (We) {
681
691
  let t = "SSR_CACHE=postgres, but nothing in the environment names a database (looked for DB_URL, DB_PRIMARY_URL, DB_DIRECT_URL, DB_MIGRATE_URL, DB_HOST, PG_HOST).";
682
- if (e()) throw Q.fatal(`${t} Refusing to fall back to the per-process memory cache: it is not shared between instances and does not survive a restart, so the pages this process serves would differ from its replicas' with nothing to indicate it.`), Error("[voltro start] SSR_CACHE=postgres with no database configured");
683
- B = Pe(), Q.warn(`${t} Falling back to the per-process memory cache — this would be a hard failure in production.`);
684
- } else B = Pe(), Q.info("isr cache backend: memory (per-process)", { hint: "set SSR_CACHE=postgres for persistent storage" });
685
- await s(t, o, k, l);
686
- let We = H(t, "src", "pages"), { pages: W, dirs: G } = await be(We), K = pt(W);
687
- de(z, K.map((e) => e.pattern)), i.mark("scan");
688
- let q = H(g, "server", "ssrEntry.js"), Xe = await dt(q);
689
- if (!Xe && process.env.NODE_ENV === "production") throw Q.fatal(`production \`voltro start\` requires a precompiled SSR bundle at ${q} but it is missing. Run \`voltro build\` before serving — production renders from the bundle and never compiles on demand.`), Error(`[voltro start] missing SSR bundle at ${q}`);
690
- let J = Xe ? await _t(q) : await vt(t, h);
691
- Q.info(`ssr loader: ${J.kind}`, {
692
- kind: J.kind,
693
- ...J.kind === "middleware" ? { hint: "no pre-built SSR bundle found; run `voltro build` to enable bundle mode" } : {}
692
+ if (e()) throw Z.fatal(`${t} Refusing to fall back to the per-process memory cache: it is not shared between instances and does not survive a restart, so the pages this process serves would differ from its replicas' with nothing to indicate it.`), Error("[voltro start] SSR_CACHE=postgres with no database configured");
693
+ z = Fe(), Z.warn(`${t} Falling back to the per-process memory cache — this would be a hard failure in production.`);
694
+ } else z = Fe(), Z.info("isr cache backend: memory (per-process)", { hint: "set SSR_CACHE=postgres for persistent storage" });
695
+ await s(t, o, O, l);
696
+ let Ge = V(t, "src", "pages"), { pages: U, dirs: W } = await xe(Ge), G = mt(U);
697
+ fe(R, G.map((e) => e.pattern)), i.mark("scan");
698
+ let K = V(h, "server", "ssrEntry.js"), Ze = await ft(K);
699
+ if (!Ze && process.env.NODE_ENV === "production") throw Z.fatal(`production \`voltro start\` requires a precompiled SSR bundle at ${K} but it is missing. Run \`voltro build\` before serving — production renders from the bundle and never compiles on demand.`), Error(`[voltro start] missing SSR bundle at ${K}`);
700
+ let q = Ze ? await bt(K) : await xt(t, m);
701
+ Z.info(`ssr loader: ${q.kind}`, {
702
+ kind: q.kind,
703
+ ...q.kind === "middleware" ? { hint: "no pre-built SSR bundle found; run `voltro build` to enable bundle mode" } : {}
694
704
  }), i.mark("provider");
695
- let $e = J.getPageMeta?.();
696
- O(t);
697
- let Y = /* @__PURE__ */ new Map(), tt = 0;
698
- for (let e of W) {
699
- let t = $e?.[e.pattern];
705
+ let et = q.getPageMeta?.();
706
+ D(t);
707
+ let J = /* @__PURE__ */ new Map(), nt = 0;
708
+ for (let e of U) {
709
+ let t = et?.[e.pattern];
700
710
  if (t) {
701
- Y.set(e.pattern, t);
711
+ J.set(e.pattern, t);
702
712
  continue;
703
713
  }
704
714
  try {
705
- let t = await J.getPage(e.pattern, e.file);
706
- Y.set(e.pattern, Me(t, e.file)), tt++;
715
+ let t = await q.getPage(e.pattern, e.file);
716
+ J.set(e.pattern, Ne(t, e.file)), nt++;
707
717
  } catch (t) {
708
- Q.warn("failed to load page metadata", { pattern: e.pattern }, t);
718
+ Z.warn("failed to load page metadata", { pattern: e.pattern }, t);
709
719
  }
710
720
  }
711
- let X = /* @__PURE__ */ new Map();
712
- for (let [e, t] of Y) {
721
+ let Y = /* @__PURE__ */ new Map();
722
+ for (let [e, t] of J) {
713
723
  if (t.interactive !== "islands") continue;
714
- let n = H(g, "island-shells", `${S(e)}.html`);
724
+ let n = V(h, "island-shells", `${x(e)}.html`);
715
725
  try {
716
- X.set(e, await U.readFile(n, "utf8"));
726
+ Y.set(e, await H.readFile(n, "utf8"));
717
727
  } catch {
718
- Q.warn("islands page has no built per-page shell — serving the full app shell", {
728
+ Z.warn("islands page has no built per-page shell — serving the full app shell", {
719
729
  pattern: e,
720
730
  expected: n
721
731
  });
722
732
  }
723
733
  }
724
- Q.info(`registered ${Y.size} route(s)`, {
725
- count: Y.size,
726
- fromManifest: Y.size - tt,
727
- fromModules: tt
734
+ Z.info(`registered ${J.size} route(s)`, {
735
+ count: J.size,
736
+ fromManifest: J.size - nt,
737
+ fromModules: nt
728
738
  }), i.mark("routes");
729
- let Z = /* @__PURE__ */ new Set();
730
- for (let e of K) Y.get(e.pattern)?.renderMode === "spa" && pe(G, e.dirChain).some((e) => e.hasLayout) && Z.add(e.pattern);
731
- Z.size > 0 && Q.info(`${Z.size} spa route(s) render an SSR layout shell`, { patterns: [...Z] });
732
- let ot = /* @__PURE__ */ new Map();
733
- for (let [e, t] of Y) t.cacheInvalidatesOn.length > 0 && ot.set(e, t.cacheInvalidatesOn);
739
+ let X = /* @__PURE__ */ new Set();
740
+ for (let e of G) J.get(e.pattern)?.renderMode === "spa" && me(W, e.dirChain).some((e) => e.hasLayout) && X.add(e.pattern);
741
+ X.size > 0 && Z.info(`${X.size} spa route(s) render an SSR layout shell`, { patterns: [...X] });
734
742
  let st = /* @__PURE__ */ new Map();
735
- for (let e of K) st.set(e.pattern, e.regex);
743
+ for (let [e, t] of J) t.cacheInvalidatesOn.length > 0 && st.set(e, t.cacheInvalidatesOn);
744
+ let ct = /* @__PURE__ */ new Map();
745
+ for (let e of G) ct.set(e.pattern, e.regex);
736
746
  {
737
- let n = new Set([...Y].filter(([, e]) => (e.renderMode === "ssr" || e.renderMode === "isr") && e.hasOgImage).map(([e]) => e));
747
+ let n = new Set([...J].filter(([, e]) => (e.renderMode === "ssr" || e.renderMode === "isr") && e.hasOgImage).map(([e]) => e));
738
748
  if (n.size > 0) {
739
- let { secret: r, fromEnv: i } = le();
740
- if (!i && e()) throw Q.fatal(`${n.size} ssr route(s) export ogImage, but VOLTRO_OG_SECRET is unset. Behind a load balancer the signing replica and the fetching replica differ, so a per-boot secret would 403 every cross-replica image fetch. Set VOLTRO_OG_SECRET (any long random value, same on every replica).`), Error("[voltro start] ssr ogImage routes need VOLTRO_OG_SECRET in a deploy environment");
741
- let a = new Map(W.map((e) => [e.pattern, e.file]));
742
- ht = j({
749
+ let { secret: r, fromEnv: i } = ue();
750
+ if (!i && e()) throw Z.fatal(`${n.size} ssr route(s) export ogImage, but VOLTRO_OG_SECRET is unset. Behind a load balancer the signing replica and the fetching replica differ, so a per-boot secret would 403 every cross-replica image fetch. Set VOLTRO_OG_SECRET (any long random value, same on every replica).`), Error("[voltro start] ssr ogImage routes need VOLTRO_OG_SECRET in a deploy environment");
751
+ let a = new Map(U.map((e) => [e.pattern, e.file]));
752
+ gt = A({
743
753
  root: t,
744
754
  fonts: o.fonts,
745
- cache: B,
755
+ cache: z,
746
756
  secret: r,
747
757
  isOgSsrRoute: (e) => n.has(e),
748
758
  getPageModule: async (e) => {
749
759
  let t = a.get(e);
750
- return t === void 0 ? null : await J.getPage(e, t);
760
+ return t === void 0 ? null : await q.getPage(e, t);
751
761
  }
752
- }), Q.info(`og route active for ${n.size} ssr route(s)`, { secret: i ? "env" : "per-boot" });
762
+ }), Z.info(`og route active for ${n.size} ssr route(s)`, { secret: i ? "env" : "per-boot" });
753
763
  }
754
764
  }
755
- let ct = /* @__PURE__ */ new Map();
756
- for (let [e, t] of Y) ct.set(e, t.renderMode);
757
- let ut = [...Y.values()].some((e) => e.renderMode === "isr"), ft = {
758
- cache: B,
759
- tableSink: Qe({
760
- cache: B,
761
- tableSubscriptionsByPattern: ot,
762
- regexByPattern: st
765
+ let lt = /* @__PURE__ */ new Map();
766
+ for (let [e, t] of J) lt.set(e, t.renderMode);
767
+ let dt = [...J.values()].some((e) => e.renderMode === "isr"), pt = {
768
+ cache: z,
769
+ tableSink: $e({
770
+ cache: z,
771
+ tableSubscriptionsByPattern: st,
772
+ regexByPattern: ct
763
773
  }),
764
- regexByPattern: st,
765
- renderModeByPattern: ct
766
- }, $ = (e) => {
767
- let t = rt(e);
768
- t && it(ft, t);
769
- }, yt = et({
770
- cache: B,
771
- tableSubscriptionsByPattern: ot,
772
- regexByPattern: st,
773
- ...ut ? { onRevalidate: $ } : {}
774
- }), bt = await yt.start(), xt = null, St = null;
775
- if (ut) {
776
- let e = Je({}, process.env);
774
+ regexByPattern: ct,
775
+ renderModeByPattern: lt
776
+ }, _t = (e) => {
777
+ let t = it(e);
778
+ t && at(pt, t);
779
+ }, vt = tt({
780
+ cache: z,
781
+ tableSubscriptionsByPattern: st,
782
+ regexByPattern: ct,
783
+ ...dt ? { onRevalidate: _t } : {}
784
+ }), Q = await vt.start(), $ = null, St = null;
785
+ if (dt) {
786
+ let e = Ye({}, process.env);
777
787
  if (e.crossReplica) try {
778
788
  St = e.provider;
779
- let t = Ae(process.env);
780
- xt = await Ke.runPromise(e.provider.subscribe(t, $)), Q.info(`revalidation subscriber: broker (${e.provider.name})`, { channel: t });
789
+ let t = je(process.env);
790
+ $ = await qe.runPromise(e.provider.subscribe(t, _t)), Z.info(`revalidation subscriber: broker (${e.provider.name})`, { channel: t });
781
791
  } catch (e) {
782
- Q.warn("revalidation broker subscribe failed — broker leg disabled", {}, e), St = null;
792
+ Z.warn("revalidation broker subscribe failed — broker leg disabled", {}, e), St = null;
783
793
  }
784
- bt && xt === null && Q.info("revalidation subscriber: postgres LISTEN (voltro_revalidate)"), !bt && xt === null && Q.warn("isr routes exist, but this web process has NO revalidation transport: no database is configured for the LISTEN line and no broker is configured. `revalidatePath` / `revalidateTable` / `revalidateTag` from the api will not reach this process — cached pages stay until their own `revalidate` window expires. Set DB_URL (postgres) or BROADCAST_URL (redis:// or nats://) on BOTH the api and this web deployment.");
794
+ Q && $ === null && Z.info("revalidation subscriber: postgres LISTEN (voltro_revalidate)"), !Q && $ === null && Z.warn("isr routes exist, but this web process has NO revalidation transport: no database is configured for the LISTEN line and no broker is configured. `revalidatePath` / `revalidateTable` / `revalidateTag` from the api will not reach this process — cached pages stay until their own `revalidate` window expires. Set DB_URL (postgres) or BROADCAST_URL (redis:// or nats://) on BOTH the api and this web deployment.");
785
795
  }
786
796
  i.mark("cdc");
787
- let Ct = je(), wt = W.map((e) => {
788
- let t = Y.get(e.pattern);
797
+ let Ct = Me(), wt = U.map((e) => {
798
+ let t = J.get(e.pattern);
789
799
  return {
790
800
  pattern: e.pattern,
791
801
  file: e.file,
@@ -800,18 +810,18 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
800
810
  hasMeta: t?.hasMeta ?? !1,
801
811
  hasGetStaticPaths: t?.hasGetStaticPaths ?? !1
802
812
  };
803
- }), Tt = G.map((e) => ({
813
+ }), Tt = W.map((e) => ({
804
814
  dir: e.dir,
805
815
  hasLayout: e.hasLayout,
806
816
  hasError: e.hasError,
807
817
  hasPending: e.hasPending,
808
818
  hasNotFound: e.hasNotFound
809
- })), Et = V ? "postgres" : "memory", Dt = {
819
+ })), Et = B ? "postgres" : "memory", Dt = {
810
820
  kind: "web",
811
821
  meta: {
812
822
  name: o.name ?? "(unnamed)",
813
- voltroVersion: at,
814
- port: m,
823
+ voltroVersion: ot,
824
+ port: p,
815
825
  mode: "start",
816
826
  apis: Object.entries(o.apis ?? {}).map(([e, t]) => {
817
827
  let n = {
@@ -824,7 +834,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
824
834
  routes: wt,
825
835
  dirs: Tt,
826
836
  cache: () => {
827
- let e = Date.now(), t = B.snapshot().map(([t, n]) => ({
837
+ let e = Date.now(), t = z.snapshot().map(([t, n]) => ({
828
838
  key: t,
829
839
  renderedAt: n.renderedAt,
830
840
  expiresAt: n.expiresAt,
@@ -836,15 +846,15 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
836
846
  }));
837
847
  return {
838
848
  backend: Et,
839
- size: B.size(),
849
+ size: z.size(),
840
850
  entries: t
841
851
  };
842
852
  },
843
- metrics: () => qe()
853
+ metrics: () => Je()
844
854
  }, Ot = async (e, n) => {
845
855
  let r = e.split("?")[0] ?? "/";
846
856
  if (o.name === "voltroDashboard" && r === "/api/dashboard/registry") try {
847
- let e = await Re();
857
+ let e = await ze();
848
858
  return {
849
859
  status: 200,
850
860
  headers: { "content-type": "application/json; charset=utf-8" },
@@ -886,8 +896,8 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
886
896
  body: JSON.stringify({ apps: t })
887
897
  };
888
898
  }
889
- if (ht !== null && r === "/_voltro/og") {
890
- let t = await ht.handle(new URL(e, "http://localhost"));
899
+ if (gt !== null && r === "/_voltro/og") {
900
+ let t = await gt.handle(new URL(e, "http://localhost"));
891
901
  if (t !== null) return {
892
902
  status: t.status,
893
903
  headers: { ...t.headers },
@@ -895,18 +905,18 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
895
905
  };
896
906
  }
897
907
  if (r === "/_voltro/inspect/logs") {
898
- let t = N(e, P(), n);
908
+ let t = M(e, N(), n);
899
909
  return {
900
910
  status: t.status,
901
911
  headers: {
902
912
  "content-type": t.contentType,
903
- ...we(n.origin)
913
+ ...Te(n.origin)
904
914
  },
905
915
  body: t.body
906
916
  };
907
917
  }
908
918
  if (r !== "/_voltro/inspect/stream") {
909
- let t = Ee(e, Dt, n);
919
+ let t = De(e, Dt, n);
910
920
  if (t !== null) return {
911
921
  status: t.status,
912
922
  headers: {
@@ -916,9 +926,9 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
916
926
  body: t.body
917
927
  };
918
928
  }
919
- let i = mt(r, K), a = i ? Y.get(i.route.pattern)?.renderMode : void 0, s = a === "ssr" || a === "isr" || (i ? Z.has(i.route.pattern) : !1), c = [];
920
- if (!s && z.length > 0) {
921
- let t = te(z, {
929
+ let i = ht(r, G), a = i ? J.get(i.route.pattern)?.renderMode : void 0, s = a === "ssr" || a === "isr" || (i ? X.has(i.route.pattern) : !1), c = [];
930
+ if (!s && R.length > 0) {
931
+ let t = ne(R, {
922
932
  route: void 0,
923
933
  pathname: r
924
934
  });
@@ -935,10 +945,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
935
945
  }
936
946
  let l = (e) => c.length === 0 ? e : {
937
947
  ...e,
938
- "set-cookie": c.map(y)
939
- }, p = r === "/" ? H(g, "index.html") : H(g, r.replace(/^\//, ""), "index.html");
940
- if (!s && await dt(p)) {
941
- let e = await U.readFile(p);
948
+ "set-cookie": c.map(v)
949
+ }, te = r === "/" ? V(h, "index.html") : V(h, r.replace(/^\//, ""), "index.html");
950
+ if (!s && await ft(te)) {
951
+ let e = await H.readFile(te);
942
952
  return {
943
953
  status: 200,
944
954
  headers: l({ "content-type": "text/html; charset=utf-8" }),
@@ -946,22 +956,22 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
946
956
  };
947
957
  }
948
958
  if (/\.[a-z0-9]+$/i.test(r)) {
949
- let e = H(g, r.replace(/^\//, ""));
950
- if (await dt(e)) {
951
- let t = await U.readFile(e);
959
+ let e = V(h, r.replace(/^\//, ""));
960
+ if (await ft(e)) {
961
+ let t = await H.readFile(e);
952
962
  return {
953
963
  status: 200,
954
- headers: l({ "content-type": lt(e) }),
964
+ headers: l({ "content-type": ut(e) }),
955
965
  body: t
956
966
  };
957
967
  }
958
968
  }
959
- let m = mt(r, K);
960
- if (!m) {
961
- let i = ue(G, r);
969
+ let p = ht(r, G);
970
+ if (!p) {
971
+ let i = de(W, r);
962
972
  if (i !== void 0) try {
963
- let a = await gt({
964
- provider: J,
973
+ let a = await yt({
974
+ provider: q,
965
975
  root: t,
966
976
  route: {
967
977
  pattern: "<not-found>",
@@ -973,13 +983,13 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
973
983
  },
974
984
  params: {},
975
985
  pathname: r,
976
- dirs: G,
977
- shellTemplate: T,
986
+ dirs: W,
987
+ shellTemplate: w,
978
988
  requestHeaders: n,
979
- apiOrigin: F,
980
- apiName: I,
981
- middlewares: z,
982
- onCookieWarning: R,
989
+ apiOrigin: P,
990
+ apiName: F,
991
+ middlewares: R,
992
+ onCookieWarning: L,
983
993
  requestUrl: e,
984
994
  buffered: !0,
985
995
  forceSsrRender: !0
@@ -993,7 +1003,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
993
1003
  body: a.html
994
1004
  };
995
1005
  } catch (e) {
996
- Q.warn("not-found.tsx failed to render — serving the plain 404", { pathname: r }, e instanceof Error ? e : Error(String(e)));
1006
+ Z.warn("not-found.tsx failed to render — serving the plain 404", { pathname: r }, e instanceof Error ? e : Error(String(e)));
997
1007
  }
998
1008
  return {
999
1009
  status: 404,
@@ -1004,139 +1014,139 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1004
1014
  body: "not found"
1005
1015
  };
1006
1016
  }
1007
- let h = Y.get(m.route.pattern), _ = n["x-tenant"] ?? "anonymous", ne = (await J.getHelpers()).i18n?.resolve(n.cookie, n["accept-language"])?.locale, v = Fe(r, {
1008
- ...h?.tenantAware ? { tenant: _ } : {},
1009
- ...ne ? { locale: ne } : {}
1010
- }), b = h?.ppr === !0 && h.renderMode === "isr", x = (i, a) => ({
1017
+ let m = J.get(p.route.pattern), g = n["x-tenant"] ?? "anonymous", re = (await q.getHelpers()).i18n?.resolve(n.cookie, n["accept-language"])?.locale, _ = Ie(r, {
1018
+ ...m?.tenantAware ? { tenant: g } : {},
1019
+ ...re ? { locale: re } : {}
1020
+ }), y = m?.ppr === !0 && m.renderMode === "isr", b = (i, a) => ({
1011
1021
  status: 200,
1012
1022
  headers: {},
1013
1023
  body: "",
1014
1024
  stream: (o) => {
1015
- re(m.route.pattern), o.writeHead(200, {
1025
+ ie(p.route.pattern), o.writeHead(200, {
1016
1026
  "content-type": "text/html; charset=utf-8",
1017
1027
  "x-voltro-rendered-by": "isr",
1018
1028
  "x-voltro-ppr": "shell+holes",
1019
1029
  ...a
1020
1030
  }), o.write(i), (async () => {
1021
1031
  try {
1022
- let i = await gt({
1023
- provider: J,
1032
+ let i = await yt({
1033
+ provider: q,
1024
1034
  root: t,
1025
- route: m.route,
1026
- params: m.params,
1035
+ route: p.route,
1036
+ params: p.params,
1027
1037
  pathname: r,
1028
- dirs: G,
1029
- shellTemplate: X.get(m.route.pattern) ?? T,
1038
+ dirs: W,
1039
+ shellTemplate: Y.get(p.route.pattern) ?? w,
1030
1040
  requestHeaders: n,
1031
- apiOrigin: F,
1032
- apiName: I,
1033
- middlewares: z,
1034
- onCookieWarning: R,
1041
+ apiOrigin: P,
1042
+ apiName: F,
1043
+ middlewares: R,
1044
+ onCookieWarning: L,
1035
1045
  requestUrl: e,
1036
1046
  holesOnly: !0
1037
1047
  });
1038
- i !== null && "holes" in i ? await ye({
1048
+ i !== null && "holes" in i ? await be({
1039
1049
  loader: i.holes.loader,
1040
1050
  ctx: i.holes.ctx,
1041
1051
  res: o,
1042
1052
  helpers: i.holes.helpers,
1043
1053
  page: i.holes.page,
1044
- log: Q
1054
+ log: Z
1045
1055
  }) : o.writableEnded || o.end();
1046
1056
  } catch (e) {
1047
- Q.warn("ppr hole pass failed", { url: r }, e), o.writableEnded || o.end();
1057
+ Z.warn("ppr hole pass failed", { url: r }, e), o.writableEnded || o.end();
1048
1058
  }
1049
1059
  })();
1050
1060
  }
1051
- }), S = B.get(v), C = Date.now();
1052
- if (S && Ie(S, C)) return f.emit("cache", {
1061
+ }), x = z.get(_), S = Date.now();
1062
+ if (x && Le(x, S)) return f.emit("cache", {
1053
1063
  kind: "HIT",
1054
- key: v,
1055
- ageMs: C - S.renderedAt
1056
- }), b ? x(S.html, {
1064
+ key: _,
1065
+ ageMs: S - x.renderedAt
1066
+ }), y ? b(x.html, {
1057
1067
  "x-voltro-cache": "HIT",
1058
- "x-voltro-cache-key": v,
1059
- "x-voltro-cache-age-ms": String(C - S.renderedAt)
1068
+ "x-voltro-cache-key": _,
1069
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1060
1070
  }) : {
1061
1071
  status: 200,
1062
1072
  headers: {
1063
1073
  "content-type": "text/html; charset=utf-8",
1064
1074
  "x-voltro-rendered-by": "isr",
1065
1075
  "x-voltro-cache": "HIT",
1066
- "x-voltro-cache-key": v,
1067
- "x-voltro-cache-age-ms": String(C - S.renderedAt)
1076
+ "x-voltro-cache-key": _,
1077
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1068
1078
  },
1069
- body: S.html
1079
+ body: x.html
1070
1080
  };
1071
- if (S && Ne(S, C)) {
1081
+ if (x && Pe(x, S)) {
1072
1082
  f.emit("cache", {
1073
1083
  kind: "STALE",
1074
- key: v,
1075
- ageMs: C - S.renderedAt
1084
+ key: _,
1085
+ ageMs: S - x.renderedAt
1076
1086
  });
1077
- let i = B.generation(v);
1087
+ let i = z.generation(_);
1078
1088
  return (async () => {
1079
1089
  try {
1080
- let a = await gt({
1081
- provider: J,
1090
+ let a = await yt({
1091
+ provider: q,
1082
1092
  root: t,
1083
- route: m.route,
1084
- params: m.params,
1093
+ route: p.route,
1094
+ params: p.params,
1085
1095
  pathname: r,
1086
- dirs: G,
1087
- shellTemplate: X.get(m.route.pattern) ?? T,
1096
+ dirs: W,
1097
+ shellTemplate: Y.get(p.route.pattern) ?? w,
1088
1098
  requestHeaders: n,
1089
- apiOrigin: F,
1090
- apiName: I,
1091
- middlewares: z,
1092
- onCookieWarning: R,
1099
+ apiOrigin: P,
1100
+ apiName: F,
1101
+ middlewares: R,
1102
+ onCookieWarning: L,
1093
1103
  requestUrl: e,
1094
1104
  buffered: !0
1095
1105
  });
1096
1106
  if (a && "html" in a && a.renderMode === "isr" && a.revalidateMs !== null) {
1097
- let e = Y.get(m.route.pattern)?.staleWhileRevalidateMs ?? 0, t = Date.now();
1098
- B.set(v, {
1107
+ let e = J.get(p.route.pattern)?.staleWhileRevalidateMs ?? 0, t = Date.now();
1108
+ z.set(_, {
1099
1109
  html: a.html,
1100
1110
  renderedAt: t,
1101
1111
  expiresAt: t + a.revalidateMs,
1102
1112
  servableUntil: t + a.revalidateMs + e,
1103
1113
  revalidateMs: a.revalidateMs,
1104
1114
  staleWhileRevalidateMs: e
1105
- }, { ifGeneration: i }) || Q.info("SWR refresh discarded — the entry was purged while it rendered", { key: v });
1115
+ }, { ifGeneration: i }) || Z.info("SWR refresh discarded — the entry was purged while it rendered", { key: _ });
1106
1116
  }
1107
1117
  } catch (e) {
1108
- Q.warn("background SWR refresh failed", { url: r }, e);
1118
+ Z.warn("background SWR refresh failed", { url: r }, e);
1109
1119
  }
1110
- })(), b ? x(S.html, {
1120
+ })(), y ? b(x.html, {
1111
1121
  "x-voltro-cache": "STALE",
1112
- "x-voltro-cache-key": v,
1113
- "x-voltro-cache-age-ms": String(C - S.renderedAt)
1122
+ "x-voltro-cache-key": _,
1123
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1114
1124
  }) : {
1115
1125
  status: 200,
1116
1126
  headers: {
1117
1127
  "content-type": "text/html; charset=utf-8",
1118
1128
  "x-voltro-rendered-by": "isr",
1119
1129
  "x-voltro-cache": "STALE",
1120
- "x-voltro-cache-key": v,
1121
- "x-voltro-cache-age-ms": String(C - S.renderedAt)
1130
+ "x-voltro-cache-key": _,
1131
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1122
1132
  },
1123
- body: S.html
1133
+ body: x.html
1124
1134
  };
1125
1135
  }
1126
1136
  try {
1127
- let i = B.generation(v), a = await gt({
1128
- provider: J,
1137
+ let i = z.generation(_), a = await yt({
1138
+ provider: q,
1129
1139
  root: t,
1130
- route: m.route,
1131
- params: m.params,
1140
+ route: p.route,
1141
+ params: p.params,
1132
1142
  pathname: r,
1133
- dirs: G,
1134
- shellTemplate: X.get(m.route.pattern) ?? T,
1143
+ dirs: W,
1144
+ shellTemplate: Y.get(p.route.pattern) ?? w,
1135
1145
  requestHeaders: n,
1136
- apiOrigin: F,
1137
- apiName: I,
1138
- middlewares: z,
1139
- onCookieWarning: R,
1146
+ apiOrigin: P,
1147
+ apiName: F,
1148
+ middlewares: R,
1149
+ onCookieWarning: L,
1140
1150
  requestUrl: e
1141
1151
  });
1142
1152
  if (!a) return {
@@ -1145,12 +1155,12 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1145
1155
  "content-type": "text/html; charset=utf-8",
1146
1156
  "x-voltro-rendered-by": "spa-fallback"
1147
1157
  },
1148
- body: T
1158
+ body: w
1149
1159
  };
1150
1160
  let o = a.setCookies ?? [], s = a.responseHeaders ?? {}, c = (e) => ({
1151
1161
  ...s,
1152
1162
  ...e,
1153
- ...o.length === 0 ? {} : { "set-cookie": o.map(y) }
1163
+ ...o.length === 0 ? {} : { "set-cookie": o.map(v) }
1154
1164
  });
1155
1165
  if ("stream" in a) return {
1156
1166
  status: 200,
@@ -1179,34 +1189,34 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1179
1189
  "x-voltro-rendered-by": a.renderMode
1180
1190
  });
1181
1191
  if (a.renderMode === "isr" && a.revalidateMs !== null) {
1182
- let e = Date.now(), t = Y.get(m.route.pattern)?.staleWhileRevalidateMs ?? 0;
1183
- B.set(v, {
1192
+ let e = Date.now(), t = J.get(p.route.pattern)?.staleWhileRevalidateMs ?? 0;
1193
+ z.set(_, {
1184
1194
  html: a.html,
1185
1195
  renderedAt: e,
1186
1196
  expiresAt: e + a.revalidateMs,
1187
1197
  servableUntil: e + a.revalidateMs + t,
1188
1198
  revalidateMs: a.revalidateMs,
1189
1199
  staleWhileRevalidateMs: t
1190
- }, { ifGeneration: i }) || Q.info("miss fill discarded — the entry was purged while it rendered", { key: v }), l["x-voltro-cache"] = "MISS", l["x-voltro-cache-key"] = v, l["x-voltro-cache-revalidate-ms"] = String(a.revalidateMs), t > 0 && (l["x-voltro-cache-swr-ms"] = String(t)), f.emit("cache", {
1200
+ }, { ifGeneration: i }) || Z.info("miss fill discarded — the entry was purged while it rendered", { key: _ }), l["x-voltro-cache"] = "MISS", l["x-voltro-cache-key"] = _, l["x-voltro-cache-revalidate-ms"] = String(a.revalidateMs), t > 0 && (l["x-voltro-cache-swr-ms"] = String(t)), f.emit("cache", {
1191
1201
  kind: "MISS",
1192
- key: v,
1202
+ key: _,
1193
1203
  revalidateMs: a.revalidateMs,
1194
1204
  swrMs: t
1195
1205
  });
1196
1206
  } else a.renderMode === "isr" && (l["x-voltro-cache"] = "BYPASS", f.emit("cache", {
1197
1207
  kind: "BYPASS",
1198
- key: v
1208
+ key: _
1199
1209
  }));
1200
- return b && a.renderMode === "isr" ? x(a.html, {
1210
+ return y && a.renderMode === "isr" ? b(a.html, {
1201
1211
  "x-voltro-cache": l["x-voltro-cache"] ?? "MISS",
1202
- "x-voltro-cache-key": v
1212
+ "x-voltro-cache-key": _
1203
1213
  }) : {
1204
1214
  status: 200,
1205
1215
  headers: l,
1206
1216
  body: a.html
1207
1217
  };
1208
1218
  } catch (e) {
1209
- return Q.error("render error", { url: r }, e), d(e) ? {
1219
+ return Z.error("render error", { url: r }, e), d(e) ? {
1210
1220
  status: 500,
1211
1221
  headers: {
1212
1222
  "content-type": "text/plain; charset=utf-8",
@@ -1227,44 +1237,44 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1227
1237
  };
1228
1238
  }
1229
1239
  }, kt = !1, At = a({
1230
- apiName: I,
1231
- apiOrigin: F,
1240
+ apiName: F,
1241
+ apiOrigin: P,
1232
1242
  loadDescriptors: async () => {
1233
- if (I === void 0) return;
1234
- let e = (await J.getHelpers()).apiDescriptors?.[I];
1243
+ if (F === void 0) return;
1244
+ let e = (await q.getHelpers()).apiDescriptors?.[F];
1235
1245
  return e === void 0 ? void 0 : await e();
1236
1246
  },
1237
- rpcQuery: (e, t) => ge(F, e, {
1238
- apiName: I,
1247
+ rpcQuery: (e, t) => _e(P, e, {
1248
+ apiName: F,
1239
1249
  headers: t
1240
1250
  }),
1241
1251
  resolveLocale: async (e, t) => {
1242
- let n = await J.getHelpers(), r = A(t, n.i18n?.locales);
1252
+ let n = await q.getHelpers(), r = k(t, n.i18n?.locales);
1243
1253
  return r === void 0 ? n.i18n?.resolve(e.cookie, e["accept-language"])?.locale ?? "en" : r;
1244
1254
  },
1245
1255
  renderErrorPage: async ({ path: e, headers: n, flash: r }) => {
1246
- let { pathname: i } = oe(e), a = mt(i, K);
1256
+ let { pathname: i } = se(e), a = ht(i, G);
1247
1257
  if (!a) return;
1248
- let o = await gt({
1249
- provider: J,
1258
+ let o = await yt({
1259
+ provider: q,
1250
1260
  root: t,
1251
1261
  route: a.route,
1252
1262
  params: a.params,
1253
1263
  pathname: i,
1254
- dirs: G,
1255
- shellTemplate: T,
1264
+ dirs: W,
1265
+ shellTemplate: w,
1256
1266
  requestHeaders: n,
1257
- apiOrigin: F,
1258
- apiName: I,
1259
- middlewares: z,
1260
- onCookieWarning: R,
1267
+ apiOrigin: P,
1268
+ apiName: F,
1269
+ middlewares: R,
1270
+ onCookieWarning: L,
1261
1271
  requestUrl: e,
1262
1272
  formFlash: r,
1263
1273
  buffered: !0
1264
1274
  });
1265
1275
  return o !== null && "html" in o ? o.html : void 0;
1266
1276
  }
1267
- }), jt = Ye(async (e, t) => {
1277
+ }), jt = Xe(async (e, t) => {
1268
1278
  let n = e.url ?? "/", r = Date.now(), i = {};
1269
1279
  for (let [t, n] of Object.entries(e.headers)) n !== void 0 && (i[t.toLowerCase()] = Array.isArray(n) ? n.join(", ") : n);
1270
1280
  let a = n.split("?")[0] ?? "/", s = (e.method ?? "GET").toUpperCase();
@@ -1283,9 +1293,9 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1283
1293
  }), t.end(kt ? "ready" : "not-ready");
1284
1294
  return;
1285
1295
  }
1286
- if (!(a.startsWith(v) && await At(e, t))) {
1296
+ if (!(a.startsWith(_) && await At(e, t))) {
1287
1297
  if (s === "OPTIONS" && a.startsWith("/_voltro/inspect")) {
1288
- let e = we(i.origin);
1298
+ let e = Te(i.origin);
1289
1299
  t.writeHead(204, e), t.end();
1290
1300
  return;
1291
1301
  }
@@ -1295,13 +1305,13 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1295
1305
  t.writeHead(400, { "content-type": "text/plain" }), t.end("missing ?target=");
1296
1306
  return;
1297
1307
  }
1298
- if (!Oe(r)) {
1308
+ if (!ke(r)) {
1299
1309
  t.writeHead(400, { "content-type": "text/plain" }), t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
1300
1310
  return;
1301
1311
  }
1302
1312
  try {
1303
1313
  let n = { accept: i.accept ?? "application/json" }, a = i.authorization;
1304
- a ? n.authorization = Array.isArray(a) ? a[0] : a : De(r) && process.env.VOLTRO_INSPECT_TOKEN && (n.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
1314
+ a ? n.authorization = Array.isArray(a) ? a[0] : a : Oe(r) && process.env.VOLTRO_INSPECT_TOKEN && (n.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
1305
1315
  let o;
1306
1316
  if (s && s !== "GET" && s !== "HEAD") {
1307
1317
  let t = [];
@@ -1331,14 +1341,14 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1331
1341
  t.writeHead(400, { "content-type": "text/plain" }), t.end("missing ?target=");
1332
1342
  return;
1333
1343
  }
1334
- if (!Oe(r)) {
1344
+ if (!ke(r)) {
1335
1345
  t.writeHead(400, { "content-type": "text/plain" }), t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
1336
1346
  return;
1337
1347
  }
1338
1348
  let a = new AbortController();
1339
1349
  e.on("close", () => a.abort()), t.on("close", () => a.abort());
1340
1350
  try {
1341
- let e = i.authorization ?? (De(r) && process.env.VOLTRO_INSPECT_TOKEN ? `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` : void 0), n = await fetch(r, {
1351
+ let e = i.authorization ?? (Oe(r) && process.env.VOLTRO_INSPECT_TOKEN ? `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` : void 0), n = await fetch(r, {
1342
1352
  redirect: "manual",
1343
1353
  method: "GET",
1344
1354
  headers: {
@@ -1373,15 +1383,15 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1373
1383
  return;
1374
1384
  }
1375
1385
  if (a === "/_voltro/inspect/stream") {
1376
- let n = we(i.origin);
1377
- if (L()) {
1386
+ let n = Te(i.origin);
1387
+ if (I()) {
1378
1388
  t.writeHead(503, {
1379
1389
  "content-type": "application/json",
1380
1390
  ...n
1381
1391
  }), t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
1382
1392
  return;
1383
1393
  }
1384
- let r = Te(i, "GET");
1394
+ let r = Ee(i, "GET");
1385
1395
  if (!r.ok) {
1386
1396
  t.writeHead(401, {
1387
1397
  "content-type": "application/json",
@@ -1399,11 +1409,11 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1399
1409
  "x-accel-buffering": "no",
1400
1410
  ...n
1401
1411
  }), t.flushHeaders(), t.write("retry: 5000\n\n");
1402
- for (let e of f.buffered()) t.write(ve(e));
1412
+ for (let e of f.buffered()) t.write(ye(e));
1403
1413
  let a = f.subscribe((e) => {
1404
- t.write(ve(e));
1414
+ t.write(ye(e));
1405
1415
  }), o = setInterval(() => {
1406
- t.write(me());
1416
+ t.write(he());
1407
1417
  }, 15e3), s = () => {
1408
1418
  clearInterval(o), a();
1409
1419
  };
@@ -1412,13 +1422,13 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1412
1422
  }
1413
1423
  try {
1414
1424
  let e = await Ot(n, i);
1415
- if (e.stream ? e.stream(t) : Ze({
1425
+ if (e.stream ? e.stream(t) : Qe({
1416
1426
  response: t,
1417
1427
  status: e.status,
1418
1428
  headers: e.headers,
1419
1429
  body: e.body,
1420
1430
  requestHeaders: i,
1421
- compression: fe.compression
1431
+ compression: pe.compression
1422
1432
  }) || (t.writeHead(e.status, e.headers), t.end(e.body)), !a.startsWith("/_voltro/inspect")) {
1423
1433
  let t = Date.now() - r;
1424
1434
  f.emit("request", {
@@ -1428,7 +1438,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1428
1438
  renderedBy: e.headers["x-voltro-rendered-by"],
1429
1439
  cache: e.headers["x-voltro-cache"]
1430
1440
  });
1431
- let n = mt(a, K)?.route.pattern ?? (e.status === 404 ? "<unmatched>" : "<asset>");
1441
+ let n = ht(a, G)?.route.pattern ?? (e.status === 404 ? "<unmatched>" : "<asset>");
1432
1442
  Ct.record({
1433
1443
  kind: "request",
1434
1444
  tag: n,
@@ -1441,62 +1451,62 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1441
1451
  }
1442
1452
  }
1443
1453
  });
1444
- await new Promise((e) => jt.listen(m, "::", e)), kt = !0, i.mark("ready"), Q.info(`listening on http://localhost:${m}`, {
1445
- port: m,
1446
- distDir: g
1447
- }), Q.debug("dynamic + ssr/isr routes resolve via SSR loader");
1454
+ await new Promise((e) => jt.listen(p, "::", e)), kt = !0, i.mark("ready"), Z.info(`listening on http://localhost:${p}`, {
1455
+ port: p,
1456
+ distDir: h
1457
+ }), Z.debug("dynamic + ssr/isr routes resolve via SSR loader");
1448
1458
  try {
1449
- await Le({
1450
- id: C,
1451
- name: x,
1459
+ await Re({
1460
+ id: S,
1461
+ name: b,
1452
1462
  kind: "web",
1453
- url: `http://localhost:${m}`,
1463
+ url: `http://localhost:${p}`,
1454
1464
  pid: process.pid,
1455
1465
  status: "live",
1456
- logFile: w.path
1466
+ logFile: C.path
1457
1467
  });
1458
- let e = ce(t);
1468
+ let e = le(t);
1459
1469
  if (e) {
1460
1470
  let t = await r({ dashboardAppPath: e });
1461
- t.status === "launched" ? Q.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Q.debug(`dashboard already running on :${t.port}`, { port: t.port });
1471
+ t.status === "launched" ? Z.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Z.debug(`dashboard already running on :${t.port}`, { port: t.port });
1462
1472
  }
1463
1473
  setInterval(() => {
1464
- Le({
1465
- id: C,
1466
- name: x,
1474
+ Re({
1475
+ id: S,
1476
+ name: b,
1467
1477
  kind: "web",
1468
- url: `http://localhost:${m}`,
1478
+ url: `http://localhost:${p}`,
1469
1479
  pid: process.pid,
1470
1480
  status: "live",
1471
- logFile: w.path
1481
+ logFile: C.path
1472
1482
  }).catch(() => {});
1473
1483
  }, 1e4).unref();
1474
1484
  } catch (e) {
1475
- Q.warn("runtime-registry write failed", {}, e);
1485
+ Z.warn("runtime-registry write failed", {}, e);
1476
1486
  }
1477
- Ge({
1487
+ Ke({
1478
1488
  app: o.name ?? "unnamed",
1479
1489
  kind: "web",
1480
- url: `http://localhost:${m}`,
1490
+ url: `http://localhost:${p}`,
1481
1491
  bootMs: i.total()
1482
1492
  });
1483
1493
  let Mt = i.phaseBreakdown();
1484
- Q.info(`start: ready in ${i.total()}ms`, {
1494
+ Z.info(`start: ready in ${i.total()}ms`, {
1485
1495
  bootMs: i.total(),
1486
1496
  ...Mt ? { phases: Mt } : {}
1487
1497
  });
1488
1498
  let Nt = !1, Pt = (e) => async () => {
1489
1499
  if (!Nt) {
1490
- if (Nt = !0, Q.info(`received ${e}, shutting down`, { signal: e }), jt.close(), await yt.stop(), xt) try {
1491
- xt();
1500
+ if (Nt = !0, Z.info(`received ${e}, shutting down`, { signal: e }), jt.close(), await vt.stop(), $) try {
1501
+ $();
1492
1502
  } catch {}
1493
1503
  if (St) try {
1494
- await Ke.runPromise(St.close());
1504
+ await qe.runPromise(St.close());
1495
1505
  } catch {}
1496
- if (V) try {
1497
- await V.end();
1506
+ if (B) try {
1507
+ await B.end();
1498
1508
  } catch {}
1499
- await J.close(), await ze(C), await w.dispose(), process.exit(0);
1509
+ await q.close(), await Be(S), await C.dispose(), process.exit(0);
1500
1510
  }
1501
1511
  };
1502
1512
  process.on("SIGINT", Pt("SIGINT")), process.on("SIGTERM", Pt("SIGTERM"));
@@ -1508,10 +1518,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1508
1518
  e.unref();
1509
1519
  }
1510
1520
  return new Promise(() => {});
1511
- }, bt = async (e) => {
1521
+ }, St = async (e) => {
1512
1522
  t("start");
1513
- let n = e.find((e) => !e.startsWith("-")) ?? process.cwd(), r = await yt(Ue(n));
1514
- return r.ran ? r.exitCode : (Q.error("no web app found at this path"), 1);
1523
+ let n = e.find((e) => !e.startsWith("-")) ?? process.cwd(), r = await $(We(n));
1524
+ return r.ran ? r.exitCode : (Z.error("no web app found at this path"), 1);
1515
1525
  };
1516
1526
  //#endregion
1517
- export { yt as n, bt as t };
1527
+ export { $ as n, St as t };