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