@voltro/cli 0.12.0 → 0.13.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 (85) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/dist/{apiBuild-GefjNI5d.js → apiBuild-B6_ehbem.js} +3 -3
  3. package/dist/apiBuild-Bzpb383i.js +2 -0
  4. package/dist/bin.js +3 -3
  5. package/dist/{commands-BmNi1RgZ.js → commands-DYOuGlEC.js} +1668 -1371
  6. package/dist/dbCommand-ADD4mrTI.js +2 -0
  7. package/dist/{dbCommand-DNrkb58g.js → dbCommand-DIOJQwsq.js} +71 -57
  8. package/dist/{dev-d0LjACxE.js → dev-Fb9BmavX.js} +1483 -1414
  9. package/dist/dev-xdijqojc.js +3 -0
  10. package/dist/{seedRunner-DZmhoqNt.js → frameworkTableAssembly-CYlrafoK.js} +110 -331
  11. package/dist/frameworkTableAssembly-XvKO7wQt.js +2 -0
  12. package/dist/index.js +1 -1
  13. package/dist/{inspectMetrics-uEfIS1vp.js → inspectMetrics-DOiiII34.js} +302 -293
  14. package/dist/seedRunner-D6eu-u5U.js +229 -0
  15. package/dist/{serveCommand-B2-YV9TU.js → serveCommand-CqYxzBZR.js} +368 -367
  16. package/dist/serveEntry.js +3 -3
  17. package/dist/{start-DKcQd52a.js → start-CjG_0xhR.js} +1 -1
  18. package/dist/startEntry.js +2 -2
  19. package/package.json +17 -17
  20. package/templates/AGENTS.md +1 -1
  21. package/templates/agent-docs/_index.md +1 -1
  22. package/templates/agent-docs/authentication.md +36 -0
  23. package/templates/agent-docs/cli.md +78 -4
  24. package/templates/agent-docs/configuration.md +48 -0
  25. package/templates/agent-docs/database/migrations.md +32 -0
  26. package/templates/agent-docs/database/transactions.md +31 -0
  27. package/templates/agent-docs/testing.md +24 -0
  28. package/templates/agent-docs/whats-new.md +41 -137
  29. package/templates/apps/api-ai/package.json +7 -7
  30. package/templates/apps/api-auth/package.json +8 -8
  31. package/templates/apps/api-backend/package.json +7 -7
  32. package/templates/apps/api-backend-deactivation/package.json +7 -7
  33. package/templates/apps/api-backend-deactivation/tests/users.deactivate.test.ts +1 -1
  34. package/templates/apps/api-backend-mail/package.json +8 -8
  35. package/templates/apps/api-backend-mariadb/package.json +9 -9
  36. package/templates/apps/api-backend-storage/package.json +8 -8
  37. package/templates/apps/api-data-advanced/package.json +8 -8
  38. package/templates/apps/api-data-advanced/tests/queries.test.ts +6 -1
  39. package/templates/apps/api-durable/package.json +8 -8
  40. package/templates/apps/api-feature-flags/package.json +9 -9
  41. package/templates/apps/api-governance/app.config.ts +0 -1
  42. package/templates/apps/api-governance/package.json +8 -8
  43. package/templates/apps/api-kv/package.json +8 -8
  44. package/templates/apps/api-kv/tests/sync.test.ts +2 -2
  45. package/templates/apps/api-moderation/package.json +8 -8
  46. package/templates/apps/api-observability/package.json +8 -8
  47. package/templates/apps/api-ratelimit/package.json +8 -8
  48. package/templates/apps/api-rbac/README.md +53 -14
  49. package/templates/apps/api-rbac/app.config.ts +24 -26
  50. package/templates/apps/api-rbac/authz.ts +76 -0
  51. package/templates/apps/api-rbac/database/schema.ts +23 -6
  52. package/templates/apps/api-rbac/mutations/notes.create.mutation.server.ts +7 -5
  53. package/templates/apps/api-rbac/mutations/notes.create.mutation.ts +15 -8
  54. package/templates/apps/api-rbac/mutations/notes.delete.mutation.server.ts +54 -0
  55. package/templates/apps/api-rbac/mutations/notes.delete.mutation.ts +43 -0
  56. package/templates/apps/api-rbac/mutations/teams.rename.mutation.server.ts +19 -0
  57. package/templates/apps/api-rbac/mutations/teams.rename.mutation.ts +37 -0
  58. package/templates/apps/api-rbac/package.json +8 -8
  59. package/templates/apps/api-rbac/queries/notes.list.query.server.ts +12 -0
  60. package/templates/apps/api-rbac/queries/notes.list.query.ts +26 -0
  61. package/templates/apps/api-rbac/template.json +2 -2
  62. package/templates/apps/api-rbac/tests/authz.test.ts +233 -0
  63. package/templates/apps/api-rest/package.json +7 -7
  64. package/templates/apps/api-saas/package.json +11 -11
  65. package/templates/apps/api-search/package.json +8 -8
  66. package/templates/apps/api-versioning/package.json +8 -8
  67. package/templates/apps/api-webhooks/package.json +9 -8
  68. package/templates/apps/changelog/package.json +6 -6
  69. package/templates/apps/edge-functions/package.json +2 -2
  70. package/templates/apps/frontend-admin/package.json +8 -8
  71. package/templates/apps/frontend-app/package.json +8 -8
  72. package/templates/apps/frontend-blank/package.json +7 -7
  73. package/templates/apps/frontend-contact/package.json +7 -7
  74. package/templates/apps/frontend-dashboard/package.json +7 -7
  75. package/templates/apps/frontend-docs/package.json +7 -7
  76. package/templates/apps/frontend-i18n/package.json +6 -6
  77. package/templates/apps/frontend-landing/package.json +7 -7
  78. package/templates/apps/frontend-spa/package.json +7 -7
  79. package/templates/apps/frontend-ssr/package.json +7 -7
  80. package/templates/apps/frontend-ssr-api/package.json +8 -8
  81. package/templates/apps/frontend-static-blog/package.json +6 -6
  82. package/dist/apiBuild-s7swuEU5.js +0 -2
  83. package/dist/dbCommand-Bt6BCG7g.js +0 -2
  84. package/dist/dev-YHbHmeXt.js +0 -3
  85. package/templates/apps/api-rbac/tests/notes.create.test.ts +0 -80
@@ -485,8 +485,17 @@ __installPublicEnv(publicEnvValues)
485
485
  }, rt = (e, t = {}) => {
486
486
  let n = [e];
487
487
  return t.tenant !== void 0 && t.tenant !== "" && n.push(`tenant=${t.tenant}`), t.locale !== void 0 && t.locale !== "" && n.push(`lang=${t.locale}`), n.join("|");
488
- }, it = (e, t) => e.expiresAt > t, at = (e, t) => e.expiresAt <= t && e.servableUntil > t, ot = S({ scope: "voltro:cli" }), st = [], ct = (e) => {
489
- st.length = 0;
488
+ }, it = (e, t) => e.expiresAt > t, at = (e, t) => e.expiresAt <= t && e.servableUntil > t, ot = S({ scope: "voltro:cli" }), st = (e, t) => {
489
+ if (t?.code !== "EACCES") return "";
490
+ if (typeof process.getuid != "function") return " — permission denied";
491
+ try {
492
+ let t = j(e);
493
+ return ` — permission denied: the file is owned by uid ${t.uid} (mode ${(t.mode & 511).toString(8)}) and this process is uid ${process.getuid()}. A container running as root with the workspace bind-mounted writes files the host user cannot read; run it as \`--user <your-uid>:<your-gid>\`, or delete the file and let the owning user recreate it.`;
494
+ } catch {
495
+ return " — permission denied (and the file could not be stat-ed either)";
496
+ }
497
+ }, ct = [], lt = (e) => {
498
+ ct.length = 0;
490
499
  let t = e[1] && !e[1].startsWith("-") ? e[1] : void 0, n = t ? c(t) ? t : d(process.cwd(), t) : process.cwd(), r = [], i = n;
491
500
  for (;;) {
492
501
  r.push(i);
@@ -497,7 +506,7 @@ __installPublicEnv(publicEnvValues)
497
506
  for (let e of r) for (let t of [".env.local", ".env"]) {
498
507
  let n = d(e, t);
499
508
  if (T(n)) {
500
- st.push(n);
509
+ ct.push(n);
501
510
  try {
502
511
  let e = k(n, "utf8");
503
512
  for (let t of e.split(/\r?\n/)) {
@@ -509,11 +518,11 @@ __installPublicEnv(publicEnvValues)
509
518
  (i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
510
519
  }
511
520
  } catch (e) {
512
- ot.warn("failed to load env file (continuing)", { path: n }, e);
521
+ ot.warn(`failed to load env file (continuing)${st(n, e)}`, { path: n }, e);
513
522
  }
514
523
  }
515
524
  }
516
- }, lt = 500, ut = (e, t, n = {}) => {
525
+ }, ut = 500, dt = (e, t, n = {}) => {
517
526
  if (e.length === 0) return () => {};
518
527
  let r = (e) => n.root ? u(n.root, e) : e, i = !1, a = (e) => {
519
528
  i || (i = !0, t.warn(`.env changed (${r(e)}) — hard-restarting: process.env is read once at boot, a reload would keep stale values`, { file: r(e) }), Promise.resolve().then(() => n.onBeforeRestart?.()).catch((e) => t.warn(".env restart: onBeforeRestart failed (continuing)", {}, e)).finally(() => {
@@ -531,47 +540,47 @@ __installPublicEnv(publicEnvValues)
531
540
  });
532
541
  }));
533
542
  };
534
- for (let t of e) P(t, { interval: lt }, (e, n) => {
543
+ for (let t of e) P(t, { interval: ut }, (e, n) => {
535
544
  e.mtimeMs !== n.mtimeMs && a(t);
536
545
  });
537
546
  return t.info("watching .env files for changes", {
538
547
  files: e.map(r),
539
- intervalMs: lt
548
+ intervalMs: ut
540
549
  }), () => {
541
550
  for (let t of e) N(t);
542
551
  };
543
- }, q = S({ scope: "vite" }), dt = /\x1b\[[0-9;]*m/g, ft = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, pt = (e) => e.replace(dt, "").replace(ft, "").trim(), mt = /proxy error/i, ht = [
552
+ }, q = S({ scope: "vite" }), ft = /\x1b\[[0-9;]*m/g, pt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, mt = (e) => e.replace(ft, "").replace(pt, "").trim(), ht = /proxy error/i, gt = [
544
553
  "ECONNREFUSED",
545
554
  "ECONNRESET",
546
555
  "ECONNABORTED",
547
556
  "EPIPE",
548
557
  "ETIMEDOUT"
549
- ], gt = (e, t = 0) => {
558
+ ], _t = (e, t = 0) => {
550
559
  if (e == null || t > 5) return !1;
551
560
  let n = e;
552
- return typeof n.code == "string" && ht.includes(n.code) || typeof n.message == "string" && ht.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => gt(e, t + 1)) ? !0 : gt(n.cause, t + 1);
553
- }, _t = 4e3, vt = () => {
561
+ return typeof n.code == "string" && gt.includes(n.code) || typeof n.message == "string" && gt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => _t(e, t + 1)) ? !0 : _t(n.cause, t + 1);
562
+ }, vt = 4e3, yt = () => {
554
563
  let e = /* @__PURE__ */ new Set(), t = 0, n = {
555
564
  hasWarned: !1,
556
565
  info: (e) => {
557
- let t = pt(e);
566
+ let t = mt(e);
558
567
  t.length !== 0 && q.info(t);
559
568
  },
560
569
  warn: (e) => {
561
570
  n.hasWarned = !0;
562
- let t = pt(e);
571
+ let t = mt(e);
563
572
  t.length !== 0 && q.warn(t);
564
573
  },
565
574
  warnOnce: (t) => {
566
- let r = pt(t);
575
+ let r = mt(t);
567
576
  e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && q.warn(r));
568
577
  },
569
578
  error: (e, n) => {
570
- let r = pt(e), i = n?.error;
579
+ let r = mt(e), i = n?.error;
571
580
  if (r.length !== 0) {
572
- if (mt.test(r) && gt(i)) {
581
+ if (ht.test(r) && _t(i)) {
573
582
  let e = Date.now();
574
- e - t > _t && (t = e, q.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
583
+ e - t > vt && (t = e, q.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
575
584
  return;
576
585
  }
577
586
  q.error(r, {}, i);
@@ -581,12 +590,12 @@ __installPublicEnv(publicEnvValues)
581
590
  hasErrorLogged: (e) => !1
582
591
  };
583
592
  return n;
584
- }, yt = (e = process.env) => {
593
+ }, bt = (e = process.env) => {
585
594
  let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
586
595
  if (t === void 0 || t.trim() === "") return 4;
587
596
  let n = Number(t);
588
597
  return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
589
- }, bt = (e) => {
598
+ }, xt = (e) => {
590
599
  let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
591
600
  let e = r.shift();
592
601
  e ? e() : n--;
@@ -604,8 +613,8 @@ __installPublicEnv(publicEnvValues)
604
613
  return n;
605
614
  }
606
615
  };
607
- }, xt = (e) => {
608
- let t = bt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
616
+ }, St = (e) => {
617
+ let t = xt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
609
618
  return {
610
619
  load: (i, a) => {
611
620
  if (r.has(i)) return a();
@@ -630,7 +639,7 @@ __installPublicEnv(publicEnvValues)
630
639
  return r.size;
631
640
  }
632
641
  };
633
- }, St = (e) => {
642
+ }, Ct = (e) => {
634
643
  let t = [];
635
644
  for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
636
645
  name: n.slice(5, -2),
@@ -646,7 +655,7 @@ __installPublicEnv(publicEnvValues)
646
655
  optional: !1
647
656
  });
648
657
  return t;
649
- }, Ct = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), wt = async (e) => {
658
+ }, wt = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), Tt = async (e) => {
650
659
  let t = d(e);
651
660
  for (let e = 0; e < 4; e++) {
652
661
  let e = l(t, "project.json");
@@ -664,8 +673,8 @@ __installPublicEnv(publicEnvValues)
664
673
  t = n;
665
674
  }
666
675
  return null;
667
- }, Tt = async (e) => {
668
- let t = await wt(e);
676
+ }, Et = async (e) => {
677
+ let t = await Tt(e);
669
678
  if (!t) return [];
670
679
  let { projectDir: n, manifest: r } = t, i = o(e), a = r.apps ?? {}, s = [];
671
680
  for (let [e, t] of Object.entries(a)) {
@@ -677,20 +686,20 @@ __installPublicEnv(publicEnvValues)
677
686
  let { pages: e } = await $(r);
678
687
  a = e.map((e) => ({
679
688
  pattern: e.pattern,
680
- params: St(e.pattern)
689
+ params: Ct(e.pattern)
681
690
  }));
682
691
  } catch {
683
692
  continue;
684
693
  }
685
694
  s.push({
686
- key: Ct(e),
695
+ key: wt(e),
687
696
  origin: `http://localhost:${t.port}`,
688
697
  ...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
689
698
  routes: a
690
699
  });
691
700
  }
