@voltro/cli 0.57.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +256 -0
  2. package/dist/apiBuild-B9OvhITV.js +2 -0
  3. package/dist/{apiBuild-DDr2aNFd.js → apiBuild-BU5cd-Fn.js} +52 -50
  4. package/dist/bin.js +1 -1
  5. package/dist/build-uRMZrT8z.js +1066 -0
  6. package/dist/{checkCommand-BISqx1OJ.js → checkCommand-C1CQc8lD.js} +1 -1
  7. package/dist/{checkCommand-DUtMWjcR.js → checkCommand-DC7k1_hP.js} +3 -3
  8. package/dist/{codegenCommand-DnVuDxwT.js → codegenCommand-kS3Twuc9.js} +7 -7
  9. package/dist/{codemodRunner-BlQPfjzA.js → codemodRunner-kNnh1I7_.js} +1227 -911
  10. package/dist/{commands-CRbxgxv0.js → commands-cu34ENUT.js} +21 -21
  11. package/dist/{dashboardCommand-Bf_-Ne3P.js → dashboardCommand-gG1y4PFG.js} +5 -5
  12. package/dist/{dataCommand-BoBJJ-Gb.js → dataCommand-hNOGKz4K.js} +6 -6
  13. package/dist/{dev-DOEJXicj.js → dev-Ce2gEziv.js} +2422 -2419
  14. package/dist/dev-Dff_pdik.js +3 -0
  15. package/dist/{doctorCommand-BrWu67JZ.js → doctorCommand-CGjefPmk.js} +505 -284
  16. package/dist/doctorCommand-DXnNpKQT.js +2 -0
  17. package/dist/{dormancyCommand-xn2y-pJm.js → dormancyCommand-DYgI0Kf-.js} +3 -3
  18. package/dist/{embeddingsCommand-Cn5MbRDM.js → embeddingsCommand-yJivQSrI.js} +2 -2
  19. package/dist/{envCommand-UJmJIbs9.js → envCommand-ORJUf8r_.js} +8 -8
  20. package/dist/{evolveCommand-Db30twUy.js → evolveCommand-8CuFBlbQ.js} +2 -2
  21. package/dist/index.js +1 -1
  22. package/dist/{infoCommand-BjVXpMlP.js → infoCommand-D02A4WI2.js} +1 -1
  23. package/dist/inspect-CZvsmp8t.js +2 -0
  24. package/dist/{inspect-DZnan87F.js → inspect-PcC5J-Dl.js} +6 -7
  25. package/dist/manifestBuild-AUh31bFU.js +2 -0
  26. package/dist/{manifestBuild-DnbFKF6w.js → manifestBuild-BwiS4iYm.js} +1 -1
  27. package/dist/{probeCommand-C5fuN6Z2.js → probeCommand-BUYzc0CT.js} +1 -1
  28. package/dist/{runtimeTrace-BQL_lfz6.js → runtimeTrace-DDuKJgVi.js} +1 -1
  29. package/dist/{sdkgen-CMUPrDjH.js → sdkgen-vq1fF9D_.js} +1 -1
  30. package/dist/serveCommand-1R52mo6F.js +2 -0
  31. package/dist/{serveCommand-B_w-Mpb_.js → serveCommand-Dr4KXmTS.js} +726 -725
  32. package/dist/serveEntry.js +1 -1
  33. package/dist/{start-s25GAIgn.js → start-C75w6ftA.js} +1 -1
  34. package/dist/{start-YaUehtDV.js → start-DNtIlBcn.js} +641 -609
  35. package/dist/startEntry.js +1 -1
  36. package/dist/{updateCommand-C9n_Z_oG.js → updateCommand-Bw3mCUDT.js} +1 -1
  37. package/dist/updateCommand-inInBIAh.js +2 -0
  38. package/dist/webDev-Bzb8ZFus.js +2 -0
  39. package/dist/{webDev-BgdkyjP6.js → webDev-CBN9KkyQ.js} +154 -146
  40. package/dist/{webhooksCommand-CYXTNvXq.js → webhooksCommand-BPJQOGTe.js} +1 -1
  41. package/package.json +73 -19
  42. package/templates/AGENTS.md +1 -1
  43. package/templates/agent-docs/_index.md +1 -1
  44. package/templates/agent-docs/_manifest.json +1 -1
  45. package/templates/agent-docs/ai.md +223 -0
  46. package/templates/agent-docs/authentication.md +34 -0
  47. package/templates/agent-docs/cli.md +7 -6
  48. package/templates/agent-docs/data.md +30 -0
  49. package/templates/agent-docs/database/transactions.md +48 -0
  50. package/templates/agent-docs/observability.md +13 -2
  51. package/templates/agent-docs/plugins/auth-supabase.md +21 -0
  52. package/templates/agent-docs/plugins/sentry.md +131 -9
  53. package/templates/agent-docs/schema-driven-ui.md +29 -0
  54. package/templates/agent-docs/whats-new.md +26 -165
  55. package/templates/apps/api-ai/package.json +6 -6
  56. package/templates/apps/api-auth/package.json +8 -8
  57. package/templates/apps/api-backend/package.json +7 -7
  58. package/templates/apps/api-backend-deactivation/package.json +7 -7
  59. package/templates/apps/api-backend-mail/package.json +8 -8
  60. package/templates/apps/api-backend-mariadb/package.json +9 -9
  61. package/templates/apps/api-backend-sqlite/package.json +8 -8
  62. package/templates/apps/api-backend-storage/package.json +8 -8
  63. package/templates/apps/api-cms/package.json +9 -9
  64. package/templates/apps/api-collab/package.json +8 -8
  65. package/templates/apps/api-data-advanced/package.json +8 -8
  66. package/templates/apps/api-durable/package.json +8 -8
  67. package/templates/apps/api-feature-flags/package.json +9 -9
  68. package/templates/apps/api-governance/package.json +8 -8
  69. package/templates/apps/api-kv/package.json +8 -8
  70. package/templates/apps/api-moderation/package.json +8 -8
  71. package/templates/apps/api-observability/package.json +8 -8
  72. package/templates/apps/api-ratelimit/package.json +8 -8
  73. package/templates/apps/api-rbac/package.json +8 -8
  74. package/templates/apps/api-rest/package.json +7 -7
  75. package/templates/apps/api-row-history/package.json +8 -8
  76. package/templates/apps/api-saas/package.json +11 -11
  77. package/templates/apps/api-saas-starter/package.json +10 -10
  78. package/templates/apps/api-search/package.json +8 -8
  79. package/templates/apps/api-status/package.json +8 -8
  80. package/templates/apps/api-webhooks/package.json +9 -9
  81. package/templates/apps/changelog/package.json +7 -7
  82. package/templates/apps/edge-functions/package.json +2 -2
  83. package/templates/apps/frontend-admin/package.json +7 -7
  84. package/templates/apps/frontend-app/package.json +8 -8
  85. package/templates/apps/frontend-auth/package.json +7 -7
  86. package/templates/apps/frontend-blank/package.json +6 -6
  87. package/templates/apps/frontend-cms/package.json +8 -8
  88. package/templates/apps/frontend-collab/package.json +9 -9
  89. package/templates/apps/frontend-contact/package.json +7 -7
  90. package/templates/apps/frontend-dashboard/package.json +6 -6
  91. package/templates/apps/frontend-docs/package.json +8 -8
  92. package/templates/apps/frontend-i18n/package.json +6 -6
  93. package/templates/apps/frontend-landing/package.json +7 -7
  94. package/templates/apps/frontend-portal/package.json +7 -7
  95. package/templates/apps/frontend-saas/package.json +7 -7
  96. package/templates/apps/frontend-spa/package.json +6 -6
  97. package/templates/apps/frontend-ssr/package.json +6 -6
  98. package/templates/apps/frontend-ssr-api/package.json +7 -7
  99. package/templates/apps/frontend-static-blog/package.json +8 -8
  100. package/templates/apps/frontend-status/package.json +7 -7
  101. package/templates/apps/mobile-app/package.json +4 -4
  102. package/dist/apiBuild-B83Cb2Rv.js +0 -2
  103. package/dist/build-QKP6Bm0J.js +0 -872
  104. package/dist/dev-Bl9HqtV7.js +0 -3
  105. package/dist/doctorCommand-DrQv9SL3.js +0 -2
  106. package/dist/inspect-B0hL41s0.js +0 -2
  107. package/dist/manifestBuild-UXrnUcXP.js +0 -2
  108. package/dist/serveCommand-Dtb48ffg.js +0 -2
  109. package/dist/updateCommand-DsXEAHbd.js +0 -2
  110. package/dist/webDev-B6ZMX42w.js +0 -2
@@ -1,30 +1,51 @@
1
1
  import { i as e, t } from "./nodeEnvironment-cGFAj1J8.js";
