@voltro/cli 0.29.0 → 0.30.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 +448 -0
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/dist/apiBuild-Ca6Sq5jy.js +2 -0
- package/dist/{apiBuild-BESZbTjA.js → apiBuild-DmkzRyv7.js} +2 -2
- package/dist/bin.js +3 -3
- package/dist/{checkCommand-BPAtyWs8.js → checkCommand-C4konUy9.js} +435 -304
- package/dist/checkCommand-DHD0aBeR.js +2 -0
- package/dist/{commands-82BDEktg.js → commands-BkJft9K2.js} +2413 -1814
- package/dist/{dbCommand-bCBbk6tz.js → dbCommand-qn__kLEt.js} +344 -265
- package/dist/dbCommand-wfGi3FgG.js +2 -0
- package/dist/{dev-Cg4BKLmi.js → dev-C_NPcLDp.js} +2716 -1782
- package/dist/{dev-DeEJj5T4.js → dev-DXhhZ7-f.js} +1 -1
- package/dist/frameworkTableAssembly-Bn_c4Mnl.js +2 -0
- package/dist/{frameworkTableAssembly-4Db40V23.js → frameworkTableAssembly-Cpgn2e88.js} +155 -141
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/dist/{inspect-BMvQpwqy.js → inspect-BUUjt773.js} +150 -14
- package/dist/inspect-mmBuRXmy.js +2 -0
- package/dist/{inspectMetrics-DHYygE4s.js → inspectMetrics-CkB2J0Zn.js} +566 -512
- package/dist/{manifestBuild-C4R1EdHn.js → manifestBuild-BLrVuSlM.js} +1 -1
- package/dist/manifestBuild-Dj8Jjoto.js +2 -0
- package/dist/{sdkgen-CW5NbYF0.js → sdkgen-wsWLrq4l.js} +1 -1
- package/dist/serveCommand-HtI4X5kj.js +1577 -0
- package/dist/serveEntry.js +2 -2
- package/dist/{start-CsCIaW4-.js → start-egkbpugc.js} +177 -175
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.core.md +50 -0
- package/templates/AGENTS.md +53 -2
- package/templates/agent-docs/_index.md +3 -2
- package/templates/agent-docs/_manifest.json +16 -4
- package/templates/agent-docs/ai.md +56 -0
- package/templates/agent-docs/cli.md +46 -0
- package/templates/agent-docs/internationalization.md +8 -7
- package/templates/agent-docs/local-first-mobile.md +18 -6
- package/templates/agent-docs/routing.md +15 -1
- package/templates/agent-docs/security.md +17 -0
- package/templates/agent-docs/templates/apibackends.md +209 -0
- package/templates/agent-docs/templates/appshells.md +144 -1
- package/templates/agent-docs/templates/mobile.md +60 -0
- package/templates/agent-docs/templates/overview.md +17 -7
- package/templates/agent-docs/whats-new.md +36 -243
- package/templates/agent-docs/workflows.md +367 -0
- 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-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-collab/README.md +70 -0
- package/templates/apps/api-collab/app.config.ts +28 -0
- package/templates/apps/api-collab/database/schema.ts +63 -0
- package/templates/apps/api-collab/mutations/documents.create.mutation.server.ts +19 -0
- package/templates/apps/api-collab/mutations/documents.create.mutation.ts +36 -0
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.server.ts +20 -0
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +30 -0
- package/templates/apps/api-collab/package.json +30 -0
- package/templates/apps/api-collab/queries/documents.query.server.ts +16 -0
- package/templates/apps/api-collab/queries/documents.query.ts +23 -0
- package/templates/apps/api-collab/template.json +6 -0
- package/templates/apps/api-collab/tests/documents.setBody.test.ts +89 -0
- package/templates/apps/api-collab/tsconfig.json +5 -0
- 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-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/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/app.config.ts +1 -1
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-admin/src/locales/index.ts +1 -1
- package/templates/apps/frontend-app/app.config.ts +1 -1
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-app/src/locales/index.ts +1 -1
- package/templates/apps/frontend-app/src/pages/layout.tsx +1 -1
- package/templates/apps/frontend-app/src/pages/page.tsx +1 -1
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-auth/src/locales/index.ts +1 -1
- package/templates/apps/frontend-blank/app.config.ts +1 -1
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-blank/src/locales/index.ts +1 -1
- package/templates/apps/frontend-blank/src/pages/layout.tsx +1 -1
- package/templates/apps/frontend-blank/src/pages/page.tsx +1 -1
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-cms/src/locales/index.ts +1 -1
- package/templates/apps/frontend-collab/README.md +80 -0
- package/templates/apps/frontend-collab/app.config.ts +38 -0
- package/templates/apps/frontend-collab/package.json +33 -0
- package/templates/apps/frontend-collab/src/locales/de.ts +29 -0
- package/templates/apps/frontend-collab/src/locales/en.ts +31 -0
- package/templates/apps/frontend-collab/src/locales/index.ts +15 -0
- package/templates/apps/frontend-collab/src/pages/layout.tsx +39 -0
- package/templates/apps/frontend-collab/src/pages/page.test.tsx +150 -0
- package/templates/apps/frontend-collab/src/pages/page.tsx +186 -0
- package/templates/apps/frontend-collab/template.json +6 -0
- package/templates/apps/frontend-collab/tsconfig.json +11 -0
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/app.config.ts +1 -1
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-dashboard/src/locales/index.ts +1 -1
- 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-portal/package.json +8 -8
- package/templates/apps/frontend-portal/src/locales/index.ts +1 -1
- package/templates/apps/frontend-saas/README.md +1 -1
- package/templates/apps/frontend-saas/app.config.ts +1 -1
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-saas/src/locales/index.ts +1 -1
- package/templates/apps/frontend-spa/app.config.ts +1 -1
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-spa/src/locales/index.ts +1 -1
- package/templates/apps/frontend-spa/src/pages/layout.tsx +1 -1
- package/templates/apps/frontend-spa/src/pages/page.tsx +1 -1
- package/templates/apps/frontend-ssr/app.config.ts +1 -1
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr/src/locales/index.ts +1 -1
- package/templates/apps/frontend-ssr/src/pages/layout.tsx +1 -1
- package/templates/apps/frontend-ssr/src/pages/page.tsx +1 -1
- package/templates/apps/frontend-ssr-api/app.config.ts +1 -1
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-ssr-api/src/locales/index.ts +1 -1
- package/templates/apps/frontend-ssr-api/src/pages/layout.tsx +1 -1
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/frontend-status/src/locales/index.ts +1 -1
- package/templates/apps/mobile-app/README.md +58 -0
- package/templates/apps/mobile-app/app.config.ts +33 -0
- package/templates/apps/mobile-app/babel.config.js +5 -0
- package/templates/apps/mobile-app/metro.config.js +20 -0
- package/templates/apps/mobile-app/package.json +33 -0
- package/templates/apps/mobile-app/src/app/_layout.tsx +61 -0
- package/templates/apps/mobile-app/src/app/index.tsx +62 -0
- package/templates/apps/mobile-app/src/app/orders/[id].tsx +19 -0
- package/templates/apps/mobile-app/src/app/settings.tsx +51 -0
- package/templates/apps/mobile-app/src/client.ts +74 -0
- package/templates/apps/mobile-app/src/lib/deeplinks.ts +39 -0
- package/templates/apps/mobile-app/src/lib/notifications.ts +31 -0
- package/templates/apps/mobile-app/src/lib/sync.ts +29 -0
- package/templates/apps/mobile-app/src/persistence.ts +38 -0
- package/templates/apps/mobile-app/template.json +6 -0
- package/templates/apps/mobile-app/tests/deeplinks.test.ts +32 -0
- package/templates/apps/mobile-app/tests/notifications.test.ts +26 -0
- package/templates/apps/mobile-app/tests/sync.test.ts +34 -0
- package/templates/apps/mobile-app/tsconfig.json +10 -0
- package/templates/apps/mobile-app/voltro.mobile.ts +11 -0
- package/templates/patches/@effect__cluster@0.60.0.patch +6 -6
- package/dist/apiBuild-C8d74T6g.js +0 -2
- package/dist/checkCommand-DBvZvCh1.js +0 -2
- package/dist/dbCommand-CaIVTp-a.js +0 -2
- package/dist/frameworkTableAssembly-BTNirAAk.js +0 -2
- package/dist/inspect-DHeaMZak.js +0 -2
- package/dist/manifestBuild-Ck_90gZy.js +0 -2
- package/dist/serveCommand-BXl8mhZD.js +0 -1489
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { t as e } from "./cliRuntime-Oh517vCV.js";
|
|
2
2
|
import { T as t, h as n, m as r } from "./fileConventions-Cof68_BL.js";
|
|
3
|
-
import {
|
|
3
|
+
import { A as i, E as a, O as o, a as s, k as c, m as l } from "./inspect-BUUjt773.js";
|
|
4
4
|
import { basename as u, dirname as d, isAbsolute as f, join as p, relative as m, resolve as h } from "node:path";
|
|
5
5
|
import { fileURLToPath as g, pathToFileURL as _ } from "node:url";
|
|
6
6
|
import { FileSystem as v } from "@effect/platform";
|
|
7
7
|
import { NodeContext as y } from "@effect/platform-node";
|
|
8
8
|
import { Effect as b } from "effect";
|
|
9
9
|
import { addSink as x, createLogger as S, printReadyBlock as C } from "@voltro/logger";
|
|
10
|
-
import { closeSync as w, existsSync as T, mkdirSync as E, openSync as D, promises as O, readFileSync as ee, readdirSync as
|
|
11
|
-
import { currentTraceContext as
|
|
12
|
-
import { homedir as
|
|
13
|
-
import { createRequire as
|
|
14
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
15
|
-
import { __installPublicEnv as
|
|
16
|
-
import { mkdir as
|
|
17
|
-
import { createHash as
|
|
18
|
-
import { spawn as
|
|
19
|
-
import { createConnection as
|
|
20
|
-
import { PassThrough as
|
|
10
|
+
import { closeSync as w, existsSync as T, mkdirSync as E, openSync as D, promises as O, readFileSync as ee, readdirSync as te, statSync as k, unlinkSync as A, unwatchFile as ne, watchFile as re, writeSync as j } from "node:fs";
|
|
11
|
+
import { currentTraceContext as M, recordSample as ie, resolveSecret as N } from "@voltro/runtime";
|
|
12
|
+
import { homedir as P } from "node:os";
|
|
13
|
+
import { createRequire as F } from "node:module";
|
|
14
|
+
import { FRAMEWORK_ENV_CATALOG as ae, appEnvEntries as I, checkEnvNaming as L, formatEnvErrors as R, installEnvSnapshot as oe, isEnvContract as z, pluginEnvEntries as se, renderDotEnvExample as B, resolveEnv as ce } from "@voltro/env";
|
|
15
|
+
import { __installPublicEnv as le } from "@voltro/env/public";
|
|
16
|
+
import { mkdir as V, readFile as ue, writeFile as de } from "node:fs/promises";
|
|
17
|
+
import { createHash as fe } from "node:crypto";
|
|
18
|
+
import { spawn as pe } from "node:child_process";
|
|
19
|
+
import { createConnection as me } from "node:net";
|
|
20
|
+
import { PassThrough as he } from "node:stream";
|
|
21
21
|
//#region src/agentsMd.ts
|
|
22
|
-
var
|
|
22
|
+
var H = d(g(import.meta.url)), U = [h(H, "..", "templates"), h(H, "..", "..", "templates")], ge = (e) => ({
|
|
23
23
|
_tag: "TemplateNotFoundError",
|
|
24
24
|
searched: e
|
|
25
|
-
}),
|
|
25
|
+
}), W = ["AGENTS.md", "CLAUDE.md"], _e = "voltro:agents-md:keep", ve = 2048, G = "<!-- VOLTRO:INDEX -->", K = (e, t) => e.exists(t).pipe(b.orElseSucceed(() => !1)), q = (e, t) => e.readFileString(t).pipe(b.orElseSucceed(() => "")), ye = (e, t) => e.readFileString(t).pipe(b.map((e) => {
|
|
26
26
|
try {
|
|
27
27
|
return JSON.parse(e).workspaces !== void 0;
|
|
28
28
|
} catch {
|
|
29
29
|
return !1;
|
|
30
30
|
}
|
|
31
|
-
}), b.orElseSucceed(() => !1)),
|
|
31
|
+
}), b.orElseSucceed(() => !1)), J = (e) => b.gen(function* () {
|
|
32
32
|
let t = yield* v.FileSystem, n = h(e);
|
|
33
33
|
for (;;) {
|
|
34
|
-
if ((yield* K(t, p(n, ".git"))) || (yield* K(t, p(n, "pnpm-workspace.yaml"))) || (yield*
|
|
34
|
+
if ((yield* K(t, p(n, ".git"))) || (yield* K(t, p(n, "pnpm-workspace.yaml"))) || (yield* ye(t, p(n, "package.json")))) return n;
|
|
35
35
|
let r = d(n);
|
|
36
36
|
if (r === n) return h(e);
|
|
37
37
|
n = r;
|
|
@@ -174,7 +174,7 @@ boundary, naming, anti-patterns) before editing.
|
|
|
174
174
|
`, Ae = (e, t, n, r) => b.gen(function* () {
|
|
175
175
|
let i = yield* K(e, t);
|
|
176
176
|
if (i) {
|
|
177
|
-
if ((yield* q(e, t)).slice(0,
|
|
177
|
+
if ((yield* q(e, t)).slice(0, ve).includes("voltro:agents-md:keep")) return {
|
|
178
178
|
path: t,
|
|
179
179
|
action: "protected"
|
|
180
180
|
};
|
|
@@ -188,24 +188,24 @@ boundary, naming, anti-patterns) before editing.
|
|
|
188
188
|
action: i ? "overwritten" : "created"
|
|
189
189
|
};
|
|
190
190
|
}), je = (e, t = {}) => b.gen(function* () {
|
|
191
|
-
let n = yield* v.FileSystem, r = yield*
|
|
192
|
-
for (let e of
|
|
191
|
+
let n = yield* v.FileSystem, r = yield* J(e), i = null;
|
|
192
|
+
for (let e of U) if (yield* K(n, p(e, "AGENTS.core.md"))) {
|
|
193
193
|
i = e;
|
|
194
194
|
break;
|
|
195
195
|
}
|
|
196
196
|
if (i === null) {
|
|
197
|
-
for (let e of
|
|
197
|
+
for (let e of U) if (yield* K(n, p(e, "AGENTS.md"))) {
|
|
198
198
|
let i = yield* q(n, p(e, "AGENTS.md")), a = [];
|
|
199
|
-
for (let e of
|
|
199
|
+
for (let e of W) a.push(yield* Ae(n, p(r, e), i, t.force ?? !1));
|
|
200
200
|
return { files: a };
|
|
201
201
|
}
|
|
202
|
-
return yield* b.fail(
|
|
202
|
+
return yield* b.fail(ge(U.map((e) => p(e, "AGENTS.core.md"))));
|
|
203
203
|
}
|
|
204
204
|
let a = yield* q(n, p(i, "AGENTS.core.md")), o = yield* q(n, p(i, "agent-docs", "_manifest.json")), s = o ? JSON.parse(o) : {
|
|
205
205
|
modules: [],
|
|
206
206
|
plugins: []
|
|
207
|
-
}, c = (t.preferPointer ?? !1) || (yield* K(n, p(r, "node_modules/@voltro/cli/templates/agent-docs", "_manifest.json"))), l = c ? "node_modules/@voltro/cli/templates/" : "", u = t.force ?? !1, d =
|
|
208
|
-
if ((yield* b.forEach(d, (e) => q(n, e).pipe(b.map((e) => e.slice(0,
|
|
207
|
+
}, c = (t.preferPointer ?? !1) || (yield* K(n, p(r, "node_modules/@voltro/cli/templates/agent-docs", "_manifest.json"))), l = c ? "node_modules/@voltro/cli/templates/" : "", u = t.force ?? !1, d = W.map((e) => p(r, e));
|
|
208
|
+
if ((yield* b.forEach(d, (e) => q(n, e).pipe(b.map((e) => e.slice(0, ve))))).every((e) => e.includes("voltro:agents-md:keep"))) return { files: d.map((e) => ({
|
|
209
209
|
path: e,
|
|
210
210
|
action: "protected"
|
|
211
211
|
})) };
|
|
@@ -217,13 +217,13 @@ boundary, naming, anti-patterns) before editing.
|
|
|
217
217
|
for (let e of t) _.add(e);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
let x = t.plugins ? t.plugins.map(xe).filter((e) => e !== null) : y ? [..._] : null, S = a.includes(
|
|
220
|
+
let x = t.plugins ? t.plugins.map(xe).filter((e) => e !== null) : y ? [..._] : null, S = a.includes(G) ? a.replace(G, Te(s, x, l)) : a, C = [];
|
|
221
221
|
for (let e of d) C.push(yield* Ae(n, e, S, u));
|
|
222
222
|
c || (yield* be(n, p(i, "agent-docs"), p(r, "agent-docs")));
|
|
223
223
|
let w = new Map((t.appTemplates ?? []).map((e) => [h(e.dir), e.template])), T = (e) => {
|
|
224
224
|
let t = w.get(h(e));
|
|
225
225
|
return t ? Ee(t, s, l) : "";
|
|
226
|
-
}, E = (e, t) => b.forEach(
|
|
226
|
+
}, E = (e, t) => b.forEach(W, (r) => Ae(n, p(e, r), t, u));
|
|
227
227
|
for (let e of f) C.push(...yield* E(e, De.api(l, g.get(e) ?? null, T(e)))), (yield* K(n, p(e, "database"))) && C.push(...yield* E(p(e, "database"), De.database(l)));
|
|
228
228
|
for (let e of m) C.push(...yield* E(e, De.web(l, T(e))));
|
|
229
229
|
for (let e of Oe) C.push(yield* Ae(n, p(r, ".claude", "skills", e.name, "SKILL.md"), ke(e, l), u));
|
|
@@ -240,7 +240,7 @@ boundary, naming, anti-patterns) before editing.
|
|
|
240
240
|
}).pipe(b.catchTag("TemplateNotFoundError", (e) => b.gen(function* () {
|
|
241
241
|
return yield* b.logError("AGENTS.md template not found", { searched: e.searched }), 1;
|
|
242
242
|
}))), { scope: "voltro:agents-md" });
|
|
243
|
-
}, Pe = p(
|
|
243
|
+
}, Pe = p(P(), ".voltro"), Fe = p(Pe, "runtime-registry.json"), Ie = 3e4, Le = () => {
|
|
244
244
|
let e = Math.random().toString(36).slice(2, 10);
|
|
245
245
|
return `${Fe}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
246
246
|
}, Re = async () => {
|
|
@@ -357,7 +357,7 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
`;
|
|
360
|
-
await
|
|
360
|
+
await de(p(e, "env.generated.d.ts"), r, "utf8");
|
|
361
361
|
}, tt = async (e, t) => {
|
|
362
362
|
let n = $e(t, (e) => e === "public"), r = `${Ze}
|
|
363
363
|
import '@voltro/env/public'
|
|
@@ -368,7 +368,7 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
`, i = p(e, "src");
|
|
371
|
-
await
|
|
371
|
+
await V(i, { recursive: !0 }), await de(p(i, "voltro-env.d.ts"), r, "utf8");
|
|
372
372
|
}, nt = async (e, t) => {
|
|
373
373
|
let n = `${Ze}
|
|
374
374
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
@@ -378,14 +378,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
378
378
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
379
379
|
__installPublicEnv(publicEnvValues)
|
|
380
380
|
`;
|
|
381
|
-
await
|
|
381
|
+
await V(e, { recursive: !0 }), await de(p(e, "env.public.ts"), n, "utf8");
|
|
382
382
|
}, rt = async (e) => {
|
|
383
|
-
let t =
|
|
383
|
+
let t = z(e.rawEnv) ? e.rawEnv : void 0, n = await ce({
|
|
384
384
|
contract: t,
|
|
385
|
-
resolveSecret:
|
|
386
|
-
}), r = [...n.errors, ...
|
|
387
|
-
if (r.length > 0) throw Error(
|
|
388
|
-
|
|
385
|
+
resolveSecret: N
|
|
386
|
+
}), r = [...n.errors, ...L(t, e.appType)];
|
|
387
|
+
if (r.length > 0) throw Error(R(r));
|
|
388
|
+
oe(n.values), e.appType === "web" && le(n.publicValues);
|
|
389
389
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
390
390
|
if (i > 0) {
|
|
391
391
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -402,7 +402,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
402
402
|
contract: t
|
|
403
403
|
};
|
|
404
404
|
}, it = (e) => {
|
|
405
|
-
let t =
|
|
405
|
+
let t = I(e.contract), n = (e.plugins ?? []).flatMap((e) => se(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ae, i = /* @__PURE__ */ new Set(), a = [];
|
|
406
406
|
for (let e of [
|
|
407
407
|
...t,
|
|
408
408
|
...n,
|
|
@@ -427,7 +427,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
427
427
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
428
428
|
}
|
|
429
429
|
};
|
|
430
|
-
}, ot = (e, t) =>
|
|
430
|
+
}, ot = (e, t) => B(it({
|
|
431
431
|
...e,
|
|
432
432
|
includeFramework: !1
|
|
433
433
|
}), {
|
|
@@ -476,7 +476,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
476
476
|
if (t?.code !== "EACCES") return "";
|
|
477
477
|
if (typeof process.getuid != "function") return " — permission denied";
|
|
478
478
|
try {
|
|
479
|
-
let t =
|
|
479
|
+
let t = k(e);
|
|
480
480
|
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.`;
|
|
481
481
|
} catch {
|
|
482
482
|
return " — permission denied (and the file could not be stat-ed either)";
|
|
@@ -513,7 +513,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
513
513
|
if (e.length === 0) return () => {};
|
|
514
514
|
let r = (e) => n.root ? m(n.root, e) : e, i = !1, a = (e) => {
|
|
515
515
|
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(() => {
|
|
516
|
-
let e =
|
|
516
|
+
let e = pe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
517
517
|
stdio: "inherit",
|
|
518
518
|
env: process.env,
|
|
519
519
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -527,14 +527,14 @@ __installPublicEnv(publicEnvValues)
|
|
|
527
527
|
});
|
|
528
528
|
}));
|
|
529
529
|
};
|
|
530
|
-
for (let t of e)
|
|
530
|
+
for (let t of e) re(t, { interval: gt }, (e, n) => {
|
|
531
531
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
532
532
|
});
|
|
533
533
|
return t.info("watching .env files for changes", {
|
|
534
534
|
files: e.map(r),
|
|
535
535
|
intervalMs: gt
|
|
536
536
|
}), () => {
|
|
537
|
-
for (let t of e)
|
|
537
|
+
for (let t of e) ne(t);
|
|
538
538
|
};
|
|
539
539
|
}, vt = S({ scope: "vite" }), yt = /\x1b\[[0-9;]*m/g, bt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, xt = (e) => e.replace(yt, "").replace(bt, "").trim(), St = /proxy error/i, Ct = [
|
|
540
540
|
"ECONNREFUSED",
|
|
@@ -788,27 +788,48 @@ __installPublicEnv(publicEnvValues)
|
|
|
788
788
|
return t.slice();
|
|
789
789
|
}
|
|
790
790
|
};
|
|
791
|
-
}, Jt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Yt = () => `: keep-alive ${Date.now()}\n\n`, Xt = {
|
|
791
|
+
}, Jt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Yt = () => `: keep-alive ${Date.now()}\n\n`, Xt = 8e3, Zt = (e, t = Xt) => {
|
|
792
|
+
let n = $t(e);
|
|
793
|
+
return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
|
|
794
|
+
}, Qt = 4, $t = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
|
|
795
|
+
if (e instanceof Error) {
|
|
796
|
+
let r = e.stack ?? `${e.name}: ${e.message}`;
|
|
797
|
+
if (n.has(e)) return `${r}\n [cycle]`;
|
|
798
|
+
n.add(e);
|
|
799
|
+
let i = [];
|
|
800
|
+
if (t < Qt) if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${en($t(a, t + 1, n))}`);
|
|
801
|
+
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${en($t(e.cause, t + 1, n))}`);
|
|
802
|
+
return r + i.join("");
|
|
803
|
+
}
|
|
804
|
+
try {
|
|
805
|
+
return String(e);
|
|
806
|
+
} catch {
|
|
807
|
+
return "[unstringifiable thrown value]";
|
|
808
|
+
}
|
|
809
|
+
}, en = (e) => {
|
|
810
|
+
let t = e.split("\n");
|
|
811
|
+
return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
|
|
812
|
+
}, tn = {
|
|
792
813
|
trace: 0,
|
|
793
814
|
debug: 1,
|
|
794
815
|
info: 2,
|
|
795
816
|
warn: 3,
|
|
796
817
|
error: 4,
|
|
797
818
|
fatal: 5
|
|
798
|
-
},
|
|
819
|
+
}, nn = 2e3, rn = 200, an = class {
|
|
799
820
|
capacity;
|
|
800
821
|
buffer = [];
|
|
801
|
-
constructor(e =
|
|
822
|
+
constructor(e = nn) {
|
|
802
823
|
this.capacity = e;
|
|
803
824
|
}
|
|
804
825
|
append(e) {
|
|
805
826
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
806
827
|
}
|
|
807
828
|
query(e = {}) {
|
|
808
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
829
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? rn, this.capacity), i = e.minLevel === void 0 ? tn.trace : tn[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
809
830
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
810
831
|
let r = this.buffer[e];
|
|
811
|
-
r.ts < t || r.ts > n ||
|
|
832
|
+
r.ts < t || r.ts > n || tn[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);
|
|
812
833
|
}
|
|
813
834
|
return l.reverse();
|
|
814
835
|
}
|
|
@@ -821,7 +842,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
821
842
|
clear() {
|
|
822
843
|
this.buffer = [];
|
|
823
844
|
}
|
|
824
|
-
},
|
|
845
|
+
}, on = null, sn = () => (on === null && (on = new an()), on), cn = (e) => {
|
|
825
846
|
if (typeof e == "string") return e;
|
|
826
847
|
if (e instanceof Error) return e.message;
|
|
827
848
|
try {
|
|
@@ -829,18 +850,28 @@ __installPublicEnv(publicEnvValues)
|
|
|
829
850
|
} catch {
|
|
830
851
|
return String(e);
|
|
831
852
|
}
|
|
832
|
-
},
|
|
853
|
+
}, ln = 8e3, un = (e) => typeof e == "string" ? e.length <= ln ? e : `${e.slice(0, ln)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Zt(e, ln), dn = (e, t) => {
|
|
854
|
+
try {
|
|
855
|
+
e(...t);
|
|
856
|
+
} catch (n) {
|
|
857
|
+
try {
|
|
858
|
+
e(...t.map(un)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${ln} chars per argument.`);
|
|
859
|
+
} catch {
|
|
860
|
+
e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}, fn = (e) => {
|
|
833
864
|
let t = {
|
|
834
865
|
log: console.log.bind(console),
|
|
835
866
|
info: console.info.bind(console),
|
|
836
867
|
warn: console.warn.bind(console),
|
|
837
868
|
error: console.error.bind(console),
|
|
838
869
|
debug: console.debug.bind(console)
|
|
839
|
-
}, n =
|
|
840
|
-
if (t[i]
|
|
870
|
+
}, n = sn(), r = !1, i = (i) => (...a) => {
|
|
871
|
+
if (dn(t[i], a), !r) {
|
|
841
872
|
r = !0;
|
|
842
873
|
try {
|
|
843
|
-
let t = a.length > 0 ?
|
|
874
|
+
let t = a.length > 0 ? cn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = M();
|
|
844
875
|
e.emit("log", {
|
|
845
876
|
level: i,
|
|
846
877
|
message: r,
|
|
@@ -878,7 +909,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
878
909
|
argsCount: 1,
|
|
879
910
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
880
911
|
});
|
|
881
|
-
let a =
|
|
912
|
+
let a = M(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
882
913
|
...t.fields,
|
|
883
914
|
traceId: a.traceId
|
|
884
915
|
} : t.fields;
|
|
@@ -898,24 +929,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
898
929
|
return () => {
|
|
899
930
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
900
931
|
};
|
|
901
|
-
},
|
|
932
|
+
}, pn = 2e3, mn = 8, hn = 1e3, gn = 200, Y = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, _n = (e) => {
|
|
902
933
|
switch (e) {
|
|
903
934
|
case "error": return "error";
|
|
904
935
|
case "warn": return "warn";
|
|
905
936
|
case "debug": return "debug";
|
|
906
937
|
default: return "info";
|
|
907
938
|
}
|
|
908
|
-
},
|
|
939
|
+
}, vn = S({ scope: "client" }), yn = (e, t) => {
|
|
909
940
|
let n;
|
|
910
941
|
try {
|
|
911
942
|
n = JSON.parse(e);
|
|
912
943
|
} catch {
|
|
913
|
-
return
|
|
944
|
+
return bn(400, { error: "invalid JSON body" });
|
|
914
945
|
}
|
|
915
|
-
if (typeof n != "object" || !n) return
|
|
946
|
+
if (typeof n != "object" || !n) return bn(400, { error: "body must be a JSON object" });
|
|
916
947
|
let r = n;
|
|
917
|
-
if (!Array.isArray(r.entries)) return
|
|
918
|
-
let i = typeof r.app == "string" ? Y(r.app, 120) : void 0, a = typeof r.page == "string" ? Y(r.page, 200) : void 0, o = typeof r.ua == "string" ? Y(r.ua, 200) : void 0, s = r.entries.slice(0,
|
|
948
|
+
if (!Array.isArray(r.entries)) return bn(400, { error: "entries must be an array" });
|
|
949
|
+
let i = typeof r.app == "string" ? Y(r.app, 120) : void 0, a = typeof r.page == "string" ? Y(r.page, 200) : void 0, o = typeof r.ua == "string" ? Y(r.ua, 200) : void 0, s = r.entries.slice(0, gn), c = 0;
|
|
919
950
|
for (let e of s) {
|
|
920
951
|
if (typeof e != "object" || !e) continue;
|
|
921
952
|
let n = e;
|
|
@@ -926,7 +957,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
926
957
|
"warn",
|
|
927
958
|
"error",
|
|
928
959
|
"debug"
|
|
929
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Y(n.message,
|
|
960
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Y(n.message, pn), u = Array.isArray(n.args) ? n.args.slice(0, mn).filter((e) => typeof e == "string").map((e) => Y(e, hn)) : void 0, d = typeof n.stack == "string" ? Y(n.stack, pn) : void 0;
|
|
930
961
|
t.emit("clientLog", {
|
|
931
962
|
ts: s,
|
|
932
963
|
level: r,
|
|
@@ -941,36 +972,36 @@ __installPublicEnv(publicEnvValues)
|
|
|
941
972
|
...i === void 0 ? {} : { app: i },
|
|
942
973
|
...a === void 0 ? {} : { page: a },
|
|
943
974
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
944
|
-
}, p =
|
|
945
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
975
|
+
}, p = _n(r);
|
|
976
|
+
(p === "error" || p === "warn") && d !== void 0 ? vn[p](l, f, { stack: d }) : vn[p](l, {
|
|
946
977
|
...f,
|
|
947
978
|
...d === void 0 ? {} : { stack: d }
|
|
948
979
|
}), c++;
|
|
949
980
|
}
|
|
950
|
-
return
|
|
981
|
+
return bn(202, {
|
|
951
982
|
accepted: c,
|
|
952
983
|
dropped: r.entries.length - c
|
|
953
984
|
});
|
|
954
|
-
},
|
|
985
|
+
}, bn = (e, t) => ({
|
|
955
986
|
status: e,
|
|
956
987
|
contentType: "application/json; charset=utf-8",
|
|
957
988
|
body: JSON.stringify(t)
|
|
958
|
-
}),
|
|
989
|
+
}), xn = "/_voltro/inspect/clientLog", Sn = [
|
|
959
990
|
"trace",
|
|
960
991
|
"debug",
|
|
961
992
|
"info",
|
|
962
993
|
"warn",
|
|
963
994
|
"error",
|
|
964
995
|
"fatal"
|
|
965
|
-
],
|
|
996
|
+
], Cn = {
|
|
966
997
|
trace: "TRACE",
|
|
967
998
|
debug: "DEBUG",
|
|
968
999
|
info: "INFO ",
|
|
969
1000
|
warn: "WARN ",
|
|
970
1001
|
error: "ERROR",
|
|
971
1002
|
fatal: "FATAL"
|
|
972
|
-
},
|
|
973
|
-
if (
|
|
1003
|
+
}, wn = (e) => Sn.includes(e), Tn = (e, t, n = {}) => {
|
|
1004
|
+
if (c()) return {
|
|
974
1005
|
status: 503,
|
|
975
1006
|
contentType: "application/json",
|
|
976
1007
|
body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" })
|
|
@@ -984,36 +1015,36 @@ __installPublicEnv(publicEnvValues)
|
|
|
984
1015
|
reason: r.reason
|
|
985
1016
|
})
|
|
986
1017
|
};
|
|
987
|
-
let
|
|
1018
|
+
let i = e.indexOf("?"), a = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), o = {}, l = a.get("since");
|
|
988
1019
|
if (l !== null) {
|
|
989
1020
|
let e = Number(l);
|
|
990
|
-
Number.isFinite(e) && (
|
|
1021
|
+
Number.isFinite(e) && (o.since = e);
|
|
991
1022
|
}
|
|
992
|
-
let u =
|
|
1023
|
+
let u = a.get("until");
|
|
993
1024
|
if (u !== null) {
|
|
994
1025
|
let e = Number(u);
|
|
995
|
-
Number.isFinite(e) && (
|
|
1026
|
+
Number.isFinite(e) && (o.until = e);
|
|
996
1027
|
}
|
|
997
|
-
let d =
|
|
1028
|
+
let d = a.get("max");
|
|
998
1029
|
if (d !== null) {
|
|
999
1030
|
let e = Number(d);
|
|
1000
|
-
Number.isFinite(e) && e > 0 && (
|
|
1001
|
-
}
|
|
1002
|
-
let f =
|
|
1003
|
-
f !== null &&
|
|
1004
|
-
let p =
|
|
1005
|
-
(p === "server" || p === "client") && (
|
|
1006
|
-
let m =
|
|
1007
|
-
m !== null && m.length > 0 && (
|
|
1008
|
-
let h =
|
|
1009
|
-
h !== null && h.length > 0 && (
|
|
1010
|
-
let g =
|
|
1011
|
-
g !== null && g.length > 0 && (
|
|
1012
|
-
let _ = t.query(
|
|
1013
|
-
if ((
|
|
1031
|
+
Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
|
|
1032
|
+
}
|
|
1033
|
+
let f = a.get("level");
|
|
1034
|
+
f !== null && wn(f) && (o.minLevel = f);
|
|
1035
|
+
let p = a.get("source");
|
|
1036
|
+
(p === "server" || p === "client") && (o.source = p);
|
|
1037
|
+
let m = a.get("scope");
|
|
1038
|
+
m !== null && m.length > 0 && (o.scope = m);
|
|
1039
|
+
let h = a.get("filter");
|
|
1040
|
+
h !== null && h.length > 0 && (o.filter = h);
|
|
1041
|
+
let g = a.get("trace");
|
|
1042
|
+
g !== null && g.length > 0 && (o.traceId = g);
|
|
1043
|
+
let _ = t.query(o);
|
|
1044
|
+
if ((a.get("format") ?? "json") === "text") return {
|
|
1014
1045
|
status: 200,
|
|
1015
1046
|
contentType: "text/plain; charset=utf-8",
|
|
1016
|
-
body: _.map(
|
|
1047
|
+
body: _.map(En).join("\n") + (_.length > 0 ? "\n" : "")
|
|
1017
1048
|
};
|
|
1018
1049
|
let v = {
|
|
1019
1050
|
capturedAt: Date.now(),
|
|
@@ -1027,40 +1058,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
1027
1058
|
contentType: "application/json; charset=utf-8",
|
|
1028
1059
|
body: JSON.stringify(v)
|
|
1029
1060
|
};
|
|
1030
|
-
},
|
|
1031
|
-
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 =
|
|
1032
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1033
|
-
},
|
|
1061
|
+
}, En = (e) => {
|
|
1062
|
+
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);
|
|
1063
|
+
return `${n}:${r}:${i}.${a} ${Cn[e.level]} ${o} ${e.message}${s}`;
|
|
1064
|
+
}, Dn = 80, On = (e) => {
|
|
1034
1065
|
let t = Object.entries(e);
|
|
1035
1066
|
if (t.length === 0) return "";
|
|
1036
1067
|
let n = [];
|
|
1037
1068
|
for (let [e, r] of t) {
|
|
1038
1069
|
if (r === void 0) continue;
|
|
1039
|
-
let t =
|
|
1070
|
+
let t = kn(r);
|
|
1040
1071
|
n.push(`${e}=${t}`);
|
|
1041
1072
|
}
|
|
1042
1073
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1043
|
-
},
|
|
1074
|
+
}, kn = (e) => {
|
|
1044
1075
|
if (typeof e == "string") {
|
|
1045
|
-
let t = e.length >
|
|
1076
|
+
let t = e.length > Dn ? e.slice(0, Dn) + "…" : e;
|
|
1046
1077
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1047
1078
|
}
|
|
1048
1079
|
if (e === null) return "null";
|
|
1049
1080
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1050
1081
|
try {
|
|
1051
1082
|
let t = JSON.stringify(e);
|
|
1052
|
-
return t.length >
|
|
1083
|
+
return t.length > Dn ? t.slice(0, Dn) + "…" : t;
|
|
1053
1084
|
} catch {
|
|
1054
1085
|
return "[unserialisable]";
|
|
1055
1086
|
}
|
|
1056
|
-
},
|
|
1087
|
+
}, An = "/_voltro/inspect/logs", jn = (e, t, n) => {
|
|
1057
1088
|
if (t.headers.authorization !== void 0) return !1;
|
|
1058
1089
|
let { token: r } = n;
|
|
1059
1090
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
1060
1091
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
1061
1092
|
let i = n.writeToken;
|
|
1062
1093
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
1063
|
-
},
|
|
1094
|
+
}, Mn = [{
|
|
1064
1095
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1065
1096
|
handle: (e, t) => {
|
|
1066
1097
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1072,13 +1103,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1072
1103
|
});
|
|
1073
1104
|
} else t.info(n);
|
|
1074
1105
|
}
|
|
1075
|
-
}],
|
|
1106
|
+
}], Nn = () => {
|
|
1076
1107
|
let e = {
|
|
1077
1108
|
warn: console.warn.bind(console),
|
|
1078
1109
|
error: console.error.bind(console)
|
|
1079
1110
|
}, t = S({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1080
1111
|
if (!n) {
|
|
1081
|
-
for (let e of
|
|
1112
|
+
for (let e of Mn) if (e.match(i[0])) {
|
|
1082
1113
|
n = !0;
|
|
1083
1114
|
try {
|
|
1084
1115
|
e.handle(i, t);
|
|
@@ -1093,7 +1124,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1093
1124
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1094
1125
|
console.warn = e.warn, console.error = e.error;
|
|
1095
1126
|
};
|
|
1096
|
-
},
|
|
1127
|
+
}, Pn = {
|
|
1097
1128
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1098
1129
|
renderMode: "it picks the server render strategy",
|
|
1099
1130
|
dynamic: "it picks the server render strategy",
|
|
@@ -1104,7 +1135,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1104
1135
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1105
1136
|
interactive: "it decides how much client JS the server ships",
|
|
1106
1137
|
tenantAware: "it is part of the server-side cache key"
|
|
1107
|
-
},
|
|
1138
|
+
}, Fn = Object.keys(Pn), In = (e) => t.test(e), Ln = (e) => e.replace(/page\.tsx$/, "page.test.tsx"), Rn = "virtual:voltro-route-refresh", zn = `\0${Rn}`, Bn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, Vn = () => `
|
|
1108
1139
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1109
1140
|
|
|
1110
1141
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1133,11 +1164,11 @@ const stableForm = (value) => {
|
|
|
1133
1164
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1134
1165
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1135
1166
|
* value. Everything else a page exports is plain client-side data. */
|
|
1136
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1167
|
+
const serverRelevantExports = ${JSON.stringify(Fn)}
|
|
1137
1168
|
|
|
1138
1169
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1139
1170
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1140
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1171
|
+
const serverExportEffect = ${JSON.stringify(Pn)}
|
|
1141
1172
|
|
|
1142
1173
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1143
1174
|
export const serverEffectOf = (name) =>
|
|
@@ -1180,7 +1211,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1180
1211
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1181
1212
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1182
1213
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1183
|
-
`,
|
|
1214
|
+
`, Hn = (e) => `
|
|
1184
1215
|
if (import.meta.hot) {
|
|
1185
1216
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1186
1217
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1207,45 +1238,45 @@ import {
|
|
|
1207
1238
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1208
1239
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1209
1240
|
serverEffectOf as __voltro_serverEffect,
|
|
1210
|
-
} from '${
|
|
1211
|
-
`,
|
|
1212
|
-
let [i = "", a] =
|
|
1213
|
-
if (!i.endsWith(".tsx") || a !== void 0 &&
|
|
1214
|
-
let o =
|
|
1241
|
+
} from '${Rn}'
|
|
1242
|
+
`, Un = (e) => e.replace(/\\/g, "/"), Wn = (e, t) => {
|
|
1243
|
+
let [i = "", a] = Un(e).split("?");
|
|
1244
|
+
if (!i.endsWith(".tsx") || a !== void 0 && Bn.test(a)) return !1;
|
|
1245
|
+
let o = Un(t).replace(/\/$/, "");
|
|
1215
1246
|
return i.startsWith(`${o}/`) ? r.test(i) || n.has(i.slice(i.lastIndexOf("/") + 1)) : !1;
|
|
1216
|
-
},
|
|
1247
|
+
}, Gn = (e, t, n) => Wn(t, n) ? `${e}${Hn(Un(t).split("?")[0] ?? t)}` : null, Kn = (e) => ({
|
|
1217
1248
|
name: "voltro:route-fast-refresh",
|
|
1218
1249
|
enforce: "pre",
|
|
1219
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1220
|
-
load: (e) => e ===
|
|
1250
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? zn : void 0,
|
|
1251
|
+
load: (e) => e === zn ? Vn() : void 0,
|
|
1221
1252
|
transform: (t, n, r) => {
|
|
1222
1253
|
if (r?.ssr === !0) return null;
|
|
1223
|
-
let i =
|
|
1254
|
+
let i = Gn(t, n, e);
|
|
1224
1255
|
return i === null ? null : {
|
|
1225
1256
|
code: i,
|
|
1226
1257
|
map: null
|
|
1227
1258
|
};
|
|
1228
1259
|
}
|
|
1229
|
-
}),
|
|
1260
|
+
}), qn = [
|
|
1230
1261
|
"static",
|
|
1231
1262
|
"spa",
|
|
1232
1263
|
"ssr",
|
|
1233
1264
|
"isr"
|
|
1234
|
-
],
|
|
1265
|
+
], Jn = (e) => typeof e == "string" && qn.includes(e), Yn = qn.map((e) => `'${e}'`).join(" | "), Xn = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${Yn}.${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)." : ""}`, Zn = class extends Error {
|
|
1235
1266
|
page;
|
|
1236
1267
|
value;
|
|
1237
1268
|
name = "InvalidRenderModeError";
|
|
1238
1269
|
constructor(e, t) {
|
|
1239
|
-
super(
|
|
1270
|
+
super(Xn(e, t)), this.page = e, this.value = t;
|
|
1240
1271
|
}
|
|
1241
|
-
},
|
|
1272
|
+
}, Qn = (e, t = "<page>") => {
|
|
1242
1273
|
if (e.renderMode !== void 0 && e.renderMode !== null) {
|
|
1243
|
-
if (!
|
|
1274
|
+
if (!Jn(e.renderMode)) throw new Zn(t, String(e.renderMode));
|
|
1244
1275
|
return e.renderMode;
|
|
1245
1276
|
}
|
|
1246
1277
|
return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
|
|
1247
|
-
},
|
|
1248
|
-
renderMode:
|
|
1278
|
+
}, $n = (e, t = "<page>") => ({
|
|
1279
|
+
renderMode: Qn(e, t),
|
|
1249
1280
|
tenantAware: e.tenantAware === !0,
|
|
1250
1281
|
revalidateMs: ct(e.revalidate),
|
|
1251
1282
|
staleWhileRevalidateMs: ct(e.staleWhileRevalidate) ?? 0,
|
|
@@ -1254,10 +1285,10 @@ import {
|
|
|
1254
1285
|
hasLoader: typeof e.loader == "function",
|
|
1255
1286
|
hasMeta: e.meta != null,
|
|
1256
1287
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1257
|
-
}),
|
|
1258
|
-
|
|
1288
|
+
}), er = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, tr = (e) => er.exec(e)?.[1] ?? null, nr = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, rr = (e) => {
|
|
1289
|
+
nr.lastIndex = 0;
|
|
1259
1290
|
let t;
|
|
1260
|
-
for (; (t =
|
|
1291
|
+
for (; (t = nr.exec(e)) !== null;) {
|
|
1261
1292
|
let e = t[2];
|
|
1262
1293
|
if (e.startsWith(".")) for (let n of t[1].split(",")) {
|
|
1263
1294
|
let t = n.lastIndexOf(" as ");
|
|
@@ -1265,36 +1296,36 @@ import {
|
|
|
1265
1296
|
}
|
|
1266
1297
|
}
|
|
1267
1298
|
return null;
|
|
1268
|
-
},
|
|
1299
|
+
}, ir = /export\s*\{([^}]*)\}/g, ar = (e) => {
|
|
1269
1300
|
if (/export\s+default\b/.test(e)) return !0;
|
|
1270
|
-
|
|
1301
|
+
ir.lastIndex = 0;
|
|
1271
1302
|
let t;
|
|
1272
|
-
for (; (t =
|
|
1303
|
+
for (; (t = ir.exec(e)) !== null;) for (let e of t[1].split(",")) {
|
|
1273
1304
|
let t = e.lastIndexOf(" as ");
|
|
1274
1305
|
if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
|
|
1275
1306
|
}
|
|
1276
1307
|
return !1;
|
|
1277
|
-
},
|
|
1308
|
+
}, or = async (e, t) => {
|
|
1278
1309
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1279
1310
|
let n;
|
|
1280
1311
|
try {
|
|
1281
|
-
n = await
|
|
1312
|
+
n = await ue(p(e, t.file), "utf8");
|
|
1282
1313
|
} catch {
|
|
1283
1314
|
return null;
|
|
1284
1315
|
}
|
|
1285
|
-
let r =
|
|
1286
|
-
return r !== null && !
|
|
1316
|
+
let r = tr(n);
|
|
1317
|
+
return r !== null && !Jn(r) ? Xn(p("src", "pages", t.file), r) : ar(n) ? null : `${p("src", "pages", t.file)} is a route (a \`page.tsx\` under src/pages/) but exports no default.\n\n A page's default export IS its component — the router has nothing to render without it,\n and the failure would otherwise surface only in \`voltro build\`'s prerender as\n "SSR received a descriptor with no Component", long after the file was written.\n\n Fix: \`export default function Page() { … }\`, or re-export another page's component\n (\`export { default } from '../page'\`). If this file is NOT a route, rename it —\n only the reserved names route, and anything else under src/pages/ is ordinary code\n that may live beside the page that uses it.`;
|
|
1287
1318
|
}))).filter((e) => e !== null);
|
|
1288
1319
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1289
|
-
}, X = p(
|
|
1320
|
+
}, X = p(P(), ".voltro", "logs"), sr = () => {
|
|
1290
1321
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1291
1322
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1292
|
-
},
|
|
1293
|
-
if (
|
|
1294
|
-
|
|
1295
|
-
let e = Date.now() -
|
|
1323
|
+
}, cr = !1, lr = () => {
|
|
1324
|
+
if (cr) return;
|
|
1325
|
+
cr = !0;
|
|
1326
|
+
let e = Date.now() - sr(), t = [];
|
|
1296
1327
|
try {
|
|
1297
|
-
t =
|
|
1328
|
+
t = te(X);
|
|
1298
1329
|
} catch {
|
|
1299
1330
|
return;
|
|
1300
1331
|
}
|
|
@@ -1302,13 +1333,13 @@ import {
|
|
|
1302
1333
|
if (!n.endsWith(".log")) continue;
|
|
1303
1334
|
let t = p(X, n);
|
|
1304
1335
|
try {
|
|
1305
|
-
|
|
1336
|
+
k(t).mtimeMs < e && A(t);
|
|
1306
1337
|
} catch {}
|
|
1307
1338
|
}
|
|
1308
|
-
},
|
|
1309
|
-
let t =
|
|
1339
|
+
}, ur = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), dr = (e, t) => p(X, `${ur(e)}-${t}.log`), fr = (e) => {
|
|
1340
|
+
let t = ur(e), n = [];
|
|
1310
1341
|
try {
|
|
1311
|
-
n =
|
|
1342
|
+
n = te(X);
|
|
1312
1343
|
} catch {
|
|
1313
1344
|
return;
|
|
1314
1345
|
}
|
|
@@ -1318,17 +1349,17 @@ import {
|
|
|
1318
1349
|
for (let e of r) {
|
|
1319
1350
|
let t = p(X, e);
|
|
1320
1351
|
try {
|
|
1321
|
-
let e =
|
|
1352
|
+
let e = k(t);
|
|
1322
1353
|
e.mtimeMs > a && (a = e.mtimeMs, i = t);
|
|
1323
1354
|
} catch {}
|
|
1324
1355
|
}
|
|
1325
1356
|
return i;
|
|
1326
|
-
},
|
|
1357
|
+
}, pr = (e) => {
|
|
1327
1358
|
try {
|
|
1328
1359
|
E(X, { recursive: !0 });
|
|
1329
1360
|
} catch {}
|
|
1330
|
-
|
|
1331
|
-
let t =
|
|
1361
|
+
lr();
|
|
1362
|
+
let t = dr(e, process.pid), n = D(t, "w"), r = (e) => {
|
|
1332
1363
|
let t = {
|
|
1333
1364
|
ts: e.ts.getTime(),
|
|
1334
1365
|
level: e.level,
|
|
@@ -1351,7 +1382,7 @@ import {
|
|
|
1351
1382
|
}
|
|
1352
1383
|
}, i = !1, a = x((e) => {
|
|
1353
1384
|
if (!i) try {
|
|
1354
|
-
|
|
1385
|
+
j(n, r(e));
|
|
1355
1386
|
} catch {}
|
|
1356
1387
|
}), o = () => {
|
|
1357
1388
|
if (!i) {
|
|
@@ -1369,7 +1400,7 @@ import {
|
|
|
1369
1400
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1370
1401
|
}
|
|
1371
1402
|
};
|
|
1372
|
-
},
|
|
1403
|
+
}, mr = async (e, t) => {
|
|
1373
1404
|
let n;
|
|
1374
1405
|
try {
|
|
1375
1406
|
n = await O.readFile(e, "utf8");
|
|
@@ -1383,11 +1414,11 @@ import {
|
|
|
1383
1414
|
i.push(t);
|
|
1384
1415
|
} catch {}
|
|
1385
1416
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1386
|
-
},
|
|
1417
|
+
}, hr = S({ scope: "voltro:dashboard" }), gr = F(import.meta.url), _r = 5179, vr = (e) => {
|
|
1387
1418
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1388
1419
|
if (t && T(p(h(t), "app.config.ts"))) return h(t);
|
|
1389
1420
|
try {
|
|
1390
|
-
let e = d(
|
|
1421
|
+
let e = d(gr.resolve("@voltro/dashboard/package.json"));
|
|
1391
1422
|
if (T(p(e, "app.config.ts"))) return e;
|
|
1392
1423
|
} catch {}
|
|
1393
1424
|
let n = p("voltro-devtools", "apps", "dashboard"), r = h(e);
|
|
@@ -1399,53 +1430,53 @@ import {
|
|
|
1399
1430
|
r = t;
|
|
1400
1431
|
}
|
|
1401
1432
|
return null;
|
|
1402
|
-
},
|
|
1403
|
-
let i =
|
|
1433
|
+
}, yr = "VOLTRO_IS_DASHBOARD", br = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1434
|
+
let i = me({
|
|
1404
1435
|
port: e,
|
|
1405
1436
|
host: t
|
|
1406
1437
|
}), a = !1, o = (e) => {
|
|
1407
1438
|
a || (a = !0, i.destroy(), r(e));
|
|
1408
1439
|
};
|
|
1409
1440
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1410
|
-
}),
|
|
1441
|
+
}), xr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Sr = () => process.env[yr] === "1", Cr = () => process.stdout.isTTY === !0, wr = p(P(), ".voltro", "dashboard-launch.lock"), Tr = 1e4, Er = async () => {
|
|
1411
1442
|
try {
|
|
1412
|
-
await O.mkdir(d(
|
|
1413
|
-
let e = await O.open(
|
|
1443
|
+
await O.mkdir(d(wr), { recursive: !0 });
|
|
1444
|
+
let e = await O.open(wr, "wx");
|
|
1414
1445
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1415
1446
|
} catch {
|
|
1416
1447
|
try {
|
|
1417
|
-
let e = await O.stat(
|
|
1418
|
-
if (Date.now() - e.mtimeMs >
|
|
1448
|
+
let e = await O.stat(wr);
|
|
1449
|
+
if (Date.now() - e.mtimeMs > Tr) return await O.unlink(wr).catch(() => void 0), Er();
|
|
1419
1450
|
} catch {}
|
|
1420
1451
|
return !1;
|
|
1421
1452
|
}
|
|
1422
|
-
},
|
|
1453
|
+
}, Dr = async () => {
|
|
1423
1454
|
try {
|
|
1424
|
-
await O.unlink(
|
|
1455
|
+
await O.unlink(wr);
|
|
1425
1456
|
} catch {}
|
|
1426
|
-
},
|
|
1457
|
+
}, Or = async (e) => {
|
|
1427
1458
|
let t = e.port ?? 5179;
|
|
1428
|
-
if (
|
|
1459
|
+
if (xr()) return {
|
|
1429
1460
|
status: "skipped",
|
|
1430
1461
|
reason: "disabled by flag/env",
|
|
1431
1462
|
port: t
|
|
1432
1463
|
};
|
|
1433
|
-
if (
|
|
1464
|
+
if (Sr()) return {
|
|
1434
1465
|
status: "skipped",
|
|
1435
1466
|
reason: "this process IS the dashboard",
|
|
1436
1467
|
port: t
|
|
1437
1468
|
};
|
|
1438
|
-
if (!
|
|
1469
|
+
if (!Cr()) return {
|
|
1439
1470
|
status: "skipped",
|
|
1440
1471
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1441
1472
|
port: t
|
|
1442
1473
|
};
|
|
1443
|
-
if (!await
|
|
1474
|
+
if (!await Er()) return {
|
|
1444
1475
|
status: "skipped",
|
|
1445
1476
|
reason: "another voltro process is currently launching the dashboard",
|
|
1446
1477
|
port: t
|
|
1447
1478
|
};
|
|
1448
|
-
if (await
|
|
1479
|
+
if (await br(t)) return await Dr(), {
|
|
1449
1480
|
status: "already-running",
|
|
1450
1481
|
port: t
|
|
1451
1482
|
};
|
|
@@ -1454,7 +1485,7 @@ import {
|
|
|
1454
1485
|
let e = process.argv[1];
|
|
1455
1486
|
n = e && e.endsWith("/src/bin.ts") ? p(d(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
1456
1487
|
}
|
|
1457
|
-
let r = T(p(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a =
|
|
1488
|
+
let r = T(p(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = pe(process.execPath, [
|
|
1458
1489
|
n,
|
|
1459
1490
|
i,
|
|
1460
1491
|
e.dashboardAppPath
|
|
@@ -1462,7 +1493,7 @@ import {
|
|
|
1462
1493
|
stdio: "ignore",
|
|
1463
1494
|
env: {
|
|
1464
1495
|
...process.env,
|
|
1465
|
-
[
|
|
1496
|
+
[yr]: "1",
|
|
1466
1497
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1467
1498
|
}
|
|
1468
1499
|
});
|
|
@@ -1470,22 +1501,22 @@ import {
|
|
|
1470
1501
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1471
1502
|
a.kill("SIGTERM");
|
|
1472
1503
|
} catch {}
|
|
1473
|
-
}),
|
|
1504
|
+
}), hr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1474
1505
|
port: t,
|
|
1475
1506
|
mode: i,
|
|
1476
1507
|
prebuilt: r
|
|
1477
|
-
}), r ||
|
|
1478
|
-
|
|
1508
|
+
}), r || hr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), hr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1509
|
+
Dr();
|
|
1479
1510
|
}, 4e3).unref(), {
|
|
1480
1511
|
status: "launched",
|
|
1481
1512
|
port: t
|
|
1482
1513
|
};
|
|
1483
|
-
},
|
|
1514
|
+
}, kr = class extends Error {
|
|
1484
1515
|
_voltroDeferral = !0;
|
|
1485
1516
|
constructor(e) {
|
|
1486
1517
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1487
1518
|
}
|
|
1488
|
-
},
|
|
1519
|
+
}, Ar = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, jr = (e) => {
|
|
1489
1520
|
if (!(e instanceof Error)) return;
|
|
1490
1521
|
let t = e._voltroControl;
|
|
1491
1522
|
if (t === "redirect") {
|
|
@@ -1507,7 +1538,7 @@ import {
|
|
|
1507
1538
|
},
|
|
1508
1539
|
body: "not found"
|
|
1509
1540
|
};
|
|
1510
|
-
},
|
|
1541
|
+
}, Mr = (e) => {
|
|
1511
1542
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1512
1543
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1513
1544
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1522,7 +1553,7 @@ import {
|
|
|
1522
1553
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1523
1554
|
});
|
|
1524
1555
|
} catch (e) {
|
|
1525
|
-
throw new
|
|
1556
|
+
throw new kr(e instanceof Error ? e.message : String(e));
|
|
1526
1557
|
}
|
|
1527
1558
|
return {
|
|
1528
1559
|
loaderData: n.renderData,
|
|
@@ -1538,8 +1569,8 @@ import {
|
|
|
1538
1569
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1539
1570
|
}
|
|
1540
1571
|
};
|
|
1541
|
-
},
|
|
1542
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1572
|
+
}, Nr = (e) => {
|
|
1573
|
+
let { helpers: t, renderInput: n } = e, r = Mr({
|
|
1543
1574
|
helpers: t,
|
|
1544
1575
|
page: e.page,
|
|
1545
1576
|
pathname: n.pathname,
|
|
@@ -1560,19 +1591,19 @@ import {
|
|
|
1560
1591
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1561
1592
|
hasDeferred: r.hasDeferred
|
|
1562
1593
|
};
|
|
1563
|
-
},
|
|
1594
|
+
}, Pr = (e) => {
|
|
1564
1595
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1565
1596
|
return {
|
|
1566
1597
|
body: t,
|
|
1567
1598
|
meta: n
|
|
1568
1599
|
};
|
|
1569
|
-
},
|
|
1600
|
+
}, Fr = (e) => [
|
|
1570
1601
|
...e.extra ?? [],
|
|
1571
1602
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1572
1603
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1573
1604
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1574
1605
|
e.prepared.stateScript
|
|
1575
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1606
|
+
].filter((e) => e.length > 0).join("\n "), Ir = (e) => {
|
|
1576
1607
|
let t = e.indexOf("?");
|
|
1577
1608
|
return t === -1 ? {
|
|
1578
1609
|
pathname: e || "/",
|
|
@@ -1581,51 +1612,58 @@ import {
|
|
|
1581
1612
|
pathname: e.slice(0, t) || "/",
|
|
1582
1613
|
search: e.slice(t)
|
|
1583
1614
|
};
|
|
1584
|
-
},
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1615
|
+
}, Lr = /Could not find required `intl` object/, Rr = (e) => [
|
|
1616
|
+
"",
|
|
1617
|
+
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1618
|
+
`${e} DID wrap this render in <I18nProvider> — the framework`,
|
|
1619
|
+
"resolved a locale for this request and supplied the provider. You are",
|
|
1620
|
+
"seeing this error anyway, which leaves one cause:",
|
|
1621
|
+
"",
|
|
1622
|
+
" TWO PHYSICAL COPIES OF react-intl (or of @voltro/i18n, which owns it).",
|
|
1623
|
+
"",
|
|
1624
|
+
"A React context is identified by object identity. The provider built from",
|
|
1625
|
+
"one copy is invisible to a `useT()` / `useIntl()` from the other, and the",
|
|
1626
|
+
"error is identical to having no provider at all.",
|
|
1627
|
+
"",
|
|
1628
|
+
"Check it:",
|
|
1629
|
+
"",
|
|
1630
|
+
" pnpm ls -r --depth 10 @voltro/i18n react-intl",
|
|
1631
|
+
"",
|
|
1632
|
+
"More than one version of either, anywhere in the workspace, is the cause.",
|
|
1633
|
+
"It usually means one package.json was left behind on an upgrade — the app",
|
|
1634
|
+
"still builds and every other test still passes.",
|
|
1635
|
+
"",
|
|
1636
|
+
"If both resolve to exactly one version, this diagnosis is wrong and the",
|
|
1637
|
+
"framework is at fault. Report it with that output attached.",
|
|
1638
|
+
"───────────────────────────────────────────────────────────────────────"
|
|
1639
|
+
].join("\n"), zr = (e, t, n) => {
|
|
1640
|
+
if (!t) return;
|
|
1641
|
+
let r = String(e?.message ?? e);
|
|
1642
|
+
return Lr.test(r) ? Rr(n) : void 0;
|
|
1643
|
+
}, Br = "<div id=\"root\"></div>", Vr = "<div id=\"root\">", Hr = "</div>", Ur = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Wr = /\bsrc=["']([^"']+)["']/i, Gr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Kr = (e) => {
|
|
1644
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Ur, (e) => {
|
|
1645
|
+
let r = Wr.exec(e)?.[1];
|
|
1608
1646
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1609
1647
|
});
|
|
1610
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1611
|
-
let i = r.indexOf(
|
|
1612
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1648
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Gr, "<script async$1>"));
|
|
1649
|
+
let i = r.indexOf(Br);
|
|
1650
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Br}\` 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.`);
|
|
1613
1651
|
return {
|
|
1614
|
-
head: `${r.slice(0, i)}${
|
|
1615
|
-
tail: `${
|
|
1652
|
+
head: `${r.slice(0, i)}${Vr}`,
|
|
1653
|
+
tail: `${Hr}${r.slice(i + 21)}`,
|
|
1616
1654
|
bootstrapModules: n
|
|
1617
1655
|
};
|
|
1618
|
-
},
|
|
1656
|
+
}, qr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Jr = (e) => {
|
|
1619
1657
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1620
1658
|
if (s || !o || a === null) return;
|
|
1621
1659
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1622
1660
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1623
|
-
t.flushHeaders?.(), t.write(
|
|
1661
|
+
t.flushHeaders?.(), t.write(qr({
|
|
1624
1662
|
head: n.head,
|
|
1625
1663
|
headInjection: i(a.meta),
|
|
1626
1664
|
htmlLang: r
|
|
1627
1665
|
}));
|
|
1628
|
-
let c = new
|
|
1666
|
+
let c = new he();
|
|
1629
1667
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
1630
1668
|
t.end(n.tail);
|
|
1631
1669
|
}), a.stream.pipe(c);
|
|
@@ -1650,16 +1688,16 @@ import {
|
|
|
1650
1688
|
return;
|
|
1651
1689
|
}
|
|
1652
1690
|
c();
|
|
1653
|
-
},
|
|
1691
|
+
}, Yr = (e) => Array.isArray(e.preload) && e.preload.length > 0, Xr = (e, t) => typeof e == "string" ? {
|
|
1654
1692
|
tag: e,
|
|
1655
1693
|
input: {}
|
|
1656
1694
|
} : {
|
|
1657
1695
|
tag: e.tag,
|
|
1658
1696
|
input: e.input?.(t) ?? {}
|
|
1659
|
-
},
|
|
1697
|
+
}, Zr = async (e) => {
|
|
1660
1698
|
let { pageMod: t, params: n, query: r, apiName: i, seed: a, onError: o } = e;
|
|
1661
|
-
if (
|
|
1662
|
-
let { tag: t, input: s } =
|
|
1699
|
+
if (Yr(t) && !(r === void 0 || i === void 0)) for (let e of t.preload) {
|
|
1700
|
+
let { tag: t, input: s } = Xr(e, n);
|
|
1663
1701
|
try {
|
|
1664
1702
|
a(i, t, s, await r(t, s));
|
|
1665
1703
|
} catch (e) {
|
|
@@ -1669,14 +1707,14 @@ import {
|
|
|
1669
1707
|
}, e);
|
|
1670
1708
|
}
|
|
1671
1709
|
}
|
|
1672
|
-
}, Z = S({ scope: "voltro:dev:web" }),
|
|
1710
|
+
}, Z = S({ scope: "voltro:dev:web" }), Qr = S({ scope: "vite" }), $r = await (async () => {
|
|
1673
1711
|
try {
|
|
1674
1712
|
let e = p(d(g(import.meta.url)), "..", "package.json"), t = await O.readFile(e, "utf8");
|
|
1675
1713
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1676
1714
|
} catch {
|
|
1677
1715
|
return "0.0.0";
|
|
1678
1716
|
}
|
|
1679
|
-
})(),
|
|
1717
|
+
})(), ei = async () => {
|
|
1680
1718
|
try {
|
|
1681
1719
|
let e = d(g(import.meta.url)), t = h(e, "..", "..", "devtools");
|
|
1682
1720
|
if (T(p(t, "package.json"))) return t;
|
|
@@ -1685,7 +1723,7 @@ import {
|
|
|
1685
1723
|
} catch {
|
|
1686
1724
|
return null;
|
|
1687
1725
|
}
|
|
1688
|
-
},
|
|
1726
|
+
}, ti = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1689
1727
|
"",
|
|
1690
1728
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1691
1729
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1695,12 +1733,12 @@ import {
|
|
|
1695
1733
|
" await import('@voltro/devtools/styles.css')",
|
|
1696
1734
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1697
1735
|
"}"
|
|
1698
|
-
],
|
|
1736
|
+
], ni = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ri = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], ii = (e) => e.sentry ? [
|
|
1699
1737
|
"",
|
|
1700
1738
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1701
1739
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1702
1740
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1703
|
-
] : [],
|
|
1741
|
+
] : [], ai = (e) => e.env ? ["import './env.public'"] : [], oi = (e) => {
|
|
1704
1742
|
let t = [], n = h(e);
|
|
1705
1743
|
for (;;) {
|
|
1706
1744
|
T(p(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1709,14 +1747,14 @@ import {
|
|
|
1709
1747
|
n = e;
|
|
1710
1748
|
}
|
|
1711
1749
|
return t;
|
|
1712
|
-
},
|
|
1750
|
+
}, si = In, ci = (e) => {
|
|
1713
1751
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1714
1752
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1715
1753
|
if (t) return `island-${t[1]}`;
|
|
1716
|
-
},
|
|
1717
|
-
let t = e.replace(r, "").split("/").filter(Boolean).filter((e) => !
|
|
1754
|
+
}, li = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, ui = (e) => e.startsWith("(") && e.endsWith(")"), di = (e) => e.filter((e) => !ui(e)), fi = (e) => {
|
|
1755
|
+
let t = e.replace(r, "").split("/").filter(Boolean).filter((e) => !ui(e));
|
|
1718
1756
|
return t.length === 0 ? "/" : "/" + t.join("/");
|
|
1719
|
-
},
|
|
1757
|
+
}, pi = (e) => `${e.replace(r, "").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) => {
|
|
1720
1758
|
let t = [], i = [], a = async (e, o) => {
|
|
1721
1759
|
let s = [];
|
|
1722
1760
|
try {
|
|
@@ -1724,17 +1762,17 @@ import {
|
|
|
1724
1762
|
} catch {
|
|
1725
1763
|
return;
|
|
1726
1764
|
}
|
|
1727
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1765
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !si(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
1728
1766
|
if (l.some((e) => n.has(e))) {
|
|
1729
1767
|
let t = u.has("layout.tsx"), r = !1;
|
|
1730
1768
|
if (t) try {
|
|
1731
1769
|
let t = await O.readFile(p(e, "layout.tsx"), "utf8");
|
|
1732
|
-
r =
|
|
1770
|
+
r = li.test(t);
|
|
1733
1771
|
} catch {}
|
|
1734
1772
|
i.push({
|
|
1735
1773
|
dir: d,
|
|
1736
1774
|
chain: o,
|
|
1737
|
-
contributesToUrl: o.length === 0 || !
|
|
1775
|
+
contributesToUrl: o.length === 0 || !ui(o[o.length - 1]),
|
|
1738
1776
|
hasLayout: t,
|
|
1739
1777
|
hasLayoutLoader: r,
|
|
1740
1778
|
hasError: u.has("error.tsx"),
|
|
@@ -1748,8 +1786,8 @@ import {
|
|
|
1748
1786
|
let n = d ? `${d}/${e}` : e;
|
|
1749
1787
|
t.push({
|
|
1750
1788
|
file: n,
|
|
1751
|
-
pattern:
|
|
1752
|
-
ident:
|
|
1789
|
+
pattern: fi(n),
|
|
1790
|
+
ident: pi(n),
|
|
1753
1791
|
dirChain: o
|
|
1754
1792
|
});
|
|
1755
1793
|
}
|
|
@@ -1768,14 +1806,14 @@ import {
|
|
|
1768
1806
|
dirs: s,
|
|
1769
1807
|
orphanedSpecials: c
|
|
1770
1808
|
};
|
|
1771
|
-
},
|
|
1809
|
+
}, mi = (e, t) => {
|
|
1772
1810
|
let n = [];
|
|
1773
1811
|
for (let r = 0; r <= t.length; r++) {
|
|
1774
1812
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1775
1813
|
a && n.push(a);
|
|
1776
1814
|
}
|
|
1777
1815
|
return n;
|
|
1778
|
-
},
|
|
1816
|
+
}, hi = async (e) => {
|
|
1779
1817
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1780
1818
|
return {
|
|
1781
1819
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1798,10 +1836,10 @@ import {
|
|
|
1798
1836
|
})),
|
|
1799
1837
|
segmentLoaderData: o
|
|
1800
1838
|
};
|
|
1801
|
-
},
|
|
1802
|
-
let t =
|
|
1839
|
+
}, gi = (e) => {
|
|
1840
|
+
let t = di(e);
|
|
1803
1841
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1804
|
-
},
|
|
1842
|
+
}, _i = [
|
|
1805
1843
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1806
1844
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1807
1845
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1894,7 +1932,7 @@ import {
|
|
|
1894
1932
|
" _vdtErrorStart('Build error')",
|
|
1895
1933
|
" })",
|
|
1896
1934
|
"}"
|
|
1897
|
-
].join("\n"),
|
|
1935
|
+
].join("\n"), vi = (e) => {
|
|
1898
1936
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1899
1937
|
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, "\\$&"));
|
|
1900
1938
|
let a = i.join("/");
|
|
@@ -1903,8 +1941,8 @@ import {
|
|
|
1903
1941
|
paramNames: t,
|
|
1904
1942
|
priority: n
|
|
1905
1943
|
};
|
|
1906
|
-
},
|
|
1907
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1944
|
+
}, yi = (e) => e.map((e) => {
|
|
1945
|
+
let { regex: t, paramNames: n, priority: r } = vi(e.pattern);
|
|
1908
1946
|
return {
|
|
1909
1947
|
pattern: e.pattern,
|
|
1910
1948
|
file: e.file,
|
|
@@ -1913,7 +1951,7 @@ import {
|
|
|
1913
1951
|
paramNames: n,
|
|
1914
1952
|
priority: r
|
|
1915
1953
|
};
|
|
1916
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1954
|
+
}).slice().sort((e, t) => e.priority - t.priority), bi = (e, t) => {
|
|
1917
1955
|
for (let n of t) {
|
|
1918
1956
|
let t = n.regex.exec(e);
|
|
1919
1957
|
if (!t) continue;
|
|
@@ -1925,7 +1963,7 @@ import {
|
|
|
1925
1963
|
};
|
|
1926
1964
|
}
|
|
1927
1965
|
return null;
|
|
1928
|
-
},
|
|
1966
|
+
}, xi = async (e, t) => {
|
|
1929
1967
|
let n = e;
|
|
1930
1968
|
for (;;) {
|
|
1931
1969
|
let e = p(n, "node_modules", t);
|
|
@@ -1939,7 +1977,7 @@ import {
|
|
|
1939
1977
|
if (r === n) return null;
|
|
1940
1978
|
n = r;
|
|
1941
1979
|
}
|
|
1942
|
-
},
|
|
1980
|
+
}, Si = async (e) => {
|
|
1943
1981
|
try {
|
|
1944
1982
|
let t = await import(_(p(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;
|
|
1945
1983
|
return a ? {
|
|
@@ -1948,7 +1986,7 @@ import {
|
|
|
1948
1986
|
} : { port: r };
|
|
1949
1987
|
} catch {}
|
|
1950
1988
|
return { port: 4e3 };
|
|
1951
|
-
},
|
|
1989
|
+
}, Ci = (e, t) => ({
|
|
1952
1990
|
name: e,
|
|
1953
1991
|
pkg: t.package,
|
|
1954
1992
|
browserWsUrl: t.url,
|
|
@@ -1956,7 +1994,7 @@ import {
|
|
|
1956
1994
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1957
1995
|
...t.headers ? { headers: t.headers } : {},
|
|
1958
1996
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1959
|
-
}),
|
|
1997
|
+
}), wi = (e, t, n) => {
|
|
1960
1998
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1961
1999
|
return {
|
|
1962
2000
|
name: e,
|
|
@@ -1968,7 +2006,7 @@ import {
|
|
|
1968
2006
|
...t.headers ? { headers: t.headers } : {},
|
|
1969
2007
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1970
2008
|
};
|
|
1971
|
-
},
|
|
2009
|
+
}, Ti = (e) => {
|
|
1972
2010
|
let t = /* @__PURE__ */ new Map();
|
|
1973
2011
|
for (let n of e) {
|
|
1974
2012
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1976,43 +2014,43 @@ import {
|
|
|
1976
2014
|
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>.`);
|
|
1977
2015
|
t.set(n.browserWsUrl, n.name);
|
|
1978
2016
|
}
|
|
1979
|
-
},
|
|
2017
|
+
}, Ei = async (e, t) => {
|
|
1980
2018
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1981
2019
|
for (let [t, i] of n) {
|
|
1982
2020
|
if (i.url) {
|
|
1983
|
-
r.push(
|
|
2021
|
+
r.push(Ci(t, i));
|
|
1984
2022
|
continue;
|
|
1985
2023
|
}
|
|
1986
|
-
let n = await
|
|
2024
|
+
let n = await xi(e, i.package);
|
|
1987
2025
|
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.`);
|
|
1988
|
-
r.push(
|
|
2026
|
+
r.push(wi(t, i, await Si(n)));
|
|
1989
2027
|
}
|
|
1990
|
-
return
|
|
1991
|
-
},
|
|
2028
|
+
return Ti(r), r;
|
|
2029
|
+
}, Di = (e) => {
|
|
1992
2030
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1993
2031
|
let t = new URL(e);
|
|
1994
2032
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1995
2033
|
} catch {
|
|
1996
2034
|
return;
|
|
1997
2035
|
}
|
|
1998
|
-
},
|
|
2036
|
+
}, Oi = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ki = (e) => process.env[Oi(e)] ?? process.env.VOLTRO_API_ORIGIN, Ai = (e, t) => {
|
|
1999
2037
|
if (!e) return;
|
|
2000
|
-
let n =
|
|
2038
|
+
let n = ki(e.name) ?? e.serverOrigin;
|
|
2001
2039
|
if (n) {
|
|
2002
|
-
let e =
|
|
2040
|
+
let e = Di(n);
|
|
2003
2041
|
if (e) return e;
|
|
2004
2042
|
}
|
|
2005
2043
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
2006
|
-
let t =
|
|
2044
|
+
let t = Di(e.proxyTarget);
|
|
2007
2045
|
if (t) return t;
|
|
2008
2046
|
}
|
|
2009
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
2010
|
-
},
|
|
2047
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Di(e.browserWsUrl);
|
|
2048
|
+
}, ji = (e, t, n) => {
|
|
2011
2049
|
if (!e) {
|
|
2012
2050
|
if (n?.apiName === void 0) return;
|
|
2013
2051
|
let e = n.apiName;
|
|
2014
2052
|
return async () => {
|
|
2015
|
-
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 ${
|
|
2053
|
+
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 ${Oi(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.`);
|
|
2016
2054
|
};
|
|
2017
2055
|
}
|
|
2018
2056
|
return async (r, i) => {
|
|
@@ -2034,7 +2072,7 @@ import {
|
|
|
2034
2072
|
});
|
|
2035
2073
|
} catch (t) {
|
|
2036
2074
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2037
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2075
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Oi(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 });
|
|
2038
2076
|
}
|
|
2039
2077
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2040
2078
|
let s = await o.json();
|
|
@@ -2052,8 +2090,8 @@ import {
|
|
|
2052
2090
|
}
|
|
2053
2091
|
if (u) return l;
|
|
2054
2092
|
};
|
|
2055
|
-
},
|
|
2056
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = T(p(e, "node_modules", "@voltro", "devtools", "package.json")) || await
|
|
2093
|
+
}, Mi = async (e, t, n, r = {}) => {
|
|
2094
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = T(p(e, "node_modules", "@voltro", "devtools", "package.json")) || await ei() !== null, s = t.theme === "system" ? [
|
|
2057
2095
|
" <script>",
|
|
2058
2096
|
" (function () {",
|
|
2059
2097
|
" var root = document.documentElement",
|
|
@@ -2092,7 +2130,7 @@ import {
|
|
|
2092
2130
|
"</html>",
|
|
2093
2131
|
""
|
|
2094
2132
|
].join("\n"), l = p(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
|
|
2095
|
-
await
|
|
2133
|
+
await or(l, u);
|
|
2096
2134
|
for (let e of f) Z.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
|
|
2097
2135
|
let m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, h = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, g = n.map((e) => `import { appGroup as ${m(e.name)}, appDescriptors as ${h(e.name)} } from '${e.pkg}/rpcGroup'`);
|
|
2098
2136
|
n.some((e) => e.hasAuthHeaders) && (g.push("import __voltroAppConfig from '../app.config'"), g.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
|
|
@@ -2107,13 +2145,13 @@ import {
|
|
|
2107
2145
|
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'`);
|
|
2108
2146
|
}
|
|
2109
2147
|
let r = u.map((e) => {
|
|
2110
|
-
let t =
|
|
2148
|
+
let t = mi(d, e.dirChain).map((e) => {
|
|
2111
2149
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2112
2150
|
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(", ")} }`;
|
|
2113
2151
|
}).join(",\n");
|
|
2114
2152
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2115
2153
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2116
|
-
let t =
|
|
2154
|
+
let t = gi(e.chain), n = mi(d, e.chain).map((e) => {
|
|
2117
2155
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2118
2156
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2119
2157
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2369,14 +2407,14 @@ import {
|
|
|
2369
2407
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2370
2408
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2371
2409
|
"",
|
|
2372
|
-
|
|
2410
|
+
...ai(t),
|
|
2373
2411
|
"import { mount } from '@voltro/web'",
|
|
2374
2412
|
...g,
|
|
2375
2413
|
"import { App } from './app'",
|
|
2376
2414
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2377
|
-
...
|
|
2378
|
-
...
|
|
2379
|
-
...
|
|
2415
|
+
...ri(t),
|
|
2416
|
+
...ti(t, o),
|
|
2417
|
+
...ii(t),
|
|
2380
2418
|
"",
|
|
2381
2419
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2382
2420
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2393,10 +2431,10 @@ import {
|
|
|
2393
2431
|
" apis: {",
|
|
2394
2432
|
..._,
|
|
2395
2433
|
" },",
|
|
2396
|
-
...
|
|
2434
|
+
...ni(t, o),
|
|
2397
2435
|
"})",
|
|
2398
2436
|
"",
|
|
2399
|
-
|
|
2437
|
+
_i
|
|
2400
2438
|
].join("\n");
|
|
2401
2439
|
} else v = "", y = "", b = [
|
|
2402
2440
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2404,22 +2442,22 @@ import {
|
|
|
2404
2442
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2405
2443
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2406
2444
|
"",
|
|
2407
|
-
|
|
2445
|
+
...ai(t),
|
|
2408
2446
|
"import { mount } from '@voltro/web'",
|
|
2409
2447
|
...g,
|
|
2410
2448
|
"import App from '../src/App'",
|
|
2411
|
-
...
|
|
2412
|
-
...
|
|
2413
|
-
...
|
|
2449
|
+
...ri(t),
|
|
2450
|
+
...ti(t, o),
|
|
2451
|
+
...ii(t),
|
|
2414
2452
|
"",
|
|
2415
2453
|
"mount(App, {",
|
|
2416
2454
|
" apis: {",
|
|
2417
2455
|
..._,
|
|
2418
2456
|
" },",
|
|
2419
|
-
...
|
|
2457
|
+
...ni(t, o),
|
|
2420
2458
|
"})",
|
|
2421
2459
|
"",
|
|
2422
|
-
|
|
2460
|
+
_i
|
|
2423
2461
|
].join("\n");
|
|
2424
2462
|
let x = p(e, ".framework");
|
|
2425
2463
|
await O.mkdir(x, { recursive: !0 }), t.env ? await nt(x, r) : await O.rm(p(x, "env.public.ts"), { force: !0 }), await O.writeFile(p(x, "index.html"), c, "utf8"), await O.writeFile(p(x, "main.tsx"), b, "utf8"), v ? (await O.writeFile(p(x, "app.tsx"), v, "utf8"), await O.writeFile(p(x, "routeTable.ts"), y, "utf8")) : (await O.rm(p(x, "app.tsx"), { force: !0 }), await O.rm(p(x, "routeTable.ts"), { force: !0 }));
|
|
@@ -2436,7 +2474,7 @@ import {
|
|
|
2436
2474
|
Z.warn(`could not add ${D.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2437
2475
|
}
|
|
2438
2476
|
}
|
|
2439
|
-
},
|
|
2477
|
+
}, Ni = async (e, t) => {
|
|
2440
2478
|
try {
|
|
2441
2479
|
let n = p(d(e), "project.json");
|
|
2442
2480
|
if (!T(n)) return;
|
|
@@ -2449,24 +2487,24 @@ import {
|
|
|
2449
2487
|
projectJson: n
|
|
2450
2488
|
});
|
|
2451
2489
|
} catch {}
|
|
2452
|
-
},
|
|
2453
|
-
let t =
|
|
2490
|
+
}, Pi = (e) => p(e, ".framework", "dist", "server", "appConfig.js"), Fi = async (e) => {
|
|
2491
|
+
let t = Pi(e), n = T(t) ? t : p(e, "app.config.ts");
|
|
2454
2492
|
try {
|
|
2455
2493
|
let e = (await import(_(n).href)).default;
|
|
2456
2494
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2457
2495
|
} catch {
|
|
2458
2496
|
return null;
|
|
2459
2497
|
}
|
|
2460
|
-
},
|
|
2461
|
-
let t = await
|
|
2498
|
+
}, Ii = async (e) => {
|
|
2499
|
+
let t = await Fi(e);
|
|
2462
2500
|
if (!t) return {
|
|
2463
2501
|
ran: !1,
|
|
2464
2502
|
exitCode: 0
|
|
2465
2503
|
};
|
|
2466
|
-
|
|
2504
|
+
Nn();
|
|
2467
2505
|
let n = qt();
|
|
2468
|
-
|
|
2469
|
-
let r = await
|
|
2506
|
+
fn(n), Z.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2507
|
+
let r = await Ei(e, t);
|
|
2470
2508
|
for (let e of r) Z.info("api wired", {
|
|
2471
2509
|
name: e.name,
|
|
2472
2510
|
pkg: e.pkg,
|
|
@@ -2485,12 +2523,12 @@ import {
|
|
|
2485
2523
|
log: Z,
|
|
2486
2524
|
generateTypes: !0
|
|
2487
2525
|
}), f = d.publicValues;
|
|
2488
|
-
await
|
|
2526
|
+
await Mi(e, t, r, f), Z.debug("generated framework entry files", { files: [
|
|
2489
2527
|
"index.html",
|
|
2490
2528
|
".framework/main.tsx",
|
|
2491
2529
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2492
2530
|
] });
|
|
2493
|
-
let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : t.port ?? 5173, _ = t.name ?? "unnamed", v = Ke("web", _, g), y =
|
|
2531
|
+
let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : t.port ?? 5173, _ = t.name ?? "unnamed", v = Ke("web", _, g), y = pr(_);
|
|
2494
2532
|
await We({
|
|
2495
2533
|
id: v,
|
|
2496
2534
|
name: _,
|
|
@@ -2499,10 +2537,10 @@ import {
|
|
|
2499
2537
|
pid: process.pid,
|
|
2500
2538
|
status: "booting",
|
|
2501
2539
|
logFile: y.path
|
|
2502
|
-
}).catch(() => {}), await
|
|
2540
|
+
}).catch(() => {}), await Ni(e, g);
|
|
2503
2541
|
let { pages: b, dirs: x } = await $(p(e, "src", "pages")), S = {
|
|
2504
2542
|
dirs: x,
|
|
2505
|
-
ssrRoutes:
|
|
2543
|
+
ssrRoutes: yi(b)
|
|
2506
2544
|
}, w = x.map((e) => ({
|
|
2507
2545
|
dir: e.dir,
|
|
2508
2546
|
hasLayout: e.hasLayout,
|
|
@@ -2514,7 +2552,7 @@ import {
|
|
|
2514
2552
|
pages: b
|
|
2515
2553
|
});
|
|
2516
2554
|
E.wrote && Z.debug("routes codegen wrote", { path: m(e, E.path) });
|
|
2517
|
-
let D = await Xe("vite", () => import("vite")), ee = (await import("@vitejs/plugin-react")).default,
|
|
2555
|
+
let D = await Xe("vite", () => import("vite")), ee = (await import("@vitejs/plugin-react")).default, te = (await import("@tailwindcss/vite")).default, k = p(e, ".framework"), A = p(e, "src"), ne = /* @__PURE__ */ new Set([
|
|
2518
2556
|
".framework",
|
|
2519
2557
|
"node_modules",
|
|
2520
2558
|
"dist",
|
|
@@ -2522,15 +2560,15 @@ import {
|
|
|
2522
2560
|
".vite",
|
|
2523
2561
|
".turbo",
|
|
2524
2562
|
".cache"
|
|
2525
|
-
]),
|
|
2563
|
+
]), re = {
|
|
2526
2564
|
name: "framework:watch-app-sources",
|
|
2527
2565
|
async configureServer(t) {
|
|
2528
2566
|
try {
|
|
2529
|
-
let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !
|
|
2567
|
+
let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !ne.has(e.name));
|
|
2530
2568
|
for (let r of n) t.watcher.add(p(e, r.name));
|
|
2531
|
-
n.length === 0 && t.watcher.add(
|
|
2569
|
+
n.length === 0 && t.watcher.add(A);
|
|
2532
2570
|
} catch {
|
|
2533
|
-
t.watcher.add(
|
|
2571
|
+
t.watcher.add(A);
|
|
2534
2572
|
}
|
|
2535
2573
|
try {
|
|
2536
2574
|
let n = await O.readFile(p(e, "package.json"), "utf8"), r = JSON.parse(n), i = Object.keys({
|
|
@@ -2538,7 +2576,7 @@ import {
|
|
|
2538
2576
|
...r.devDependencies
|
|
2539
2577
|
});
|
|
2540
2578
|
await Promise.all(i.map(async (n) => {
|
|
2541
|
-
let r = await
|
|
2579
|
+
let r = await xi(e, n);
|
|
2542
2580
|
if (!r) return;
|
|
2543
2581
|
let i = p(r, "src");
|
|
2544
2582
|
try {
|
|
@@ -2547,15 +2585,15 @@ import {
|
|
|
2547
2585
|
}));
|
|
2548
2586
|
} catch {}
|
|
2549
2587
|
}
|
|
2550
|
-
},
|
|
2588
|
+
}, j = p(e, "src", "pages"), M = (e) => e.endsWith(".tsx") && (e === j || e.startsWith(j + "/")), ie = (e) => e === j || e.startsWith(j + "/"), N = async (n) => {
|
|
2551
2589
|
try {
|
|
2552
2590
|
let i = Date.now();
|
|
2553
|
-
await
|
|
2554
|
-
let { pages: a, dirs: o } = await $(
|
|
2591
|
+
await Mi(e, t, r, f);
|
|
2592
|
+
let { pages: a, dirs: o } = await $(j);
|
|
2555
2593
|
await zt({
|
|
2556
2594
|
appRoot: e,
|
|
2557
2595
|
pages: a
|
|
2558
|
-
}), S.dirs = o, S.ssrRoutes =
|
|
2596
|
+
}), S.dirs = o, S.ssrRoutes = yi(a), Z.info("page tree regenerated", {
|
|
2559
2597
|
reason: n,
|
|
2560
2598
|
ms: Date.now() - i,
|
|
2561
2599
|
routes: S.ssrRoutes.length
|
|
@@ -2563,44 +2601,44 @@ import {
|
|
|
2563
2601
|
} catch (e) {
|
|
2564
2602
|
Z.error("page tree regen failed", { reason: n }, e);
|
|
2565
2603
|
}
|
|
2566
|
-
},
|
|
2604
|
+
}, P = {
|
|
2567
2605
|
name: "framework:regenerate-on-page-tree-change",
|
|
2568
2606
|
configureServer(t) {
|
|
2569
2607
|
let n = null, r = [], i = (e) => {
|
|
2570
2608
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
2571
2609
|
n = null;
|
|
2572
2610
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
2573
|
-
r.length = 0,
|
|
2611
|
+
r.length = 0, N(e);
|
|
2574
2612
|
}, 50);
|
|
2575
2613
|
};
|
|
2576
2614
|
t.watcher.on("add", (t) => {
|
|
2577
|
-
|
|
2615
|
+
M(t) && i(`add ${m(e, t)}`);
|
|
2578
2616
|
}), t.watcher.on("unlink", (t) => {
|
|
2579
|
-
|
|
2617
|
+
M(t) && i(`unlink ${m(e, t)}`);
|
|
2580
2618
|
}), t.watcher.on("addDir", (t) => {
|
|
2581
|
-
|
|
2619
|
+
ie(t) && i(`addDir ${m(e, t)}`);
|
|
2582
2620
|
}), t.watcher.on("unlinkDir", (t) => {
|
|
2583
|
-
|
|
2621
|
+
ie(t) && i(`unlinkDir ${m(e, t)}`);
|
|
2584
2622
|
});
|
|
2585
2623
|
}
|
|
2586
|
-
},
|
|
2587
|
-
if (!
|
|
2624
|
+
}, F = p(e, "app.config.ts"), ae = (e) => {
|
|
2625
|
+
if (!z(e.env)) return "";
|
|
2588
2626
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
2589
2627
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
2590
|
-
},
|
|
2628
|
+
}, I = (e, t) => {
|
|
2591
2629
|
let n = [];
|
|
2592
|
-
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"),
|
|
2593
|
-
},
|
|
2630
|
+
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), ae(e) !== ae(t) && n.push("env"), n;
|
|
2631
|
+
}, L = t, R = h(F), oe = {
|
|
2594
2632
|
name: "framework:watch-app-config",
|
|
2595
2633
|
async configureServer(t) {
|
|
2596
|
-
t.watcher.add(
|
|
2634
|
+
t.watcher.add(F), Z.info("watching app.config.ts for changes", { path: m(e, F) });
|
|
2597
2635
|
let n = async () => {
|
|
2598
2636
|
try {
|
|
2599
2637
|
try {
|
|
2600
|
-
let e = t.moduleGraph.getModuleById(
|
|
2638
|
+
let e = t.moduleGraph.getModuleById(F);
|
|
2601
2639
|
e && t.moduleGraph.invalidateModule(e);
|
|
2602
2640
|
} catch {}
|
|
2603
|
-
let e = (await t.ssrLoadModule(
|
|
2641
|
+
let e = (await t.ssrLoadModule(F, { fixStacktrace: !0 })).default;
|
|
2604
2642
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Z.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
|
|
2605
2643
|
} catch (e) {
|
|
2606
2644
|
return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
@@ -2619,17 +2657,17 @@ import {
|
|
|
2619
2657
|
theme: r.theme,
|
|
2620
2658
|
port: r.port,
|
|
2621
2659
|
name: r.name
|
|
2622
|
-
}), JSON.stringify(r) === JSON.stringify(
|
|
2660
|
+
}), JSON.stringify(r) === JSON.stringify(L)) {
|
|
2623
2661
|
Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2624
2662
|
return;
|
|
2625
2663
|
}
|
|
2626
|
-
let i =
|
|
2664
|
+
let i = I(L, r);
|
|
2627
2665
|
if (i.length > 0) {
|
|
2628
2666
|
Z.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
2629
2667
|
try {
|
|
2630
2668
|
await t.close();
|
|
2631
2669
|
} catch {}
|
|
2632
|
-
let e =
|
|
2670
|
+
let e = pe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
2633
2671
|
stdio: "inherit",
|
|
2634
2672
|
env: process.env,
|
|
2635
2673
|
cwd: process.cwd()
|
|
@@ -2645,7 +2683,7 @@ import {
|
|
|
2645
2683
|
}
|
|
2646
2684
|
try {
|
|
2647
2685
|
let n = Date.now();
|
|
2648
|
-
await
|
|
2686
|
+
await Mi(e, r, await Ei(e, r)), L = r, t.ws && t.ws.send({
|
|
2649
2687
|
type: "full-reload",
|
|
2650
2688
|
path: "*"
|
|
2651
2689
|
}), Z.info("app.config.ts soft-regen", {
|
|
@@ -2655,7 +2693,7 @@ import {
|
|
|
2655
2693
|
} catch (e) {
|
|
2656
2694
|
Z.error("app.config.ts soft-regen failed", {}, e);
|
|
2657
2695
|
}
|
|
2658
|
-
}, o = (e) => u(e) === "app.config.ts" ? e ===
|
|
2696
|
+
}, o = (e) => u(e) === "app.config.ts" ? e === F || h(e) === R : !1;
|
|
2659
2697
|
t.watcher.on("change", (e) => {
|
|
2660
2698
|
o(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), i());
|
|
2661
2699
|
}), t.watcher.on("add", (e) => {
|
|
@@ -2663,7 +2701,7 @@ import {
|
|
|
2663
2701
|
});
|
|
2664
2702
|
try {
|
|
2665
2703
|
let { watchFile: e } = await import("node:fs");
|
|
2666
|
-
e(
|
|
2704
|
+
e(F, { interval: 500 }, (e, t) => {
|
|
2667
2705
|
e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), i());
|
|
2668
2706
|
}), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
2669
2707
|
} catch (e) {
|
|
@@ -2674,18 +2712,18 @@ import {
|
|
|
2674
2712
|
onBeforeRestart: () => t.close()
|
|
2675
2713
|
});
|
|
2676
2714
|
}
|
|
2677
|
-
},
|
|
2715
|
+
}, se = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, B = 0, ce = {
|
|
2678
2716
|
name: "framework:suppress-api-hmr",
|
|
2679
2717
|
handleHotUpdate(e) {
|
|
2680
|
-
if (
|
|
2718
|
+
if (B += 1, se.test(e.file)) return [];
|
|
2681
2719
|
}
|
|
2682
|
-
},
|
|
2720
|
+
}, le = {
|
|
2683
2721
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
2684
2722
|
async configureServer(t) {
|
|
2685
2723
|
let n = /* @__PURE__ */ new Map();
|
|
2686
2724
|
for (let i of r) {
|
|
2687
2725
|
if (!i.proxyTarget) continue;
|
|
2688
|
-
let r = await
|
|
2726
|
+
let r = await xi(e, i.pkg);
|
|
2689
2727
|
if (!r) continue;
|
|
2690
2728
|
let a = p(r, "rpcGroup.generated.ts");
|
|
2691
2729
|
try {
|
|
@@ -2713,7 +2751,7 @@ import {
|
|
|
2713
2751
|
if (r !== null) {
|
|
2714
2752
|
a = !0, Z.info(`rpcGroup changed (${m(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
|
|
2715
2753
|
try {
|
|
2716
|
-
await O.rm(p(
|
|
2754
|
+
await O.rm(p(k, ".vite", "deps"), {
|
|
2717
2755
|
recursive: !0,
|
|
2718
2756
|
force: !0
|
|
2719
2757
|
}), await t.restart(!0);
|
|
@@ -2728,38 +2766,38 @@ import {
|
|
|
2728
2766
|
};
|
|
2729
2767
|
t.watcher.on("change", s), t.watcher.on("add", s);
|
|
2730
2768
|
}
|
|
2731
|
-
},
|
|
2769
|
+
}, V = {}, ue = (e) => (t) => {
|
|
2732
2770
|
t.on("proxyReq", (t, n) => {
|
|
2733
|
-
|
|
2771
|
+
jn(t, n, {
|
|
2734
2772
|
target: e,
|
|
2735
2773
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
2736
2774
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
2737
|
-
isLoopback:
|
|
2775
|
+
isLoopback: i
|
|
2738
2776
|
});
|
|
2739
2777
|
});
|
|
2740
2778
|
};
|
|
2741
2779
|
for (let e of r) {
|
|
2742
2780
|
if (!e.proxyTarget) continue;
|
|
2743
|
-
|
|
2781
|
+
V[e.browserWsUrl] = {
|
|
2744
2782
|
target: e.proxyTarget,
|
|
2745
2783
|
ws: !0,
|
|
2746
2784
|
changeOrigin: !0,
|
|
2747
2785
|
...e.wsPath ? {} : { rewrite: () => "/ws" }
|
|
2748
2786
|
};
|
|
2749
2787
|
let t = e.proxyTarget.replace(/^ws/, "http");
|
|
2750
|
-
|
|
2788
|
+
V[`/_voltro/api/${e.name}`] = {
|
|
2751
2789
|
target: t,
|
|
2752
2790
|
changeOrigin: !0,
|
|
2753
2791
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
2754
|
-
configure:
|
|
2792
|
+
configure: ue(t)
|
|
2755
2793
|
};
|
|
2756
2794
|
}
|
|
2757
2795
|
for (let [e, n] of Object.entries(t.proxies ?? {})) {
|
|
2758
|
-
if (
|
|
2796
|
+
if (V[e]) {
|
|
2759
2797
|
Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
2760
2798
|
continue;
|
|
2761
2799
|
}
|
|
2762
|
-
|
|
2800
|
+
V[e] = {
|
|
2763
2801
|
target: n.target,
|
|
2764
2802
|
changeOrigin: n.changeOrigin ?? !0,
|
|
2765
2803
|
...n.rewrite === void 0 ? {} : { rewrite: (t) => t.replace(RegExp(`^${e}`), n.rewrite) }
|
|
@@ -2769,7 +2807,7 @@ import {
|
|
|
2769
2807
|
...n.rewrite === void 0 ? {} : { rewrite: n.rewrite }
|
|
2770
2808
|
});
|
|
2771
2809
|
}
|
|
2772
|
-
let
|
|
2810
|
+
let de = {
|
|
2773
2811
|
name: "framework:inspect",
|
|
2774
2812
|
configureServer(r) {
|
|
2775
2813
|
let u = null, d = async () => {
|
|
@@ -2781,7 +2819,7 @@ import {
|
|
|
2781
2819
|
pattern: n.pattern,
|
|
2782
2820
|
file: n.file,
|
|
2783
2821
|
dirChain: n.dirChain,
|
|
2784
|
-
renderMode:
|
|
2822
|
+
renderMode: Qn(i, p("src", "pages", n.file)),
|
|
2785
2823
|
interactive: i.interactive ?? "full",
|
|
2786
2824
|
tenantAware: i.tenantAware === !0,
|
|
2787
2825
|
revalidateMs: ct(i.revalidate),
|
|
@@ -2812,65 +2850,65 @@ import {
|
|
|
2812
2850
|
}), r();
|
|
2813
2851
|
}), r.middlewares.use((t, n, r) => {
|
|
2814
2852
|
if (t.method !== "GET" && t.method !== "HEAD") return r();
|
|
2815
|
-
let { pathname: i } =
|
|
2853
|
+
let { pathname: i } = Ir(t.url ?? "/");
|
|
2816
2854
|
if (i !== "/robots.txt" || T(p(e, "public", "robots.txt"))) return r();
|
|
2817
2855
|
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(Gt({ indexable: !1 }));
|
|
2818
2856
|
}), t.name === "voltroDashboard" && r.middlewares.use(async (e, t, n) => {
|
|
2819
|
-
let r = e.url ?? "",
|
|
2820
|
-
if (
|
|
2857
|
+
let r = e.url ?? "", a = r.split("?")[0];
|
|
2858
|
+
if (a === "/api/dashboard/proxy") {
|
|
2821
2859
|
let n = new URL(r, "http://x").searchParams.get("target");
|
|
2822
2860
|
if (!n) {
|
|
2823
2861
|
t.statusCode = 400, t.end("missing ?target=");
|
|
2824
2862
|
return;
|
|
2825
2863
|
}
|
|
2826
|
-
if (!
|
|
2864
|
+
if (!o(n)) {
|
|
2827
2865
|
t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
|
|
2828
2866
|
return;
|
|
2829
2867
|
}
|
|
2830
2868
|
try {
|
|
2831
2869
|
let r = { accept: String(e.headers.accept ?? "application/json") };
|
|
2832
|
-
e.headers.authorization ? r.authorization = String(e.headers.authorization) :
|
|
2833
|
-
let
|
|
2870
|
+
e.headers.authorization ? r.authorization = String(e.headers.authorization) : i(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
|
|
2871
|
+
let a;
|
|
2834
2872
|
if (e.method && e.method !== "GET" && e.method !== "HEAD") {
|
|
2835
2873
|
let t = [];
|
|
2836
2874
|
for await (let n of e) t.push(n);
|
|
2837
|
-
|
|
2875
|
+
a = Buffer.concat(t);
|
|
2838
2876
|
let n = e.headers["content-type"];
|
|
2839
2877
|
n && (r["content-type"] = Array.isArray(n) ? n[0] : String(n));
|
|
2840
2878
|
}
|
|
2841
|
-
let
|
|
2879
|
+
let o = await fetch(n, {
|
|
2842
2880
|
redirect: "manual",
|
|
2843
2881
|
...e.method ? { method: e.method } : {},
|
|
2844
2882
|
headers: r,
|
|
2845
|
-
...
|
|
2846
|
-
}), s = Buffer.from(await
|
|
2847
|
-
t.statusCode =
|
|
2883
|
+
...a && a.length ? { body: new Uint8Array(a.buffer, a.byteOffset, a.byteLength) } : {}
|
|
2884
|
+
}), s = Buffer.from(await o.arrayBuffer());
|
|
2885
|
+
t.statusCode = o.status, t.setHeader("content-type", o.headers.get("content-type") ?? "application/octet-stream"), t.setHeader("content-length", String(s.length)), t.end(s);
|
|
2848
2886
|
} catch (e) {
|
|
2849
2887
|
t.statusCode = 502, t.end(`proxy error: ${e.message}`);
|
|
2850
2888
|
}
|
|
2851
2889
|
return;
|
|
2852
2890
|
}
|
|
2853
|
-
if (
|
|
2891
|
+
if (a === "/api/dashboard/proxy/stream") {
|
|
2854
2892
|
let n = new URL(r, "http://x").searchParams.get("target");
|
|
2855
2893
|
if (!n) {
|
|
2856
2894
|
t.statusCode = 400, t.end("missing ?target=");
|
|
2857
2895
|
return;
|
|
2858
2896
|
}
|
|
2859
|
-
if (!
|
|
2897
|
+
if (!o(n)) {
|
|
2860
2898
|
t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
|
|
2861
2899
|
return;
|
|
2862
2900
|
}
|
|
2863
|
-
let
|
|
2864
|
-
e.on("close", () =>
|
|
2901
|
+
let a = new AbortController();
|
|
2902
|
+
e.on("close", () => a.abort()), t.on("close", () => a.abort());
|
|
2865
2903
|
try {
|
|
2866
2904
|
let r = await fetch(n, {
|
|
2867
2905
|
redirect: "manual",
|
|
2868
2906
|
method: "GET",
|
|
2869
2907
|
headers: {
|
|
2870
2908
|
accept: "text/event-stream",
|
|
2871
|
-
...e.headers.authorization ? { authorization: String(e.headers.authorization) } :
|
|
2909
|
+
...e.headers.authorization ? { authorization: String(e.headers.authorization) } : i(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
|
|
2872
2910
|
},
|
|
2873
|
-
signal:
|
|
2911
|
+
signal: a.signal
|
|
2874
2912
|
});
|
|
2875
2913
|
if (!r.ok || !r.body) {
|
|
2876
2914
|
t.statusCode = r.status, t.end(`upstream ${r.status}`);
|
|
@@ -2882,15 +2920,15 @@ import {
|
|
|
2882
2920
|
connection: "keep-alive",
|
|
2883
2921
|
"x-accel-buffering": "no"
|
|
2884
2922
|
});
|
|
2885
|
-
let
|
|
2923
|
+
let o = r.body.getReader();
|
|
2886
2924
|
try {
|
|
2887
2925
|
for (;;) {
|
|
2888
|
-
let { done: e, value: n } = await
|
|
2926
|
+
let { done: e, value: n } = await o.read();
|
|
2889
2927
|
if (e) break;
|
|
2890
2928
|
n && t.write(Buffer.from(n));
|
|
2891
2929
|
}
|
|
2892
2930
|
} finally {
|
|
2893
|
-
|
|
2931
|
+
o.releaseLock(), t.end();
|
|
2894
2932
|
}
|
|
2895
2933
|
} catch (e) {
|
|
2896
2934
|
e.name !== "AbortError" && (t.statusCode = 502, t.end(`proxy stream error: ${e.message}`));
|
|
@@ -2898,32 +2936,32 @@ import {
|
|
|
2898
2936
|
return;
|
|
2899
2937
|
}
|
|
2900
2938
|
n();
|
|
2901
|
-
}), r.middlewares.use(async (e, r,
|
|
2939
|
+
}), r.middlewares.use(async (e, r, i) => {
|
|
2902
2940
|
let o = e.url ?? "";
|
|
2903
|
-
if (!o.startsWith("/_voltro/inspect")) return
|
|
2941
|
+
if (!o.startsWith("/_voltro/inspect")) return i();
|
|
2904
2942
|
let u = {};
|
|
2905
2943
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (u[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
2906
2944
|
let f = o.split("?")[0];
|
|
2907
2945
|
if (e.method === "GET" && (f === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
|
|
2908
|
-
let e =
|
|
2946
|
+
let e = a(u.origin), t = Tn(o, sn(), u);
|
|
2909
2947
|
r.statusCode = t.status, r.setHeader("content-type", t.contentType);
|
|
2910
2948
|
for (let [t, n] of Object.entries(e)) r.setHeader(t, n);
|
|
2911
2949
|
r.end(t.body);
|
|
2912
2950
|
return;
|
|
2913
2951
|
}
|
|
2914
2952
|
if (e.method === "POST" && f === "/_voltro/inspect/clientLog") {
|
|
2915
|
-
let t =
|
|
2916
|
-
if (
|
|
2953
|
+
let t = a(u.origin);
|
|
2954
|
+
if (c()) {
|
|
2917
2955
|
r.statusCode = 503, r.setHeader("content-type", "application/json");
|
|
2918
2956
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2919
2957
|
r.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
2920
2958
|
return;
|
|
2921
2959
|
}
|
|
2922
|
-
let
|
|
2960
|
+
let i = "";
|
|
2923
2961
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
2924
|
-
|
|
2962
|
+
i += e;
|
|
2925
2963
|
}), e.on("end", () => {
|
|
2926
|
-
let e =
|
|
2964
|
+
let e = yn(i, n);
|
|
2927
2965
|
r.statusCode = e.status, r.setHeader("content-type", e.contentType);
|
|
2928
2966
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2929
2967
|
r.end(e.body);
|
|
@@ -2933,28 +2971,28 @@ import {
|
|
|
2933
2971
|
return;
|
|
2934
2972
|
}
|
|
2935
2973
|
if (f === "/_voltro/inspect/stream") {
|
|
2936
|
-
let t =
|
|
2937
|
-
if (
|
|
2974
|
+
let t = a(u.origin);
|
|
2975
|
+
if (c()) {
|
|
2938
2976
|
r.statusCode = 503, r.setHeader("content-type", "application/json");
|
|
2939
2977
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2940
2978
|
r.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
2941
2979
|
return;
|
|
2942
2980
|
}
|
|
2943
|
-
let
|
|
2944
|
-
if (!
|
|
2981
|
+
let i = s(u, "GET");
|
|
2982
|
+
if (!i.ok) {
|
|
2945
2983
|
r.statusCode = 401, r.setHeader("content-type", "application/json");
|
|
2946
2984
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2947
2985
|
r.end(JSON.stringify({
|
|
2948
2986
|
error: "unauthorized",
|
|
2949
|
-
reason:
|
|
2987
|
+
reason: i.reason
|
|
2950
2988
|
}));
|
|
2951
2989
|
return;
|
|
2952
2990
|
}
|
|
2953
2991
|
r.statusCode = 200, r.setHeader("content-type", "text/event-stream; charset=utf-8"), r.setHeader("cache-control", "no-cache, no-transform"), r.setHeader("connection", "keep-alive"), r.setHeader("x-accel-buffering", "no");
|
|
2954
2992
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2955
2993
|
r.flushHeaders?.(), r.write("retry: 5000\n\n");
|
|
2956
|
-
let
|
|
2957
|
-
if (!(
|
|
2994
|
+
let l = o.indexOf("?");
|
|
2995
|
+
if (!(l !== -1 && new URLSearchParams(o.slice(l + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(Jt(e));
|
|
2958
2996
|
let d = n.subscribe((e) => {
|
|
2959
2997
|
try {
|
|
2960
2998
|
r.write(Jt(e));
|
|
@@ -2970,11 +3008,11 @@ import {
|
|
|
2970
3008
|
return;
|
|
2971
3009
|
}
|
|
2972
3010
|
try {
|
|
2973
|
-
let n =
|
|
3011
|
+
let n = l(o, {
|
|
2974
3012
|
kind: "web",
|
|
2975
3013
|
meta: {
|
|
2976
3014
|
name: t.name ?? "(unnamed)",
|
|
2977
|
-
voltroVersion:
|
|
3015
|
+
voltroVersion: $r,
|
|
2978
3016
|
port: g,
|
|
2979
3017
|
mode: "dev",
|
|
2980
3018
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -2992,9 +3030,9 @@ import {
|
|
|
2992
3030
|
size: 0,
|
|
2993
3031
|
entries: []
|
|
2994
3032
|
}),
|
|
2995
|
-
env: () => at(t.name ?? "app", { contract:
|
|
3033
|
+
env: () => at(t.name ?? "app", { contract: z(t.env) ? t.env : void 0 })
|
|
2996
3034
|
}, u, { method: e.method ?? "GET" });
|
|
2997
|
-
if (n === null) return
|
|
3035
|
+
if (n === null) return i();
|
|
2998
3036
|
r.statusCode = n.status, r.setHeader("content-type", n.contentType);
|
|
2999
3037
|
for (let [e, t] of Object.entries(n.headers ?? {})) r.setHeader(e, t);
|
|
3000
3038
|
r.end(n.body);
|
|
@@ -3003,7 +3041,7 @@ import {
|
|
|
3003
3041
|
}
|
|
3004
3042
|
});
|
|
3005
3043
|
}
|
|
3006
|
-
},
|
|
3044
|
+
}, me = t.name === "voltroDashboard" ? {
|
|
3007
3045
|
name: "framework:dashboard-registry",
|
|
3008
3046
|
configureServer(e) {
|
|
3009
3047
|
e.middlewares.use(async (e, t, n) => {
|
|
@@ -3016,21 +3054,25 @@ import {
|
|
|
3016
3054
|
}
|
|
3017
3055
|
});
|
|
3018
3056
|
}
|
|
3019
|
-
} : null,
|
|
3057
|
+
} : null, he = /* @__PURE__ */ new Set(), H = (e, t, n, r, i, a = !1) => {
|
|
3058
|
+
let o = zr(i, a, t) ?? "";
|
|
3020
3059
|
if (Z.error(`${t} render failed`, {
|
|
3021
3060
|
pathname: n,
|
|
3022
3061
|
pattern: r,
|
|
3023
|
-
cause:
|
|
3062
|
+
cause: Zt(i) + o
|
|
3024
3063
|
}), e.headersSent) {
|
|
3025
3064
|
e.end();
|
|
3026
3065
|
return;
|
|
3027
3066
|
}
|
|
3028
3067
|
e.writeHead(500, {
|
|
3029
3068
|
"content-type": "text/plain; charset=utf-8",
|
|
3030
|
-
"x-voltro-rendered-by": `${t}-failed
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3069
|
+
"x-voltro-rendered-by": `${t}-failed`,
|
|
3070
|
+
"x-voltro-ssr-generation": String(B)
|
|
3071
|
+
});
|
|
3072
|
+
let s = B === 0 ? "" : `\n[voltro] this process has absorbed ${B} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
|
|
3073
|
+
e.end(`${t} render failed for ${n}\n\n${Zt(i)}\n${o}\n${s}`);
|
|
3074
|
+
}, U = Dt(), ge = kt({
|
|
3075
|
+
limit: U,
|
|
3034
3076
|
onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
|
|
3035
3077
|
onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
3036
3078
|
id: e,
|
|
@@ -3038,11 +3080,11 @@ import {
|
|
|
3038
3080
|
...n ? { failed: !0 } : {}
|
|
3039
3081
|
})
|
|
3040
3082
|
});
|
|
3041
|
-
Z.debug(`ssr cold-compile concurrency ${
|
|
3042
|
-
let
|
|
3083
|
+
Z.debug(`ssr cold-compile concurrency ${U}`, { concurrency: U });
|
|
3084
|
+
let W = null, _e = async () => (W === null && (W = await O.readFile(p(e, ".framework", "index.html"), "utf8")), W), ve = {
|
|
3043
3085
|
name: "framework:ssr",
|
|
3044
3086
|
configureServer(n) {
|
|
3045
|
-
let i = (e) =>
|
|
3087
|
+
let i = (e) => ge.load(e, async () => await n.ssrLoadModule(e)), a, o = () => {
|
|
3046
3088
|
if (a !== void 0) return a;
|
|
3047
3089
|
let n = t.locales ?? [], r = t.defaultLocale ?? n[0] ?? "en";
|
|
3048
3090
|
return n.length === 0 ? (a = Promise.resolve(() => void 0), a) : (a = (async () => {
|
|
@@ -3064,11 +3106,11 @@ import {
|
|
|
3064
3106
|
if (a.method !== "GET" && a.method !== "HEAD") return c();
|
|
3065
3107
|
let l = a.url ?? "/";
|
|
3066
3108
|
l.indexOf("?");
|
|
3067
|
-
let { pathname: u, search: d } =
|
|
3109
|
+
let { pathname: u, search: d } = Ir(l);
|
|
3068
3110
|
if (u.startsWith("/@") || u.startsWith("/node_modules/") || u.startsWith("/.framework/") || u.startsWith("/_voltro/") || u === "/main.tsx" || u === "/index.html" || u === "/sw.js" || u === "/favicon.ico" || u === "/robots.txt" || /\.[a-z0-9]+$/i.test(u)) return c();
|
|
3069
|
-
let f =
|
|
3111
|
+
let f = bi(u, S.ssrRoutes);
|
|
3070
3112
|
if (!f) return c();
|
|
3071
|
-
let m = !
|
|
3113
|
+
let m = !he.has(f.route.pattern), h = Date.now();
|
|
3072
3114
|
m && Z.info(`ssr compiling ${f.route.pattern}`, {
|
|
3073
3115
|
pattern: f.route.pattern,
|
|
3074
3116
|
pathname: u
|
|
@@ -3086,18 +3128,18 @@ import {
|
|
|
3086
3128
|
}
|
|
3087
3129
|
for (let e of i.importedModules ?? []) e.id && await v(e.id, t, r);
|
|
3088
3130
|
}
|
|
3089
|
-
};
|
|
3131
|
+
}, y = !1;
|
|
3090
3132
|
try {
|
|
3091
|
-
let
|
|
3092
|
-
if (
|
|
3093
|
-
let
|
|
3094
|
-
for (let [e, t] of Object.entries(a.headers ?? {})) typeof t == "string" ?
|
|
3095
|
-
let
|
|
3096
|
-
s.once("close",
|
|
3097
|
-
let
|
|
3133
|
+
let b = await _("loadPage", async () => await i(p(e, "src", "pages", f.route.file))), x = Qn(b, p("src", "pages", f.route.file)), C = mi(S.dirs, f.route.dirChain), w = x === "spa" && C.some((e) => e.hasLayout);
|
|
3134
|
+
if (x !== "ssr" && x !== "isr" && !w) return c();
|
|
3135
|
+
let T = {};
|
|
3136
|
+
for (let [e, t] of Object.entries(a.headers ?? {})) typeof t == "string" ? T[e] = t : Array.isArray(t) && (T[e] = t.join(", "));
|
|
3137
|
+
let E = ji(Ai(r[0], { allowDevProxy: !0 }), T.cookie, { apiName: r[0]?.name }), D = new AbortController(), O = () => D.abort();
|
|
3138
|
+
s.once("close", O);
|
|
3139
|
+
let ee = null, te = [], k = {};
|
|
3098
3140
|
try {
|
|
3099
|
-
(await i("@voltro/web/ssr")).beginStoreSeeds(), {chain:
|
|
3100
|
-
entries:
|
|
3141
|
+
(await i("@voltro/web/ssr")).beginStoreSeeds(), {chain: te, segmentLoaderData: k} = await _("loadChain", () => hi({
|
|
3142
|
+
entries: C,
|
|
3101
3143
|
loadLayout: (t) => i(p(e, "src", "pages", t.dir, "layout.tsx")),
|
|
3102
3144
|
loadError: (t) => i(p(e, "src", "pages", t.dir, "error.tsx")),
|
|
3103
3145
|
loadPending: (t) => i(p(e, "src", "pages", t.dir, "loading.tsx")),
|
|
@@ -3105,28 +3147,28 @@ import {
|
|
|
3105
3147
|
params: f.params,
|
|
3106
3148
|
pathname: u,
|
|
3107
3149
|
search: d,
|
|
3108
|
-
signal:
|
|
3109
|
-
headers:
|
|
3110
|
-
query:
|
|
3150
|
+
signal: D.signal,
|
|
3151
|
+
headers: T,
|
|
3152
|
+
query: E
|
|
3111
3153
|
}
|
|
3112
3154
|
}));
|
|
3113
|
-
let t =
|
|
3114
|
-
typeof t == "function" && !
|
|
3155
|
+
let t = b.loader;
|
|
3156
|
+
typeof t == "function" && !w && (ee = await _("loader", () => t({
|
|
3115
3157
|
params: f.params,
|
|
3116
3158
|
pathname: u,
|
|
3117
3159
|
search: d,
|
|
3118
|
-
signal:
|
|
3119
|
-
headers:
|
|
3120
|
-
query:
|
|
3160
|
+
signal: D.signal,
|
|
3161
|
+
headers: T,
|
|
3162
|
+
query: E
|
|
3121
3163
|
})));
|
|
3122
3164
|
} finally {
|
|
3123
|
-
s.off("close",
|
|
3165
|
+
s.off("close", O);
|
|
3124
3166
|
}
|
|
3125
3167
|
let A = await _("loadSsrHelpers", async () => await i("@voltro/web/ssr"));
|
|
3126
|
-
|
|
3127
|
-
pageMod:
|
|
3168
|
+
w || await Zr({
|
|
3169
|
+
pageMod: b,
|
|
3128
3170
|
params: f.params,
|
|
3129
|
-
query:
|
|
3171
|
+
query: E,
|
|
3130
3172
|
apiName: r[0]?.name,
|
|
3131
3173
|
seed: A.seedPreloadedSubscription,
|
|
3132
3174
|
onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
|
|
@@ -3135,116 +3177,120 @@ import {
|
|
|
3135
3177
|
pathname: u
|
|
3136
3178
|
}, n)
|
|
3137
3179
|
});
|
|
3138
|
-
let
|
|
3180
|
+
let ne = {
|
|
3139
3181
|
pattern: f.route.pattern,
|
|
3140
|
-
Component:
|
|
3141
|
-
meta:
|
|
3142
|
-
loader:
|
|
3143
|
-
ErrorBoundary:
|
|
3144
|
-
Pending:
|
|
3145
|
-
renderMode:
|
|
3146
|
-
chain:
|
|
3147
|
-
},
|
|
3148
|
-
cookies: A.parseCookieHeader(
|
|
3149
|
-
headers:
|
|
3182
|
+
Component: b.default,
|
|
3183
|
+
meta: b.meta,
|
|
3184
|
+
loader: b.loader,
|
|
3185
|
+
ErrorBoundary: b.ErrorBoundary,
|
|
3186
|
+
Pending: b.Pending,
|
|
3187
|
+
renderMode: x,
|
|
3188
|
+
chain: te
|
|
3189
|
+
}, re = {
|
|
3190
|
+
cookies: A.parseCookieHeader(T.cookie),
|
|
3191
|
+
headers: T,
|
|
3150
3192
|
url: l
|
|
3151
|
-
},
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3193
|
+
}, j = b.interactive ?? "full", M = (await o())(T.cookie, T["accept-language"]);
|
|
3194
|
+
y = M !== void 0;
|
|
3195
|
+
let ie = M ? {
|
|
3196
|
+
outerWrap: M.outerWrap,
|
|
3197
|
+
locale: M.locale
|
|
3198
|
+
} : {}, N = w ? Nr({
|
|
3155
3199
|
helpers: A,
|
|
3156
3200
|
page: `src/pages/${f.route.file}`,
|
|
3157
|
-
interactive:
|
|
3201
|
+
interactive: j,
|
|
3158
3202
|
delivery: "stream",
|
|
3159
3203
|
renderInput: {
|
|
3160
|
-
descriptor:
|
|
3204
|
+
descriptor: ne,
|
|
3161
3205
|
params: f.params,
|
|
3162
3206
|
pathname: u,
|
|
3207
|
+
search: d,
|
|
3163
3208
|
segmentLoaderData: k,
|
|
3164
|
-
requestContext:
|
|
3165
|
-
...
|
|
3209
|
+
requestContext: re,
|
|
3210
|
+
...ie
|
|
3166
3211
|
}
|
|
3167
|
-
}) : null,
|
|
3212
|
+
}) : null, P = w ? null : Mr({
|
|
3168
3213
|
helpers: A,
|
|
3169
3214
|
page: `src/pages/${f.route.file}`,
|
|
3170
3215
|
pathname: u,
|
|
3171
|
-
renderMode:
|
|
3172
|
-
interactive:
|
|
3173
|
-
loaderData:
|
|
3216
|
+
renderMode: x,
|
|
3217
|
+
interactive: j,
|
|
3218
|
+
loaderData: ee,
|
|
3174
3219
|
segmentLoaderData: k,
|
|
3175
|
-
pageLoaderRan: typeof
|
|
3176
|
-
}),
|
|
3220
|
+
pageLoaderRan: typeof b.loader == "function"
|
|
3221
|
+
}), F = [];
|
|
3177
3222
|
await _("collectCss", async () => {
|
|
3178
3223
|
let t = /* @__PURE__ */ new Set(), n = [
|
|
3179
3224
|
p(e, "src", "pages", f.route.file),
|
|
3180
|
-
...
|
|
3225
|
+
...C.flatMap((t) => [
|
|
3181
3226
|
...t.hasLayout ? [p(e, "src", "pages", t.dir, "layout.tsx")] : [],
|
|
3182
3227
|
...t.hasError ? [p(e, "src", "pages", t.dir, "error.tsx")] : [],
|
|
3183
3228
|
...t.hasPending ? [p(e, "src", "pages", t.dir, "loading.tsx")] : []
|
|
3184
3229
|
]),
|
|
3185
3230
|
p(e, ".framework", "main.tsx")
|
|
3186
3231
|
];
|
|
3187
|
-
for (let e of n) await v(e, t,
|
|
3232
|
+
for (let e of n) await v(e, t, F);
|
|
3188
3233
|
});
|
|
3189
|
-
let
|
|
3190
|
-
if (
|
|
3191
|
-
let e = (e) =>
|
|
3234
|
+
let ae = await _("readShell", _e), I = await _("transformShell", () => n.transformIndexHtml(l, ae)), L = F.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), R = M?.locale ?? re.cookies["voltro:locale"] ?? t.defaultLocale ?? (t.locales ?? [])[0] ?? "en", oe = Date.now();
|
|
3235
|
+
if (N) {
|
|
3236
|
+
let e = (e) => Fr({
|
|
3192
3237
|
helpers: A,
|
|
3193
|
-
prepared:
|
|
3238
|
+
prepared: N,
|
|
3194
3239
|
meta: e,
|
|
3195
|
-
interactive:
|
|
3196
|
-
extra: [
|
|
3240
|
+
interactive: j,
|
|
3241
|
+
extra: [L]
|
|
3197
3242
|
});
|
|
3198
|
-
if (
|
|
3243
|
+
if (N.hasDeferred) Jr({
|
|
3199
3244
|
res: s,
|
|
3200
|
-
shell:
|
|
3201
|
-
shell:
|
|
3245
|
+
shell: Kr({
|
|
3246
|
+
shell: I,
|
|
3202
3247
|
inlineModuleScriptsAsync: !0
|
|
3203
3248
|
}),
|
|
3204
|
-
htmlLang:
|
|
3249
|
+
htmlLang: R,
|
|
3205
3250
|
headers: {
|
|
3206
3251
|
"content-type": "text/html; charset=utf-8",
|
|
3207
3252
|
"x-voltro-rendered-by": "spa-shell-dev"
|
|
3208
3253
|
},
|
|
3209
3254
|
headInjection: e,
|
|
3210
3255
|
render: (e) => A.renderPageToStream({
|
|
3211
|
-
...
|
|
3256
|
+
...N.renderInput,
|
|
3212
3257
|
...e
|
|
3213
3258
|
}),
|
|
3214
3259
|
onShellError: (e) => {
|
|
3215
|
-
|
|
3260
|
+
H(s, "spa-shell-dev", u, f.route.pattern, e, y);
|
|
3216
3261
|
}
|
|
3217
3262
|
});
|
|
3218
3263
|
else {
|
|
3219
|
-
let t =
|
|
3264
|
+
let t = Pr({
|
|
3220
3265
|
helpers: A,
|
|
3221
|
-
prepared:
|
|
3222
|
-
}), n =
|
|
3266
|
+
prepared: N
|
|
3267
|
+
}), n = I.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="${R}"`);
|
|
3223
3268
|
s.statusCode = 200, s.setHeader("content-type", "text/html; charset=utf-8"), s.setHeader("x-voltro-rendered-by", "spa-shell-dev"), s.end(n);
|
|
3224
3269
|
}
|
|
3225
|
-
} else if (
|
|
3270
|
+
} else if (P) {
|
|
3226
3271
|
let e = (e) => [
|
|
3227
|
-
|
|
3272
|
+
L,
|
|
3228
3273
|
A.renderMetaToHtml(e),
|
|
3229
|
-
`<meta name="voltro-interactive" content="${
|
|
3230
|
-
...
|
|
3231
|
-
A.renderRouterStateScript(
|
|
3274
|
+
`<meta name="voltro-interactive" content="${j}" />`,
|
|
3275
|
+
...P.hasDeferred ? [A.renderDeferredRegistryScript()] : [],
|
|
3276
|
+
A.renderRouterStateScript(P.stateInput)
|
|
3232
3277
|
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3233
|
-
descriptor:
|
|
3278
|
+
descriptor: ne,
|
|
3234
3279
|
params: f.params,
|
|
3235
3280
|
pathname: u,
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3281
|
+
search: d,
|
|
3282
|
+
loaderData: P.loaderData,
|
|
3283
|
+
segmentLoaderData: P.segmentLoaderData,
|
|
3284
|
+
requestContext: re,
|
|
3285
|
+
...ie
|
|
3240
3286
|
};
|
|
3241
|
-
if (
|
|
3287
|
+
if (x === "ssr" && j === "full") Jr({
|
|
3242
3288
|
res: s,
|
|
3243
|
-
shell:
|
|
3244
|
-
shell:
|
|
3289
|
+
shell: Kr({
|
|
3290
|
+
shell: I,
|
|
3245
3291
|
inlineModuleScriptsAsync: !0
|
|
3246
3292
|
}),
|
|
3247
|
-
htmlLang:
|
|
3293
|
+
htmlLang: R,
|
|
3248
3294
|
headers: {
|
|
3249
3295
|
"content-type": "text/html; charset=utf-8",
|
|
3250
3296
|
"x-voltro-rendered-by": "ssr-dev"
|
|
@@ -3255,59 +3301,59 @@ import {
|
|
|
3255
3301
|
...e
|
|
3256
3302
|
}),
|
|
3257
3303
|
onShellError: (e) => {
|
|
3258
|
-
|
|
3304
|
+
H(s, "ssr-dev", u, f.route.pattern, e, y);
|
|
3259
3305
|
}
|
|
3260
3306
|
});
|
|
3261
3307
|
else {
|
|
3262
|
-
let { html: n, meta: r } = A.renderPageToHtml(t), i =
|
|
3308
|
+
let { html: n, meta: r } = A.renderPageToHtml(t), i = I.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${R}"`);
|
|
3263
3309
|
s.statusCode = 200, s.setHeader("content-type", "text/html; charset=utf-8"), s.setHeader("x-voltro-rendered-by", "ssr-dev"), s.end(i);
|
|
3264
3310
|
}
|
|
3265
3311
|
}
|
|
3266
|
-
g.render = Date.now() -
|
|
3267
|
-
let
|
|
3268
|
-
m ? (
|
|
3312
|
+
g.render = Date.now() - oe;
|
|
3313
|
+
let z = Date.now() - h;
|
|
3314
|
+
m ? (he.add(f.route.pattern), Z.info(`ssr compiled ${f.route.pattern} in ${z}ms`, {
|
|
3269
3315
|
pattern: f.route.pattern,
|
|
3270
3316
|
pathname: u,
|
|
3271
|
-
elapsedMs:
|
|
3317
|
+
elapsedMs: z,
|
|
3272
3318
|
cold: !0,
|
|
3273
3319
|
phases: g
|
|
3274
|
-
})) :
|
|
3320
|
+
})) : z > 200 && Z.info(`ssr rendered ${u} in ${z}ms`, {
|
|
3275
3321
|
pattern: f.route.pattern,
|
|
3276
3322
|
pathname: u,
|
|
3277
|
-
elapsedMs:
|
|
3323
|
+
elapsedMs: z,
|
|
3278
3324
|
cold: !1,
|
|
3279
3325
|
phases: g
|
|
3280
3326
|
});
|
|
3281
3327
|
} catch (e) {
|
|
3282
|
-
if (
|
|
3328
|
+
if (Ar(e)) {
|
|
3283
3329
|
Z.error("ssr-dev render refused", {
|
|
3284
3330
|
pathname: u,
|
|
3285
3331
|
pattern: f.route.pattern
|
|
3286
3332
|
}, e), s.statusCode = 500, s.setHeader("content-type", "text/plain; charset=utf-8"), s.end(e.message);
|
|
3287
3333
|
return;
|
|
3288
3334
|
}
|
|
3289
|
-
let t =
|
|
3335
|
+
let t = jr(e);
|
|
3290
3336
|
if (t) {
|
|
3291
3337
|
s.statusCode = t.status;
|
|
3292
3338
|
for (let [e, n] of Object.entries(t.headers)) s.setHeader(e, String(n));
|
|
3293
3339
|
s.end(t.body);
|
|
3294
3340
|
return;
|
|
3295
3341
|
}
|
|
3296
|
-
|
|
3342
|
+
H(s, "ssr-dev", u, f.route.pattern, e, y);
|
|
3297
3343
|
}
|
|
3298
3344
|
});
|
|
3299
3345
|
}
|
|
3300
|
-
}, G = Date.now(),
|
|
3346
|
+
}, G = Date.now(), K = D.version ?? "?", q = await ei(), ye = p(e, "node_modules", "@voltro", "ui-shadcn"), J = T(p(ye, "package.json")) ? ye : null, be = [], xe = await (async () => {
|
|
3301
3347
|
let t = [];
|
|
3302
3348
|
for (let n of r) {
|
|
3303
3349
|
if (!n.proxyTarget) continue;
|
|
3304
|
-
let r = await
|
|
3350
|
+
let r = await xi(e, n.pkg);
|
|
3305
3351
|
if (r) try {
|
|
3306
3352
|
t.push(await O.readFile(p(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3307
3353
|
} catch {}
|
|
3308
3354
|
}
|
|
3309
3355
|
if (t.length === 0) return !1;
|
|
3310
|
-
let n =
|
|
3356
|
+
let n = fe("sha1").update(t.join("\0")).digest("hex"), i = p(k, ".voltro-rpcgroup-optimize"), a = "";
|
|
3311
3357
|
try {
|
|
3312
3358
|
a = (await O.readFile(i, "utf8")).trim();
|
|
3313
3359
|
} catch {}
|
|
@@ -3317,19 +3363,23 @@ import {
|
|
|
3317
3363
|
} catch {}
|
|
3318
3364
|
return !0;
|
|
3319
3365
|
})();
|
|
3320
|
-
|
|
3321
|
-
root:
|
|
3366
|
+
xe && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client"), await (await D.createServer({
|
|
3367
|
+
root: k,
|
|
3322
3368
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3323
3369
|
ssr: { noExternal: ["react-intl"] },
|
|
3324
3370
|
resolve: {
|
|
3325
|
-
dedupe: [
|
|
3371
|
+
dedupe: [
|
|
3372
|
+
"react",
|
|
3373
|
+
"react-dom",
|
|
3374
|
+
"react-intl"
|
|
3375
|
+
],
|
|
3326
3376
|
alias: [
|
|
3327
|
-
...
|
|
3377
|
+
...q ? [{
|
|
3328
3378
|
find: "@voltro/devtools/styles.css",
|
|
3329
|
-
replacement: p(
|
|
3379
|
+
replacement: p(q, "src/styles.css")
|
|
3330
3380
|
}, {
|
|
3331
3381
|
find: "@voltro/devtools",
|
|
3332
|
-
replacement: p(
|
|
3382
|
+
replacement: p(q, "src/index.ts")
|
|
3333
3383
|
}] : [],
|
|
3334
3384
|
...J ? [
|
|
3335
3385
|
{
|
|
@@ -3353,36 +3403,36 @@ import {
|
|
|
3353
3403
|
]
|
|
3354
3404
|
},
|
|
3355
3405
|
optimizeDeps: {
|
|
3356
|
-
include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...
|
|
3357
|
-
force:
|
|
3406
|
+
include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...be],
|
|
3407
|
+
force: xe
|
|
3358
3408
|
},
|
|
3359
3409
|
customLogger: Et(),
|
|
3360
3410
|
plugins: [
|
|
3361
|
-
|
|
3411
|
+
Kn(p(e, "src", "pages")),
|
|
3362
3412
|
ee(),
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
H,
|
|
3367
|
-
ae,
|
|
3413
|
+
te(),
|
|
3414
|
+
re,
|
|
3415
|
+
P,
|
|
3368
3416
|
oe,
|
|
3369
3417
|
ce,
|
|
3370
|
-
|
|
3371
|
-
|
|
3418
|
+
le,
|
|
3419
|
+
de,
|
|
3420
|
+
ve,
|
|
3421
|
+
...me ? [me] : []
|
|
3372
3422
|
],
|
|
3373
3423
|
server: {
|
|
3374
3424
|
port: g,
|
|
3375
3425
|
strictPort: !0,
|
|
3376
3426
|
host: !0,
|
|
3377
3427
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3378
|
-
proxy:
|
|
3379
|
-
fs: { allow: [e, ...
|
|
3428
|
+
proxy: V,
|
|
3429
|
+
fs: { allow: [e, ...oi(e)] }
|
|
3380
3430
|
},
|
|
3381
3431
|
appType: "spa",
|
|
3382
|
-
cacheDir: p(
|
|
3432
|
+
cacheDir: p(k, ".vite"),
|
|
3383
3433
|
publicDir: p(e, "public")
|
|
3384
|
-
})).listen(),
|
|
3385
|
-
version:
|
|
3434
|
+
})).listen(), Qr.info(`v${K} ready in ${Date.now() - G}ms`, {
|
|
3435
|
+
version: K,
|
|
3386
3436
|
bootMs: Date.now() - G
|
|
3387
3437
|
}), Z.info(`listening on http://localhost:${g}`, {
|
|
3388
3438
|
port: g,
|
|
@@ -3402,9 +3452,9 @@ import {
|
|
|
3402
3452
|
status: "live",
|
|
3403
3453
|
logFile: y.path
|
|
3404
3454
|
});
|
|
3405
|
-
let t =
|
|
3455
|
+
let t = vr(e);
|
|
3406
3456
|
if (t) {
|
|
3407
|
-
let e = await
|
|
3457
|
+
let e = await Or({ dashboardAppPath: t });
|
|
3408
3458
|
e.status === "launched" ? Z.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Z.debug(`dashboard already running on :${e.port}`, { port: e.port });
|
|
3409
3459
|
}
|
|
3410
3460
|
setInterval(() => {
|
|
@@ -3431,21 +3481,21 @@ import {
|
|
|
3431
3481
|
url: `http://localhost:${g}`,
|
|
3432
3482
|
bootMs: Date.now() - G
|
|
3433
3483
|
}), new Promise(() => {});
|
|
3434
|
-
},
|
|
3484
|
+
}, Li = async (e) => {
|
|
3435
3485
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3436
|
-
let t = await
|
|
3486
|
+
let t = await Fi(e);
|
|
3437
3487
|
if (!t) return {
|
|
3438
3488
|
ran: !1,
|
|
3439
3489
|
exitCode: 0
|
|
3440
3490
|
};
|
|
3441
3491
|
let n = Date.now(), r = Z.child("serve");
|
|
3442
3492
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3443
|
-
let i = await
|
|
3493
|
+
let i = await Ei(e, t);
|
|
3444
3494
|
for (let e of i) r.info("api wired", {
|
|
3445
3495
|
name: e.name,
|
|
3446
3496
|
pkg: e.pkg
|
|
3447
3497
|
});
|
|
3448
|
-
await
|
|
3498
|
+
await Mi(e, t, i);
|
|
3449
3499
|
{
|
|
3450
3500
|
let { pages: t } = await $(p(e, "src", "pages"));
|
|
3451
3501
|
await zt({
|
|
@@ -3459,10 +3509,14 @@ import {
|
|
|
3459
3509
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3460
3510
|
plugins: [s()],
|
|
3461
3511
|
customLogger: Et(),
|
|
3462
|
-
resolve: { dedupe: [
|
|
3512
|
+
resolve: { dedupe: [
|
|
3513
|
+
"react",
|
|
3514
|
+
"react-dom",
|
|
3515
|
+
"react-intl"
|
|
3516
|
+
] },
|
|
3463
3517
|
build: {
|
|
3464
3518
|
outDir: "dist",
|
|
3465
|
-
rollupOptions: { output: { manualChunks:
|
|
3519
|
+
rollupOptions: { output: { manualChunks: ci } }
|
|
3466
3520
|
},
|
|
3467
3521
|
publicDir: p(e, "public")
|
|
3468
3522
|
});
|
|
@@ -3482,14 +3536,14 @@ import {
|
|
|
3482
3536
|
extras: d,
|
|
3483
3537
|
bootMs: Date.now() - n
|
|
3484
3538
|
}), new Promise(() => {});
|
|
3485
|
-
},
|
|
3539
|
+
}, Ri = 5e3, zi = 6e4, Bi = (e, t) => {
|
|
3486
3540
|
if (e.length === 0) return 0;
|
|
3487
3541
|
if (e.length === 1) return e[0];
|
|
3488
3542
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3489
3543
|
if (r === i) return e[r];
|
|
3490
3544
|
let a = n - r;
|
|
3491
3545
|
return e[r] * (1 - a) + e[i] * a;
|
|
3492
|
-
},
|
|
3546
|
+
}, Vi = (e) => {
|
|
3493
3547
|
if (e.length === 0) return {
|
|
3494
3548
|
p50: 0,
|
|
3495
3549
|
p95: 0,
|
|
@@ -3501,18 +3555,18 @@ import {
|
|
|
3501
3555
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3502
3556
|
for (let e of t) n += e;
|
|
3503
3557
|
return {
|
|
3504
|
-
p50:
|
|
3505
|
-
p95:
|
|
3506
|
-
p99:
|
|
3558
|
+
p50: Bi(t, .5),
|
|
3559
|
+
p95: Bi(t, .95),
|
|
3560
|
+
p99: Bi(t, .99),
|
|
3507
3561
|
mean: n / t.length,
|
|
3508
3562
|
min: t[0],
|
|
3509
3563
|
max: t[t.length - 1]
|
|
3510
3564
|
};
|
|
3511
|
-
},
|
|
3512
|
-
let t = e.maxSamples ??
|
|
3565
|
+
}, Hi = (e = {}) => {
|
|
3566
|
+
let t = e.maxSamples ?? Ri, n = e.defaultWindowMs ?? zi, r = [];
|
|
3513
3567
|
return {
|
|
3514
3568
|
record(e) {
|
|
3515
|
-
|
|
3569
|
+
ie(e), r.push({
|
|
3516
3570
|
...e,
|
|
3517
3571
|
ts: Date.now()
|
|
3518
3572
|
}), r.length > t && r.shift();
|
|
@@ -3538,7 +3592,7 @@ import {
|
|
|
3538
3592
|
tag: e.tag,
|
|
3539
3593
|
count: e.samples.length,
|
|
3540
3594
|
errorCount: n,
|
|
3541
|
-
latencyMs:
|
|
3595
|
+
latencyMs: Vi(t)
|
|
3542
3596
|
});
|
|
3543
3597
|
}
|
|
3544
3598
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3551,4 +3605,4 @@ import {
|
|
|
3551
3605
|
};
|
|
3552
3606
|
};
|
|
3553
3607
|
//#endregion
|
|
3554
|
-
export { _t as $,
|
|
3608
|
+
export { _t as $, tr as A, Tn as B, yr as C, fr as D, vr as E, Xn as F, Jt as G, yn as H, Qn as I, Gt as J, qt as K, In as L, qn as M, $n as N, pr as O, Jn as P, Dt as Q, Ln as R, Ir as S, Or as T, fn as U, xn as V, sn as W, zt as X, Wt as Y, kt as Z, Ar as _, We as _t, hi as a, st as at, Pr as b, Ei as c, ot as ct, ci as d, et as dt, ht as et, $ as f, Xe as ft, Jr as g, Ge as gt, Kr as h, Ue as ht, ji as i, dt as it, rr as j, mr as k, Ii as l, rt as lt, Zr as m, Ke as mt, li as n, lt as nt, mi as o, ct as ot, Mi as p, Je as pt, Yt as q, Ai as r, ut as rt, Fi as s, at as st, Hi as t, mt as tt, Li as u, tt as ut, Mr as v, Me as vt, _r as w, Fr as x, Nr as y, Ne as yt, An as z };
|