@voltro/cli 0.22.0 → 0.22.1
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.
- package/CHANGELOG.md +67 -0
- package/dist/apiBuild-COyPDf3R.js +2 -0
- package/dist/{apiBuild-2zRxj2hJ.js → apiBuild-DiWxVz-M.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/{commands-DGaeTn2f.js → commands-BxRaIOBG.js} +1147 -1141
- package/dist/{dev-DeHVUxQx.js → dev-BRiPgbKw.js} +2 -2
- package/dist/{dev-BEYBSGJ7.js → dev-Dd3EZzj5.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-4AVPn6IS.js → inspectMetrics-9ZSuDeqD.js} +140 -111
- package/dist/{serveCommand-DEVTtnLy.js → serveCommand-DXJOARkO.js} +184 -184
- package/dist/serveEntry.js +2 -2
- package/dist/{start-BjGUIIvj.js → start-CsIjcOi-.js} +1 -1
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/whats-new.md +32 -214
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-sqNmWmY5.js +0 -2
|
@@ -1544,6 +1544,28 @@ import {
|
|
|
1544
1544
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1545
1545
|
}
|
|
1546
1546
|
}, Er = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Dr = (e) => {
|
|
1547
|
+
if (!(e instanceof Error)) return;
|
|
1548
|
+
let t = e._voltroControl;
|
|
1549
|
+
if (t === "redirect") {
|
|
1550
|
+
let { location: t, status: n } = e;
|
|
1551
|
+
return typeof t == "string" ? {
|
|
1552
|
+
status: n === 307 || n === 308 ? n : 303,
|
|
1553
|
+
headers: {
|
|
1554
|
+
location: t,
|
|
1555
|
+
"x-voltro-rendered-by": "loader-redirect"
|
|
1556
|
+
},
|
|
1557
|
+
body: ""
|
|
1558
|
+
} : void 0;
|
|
1559
|
+
}
|
|
1560
|
+
if (t === "not-found") return {
|
|
1561
|
+
status: 404,
|
|
1562
|
+
headers: {
|
|
1563
|
+
"content-type": "text/plain; charset=utf-8",
|
|
1564
|
+
"x-voltro-rendered-by": "loader-not-found"
|
|
1565
|
+
},
|
|
1566
|
+
body: "not found"
|
|
1567
|
+
};
|
|
1568
|
+
}, Or = (e) => {
|
|
1547
1569
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1548
1570
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1549
1571
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1574,8 +1596,8 @@ import {
|
|
|
1574
1596
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1575
1597
|
}
|
|
1576
1598
|
};
|
|
1577
|
-
},
|
|
1578
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1599
|
+
}, kr = (e) => {
|
|
1600
|
+
let { helpers: t, renderInput: n } = e, r = Or({
|
|
1579
1601
|
helpers: t,
|
|
1580
1602
|
page: e.page,
|
|
1581
1603
|
pathname: n.pathname,
|
|
@@ -1596,37 +1618,37 @@ import {
|
|
|
1596
1618
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1597
1619
|
hasDeferred: r.hasDeferred
|
|
1598
1620
|
};
|
|
1599
|
-
},
|
|
1621
|
+
}, Ar = (e) => {
|
|
1600
1622
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1601
1623
|
return {
|
|
1602
1624
|
body: t,
|
|
1603
1625
|
meta: n
|
|
1604
1626
|
};
|
|
1605
|
-
},
|
|
1627
|
+
}, jr = (e) => [
|
|
1606
1628
|
...e.extra ?? [],
|
|
1607
1629
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1608
1630
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1609
1631
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1610
1632
|
e.prepared.stateScript
|
|
1611
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1612
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1613
|
-
let r =
|
|
1633
|
+
].filter((e) => e.length > 0).join("\n "), Mr = "<div id=\"root\"></div>", Nr = "<div id=\"root\">", Pr = "</div>", Fr = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Ir = /\bsrc=["']([^"']+)["']/i, Lr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Rr = (e) => {
|
|
1634
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Fr, (e) => {
|
|
1635
|
+
let r = Ir.exec(e)?.[1];
|
|
1614
1636
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1615
1637
|
});
|
|
1616
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1617
|
-
let i = r.indexOf(
|
|
1618
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1638
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Lr, "<script async$1>"));
|
|
1639
|
+
let i = r.indexOf(Mr);
|
|
1640
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Mr}\` 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.`);
|
|
1619
1641
|
return {
|
|
1620
|
-
head: `${r.slice(0, i)}${
|
|
1621
|
-
tail: `${
|
|
1642
|
+
head: `${r.slice(0, i)}${Nr}`,
|
|
1643
|
+
tail: `${Pr}${r.slice(i + 21)}`,
|
|
1622
1644
|
bootstrapModules: n
|
|
1623
1645
|
};
|
|
1624
|
-
},
|
|
1646
|
+
}, zr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Br = (e) => {
|
|
1625
1647
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1626
1648
|
if (s || !o || a === null) return;
|
|
1627
1649
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1628
1650
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1629
|
-
t.flushHeaders?.(), t.write(
|
|
1651
|
+
t.flushHeaders?.(), t.write(zr({
|
|
1630
1652
|
head: n.head,
|
|
1631
1653
|
headInjection: i(a.meta),
|
|
1632
1654
|
htmlLang: r
|
|
@@ -1656,14 +1678,14 @@ import {
|
|
|
1656
1678
|
return;
|
|
1657
1679
|
}
|
|
1658
1680
|
c();
|
|
1659
|
-
}, X = T({ scope: "voltro:dev:web" }),
|
|
1681
|
+
}, X = T({ scope: "voltro:dev:web" }), Vr = T({ scope: "vite" }), Hr = await (async () => {
|
|
1660
1682
|
try {
|
|
1661
1683
|
let e = f(u(h(import.meta.url)), "..", "package.json"), t = await A.readFile(e, "utf8");
|
|
1662
1684
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1663
1685
|
} catch {
|
|
1664
1686
|
return "0.0.0";
|
|
1665
1687
|
}
|
|
1666
|
-
})(),
|
|
1688
|
+
})(), Ur = async () => {
|
|
1667
1689
|
try {
|
|
1668
1690
|
let e = u(h(import.meta.url)), t = m(e, "..", "..", "devtools");
|
|
1669
1691
|
if (O(f(t, "package.json"))) return t;
|
|
@@ -1672,7 +1694,7 @@ import {
|
|
|
1672
1694
|
} catch {
|
|
1673
1695
|
return null;
|
|
1674
1696
|
}
|
|
1675
|
-
},
|
|
1697
|
+
}, Wr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1676
1698
|
"",
|
|
1677
1699
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1678
1700
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1682,12 +1704,12 @@ import {
|
|
|
1682
1704
|
" await import('@voltro/devtools/styles.css')",
|
|
1683
1705
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1684
1706
|
"}"
|
|
1685
|
-
],
|
|
1707
|
+
], Gr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Kr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], qr = (e) => e.sentry ? [
|
|
1686
1708
|
"",
|
|
1687
1709
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1688
1710
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1689
1711
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1690
|
-
] : [],
|
|
1712
|
+
] : [], Jr = (e) => e.env ? ["import './env.public'"] : [], Yr = (e) => {
|
|
1691
1713
|
let t = [], n = m(e);
|
|
1692
1714
|
for (;;) {
|
|
1693
1715
|
O(f(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1696,14 +1718,14 @@ import {
|
|
|
1696
1718
|
n = e;
|
|
1697
1719
|
}
|
|
1698
1720
|
return t;
|
|
1699
|
-
},
|
|
1721
|
+
}, Xr = Nn, Zr = (e) => {
|
|
1700
1722
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1701
1723
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1702
1724
|
if (t) return `island-${t[1]}`;
|
|
1703
|
-
},
|
|
1704
|
-
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) =>
|
|
1725
|
+
}, Qr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, $r = (e) => e.startsWith("(") && e.endsWith(")"), ei = (e) => e.filter((e) => !$r(e)), ti = (e) => {
|
|
1726
|
+
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !$r(e));
|
|
1705
1727
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
1706
|
-
},
|
|
1728
|
+
}, ni = (e) => `${e.replace(t, "").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`, Z = (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}`, Q = async (n) => {
|
|
1707
1729
|
let r = [], i = [], a = async (n, o) => {
|
|
1708
1730
|
let s = [];
|
|
1709
1731
|
try {
|
|
@@ -1711,17 +1733,17 @@ import {
|
|
|
1711
1733
|
} catch {
|
|
1712
1734
|
return;
|
|
1713
1735
|
}
|
|
1714
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1736
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Xr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
1715
1737
|
if (l.some((t) => e.has(t))) {
|
|
1716
1738
|
let t = u.has("layout.tsx"), r = !1;
|
|
1717
1739
|
if (t) try {
|
|
1718
1740
|
let e = await A.readFile(f(n, "layout.tsx"), "utf8");
|
|
1719
|
-
r =
|
|
1741
|
+
r = Qr.test(e);
|
|
1720
1742
|
} catch {}
|
|
1721
1743
|
i.push({
|
|
1722
1744
|
dir: d,
|
|
1723
1745
|
chain: o,
|
|
1724
|
-
contributesToUrl: o.length === 0 ||
|
|
1746
|
+
contributesToUrl: o.length === 0 || !$r(o[o.length - 1]),
|
|
1725
1747
|
hasLayout: t,
|
|
1726
1748
|
hasLayoutLoader: r,
|
|
1727
1749
|
hasError: u.has("error.tsx"),
|
|
@@ -1735,8 +1757,8 @@ import {
|
|
|
1735
1757
|
let n = d ? `${d}/${e}` : e;
|
|
1736
1758
|
r.push({
|
|
1737
1759
|
file: n,
|
|
1738
|
-
pattern:
|
|
1739
|
-
ident:
|
|
1760
|
+
pattern: ti(n),
|
|
1761
|
+
ident: ni(n),
|
|
1740
1762
|
dirChain: o
|
|
1741
1763
|
});
|
|
1742
1764
|
}
|
|
@@ -1755,14 +1777,14 @@ import {
|
|
|
1755
1777
|
dirs: s,
|
|
1756
1778
|
orphanedSpecials: c
|
|
1757
1779
|
};
|
|
1758
|
-
},
|
|
1780
|
+
}, ri = (e, t) => {
|
|
1759
1781
|
let n = [];
|
|
1760
1782
|
for (let r = 0; r <= t.length; r++) {
|
|
1761
1783
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1762
1784
|
a && n.push(a);
|
|
1763
1785
|
}
|
|
1764
1786
|
return n;
|
|
1765
|
-
},
|
|
1787
|
+
}, ii = async (e) => {
|
|
1766
1788
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1767
1789
|
return {
|
|
1768
1790
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1784,10 +1806,10 @@ import {
|
|
|
1784
1806
|
})),
|
|
1785
1807
|
segmentLoaderData: o
|
|
1786
1808
|
};
|
|
1787
|
-
},
|
|
1788
|
-
let t =
|
|
1809
|
+
}, ai = (e) => {
|
|
1810
|
+
let t = ei(e);
|
|
1789
1811
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1790
|
-
},
|
|
1812
|
+
}, oi = [
|
|
1791
1813
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1792
1814
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1793
1815
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1880,7 +1902,7 @@ import {
|
|
|
1880
1902
|
" _vdtErrorStart('Build error')",
|
|
1881
1903
|
" })",
|
|
1882
1904
|
"}"
|
|
1883
|
-
].join("\n"),
|
|
1905
|
+
].join("\n"), si = (e) => {
|
|
1884
1906
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1885
1907
|
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, "\\$&"));
|
|
1886
1908
|
let a = i.join("/");
|
|
@@ -1889,8 +1911,8 @@ import {
|
|
|
1889
1911
|
paramNames: t,
|
|
1890
1912
|
priority: n
|
|
1891
1913
|
};
|
|
1892
|
-
},
|
|
1893
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1914
|
+
}, ci = (e) => e.map((e) => {
|
|
1915
|
+
let { regex: t, paramNames: n, priority: r } = si(e.pattern);
|
|
1894
1916
|
return {
|
|
1895
1917
|
pattern: e.pattern,
|
|
1896
1918
|
file: e.file,
|
|
@@ -1899,7 +1921,7 @@ import {
|
|
|
1899
1921
|
paramNames: n,
|
|
1900
1922
|
priority: r
|
|
1901
1923
|
};
|
|
1902
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1924
|
+
}).slice().sort((e, t) => e.priority - t.priority), li = (e, t) => {
|
|
1903
1925
|
for (let n of t) {
|
|
1904
1926
|
let t = n.regex.exec(e);
|
|
1905
1927
|
if (!t) continue;
|
|
@@ -1911,7 +1933,7 @@ import {
|
|
|
1911
1933
|
};
|
|
1912
1934
|
}
|
|
1913
1935
|
return null;
|
|
1914
|
-
},
|
|
1936
|
+
}, ui = async (e, t) => {
|
|
1915
1937
|
let n = e;
|
|
1916
1938
|
for (;;) {
|
|
1917
1939
|
let e = f(n, "node_modules", t);
|
|
@@ -1925,7 +1947,7 @@ import {
|
|
|
1925
1947
|
if (r === n) return null;
|
|
1926
1948
|
n = r;
|
|
1927
1949
|
}
|
|
1928
|
-
},
|
|
1950
|
+
}, di = async (e) => {
|
|
1929
1951
|
try {
|
|
1930
1952
|
let t = await import(g(f(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;
|
|
1931
1953
|
return a ? {
|
|
@@ -1934,7 +1956,7 @@ import {
|
|
|
1934
1956
|
} : { port: r };
|
|
1935
1957
|
} catch {}
|
|
1936
1958
|
return { port: 4e3 };
|
|
1937
|
-
},
|
|
1959
|
+
}, fi = (e, t) => ({
|
|
1938
1960
|
name: e,
|
|
1939
1961
|
pkg: t.package,
|
|
1940
1962
|
browserWsUrl: t.url,
|
|
@@ -1942,7 +1964,7 @@ import {
|
|
|
1942
1964
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1943
1965
|
...t.headers ? { headers: t.headers } : {},
|
|
1944
1966
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1945
|
-
}),
|
|
1967
|
+
}), pi = (e, t, n) => {
|
|
1946
1968
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1947
1969
|
return {
|
|
1948
1970
|
name: e,
|
|
@@ -1954,7 +1976,7 @@ import {
|
|
|
1954
1976
|
...t.headers ? { headers: t.headers } : {},
|
|
1955
1977
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1956
1978
|
};
|
|
1957
|
-
},
|
|
1979
|
+
}, mi = (e) => {
|
|
1958
1980
|
let t = /* @__PURE__ */ new Map();
|
|
1959
1981
|
for (let n of e) {
|
|
1960
1982
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1962,43 +1984,43 @@ import {
|
|
|
1962
1984
|
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>.`);
|
|
1963
1985
|
t.set(n.browserWsUrl, n.name);
|
|
1964
1986
|
}
|
|
1965
|
-
},
|
|
1987
|
+
}, hi = async (e, t) => {
|
|
1966
1988
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1967
1989
|
for (let [t, i] of n) {
|
|
1968
1990
|
if (i.url) {
|
|
1969
|
-
r.push(
|
|
1991
|
+
r.push(fi(t, i));
|
|
1970
1992
|
continue;
|
|
1971
1993
|
}
|
|
1972
|
-
let n = await
|
|
1994
|
+
let n = await ui(e, i.package);
|
|
1973
1995
|
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.`);
|
|
1974
|
-
r.push(
|
|
1996
|
+
r.push(pi(t, i, await di(n)));
|
|
1975
1997
|
}
|
|
1976
|
-
return
|
|
1977
|
-
},
|
|
1998
|
+
return mi(r), r;
|
|
1999
|
+
}, gi = (e) => {
|
|
1978
2000
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1979
2001
|
let t = new URL(e);
|
|
1980
2002
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1981
2003
|
} catch {
|
|
1982
2004
|
return;
|
|
1983
2005
|
}
|
|
1984
|
-
},
|
|
2006
|
+
}, _i = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, vi = (e) => process.env[_i(e)] ?? process.env.VOLTRO_API_ORIGIN, yi = (e, t) => {
|
|
1985
2007
|
if (!e) return;
|
|
1986
|
-
let n =
|
|
2008
|
+
let n = vi(e.name) ?? e.serverOrigin;
|
|
1987
2009
|
if (n) {
|
|
1988
|
-
let e =
|
|
2010
|
+
let e = gi(n);
|
|
1989
2011
|
if (e) return e;
|
|
1990
2012
|
}
|
|
1991
2013
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1992
|
-
let t =
|
|
2014
|
+
let t = gi(e.proxyTarget);
|
|
1993
2015
|
if (t) return t;
|
|
1994
2016
|
}
|
|
1995
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1996
|
-
},
|
|
2017
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return gi(e.browserWsUrl);
|
|
2018
|
+
}, bi = (e, t, n) => {
|
|
1997
2019
|
if (!e) {
|
|
1998
2020
|
if (n?.apiName === void 0) return;
|
|
1999
2021
|
let e = n.apiName;
|
|
2000
2022
|
return async () => {
|
|
2001
|
-
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 ${
|
|
2023
|
+
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 ${_i(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.`);
|
|
2002
2024
|
};
|
|
2003
2025
|
}
|
|
2004
2026
|
return async (r, i) => {
|
|
@@ -2020,7 +2042,7 @@ import {
|
|
|
2020
2042
|
});
|
|
2021
2043
|
} catch (t) {
|
|
2022
2044
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2023
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2045
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${_i(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 });
|
|
2024
2046
|
}
|
|
2025
2047
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2026
2048
|
let s = await o.json();
|
|
@@ -2039,7 +2061,7 @@ import {
|
|
|
2039
2061
|
if (u) return l;
|
|
2040
2062
|
};
|
|
2041
2063
|
}, $ = async (e, t, n, r = {}) => {
|
|
2042
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await
|
|
2064
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await Ur() !== null, s = t.theme === "system" ? [
|
|
2043
2065
|
" <script>",
|
|
2044
2066
|
" (function () {",
|
|
2045
2067
|
" var root = document.documentElement",
|
|
@@ -2093,13 +2115,13 @@ import {
|
|
|
2093
2115
|
e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${Z(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && n.push(`import ${Z(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && n.push(`import ${Z(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && n.push(`import ${Z(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && n.push(`import ${Z(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2094
2116
|
}
|
|
2095
2117
|
let r = u.map((e) => {
|
|
2096
|
-
let t =
|
|
2118
|
+
let t = ri(d, e.dirChain).map((e) => {
|
|
2097
2119
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2098
2120
|
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(", ")} }`;
|
|
2099
2121
|
}).join(",\n");
|
|
2100
2122
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2101
2123
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2102
|
-
let t =
|
|
2124
|
+
let t = ai(e.chain), n = ri(d, e.chain).map((e) => {
|
|
2103
2125
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2104
2126
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2105
2127
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2338,14 +2360,14 @@ import {
|
|
|
2338
2360
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2339
2361
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2340
2362
|
"",
|
|
2341
|
-
...
|
|
2363
|
+
...Jr(t),
|
|
2342
2364
|
"import { mount } from '@voltro/web'",
|
|
2343
2365
|
...g,
|
|
2344
2366
|
"import { App } from './app'",
|
|
2345
2367
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2346
|
-
...Gr(t),
|
|
2347
|
-
...Ur(t, o),
|
|
2348
2368
|
...Kr(t),
|
|
2369
|
+
...Wr(t, o),
|
|
2370
|
+
...qr(t),
|
|
2349
2371
|
"",
|
|
2350
2372
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2351
2373
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2362,10 +2384,10 @@ import {
|
|
|
2362
2384
|
" apis: {",
|
|
2363
2385
|
..._,
|
|
2364
2386
|
" },",
|
|
2365
|
-
...
|
|
2387
|
+
...Gr(t, o),
|
|
2366
2388
|
"})",
|
|
2367
2389
|
"",
|
|
2368
|
-
|
|
2390
|
+
oi
|
|
2369
2391
|
].join("\n");
|
|
2370
2392
|
} else v = "", y = "", b = [
|
|
2371
2393
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2373,22 +2395,22 @@ import {
|
|
|
2373
2395
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2374
2396
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2375
2397
|
"",
|
|
2376
|
-
...
|
|
2398
|
+
...Jr(t),
|
|
2377
2399
|
"import { mount } from '@voltro/web'",
|
|
2378
2400
|
...g,
|
|
2379
2401
|
"import App from '../src/App'",
|
|
2380
|
-
...Gr(t),
|
|
2381
|
-
...Ur(t, o),
|
|
2382
2402
|
...Kr(t),
|
|
2403
|
+
...Wr(t, o),
|
|
2404
|
+
...qr(t),
|
|
2383
2405
|
"",
|
|
2384
2406
|
"mount(App, {",
|
|
2385
2407
|
" apis: {",
|
|
2386
2408
|
..._,
|
|
2387
2409
|
" },",
|
|
2388
|
-
...
|
|
2410
|
+
...Gr(t, o),
|
|
2389
2411
|
"})",
|
|
2390
2412
|
"",
|
|
2391
|
-
|
|
2413
|
+
oi
|
|
2392
2414
|
].join("\n");
|
|
2393
2415
|
let x = f(e, ".framework");
|
|
2394
2416
|
await A.mkdir(x, { recursive: !0 }), t.env ? await ht(x, r) : await A.rm(f(x, "env.public.ts"), { force: !0 }), await A.writeFile(f(x, "index.html"), c, "utf8"), await A.writeFile(f(x, "main.tsx"), b, "utf8"), v ? (await A.writeFile(f(x, "app.tsx"), v, "utf8"), await A.writeFile(f(x, "routeTable.ts"), y, "utf8")) : (await A.rm(f(x, "app.tsx"), { force: !0 }), await A.rm(f(x, "routeTable.ts"), { force: !0 }));
|
|
@@ -2405,7 +2427,7 @@ import {
|
|
|
2405
2427
|
X.warn(`could not add ${E.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2406
2428
|
}
|
|
2407
2429
|
}
|
|
2408
|
-
},
|
|
2430
|
+
}, xi = async (e, t) => {
|
|
2409
2431
|
try {
|
|
2410
2432
|
let n = f(u(e), "project.json");
|
|
2411
2433
|
if (!O(n)) return;
|
|
@@ -2418,16 +2440,16 @@ import {
|
|
|
2418
2440
|
projectJson: n
|
|
2419
2441
|
});
|
|
2420
2442
|
} catch {}
|
|
2421
|
-
},
|
|
2422
|
-
let t =
|
|
2443
|
+
}, Si = (e) => f(e, ".framework", "dist", "server", "appConfig.js"), Ci = async (e) => {
|
|
2444
|
+
let t = Si(e), n = O(t) ? t : f(e, "app.config.ts");
|
|
2423
2445
|
try {
|
|
2424
2446
|
let e = (await import(g(n).href)).default;
|
|
2425
2447
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2426
2448
|
} catch {
|
|
2427
2449
|
return null;
|
|
2428
2450
|
}
|
|
2429
|
-
},
|
|
2430
|
-
let t = await
|
|
2451
|
+
}, wi = async (e) => {
|
|
2452
|
+
let t = await Ci(e);
|
|
2431
2453
|
if (!t) return {
|
|
2432
2454
|
ran: !1,
|
|
2433
2455
|
exitCode: 0
|
|
@@ -2435,7 +2457,7 @@ import {
|
|
|
2435
2457
|
An();
|
|
2436
2458
|
let n = Qt();
|
|
2437
2459
|
ln(n), X.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2438
|
-
let u = await
|
|
2460
|
+
let u = await hi(e, t);
|
|
2439
2461
|
for (let e of u) X.info("api wired", {
|
|
2440
2462
|
name: e.name,
|
|
2441
2463
|
pkg: e.pkg,
|
|
@@ -2468,10 +2490,10 @@ import {
|
|
|
2468
2490
|
pid: process.pid,
|
|
2469
2491
|
status: "booting",
|
|
2470
2492
|
logFile: y.path
|
|
2471
|
-
}).catch(() => {}), await
|
|
2493
|
+
}).catch(() => {}), await xi(e, g);
|
|
2472
2494
|
let { pages: b, dirs: x } = await Q(f(e, "src", "pages")), S = {
|
|
2473
2495
|
dirs: x,
|
|
2474
|
-
ssrRoutes:
|
|
2496
|
+
ssrRoutes: ci(b)
|
|
2475
2497
|
}, C = x.map((e) => ({
|
|
2476
2498
|
dir: e.dir,
|
|
2477
2499
|
hasLayout: e.hasLayout,
|
|
@@ -2507,7 +2529,7 @@ import {
|
|
|
2507
2529
|
...r.devDependencies
|
|
2508
2530
|
});
|
|
2509
2531
|
await Promise.all(i.map(async (n) => {
|
|
2510
|
-
let r = await
|
|
2532
|
+
let r = await ui(e, n);
|
|
2511
2533
|
if (!r) return;
|
|
2512
2534
|
let i = f(r, "src");
|
|
2513
2535
|
try {
|
|
@@ -2524,7 +2546,7 @@ import {
|
|
|
2524
2546
|
await Xt({
|
|
2525
2547
|
appRoot: e,
|
|
2526
2548
|
pages: i
|
|
2527
|
-
}), S.dirs = a, S.ssrRoutes =
|
|
2549
|
+
}), S.dirs = a, S.ssrRoutes = ci(i), X.info("page tree regenerated", {
|
|
2528
2550
|
reason: n,
|
|
2529
2551
|
ms: Date.now() - r,
|
|
2530
2552
|
routes: S.ssrRoutes.length
|
|
@@ -2614,7 +2636,7 @@ import {
|
|
|
2614
2636
|
}
|
|
2615
2637
|
try {
|
|
2616
2638
|
let n = Date.now();
|
|
2617
|
-
await $(e, r, await
|
|
2639
|
+
await $(e, r, await hi(e, r)), ae = r, t.ws && t.ws.send({
|
|
2618
2640
|
type: "full-reload",
|
|
2619
2641
|
path: "*"
|
|
2620
2642
|
}), X.info("app.config.ts soft-regen", {
|
|
@@ -2654,7 +2676,7 @@ import {
|
|
|
2654
2676
|
let n = /* @__PURE__ */ new Map();
|
|
2655
2677
|
for (let r of u) {
|
|
2656
2678
|
if (!r.proxyTarget) continue;
|
|
2657
|
-
let i = await
|
|
2679
|
+
let i = await ui(e, r.pkg);
|
|
2658
2680
|
if (!i) continue;
|
|
2659
2681
|
let a = f(i, "rpcGroup.generated.ts");
|
|
2660
2682
|
try {
|
|
@@ -2938,7 +2960,7 @@ import {
|
|
|
2938
2960
|
kind: "web",
|
|
2939
2961
|
meta: {
|
|
2940
2962
|
name: t.name ?? "(unnamed)",
|
|
2941
|
-
voltroVersion:
|
|
2963
|
+
voltroVersion: Hr,
|
|
2942
2964
|
port: g,
|
|
2943
2965
|
mode: "dev",
|
|
2944
2966
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -3012,7 +3034,7 @@ import {
|
|
|
3012
3034
|
if (r.method !== "GET" && r.method !== "HEAD") return a();
|
|
3013
3035
|
let o = r.url ?? "/", s = o.indexOf("?"), c = (s === -1 ? o : o.slice(0, s)) || "/";
|
|
3014
3036
|
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 a();
|
|
3015
|
-
let l =
|
|
3037
|
+
let l = li(c, S.ssrRoutes);
|
|
3016
3038
|
if (!l) return a();
|
|
3017
3039
|
let d = !he.has(l.route.pattern), p = Date.now();
|
|
3018
3040
|
d && X.info(`ssr compiling ${l.route.pattern}`, {
|
|
@@ -3034,15 +3056,15 @@ import {
|
|
|
3034
3056
|
}
|
|
3035
3057
|
};
|
|
3036
3058
|
try {
|
|
3037
|
-
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ = Yn(s, f("src", "pages", l.route.file)), v =
|
|
3059
|
+
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ = Yn(s, f("src", "pages", l.route.file)), v = ri(S.dirs, l.route.dirChain), y = _ === "spa" && v.some((e) => e.hasLayout);
|
|
3038
3060
|
if (_ !== "ssr" && _ !== "isr" && !y) return a();
|
|
3039
3061
|
let b = {};
|
|
3040
3062
|
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ? b[e] = t : Array.isArray(t) && (b[e] = t.join(", "));
|
|
3041
|
-
let x = yi(
|
|
3063
|
+
let x = bi(yi(u[0], { allowDevProxy: !0 }), b.cookie, { apiName: u[0]?.name }), C = new AbortController(), w = () => C.abort();
|
|
3042
3064
|
i.once("close", w);
|
|
3043
3065
|
let T = null, E = [], D = {};
|
|
3044
3066
|
try {
|
|
3045
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () =>
|
|
3067
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () => ii({
|
|
3046
3068
|
entries: v,
|
|
3047
3069
|
loadLayout: (t) => n(f(e, "src", "pages", t.dir, "layout.tsx")),
|
|
3048
3070
|
loadError: (t) => n(f(e, "src", "pages", t.dir, "error.tsx")),
|
|
@@ -3079,7 +3101,7 @@ import {
|
|
|
3079
3101
|
cookies: O.parseCookieHeader(b.cookie),
|
|
3080
3102
|
headers: b,
|
|
3081
3103
|
url: o
|
|
3082
|
-
}, A = s.interactive ?? "full", j = y ?
|
|
3104
|
+
}, A = s.interactive ?? "full", j = y ? kr({
|
|
3083
3105
|
helpers: O,
|
|
3084
3106
|
page: `src/pages/${l.route.file}`,
|
|
3085
3107
|
interactive: A,
|
|
@@ -3091,7 +3113,7 @@ import {
|
|
|
3091
3113
|
segmentLoaderData: D,
|
|
3092
3114
|
requestContext: k
|
|
3093
3115
|
}
|
|
3094
|
-
}) : null, M = y ? null :
|
|
3116
|
+
}) : null, M = y ? null : Or({
|
|
3095
3117
|
helpers: O,
|
|
3096
3118
|
page: `src/pages/${l.route.file}`,
|
|
3097
3119
|
pathname: c,
|
|
@@ -3115,16 +3137,16 @@ import {
|
|
|
3115
3137
|
});
|
|
3116
3138
|
let P = await h("readShell", xe), F = await h("transformShell", () => t.transformIndexHtml(o, P)), te = N.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), I = k.cookies["voltro:locale"] ?? "en", ne = Date.now();
|
|
3117
3139
|
if (j) {
|
|
3118
|
-
let e = (e) =>
|
|
3140
|
+
let e = (e) => jr({
|
|
3119
3141
|
helpers: O,
|
|
3120
3142
|
prepared: j,
|
|
3121
3143
|
meta: e,
|
|
3122
3144
|
interactive: A,
|
|
3123
3145
|
extra: [te]
|
|
3124
3146
|
});
|
|
3125
|
-
if (j.hasDeferred)
|
|
3147
|
+
if (j.hasDeferred) Br({
|
|
3126
3148
|
res: i,
|
|
3127
|
-
shell:
|
|
3149
|
+
shell: Rr({
|
|
3128
3150
|
shell: F,
|
|
3129
3151
|
inlineModuleScriptsAsync: !0
|
|
3130
3152
|
}),
|
|
@@ -3143,7 +3165,7 @@ import {
|
|
|
3143
3165
|
}
|
|
3144
3166
|
});
|
|
3145
3167
|
else {
|
|
3146
|
-
let t =
|
|
3168
|
+
let t = Ar({
|
|
3147
3169
|
helpers: O,
|
|
3148
3170
|
prepared: j
|
|
3149
3171
|
}), 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}"`);
|
|
@@ -3164,9 +3186,9 @@ import {
|
|
|
3164
3186
|
segmentLoaderData: M.segmentLoaderData,
|
|
3165
3187
|
requestContext: k
|
|
3166
3188
|
};
|
|
3167
|
-
if (_ === "ssr" && A === "full")
|
|
3189
|
+
if (_ === "ssr" && A === "full") Br({
|
|
3168
3190
|
res: i,
|
|
3169
|
-
shell:
|
|
3191
|
+
shell: Rr({
|
|
3170
3192
|
shell: F,
|
|
3171
3193
|
inlineModuleScriptsAsync: !0
|
|
3172
3194
|
}),
|
|
@@ -3212,15 +3234,22 @@ import {
|
|
|
3212
3234
|
}, e), i.statusCode = 500, i.setHeader("content-type", "text/plain; charset=utf-8"), i.end(e.message);
|
|
3213
3235
|
return;
|
|
3214
3236
|
}
|
|
3237
|
+
let t = Dr(e);
|
|
3238
|
+
if (t) {
|
|
3239
|
+
i.statusCode = t.status;
|
|
3240
|
+
for (let [e, n] of Object.entries(t.headers)) i.setHeader(e, String(n));
|
|
3241
|
+
i.end(t.body);
|
|
3242
|
+
return;
|
|
3243
|
+
}
|
|
3215
3244
|
ge(i, "ssr-dev", c, l.route.pattern, e);
|
|
3216
3245
|
}
|
|
3217
3246
|
});
|
|
3218
3247
|
}
|
|
3219
|
-
}, B = Date.now(), Ce = T.version ?? "?", V = await
|
|
3248
|
+
}, B = Date.now(), Ce = T.version ?? "?", V = await Ur(), we = f(e, "node_modules", "@voltro", "ui-shadcn"), H = O(f(we, "package.json")) ? we : null, Te = [], Ee = await (async () => {
|
|
3220
3249
|
let t = [];
|
|
3221
3250
|
for (let n of u) {
|
|
3222
3251
|
if (!n.proxyTarget) continue;
|
|
3223
|
-
let r = await
|
|
3252
|
+
let r = await ui(e, n.pkg);
|
|
3224
3253
|
if (r) try {
|
|
3225
3254
|
t.push(await A.readFile(f(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3226
3255
|
} catch {}
|
|
@@ -3295,12 +3324,12 @@ import {
|
|
|
3295
3324
|
host: !0,
|
|
3296
3325
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3297
3326
|
proxy: R,
|
|
3298
|
-
fs: { allow: [e, ...
|
|
3327
|
+
fs: { allow: [e, ...Yr(e)] }
|
|
3299
3328
|
},
|
|
3300
3329
|
appType: "spa",
|
|
3301
3330
|
cacheDir: f(k, ".vite"),
|
|
3302
3331
|
publicDir: f(e, "public")
|
|
3303
|
-
})).listen(),
|
|
3332
|
+
})).listen(), Vr.info(`v${Ce} ready in ${Date.now() - B}ms`, {
|
|
3304
3333
|
version: Ce,
|
|
3305
3334
|
bootMs: Date.now() - B
|
|
3306
3335
|
}), X.info(`listening on http://localhost:${g}`, {
|
|
@@ -3350,16 +3379,16 @@ import {
|
|
|
3350
3379
|
url: `http://localhost:${g}`,
|
|
3351
3380
|
bootMs: Date.now() - B
|
|
3352
3381
|
}), new Promise(() => {});
|
|
3353
|
-
},
|
|
3382
|
+
}, Ti = async (e) => {
|
|
3354
3383
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3355
|
-
let t = await
|
|
3384
|
+
let t = await Ci(e);
|
|
3356
3385
|
if (!t) return {
|
|
3357
3386
|
ran: !1,
|
|
3358
3387
|
exitCode: 0
|
|
3359
3388
|
};
|
|
3360
3389
|
let n = Date.now(), r = X.child("serve");
|
|
3361
3390
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3362
|
-
let i = await
|
|
3391
|
+
let i = await hi(e, t);
|
|
3363
3392
|
for (let e of i) r.info("api wired", {
|
|
3364
3393
|
name: e.name,
|
|
3365
3394
|
pkg: e.pkg
|
|
@@ -3381,7 +3410,7 @@ import {
|
|
|
3381
3410
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3382
3411
|
build: {
|
|
3383
3412
|
outDir: "dist",
|
|
3384
|
-
rollupOptions: { output: { manualChunks:
|
|
3413
|
+
rollupOptions: { output: { manualChunks: Zr } }
|
|
3385
3414
|
},
|
|
3386
3415
|
publicDir: f(e, "public")
|
|
3387
3416
|
});
|
|
@@ -3401,14 +3430,14 @@ import {
|
|
|
3401
3430
|
extras: d,
|
|
3402
3431
|
bootMs: Date.now() - n
|
|
3403
3432
|
}), new Promise(() => {});
|
|
3404
|
-
},
|
|
3433
|
+
}, Ei = 5e3, Di = 6e4, Oi = (e, t) => {
|
|
3405
3434
|
if (e.length === 0) return 0;
|
|
3406
3435
|
if (e.length === 1) return e[0];
|
|
3407
3436
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3408
3437
|
if (r === i) return e[r];
|
|
3409
3438
|
let a = n - r;
|
|
3410
3439
|
return e[r] * (1 - a) + e[i] * a;
|
|
3411
|
-
},
|
|
3440
|
+
}, ki = (e) => {
|
|
3412
3441
|
if (e.length === 0) return {
|
|
3413
3442
|
p50: 0,
|
|
3414
3443
|
p95: 0,
|
|
@@ -3420,15 +3449,15 @@ import {
|
|
|
3420
3449
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3421
3450
|
for (let e of t) n += e;
|
|
3422
3451
|
return {
|
|
3423
|
-
p50:
|
|
3424
|
-
p95:
|
|
3425
|
-
p99:
|
|
3452
|
+
p50: Oi(t, .5),
|
|
3453
|
+
p95: Oi(t, .95),
|
|
3454
|
+
p99: Oi(t, .99),
|
|
3426
3455
|
mean: n / t.length,
|
|
3427
3456
|
min: t[0],
|
|
3428
3457
|
max: t[t.length - 1]
|
|
3429
3458
|
};
|
|
3430
|
-
},
|
|
3431
|
-
let t = e.maxSamples ??
|
|
3459
|
+
}, Ai = (e = {}) => {
|
|
3460
|
+
let t = e.maxSamples ?? Ei, n = e.defaultWindowMs ?? Di, r = [];
|
|
3432
3461
|
return {
|
|
3433
3462
|
record(e) {
|
|
3434
3463
|
L(e), r.push({
|
|
@@ -3457,7 +3486,7 @@ import {
|
|
|
3457
3486
|
tag: e.tag,
|
|
3458
3487
|
count: e.samples.length,
|
|
3459
3488
|
errorCount: n,
|
|
3460
|
-
latencyMs:
|
|
3489
|
+
latencyMs: ki(t)
|
|
3461
3490
|
});
|
|
3462
3491
|
}
|
|
3463
3492
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3470,4 +3499,4 @@ import {
|
|
|
3470
3499
|
};
|
|
3471
3500
|
};
|
|
3472
3501
|
//#endregion
|
|
3473
|
-
export { St as $, Wn as A, gn as B, wr as C, dr as D, ur as E, Nn as F, en as G, sn as H, Pn as I, Rt as J, Xt as K, Dn as L, Gn as M, qn as N, Qn as O, Yn as P, xt as Q, Sn as R, mr as S, lr as T, $t as U, ln as V, Qt as W, Dt as X, kt as Y, Et as Z,
|
|
3502
|
+
export { St as $, Wn as A, gn as B, wr as C, dr as D, ur as E, Nn as F, en as G, sn as H, Pn as I, Rt as J, Xt as K, Dn as L, Gn as M, qn as N, Qn as O, Yn as P, xt as Q, Sn as R, mr as S, lr as T, $t as U, ln as V, Qt as W, Dt as X, kt as Y, Et as Z, Or as _, we as _t, ii as a, gt as at, jr as b, hi as c, lt as ct, Zr as d, nt as dt, Ct as et, Q as f, it as ft, Er as g, V as gt, Br as h, Ke as ht, bi as i, yt as it, Xn as j, er as k, wi as l, st as lt, Rr as m, Ge as mt, Qr as n, G as nt, ri as o, mt as ot, $ as p, rt as pt, Bt as q, yi as r, vt as rt, Ci as s, pt as st, Ai as t, bt as tt, Ti as u, at as ut, kr as v, hr as w, gr as x, Ar as y, vn as z };
|