2
- import { $ as n, A as r, B as i, C as a, Ct as o, D as s, E as c, F as l, Ft as u, G as d, H as f, I as p, J as m, K as h, Kt as ee, L as g, M as _, Mt as v, N as y, Nt as b, O as x, Ot as S, P as C, Pt as w, Q as T, Qt as te, S as E, T as ne, U as re, V as ie, W as D, X as ae, Xt as oe, Y as se, Yt as O, Z as ce, Zt as le, _t as ue, a as k, c as de, dt as fe, et as pe, h as me, it as A, j, jt as he, k as M, lt as N, m as P, n as ge, ot as _e, q as F, rt as ve, s as ye, tt as be, u as xe, vt as Se, w as Ce, z as we } from "./webDev-BgdkyjP6.js";
3
- import { A as I, I as Te, M as Ee, O as De, g as Oe, j as ke, o as Ae } from "./inspect-DZnan87F.js";
4
- import { r as je } from "./appPort-B_HpJ_ck.js";
5
- import { o as Me, t as Ne } from "./connectionConfig-Bk9IC7D0.js";
6
- import { n as Pe, r as Fe, t as Ie } from "./inspectMetrics-BY0Sjb2F.js";
7
- import { a as Le, c as Re, d as ze, f as Be, l as Ve, p as L, u as He } from "./renderModeScan-43yQ2opo.js";
8
- import { i as Ue, n as We, r as Ge, t as Ke } from "./runtimeRegistry-DMeKfTHP.js";
9
- import { n as qe } from "./logFileSink-B4uP8pvf.js";
10
- import { t as Je } from "./bootTiming-BdyP9nYw.js";
11
- import { a as Ye, n as Xe, r as Ze, t as Qe } from "./staticCachePolicy-CIyj6DbS.js";
12
- import { extname as R, join as z, resolve as B } from "node:path";
13
- import { promises as V } from "node:fs";
14
- import { pathToFileURL as H } from "node:url";
15
- import { createLogger as U, printReadyBlock as $e } from "@voltro/logger";
16
- import { appMode as et, frameworkVersion as tt, setProcessBootPath as nt } from "@voltro/protocol/identity";
17
- import { applyKeepAlive as rt, maybeCompress as W, negotiateEncoding as it, resolveKeepAlive as at, snapshotMetricsSync as ot } from "@voltro/runtime";
18
- import { Effect as st } from "effect";
19
- import { createHash as G } from "node:crypto";
20
- import { resolveBroadcastProvider as ct } from "@voltro/plugin-broadcast";
21
- import { createServer as lt } from "node:http";
22
- //#region src/httpResponseWrite.ts
23
- var ut = (e) => `W/"${G("md5").update(e).digest("hex")}"`, dt = (e) => {
2
+ import { $ as n, $t as r, A as i, B as a, D as o, E as s, Et as c, F as l, Ft as u, G as d, H as ee, I as f, It as p, J as m, K as te, L as h, Lt as g, M as _, N as v, O as y, P as b, Pt as x, Q as ne, Qt as S, R as C, Rt as w, T as re, U as ie, W as ae, X as T, Y as E, Yt as oe, Z as se, a as ce, bt as le, c as D, en as ue, et as de, ft as fe, h as O, it as pe, j as me, jt as k, k as he, lt as A, m as j, mt as ge, n as _e, nt as ve, ot as ye, q as M, rt as be, s as xe, st as Se, tn as Ce, tt as N, u as we, xt as Te, z as P } from "./webDev-CBN9KkyQ.js";
3
+ import { A as F, I as Ee, M as De, O as Oe, g as ke, j as Ae, o as je } from "./inspect-PcC5J-Dl.js";
4
+ import { r as Me } from "./appPort-B_HpJ_ck.js";
5
+ import { o as Ne, t as Pe } from "./connectionConfig-Bk9IC7D0.js";
6
+ import { n as Fe, r as Ie, t as Le } from "./inspectMetrics-BY0Sjb2F.js";
7
+ import { a as Re, c as ze, d as Be, f as Ve, l as He, p as I, u as Ue } from "./renderModeScan-43yQ2opo.js";
8
+ import { i as We, n as Ge, r as Ke, t as qe } from "./runtimeRegistry-DMeKfTHP.js";
9
+ import { n as Je } from "./logFileSink-B4uP8pvf.js";
10
+ import { t as Ye } from "./bootTiming-BdyP9nYw.js";
11
+ import { a as Xe, n as Ze, r as Qe, t as $e } from "./staticCachePolicy-CIyj6DbS.js";
12
+ import { extname as L, join as R, resolve as z } from "node:path";
13
+ import { promises as B } from "node:fs";
14
+ import { pathToFileURL as V } from "node:url";
15
+ import { createLogger as H, printReadyBlock as et } from "@voltro/logger";
16
+ import { appMode as tt, frameworkVersion as nt, setProcessBootPath as rt } from "@voltro/protocol/identity";
17
+ import { applyKeepAlive as it, maybeCompress as U, negotiateEncoding as at, resolveKeepAlive as ot, snapshotMetricsSync as st } from "@voltro/runtime";
18
+ import { Effect as ct } from "effect";
19
+ import { createHash as W } from "node:crypto";
20
+ import { resolveBroadcastProvider as lt } from "@voltro/plugin-broadcast";
21
+ import { createServer as ut } from "node:http";
22
+ //#region src/inertPublicEnv.ts
23
+ var dt = "VOLTRO_PUBLIC_", ft = (e, t) => {
24
+ let n = [];
25
+ for (let [r, i] of Object.entries(e)) if (r.startsWith(dt) && i !== void 0 && i !== "") {
26
+ if (t === void 0 || !(r in t)) {
27
+ n.push({
28
+ key: r,
29
+ baked: "absent"
30
+ });
31
+ continue;
32
+ }
33
+ String(t[r]) !== i && n.push({
34
+ key: r,
35
+ baked: "different"
36
+ });
37
+ }
38
+ return n.sort((e, t) => e.key.localeCompare(t.key));
39
+ }, pt = (e) => {
40
+ let t = e.map((e) => e.baked === "absent" ? ` • ${e.key} — not in the bundle at all` : ` • ${e.key} — the bundle carries a DIFFERENT value; the built one wins`);
41
+ return `${e.length} VOLTRO_PUBLIC_* variable${e.length === 1 ? "" : "s"} set in this process's environment cannot reach the browser:\n${t.join("\n")}\n Public values are BAKED into the bundle by \`voltro build\` — that is what makes them
42
+ readable in a browser — so they must exist when the bundle is BUILT, not when it runs.
43
+ → pass them to the build (a Docker build-arg / CI build step), not as deployment env.`;
44
+ }, mt = (e) => `W/"${W("md5").update(e).digest("hex")}"`, ht = (e) => {
24
45
  let { response: t, status: n, headers: r, body: i, requestHeaders: a } = e, o = r["cache-control"], s = (typeof o == "string" ? o : "").toLowerCase();
25
46
  if (i === void 0 || n !== 200 || s.includes("no-store")) return !1;
26
- let c = r["content-type"], l = typeof c == "string" ? c : void 0, u = r.etag, d = typeof u == "string" ? u : ut(i), f = a["if-none-match"];
27
- if (f !== void 0 && f.split(",").some((e) => e.trim() === d)) return t.writeHead(304, {
47
+ let c = r["content-type"], l = typeof c == "string" ? c : void 0, u = r.etag, d = typeof u == "string" ? u : mt(i), ee = a["if-none-match"];
48
+ if (ee !== void 0 && ee.split(",").some((e) => e.trim() === d)) return t.writeHead(304, {
28
49
  ...r,
29
50
  etag: d
30
51
  }), t.end(), !0;
@@ -32,18 +53,18 @@ var ut = (e) => `W/"${G("md5").update(e).digest("hex")}"`, dt = (e) => {
32
53
  ...r,
33
54
  etag: d
34
55
  }), t.end(i), !0;
35
- let p = W({
56
+ let f = U({
36
57
  body: typeof i == "string" ? new TextEncoder().encode(i) : new Uint8Array(i),
37
58
  contentType: l,
38
59
  acceptEncoding: a["accept-encoding"],
39
60
  options: e.compression
40
- }), m = {
61
+ }), p = {
41
62
  ...r,
42
- ...p.headers,
63
+ ...f.headers,
43
64
  etag: d
44
65
  };
45
- return p.compressed && delete m["content-length"], t.writeHead(n, m), t.end(Buffer.from(p.bytes)), !0;
46
- }, K = U({ scope: "voltro:start:cdc" }), ft = (e) => (t) => {
66
+ return f.compressed && delete p["content-length"], t.writeHead(n, p), t.end(Buffer.from(f.bytes)), !0;
67
+ }, G = H({ scope: "voltro:start:cdc" }), gt = (e) => (t) => {
47
68
  let n = 0;
48
69
  for (let [r, i] of e.tableSubscriptionsByPattern) {
49
70
  if (!i.includes(t)) continue;
@@ -54,15 +75,15 @@ var ut = (e) => `W/"${G("md5").update(e).digest("hex")}"`, dt = (e) => {
54
75
  }));
55
76
  }
56
77
  return n;
57
- }, pt = () => Ne() ? Me() : null, mt = (e) => {
58
- let t = e.channel ?? "framework_changes", n = e.revalidateChannel ?? "voltro_revalidate", r = ft(e), i = null, a = null;
78
+ }, K = () => Pe() ? Ne() : null, _t = (e) => {
79
+ let t = e.channel ?? "framework_changes", n = e.revalidateChannel ?? "voltro_revalidate", r = gt(e), i = null, a = null;
59
80
  return {
60
81
  start: async () => {
61
82
  let o = e.tableSubscriptionsByPattern.size > 0, s = e.onRevalidate !== void 0;
62
- if (!o && !s) return K.debug("skipped — no pages declare cacheInvalidatesOn and no revalidation handler is wired"), !1;
63
- let c = pt();
64
- if (!c && !o) return K.debug("no database configured — the revalidation LISTEN line is unavailable"), !1;
65
- if (!c) return K.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;
83
+ if (!o && !s) return G.debug("skipped — no pages declare cacheInvalidatesOn and no revalidation handler is wired"), !1;
84
+ let c = K();
85
+ if (!c && !o) return G.debug("no database configured — the revalidation LISTEN line is unavailable"), !1;
86
+ if (!c) return G.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;
66
87
  i = new (await (import("pg"))).default.Client(c), await i.connect(), a = (i) => {
67
88
  if (i.channel === n && i.payload && e.onRevalidate) {
68
89
  e.onRevalidate(i.payload);
@@ -73,18 +94,18 @@ var ut = (e) => `W/"${G("md5").update(e).digest("hex")}"`, dt = (e) => {
73
94
  try {
74
95
  a = JSON.parse(i.payload);
75
96
  } catch (e) {
76
- K.warn("bad CDC payload", {}, e);
97
+ G.warn("bad CDC payload", {}, e);
77
98
  return;
78
99
  }
79
100
  let o = r(a.table);
80
- o > 0 && K.info(`${a.op} on '${a.table}' → dropped ${o} cache entries`, {
101
+ o > 0 && G.info(`${a.op} on '${a.table}' → dropped ${o} cache entries`, {
81
102
  op: a.op,
82
103
  table: a.table,
83
104
  dropped: o
84
105
  });
85
106
  }, i.on("notification", a), o && await i.query(`LISTEN ${t}`), s && await i.query(`LISTEN ${n}`);
86
107
  let l = [...o ? [t] : [], ...s ? [n] : []];
87
- return K.info(`LISTEN ${l.join(", ")}`, {
108
+ return G.info(`LISTEN ${l.join(", ")}`, {
88
109
  channels: l,
89
110
  ..."connectionString" in c ? { target: c.connectionString.replace(/\/\/[^@/]*@/, "//") } : {
90
111
  host: c.host,
@@ -102,7 +123,7 @@ var ut = (e) => `W/"${G("md5").update(e).digest("hex")}"`, dt = (e) => {
102
123
  }
103
124
  }
104
125
  };
105
- }, q = U({ scope: "voltro:start:isr-cache" }), ht = "voltro_isr_cache", J = (e) => `
126
+ }, vt = H({ scope: "voltro:start:isr-cache" }), q = "voltro_isr_cache", yt = (e) => `
106
127
  CREATE TABLE IF NOT EXISTS ${e} (
107
128
  cache_key TEXT PRIMARY KEY,
108
129
  html TEXT NOT NULL,
@@ -113,9 +134,9 @@ CREATE TABLE IF NOT EXISTS ${e} (
113
134
  stale_while_revalidate_ms BIGINT NOT NULL DEFAULT 0
114
135
  );
115
136
  CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
116
- `, gt = (e) => {
117
- let t = e.tableName ?? ht, { client: n } = e, r = /* @__PURE__ */ new Map(), i = !1, a = (async () => {
118
- i || (i = !0, await n.query(J(t)));
137
+ `, bt = (e) => {
138
+ let t = e.tableName ?? q, { client: n } = e, r = /* @__PURE__ */ new Map(), i = !1, a = (async () => {
139
+ i || (i = !0, await n.query(yt(t)));
119
140
  })().then(async () => {
120
141
  let e = await n.query(`SELECT * FROM ${t}`);
121
142
  for (let t of e.rows) r.set(t.cache_key, {
@@ -127,10 +148,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
127
148
  staleWhileRevalidateMs: Number(t.stale_while_revalidate_ms)
128
149
  });
129
150
  }).catch((e) => {
130
- q.warn("postgres bootstrap failed", {}, e);
151
+ vt.warn("postgres bootstrap failed", {}, e);
131
152
  }), o = (e, t) => {
132
153
  a.then(() => n.query(e, t)).catch((e) => {
133
- q.warn("postgres write failed", {}, e);
154
+ vt.warn("postgres write failed", {}, e);
134
155
  });
135
156
  }, s = /* @__PURE__ */ new Map(), c = (e) => {
136
157
  s.set(e, (s.get(e) ?? 0) + 1);
@@ -181,21 +202,21 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
181
202
  return Array.from(r.entries());
182
203
  }
183
204
  };
184
- }, Y = U({ scope: "voltro:start:revalidate" }), _t = (e) => {
205
+ }, J = H({ scope: "voltro:start:revalidate" }), xt = (e) => {
185
206
  try {
186
207
  let t = JSON.parse(e);
187
208
  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") ? {
188
209
  kind: t.kind,
189
210
  value: t.value,
190
211
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
191
- } : (Y.warn("bad revalidation payload (shape)", { payload: e }), null);
212
+ } : (J.warn("bad revalidation payload (shape)", { payload: e }), null);
192
213
  } catch {
193
- return Y.warn("bad revalidation payload (not JSON)", { payload: e }), null;
214
+ return J.warn("bad revalidation payload (not JSON)", { payload: e }), null;
194
215
  }
195
- }, vt = (e, t) => {
216
+ }, St = (e, t) => {
196
217
  if (t.kind === "table" || t.kind === "tag") {
197
218
  let n = e.tableSink(t.value);
198
- return Y.info(`revalidate ${t.kind} '${t.value}' → dropped ${n} cache entries`, {
219
+ return J.info(`revalidate ${t.kind} '${t.value}' → dropped ${n} cache entries`, {
199
220
  kind: t.kind,
200
221
  value: t.value,
201
222
  dropped: n
@@ -204,7 +225,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
204
225
  let n = t.value, r = (e) => t.tenant === void 0 || e.split("|").includes(`tenant=${t.tenant}`), i = e.regexByPattern.get(n);
205
226
  if (i !== void 0) {
206
227
  let a = e.renderModeByPattern.get(n);
207
- if (a !== "isr") return Y.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.`, {
228
+ if (a !== "isr") return J.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.`, {
208
229
  path: n,
209
230
  renderMode: a ?? "unknown"
210
231
  }), 0;
@@ -212,27 +233,27 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
212
233
  let t = e.split("|")[0] ?? e;
213
234
  return i.test(t) && r(e);
214
235
  });
215
- return Y.info(`revalidate path pattern '${n}' → dropped ${o} cache entries`, {
236
+ return J.info(`revalidate path pattern '${n}' → dropped ${o} cache entries`, {
216
237
  path: n,
217
238
  dropped: o,
218
239
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
219
240
  }), o;
220
241
  }
221
242
  let a = [...e.regexByPattern.entries()].find(([, e]) => e.test(n));
222
- if (a === void 0) return Y.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;
243
+ if (a === void 0) return J.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;
223
244
  let o = e.renderModeByPattern.get(a[0]);
224
- if (o !== "isr") return Y.error(`revalidatePath('${n}') targets a '${o ?? "unknown"}' route (${a[0]}) — only \`renderMode: 'isr'\` routes have cache entries to drop.`, {
245
+ if (o !== "isr") return J.error(`revalidatePath('${n}') targets a '${o ?? "unknown"}' route (${a[0]}) — only \`renderMode: 'isr'\` routes have cache entries to drop.`, {
225
246
  path: n,
226
247
  route: a[0],
227
248
  renderMode: o ?? "unknown"
228
249
  }), 0;
229
250
  let s = e.cache.invalidateBy((e) => (e.split("|")[0] ?? e) === n && r(e));
230
- return Y.info(`revalidate path '${n}' → dropped ${s} cache entries`, {
251
+ return J.info(`revalidate path '${n}' → dropped ${s} cache entries`, {
231
252
  path: n,
232
253
  dropped: s,
233
254
  ...t.tenant === void 0 ? {} : { tenant: t.tenant }
234
255
  }), s;
235
- }, X = U({ scope: "voltro:start" }), yt = tt() ?? "unknown", bt = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", Z = (e) => e instanceof Error && e._voltroControl === "not-found", xt = {
256
+ }, Y = H({ scope: "voltro:start" }), Ct = nt() ?? "unknown", X = (e) => e instanceof Error && e._voltroControl === "redirect" && typeof e.location == "string", wt = (e) => e instanceof Error && e._voltroControl === "not-found", Tt = {
236
257
  ".html": "text/html; charset=utf-8",
237
258
  ".js": "application/javascript",
238
259
  ".mjs": "application/javascript",
@@ -250,13 +271,13 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
250
271
  ".woff": "font/woff",
251
272
  ".woff2": "font/woff2",
252
273
  ".txt": "text/plain; charset=utf-8"
253
- }, St = (e) => xt[R(e).toLowerCase()] ?? "application/octet-stream", Ct = (e) => e.replace(/<script\b(?=[^>]*\btype="module")(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<script\b(?=[^>]*\bsrc=)(?:(?!<\/script>).)*<\/script>/gi, "").replace(/<link\b[^>]*\brel="modulepreload"[^>]*>/gi, ""), Q = async (e) => {
274
+ }, Et = (e) => Tt[L(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, ""), Z = async (e) => {
254
275
  try {
255
- return await V.stat(e), !0;
276
+ return await B.stat(e), !0;
256
277
  } catch {
257
278
  return !1;
258
279
  }
259
- }, wt = (e) => {
280
+ }, Ot = (e) => {
260
281
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
261
282
  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, "\\$&"));
262
283
  let a = i.join("/");
@@ -265,8 +286,8 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
265
286
  paramNames: t,
266
287
  priority: n
267
288
  };
268
- }, Tt = (e) => e.map((e) => {
269
- let { regex: t, paramNames: n, priority: r } = wt(e.pattern);
289
+ }, kt = (e) => e.map((e) => {
290
+ let { regex: t, paramNames: n, priority: r } = Ot(e.pattern);
270
291
  return {
271
292
  pattern: e.pattern,
272
293
  file: e.file,
@@ -275,7 +296,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
275
296
  paramNames: n,
276
297
  priority: r
277
298
  };
278
- }).slice().sort((e, t) => e.priority - t.priority), Et = (e, t) => {
299
+ }).slice().sort((e, t) => e.priority - t.priority), At = (e, t) => {
279
300
  for (let n of t) {
280
301
  let t = n.regex.exec(e);
281
302
  if (!t) continue;
@@ -287,7 +308,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
287
308
  };
288
309
  }
289
310
  return null;
290
- }, Dt = null, Ot, kt = (e, t) => t === void 0 ? Promise.resolve() : (Ot ??= (async () => {
311
+ }, jt = null, Mt, Nt = (e, t) => t === void 0 ? Promise.resolve() : (Mt ??= (async () => {
291
312
  try {
292
313
  let n = await e.getHelpers(), r = n.apiDescriptors?.[t];
293
314
  if (r === void 0) return;
@@ -295,263 +316,263 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
295
316
  if (i === void 0) return;
296
317
  i(t, await r());
297
318
  } catch {}
298
- })(), Ot), At = async (e) => {
299
- let { provider: t, route: a, params: o, pathname: s, dirs: c, shellTemplate: l, requestHeaders: u, requestUrl: f = "", apiOrigin: ee, apiName: g } = e;
300
- await kt(t, g);
301
- let { search: _ } = pe(f), v = await i(ie(e.middlewares ?? [], {
302
- route: a.pattern,
303
- pathname: s
319
+ })(), Mt), Pt = async (e) => {
320
+ let { provider: t, route: r, params: i, pathname: a, dirs: o, shellTemplate: s, requestHeaders: c, requestUrl: l = "", apiOrigin: u, apiName: d } = e;
321
+ await Nt(t, d);
322
+ let { search: p } = be(l), g = await ie(ae(e.middlewares ?? [], {
323
+ route: r.pattern,
324
+ pathname: a
304
325
  }), {
305
- pathname: s,
306
- search: _,
307
- headers: u,
308
- cookies: we(u.cookie),
309
- route: a.pattern
310
- }, e.onCookieWarning), b = await t.getPage(a.pattern, a.file), x = e.forceSsrRender === !0 ? "ssr" : Re(b, a.file), S = x === "isr" && b.ppr === !0, w = x === "isr" && e.holesOnly !== !0 ? C(v.headers) : v.headers, te = ye(ee, w.cookie, {
311
- apiName: g,
312
- headers: w
326
+ pathname: a,
327
+ search: p,
328
+ headers: c,
329
+ cookies: ee(c.cookie),
330
+ route: r.pattern
331
+ }, e.onCookieWarning), y = await t.getPage(r.pattern, r.file), x = e.forceSsrRender === !0 ? "ssr" : ze(y, r.file), ne = x === "isr" && y.ppr === !0, S = x === "isr" && e.holesOnly !== !0 ? h(g.headers) : g.headers, C = xe(u, S.cookie, {
332
+ apiName: d,
333
+ headers: S
313
334
  });
314
335
  if (e.holesOnly === !0) {
315
- if (typeof b.loader != "function") return null;
336
+ if (typeof y.loader != "function") return null;
316
337
  let e = new AbortController();
317
338
  return {
318
339
  holes: {
319
- loader: b.loader,
340
+ loader: y.loader,
320
341
  ctx: {
321
- params: o,
322
- pathname: s,
323
- search: _,
342
+ params: i,
343
+ pathname: a,
344
+ search: p,
324
345
  signal: e.signal,
325
- headers: w,
326
- query: te,
346
+ headers: S,
347
+ query: C,
327
348
  isServer: !0
328
349
  },
329
350
  helpers: await t.getHelpers(),
330
- page: a.pattern
351
+ page: r.pattern
331
352
  },
332
- setCookies: v.setCookies
353
+ setCookies: g.setCookies
333
354
  };
334
355
  }
335
- let E = x === "spa" && xe(c, a.dirChain).some((e) => e.hasLayout);
336
- if (x !== "ssr" && x !== "isr" && !E) return null;
337
- let ne = xe(c, a.dirChain), oe = {}, se = null, O, le = new AbortController(), ue = S ? j(w, a.pattern) : w;
356
+ let w = x === "spa" && we(o, r.dirChain).some((e) => e.hasLayout);
357
+ if (x !== "ssr" && x !== "isr" && !w) return null;
358
+ let re = we(o, r.dirChain), oe = {}, ce = null, le, ue = new AbortController(), fe = ne ? b(S, r.pattern) : S;
338
359
  try {
339
- (await t.getHelpers()).beginStoreSeeds(), {chain: O, segmentLoaderData: oe} = await de({
340
- entries: ne,
360
+ (await t.getHelpers()).beginStoreSeeds(), {chain: le, segmentLoaderData: oe} = await D({
361
+ entries: re,
341
362
  loadLayout: (e) => t.getLayout(e.dir),
342
363
  loadError: (e) => t.getError(e.dir),
343
364
  loadPending: (e) => t.getPending(e.dir),
344
365
  ctx: {
345
- params: o,
346
- pathname: s,
347
- search: _,
348
- signal: le.signal,
349
- headers: ue,
350
- query: te,
366
+ params: i,
367
+ pathname: a,
368
+ search: p,
369
+ signal: ue.signal,
370
+ headers: fe,
371
+ query: C,
351
372
  isServer: !0
352
373
  }
353
- }), typeof b.loader == "function" && !E && (se = await b.loader({
354
- params: o,
355
- pathname: s,
356
- search: _,
357
- signal: le.signal,
358
- headers: ue,
359
- query: te,
374
+ }), typeof y.loader == "function" && !w && (ce = await y.loader({
375
+ params: i,
376
+ pathname: a,
377
+ search: p,
378
+ signal: ue.signal,
379
+ headers: fe,
380
+ query: C,
360
381
  isServer: !0
361
382
  }));
362
383
  } catch (e) {
363
- if (bt(e)) return {
384
+ if (X(e)) return {
364
385
  control: "redirect",
365
386
  status: e.status,
366
387
  location: e.location,
367
- setCookies: v.setCookies,
368
- responseHeaders: v.responseHeaders
388
+ setCookies: g.setCookies,
389
+ responseHeaders: g.responseHeaders
369
390
  };
370
- if (Z(e)) return {
391
+ if (wt(e)) return {
371
392
  control: "not-found",
372
- setCookies: v.setCookies,
373
- responseHeaders: v.responseHeaders
393
+ setCookies: g.setCookies,
394
+ responseHeaders: g.responseHeaders
374
395
  };
375
396
  throw e;
376
397
  }
377
- let k = await t.getHelpers();
378
- E || await re({
379
- pageMod: b,
380
- params: o,
381
- query: te,
382
- apiName: g,
383
- seed: k.seedPreloadedSubscription,
384
- seedFailure: k.seedPreloadedSubscriptionFailure,
385
- onError: ({ tag: e, apiName: t }, n) => X.warn("preload seed failed", {
398
+ let O = await t.getHelpers();
399
+ w || await te({
400
+ pageMod: y,
401
+ params: i,
402
+ query: C,
403
+ apiName: d,
404
+ seed: O.seedPreloadedSubscription,
405
+ seedFailure: O.seedPreloadedSubscriptionFailure,
406
+ onError: ({ tag: e, apiName: t }, n) => Y.warn("preload seed failed", {
386
407
  tag: e,
387
408
  apiName: t,
388
- pathname: s
409
+ pathname: a
389
410
  }, n)
390
411
  });
391
- let fe = {
392
- pattern: a.pattern,
393
- Component: b.default,
394
- meta: b.meta,
395
- loader: b.loader,
396
- ErrorBoundary: b.ErrorBoundary,
397
- Pending: b.Pending,
412
+ let pe = {
413
+ pattern: r.pattern,
414
+ Component: y.default,
415
+ meta: y.meta,
416
+ loader: y.loader,
417
+ ErrorBoundary: y.ErrorBoundary,
418
+ Pending: y.Pending,
398
419
  renderMode: x,
399
- chain: O
420
+ chain: le
400
421
  };
401
- if (x === "isr" && v.cspNonce !== void 0) throw Error(`page '${a.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.`);
422
+ if (x === "isr" && g.cspNonce !== void 0) throw Error(`page '${r.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.`);
402
423
  let me = {
403
- cookies: S ? r(y(v.cookies), a.pattern) : x === "isr" ? y(v.cookies) : v.cookies,
404
- headers: ue,
405
- url: f,
424
+ cookies: ne ? v(f(g.cookies), r.pattern) : x === "isr" ? f(g.cookies) : g.cookies,
425
+ headers: fe,
426
+ url: l,
406
427
  ...e.formFlash === void 0 ? {} : { formFlash: e.formFlash }
407
- }, A = k.i18n?.resolve(w.cookie, w["accept-language"]), he = {
408
- lang: A?.locale ?? me.cookies["voltro:locale"] ?? "en",
409
- ...A?.timeZone === void 0 ? {} : { timeZone: A.timeZone },
428
+ }, k = O.i18n?.resolve(S.cookie, S["accept-language"]), he = {
429
+ lang: k?.locale ?? me.cookies["voltro:locale"] ?? "en",
430
+ ...k?.timeZone === void 0 ? {} : { timeZone: k.timeZone },
410
431
  renderedAt: Date.now()
411
- }, N = b.interactive ?? "full";
412
- if (E) {
413
- let e = ce({
414
- helpers: k,
415
- page: a.pattern,
416
- interactive: N,
432
+ }, A = y.interactive ?? "full";
433
+ if (w) {
434
+ let e = de({
435
+ helpers: O,
436
+ page: r.pattern,
437
+ interactive: A,
417
438
  delivery: "stream",
418
439
  renderInput: {
419
- descriptor: fe,
420
- params: o,
421
- pathname: s,
422
- search: _,
440
+ descriptor: pe,
441
+ params: i,
442
+ pathname: a,
443
+ search: p,
423
444
  segmentLoaderData: oe,
424
445
  requestContext: me,
425
- ...A ? {
426
- outerWrap: A.outerWrap,
427
- locale: A.locale
446
+ ...k ? {
447
+ outerWrap: k.outerWrap,
448
+ locale: k.locale
428
449
  } : {}
429
450
  }
430
- }), t = (t) => n({
431
- helpers: k,
451
+ }), t = (t) => ve({
452
+ helpers: O,
432
453
  prepared: e,
433
454
  meta: t,
434
- interactive: N
455
+ interactive: A
435
456
  });
436
457
  if (e.hasDeferred) {
437
- let n = h({ shell: l });
458
+ let n = E({ shell: s });
438
459
  return {
439
460
  renderMode: "spa",
440
- setCookies: v.setCookies,
441
- responseHeaders: v.responseHeaders,
442
- stream: (r) => m({
461
+ setCookies: g.setCookies,
462
+ responseHeaders: g.responseHeaders,
463
+ stream: (r) => se({
443
464
  res: r,
444
465
  shell: n,
445
466
  documentAttrs: he,
446
467
  headers: {
447
- ...v.responseHeaders,
468
+ ...g.responseHeaders,
448
469
  "content-type": "text/html; charset=utf-8",
449
470
  "x-voltro-rendered-by": "spa",
450
- ...p(v.setCookies)
471
+ ...P(g.setCookies)
451
472
  },
452
473
  headInjection: t,
453
- ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce },
454
- render: (t) => k.renderPageToStream({
474
+ ...g.cspNonce === void 0 ? {} : { nonce: g.cspNonce },
475
+ render: (t) => O.renderPageToStream({
455
476
  ...e.renderInput,
456
477
  ...t,
457
- ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce }
478
+ ...g.cspNonce === void 0 ? {} : { nonce: g.cspNonce }
458
479
  }),
459
480
  onShellError: (e) => {
460
- X.error("spa layout shell render failed", { pathname: s }, e), r.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), r.end("server error");
481
+ Y.error("spa layout shell render failed", { pathname: a }, e), r.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), r.end("server error");
461
482
  }
462
483
  })
463
484
  };
464
485
  }
465
- let r = T({
466
- helpers: k,
486
+ let n = N({
487
+ helpers: O,
467
488
  prepared: e
468
- }), i = D(d(l.replace("<div id=\"root\"></div>", `<div id="root">${r.body}</div>`), t(r.meta)), he);
489
+ }), o = M(m(s.replace("<div id=\"root\"></div>", `<div id="root">${n.body}</div>`), t(n.meta)), he);
469
490
  return {
470
- html: v.cspNonce === void 0 ? i : F(i, v.cspNonce),
491
+ html: g.cspNonce === void 0 ? o : T(o, g.cspNonce),
471
492
  renderMode: "spa",
472
493
  revalidateMs: null,
473
- setCookies: v.setCookies,
474
- responseHeaders: v.responseHeaders
494
+ setCookies: g.setCookies,
495
+ responseHeaders: g.responseHeaders
475
496
  };
476
497
  }
477
- let P = ae({
478
- helpers: k,
479
- page: a.pattern,
480
- pathname: s,
498
+ let j = n({
499
+ helpers: O,
500
+ page: r.pattern,
501
+ pathname: a,
481
502
  renderMode: x,
482
- interactive: N,
483
- loaderData: se,
503
+ interactive: A,
504
+ loaderData: ce,
484
505
  segmentLoaderData: oe,
485
- pageLoaderRan: typeof b.loader == "function",
486
- ...S ? { ppr: !0 } : {}
506
+ pageLoaderRan: typeof y.loader == "function",
507
+ ...ne ? { ppr: !0 } : {}
487
508
  });
488
- S && M(P.stateInput, a.pattern);
509
+ ne && _(j.stateInput, r.pattern);
489
510
  let ge = {
490
- descriptor: fe,
491
- params: o,
492
- pathname: s,
493
- search: _,
494
- loaderData: P.loaderData,
495
- segmentLoaderData: P.segmentLoaderData,
511
+ descriptor: pe,
512
+ params: i,
513
+ pathname: a,
514
+ search: p,
515
+ loaderData: j.loaderData,
516
+ segmentLoaderData: j.segmentLoaderData,
496
517
  requestContext: me,
497
- ...A ? {
498
- outerWrap: A.outerWrap,
499
- locale: A.locale
518
+ ...k ? {
519
+ outerWrap: k.outerWrap,
520
+ locale: k.locale
500
521
  } : {}
501
522
  }, _e = (t) => {
502
- if (Dt === null || x !== "ssr" && x !== "isr" || typeof b.ogImage != "function" || t.includes("og:image")) return "";
503
- let n = w["x-tenant"], r = Dt.signOgUrl({
504
- pattern: a.pattern,
523
+ if (jt === null || x !== "ssr" && x !== "isr" || typeof y.ogImage != "function" || t.includes("og:image")) return "";
524
+ let n = S["x-tenant"], i = jt.signOgUrl({
525
+ pattern: r.pattern,
505
526
  params: e.params,
506
527
  ...n === void 0 ? {} : { tenant: n }
507
528
  });
508
- return `<meta property="og:image" content="${r}" /><meta name="twitter:image" content="${r}" /><meta name="twitter:card" content="summary_large_image" />`;
509
- }, ve = (e) => [
510
- k.renderMetaToHtml(e) + _e(k.renderMetaToHtml(e)),
511
- `<meta name="voltro-interactive" content="${N}" />`,
512
- ...P.hasDeferred ? [k.renderDeferredRegistryScript()] : [],
513
- k.renderRouterStateScript(P.stateInput)
529
+ return `<meta property="og:image" content="${i}" /><meta name="twitter:image" content="${i}" /><meta name="twitter:card" content="summary_large_image" />`;
530
+ }, ye = (e) => [
531
+ O.renderMetaToHtml(e) + _e(O.renderMetaToHtml(e)),
532
+ `<meta name="voltro-interactive" content="${A}" />`,
533
+ ...j.hasDeferred ? [O.renderDeferredRegistryScript()] : [],
534
+ O.renderRouterStateScript(j.stateInput)
514
535
  ].filter((e) => e.length > 0).join("\n ");
515
- if (x === "ssr" && N === "full" && e.buffered !== !0) {
516
- let e = h({ shell: l });
536
+ if (x === "ssr" && A === "full" && e.buffered !== !0) {
537
+ let e = E({ shell: s });
517
538
  return {
518
539
  renderMode: "ssr",
519
- setCookies: v.setCookies,
520
- stream: (t) => m({
540
+ setCookies: g.setCookies,
541
+ stream: (t) => se({
521
542
  res: t,
522
543
  shell: e,
523
544
  documentAttrs: he,
524
545
  headers: {
525
- ...v.responseHeaders,
546
+ ...g.responseHeaders,
526
547
  "content-type": "text/html; charset=utf-8",
527
548
  "x-voltro-rendered-by": "ssr",
528
- ...p(v.setCookies)
549
+ ...P(g.setCookies)
529
550
  },
530
- headInjection: ve,
531
- ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce },
532
- render: (e) => k.renderPageToStream({
551
+ headInjection: ye,
552
+ ...g.cspNonce === void 0 ? {} : { nonce: g.cspNonce },
553
+ render: (e) => O.renderPageToStream({
533
554
  ...ge,
534
555
  ...e,
535
- ...v.cspNonce === void 0 ? {} : { nonce: v.cspNonce }
556
+ ...g.cspNonce === void 0 ? {} : { nonce: g.cspNonce }
536
557
  }),
537
558
  onShellError: (e) => {
538
- X.error("ssr shell render failed", { pathname: s }, e), t.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), t.end("server error");
559
+ Y.error("ssr shell render failed", { pathname: a }, e), t.writeHead(500, { "content-type": "text/plain; charset=utf-8" }), t.end("server error");
539
560
  }
540
561
  })
541
562
  };
542
563
  }
543
- let { html: be, meta: Se } = k.renderPageToHtml(ge), Ce = ve(Se), I = D(d(l.replace("<div id=\"root\"></div>", `<div id="root">${be}</div>`), Ce), he);
544
- N === "none" && (I = Ct(I));
545
- let Te = x === "isr" ? L(b.revalidate) : null;
564
+ let { html: Se, meta: Ce } = O.renderPageToHtml(ge), Te = ye(Ce), F = M(m(s.replace("<div id=\"root\"></div>", `<div id="root">${Se}</div>`), Te), he);
565
+ A === "none" && (F = Dt(F));
566
+ let Ee = x === "isr" ? I(y.revalidate) : null;
546
567
  return {
547
- html: v.cspNonce === void 0 ? I : F(I, v.cspNonce),
568
+ html: g.cspNonce === void 0 ? F : T(F, g.cspNonce),
548
569
  renderMode: x,
549
- revalidateMs: Te,
550
- setCookies: v.setCookies,
551
- responseHeaders: v.responseHeaders
570
+ revalidateMs: Ee,
571
+ setCookies: g.setCookies,
572
+ responseHeaders: g.responseHeaders
552
573
  };
553
- }, $ = (e) => e === "" ? "/" : e, jt = async (e) => {
554
- let t = await import(H(e).href);
574
+ }, Q = (e) => e === "" ? "/" : e, Ft = async (e) => {
575
+ let t = await import(V(e).href);
555
576
  return {
556
577
  kind: "bundle",
557
578
  getPageMeta: () => t.pageMeta,
@@ -561,18 +582,18 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
561
582
  return typeof r == "function" ? await r() : r;
562
583
  },
563
584
  async getLayout(e) {
564
- let n = t.layouts[$(e)];
565
- if (!n) throw Error(`[voltro start] ssr bundle missing layout for dir ${$(e)}`);
585
+ let n = t.layouts[Q(e)];
586
+ if (!n) throw Error(`[voltro start] ssr bundle missing layout for dir ${Q(e)}`);
566
587
  return typeof n == "function" ? await n() : n;
567
588
  },
568
589
  async getError(e) {
569
- let n = t.errors[$(e)];
570
- if (!n) throw Error(`[voltro start] ssr bundle missing error for dir ${$(e)}`);
590
+ let n = t.errors[Q(e)];
591
+ if (!n) throw Error(`[voltro start] ssr bundle missing error for dir ${Q(e)}`);
571
592
  return typeof n == "function" ? await n() : n;
572
593
  },
573
594
  async getPending(e) {
574
- let n = t.pendings[$(e)];
575
- if (!n) throw Error(`[voltro start] ssr bundle missing pending for dir ${$(e)}`);
595
+ let n = t.pendings[Q(e)];
596
+ if (!n) throw Error(`[voltro start] ssr bundle missing pending for dir ${Q(e)}`);
576
597
  return typeof n == "function" ? await n() : n;
577
598
  },
578
599
  async getHelpers() {
@@ -580,8 +601,8 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
580
601
  },
581
602
  async close() {}
582
603
  };
583
- }, Mt = async (e, t) => {
584
- let n = await O("vite", () => import("vite")), r = (await import("@vitejs/plugin-react")).default, i = (await import("@tailwindcss/vite")).default, a = await n.createServer({
604
+ }, It = async (e, t) => {
605
+ let n = await S("vite", () => import("vite")), r = (await import("@vitejs/plugin-react")).default, i = (await import("@tailwindcss/vite")).default, a = await n.createServer({
585
606
  root: t,
586
607
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
587
608
  plugins: [r(), i()],
@@ -598,10 +619,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
598
619
  },
599
620
  appType: "custom",
600
621
  logLevel: "warn"
601
- }), o = z(e, "src", "pages"), s = (e) => e === "" ? o : z(o, e), c = w({
602
- limit: u(),
603
- onColdStart: (e) => X.debug("ssr cold-compile start", { id: e }),
604
- onColdEnd: (e, { durationMs: t, failed: n }) => X.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
622
+ }), o = R(e, "src", "pages"), s = (e) => e === "" ? o : R(o, e), c = g({
623
+ limit: w(),
624
+ onColdStart: (e) => Y.debug("ssr cold-compile start", { id: e }),
625
+ onColdEnd: (e, { durationMs: t, failed: n }) => Y.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
605
626
  id: e,
606
627
  ms: t,
607
628
  ...n ? { failed: !0 } : {}
@@ -610,16 +631,16 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
610
631
  return {
611
632
  kind: "middleware",
612
633
  async getPage(e, t) {
613
- return l(z(o, t));
634
+ return l(R(o, t));
614
635
  },
615
636
  async getLayout(e) {
616
- return l(z(s(e), "layout.tsx"));
637
+ return l(R(s(e), "layout.tsx"));
617
638
  },
618
639
  async getError(e) {
619
- return l(z(s(e), "error.tsx"));
640
+ return l(R(s(e), "error.tsx"));
620
641
  },
621
642
  async getPending(e) {
622
- return l(z(s(e), "loading.tsx"));
643
+ return l(R(s(e), "loading.tsx"));
623
644
  },
624
645
  async getHelpers() {
625
646
  return await l("@voltro/web/ssr");
@@ -628,173 +649,184 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
628
649
  await a.close();
629
650
  }
630
651
  };
631
- }, Nt = async (t) => {
632
- let n = Je(), r = await P(t);
633
- if (!r) return {
652
+ }, Lt = async (t) => {
653
+ let n = Ye(), f = await j(t);
654
+ if (!f) return {
634
655
  ran: !1,
635
656
  exitCode: 0
636
657
  };
637
- if (r.type !== "web") return X.error("only web apps are supported by `voltro start`"), {
658
+ if (f.type !== "web") return Y.error("only web apps are supported by `voltro start`"), {
638
659
  ran: !0,
639
660
  exitCode: 1
640
661
  };
641
662
  {
642
- let e = a(r);
643
- if (e !== void 0) return X.error(`voltro start: refusing to boot — ${e}`), {
663
+ let e = s(f);
664
+ if (e !== void 0) return Y.error(`voltro start: refusing to boot — ${e}`), {
644
665
  ran: !0,
645
666
  exitCode: 1
646
667
  };
647
668
  }
648
- let { resolved: u } = await ee({
649
- rawEnv: r.env,
669
+ let { resolved: m } = await oe({
670
+ rawEnv: f.env,
650
671
  appType: "web",
651
672
  root: t,
652
- log: X,
673
+ log: Y,
653
674
  generateTypes: !1
654
- }), d = u.publicValues;
675
+ }), te = m.publicValues;
655
676
  n.mark("config");
656
- let p = le();
657
- N(p), X.info("booting voltro start", { app: r.name ?? "(unnamed)" });
658
- let m = je({
677
+ let h = ue();
678
+ fe(h), Y.info("booting voltro start", { app: f.name ?? "(unnamed)" });
679
+ let g = Me({
659
680
  kind: "web",
660
- configPort: r.port,
681
+ configPort: f.port,
661
682
  env: process.env,
662
- dashboardPin: process.env[be] === "1"
683
+ dashboardPin: process.env[pe] === "1"
663
684
  });
664
- for (let e of m.warnings) X.warn(e);
665
- let h = m.port, y = z(t, ".framework"), C = z(y, "dist"), w = z(C, "index.html");
666
- if (!await Q(w)) return X.error("no built dist found — run `voltro build` first", { distDir: C }), {
685
+ for (let e of g.warnings) Y.warn(e);
686
+ let _ = g.port, v = R(t, ".framework");
687
+ {
688
+ let e;
689
+ try {
690
+ e = JSON.parse(await B.readFile(R(v, "env.public.json"), "utf8"));
691
+ } catch {
692
+ e = void 0;
693
+ }
694
+ let t = ft(process.env, e);
695
+ t.length > 0 && Y.warn(pt(t));
696
+ }
697
+ let b = R(v, "dist"), S = R(b, "index.html");
698
+ if (!await Z(S)) return Y.error("no built dist found — run `voltro build` first", { distDir: b }), {
667
699
  ran: !0,
668
700
  exitCode: 1
669
701
  };
670
- let T = r.name ?? "unnamed", re = Ke("web", T, h), D = qe(T);
671
- await Ue({
672
- id: re,
673
- name: T,
702
+ let w = f.name ?? "unnamed", T = qe("web", w, _), E = Je(w);
703
+ await We({
704
+ id: T,
705
+ name: w,
674
706
  kind: "web",
675
- url: `http://localhost:${h}`,
707
+ url: `http://localhost:${_}`,
676
708
  pid: process.pid,
677
709
  status: "booting",
678
- logFile: D.path
710
+ logFile: E.path
679
711
  }).catch(() => {});
680
- let ae = z(C, "_voltro", "shell.html"), O = await Q(ae) ? await V.readFile(ae, "utf8") : await V.readFile(w, "utf8"), ce = await me(t, r), de = Pe(r), j = Ye(r), M = ge(ce[0]), F = ce[0]?.name, Re = /* @__PURE__ */ new Set(), L = (e) => {
681
- Re.has(e.name) || (Re.add(e.name), X.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
712
+ let se = R(b, "_voltro", "shell.html"), D = await Z(se) ? await B.readFile(se, "utf8") : await B.readFile(S, "utf8"), de = await O(t, f), ve = Fe(f), M = Xe(f), N = _e(de[0]), P = de[0]?.name, ze = /* @__PURE__ */ new Set(), I = (e) => {
713
+ ze.has(e.name) || (ze.add(e.name), Y.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
682
714
  cookie: e.name,
683
715
  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."
684
716
  }));
685
- }, R = await g(t);
686
- R.length > 0 && X.info(`middleware.ts loaded — ${R.length} middleware(s): ` + R.map((e) => e.exportName).join(", "));
687
- let B, H = null, U = process.env.SSR_CACHE === "postgres";
688
- if (U && Ne()) H = new (await (import("pg"))).default.Client(Me()), await H.connect(), B = gt({ client: H }), X.info("isr cache backend: postgres", { table: "voltro_isr_cache" });
689
- else if (U) {
717
+ }, L = await a(t);
718
+ L.length > 0 && Y.info(`middleware.ts loaded — ${L.length} middleware(s): ` + L.map((e) => e.exportName).join(", "));
719
+ let z, V = null, H = process.env.SSR_CACHE === "postgres";
720
+ if (H && Pe()) V = new (await (import("pg"))).default.Client(Ne()), await V.connect(), z = bt({ client: V }), Y.info("isr cache backend: postgres", { table: "voltro_isr_cache" });
721
+ else if (H) {
690
722
  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).";
691
- if (e()) throw X.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");
692
- B = Be(), X.warn(`${t} Falling back to the per-process memory cache — this would be a hard failure in production.`);
693
- } else B = Be(), X.info("isr cache backend: memory (per-process)", { hint: "set SSR_CACHE=postgres for persistent storage" });
694
- await Ce(t, r, ce, d);
695
- let tt = z(t, "src", "pages"), { pages: nt, dirs: W } = await E(tt), G = Tt(nt);
696
- l(R, G.map((e) => e.pattern)), n.mark("scan");
697
- let K = z(C, "server", "ssrEntry.js"), pt = await Q(K);
698
- if (!pt && process.env.NODE_ENV === "production") throw X.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}`);
699
- let q = pt ? await jt(K) : await Mt(t, y);
700
- X.info(`ssr loader: ${q.kind}`, {
701
- kind: q.kind,
702
- ...q.kind === "middleware" ? { hint: "no pre-built SSR bundle found; run `voltro build` to enable bundle mode" } : {}
723
+ if (e()) throw Y.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");
724
+ z = Ve(), Y.warn(`${t} Falling back to the per-process memory cache — this would be a hard failure in production.`);
725
+ } else z = Ve(), Y.info("isr cache backend: memory (per-process)", { hint: "set SSR_CACHE=postgres for persistent storage" });
726
+ await o(t, f, de, te);
727
+ let nt = R(t, "src", "pages"), { pages: rt, dirs: U } = await re(nt), W = kt(rt);
728
+ C(L, W.map((e) => e.pattern)), n.mark("scan");
729
+ let dt = R(b, "server", "ssrEntry.js"), G = await Z(dt);
730
+ if (!G && process.env.NODE_ENV === "production") throw Y.fatal(`production \`voltro start\` requires a precompiled SSR bundle at ${dt} 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 ${dt}`);
731
+ let K = G ? await Ft(dt) : await It(t, v);
732
+ Y.info(`ssr loader: ${K.kind}`, {
733
+ kind: K.kind,
734
+ ...K.kind === "middleware" ? { hint: "no pre-built SSR bundle found; run `voltro build` to enable bundle mode" } : {}
703
735
  }), n.mark("provider");
704
- let ht = q.getPageMeta?.();
705
- o(t);
706
- let J = /* @__PURE__ */ new Map(), Y = 0;
707
- for (let e of nt) {
708
- let t = ht?.[e.pattern];
736
+ let vt = K.getPageMeta?.();
737
+ c(t);
738
+ let q = /* @__PURE__ */ new Map(), yt = 0;
739
+ for (let e of rt) {
740
+ let t = vt?.[e.pattern];
709
741
  if (t) {
710
- J.set(e.pattern, t);
742
+ q.set(e.pattern, t);
711
743
  continue;
712
744
  }
713
745
  try {
714
- let t = await q.getPage(e.pattern, e.file);
715
- J.set(e.pattern, Le(t, e.file)), Y++;
746
+ let t = await K.getPage(e.pattern, e.file);
747
+ q.set(e.pattern, Re(t, e.file)), yt++;
716
748
  } catch (t) {
717
- X.warn("failed to load page metadata", { pattern: e.pattern }, t);
749
+ Y.warn("failed to load page metadata", { pattern: e.pattern }, t);
718
750
  }
719
751
  }
720
- let bt = /* @__PURE__ */ new Map();
721
- for (let [e, t] of J) {
752
+ let J = /* @__PURE__ */ new Map();
753
+ for (let [e, t] of q) {
722
754
  if (t.interactive !== "islands") continue;
723
- let n = z(C, "island-shells", `${S(e)}.html`);
755
+ let n = R(b, "island-shells", `${k(e)}.html`);
724
756
  try {
725
- bt.set(e, await V.readFile(n, "utf8"));
757
+ J.set(e, await B.readFile(n, "utf8"));
726
758
  } catch {
727
- X.warn("islands page has no built per-page shell — serving the full app shell", {
759
+ Y.warn("islands page has no built per-page shell — serving the full app shell", {
728
760
  pattern: e,
729
761
  expected: n
730
762
  });
731
763
  }
732
764
  }
733
- X.info(`registered ${J.size} route(s)`, {
734
- count: J.size,
735
- fromManifest: J.size - Y,
736
- fromModules: Y
765
+ Y.info(`registered ${q.size} route(s)`, {
766
+ count: q.size,
767
+ fromManifest: q.size - yt,
768
+ fromModules: yt
737
769
  }), n.mark("routes");
738
- let Z = /* @__PURE__ */ new Set();
739
- for (let e of G) J.get(e.pattern)?.renderMode === "spa" && xe(W, e.dirChain).some((e) => e.hasLayout) && Z.add(e.pattern);
740
- Z.size > 0 && X.info(`${Z.size} spa route(s) render an SSR layout shell`, { patterns: [...Z] });
741
- let xt = /* @__PURE__ */ new Map();
742
- for (let [e, t] of J) t.cacheInvalidatesOn.length > 0 && xt.set(e, t.cacheInvalidatesOn);
743
- let Ct = /* @__PURE__ */ new Map();
744
- for (let e of G) Ct.set(e.pattern, e.regex);
770
+ let X = /* @__PURE__ */ new Set();
771
+ for (let e of W) q.get(e.pattern)?.renderMode === "spa" && we(U, e.dirChain).some((e) => e.hasLayout) && X.add(e.pattern);
772
+ X.size > 0 && Y.info(`${X.size} spa route(s) render an SSR layout shell`, { patterns: [...X] });
773
+ let wt = /* @__PURE__ */ new Map();
774
+ for (let [e, t] of q) t.cacheInvalidatesOn.length > 0 && wt.set(e, t.cacheInvalidatesOn);
775
+ let Tt = /* @__PURE__ */ new Map();
776
+ for (let e of W) Tt.set(e.pattern, e.regex);
745
777
  {
746
- let n = new Set([...J].filter(([, e]) => (e.renderMode === "ssr" || e.renderMode === "isr") && e.hasOgImage).map(([e]) => e));
778
+ let n = new Set([...q].filter(([, e]) => (e.renderMode === "ssr" || e.renderMode === "isr") && e.hasOgImage).map(([e]) => e));
747
779
  if (n.size > 0) {
748
- let { secret: i, fromEnv: a } = Se();
749
- if (!a && e()) throw X.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");
750
- let o = new Map(nt.map((e) => [e.pattern, e.file]));
751
- Dt = ue({
780
+ let { secret: r, fromEnv: i } = Te();
781
+ if (!i && e()) throw Y.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");
782
+ let a = new Map(rt.map((e) => [e.pattern, e.file]));
783
+ jt = le({
752
784
  root: t,
753
- fonts: r.fonts,
754
- cache: B,
755
- secret: i,
785
+ fonts: f.fonts,
786
+ cache: z,
787
+ secret: r,
756
788
  isOgSsrRoute: (e) => n.has(e),
757
789
  getPageModule: async (e) => {
758
- let t = o.get(e);
759
- return t === void 0 ? null : await q.getPage(e, t);
790
+ let t = a.get(e);
791
+ return t === void 0 ? null : await K.getPage(e, t);
760
792
  }
761
- }), X.info(`og route active for ${n.size} ssr route(s)`, { secret: a ? "env" : "per-boot" });
793
+ }), Y.info(`og route active for ${n.size} ssr route(s)`, { secret: i ? "env" : "per-boot" });
762
794
  }
763
795
  }
764
- let wt = /* @__PURE__ */ new Map();
765
- for (let [e, t] of J) wt.set(e, t.renderMode);
766
- let Ot = [...J.values()].some((e) => e.renderMode === "isr"), kt = {
767
- cache: B,
768
- tableSink: ft({
769
- cache: B,
770
- tableSubscriptionsByPattern: xt,
771
- regexByPattern: Ct
796
+ let Dt = /* @__PURE__ */ new Map();
797
+ for (let [e, t] of q) Dt.set(e, t.renderMode);
798
+ let Ot = [...q.values()].some((e) => e.renderMode === "isr"), Mt = {
799
+ cache: z,
800
+ tableSink: gt({
801
+ cache: z,
802
+ tableSubscriptionsByPattern: wt,
803
+ regexByPattern: Tt
772
804
  }),
773
- regexByPattern: Ct,
774
- renderModeByPattern: wt
775
- }, $ = (e) => {
776
- let t = _t(e);
777
- t && vt(kt, t);
778
- }, Nt = mt({
779
- cache: B,
780
- tableSubscriptionsByPattern: xt,
781
- regexByPattern: Ct,
782
- ...Ot ? { onRevalidate: $ } : {}
783
- }), Pt = await Nt.start(), Ft = null, It = null;
805
+ regexByPattern: Tt,
806
+ renderModeByPattern: Dt
807
+ }, Nt = (e) => {
808
+ let t = xt(e);
809
+ t && St(Mt, t);
810
+ }, Q = _t({
811
+ cache: z,
812
+ tableSubscriptionsByPattern: wt,
813
+ regexByPattern: Tt,
814
+ ...Ot ? { onRevalidate: Nt } : {}
815
+ }), Lt = await Q.start(), $ = null, Rt = null;
784
816
  if (Ot) {
785
- let e = ct({}, process.env);
817
+ let e = lt({}, process.env);
786
818
  if (e.crossReplica) try {
787
- It = e.provider;
788
- let t = Fe(process.env);
789
- Ft = await st.runPromise(e.provider.subscribe(t, $)), X.info(`revalidation subscriber: broker (${e.provider.name})`, { channel: t });
819
+ Rt = e.provider;
820
+ let t = Ie(process.env);
821
+ $ = await ct.runPromise(e.provider.subscribe(t, Nt)), Y.info(`revalidation subscriber: broker (${e.provider.name})`, { channel: t });
790
822
  } catch (e) {
791
- X.warn("revalidation broker subscribe failed — broker leg disabled", {}, e), It = null;
823
+ Y.warn("revalidation broker subscribe failed — broker leg disabled", {}, e), Rt = null;
792
824
  }
793
- Pt && Ft === null && X.info("revalidation subscriber: postgres LISTEN (voltro_revalidate)"), !Pt && Ft === null && X.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.");
825
+ Lt && $ === null && Y.info("revalidation subscriber: postgres LISTEN (voltro_revalidate)"), !Lt && $ === null && Y.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
826
  }
795
827
  n.mark("cdc");
796
- let Lt = Ie(), Rt = nt.map((e) => {
797
- let t = J.get(e.pattern);
828
+ let zt = Le(), Bt = rt.map((e) => {
829
+ let t = q.get(e.pattern);
798
830
  return {
799
831
  pattern: e.pattern,
800
832
  file: e.file,
@@ -809,20 +841,20 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
809
841
  hasMeta: t?.hasMeta ?? !1,
810
842
  hasGetStaticPaths: t?.hasGetStaticPaths ?? !1
811
843
  };
812
- }), zt = W.map((e) => ({
844
+ }), Vt = U.map((e) => ({
813
845
  dir: e.dir,
814
846
  hasLayout: e.hasLayout,
815
847
  hasError: e.hasError,
816
848
  hasPending: e.hasPending,
817
849
  hasNotFound: e.hasNotFound
818
- })), Bt = H ? "postgres" : "memory", Vt = {
850
+ })), Ht = V ? "postgres" : "memory", Ut = {
819
851
  kind: "web",
820
852
  meta: {
821
- name: r.name ?? "(unnamed)",
822
- voltroVersion: yt,
823
- port: h,
824
- mode: et(),
825
- apis: Object.entries(r.apis ?? {}).map(([e, t]) => {
853
+ name: f.name ?? "(unnamed)",
854
+ voltroVersion: Ct,
855
+ port: _,
856
+ mode: tt(),
857
+ apis: Object.entries(f.apis ?? {}).map(([e, t]) => {
826
858
  let n = {
827
859
  name: e,
828
860
  package: t.package
@@ -830,10 +862,10 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
830
862
  return t.url !== void 0 && (n.url = t.url), n;
831
863
  })
832
864
  },
833
- routes: Rt,
834
- dirs: zt,
865
+ routes: Bt,
866
+ dirs: Vt,
835
867
  cache: () => {
836
- let e = Date.now(), t = B.snapshot().map(([t, n]) => ({
868
+ let e = Date.now(), t = z.snapshot().map(([t, n]) => ({
837
869
  key: t,
838
870
  renderedAt: n.renderedAt,
839
871
  expiresAt: n.expiresAt,
@@ -844,16 +876,16 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
844
876
  staleWhileRevalidateMs: n.staleWhileRevalidateMs
845
877
  }));
846
878
  return {
847
- backend: Bt,
848
- size: B.size(),
879
+ backend: Ht,
880
+ size: z.size(),
849
881
  entries: t
850
882
  };
851
883
  },
852
- metrics: () => ot()
853
- }, Ht = async (e, n) => {
854
- let a = e.split("?")[0] ?? "/";
855
- if (r.name === "voltroDashboard" && a === "/api/dashboard/registry") try {
856
- let e = await We();
884
+ metrics: () => st()
885
+ }, Wt = async (e, n) => {
886
+ let r = e.split("?")[0] ?? "/";
887
+ if (f.name === "voltroDashboard" && r === "/api/dashboard/registry") try {
888
+ let e = await Ge();
857
889
  return {
858
890
  status: 200,
859
891
  headers: { "content-type": "application/json; charset=utf-8" },
@@ -866,7 +898,7 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
866
898
  body: `registry read error: ${e.message}`
867
899
  };
868
900
  }
869
- if (r.name === "voltroDashboard" && a === "/api/dashboard/config") {
901
+ if (f.name === "voltroDashboard" && r === "/api/dashboard/config") {
870
902
  let e = process.env.VOLTRO_DASHBOARD_APPS, t = [];
871
903
  if (e && e.trim().length > 0) {
872
904
  let n;
@@ -895,27 +927,27 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
895
927
  body: JSON.stringify({ apps: t })
896
928
  };
897
929
  }
898
- if (Dt !== null && a === "/_voltro/og") {
899
- let t = await Dt.handle(new URL(e, "http://localhost"));
930
+ if (jt !== null && r === "/_voltro/og") {
931
+ let t = await jt.handle(new URL(e, "http://localhost"));
900
932
  if (t !== null) return {
901
933
  status: t.status,
902
934
  headers: { ...t.headers },
903
935
  body: Buffer.from(t.body)
904
936
  };
905
937
  }
906
- if (a === "/_voltro/inspect/logs") {
907
- let t = _e(e, fe(), n);
938
+ if (r === "/_voltro/inspect/logs") {
939
+ let t = A(e, ge(), n);
908
940
  return {
909
941
  status: t.status,
910
942
  headers: {
911
943
  "content-type": t.contentType,
912
- ...De(n.origin)
944
+ ...Oe(n.origin)
913
945
  },
914
946
  body: t.body
915
947
  };
916
948
  }
917
- if (a !== "/_voltro/inspect/stream") {
918
- let t = Oe(e, Vt, n);
949
+ if (r !== "/_voltro/inspect/stream") {
950
+ let t = ke(e, Ut, n);
919
951
  if (t !== null) return {
920
952
  status: t.status,
921
953
  headers: {
@@ -925,282 +957,282 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
925
957
  body: t.body
926
958
  };
927
959
  }
928
- let o = Et(a, G), s = o ? J.get(o.route.pattern)?.renderMode : void 0, c = s === "ssr" || s === "isr" || (o ? Z.has(o.route.pattern) : !1), l = [];
929
- if (!c && R.length > 0) {
930
- let t = ie(R, {
960
+ let i = At(r, W), a = i ? q.get(i.route.pattern)?.renderMode : void 0, o = a === "ssr" || a === "isr" || (i ? X.has(i.route.pattern) : !1), s = [];
961
+ if (!o && L.length > 0) {
962
+ let t = ae(L, {
931
963
  route: void 0,
932
- pathname: a
964
+ pathname: r
933
965
  });
934
966
  if (t !== void 0) {
935
- let r = await i(t, {
936
- pathname: a,
937
- search: e.slice(a.length),
967
+ let i = await ie(t, {
968
+ pathname: r,
969
+ search: e.slice(r.length),
938
970
  headers: n,
939
- cookies: we(n.cookie),
971
+ cookies: ee(n.cookie),
940
972
  route: void 0
941
973
  });
942
- l.push(...r.setCookies);
974
+ s.push(...i.setCookies);
943
975
  }
944
976
  }
945
- let u = (e) => l.length === 0 ? e : {
977
+ let c = (e) => s.length === 0 ? e : {
946
978
  ...e,
947
- "set-cookie": l.map(f)
948
- }, d = a === "/" ? z(C, "index.html") : z(C, a.replace(/^\//, ""), "index.html");
949
- if (!c && await Q(d)) {
950
- let e = await V.readFile(d);
979
+ "set-cookie": s.map(d)
980
+ }, u = r === "/" ? R(b, "index.html") : R(b, r.replace(/^\//, ""), "index.html");
981
+ if (!o && await Z(u)) {
982
+ let e = await B.readFile(u);
951
983
  return {
952
984
  status: 200,
953
- headers: u({
985
+ headers: c({
954
986
  "content-type": "text/html; charset=utf-8",
955
- "cache-control": Ze(j)
987
+ "cache-control": Qe(M)
956
988
  }),
957
989
  body: e
958
990
  };
959
991
  }
960
- if (a.endsWith(".map")) return {
992
+ if (r.endsWith(".map")) return {
961
993
  status: 404,
962
994
  headers: { "content-type": "text/plain; charset=utf-8" },
963
995
  body: "not found"
964
996
  };
965
- if (/\.[a-z0-9]+$/i.test(a)) {
966
- let e = z(C, a.replace(/^\//, ""));
967
- if (await Q(e)) {
968
- let t = Qe(a, j), r = it(n["accept-encoding"]), i = r === "br" ? `${e}.br` : r === "gzip" ? `${e}.gz` : void 0;
969
- if (i !== void 0 && await Q(i)) {
970
- let n = await V.readFile(e);
997
+ if (/\.[a-z0-9]+$/i.test(r)) {
998
+ let e = R(b, r.replace(/^\//, ""));
999
+ if (await Z(e)) {
1000
+ let t = $e(r, M), i = at(n["accept-encoding"]), a = i === "br" ? `${e}.br` : i === "gzip" ? `${e}.gz` : void 0;
1001
+ if (a !== void 0 && await Z(a)) {
1002
+ let n = await B.readFile(e);
971
1003
  return {
972
1004
  status: 200,
973
- headers: u({
974
- "content-type": St(e),
1005
+ headers: c({
1006
+ "content-type": Et(e),
975
1007
  "cache-control": t,
976
- "content-encoding": r === "br" ? "br" : "gzip",
1008
+ "content-encoding": i === "br" ? "br" : "gzip",
977
1009
  vary: "Accept-Encoding",
978
- etag: ut(n)
1010
+ etag: mt(n)
979
1011
  }),
980
- body: await V.readFile(i)
1012
+ body: await B.readFile(a)
981
1013
  };
982
1014
  }
983
- let o = await V.readFile(e);
1015
+ let o = await B.readFile(e);
984
1016
  return {
985
1017
  status: 200,
986
- headers: u({
987
- "content-type": St(e),
1018
+ headers: c({
1019
+ "content-type": Et(e),
988
1020
  "cache-control": t
989
1021
  }),
990
1022
  body: o
991
1023
  };
992
1024
  }
993
1025
  }
994
- let m = Et(a, G);
995
- if (!m) {
996
- let r = k(W, a);
997
- if (r !== void 0) try {
998
- let i = await At({
999
- provider: q,
1026
+ let p = At(r, W);
1027
+ if (!p) {
1028
+ let i = ce(U, r);
1029
+ if (i !== void 0) try {
1030
+ let a = await Pt({
1031
+ provider: K,
1000
1032
  root: t,
1001
1033
  route: {
1002
1034
  pattern: "<not-found>",
1003
- file: r.dir === "" ? "not-found.tsx" : `${r.dir}/not-found.tsx`,
1004
- dirChain: r.chain,
1035
+ file: i.dir === "" ? "not-found.tsx" : `${i.dir}/not-found.tsx`,
1036
+ dirChain: i.chain,
1005
1037
  regex: /^$/,
1006
1038
  paramNames: [],
1007
1039
  priority: 2 ** 53 - 1
1008
1040
  },
1009
1041
  params: {},
1010
- pathname: a,
1011
- dirs: W,
1012
- shellTemplate: O,
1042
+ pathname: r,
1043
+ dirs: U,
1044
+ shellTemplate: D,
1013
1045
  requestHeaders: n,
1014
- apiOrigin: M,
1015
- apiName: F,
1016
- middlewares: R,
1017
- onCookieWarning: L,
1046
+ apiOrigin: N,
1047
+ apiName: P,
1048
+ middlewares: L,
1049
+ onCookieWarning: I,
1018
1050
  requestUrl: e,
1019
1051
  buffered: !0,
1020
1052
  forceSsrRender: !0
1021
1053
  });
1022
- if (i && "html" in i && typeof i.html == "string") return {
1054
+ if (a && "html" in a && typeof a.html == "string") return {
1023
1055
  status: 404,
1024
- headers: u({
1056
+ headers: c({
1025
1057
  "content-type": "text/html; charset=utf-8",
1026
1058
  "x-voltro-rendered-by": "ssr-not-found"
1027
1059
  }),
1028
- body: i.html
1060
+ body: a.html
1029
1061
  };
1030
1062
  } catch (e) {
1031
- X.warn("not-found.tsx failed to render — serving the plain 404", { pathname: a }, e instanceof Error ? e : Error(String(e)));
1063
+ Y.warn("not-found.tsx failed to render — serving the plain 404", { pathname: r }, e instanceof Error ? e : Error(String(e)));
1032
1064
  }
1033
1065
  return {
1034
1066
  status: 404,
1035
- headers: u({
1067
+ headers: c({
1036
1068
  "content-type": "text/plain",
1037
1069
  "x-voltro-rendered-by": "plain-not-found"
1038
1070
  }),
1039
1071
  body: "not found"
1040
1072
  };
1041
1073
  }
1042
- let h = J.get(m.route.pattern), ee = n["x-tenant"] ?? "anonymous", g = (await q.getHelpers()).i18n?.resolve(n.cookie, n["accept-language"])?.locale, v = Ve(a, {
1043
- ...h?.tenantAware ? { tenant: ee } : {},
1074
+ let m = q.get(p.route.pattern), te = n["x-tenant"] ?? "anonymous", g = (await K.getHelpers()).i18n?.resolve(n.cookie, n["accept-language"])?.locale, _ = He(r, {
1075
+ ...m?.tenantAware ? { tenant: te } : {},
1044
1076
  ...g ? { locale: g } : {}
1045
- }), y = h?.ppr === !0 && h.renderMode === "isr", b = (r, i) => ({
1077
+ }), v = m?.ppr === !0 && m.renderMode === "isr", y = (i, a) => ({
1046
1078
  status: 200,
1047
1079
  headers: {},
1048
1080
  body: "",
1049
1081
  stream: (o) => {
1050
- _(m.route.pattern), o.writeHead(200, {
1082
+ l(p.route.pattern), o.writeHead(200, {
1051
1083
  "content-type": "text/html; charset=utf-8",
1052
1084
  "x-voltro-rendered-by": "isr",
1053
1085
  "x-voltro-ppr": "shell+holes",
1054
- ...i
1055
- }), o.write(r), (async () => {
1086
+ ...a
1087
+ }), o.write(i), (async () => {
1056
1088
  try {
1057
- let r = await At({
1058
- provider: q,
1089
+ let i = await Pt({
1090
+ provider: K,
1059
1091
  root: t,
1060
- route: m.route,
1061
- params: m.params,
1062
- pathname: a,
1063
- dirs: W,
1064
- shellTemplate: bt.get(m.route.pattern) ?? O,
1092
+ route: p.route,
1093
+ params: p.params,
1094
+ pathname: r,
1095
+ dirs: U,
1096
+ shellTemplate: J.get(p.route.pattern) ?? D,
1065
1097
  requestHeaders: n,
1066
- apiOrigin: M,
1067
- apiName: F,
1068
- middlewares: R,
1069
- onCookieWarning: L,
1098
+ apiOrigin: N,
1099
+ apiName: P,
1100
+ middlewares: L,
1101
+ onCookieWarning: I,
1070
1102
  requestUrl: e,
1071
1103
  holesOnly: !0
1072
1104
  });
1073
- r !== null && "holes" in r ? await x({
1074
- loader: r.holes.loader,
1075
- ctx: r.holes.ctx,
1105
+ i !== null && "holes" in i ? await me({
1106
+ loader: i.holes.loader,
1107
+ ctx: i.holes.ctx,
1076
1108
  res: o,
1077
- helpers: r.holes.helpers,
1078
- page: r.holes.page,
1079
- log: X
1109
+ helpers: i.holes.helpers,
1110
+ page: i.holes.page,
1111
+ log: Y
1080
1112
  }) : o.writableEnded || o.end();
1081
1113
  } catch (e) {
1082
- X.warn("ppr hole pass failed", { url: a }, e), o.writableEnded || o.end();
1114
+ Y.warn("ppr hole pass failed", { url: r }, e), o.writableEnded || o.end();
1083
1115
  }
1084
1116
  })();
1085
1117
  }
1086
- }), S = B.get(v), w = Date.now();
1087
- if (S && He(S, w)) return p.emit("cache", {
1118
+ }), x = z.get(_), S = Date.now();
1119
+ if (x && Ue(x, S)) return h.emit("cache", {
1088
1120
  kind: "HIT",
1089
- key: v,
1090
- ageMs: w - S.renderedAt
1091
- }), y ? b(S.html, {
1092
- "cache-control": Xe(j, S.revalidateMs, S.staleWhileRevalidateMs),
1121
+ key: _,
1122
+ ageMs: S - x.renderedAt
1123
+ }), v ? y(x.html, {
1124
+ "cache-control": Ze(M, x.revalidateMs, x.staleWhileRevalidateMs),
1093
1125
  "x-voltro-cache": "HIT",
1094
- "x-voltro-cache-key": v,
1095
- "x-voltro-cache-age-ms": String(w - S.renderedAt)
1126
+ "x-voltro-cache-key": _,
1127
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1096
1128
  }) : {
1097
1129
  status: 200,
1098
1130
  headers: {
1099
1131
  "content-type": "text/html; charset=utf-8",
1100
- "cache-control": Xe(j, S.revalidateMs, S.staleWhileRevalidateMs),
1132
+ "cache-control": Ze(M, x.revalidateMs, x.staleWhileRevalidateMs),
1101
1133
  "x-voltro-rendered-by": "isr",
1102
1134
  "x-voltro-cache": "HIT",
1103
- "x-voltro-cache-key": v,
1104
- "x-voltro-cache-age-ms": String(w - S.renderedAt)
1135
+ "x-voltro-cache-key": _,
1136
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1105
1137
  },
1106
- body: S.html
1138
+ body: x.html
1107
1139
  };
1108
- if (S && ze(S, w)) {
1109
- p.emit("cache", {
1140
+ if (x && Be(x, S)) {
1141
+ h.emit("cache", {
1110
1142
  kind: "STALE",
1111
- key: v,
1112
- ageMs: w - S.renderedAt
1143
+ key: _,
1144
+ ageMs: S - x.renderedAt
1113
1145
  });
1114
- let r = B.generation(v);
1146
+ let i = z.generation(_);
1115
1147
  return (async () => {
1116
1148
  try {
1117
- let i = await At({
1118
- provider: q,
1149
+ let a = await Pt({
1150
+ provider: K,
1119
1151
  root: t,
1120
- route: m.route,
1121
- params: m.params,
1122
- pathname: a,
1123
- dirs: W,
1124
- shellTemplate: bt.get(m.route.pattern) ?? O,
1152
+ route: p.route,
1153
+ params: p.params,
1154
+ pathname: r,
1155
+ dirs: U,
1156
+ shellTemplate: J.get(p.route.pattern) ?? D,
1125
1157
  requestHeaders: n,
1126
- apiOrigin: M,
1127
- apiName: F,
1128
- middlewares: R,
1129
- onCookieWarning: L,
1158
+ apiOrigin: N,
1159
+ apiName: P,
1160
+ middlewares: L,
1161
+ onCookieWarning: I,
1130
1162
  requestUrl: e,
1131
1163
  buffered: !0
1132
1164
  });
1133
- if (i && "html" in i && i.renderMode === "isr" && i.revalidateMs !== null) {
1134
- let e = J.get(m.route.pattern)?.staleWhileRevalidateMs ?? 0, t = Date.now();
1135
- B.set(v, {
1136
- html: i.html,
1165
+ if (a && "html" in a && a.renderMode === "isr" && a.revalidateMs !== null) {
1166
+ let e = q.get(p.route.pattern)?.staleWhileRevalidateMs ?? 0, t = Date.now();
1167
+ z.set(_, {
1168
+ html: a.html,
1137
1169
  renderedAt: t,
1138
- expiresAt: t + i.revalidateMs,
1139
- servableUntil: t + i.revalidateMs + e,
1140
- revalidateMs: i.revalidateMs,
1170
+ expiresAt: t + a.revalidateMs,
1171
+ servableUntil: t + a.revalidateMs + e,
1172
+ revalidateMs: a.revalidateMs,
1141
1173
  staleWhileRevalidateMs: e
1142
- }, { ifGeneration: r }) || X.info("SWR refresh discarded — the entry was purged while it rendered", { key: v });
1174
+ }, { ifGeneration: i }) || Y.info("SWR refresh discarded — the entry was purged while it rendered", { key: _ });
1143
1175
  }
1144
1176
  } catch (e) {
1145
- X.warn("background SWR refresh failed", { url: a }, e);
1177
+ Y.warn("background SWR refresh failed", { url: r }, e);
1146
1178
  }
1147
- })(), y ? b(S.html, {
1148
- "cache-control": Xe(j, S.revalidateMs, S.staleWhileRevalidateMs),
1179
+ })(), v ? y(x.html, {
1180
+ "cache-control": Ze(M, x.revalidateMs, x.staleWhileRevalidateMs),
1149
1181
  "x-voltro-cache": "STALE",
1150
- "x-voltro-cache-key": v,
1151
- "x-voltro-cache-age-ms": String(w - S.renderedAt)
1182
+ "x-voltro-cache-key": _,
1183
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1152
1184
  }) : {
1153
1185
  status: 200,
1154
1186
  headers: {
1155
1187
  "content-type": "text/html; charset=utf-8",
1156
- "cache-control": Xe(j, S.revalidateMs, S.staleWhileRevalidateMs),
1188
+ "cache-control": Ze(M, x.revalidateMs, x.staleWhileRevalidateMs),
1157
1189
  "x-voltro-rendered-by": "isr",
1158
1190
  "x-voltro-cache": "STALE",
1159
- "x-voltro-cache-key": v,
1160
- "x-voltro-cache-age-ms": String(w - S.renderedAt)
1191
+ "x-voltro-cache-key": _,
1192
+ "x-voltro-cache-age-ms": String(S - x.renderedAt)
1161
1193
  },
1162
- body: S.html
1194
+ body: x.html
1163
1195
  };
1164
1196
  }
1165
1197
  try {
1166
- let r = B.generation(v), i = await At({
1167
- provider: q,
1198
+ let i = z.generation(_), a = await Pt({
1199
+ provider: K,
1168
1200
  root: t,
1169
- route: m.route,
1170
- params: m.params,
1171
- pathname: a,
1172
- dirs: W,
1173
- shellTemplate: bt.get(m.route.pattern) ?? O,
1201
+ route: p.route,
1202
+ params: p.params,
1203
+ pathname: r,
1204
+ dirs: U,
1205
+ shellTemplate: J.get(p.route.pattern) ?? D,
1174
1206
  requestHeaders: n,
1175
- apiOrigin: M,
1176
- apiName: F,
1177
- middlewares: R,
1178
- onCookieWarning: L,
1207
+ apiOrigin: N,
1208
+ apiName: P,
1209
+ middlewares: L,
1210
+ onCookieWarning: I,
1179
1211
  requestUrl: e
1180
1212
  });
1181
- if (!i) return {
1213
+ if (!a) return {
1182
1214
  status: 200,
1183
1215
  headers: {
1184
1216
  "content-type": "text/html; charset=utf-8",
1185
1217
  "x-voltro-rendered-by": "spa-fallback"
1186
1218
  },
1187
- body: O
1219
+ body: D
1188
1220
  };
1189
- let o = i.setCookies ?? [], s = i.responseHeaders ?? {}, c = (e) => ({
1221
+ let o = a.setCookies ?? [], s = a.responseHeaders ?? {}, c = (e) => ({
1190
1222
  ...s,
1191
1223
  ...e,
1192
- ...o.length === 0 ? {} : { "set-cookie": o.map(f) }
1224
+ ...o.length === 0 ? {} : { "set-cookie": o.map(d) }
1193
1225
  });
1194
- if ("stream" in i) return {
1226
+ if ("stream" in a) return {
1195
1227
  status: 200,
1196
- headers: { "x-voltro-rendered-by": i.renderMode },
1228
+ headers: { "x-voltro-rendered-by": a.renderMode },
1197
1229
  body: "",
1198
- stream: i.stream
1230
+ stream: a.stream
1199
1231
  };
1200
- if ("control" in i) return i.control === "redirect" ? {
1201
- status: i.status,
1232
+ if ("control" in a) return a.control === "redirect" ? {
1233
+ status: a.status,
1202
1234
  headers: c({
1203
- location: i.location,
1235
+ location: a.location,
1204
1236
  "x-voltro-rendered-by": "loader-redirect"
1205
1237
  }),
1206
1238
  body: ""
@@ -1212,40 +1244,40 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1212
1244
  }),
1213
1245
  body: "not found"
1214
1246
  };
1215
- if ("holes" in i) throw Error("renderPageForRequest returned a holes arm without holesOnly");
1247
+ if ("holes" in a) throw Error("renderPageForRequest returned a holes arm without holesOnly");
1216
1248
  let l = c({
1217
1249
  "content-type": "text/html; charset=utf-8",
1218
- "x-voltro-rendered-by": i.renderMode
1250
+ "x-voltro-rendered-by": a.renderMode
1219
1251
  });
1220
- if (i.renderMode === "isr" && i.revalidateMs !== null) {
1221
- let e = Date.now(), t = J.get(m.route.pattern)?.staleWhileRevalidateMs ?? 0;
1222
- B.set(v, {
1223
- html: i.html,
1252
+ if (a.renderMode === "isr" && a.revalidateMs !== null) {
1253
+ let e = Date.now(), t = q.get(p.route.pattern)?.staleWhileRevalidateMs ?? 0;
1254
+ z.set(_, {
1255
+ html: a.html,
1224
1256
  renderedAt: e,
1225
- expiresAt: e + i.revalidateMs,
1226
- servableUntil: e + i.revalidateMs + t,
1227
- revalidateMs: i.revalidateMs,
1257
+ expiresAt: e + a.revalidateMs,
1258
+ servableUntil: e + a.revalidateMs + t,
1259
+ revalidateMs: a.revalidateMs,
1228
1260
  staleWhileRevalidateMs: t
1229
- }, { ifGeneration: r }) || X.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(i.revalidateMs), t > 0 && (l["x-voltro-cache-swr-ms"] = String(t)), p.emit("cache", {
1261
+ }, { ifGeneration: i }) || Y.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)), h.emit("cache", {
1230
1262
  kind: "MISS",
1231
- key: v,
1232
- revalidateMs: i.revalidateMs,
1263
+ key: _,
1264
+ revalidateMs: a.revalidateMs,
1233
1265
  swrMs: t
1234
1266
  });
1235
- } else i.renderMode === "isr" && (l["x-voltro-cache"] = "BYPASS", p.emit("cache", {
1267
+ } else a.renderMode === "isr" && (l["x-voltro-cache"] = "BYPASS", h.emit("cache", {
1236
1268
  kind: "BYPASS",
1237
- key: v
1269
+ key: _
1238
1270
  }));
1239
- return y && i.renderMode === "isr" ? b(i.html, {
1271
+ return v && a.renderMode === "isr" ? y(a.html, {
1240
1272
  "x-voltro-cache": l["x-voltro-cache"] ?? "MISS",
1241
- "x-voltro-cache-key": v
1273
+ "x-voltro-cache-key": _
1242
1274
  }) : {
1243
1275
  status: 200,
1244
1276
  headers: l,
1245
- body: i.html
1277
+ body: a.html
1246
1278
  };
1247
1279
  } catch (e) {
1248
- return X.error("render error", { url: a }, e), se(e) ? {
1280
+ return Y.error("render error", { url: r }, e), ne(e) ? {
1249
1281
  status: 500,
1250
1282
  headers: {
1251
1283
  "content-type": "text/plain; charset=utf-8",
@@ -1265,75 +1297,75 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1265
1297
  body: "server error"
1266
1298
  };
1267
1299
  }
1268
- }, Ut = !1, Wt = s(r.health, () => Ut), Gt = b({
1269
- apiName: F,
1270
- apiOrigin: M,
1300
+ }, Gt = !1, Kt = i(f.health, () => Gt), qt = p({
1301
+ apiName: P,
1302
+ apiOrigin: N,
1271
1303
  loadDescriptors: async () => {
1272
- if (F === void 0) return;
1273
- let e = (await q.getHelpers()).apiDescriptors?.[F];
1304
+ if (P === void 0) return;
1305
+ let e = (await K.getHelpers()).apiDescriptors?.[P];
1274
1306
  return e === void 0 ? void 0 : await e();
1275
1307
  },
1276
- rpcQuery: (e, t) => ye(M, e, {
1277
- apiName: F,
1308
+ rpcQuery: (e, t) => xe(N, e, {
1309
+ apiName: P,
1278
1310
  headers: t
1279
1311
  }),
1280
1312
  resolveLocale: async (e, t) => {
1281
- let n = await q.getHelpers(), r = v(t, n.i18n?.locales);
1313
+ let n = await K.getHelpers(), r = u(t, n.i18n?.locales);
1282
1314
  return r === void 0 ? n.i18n?.resolve(e.cookie, e["accept-language"])?.locale ?? "en" : r;
1283
1315
  },
1284
1316
  renderErrorPage: async ({ path: e, headers: n, flash: r }) => {
1285
- let { pathname: i } = pe(e), a = Et(i, G);
1317
+ let { pathname: i } = be(e), a = At(i, W);
1286
1318
  if (!a) return;
1287
- let o = await At({
1288
- provider: q,
1319
+ let o = await Pt({
1320
+ provider: K,
1289
1321
  root: t,
1290
1322
  route: a.route,
1291
1323
  params: a.params,
1292
1324
  pathname: i,
1293
- dirs: W,
1294
- shellTemplate: O,
1325
+ dirs: U,
1326
+ shellTemplate: D,
1295
1327
  requestHeaders: n,
1296
- apiOrigin: M,
1297
- apiName: F,
1298
- middlewares: R,
1299
- onCookieWarning: L,
1328
+ apiOrigin: N,
1329
+ apiName: P,
1330
+ middlewares: L,
1331
+ onCookieWarning: I,
1300
1332
  requestUrl: e,
1301
1333
  formFlash: r,
1302
1334
  buffered: !0
1303
1335
  });
1304
1336
  return o !== null && "html" in o ? o.html : void 0;
1305
1337
  }
1306
- }), Kt = at(r), qt = lt(async (e, t) => {
1338
+ }), Jt = ot(f), Yt = ut(async (e, t) => {
1307
1339
  let n = e.url ?? "/", i = Date.now(), a = {};
1308
1340
  for (let [t, n] of Object.entries(e.headers)) n !== void 0 && (a[t.toLowerCase()] = Array.isArray(n) ? n.join(", ") : n);
1309
- let o = n.split("?")[0] ?? "/", s = (e.method ?? "GET").toUpperCase(), l = c(Wt, o);
1310
- if (l !== void 0) {
1311
- let e = await ne(Wt, l);
1341
+ let o = n.split("?")[0] ?? "/", s = (e.method ?? "GET").toUpperCase(), c = he(Kt, o);
1342
+ if (c !== void 0) {
1343
+ let e = await y(Kt, c);
1312
1344
  t.writeHead(e.status, {
1313
1345
  "content-type": "text/plain",
1314
1346
  "cache-control": "no-store"
1315
1347
  }), t.end(e.body);
1316
1348
  return;
1317
1349
  }
1318
- if (!(o.startsWith(he) && await Gt(e, t))) {
1350
+ if (!(o.startsWith(x) && await qt(e, t))) {
1319
1351
  if (s === "OPTIONS" && o.startsWith("/_voltro/inspect")) {
1320
- let e = De(a.origin);
1352
+ let e = Oe(a.origin);
1321
1353
  t.writeHead(204, e), t.end();
1322
1354
  return;
1323
1355
  }
1324
- if (r.name === "voltroDashboard" && o === "/api/dashboard/proxy") {
1356
+ if (f.name === "voltroDashboard" && o === "/api/dashboard/proxy") {
1325
1357
  let r = new URL(n, "http://x").searchParams.get("target");
1326
1358
  if (!r) {
1327
1359
  t.writeHead(400, { "content-type": "text/plain" }), t.end("missing ?target=");
1328
1360
  return;
1329
1361
  }
1330
- if (!I(r)) {
1362
+ if (!F(r)) {
1331
1363
  t.writeHead(400, { "content-type": "text/plain" }), t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
1332
1364
  return;
1333
1365
  }
1334
1366
  try {
1335
1367
  let n = { accept: a.accept ?? "application/json" }, i = a.authorization;
1336
- i ? n.authorization = Array.isArray(i) ? i[0] : i : Ee(r) && process.env.VOLTRO_INSPECT_TOKEN && (n.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
1368
+ i ? n.authorization = Array.isArray(i) ? i[0] : i : De(r) && process.env.VOLTRO_INSPECT_TOKEN && (n.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
1337
1369
  let o;
1338
1370
  if (s && s !== "GET" && s !== "HEAD") {
1339
1371
  let t = [];
@@ -1357,20 +1389,20 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1357
1389
  }
1358
1390
  return;
1359
1391
  }
1360
- if (r.name === "voltroDashboard" && o === "/api/dashboard/proxy/stream") {
1392
+ if (f.name === "voltroDashboard" && o === "/api/dashboard/proxy/stream") {
1361
1393
  let r = new URL(n, "http://x").searchParams.get("target");
1362
1394
  if (!r) {
1363
1395
  t.writeHead(400, { "content-type": "text/plain" }), t.end("missing ?target=");
1364
1396
  return;
1365
1397
  }
1366
- if (!I(r)) {
1398
+ if (!F(r)) {
1367
1399
  t.writeHead(400, { "content-type": "text/plain" }), t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
1368
1400
  return;
1369
1401
  }
1370
1402
  let i = new AbortController();
1371
1403
  e.on("close", () => i.abort()), t.on("close", () => i.abort());
1372
1404
  try {
1373
- let e = Te(a, r), n = await fetch(r, {
1405
+ let e = Ee(a, r), n = await fetch(r, {
1374
1406
  redirect: "manual",
1375
1407
  method: "GET",
1376
1408
  headers: {
@@ -1405,22 +1437,22 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1405
1437
  return;
1406
1438
  }
1407
1439
  if (o === "/_voltro/inspect/stream") {
1408
- let n = De(a.origin);
1409
- if (ke()) {
1440
+ let n = Oe(a.origin);
1441
+ if (Ae()) {
1410
1442
  t.writeHead(503, {
1411
1443
  "content-type": "application/json",
1412
1444
  ...n
1413
1445
  }), t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
1414
1446
  return;
1415
1447
  }
1416
- let r = Ae(a, "GET");
1417
- if (!r.ok) {
1448
+ let i = je(a, "GET");
1449
+ if (!i.ok) {
1418
1450
  t.writeHead(401, {
1419
1451
  "content-type": "application/json",
1420
1452
  ...n
1421
1453
  }), t.end(JSON.stringify({
1422
1454
  error: "unauthorized",
1423
- reason: r.reason
1455
+ reason: i.reason
1424
1456
  }));
1425
1457
  return;
1426
1458
  }
@@ -1431,37 +1463,37 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1431
1463
  "x-accel-buffering": "no",
1432
1464
  ...n
1433
1465
  }), t.flushHeaders(), t.write("retry: 5000\n\n");
1434
- for (let e of p.buffered()) t.write(oe(e));
1435
- let i = p.subscribe((e) => {
1436
- t.write(oe(e));
1437
- }), o = setInterval(() => {
1438
- t.write(te());
1439
- }, 15e3), s = () => {
1440
- clearInterval(o), i();
1466
+ for (let e of h.buffered()) t.write(r(e));
1467
+ let o = h.subscribe((e) => {
1468
+ t.write(r(e));
1469
+ }), s = setInterval(() => {
1470
+ t.write(Ce());
1471
+ }, 15e3), c = () => {
1472
+ clearInterval(s), o();
1441
1473
  };
1442
- e.on("close", s), t.on("close", s);
1474
+ e.on("close", c), t.on("close", c);
1443
1475
  return;
1444
1476
  }
1445
1477
  try {
1446
- let e = await Ht(n, a);
1447
- if (e.stream ? e.stream(t) : dt({
1478
+ let e = await Wt(n, a);
1479
+ if (e.stream ? e.stream(t) : ht({
1448
1480
  response: t,
1449
1481
  status: e.status,
1450
1482
  headers: e.headers,
1451
1483
  body: e.body,
1452
1484
  requestHeaders: a,
1453
- compression: de.compression
1485
+ compression: ve.compression
1454
1486
  }) || (t.writeHead(e.status, e.headers), t.end(e.body)), !o.startsWith("/_voltro/inspect")) {
1455
1487
  let t = Date.now() - i;
1456
- p.emit("request", {
1488
+ h.emit("request", {
1457
1489
  url: o,
1458
1490
  status: e.status,
1459
1491
  durationMs: t,
1460
1492
  renderedBy: e.headers["x-voltro-rendered-by"],
1461
1493
  cache: e.headers["x-voltro-cache"]
1462
1494
  });
1463
- let n = Et(o, G)?.route.pattern ?? (e.status === 404 ? "<unmatched>" : "<asset>");
1464
- Lt.record({
1495
+ let n = At(o, W)?.route.pattern ?? (e.status === 404 ? "<unmatched>" : "<asset>");
1496
+ zt.record({
1465
1497
  kind: "request",
1466
1498
  tag: n,
1467
1499
  durationMs: t,
@@ -1473,77 +1505,77 @@ CREATE INDEX IF NOT EXISTS ${e}_servable_until_idx ON ${e} (servable_until);
1473
1505
  }
1474
1506
  }
1475
1507
  });
1476
- await new Promise((e) => qt.listen(h, "::", e)), Ut = !0, n.mark("ready"), rt(qt, Kt), X.info(`listening on http://localhost:${h}`, {
1477
- port: h,
1478
- distDir: C
1479
- }), X.debug("dynamic + ssr/isr routes resolve via SSR loader");
1508
+ await new Promise((e) => Yt.listen(_, "::", e)), Gt = !0, n.mark("ready"), it(Yt, Jt), Y.info(`listening on http://localhost:${_}`, {
1509
+ port: _,
1510
+ distDir: b
1511
+ }), Y.debug("dynamic + ssr/isr routes resolve via SSR loader");
1480
1512
  try {
1481
- await Ue({
1482
- id: re,
1483
- name: T,
1513
+ await We({
1514
+ id: T,
1515
+ name: w,
1484
1516
  kind: "web",
1485
- url: `http://localhost:${h}`,
1517
+ url: `http://localhost:${_}`,
1486
1518
  pid: process.pid,
1487
1519
  status: "live",
1488
- logFile: D.path
1520
+ logFile: E.path
1489
1521
  });
1490
- let e = A(t);
1522
+ let e = Se(t);
1491
1523
  if (e) {
1492
- let t = await ve({ dashboardAppPath: e });
1493
- t.status === "launched" ? X.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && X.debug(`dashboard already running on :${t.port}`, { port: t.port });
1524
+ let t = await ye({ dashboardAppPath: e });
1525
+ t.status === "launched" ? Y.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Y.debug(`dashboard already running on :${t.port}`, { port: t.port });
1494
1526
  }
1495
1527
  setInterval(() => {
1496
- Ue({
1497
- id: re,
1498
- name: T,
1528
+ We({
1529
+ id: T,
1530
+ name: w,
1499
1531
  kind: "web",
1500
- url: `http://localhost:${h}`,
1532
+ url: `http://localhost:${_}`,
1501
1533
  pid: process.pid,
1502
1534
  status: "live",
1503
- logFile: D.path
1535
+ logFile: E.path
1504
1536
  }).catch(() => {});
1505
1537
  }, 1e4).unref();
1506
1538
  } catch (e) {
1507
- X.warn("runtime-registry write failed", {}, e);
1539
+ Y.warn("runtime-registry write failed", {}, e);
1508
1540
  }
1509
- $e({
1510
- app: r.name ?? "unnamed",
1541
+ et({
1542
+ app: f.name ?? "unnamed",
1511
1543
  kind: "web",
1512
- url: `http://localhost:${h}`,
1544
+ url: `http://localhost:${_}`,
1513
1545
  bootMs: n.total()
1514
1546
  });
1515
- let Jt = n.phaseBreakdown();
1516
- X.info(`start: ready in ${n.total()}ms`, {
1547
+ let Xt = n.phaseBreakdown();
1548
+ Y.info(`start: ready in ${n.total()}ms`, {
1517
1549
  bootMs: n.total(),
1518
- ...Jt ? { phases: Jt } : {}
1550
+ ...Xt ? { phases: Xt } : {}
1519
1551
  });
1520
- let Yt = !1, Xt = (e) => async () => {
1521
- if (!Yt) {
1522
- if (Yt = !0, X.info(`received ${e}, shutting down`, { signal: e }), qt.close(), await Nt.stop(), Ft) try {
1523
- Ft();
1552
+ let Zt = !1, Qt = (e) => async () => {
1553
+ if (!Zt) {
1554
+ if (Zt = !0, Y.info(`received ${e}, shutting down`, { signal: e }), Yt.close(), await Q.stop(), $) try {
1555
+ $();
1524
1556
  } catch {}
1525
- if (It) try {
1526
- await st.runPromise(It.close());
1557
+ if (Rt) try {
1558
+ await ct.runPromise(Rt.close());
1527
1559
  } catch {}
1528
- if (H) try {
1529
- await H.end();
1560
+ if (V) try {
1561
+ await V.end();
1530
1562
  } catch {}
1531
- await q.close(), await Ge(re), await D.dispose(), process.exit(0);
1563
+ await K.close(), await Ke(T), await E.dispose(), process.exit(0);
1532
1564
  }
1533
1565
  };
1534
- process.on("SIGINT", Xt("SIGINT")), process.on("SIGTERM", Xt("SIGTERM"));
1535
- let Zt = process.ppid;
1536
- if (Zt > 1) {
1566
+ process.on("SIGINT", Qt("SIGINT")), process.on("SIGTERM", Qt("SIGTERM"));
1567
+ let $t = process.ppid;
1568
+ if ($t > 1) {
1537
1569
  let e = setInterval(() => {
1538
- (process.ppid !== Zt || process.ppid === 1) && (clearInterval(e), Xt("SIGTERM")());
1570
+ (process.ppid !== $t || process.ppid === 1) && (clearInterval(e), Qt("SIGTERM")());
1539
1571
  }, 2e3);
1540
1572
  e.unref();
1541
1573
  }
1542
1574
  return new Promise(() => {});
1543
- }, Pt = async (e) => {
1544
- nt("start"), t("start");
1545
- let n = e.find((e) => !e.startsWith("-")) ?? process.cwd(), r = await Nt(B(n));
1546
- return r.ran ? r.exitCode : (X.error("no web app found at this path"), 1);
1575
+ }, $ = async (e) => {
1576
+ rt("start"), t("start");
1577
+ let n = e.find((e) => !e.startsWith("-")) ?? process.cwd(), r = await Lt(z(n));
1578
+ return r.ran ? r.exitCode : (Y.error("no web app found at this path"), 1);
1547
1579
  };
1548
1580
  //#endregion
1549
- export { Nt as n, Pt as t };
1581
+ export { Lt as n, $ as t };