692
701
  return s;
693
- }, Et = (e) => {
702
+ }, Dt = (e) => {
694
703
  if (e.params.length === 0) return `'${e.pattern}'`;
695
704
  let t = e.pattern;
696
705
  for (let n of e.params) {
@@ -698,21 +707,21 @@ __installPublicEnv(publicEnvValues)
698
707
  t = t.replace(e, r);
699
708
  }
700
709
  return "`" + t + "`";
701
- }, Dt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
710
+ }, Ot = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
702
711
  let t = "string";
703
712
  return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
704
- }).join("; ")} }`, Ot = (e, t, n) => {
705
- let r = Dt(e), i = Et(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
713
+ }).join("; ")} }`, kt = (e, t, n) => {
714
+ let r = Ot(e), i = Dt(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
706
715
  return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
707
- }, kt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${Ot(e, !1)},`).join("\n")}\n}`, At = (e, t) => {
716
+ }, At = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${kt(e, !1)},`).join("\n")}\n}`, jt = (e, t) => {
708
717
  if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
709
- let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${Ot(e, !0, i)},`);
718
+ let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${kt(e, !0, i)},`);
710
719
  return ` ${e.key}: {\n${a.join("\n")}\n },`;
711
- }, jt = async (e) => {
720
+ }, Mt = async (e) => {
712
721
  let t = e.pages.map((e) => ({
713
722
  pattern: e.pattern,
714
- params: St(e.pattern)
715
- })), n = await Tt(e.appRoot), r = [
723
+ params: Ct(e.pattern)
724
+ })), n = await Et(e.appRoot), r = [
716
725
  "// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
717
726
  "// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
718
727
  "// Type-safe route builders consumed by <Link to={...}>.",
@@ -721,7 +730,7 @@ __installPublicEnv(publicEnvValues)
721
730
  "",
722
731
  "type EmptyParams = Record<string, never>",
723
732
  ""
724
- ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${kt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => At(e, i)).join("\n")}\n} as const\n`}`, o = l(e.appRoot, ".framework", "routes.generated.ts");
733
+ ].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${At(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => jt(e, i)).join("\n")}\n} as const\n`}`, o = l(e.appRoot, ".framework", "routes.generated.ts");
725
734
  await O.mkdir(s(o), { recursive: !0 });
726
735
  let c = null;
727
736
  try {
@@ -734,7 +743,7 @@ __installPublicEnv(publicEnvValues)
734
743
  path: o,
735
744
  wrote: !0
736
745
  });
737
- }, Mt = 256, Nt = (e = Mt) => {
746
+ }, Nt = 256, Pt = (e = Nt) => {
738
747
  let t = [], n = /* @__PURE__ */ new Set();
739
748
  return {
740
749
  emit(r, i) {
@@ -757,27 +766,27 @@ __installPublicEnv(publicEnvValues)
757
766
  return t.slice();
758
767
  }
759
768
  };
760
- }, Pt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Ft = () => `: keep-alive ${Date.now()}\n\n`, It = {
769
+ }, Ft = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, It = () => `: keep-alive ${Date.now()}\n\n`, Lt = {
761
770
  trace: 0,
762
771
  debug: 1,
763
772
  info: 2,
764
773
  warn: 3,
765
774
  error: 4,
766
775
  fatal: 5
767
- }, Lt = 2e3, Rt = 200, zt = class {
776
+ }, Rt = 2e3, zt = 200, Bt = class {
768
777
  capacity;
769
778
  buffer = [];
770
- constructor(e = Lt) {
779
+ constructor(e = Rt) {
771
780
  this.capacity = e;
772
781
  }
773
782
  append(e) {
774
783
  this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
775
784
  }
776
785
  query(e = {}) {
777
- let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Rt, this.capacity), i = e.minLevel === void 0 ? It.trace : It[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
786
+ let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? zt, this.capacity), i = e.minLevel === void 0 ? Lt.trace : Lt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
778
787
  for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
779
788
  let r = this.buffer[e];
780
- r.ts < t || r.ts > n || It[r.level] < i || o !== void 0 && r.source !== o || a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || c !== void 0 && r.fields.traceId !== c || l.push(r);
789
+ r.ts < t || r.ts > n || Lt[r.level] < i || o !== void 0 && r.source !== o || a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || c !== void 0 && r.fields.traceId !== c || l.push(r);
781
790
  }
782
791
  return l.reverse();
783
792
  }
@@ -790,7 +799,7 @@ __installPublicEnv(publicEnvValues)
790
799
  clear() {
791
800
  this.buffer = [];
792
801
  }
793
- }, Bt = null, Vt = () => (Bt === null && (Bt = new zt()), Bt), Ht = (e) => {
802
+ }, Vt = null, Ht = () => (Vt === null && (Vt = new Bt()), Vt), Ut = (e) => {
794
803
  if (typeof e == "string") return e;
795
804
  if (e instanceof Error) return e.message;
796
805
  try {
@@ -798,18 +807,18 @@ __installPublicEnv(publicEnvValues)
798
807
  } catch {
799
808
  return String(e);
800
809
  }
801
- }, Ut = (e) => {
810
+ }, Wt = (e) => {
802
811
  let t = {
803
812
  log: console.log.bind(console),
804
813
  info: console.info.bind(console),
805
814
  warn: console.warn.bind(console),
806
815
  error: console.error.bind(console),
807
816
  debug: console.debug.bind(console)
808
- }, n = Vt(), r = !1, i = (i) => (...a) => {
817
+ }, n = Ht(), r = !1, i = (i) => (...a) => {
809
818
  if (t[i](...a), !r) {
810
819
  r = !0;
811
820
  try {
812
- let t = a.length > 0 ? Ht(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = F();
821
+ let t = a.length > 0 ? Ut(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = F();
813
822
  e.emit("log", {
814
823
  level: i,
815
824
  message: r,
@@ -867,24 +876,24 @@ __installPublicEnv(publicEnvValues)
867
876
  return () => {
868
877
  console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
869
878
  };
870
- }, Wt = 2e3, Gt = 8, Kt = 1e3, qt = 200, J = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Jt = (e) => {
879
+ }, Gt = 2e3, Kt = 8, qt = 1e3, Jt = 200, J = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Yt = (e) => {
871
880
  switch (e) {
872
881
  case "error": return "error";
873
882
  case "warn": return "warn";
874
883
  case "debug": return "debug";
875
884
  default: return "info";
876
885
  }
877
- }, Yt = S({ scope: "client" }), Xt = (e, t) => {
886
+ }, Xt = S({ scope: "client" }), Zt = (e, t) => {
878
887
  let n;
879
888
  try {
880
889
  n = JSON.parse(e);
881
890
  } catch {
882
- return Zt(400, { error: "invalid JSON body" });
891
+ return Qt(400, { error: "invalid JSON body" });
883
892
  }
884
- if (typeof n != "object" || !n) return Zt(400, { error: "body must be a JSON object" });
893
+ if (typeof n != "object" || !n) return Qt(400, { error: "body must be a JSON object" });
885
894
  let r = n;
886
- if (!Array.isArray(r.entries)) return Zt(400, { error: "entries must be an array" });
887
- let i = typeof r.app == "string" ? J(r.app, 120) : void 0, a = typeof r.page == "string" ? J(r.page, 200) : void 0, o = typeof r.ua == "string" ? J(r.ua, 200) : void 0, s = r.entries.slice(0, qt), c = 0;
895
+ if (!Array.isArray(r.entries)) return Qt(400, { error: "entries must be an array" });
896
+ let i = typeof r.app == "string" ? J(r.app, 120) : void 0, a = typeof r.page == "string" ? J(r.page, 200) : void 0, o = typeof r.ua == "string" ? J(r.ua, 200) : void 0, s = r.entries.slice(0, Jt), c = 0;
888
897
  for (let e of s) {
889
898
  if (typeof e != "object" || !e) continue;
890
899
  let n = e;
@@ -895,7 +904,7 @@ __installPublicEnv(publicEnvValues)
895
904
  "warn",
896
905
  "error",
897
906
  "debug"
898
- ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = J(n.message, Wt), u = Array.isArray(n.args) ? n.args.slice(0, Gt).filter((e) => typeof e == "string").map((e) => J(e, Kt)) : void 0, d = typeof n.stack == "string" ? J(n.stack, Wt) : void 0;
907
+ ].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = J(n.message, Gt), u = Array.isArray(n.args) ? n.args.slice(0, Kt).filter((e) => typeof e == "string").map((e) => J(e, qt)) : void 0, d = typeof n.stack == "string" ? J(n.stack, Gt) : void 0;
899
908
  t.emit("clientLog", {
900
909
  ts: s,
901
910
  level: r,
@@ -910,35 +919,35 @@ __installPublicEnv(publicEnvValues)
910
919
  ...i === void 0 ? {} : { app: i },
911
920
  ...a === void 0 ? {} : { page: a },
912
921
  ...u !== void 0 && u.length > 0 ? { args: u } : {}
913
- }, p = Jt(r);
914
- (p === "error" || p === "warn") && d !== void 0 ? Yt[p](l, f, { stack: d }) : Yt[p](l, {
922
+ }, p = Yt(r);
923
+ (p === "error" || p === "warn") && d !== void 0 ? Xt[p](l, f, { stack: d }) : Xt[p](l, {
915
924
  ...f,
916
925
  ...d === void 0 ? {} : { stack: d }
917
926
  }), c++;
918
927
  }
919
- return Zt(202, {
928
+ return Qt(202, {
920
929
  accepted: c,
921
930
  dropped: r.entries.length - c
922
931
  });
923
- }, Zt = (e, t) => ({
932
+ }, Qt = (e, t) => ({
924
933
  status: e,
925
934
  contentType: "application/json; charset=utf-8",
926
935
  body: JSON.stringify(t)
927
- }), Qt = "/_voltro/inspect/clientLog", $t = [
936
+ }), $t = "/_voltro/inspect/clientLog", en = [
928
937
  "trace",
929
938
  "debug",
930
939
  "info",
931
940
  "warn",
932
941
  "error",
933
942
  "fatal"
934
- ], en = {
943
+ ], tn = {
935
944
  trace: "TRACE",
936
945
  debug: "DEBUG",
937
946
  info: "INFO ",
938
947
  warn: "WARN ",
939
948
  error: "ERROR",
940
949
  fatal: "FATAL"
941
- }, tn = (e) => $t.includes(e), nn = (e, n, i = {}) => {
950
+ }, nn = (e) => en.includes(e), rn = (e, n, i = {}) => {
942
951
  if (t()) return {
943
952
  status: 503,
944
953
  contentType: "application/json",
@@ -969,7 +978,7 @@ __installPublicEnv(publicEnvValues)
969
978
  Number.isFinite(e) && e > 0 && (c.max = Math.floor(e));
970
979
  }
971
980
  let f = s.get("level");
972
- f !== null && tn(f) && (c.minLevel = f);
981
+ f !== null && nn(f) && (c.minLevel = f);
973
982
  let p = s.get("source");
974
983
  (p === "server" || p === "client") && (c.source = p);
975
984
  let m = s.get("scope");
@@ -982,7 +991,7 @@ __installPublicEnv(publicEnvValues)
982
991
  if ((s.get("format") ?? "json") === "text") return {
983
992
  status: 200,
984
993
  contentType: "text/plain; charset=utf-8",
985
- body: _.map(rn).join("\n") + (_.length > 0 ? "\n" : "")
994
+ body: _.map(an).join("\n") + (_.length > 0 ? "\n" : "")
986
995
  };
987
996
  let v = {
988
997
  capturedAt: Date.now(),
@@ -996,33 +1005,33 @@ __installPublicEnv(publicEnvValues)
996
1005
  contentType: "application/json; charset=utf-8",
997
1006
  body: JSON.stringify(v)
998
1007
  };
999
- }, rn = (e) => {
1000
- let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = on(e.fields);
1001
- return `${n}:${r}:${i}.${a} ${en[e.level]} ${o} ${e.message}${s}`;
1002
- }, an = 80, on = (e) => {
1008
+ }, an = (e) => {
1009
+ let t = new Date(e.ts), n = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), i = String(t.getSeconds()).padStart(2, "0"), a = String(t.getMilliseconds()).padStart(3, "0"), o = `[${e.scope ?? "?"}/${e.source}]`, s = sn(e.fields);
1010
+ return `${n}:${r}:${i}.${a} ${tn[e.level]} ${o} ${e.message}${s}`;
1011
+ }, on = 80, sn = (e) => {
1003
1012
  let t = Object.entries(e);
1004
1013
  if (t.length === 0) return "";
1005
1014
  let n = [];
1006
1015
  for (let [e, r] of t) {
1007
1016
  if (r === void 0) continue;
1008
- let t = sn(r);
1017
+ let t = cn(r);
1009
1018
  n.push(`${e}=${t}`);
1010
1019
  }
1011
1020
  return n.length > 0 ? " " + n.join(" ") : "";
1012
- }, sn = (e) => {
1021
+ }, cn = (e) => {
1013
1022
  if (typeof e == "string") {
1014
- let t = e.length > an ? e.slice(0, an) + "…" : e;
1023
+ let t = e.length > on ? e.slice(0, on) + "…" : e;
1015
1024
  return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
1016
1025
  }
1017
1026
  if (e === null) return "null";
1018
1027
  if (typeof e == "number" || typeof e == "boolean") return String(e);
1019
1028
  try {
1020
1029
  let t = JSON.stringify(e);
1021
- return t.length > an ? t.slice(0, an) + "…" : t;
1030
+ return t.length > on ? t.slice(0, on) + "…" : t;
1022
1031
  } catch {
1023
1032
  return "[unserialisable]";
1024
1033
  }
1025
- }, cn = "/_voltro/inspect/logs", ln = [{
1034
+ }, ln = "/_voltro/inspect/logs", un = [{
1026
1035
  match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
1027
1036
  handle: (e, t) => {
1028
1037
  let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
@@ -1034,13 +1043,13 @@ __installPublicEnv(publicEnvValues)
1034
1043
  });
1035
1044
  } else t.info(n);
1036
1045
  }
1037
- }], un = () => {
1046
+ }], dn = () => {
1038
1047
  let e = {
1039
1048
  warn: console.warn.bind(console),
1040
1049
  error: console.error.bind(console)
1041
1050
  }, t = S({ scope: "babel" }), n = !1, r = (r) => (...i) => {
1042
1051
  if (!n) {
1043
- for (let e of ln) if (e.match(i[0])) {
1052
+ for (let e of un) if (e.match(i[0])) {
1044
1053
  n = !0;
1045
1054
  try {
1046
1055
  e.handle(i, t);
@@ -1055,7 +1064,7 @@ __installPublicEnv(publicEnvValues)
1055
1064
  return console.warn = r("warn"), console.error = r("error"), () => {
1056
1065
  console.warn = e.warn, console.error = e.error;
1057
1066
  };
1058
- }, dn = {
1067
+ }, fn = {
1059
1068
  loader: "it runs on the server, and the router caches its result per route + params",
1060
1069
  renderMode: "it picks the server render strategy",
1061
1070
  dynamic: "it picks the server render strategy",
@@ -1066,7 +1075,7 @@ __installPublicEnv(publicEnvValues)
1066
1075
  cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
1067
1076
  interactive: "it decides how much client JS the server ships",
1068
1077
  tenantAware: "it is part of the server-side cache key"
1069
- }, fn = Object.keys(dn), pn = "virtual:voltro-route-refresh", mn = `\0${pn}`, hn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, gn = () => `
1078
+ }, pn = Object.keys(fn), mn = "virtual:voltro-route-refresh", hn = `\0${mn}`, gn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, _n = () => `
1070
1079
  // GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
1071
1080
 
1072
1081
  /** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
@@ -1095,11 +1104,11 @@ const stableForm = (value) => {
1095
1104
  * readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
1096
1105
  * one of THESE cannot be hot-applied: the server already ran with the old
1097
1106
  * value. Everything else a page exports is plain client-side data. */
1098
- const serverRelevantExports = ${JSON.stringify(fn)}
1107
+ const serverRelevantExports = ${JSON.stringify(pn)}
1099
1108
 
1100
1109
  /** Name → the server step that already consumed it, so the reload message can
1101
1110
  * say WHY rather than just WHAT. Injected from the same single source. */
1102
- const serverExportEffect = ${JSON.stringify(dn)}
1111
+ const serverExportEffect = ${JSON.stringify(fn)}
1103
1112
 
1104
1113
  /** The reason \`name\` forces a reload, for the console line. */
1105
1114
  export const serverEffectOf = (name) =>
@@ -1142,7 +1151,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
1142
1151
  const previousHook = globalThis.__getReactRefreshIgnoredExports
1143
1152
  globalThis.__getReactRefreshIgnoredExports = (args) =>
1144
1153
  ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
1145
- `, _n = (e) => `
1154
+ `, vn = (e) => `
1146
1155
  if (import.meta.hot) {
1147
1156
  // Self-import to read our OWN exports, the same technique the react plugin
1148
1157
  // uses; the namespace is only complete after evaluation, hence the promise.
@@ -1169,45 +1178,45 @@ import {
1169
1178
  registerRouteModule as __voltro_registerRouteModule,
1170
1179
  routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
1171
1180
  serverEffectOf as __voltro_serverEffect,
1172
- } from '${pn}'
1173
- `, vn = (e) => e.replace(/\\/g, "/"), yn = (e, t) => {
1174
- let [n = "", r] = vn(e).split("?");
1175
- if (!n.endsWith(".tsx") || r !== void 0 && hn.test(r)) return !1;
1176
- let i = vn(t).replace(/\/$/, "");
1181
+ } from '${mn}'
1182
+ `, yn = (e) => e.replace(/\\/g, "/"), bn = (e, t) => {
1183
+ let [n = "", r] = yn(e).split("?");
1184
+ if (!n.endsWith(".tsx") || r !== void 0 && gn.test(r)) return !1;
1185
+ let i = yn(t).replace(/\/$/, "");
1177
1186
  return n.startsWith(`${i}/`);
1178
- }, bn = (e, t, n) => yn(t, n) ? `${e}${_n(vn(t).split("?")[0] ?? t)}` : null, xn = (e) => ({
1187
+ }, xn = (e, t, n) => bn(t, n) ? `${e}${vn(yn(t).split("?")[0] ?? t)}` : null, Sn = (e) => ({
1179
1188
  name: "voltro:route-fast-refresh",
1180
1189
  enforce: "pre",
1181
- resolveId: (e) => e === "virtual:voltro-route-refresh" ? mn : void 0,
1182
- load: (e) => e === mn ? gn() : void 0,
1190
+ resolveId: (e) => e === "virtual:voltro-route-refresh" ? hn : void 0,
1191
+ load: (e) => e === hn ? _n() : void 0,
1183
1192
  transform: (t, n, r) => {
1184
1193
  if (r?.ssr === !0) return null;
1185
- let i = bn(t, n, e);
1194
+ let i = xn(t, n, e);
1186
1195
  return i === null ? null : {
1187
1196
  code: i,
1188
1197
  map: null
1189
1198
  };
1190
1199
  }
1191
- }), Sn = [
1200
+ }), Cn = [
1192
1201
  "static",
1193
1202
  "spa",
1194
1203
  "ssr",
1195
1204
  "isr"
1196
- ], Cn = (e) => typeof e == "string" && Sn.includes(e), wn = Sn.map((e) => `'${e}'`).join(" | "), Tn = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${wn}.${t === "client" || t === "csr" || t === "browser" ? "\n A page that renders only in the browser is 'spa': it is skipped by the prerender and mounts on the client. If its route has a layout, that layout still renders server-side as an SSR shell." : t === "server" || t === "dynamic" ? "\n A page rendered per request is 'ssr'." : t === "ssg" || t === "prerender" ? "\n A page rendered once at build time is 'static' (the default)." : ""}`, En = class extends Error {
1205
+ ], wn = (e) => typeof e == "string" && Cn.includes(e), Tn = Cn.map((e) => `'${e}'`).join(" | "), En = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${Tn}.${t === "client" || t === "csr" || t === "browser" ? "\n A page that renders only in the browser is 'spa': it is skipped by the prerender and mounts on the client. If its route has a layout, that layout still renders server-side as an SSR shell." : t === "server" || t === "dynamic" ? "\n A page rendered per request is 'ssr'." : t === "ssg" || t === "prerender" ? "\n A page rendered once at build time is 'static' (the default)." : ""}`, Dn = class extends Error {
1197
1206
  page;
1198
1207
  value;
1199
1208
  name = "InvalidRenderModeError";
1200
1209
  constructor(e, t) {
1201
- super(Tn(e, t)), this.page = e, this.value = t;
1210
+ super(En(e, t)), this.page = e, this.value = t;
1202
1211
  }
1203
- }, Dn = (e, t = "<page>") => {
1212
+ }, On = (e, t = "<page>") => {
1204
1213
  if (e.renderMode !== void 0 && e.renderMode !== null) {
1205
- if (!Cn(e.renderMode)) throw new En(t, String(e.renderMode));
1214
+ if (!wn(e.renderMode)) throw new Dn(t, String(e.renderMode));
1206
1215
  return e.renderMode;
1207
1216
  }
1208
1217
  return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
1209
- }, On = (e, t = "<page>") => ({
1210
- renderMode: Dn(e, t),
1218
+ }, kn = (e, t = "<page>") => ({
1219
+ renderMode: On(e, t),
1211
1220
  tenantAware: e.tenantAware === !0,
1212
1221
  revalidateMs: K(e.revalidate),
1213
1222
  staleWhileRevalidateMs: K(e.staleWhileRevalidate) ?? 0,
@@ -1216,7 +1225,7 @@ import {
1216
1225
  hasLoader: typeof e.loader == "function",
1217
1226
  hasMeta: e.meta != null,
1218
1227
  hasGetStaticPaths: typeof e.getStaticPaths == "function"
1219
- }), kn = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, An = (e) => kn.exec(e)?.[1] ?? null, jn = async (e, t) => {
1228
+ }), An = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, jn = (e) => An.exec(e)?.[1] ?? null, Mn = async (e, t) => {
1220
1229
  let n = (await Promise.all(t.map(async (t) => {
1221
1230
  let n;
1222
1231
  try {
@@ -1224,21 +1233,21 @@ import {
1224
1233
  } catch {
1225
1234
  return null;
1226
1235
  }
1227
- let r = An(n);
1228
- return r === null || Cn(r) ? null : {
1236
+ let r = jn(n);
1237
+ return r === null || wn(r) ? null : {
1229
1238
  file: t.file,
1230
1239
  value: r
1231
1240
  };
1232
1241
  }))).filter((e) => e !== null);
1233
- if (n.length !== 0) throw Error(n.map((e) => Tn(l("src", "pages", e.file), e.value)).join("\n\n"));
1234
- }, Mn = l(R(), ".voltro"), Nn = l(Mn, "runtime-registry.json"), Pn = 3e4, Fn = () => {
1242
+ if (n.length !== 0) throw Error(n.map((e) => En(l("src", "pages", e.file), e.value)).join("\n\n"));
1243
+ }, Nn = l(R(), ".voltro"), Pn = l(Nn, "runtime-registry.json"), Fn = 3e4, In = () => {
1235
1244
  let e = Math.random().toString(36).slice(2, 10);
1236
- return `${Nn}.${process.pid}.${Date.now()}.${e}.tmp`;
1237
- }, In = async () => {
1238
- await O.mkdir(Mn, { recursive: !0 });
1245
+ return `${Pn}.${process.pid}.${Date.now()}.${e}.tmp`;
1239
1246
  }, Ln = async () => {
1247
+ await O.mkdir(Nn, { recursive: !0 });
1248
+ }, Rn = async () => {
1240
1249
  try {
1241
- let e = await O.readFile(Nn, "utf8"), t = JSON.parse(e);
1250
+ let e = await O.readFile(Pn, "utf8"), t = JSON.parse(e);
1242
1251
  return t.version !== 1 || !Array.isArray(t.apps) ? {
1243
1252
  version: 1,
1244
1253
  apps: []
@@ -1249,34 +1258,34 @@ import {
1249
1258
  apps: []
1250
1259
  };
1251
1260
  }
1252
- }, Rn = async (e) => {
1253
- await In();
1254
- let t = Fn();
1261
+ }, zn = async (e) => {
1262
+ await Ln();
1263
+ let t = In();
1255
1264
  try {
1256
1265
  await O.writeFile(t, JSON.stringify(e, null, 2), {
1257
1266
  encoding: "utf8",
1258
1267
  mode: 384
1259
- }), await O.rename(t, Nn), await O.chmod(Nn, 384).catch(() => {});
1268
+ }), await O.rename(t, Pn), await O.chmod(Pn, 384).catch(() => {});
1260
1269
  } catch (e) {
1261
1270
  try {
1262
1271
  await O.unlink(t);
1263
1272
  } catch {}
1264
1273
  throw e;
1265
1274
  }
1266
- }, zn = (e) => {
1275
+ }, Bn = (e) => {
1267
1276
  try {
1268
1277
  return process.kill(e, 0), !0;
1269
1278
  } catch {
1270
1279
  return !1;
1271
1280
  }
1272
- }, Bn = (e) => {
1281
+ }, Vn = (e) => {
1273
1282
  let t = Date.now();
1274
- return e.filter((e) => zn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Pn : !1);
1275
- }, Vn = async () => {
1276
- let e = await Ln(), t = Bn(e.apps);
1283
+ return e.filter((e) => Bn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Fn : !1);
1284
+ }, Hn = async () => {
1285
+ let e = await Rn(), t = Vn(e.apps);
1277
1286
  if (t.length === e.apps.length) return e;
1278
1287
  try {
1279
- await Rn({
1288
+ await zn({
1280
1289
  version: 1,
1281
1290
  apps: t
1282
1291
  });
@@ -1285,33 +1294,33 @@ import {
1285
1294
  version: 1,
1286
1295
  apps: t
1287
1296
  };
1288
- }, Hn = async (e) => {
1289
- let t = await Ln(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
1297
+ }, Un = async (e) => {
1298
+ let t = await Rn(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
1290
1299
  ...e,
1291
1300
  ...i !== void 0 && i !== "" ? { inspectToken: i } : {},
1292
1301
  registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
1293
1302
  heartbeatAt: n
1294
1303
  };
1295
- await Rn({
1304
+ await zn({
1296
1305
  version: 1,
1297
1306
  apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
1298
1307
  });
1299
- }, Un = async (e) => {
1308
+ }, Wn = async (e) => {
1300
1309
  try {
1301
- let t = await Ln(), n = t.apps.filter((t) => t.id !== e);
1310
+ let t = await Rn(), n = t.apps.filter((t) => t.id !== e);
1302
1311
  if (n.length === t.apps.length) return;
1303
- await Rn({
1312
+ await zn({
1304
1313
  version: 1,
1305
1314
  apps: n
1306
1315
  });
1307
1316
  } catch {}
1308
- }, Wn = (e, t, n) => `${e}:${t}:${n}`, Y = l(R(), ".voltro", "logs"), Gn = () => {
1317
+ }, Gn = (e, t, n) => `${e}:${t}:${n}`, Y = l(R(), ".voltro", "logs"), Kn = () => {
1309
1318
  let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
1310
1319
  return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
1311
- }, Kn = !1, qn = () => {
1312
- if (Kn) return;
1313
- Kn = !0;
1314
- let e = Date.now() - Gn(), t = [];
1320
+ }, qn = !1, Jn = () => {
1321
+ if (qn) return;
1322
+ qn = !0;
1323
+ let e = Date.now() - Kn(), t = [];
1315
1324
  try {
1316
1325
  t = A(Y);
1317
1326
  } catch {
@@ -1324,8 +1333,8 @@ import {
1324
1333
  j(t).mtimeMs < e && M(t);
1325
1334
  } catch {}
1326
1335
  }
1327
- }, Jn = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), Yn = (e, t) => l(Y, `${Jn(e)}-${t}.log`), Xn = (e) => {
1328
- let t = Jn(e), n = [];
1336
+ }, Yn = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), Xn = (e, t) => l(Y, `${Yn(e)}-${t}.log`), Zn = (e) => {
1337
+ let t = Yn(e), n = [];
1329
1338
  try {
1330
1339
  n = A(Y);
1331
1340
  } catch {
@@ -1342,12 +1351,12 @@ import {
1342
1351
  } catch {}
1343
1352
  }
1344
1353
  return i;
1345
- }, Zn = (e) => {
1354
+ }, Qn = (e) => {
1346
1355
  try {
1347
1356
  E(Y, { recursive: !0 });
1348
1357
  } catch {}
1349
- qn();
1350
- let t = Yn(e, process.pid), n = D(t, "w"), r = (e) => {
1358
+ Jn();
1359
+ let t = Xn(e, process.pid), n = D(t, "w"), r = (e) => {
1351
1360
  let t = {
1352
1361
  ts: e.ts.getTime(),
1353
1362
  level: e.level,
@@ -1388,7 +1397,7 @@ import {
1388
1397
  a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
1389
1398
  }
1390
1399
  };
1391
- }, Qn = async (e, t) => {
1400
+ }, $n = async (e, t) => {
1392
1401
  let n;
1393
1402
  try {
1394
1403
  n = await O.readFile(e, "utf8");
@@ -1402,11 +1411,11 @@ import {
1402
1411
  i.push(t);
1403
1412
  } catch {}
1404
1413
  return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
1405
- }, $n = S({ scope: "voltro:dashboard" }), er = L(import.meta.url), tr = 5179, nr = (e) => {
1414
+ }, er = S({ scope: "voltro:dashboard" }), tr = L(import.meta.url), nr = 5179, rr = (e) => {
1406
1415
  let t = process.env.VOLTRO_DASHBOARD_PATH;
1407
1416
  if (t && T(l(d(t), "app.config.ts"))) return d(t);
1408
1417
  try {
1409
- let e = s(er.resolve("@voltro/dashboard/package.json"));
1418
+ let e = s(tr.resolve("@voltro/dashboard/package.json"));
1410
1419
  if (T(l(e, "app.config.ts"))) return e;
1411
1420
  } catch {}
1412
1421
  let n = l("voltro-devtools", "apps", "dashboard"), r = d(e);
@@ -1418,7 +1427,7 @@ import {
1418
1427
  r = t;
1419
1428
  }
1420
1429
  return null;
1421
- }, rr = "VOLTRO_IS_DASHBOARD", ir = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1430
+ }, ir = "VOLTRO_IS_DASHBOARD", ar = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
1422
1431
  let i = he({
1423
1432
  port: e,
1424
1433
  host: t
@@ -1426,7 +1435,7 @@ import {
1426
1435
  a || (a = !0, i.destroy(), r(e));
1427
1436
  };
1428
1437
  i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
1429
- }), ar = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), or = () => process.env[rr] === "1", sr = () => process.stdout.isTTY === !0, X = l(R(), ".voltro", "dashboard-launch.lock"), cr = 1e4, lr = async () => {
1438
+ }), or = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), sr = () => process.env[ir] === "1", cr = () => process.stdout.isTTY === !0, X = l(R(), ".voltro", "dashboard-launch.lock"), lr = 1e4, ur = async () => {
1430
1439
  try {
1431
1440
  await O.mkdir(s(X), { recursive: !0 });
1432
1441
  let e = await O.open(X, "wx");
@@ -1434,37 +1443,37 @@ import {
1434
1443
  } catch {
1435
1444
  try {
1436
1445
  let e = await O.stat(X);
1437
- if (Date.now() - e.mtimeMs > cr) return await O.unlink(X).catch(() => void 0), lr();
1446
+ if (Date.now() - e.mtimeMs > lr) return await O.unlink(X).catch(() => void 0), ur();
1438
1447
  } catch {}
1439
1448
  return !1;
1440
1449
  }
1441
- }, ur = async () => {
1450
+ }, dr = async () => {
1442
1451
  try {
1443
1452
  await O.unlink(X);
1444
1453
  } catch {}
1445
- }, dr = async (e) => {
1454
+ }, fr = async (e) => {
1446
1455
  let t = e.port ?? 5179;
1447
- if (ar()) return {
1456
+ if (or()) return {
1448
1457
  status: "skipped",
1449
1458
  reason: "disabled by flag/env",
1450
1459
  port: t
1451
1460
  };
1452
- if (or()) return {
1461
+ if (sr()) return {
1453
1462
  status: "skipped",
1454
1463
  reason: "this process IS the dashboard",
1455
1464
  port: t
1456
1465
  };
1457
- if (!sr()) return {
1466
+ if (!cr()) return {
1458
1467
  status: "skipped",
1459
1468
  reason: "stdout is not a TTY (CI/smoke)",
1460
1469
  port: t
1461
1470
  };
1462
- if (!await lr()) return {
1471
+ if (!await ur()) return {
1463
1472
  status: "skipped",
1464
1473
  reason: "another voltro process is currently launching the dashboard",
1465
1474
  port: t
1466
1475
  };
1467
- if (await ir(t)) return await ur(), {
1476
+ if (await ar(t)) return await dr(), {
1468
1477
  status: "already-running",
1469
1478
  port: t
1470
1479
  };
@@ -1481,7 +1490,7 @@ import {
1481
1490
  stdio: "ignore",
1482
1491
  env: {
1483
1492
  ...process.env,
1484
- [rr]: "1",
1493
+ [ir]: "1",
1485
1494
  VOLTRO_DASHBOARD_PORT: String(t)
1486
1495
  }
1487
1496
  });
@@ -1489,22 +1498,22 @@ import {
1489
1498
  if (a.exitCode === null && a.signalCode === null) try {
1490
1499
  a.kill("SIGTERM");
1491
1500
  } catch {}
1492
- }), $n.info(`auto-launching dashboard at http://localhost:${t}`, {
1501
+ }), er.info(`auto-launching dashboard at http://localhost:${t}`, {
1493
1502
  port: t,
1494
1503
  mode: i,
1495
1504
  prebuilt: r
1496
- }), r || $n.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), $n.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1497
- ur();
1505
+ }), r || er.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), er.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
1506
+ dr();
1498
1507
  }, 4e3).unref(), {
1499
1508
  status: "launched",
1500
1509
  port: t
1501
1510
  };
1502
- }, fr = class extends Error {
1511
+ }, pr = class extends Error {
1503
1512
  _voltroDeferral = !0;
1504
1513
  constructor(e) {
1505
1514
  super(e), this.name = "DeferralNotSupportedError";
1506
1515
  }
1507
- }, pr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, mr = (e) => {
1516
+ }, mr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, hr = (e) => {
1508
1517
  let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
1509
1518
  for (let [n, o] of Object.entries(e.segmentLoaderData)) {
1510
1519
  let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
@@ -1519,7 +1528,7 @@ import {
1519
1528
  ...e.layoutShell ? { layoutShell: e.layoutShell } : {}
1520
1529
  });
1521
1530
  } catch (e) {
1522
- throw new fr(e instanceof Error ? e.message : String(e));
1531
+ throw new pr(e instanceof Error ? e.message : String(e));
1523
1532
  }
1524
1533
  return {
1525
1534
  loaderData: n.renderData,
@@ -1535,8 +1544,8 @@ import {
1535
1544
  ...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
1536
1545
  }
1537
1546
  };
1538
- }, hr = (e) => {
1539
- let { helpers: t, renderInput: n } = e, r = mr({
1547
+ }, gr = (e) => {
1548
+ let { helpers: t, renderInput: n } = e, r = hr({
1540
1549
  helpers: t,
1541
1550
  page: e.page,
1542
1551
  pathname: n.pathname,
@@ -1557,37 +1566,37 @@ import {
1557
1566
  stateScript: t.renderRouterStateScript(r.stateInput),
1558
1567
  hasDeferred: r.hasDeferred
1559
1568
  };
1560
- }, gr = (e) => {
1569
+ }, _r = (e) => {
1561
1570
  let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
1562
1571
  return {
1563
1572
  body: t,
1564
1573
  meta: n
1565
1574
  };
1566
- }, _r = (e) => [
1575
+ }, vr = (e) => [
1567
1576
  ...e.extra ?? [],
1568
1577
  e.helpers.renderMetaToHtml(e.meta),
1569
1578
  `<meta name="voltro-interactive" content="${e.interactive}" />`,
1570
1579
  ...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
1571
1580
  e.prepared.stateScript
1572
- ].filter((e) => e.length > 0).join("\n "), vr = "<div id=\"root\"></div>", yr = "<div id=\"root\">", br = "</div>", xr = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Sr = /\bsrc=["']([^"']+)["']/i, Cr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, wr = (e) => {
1573
- let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(xr, (e) => {
1574
- let r = Sr.exec(e)?.[1];
1581
+ ].filter((e) => e.length > 0).join("\n "), yr = "<div id=\"root\"></div>", br = "<div id=\"root\">", xr = "</div>", Sr = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Cr = /\bsrc=["']([^"']+)["']/i, wr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Tr = (e) => {
1582
+ let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Sr, (e) => {
1583
+ let r = Cr.exec(e)?.[1];
1575
1584
  return r === void 0 || t(r) ? e : (n.push(r), "");
1576
1585
  });
1577
- e.inlineModuleScriptsAsync && (r = r.replace(Cr, "<script async$1>"));
1578
- let i = r.indexOf(vr);
1579
- if (i === -1) throw Error(`[voltro] the generated shell has no \`${vr}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
1586
+ e.inlineModuleScriptsAsync && (r = r.replace(wr, "<script async$1>"));
1587
+ let i = r.indexOf(yr);
1588
+ if (i === -1) throw Error(`[voltro] the generated shell has no \`${yr}\` element, so a streamed response cannot be split around the page body. This is a framework bug unless the app overrode \`.framework/index.html\` by hand.`);
1580
1589
  return {
1581
- head: `${r.slice(0, i)}${yr}`,
1582
- tail: `${br}${r.slice(i + 21)}`,
1590
+ head: `${r.slice(0, i)}${br}`,
1591
+ tail: `${xr}${r.slice(i + 21)}`,
1583
1592
  bootstrapModules: n
1584
1593
  };
1585
- }, Tr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Er = (e) => {
1594
+ }, Er = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Dr = (e) => {
1586
1595
  let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
1587
1596
  if (s || !o || a === null) return;
1588
1597
  s = !0, t.statusCode = e.statusCode ?? 200;
1589
1598
  for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
1590
- t.flushHeaders?.(), t.write(Tr({
1599
+ t.flushHeaders?.(), t.write(Er({
1591
1600
  head: n.head,
1592
1601
  headInjection: i(a.meta),
1593
1602
  htmlLang: r
@@ -1617,14 +1626,14 @@ import {
1617
1626
  return;
1618
1627
  }
1619
1628
  c();
1620
- }, Z = S({ scope: "voltro:dev:web" }), Dr = S({ scope: "vite" }), Or = await (async () => {
1629
+ }, Z = S({ scope: "voltro:dev:web" }), Or = S({ scope: "vite" }), kr = await (async () => {
1621
1630
  try {
1622
1631
  let e = l(s(f(import.meta.url)), "..", "package.json"), t = await O.readFile(e, "utf8");
1623
1632
  return JSON.parse(t).version ?? "0.0.0";
1624
1633
  } catch {
1625
1634
  return "0.0.0";
1626
1635
  }
1627
- })(), kr = async () => {
1636
+ })(), Ar = async () => {
1628
1637
  try {
1629
1638
  let e = s(f(import.meta.url)), t = d(e, "..", "..", "devtools");
1630
1639
  if (T(l(t, "package.json"))) return t;
@@ -1633,7 +1642,7 @@ import {
1633
1642
  } catch {
1634
1643
  return null;
1635
1644
  }
1636
- }, Ar = (e, t) => e.disableDevtools || !t ? [] : [
1645
+ }, jr = (e, t) => e.disableDevtools || !t ? [] : [
1637
1646
  "",
1638
1647
  "// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
1639
1648
  "// compile-time constant, so prod builds strip this whole `if` block — the",
@@ -1643,12 +1652,12 @@ import {
1643
1652
  " await import('@voltro/devtools/styles.css')",
1644
1653
  " Devtools = (await import('@voltro/devtools')).VoltroDevtools",
1645
1654
  "}"
1646
- ], jr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Mr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Nr = (e) => e.sentry ? [
1655
+ ], Mr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Nr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Pr = (e) => e.sentry ? [
1647
1656
  "",
1648
1657
  "// Browser-side Sentry (frontend half of the deep integration). Errors +",
1649
1658
  "// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
1650
1659
  `await initSentryBrowser(${JSON.stringify(e.sentry)})`
1651
- ] : [], Pr = (e) => e.env ? ["import './env.public'"] : [], Fr = (e) => {
1660
+ ] : [], Fr = (e) => e.env ? ["import './env.public'"] : [], Ir = (e) => {
1652
1661
  let t = [], n = d(e);
1653
1662
  for (;;) {
1654
1663
  T(l(n, "pnpm-workspace.yaml")) && t.push(n);
@@ -1657,19 +1666,19 @@ import {
1657
1666
  n = e;
1658
1667
  }
1659
1668
  return t;
1660
- }, Ir = /* @__PURE__ */ new Set([
1669
+ }, Lr = /* @__PURE__ */ new Set([
1661
1670
  "layout.tsx",
1662
1671
  "error.tsx",
1663
1672
  "loading.tsx",
1664
1673
  "not-found.tsx"
1665
- ]), Lr = (e) => /\.(test|spec)\.tsx$/.test(e), Rr = (e) => {
1674
+ ]), Rr = (e) => /\.(test|spec)\.tsx$/.test(e), zr = (e) => {
1666
1675
  if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
1667
1676
  let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
1668
1677
  if (t) return `island-${t[1]}`;
1669
- }, zr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Br = (e) => e.startsWith("(") && e.endsWith(")"), Vr = (e) => e.filter((e) => !Br(e)), Hr = (e) => {
1670
- let t = e.replace(/\.tsx$/, "").split("/").filter(Boolean).filter((e) => !Br(e)), n = t.length > 0 && t[t.length - 1] === "index" ? t.slice(0, -1) : t;
1678
+ }, Br = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Vr = (e) => e.startsWith("(") && e.endsWith(")"), Hr = (e) => e.filter((e) => !Vr(e)), Ur = (e) => {
1679
+ let t = e.replace(/\.tsx$/, "").split("/").filter(Boolean).filter((e) => !Vr(e)), n = t.length > 0 && t[t.length - 1] === "index" ? t.slice(0, -1) : t;
1671
1680
  return n.length === 0 ? "/" : "/" + n.join("/");
1672
- }, Ur = (e) => `${e.replace(/\.tsx$/, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
1681
+ }, Wr = (e) => `${e.replace(/\.tsx$/, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
1673
1682
  let t = [], n = [], r = async (e, i) => {
1674
1683
  let a = [];
1675
1684
  try {
@@ -1677,17 +1686,17 @@ import {
1677
1686
  } catch {
1678
1687
  return;
1679
1688
  }
1680
- let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), s = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Lr(e.name)).map((e) => e.name).sort(), c = new Set(s), u = i.join("/");
1681
- if (s.some((e) => Ir.has(e))) {
1689
+ let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), s = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Rr(e.name)).map((e) => e.name).sort(), c = new Set(s), u = i.join("/");
1690
+ if (s.some((e) => Lr.has(e))) {
1682
1691
  let t = c.has("layout.tsx"), r = !1;
1683
1692
  if (t) try {
1684
1693
  let t = await O.readFile(l(e, "layout.tsx"), "utf8");
1685
- r = zr.test(t);
1694
+ r = Br.test(t);
1686
1695
  } catch {}
1687
1696
  n.push({
1688
1697
  dir: u,
1689
1698
  chain: i,
1690
- contributesToUrl: i.length === 0 || !Br(i[i.length - 1]),
1699
+ contributesToUrl: i.length === 0 || !Vr(i[i.length - 1]),
1691
1700
  hasLayout: t,
1692
1701
  hasLayoutLoader: r,
1693
1702
  hasError: c.has("error.tsx"),
@@ -1696,12 +1705,12 @@ import {
1696
1705
  });
1697
1706
  }
1698
1707
  for (let e of s) {
1699
- if (Ir.has(e)) continue;
1708
+ if (Lr.has(e)) continue;
1700
1709
  let n = u ? `${u}/${e}` : e;
1701
1710
  t.push({
1702
1711
  file: n,
1703
- pattern: Hr(n),
1704
- ident: Ur(n),
1712
+ pattern: Ur(n),
1713
+ ident: Wr(n),
1705
1714
  dirChain: i
1706
1715
  });
1707
1716
  }
@@ -1711,14 +1720,14 @@ import {
1711
1720
  pages: t,
1712
1721
  dirs: n
1713
1722
  };
1714
- }, Wr = (e, t) => {
1723
+ }, Gr = (e, t) => {
1715
1724
  let n = [];
1716
1725
  for (let r = 0; r <= t.length; r++) {
1717
1726
  let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
1718
1727
  a && n.push(a);
1719
1728
  }
1720
1729
  return n;
1721
- }, Gr = async (e) => {
1730
+ }, Kr = async (e) => {
1722
1731
  let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
1723
1732
  return {
1724
1733
  chain: await Promise.all(t.map(async (e, t) => {
@@ -1740,10 +1749,10 @@ import {
1740
1749
  })),
1741
1750
  segmentLoaderData: o
1742
1751
  };
1743
- }, Kr = (e) => {
1744
- let t = Vr(e);
1752
+ }, qr = (e) => {
1753
+ let t = Hr(e);
1745
1754
  return t.length === 0 ? "" : "/" + t.join("/");
1746
- }, qr = [
1755
+ }, Jr = [
1747
1756
  "// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
1748
1757
  "// in sync with Vite's CSS HMR. Without this, edits to .css files",
1749
1758
  "// only update the JS-injected <style> overlay; the underlying <link>",
@@ -1836,7 +1845,7 @@ import {
1836
1845
  " _vdtErrorStart('Build error')",
1837
1846
  " })",
1838
1847
  "}"
1839
- ].join("\n"), Jr = (e) => {
1848
+ ].join("\n"), Yr = (e) => {
1840
1849
  let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
1841
1850
  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, "\\$&"));
1842
1851
  let a = i.join("/");
@@ -1845,8 +1854,8 @@ import {
1845
1854
  paramNames: t,
1846
1855
  priority: n
1847
1856
  };
1848
- }, Yr = (e) => e.map((e) => {
1849
- let { regex: t, paramNames: n, priority: r } = Jr(e.pattern);
1857
+ }, Xr = (e) => e.map((e) => {
1858
+ let { regex: t, paramNames: n, priority: r } = Yr(e.pattern);
1850
1859
  return {
1851
1860
  pattern: e.pattern,
1852
1861
  file: e.file,
@@ -1855,7 +1864,7 @@ import {
1855
1864
  paramNames: n,
1856
1865
  priority: r
1857
1866
  };
1858
- }).slice().sort((e, t) => e.priority - t.priority), Xr = (e, t) => {
1867
+ }).slice().sort((e, t) => e.priority - t.priority), Zr = (e, t) => {
1859
1868
  for (let n of t) {
1860
1869
  let t = n.regex.exec(e);
1861
1870
  if (!t) continue;
@@ -1867,7 +1876,7 @@ import {
1867
1876
  };
1868
1877
  }
1869
1878
  return null;
1870
- }, Zr = async (e, t) => {
1879
+ }, Qr = async (e, t) => {
1871
1880
  let n = e;
1872
1881
  for (;;) {
1873
1882
  let e = l(n, "node_modules", t);
@@ -1881,7 +1890,7 @@ import {
1881
1890
  if (r === n) return null;
1882
1891
  n = r;
1883
1892
  }
1884
- }, Qr = async (e) => {
1893
+ }, $r = async (e) => {
1885
1894
  try {
1886
1895
  let t = await import(p(l(e, "app.config.ts")).href), n = t.default?.port, r = typeof n == "number" ? n : 4e3, i = t.default?.transport?.wsPath, a = typeof i == "string" && i.startsWith("/") ? i : void 0;
1887
1896
  return a ? {
@@ -1890,7 +1899,7 @@ import {
1890
1899
  } : { port: r };
1891
1900
  } catch {}
1892
1901
  return { port: 4e3 };
1893
- }, $r = (e, t) => ({
1902
+ }, ei = (e, t) => ({
1894
1903
  name: e,
1895
1904
  pkg: t.package,
1896
1905
  browserWsUrl: t.url,
@@ -1898,7 +1907,7 @@ import {
1898
1907
  ...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
1899
1908
  ...t.headers ? { headers: t.headers } : {},
1900
1909
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1901
- }), ei = (e, t, n) => {
1910
+ }), ti = (e, t, n) => {
1902
1911
  let r = t.transport?.wsPath ?? n.wsPath;
1903
1912
  return {
1904
1913
  name: e,
@@ -1910,7 +1919,7 @@ import {
1910
1919
  ...t.headers ? { headers: t.headers } : {},
1911
1920
  ...t.authHeaders ? { hasAuthHeaders: !0 } : {}
1912
1921
  };
1913
- }, ti = (e) => {
1922
+ }, ni = (e) => {
1914
1923
  let t = /* @__PURE__ */ new Map();
1915
1924
  for (let n of e) {
1916
1925
  if (n.proxyTarget === void 0) continue;
@@ -1918,43 +1927,43 @@ import {
1918
1927
  if (e) throw Error(`[voltro] api ${JSON.stringify(n.name)} and ${JSON.stringify(e)} both resolve the same-origin WS path ${JSON.stringify(n.browserWsUrl)}. A custom transport.wsPath must be unique per origin (one api per origin may use a fixed path). Give each a distinct wsPath, or drop the override to use the default /ws/<name>.`);
1919
1928
  t.set(n.browserWsUrl, n.name);
1920
1929
  }
1921
- }, ni = async (e, t) => {
1930
+ }, ri = async (e, t) => {
1922
1931
  let n = Object.entries(t.apis ?? {}), r = [];
1923
1932
  for (let [t, i] of n) {
1924
1933
  if (i.url) {
1925
- r.push($r(t, i));
1934
+ r.push(ei(t, i));
1926
1935
  continue;
1927
1936
  }
1928
- let n = await Zr(e, i.package);
1937
+ let n = await Qr(e, i.package);
1929
1938
  if (!n) throw Error(`[voltro dev] api ${JSON.stringify(t)} (package ${JSON.stringify(i.package)}) is not a workspace dep and has no \`url\` set in app.config.ts. External apis need an explicit \`url\` because the framework can't discover their dev port.`);
1930
- r.push(ei(t, i, await Qr(n)));
1939
+ r.push(ti(t, i, await $r(n)));
1931
1940
  }
1932
- return ti(r), r;
1933
- }, ri = (e) => {
1941
+ return ni(r), r;
1942
+ }, ii = (e) => {
1934
1943
  if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
1935
1944
  let t = new URL(e);
1936
1945
  return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
1937
1946
  } catch {
1938
1947
  return;
1939
1948
  }
1940
- }, ii = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ai = (e) => process.env[ii(e)] ?? process.env.VOLTRO_API_ORIGIN, oi = (e, t) => {
1949
+ }, ai = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, oi = (e) => process.env[ai(e)] ?? process.env.VOLTRO_API_ORIGIN, si = (e, t) => {
1941
1950
  if (!e) return;
1942
- let n = ai(e.name) ?? e.serverOrigin;
1951
+ let n = oi(e.name) ?? e.serverOrigin;
1943
1952
  if (n) {
1944
- let e = ri(n);
1953
+ let e = ii(n);
1945
1954
  if (e) return e;
1946
1955
  }
1947
1956
  if (t?.allowDevProxy && e.proxyTarget) {
1948
- let t = ri(e.proxyTarget);
1957
+ let t = ii(e.proxyTarget);
1949
1958
  if (t) return t;
1950
1959
  }
1951
- if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ri(e.browserWsUrl);
1952
- }, si = (e, t, n) => {
1960
+ if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ii(e.browserWsUrl);
1961
+ }, ci = (e, t, n) => {
1953
1962
  if (!e) {
1954
1963
  if (n?.apiName === void 0) return;
1955
1964
  let e = n.apiName;
1956
1965
  return async () => {
1957
- throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${ii(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
1966
+ throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${ai(e)} (or VOLTRO_API_ORIGIN, or apis.${e}.serverUrl in app.config.ts) to the api's internal origin, e.g. http://api.<namespace>.svc.cluster.local. The browser transport is unaffected.`);
1958
1967
  };
1959
1968
  }
1960
1969
  return async (r, i) => {
@@ -1976,7 +1985,7 @@ import {
1976
1985
  });
1977
1986
  } catch (t) {
1978
1987
  let i = t?.cause?.code ?? String(t?.message ?? t);
1979
- throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${ii(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
1988
+ throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${ai(n.apiName)} / VOLTRO_API_ORIGIN` : "Set the api server origin"} to the api's SSR-reachable origin (internal cluster DNS in a split deployment).`, { cause: t });
1980
1989
  }
1981
1990
  if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
1982
1991
  let s = await o.json();
@@ -1994,8 +2003,8 @@ import {
1994
2003
  }
1995
2004
  if (u) return l;
1996
2005
  };
1997
- }, ci = async (e, t, n, r = {}) => {
1998
- let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = T(l(e, "node_modules", "@voltro", "devtools", "package.json")) || await kr() !== null, s = t.theme === "system" ? [
2006
+ }, li = async (e, t, n, r = {}) => {
2007
+ let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = T(l(e, "node_modules", "@voltro", "devtools", "package.json")) || await Ar() !== null, s = t.theme === "system" ? [
1999
2008
  " <script>",
2000
2009
  " (function () {",
2001
2010
  " var root = document.documentElement",
@@ -2034,7 +2043,7 @@ import {
2034
2043
  "</html>",
2035
2044
  ""
2036
2045
  ].join("\n"), u = l(e, "src", "pages"), { pages: d, dirs: f } = await $(u);
2037
- await jn(u, d);
2046
+ await Mn(u, d);
2038
2047
  let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, h = n.map((e) => `import { appGroup as ${p(e.name)}, appDescriptors as ${m(e.name)} } from '${e.pkg}/rpcGroup'`);
2039
2048
  n.some((e) => e.hasAuthHeaders) && (h.push("import __voltroAppConfig from '../app.config'"), h.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
2040
2049
  let g = n.map((e) => {
@@ -2048,13 +2057,13 @@ import {
2048
2057
  e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && n.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && n.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && n.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && n.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
2049
2058
  }
2050
2059
  let r = d.map((e) => {
2051
- let t = Wr(f, e.dirChain).map((e) => {
2060
+ let t = Gr(f, e.dirChain).map((e) => {
2052
2061
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2053
2062
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasLayoutLoader && t.push(`loader: refs.layoutLoaders[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), e.hasPending && t.push(`Pending: refs.pendings[${n}]`), ` { ${t.join(", ")} }`;
2054
2063
  }).join(",\n");
2055
2064
  return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
2056
2065
  }), i = f.filter((e) => e.hasNotFound).map((e) => {
2057
- let t = Kr(e.chain), n = Wr(f, e.chain).map((e) => {
2066
+ let t = qr(e.chain), n = Gr(f, e.chain).map((e) => {
2058
2067
  let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
2059
2068
  return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
2060
2069
  }).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
@@ -2293,14 +2302,14 @@ import {
2293
2302
  "// resolved apis map. Side-effect only — no local component definitions —",
2294
2303
  "// so downstream invalidations (user page edits) terminate at app.tsx.",
2295
2304
  "",
2296
- ...Pr(t),
2305
+ ...Fr(t),
2297
2306
  "import { mount } from '@voltro/web'",
2298
2307
  ...h,
2299
2308
  "import { App } from './app'",
2300
2309
  "import { preloadCurrentRoute } from './routeTable'",
2301
- ...Mr(t),
2302
- ...Ar(t, o),
2303
2310
  ...Nr(t),
2311
+ ...jr(t, o),
2312
+ ...Pr(t),
2304
2313
  "",
2305
2314
  "// Preload the current route's page chunk BEFORE hydration so the first",
2306
2315
  "// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
@@ -2317,10 +2326,10 @@ import {
2317
2326
  " apis: {",
2318
2327
  ...g,
2319
2328
  " },",
2320
- ...jr(t, o),
2329
+ ...Mr(t, o),
2321
2330
  "})",
2322
2331
  "",
2323
- qr
2332
+ Jr
2324
2333
  ].join("\n");
2325
2334
  } else _ = "", v = "", y = [
2326
2335
  "// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
@@ -2328,22 +2337,22 @@ import {
2328
2337
  "// and calls mount(). Side-effect only, no component definitions, so the",
2329
2338
  "// user's component file remains the Fast Refresh boundary.",
2330
2339
  "",
2331
- ...Pr(t),
2340
+ ...Fr(t),
2332
2341
  "import { mount } from '@voltro/web'",
2333
2342
  ...h,
2334
2343
  "import App from '../src/App'",
2335
- ...Mr(t),
2336
- ...Ar(t, o),
2337
2344
  ...Nr(t),
2345
+ ...jr(t, o),
2346
+ ...Pr(t),
2338
2347
  "",
2339
2348
  "mount(App, {",
2340
2349
  " apis: {",
2341
2350
  ...g,
2342
2351
  " },",
2343
- ...jr(t, o),
2352
+ ...Mr(t, o),
2344
2353
  "})",
2345
2354
  "",
2346
- qr
2355
+ Jr
2347
2356
  ].join("\n");
2348
2357
  let b = l(e, ".framework");
2349
2358
  await O.mkdir(b, { recursive: !0 }), t.env ? await Ze(b, r) : await O.rm(l(b, "env.public.ts"), { force: !0 }), await O.writeFile(l(b, "index.html"), c, "utf8"), await O.writeFile(l(b, "main.tsx"), y, "utf8"), _ ? (await O.writeFile(l(b, "app.tsx"), _, "utf8"), await O.writeFile(l(b, "routeTable.ts"), v, "utf8")) : (await O.rm(l(b, "app.tsx"), { force: !0 }), await O.rm(l(b, "routeTable.ts"), { force: !0 }));
@@ -2354,7 +2363,7 @@ import {
2354
2363
  let C = ["/.framework/"], w = S.split("\n").filter((e) => e.trim() !== "");
2355
2364
  for (let e of C) w.includes(e) || w.push(e);
2356
2365
  await O.writeFile(x, w.join("\n") + "\n", "utf8");
2357
- }, li = async (e, t) => {
2366
+ }, ui = async (e, t) => {
2358
2367
  try {
2359
2368
  let n = l(s(e), "project.json");
2360
2369
  if (!T(n)) return;
@@ -2367,24 +2376,24 @@ import {
2367
2376
  projectJson: n
2368
2377
  });
2369
2378
  } catch {}
2370
- }, ui = (e) => l(e, ".framework", "dist", "server", "appConfig.js"), di = async (e) => {
2371
- let t = ui(e), n = T(t) ? t : l(e, "app.config.ts");
2379
+ }, di = (e) => l(e, ".framework", "dist", "server", "appConfig.js"), fi = async (e) => {
2380
+ let t = di(e), n = T(t) ? t : l(e, "app.config.ts");
2372
2381
  try {
2373
2382
  let e = (await import(p(n).href)).default;
2374
2383
  return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
2375
2384
  } catch {
2376
2385
  return null;
2377
2386
  }
2378
- }, fi = async (s) => {
2379
- let c = await di(s);
2387
+ }, pi = async (s) => {
2388
+ let c = await fi(s);
2380
2389
  if (!c) return {
2381
2390
  ran: !1,
2382
2391
  exitCode: 0
2383
2392
  };
2384
- un();
2385
- let f = Nt();
2386
- Ut(f), Z.info("booting voltro dev (web)", { app: c.name ?? "(unnamed)" });
2387
- let p = await ni(s, c);
2393
+ dn();
2394
+ let f = Pt();
2395
+ Wt(f), Z.info("booting voltro dev (web)", { app: c.name ?? "(unnamed)" });
2396
+ let p = await ri(s, c);
2388
2397
  for (let e of p) Z.info("api wired", {
2389
2398
  name: e.name,
2390
2399
  pkg: e.pkg,
@@ -2403,13 +2412,13 @@ import {
2403
2412
  log: Z,
2404
2413
  generateTypes: !0
2405
2414
  }), h = m.publicValues;
2406
- await ci(s, c, p, h), Z.debug("generated framework entry files", { files: [
2415
+ await li(s, c, p, h), Z.debug("generated framework entry files", { files: [
2407
2416
  "index.html",
2408
2417
  ".framework/main.tsx",
2409
2418
  ...c.env ? [".framework/env.public.ts"] : []
2410
2419
  ] });
2411
- let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : c.port ?? 5173, _ = c.name ?? "unnamed", v = Wn("web", _, g), y = Zn(_);
2412
- await Hn({
2420
+ let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : c.port ?? 5173, _ = c.name ?? "unnamed", v = Gn("web", _, g), y = Qn(_);
2421
+ await Un({
2413
2422
  id: v,
2414
2423
  name: _,
2415
2424
  kind: "web",
@@ -2417,14 +2426,14 @@ import {
2417
2426
  pid: process.pid,
2418
2427
  status: "booting",
2419
2428
  logFile: y.path
2420
- }).catch(() => {}), await li(s, g);
2429
+ }).catch(() => {}), await ui(s, g);
2421
2430
  let { pages: b, dirs: x } = await $(l(s, "src", "pages")), S = x.map((e) => ({
2422
2431
  dir: e.dir,
2423
2432
  hasLayout: e.hasLayout,
2424
2433
  hasError: e.hasError,
2425
2434
  hasPending: e.hasPending,
2426
2435
  hasNotFound: e.hasNotFound
2427
- })), w = await jt({
2436
+ })), w = await Mt({
2428
2437
  appRoot: s,
2429
2438
  pages: b
2430
2439
  });
@@ -2453,7 +2462,7 @@ import {
2453
2462
  ...n.devDependencies
2454
2463
  });
2455
2464
  await Promise.all(r.map(async (t) => {
2456
- let n = await Zr(s, t);
2465
+ let n = await Qr(s, t);
2457
2466
  if (!n) return;
2458
2467
  let r = l(n, "src");
2459
2468
  try {
@@ -2465,9 +2474,9 @@ import {
2465
2474
  }, P = l(s, "src", "pages"), ee = (e) => e.endsWith(".tsx") && (e === P || e.startsWith(P + "/")), F = (e) => e === P || e.startsWith(P + "/"), te = async (e) => {
2466
2475
  try {
2467
2476
  let t = Date.now();
2468
- await ci(s, c, p, h);
2477
+ await li(s, c, p, h);
2469
2478
  let { pages: n } = await $(P);
2470
- await jt({
2479
+ await Mt({
2471
2480
  appRoot: s,
2472
2481
  pages: n
2473
2482
  }), Z.info("page tree regenerated", {
@@ -2559,7 +2568,7 @@ import {
2559
2568
  }
2560
2569
  try {
2561
2570
  let t = Date.now();
2562
- await ci(s, n, await ni(s, n)), re = n, e.ws && e.ws.send({
2571
+ await li(s, n, await ri(s, n)), re = n, e.ws && e.ws.send({
2563
2572
  type: "full-reload",
2564
2573
  path: "*"
2565
2574
  }), Z.info("app.config.ts soft-regen", {
@@ -2583,7 +2592,7 @@ import {
2583
2592
  } catch (e) {
2584
2593
  Z.warn("app.config.ts polling watcher could not attach", {}, e);
2585
2594
  }
2586
- ut(st, Z, {
2595
+ dt(ct, Z, {
2587
2596
  root: s,
2588
2597
  onBeforeRestart: () => e.close()
2589
2598
  });
@@ -2599,7 +2608,7 @@ import {
2599
2608
  let t = /* @__PURE__ */ new Map();
2600
2609
  for (let n of p) {
2601
2610
  if (!n.proxyTarget) continue;
2602
- let r = await Zr(s, n.pkg);
2611
+ let r = await Qr(s, n.pkg);
2603
2612
  if (!r) continue;
2604
2613
  let i = l(r, "rpcGroup.generated.ts");
2605
2614
  try {
@@ -2685,7 +2694,7 @@ import {
2685
2694
  pattern: t.pattern,
2686
2695
  file: t.file,
2687
2696
  dirChain: t.dirChain,
2688
- renderMode: Dn(n, l("src", "pages", t.file)),
2697
+ renderMode: On(n, l("src", "pages", t.file)),
2689
2698
  interactive: n.interactive ?? "full",
2690
2699
  tenantAware: n.tenantAware === !0,
2691
2700
  revalidateMs: K(n.revalidate),
@@ -2804,7 +2813,7 @@ import {
2804
2813
  for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (l[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
2805
2814
  let u = s.split("?")[0];
2806
2815
  if (e.method === "GET" && (u === "/_voltro/inspect/logs" || s.startsWith("/_voltro/inspect/logs?"))) {
2807
- let e = a(l.origin), t = nn(s, Vt(), l);
2816
+ let e = a(l.origin), t = rn(s, Ht(), l);
2808
2817
  n.statusCode = t.status, n.setHeader("content-type", t.contentType);
2809
2818
  for (let [t, r] of Object.entries(e)) n.setHeader(t, r);
2810
2819
  n.end(t.body);
@@ -2822,7 +2831,7 @@ import {
2822
2831
  e.setEncoding("utf-8"), e.on("data", (e) => {
2823
2832
  i += e;
2824
2833
  }), e.on("end", () => {
2825
- let e = Xt(i, f);
2834
+ let e = Zt(i, f);
2826
2835
  n.statusCode = e.status, n.setHeader("content-type", e.contentType);
2827
2836
  for (let [e, t] of Object.entries(r)) n.setHeader(e, t);
2828
2837
  n.end(e.body);
@@ -2853,14 +2862,14 @@ import {
2853
2862
  for (let [e, t] of Object.entries(i)) n.setHeader(e, t);
2854
2863
  n.flushHeaders?.(), n.write("retry: 5000\n\n");
2855
2864
  let c = s.indexOf("?");
2856
- if (!(c !== -1 && new URLSearchParams(s.slice(c + 1)).get("live") === "1")) for (let e of f.buffered()) n.write(Pt(e));
2865
+ if (!(c !== -1 && new URLSearchParams(s.slice(c + 1)).get("live") === "1")) for (let e of f.buffered()) n.write(Ft(e));
2857
2866
  let u = f.subscribe((e) => {
2858
2867
  try {
2859
- n.write(Pt(e));
2868
+ n.write(Ft(e));
2860
2869
  } catch {}
2861
2870
  }), d = setInterval(() => {
2862
2871
  try {
2863
- n.write(Ft());
2872
+ n.write(It());
2864
2873
  } catch {}
2865
2874
  }, 15e3), p = () => {
2866
2875
  clearInterval(d), u();
@@ -2873,7 +2882,7 @@ import {
2873
2882
  kind: "web",
2874
2883
  meta: {
2875
2884
  name: c.name ?? "(unnamed)",
2876
- voltroVersion: Or,
2885
+ voltroVersion: kr,
2877
2886
  port: g,
2878
2887
  mode: "dev",
2879
2888
  apis: Object.entries(c.apis ?? {}).map(([e, t]) => {
@@ -2908,14 +2917,14 @@ import {
2908
2917
  e.middlewares.use(async (e, t, n) => {
2909
2918
  if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
2910
2919
  try {
2911
- let e = await Vn();
2920
+ let e = await Hn();
2912
2921
  t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
2913
2922
  } catch (e) {
2914
2923
  t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
2915
2924
  }
2916
2925
  });
2917
2926
  }
2918
- } : null, fe = Yr(b), B = /* @__PURE__ */ new Set(), he = yt(), ge = xt({
2927
+ } : null, fe = Xr(b), B = /* @__PURE__ */ new Set(), he = bt(), ge = St({
2919
2928
  limit: he,
2920
2929
  onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
2921
2930
  onColdEnd: (e) => Z.debug("ssr cold-compile end", { id: e })
@@ -2929,7 +2938,7 @@ import {
2929
2938
  if (n.method !== "GET" && n.method !== "HEAD") return i();
2930
2939
  let a = n.url ?? "/", o = a.indexOf("?"), c = (o === -1 ? a : a.slice(0, o)) || "/";
2931
2940
  if (c.startsWith("/@") || c.startsWith("/node_modules/") || c.startsWith("/.framework/") || c.startsWith("/_voltro/") || c === "/main.tsx" || c === "/index.html" || c === "/sw.js" || c === "/favicon.ico" || c === "/robots.txt" || /\.[a-z0-9]+$/i.test(c)) return i();
2932
- let u = Xr(c, fe);
2941
+ let u = Zr(c, fe);
2933
2942
  if (!u) return i();
2934
2943
  let d = !B.has(u.route.pattern), f = Date.now();
2935
2944
  d && Z.info(`ssr compiling ${u.route.pattern}`, {
@@ -2951,15 +2960,15 @@ import {
2951
2960
  }
2952
2961
  };
2953
2962
  try {
2954
- let o = await h("loadPage", async () => await t(l(s, "src", "pages", u.route.file))), _ = Dn(o, l("src", "pages", u.route.file)), v = Wr(x, u.route.dirChain), y = _ === "spa" && v.some((e) => e.hasLayout);
2963
+ let o = await h("loadPage", async () => await t(l(s, "src", "pages", u.route.file))), _ = On(o, l("src", "pages", u.route.file)), v = Gr(x, u.route.dirChain), y = _ === "spa" && v.some((e) => e.hasLayout);
2955
2964
  if (_ !== "ssr" && _ !== "isr" && !y) return i();
2956
2965
  let b = {};
2957
2966
  for (let [e, t] of Object.entries(n.headers ?? {})) typeof t == "string" ? b[e] = t : Array.isArray(t) && (b[e] = t.join(", "));
2958
- let S = si(oi(p[0], { allowDevProxy: !0 }), b.cookie, { apiName: p[0]?.name }), C = new AbortController(), w = () => C.abort();
2967
+ let S = ci(si(p[0], { allowDevProxy: !0 }), b.cookie, { apiName: p[0]?.name }), C = new AbortController(), w = () => C.abort();
2959
2968
  r.once("close", w);
2960
2969
  let T = null, E = [], D = {};
2961
2970
  try {
2962
- ({chain: E, segmentLoaderData: D} = await h("loadChain", () => Gr({
2971
+ ({chain: E, segmentLoaderData: D} = await h("loadChain", () => Kr({
2963
2972
  entries: v,
2964
2973
  loadLayout: (e) => t(l(s, "src", "pages", e.dir, "layout.tsx")),
2965
2974
  loadError: (e) => t(l(s, "src", "pages", e.dir, "error.tsx")),
@@ -2996,7 +3005,7 @@ import {
2996
3005
  cookies: O.parseCookieHeader(b.cookie),
2997
3006
  headers: b,
2998
3007
  url: a
2999
- }, j = o.interactive ?? "full", M = y ? hr({
3008
+ }, j = o.interactive ?? "full", M = y ? gr({
3000
3009
  helpers: O,
3001
3010
  page: `src/pages/${u.route.file}`,
3002
3011
  interactive: j,
@@ -3008,7 +3017,7 @@ import {
3008
3017
  segmentLoaderData: D,
3009
3018
  requestContext: A
3010
3019
  }
3011
- }) : null, N = y ? null : mr({
3020
+ }) : null, N = y ? null : hr({
3012
3021
  helpers: O,
3013
3022
  page: `src/pages/${u.route.file}`,
3014
3023
  pathname: c,
@@ -3032,16 +3041,16 @@ import {
3032
3041
  });
3033
3042
  let ee = await h("readShell", ve), F = await h("transformShell", () => e.transformIndexHtml(a, ee)), te = P.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), I = A.cookies["voltro:locale"] ?? "en", L = Date.now();
3034
3043
  if (M) {
3035
- let e = (e) => _r({
3044
+ let e = (e) => vr({
3036
3045
  helpers: O,
3037
3046
  prepared: M,
3038
3047
  meta: e,
3039
3048
  interactive: j,
3040
3049
  extra: [te]
3041
3050
  });
3042
- if (M.hasDeferred) Er({
3051
+ if (M.hasDeferred) Dr({
3043
3052
  res: r,
3044
- shell: wr({
3053
+ shell: Tr({
3045
3054
  shell: F,
3046
3055
  inlineModuleScriptsAsync: !0
3047
3056
  }),
@@ -3063,7 +3072,7 @@ import {
3063
3072
  }
3064
3073
  });
3065
3074
  else {
3066
- let t = gr({
3075
+ let t = _r({
3067
3076
  helpers: O,
3068
3077
  prepared: M
3069
3078
  }), n = F.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${I}"`);
@@ -3084,9 +3093,9 @@ import {
3084
3093
  segmentLoaderData: N.segmentLoaderData,
3085
3094
  requestContext: A
3086
3095
  };
3087
- if (_ === "ssr" && j === "full") Er({
3096
+ if (_ === "ssr" && j === "full") Dr({
3088
3097
  res: r,
3089
- shell: wr({
3098
+ shell: Tr({
3090
3099
  shell: F,
3091
3100
  inlineModuleScriptsAsync: !0
3092
3101
  }),
@@ -3128,7 +3137,7 @@ import {
3128
3137
  phases: m
3129
3138
  });
3130
3139
  } catch (e) {
3131
- if (pr(e)) {
3140
+ if (mr(e)) {
3132
3141
  Z.error("ssr-dev render refused", {
3133
3142
  pathname: c,
3134
3143
  pattern: u.route.pattern
@@ -3142,11 +3151,11 @@ import {
3142
3151
  }
3143
3152
  });
3144
3153
  }
3145
- }, V = Date.now(), be = E.version ?? "?", xe = await kr(), H = l(s, "node_modules", "@voltro", "ui-shadcn"), U = T(l(H, "package.json")) ? H : null, Se = [], Ce = await (async () => {
3154
+ }, V = Date.now(), be = E.version ?? "?", xe = await Ar(), H = l(s, "node_modules", "@voltro", "ui-shadcn"), U = T(l(H, "package.json")) ? H : null, Se = [], Ce = await (async () => {
3146
3155
  let e = [];
3147
3156
  for (let t of p) {
3148
3157
  if (!t.proxyTarget) continue;
3149
- let n = await Zr(s, t.pkg);
3158
+ let n = await Qr(s, t.pkg);
3150
3159
  if (n) try {
3151
3160
  e.push(await O.readFile(l(n, "rpcGroup.generated.ts"), "utf8"));
3152
3161
  } catch {}
@@ -3201,9 +3210,9 @@ import {
3201
3210
  include: [...p.map((e) => `${e.pkg}/rpcGroup`), ...Se],
3202
3211
  force: Ce
3203
3212
  },
3204
- customLogger: vt(),
3213
+ customLogger: yt(),
3205
3214
  plugins: [
3206
- xn(l(s, "src", "pages")),
3215
+ Sn(l(s, "src", "pages")),
3207
3216
  D(),
3208
3217
  k(),
3209
3218
  N,
@@ -3221,12 +3230,12 @@ import {
3221
3230
  host: !0,
3222
3231
  allowedHosts: c.allowedHosts === !0 || [...c.allowedHosts ?? []],
3223
3232
  proxy: z,
3224
- fs: { allow: [s, ...Fr(s)] }
3233
+ fs: { allow: [s, ...Ir(s)] }
3225
3234
  },
3226
3235
  appType: "spa",
3227
3236
  cacheDir: l(A, ".vite"),
3228
3237
  publicDir: l(s, "public")
3229
- })).listen(), Dr.info(`v${be} ready in ${Date.now() - V}ms`, {
3238
+ })).listen(), Or.info(`v${be} ready in ${Date.now() - V}ms`, {
3230
3239
  version: be,
3231
3240
  bootMs: Date.now() - V
3232
3241
  }), Z.info(`listening on http://localhost:${g}`, {
@@ -3238,7 +3247,7 @@ import {
3238
3247
  target: e.proxyTarget
3239
3248
  }), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
3240
3249
  try {
3241
- await Hn({
3250
+ await Un({
3242
3251
  id: v,
3243
3252
  name: _,
3244
3253
  kind: "web",
@@ -3247,13 +3256,13 @@ import {
3247
3256
  status: "live",
3248
3257
  logFile: y.path
3249
3258
  });
3250
- let e = nr(s);
3259
+ let e = rr(s);
3251
3260
  if (e) {
3252
- let t = await dr({ dashboardAppPath: e });
3261
+ let t = await fr({ dashboardAppPath: e });
3253
3262
  t.status === "launched" ? Z.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Z.debug(`dashboard already running on :${t.port}`, { port: t.port });
3254
3263
  }
3255
3264
  setInterval(() => {
3256
- Hn({
3265
+ Un({
3257
3266
  id: v,
3258
3267
  name: _,
3259
3268
  kind: "web",
@@ -3264,7 +3273,7 @@ import {
3264
3273
  }).catch(() => {});
3265
3274
  }, 1e4).unref();
3266
3275
  let t = () => {
3267
- Un(v), y.dispose();
3276
+ Wn(v), y.dispose();
3268
3277
  };
3269
3278
  process.on("SIGINT", t), process.on("SIGTERM", t);
3270
3279
  } catch (e) {
@@ -3276,24 +3285,24 @@ import {
3276
3285
  url: `http://localhost:${g}`,
3277
3286
  bootMs: Date.now() - V
3278
3287
  }), new Promise(() => {});
3279
- }, pi = async (e) => {
3288
+ }, mi = async (e) => {
3280
3289
  process.env.NODE_ENV || (process.env.NODE_ENV = "production");
3281
- let t = await di(e);
3290
+ let t = await fi(e);
3282
3291
  if (!t) return {
3283
3292
  ran: !1,
3284
3293
  exitCode: 0
3285
3294
  };
3286
3295
  let n = Date.now(), r = Z.child("serve");
3287
3296
  r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
3288
- let i = await ni(e, t);
3297
+ let i = await ri(e, t);
3289
3298
  for (let e of i) r.info("api wired", {
3290
3299
  name: e.name,
3291
3300
  pkg: e.pkg
3292
3301
  });
3293
- await ci(e, t, i);
3302
+ await li(e, t, i);
3294
3303
  {
3295
3304
  let { pages: t } = await $(l(e, "src", "pages"));
3296
- await jt({
3305
+ await Mt({
3297
3306
  appRoot: e,
3298
3307
  pages: t
3299
3308
  });
@@ -3303,11 +3312,11 @@ import {
3303
3312
  root: c,
3304
3313
  envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
3305
3314
  plugins: [s()],
3306
- customLogger: vt(),
3315
+ customLogger: yt(),
3307
3316
  resolve: { dedupe: ["react", "react-dom"] },
3308
3317
  build: {
3309
3318
  outDir: "dist",
3310
- rollupOptions: { output: { manualChunks: Rr } }
3319
+ rollupOptions: { output: { manualChunks: zr } }
3311
3320
  },
3312
3321
  publicDir: l(e, "public")
3313
3322
  });
@@ -3327,14 +3336,14 @@ import {
3327
3336
  extras: f,
3328
3337
  bootMs: Date.now() - n
3329
3338
  }), new Promise(() => {});
3330
- }, mi = 5e3, hi = 6e4, gi = (e, t) => {
3339
+ }, hi = 5e3, gi = 6e4, _i = (e, t) => {
3331
3340
  if (e.length === 0) return 0;
3332
3341
  if (e.length === 1) return e[0];
3333
3342
  let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
3334
3343
  if (r === i) return e[r];
3335
3344
  let a = n - r;
3336
3345
  return e[r] * (1 - a) + e[i] * a;
3337
- }, _i = (e) => {
3346
+ }, vi = (e) => {
3338
3347
  if (e.length === 0) return {
3339
3348
  p50: 0,
3340
3349
  p95: 0,
@@ -3346,15 +3355,15 @@ import {
3346
3355
  let t = e.slice().sort((e, t) => e - t), n = 0;
3347
3356
  for (let e of t) n += e;
3348
3357
  return {
3349
- p50: gi(t, .5),
3350
- p95: gi(t, .95),
3351
- p99: gi(t, .99),
3358
+ p50: _i(t, .5),
3359
+ p95: _i(t, .95),
3360
+ p99: _i(t, .99),
3352
3361
  mean: n / t.length,
3353
3362
  min: t[0],
3354
3363
  max: t[t.length - 1]
3355
3364
  };
3356
- }, vi = (e = {}) => {
3357
- let t = e.maxSamples ?? mi, n = e.defaultWindowMs ?? hi, r = [];
3365
+ }, yi = (e = {}) => {
3366
+ let t = e.maxSamples ?? hi, n = e.defaultWindowMs ?? gi, r = [];
3358
3367
  return {
3359
3368
  record(e) {
3360
3369
  te(e), r.push({
@@ -3383,7 +3392,7 @@ import {
3383
3392
  tag: e.tag,
3384
3393
  count: e.samples.length,
3385
3394
  errorCount: n,
3386
- latencyMs: _i(t)
3395
+ latencyMs: vi(t)
3387
3396
  });
3388
3397
  }
3389
3398
  return c.sort((e, t) => t.count - e.count), {
@@ -3396,4 +3405,4 @@ import {
3396
3405
  };
3397
3406
  };
3398
3407
  //#endregion
3399
- export { it as $, Un as A, Xt as B, dr as C, Qn as D, Zn as E, Tn as F, Ft as G, Vt as H, Dn as I, yt as J, jt as K, cn as L, Sn as M, On as N, Wn as O, Cn as P, rt as Q, nn as R, tr as S, Xn as T, Pt as U, Ut as V, Nt as W, ct as X, ut as Y, st as Z, mr as _, Gr as a, Qe as at, _r as b, ni as c, Ge as ct, Rr as d, Ve as dt, at as et, $ as f, V as ft, pr as g, Er as h, si as i, tt as it, Hn as j, Vn as k, fi as l, Ue as lt, wr as m, zr as n, K as nt, Wr as o, Xe as ot, ci as p, be as pt, xt as q, oi as r, et as rt, di as s, Ye as st, vi as t, nt as tt, pi as u, Be as ut, hr as v, nr as w, rr as x, gr as y, Qt as z };
3408
+ export { it as $, Wn as A, Zt as B, fr as C, $n as D, Qn as E, En as F, It as G, Ht as H, On as I, bt as J, Mt as K, ln as L, Cn as M, kn as N, Gn as O, wn as P, rt as Q, rn as R, nr as S, Zn as T, Ft as U, Wt as V, Pt as W, lt as X, dt as Y, ct as Z, hr as _, Kr as a, Qe as at, vr as b, ri as c, Ge as ct, zr as d, Ve as dt, at as et, $ as f, V as ft, mr as g, Dr as h, ci as i, tt as it, Un as j, Hn as k, pi as l, Ue as lt, Tr as m, Br as n, K as nt, Gr as o, Xe as ot, li as p, be as pt, St as q, si as r, et as rt, fi as s, Ye as st, yi as t, nt as tt, mi as u, Be as ut, gr as v, rr as w, ir as x, _r as y, $t as z };