@voltro/cli 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +368 -0
- package/THIRD-PARTY-NOTICES.md +1 -29
- package/dist/apiBuild-C-x9YacA.js +2 -0
- package/dist/{apiBuild-CLPt-pX6.js → apiBuild-h9VHtnlw.js} +2 -2
- package/dist/bin.js +3 -3
- package/dist/checkCommand-DRovTKza.js +2 -0
- package/dist/{checkCommand-D7r6_pk7.js → checkCommand-xGhRFFg2.js} +330 -290
- package/dist/{commands-CNVVv03h.js → commands-CJfepbm4.js} +139 -13
- package/dist/{dbCommand-BH8GAYuf.js → dbCommand-DTLKAfbA.js} +431 -263
- package/dist/dbCommand-b1gum4td.js +2 -0
- package/dist/{dev-DdQEn2Ia.js → dev-C_P8FLSx.js} +2141 -2081
- package/dist/{dev-DOZVMVfi.js → dev-iiMtlkfs.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-BeEAnjqw.js → inspectMetrics-1xzTKAFx.js} +750 -685
- package/dist/{sdkgen-v9WV8zRi.js → sdkgen-C81QIkiL.js} +1 -1
- package/dist/serveCommand-DdaM4Hup.js +1608 -0
- package/dist/serveEntry.js +2 -2
- package/dist/{start-CI2QdKy9.js → start-C0koT0UO.js} +1 -1
- package/dist/startEntry.js +2 -2
- package/package.json +431 -18
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/database/misc.md +37 -0
- package/templates/agent-docs/database/schema.md +4 -2
- package/templates/agent-docs/deployment.md +87 -1
- package/templates/agent-docs/plugins/audit.md +24 -0
- package/templates/agent-docs/plugins.md +50 -0
- package/templates/agent-docs/scheduling.md +4 -1
- package/templates/agent-docs/security.md +31 -1
- package/templates/agent-docs/whats-new.md +149 -59
- 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/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-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/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +9 -9
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/package.json +2 -2
- package/dist/apiBuild-BOqL1dlg.js +0 -2
- package/dist/checkCommand-ClRvH_SN.js +0 -2
- package/dist/dbCommand-BwQ_Jl98.js +0 -2
- package/dist/serveCommand-KsKXXWn4.js +0 -1578
|
@@ -7,11 +7,11 @@ 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 k, readdirSync as A, statSync as j, unlinkSync as M, unwatchFile as
|
|
11
|
-
import { currentTraceContext as
|
|
12
|
-
import { homedir as
|
|
13
|
-
import { createRequire as
|
|
14
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
10
|
+
import { closeSync as w, existsSync as T, mkdirSync as E, openSync as D, promises as O, readFileSync as k, readdirSync as A, statSync as j, unlinkSync as M, unwatchFile as N, watchFile as ee, writeSync as P } from "node:fs";
|
|
11
|
+
import { currentTraceContext as F, recordSample as I, resolveSecret as te } from "@voltro/runtime";
|
|
12
|
+
import { homedir as L } from "node:os";
|
|
13
|
+
import { createRequire as R } from "node:module";
|
|
14
|
+
import { FRAMEWORK_ENV_CATALOG as ne, appEnvEntries as re, checkEnvNaming as z, formatEnvErrors as ie, installEnvSnapshot as B, isEnvContract as ae, pluginEnvEntries as V, renderDotEnvExample as oe, resolveEnv as se } from "@voltro/env";
|
|
15
15
|
import { __installPublicEnv as ce } from "@voltro/env/public";
|
|
16
16
|
import { mkdir as H, readFile as le, writeFile as ue } from "node:fs/promises";
|
|
17
17
|
import { createHash as de } from "node:crypto";
|
|
@@ -19,36 +19,36 @@ import { spawn as fe } from "node:child_process";
|
|
|
19
19
|
import { createConnection as pe } from "node:net";
|
|
20
20
|
import { PassThrough as me } from "node:stream";
|
|
21
21
|
//#region src/agentsMd.ts
|
|
22
|
-
var
|
|
22
|
+
var U = d(g(import.meta.url)), W = [h(U, "..", "templates"), h(U, "..", "..", "templates")], he = (e) => ({
|
|
23
23
|
_tag: "TemplateNotFoundError",
|
|
24
24
|
searched: e
|
|
25
|
-
}),
|
|
25
|
+
}), G = ["AGENTS.md", "CLAUDE.md"], ge = "voltro:agents-md:keep", _e = 2048, ve = "<!-- VOLTRO:INDEX -->", ye = (e) => /^#\s*What's new in\s+(\d+\.\d+\.\d+[^\s]*)\s*$/m.exec(e)?.[1] ?? null, be = (e) => e.templatesVersion !== null && e.installedVersion !== null && e.templatesVersion !== e.installedVersion, K = (e, t) => e.exists(t).pipe(b.orElseSucceed(() => !1)), q = (e, t) => e.readFileString(t).pipe(b.orElseSucceed(() => "")), xe = (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)), Se = (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* xe(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;
|
|
38
38
|
}
|
|
39
|
-
}),
|
|
39
|
+
}), Ce = (e, t, n) => b.gen(function* () {
|
|
40
40
|
yield* e.makeDirectory(n, { recursive: !0 }).pipe(b.orElseSucceed(() => void 0));
|
|
41
41
|
let r = yield* e.readDirectory(t).pipe(b.orElseSucceed(() => []));
|
|
42
42
|
for (let i of r) {
|
|
43
43
|
let r = p(t, i), a = p(n, i);
|
|
44
|
-
(yield* e.stat(r).pipe(b.orElseSucceed(() => null)))?.type === "Directory" ? yield*
|
|
44
|
+
(yield* e.stat(r).pipe(b.orElseSucceed(() => null)))?.type === "Directory" ? yield* Ce(e, r, a) : yield* e.copyFile(r, a).pipe(b.orElseSucceed(() => void 0));
|
|
45
45
|
}
|
|
46
|
-
}),
|
|
46
|
+
}), we = (e) => typeof e?.name == "string" && e.name.length > 0 ? e.name.split("#")[0] : null, Te = (e, t) => b.gen(function* () {
|
|
47
47
|
let n = p(t, "app.config.ts");
|
|
48
48
|
if (!(yield* K(e, n))) return null;
|
|
49
49
|
let r = (yield* b.tryPromise(() => import(_(n).href)).pipe(b.orElseSucceed(() => null)))?.default;
|
|
50
|
-
return !r || r.type && r.type !== "api" ? r?.type === "web" ? [] : null : (r.plugins ?? []).map(
|
|
51
|
-
}),
|
|
50
|
+
return !r || r.type && r.type !== "api" ? r?.type === "web" ? [] : null : (r.plugins ?? []).map(we).filter((e) => e !== null);
|
|
51
|
+
}), Ee = (e, t) => b.gen(function* () {
|
|
52
52
|
let n = [], r = [], i = p(t, "apps");
|
|
53
53
|
if (!(yield* K(e, i))) return {
|
|
54
54
|
apis: n,
|
|
@@ -67,7 +67,7 @@ var he = d(g(import.meta.url)), U = [h(he, "..", "templates"), h(he, "..", "..",
|
|
|
67
67
|
apis: n,
|
|
68
68
|
webs: r
|
|
69
69
|
};
|
|
70
|
-
}),
|
|
70
|
+
}), De = (e) => e.replace(/\|/g, "\\|").replace(/\n/g, " ").trim(), Oe = (e, t, n) => {
|
|
71
71
|
let r = [
|
|
72
72
|
"<!-- voltro agent-docs index — regenerated at seed time -->",
|
|
73
73
|
"## Deep reference (read on demand)",
|
|
@@ -79,17 +79,17 @@ var he = d(g(import.meta.url)), U = [h(he, "..", "templates"), h(he, "..", "..",
|
|
|
79
79
|
"",
|
|
80
80
|
"| Topic | Open | Summary |",
|
|
81
81
|
"|---|---|---|",
|
|
82
|
-
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${
|
|
82
|
+
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${De(e.description)} |`),
|
|
83
83
|
""
|
|
84
|
-
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = (e, t) => e.module === void 0 ? `\`node_modules/${t}/README.md\`` : `\`${n}${e.module}\` (or \`node_modules/${t}/README.md\`)`, o = t === null ? e.plugins.map((e) => `| ${e.slug} | ${a(e, e.pkg)} | ${
|
|
84
|
+
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = (e, t) => e.module === void 0 ? `\`node_modules/${t}/README.md\`` : `\`${n}${e.module}\` (or \`node_modules/${t}/README.md\`)`, o = t === null ? e.plugins.map((e) => `| ${e.slug} | ${a(e, e.pkg)} | ${De(e.description)} |`) : t.map((e) => {
|
|
85
85
|
let t = i.get(e);
|
|
86
|
-
return t ? `| ${t.slug} | ${a(t, e)} | ${
|
|
86
|
+
return t ? `| ${t.slug} | ${a(t, e)} | ${De(t.description)} |` : `| ${e.replace(/^@[^/]+\//, "")} | \`node_modules/${e}/README.md\` | (see plugin README) |`;
|
|
87
87
|
});
|
|
88
88
|
return r.push(`### Plugins${t === null ? "" : " (installed)"}`, "", "| Plugin | Open | Summary |", "|---|---|---|"), r.push(o.length ? o.join("\n") : "| _(none installed)_ | | |", ""), r.join("\n");
|
|
89
|
-
},
|
|
89
|
+
}, ke = (e, t, n) => {
|
|
90
90
|
let r = t.templates?.[e] ?? t.templates?.[e.replace(/^frontend-/, "")];
|
|
91
91
|
return `\nScaffolded from the \`${e}\` template — see \`${r ? `${n}${r}` : `${n}agent-docs/templates/overview.md`}\`.\n`;
|
|
92
|
-
},
|
|
92
|
+
}, Ae = {
|
|
93
93
|
api: (e, t, n = "") => `# api — agent notes
|
|
94
94
|
|
|
95
95
|
You are in a Voltro **api** app. Server primitives live here: \`queries/\`,
|
|
@@ -129,7 +129,7 @@ You are in a Voltro **web** app. File-based routing under \`src/pages/**\`.
|
|
|
129
129
|
Deep reference (paths from the repo root): \`${e}agent-docs/routing.md\`,
|
|
130
130
|
\`${e}agent-docs/schema-driven-ui.md\`, \`${e}agent-docs/internationalization.md\`.
|
|
131
131
|
${t}`
|
|
132
|
-
},
|
|
132
|
+
}, je = [
|
|
133
133
|
{
|
|
134
134
|
name: "voltro-schema",
|
|
135
135
|
description: "Define or change a Voltro database table/schema (columns, mixins, indexes, relations).",
|
|
@@ -160,7 +160,7 @@ ${t}`
|
|
|
160
160
|
description: "Export/import + backup/restore Voltro data & assets, and copy prod→dev/stage SAFELY with fail-closed masking/anonymization (.sensitive()/.safe()) + referential subsetting. Use for data takeout, seeding lower envs, backups, or cross-dialect moves.",
|
|
161
161
|
module: "cli.md"
|
|
162
162
|
}
|
|
163
|
-
],
|
|
163
|
+
], Me = (e, t) => `---
|
|
164
164
|
name: ${e.name}
|
|
165
165
|
description: ${e.description}
|
|
166
166
|
---
|
|
@@ -171,10 +171,10 @@ Open the full reference and follow the patterns there:
|
|
|
171
171
|
|
|
172
172
|
Also read the repo-root \`AGENTS.md\` for the always-true rules (browser/server
|
|
173
173
|
boundary, naming, anti-patterns) before editing.
|
|
174
|
-
`,
|
|
174
|
+
`, Ne = (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, _e).includes("voltro:agents-md:keep")) return {
|
|
178
178
|
path: t,
|
|
179
179
|
action: "protected"
|
|
180
180
|
};
|
|
@@ -187,67 +187,90 @@ boundary, naming, anti-patterns) before editing.
|
|
|
187
187
|
path: t,
|
|
188
188
|
action: i ? "overwritten" : "created"
|
|
189
189
|
};
|
|
190
|
-
}),
|
|
191
|
-
let n = yield* v.FileSystem, r = yield*
|
|
192
|
-
for (let e of
|
|
190
|
+
}), Pe = (e, t = {}) => b.gen(function* () {
|
|
191
|
+
let n = yield* v.FileSystem, r = yield* Se(e), i = null;
|
|
192
|
+
for (let e of W) 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 W) 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 G) a.push(yield* Ne(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(he(W.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
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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 = (e) => q(n, e).pipe(b.map((e) => {
|
|
208
|
+
if (!e) return null;
|
|
209
|
+
try {
|
|
210
|
+
return JSON.parse(e).version ?? null;
|
|
211
|
+
} catch {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
})), f = {
|
|
215
|
+
templatesVersion: yield* d(p(i, "..", "package.json")),
|
|
216
|
+
installedVersion: yield* d(p(r, "node_modules", "@voltro", "cli", "package.json")),
|
|
217
|
+
whatsNewVersion: ye(yield* q(n, p(i, "agent-docs", "whats-new.md"))),
|
|
218
|
+
copiedIn: !c
|
|
219
|
+
}, m = G.map((e) => p(r, e));
|
|
220
|
+
if ((yield* b.forEach(m, (e) => q(n, e).pipe(b.map((e) => e.slice(0, _e))))).every((e) => e.includes("voltro:agents-md:keep"))) return {
|
|
221
|
+
files: m.map((e) => ({
|
|
222
|
+
path: e,
|
|
223
|
+
action: "protected"
|
|
224
|
+
})),
|
|
225
|
+
provenance: f
|
|
226
|
+
};
|
|
227
|
+
let { apis: g, webs: _ } = yield* Ee(n, r), y = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Set(), S = !1;
|
|
228
|
+
for (let e of g) {
|
|
229
|
+
let t = yield* Te(n, e);
|
|
230
|
+
if (y.set(e, t), t !== null) {
|
|
231
|
+
S = !0;
|
|
232
|
+
for (let e of t) x.add(e);
|
|
218
233
|
}
|
|
219
234
|
}
|
|
220
|
-
let
|
|
221
|
-
for (let e of
|
|
222
|
-
c || (yield*
|
|
223
|
-
let
|
|
224
|
-
let t =
|
|
225
|
-
return t ?
|
|
226
|
-
},
|
|
227
|
-
for (let e of
|
|
228
|
-
for (let e of
|
|
229
|
-
for (let e of
|
|
230
|
-
return {
|
|
231
|
-
|
|
235
|
+
let C = t.plugins ? t.plugins.map(we).filter((e) => e !== null) : S ? [...x] : null, w = a.includes(ve) ? a.replace(ve, Oe(s, C, l)) : a, T = [];
|
|
236
|
+
for (let e of m) T.push(yield* Ne(n, e, w, u));
|
|
237
|
+
c || (yield* Ce(n, p(i, "agent-docs"), p(r, "agent-docs")));
|
|
238
|
+
let E = new Map((t.appTemplates ?? []).map((e) => [h(e.dir), e.template])), D = (e) => {
|
|
239
|
+
let t = E.get(h(e));
|
|
240
|
+
return t ? ke(t, s, l) : "";
|
|
241
|
+
}, O = (e, t) => b.forEach(G, (r) => Ne(n, p(e, r), t, u));
|
|
242
|
+
for (let e of g) T.push(...yield* O(e, Ae.api(l, y.get(e) ?? null, D(e)))), (yield* K(n, p(e, "database"))) && T.push(...yield* O(p(e, "database"), Ae.database(l)));
|
|
243
|
+
for (let e of _) T.push(...yield* O(e, Ae.web(l, D(e))));
|
|
244
|
+
for (let e of je) T.push(yield* Ne(n, p(r, ".claude", "skills", e.name, "SKILL.md"), Me(e, l), u));
|
|
245
|
+
return {
|
|
246
|
+
files: T,
|
|
247
|
+
provenance: f
|
|
248
|
+
};
|
|
249
|
+
}), Fe = (e, t = {}) => b.runPromise(Pe(e, t).pipe(b.provide(y.layer))), Ie = async (t) => {
|
|
232
250
|
let n = t.includes("--force"), r = t.find((e) => !e.startsWith("-")) ?? process.cwd();
|
|
233
251
|
return e(b.gen(function* () {
|
|
234
|
-
let e = yield*
|
|
252
|
+
let e = yield* Pe(r, { force: n });
|
|
235
253
|
for (let t of e.files) {
|
|
236
|
-
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${
|
|
254
|
+
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${ge}")` : "present (use --force to overwrite)";
|
|
237
255
|
yield* b.logInfo(`${t.path.split("/").slice(-2).join("/")} ${e}`, { action: t.action });
|
|
238
256
|
}
|
|
239
|
-
|
|
257
|
+
let t = e.provenance;
|
|
258
|
+
return t !== void 0 && (yield* b.logInfo(`seeded from @voltro/cli ${t.templatesVersion ?? "unknown"} (project has ${t.installedVersion ?? "no resolvable @voltro/cli"}; whats-new describes ${t.whatsNewVersion ?? "unknown"}; modules ${t.copiedIn ? "COPIED into ./agent-docs" : "pointed at node_modules"})`, {
|
|
259
|
+
templates: t.templatesVersion,
|
|
260
|
+
installed: t.installedVersion,
|
|
261
|
+
whatsNew: t.whatsNewVersion
|
|
262
|
+
}), be(t) && (yield* b.logWarning(`the \`voltro\` binary that ran is ${t.templatesVersion}, but this project installs ${t.installedVersion} — everything just written describes the OLDER version. Run it through the project's own cli (\`pnpm exec voltro agents-md --force\`) so the guide matches what the app boots.`))), 0;
|
|
240
263
|
}).pipe(b.catchTag("TemplateNotFoundError", (e) => b.gen(function* () {
|
|
241
264
|
return yield* b.logError("AGENTS.md template not found", { searched: e.searched }), 1;
|
|
242
265
|
}))), { scope: "voltro:agents-md" });
|
|
243
|
-
},
|
|
266
|
+
}, Le = p(L(), ".voltro"), Re = p(Le, "runtime-registry.json"), ze = 3e4, Be = () => {
|
|
244
267
|
let e = Math.random().toString(36).slice(2, 10);
|
|
245
|
-
return `${
|
|
246
|
-
},
|
|
247
|
-
await O.mkdir(
|
|
248
|
-
},
|
|
268
|
+
return `${Re}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
269
|
+
}, Ve = async () => {
|
|
270
|
+
await O.mkdir(Le, { recursive: !0 });
|
|
271
|
+
}, He = async () => {
|
|
249
272
|
try {
|
|
250
|
-
let e = await O.readFile(
|
|
273
|
+
let e = await O.readFile(Re, "utf8"), t = JSON.parse(e);
|
|
251
274
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
252
275
|
version: 1,
|
|
253
276
|
apps: []
|
|
@@ -258,34 +281,34 @@ boundary, naming, anti-patterns) before editing.
|
|
|
258
281
|
apps: []
|
|
259
282
|
};
|
|
260
283
|
}
|
|
261
|
-
},
|
|
262
|
-
await
|
|
263
|
-
let t =
|
|
284
|
+
}, Ue = async (e) => {
|
|
285
|
+
await Ve();
|
|
286
|
+
let t = Be();
|
|
264
287
|
try {
|
|
265
288
|
await O.writeFile(t, JSON.stringify(e, null, 2), {
|
|
266
289
|
encoding: "utf8",
|
|
267
290
|
mode: 384
|
|
268
|
-
}), await O.rename(t,
|
|
291
|
+
}), await O.rename(t, Re), await O.chmod(Re, 384).catch(() => {});
|
|
269
292
|
} catch (e) {
|
|
270
293
|
try {
|
|
271
294
|
await O.unlink(t);
|
|
272
295
|
} catch {}
|
|
273
296
|
throw e;
|
|
274
297
|
}
|
|
275
|
-
},
|
|
298
|
+
}, We = (e) => {
|
|
276
299
|
try {
|
|
277
300
|
return process.kill(e, 0), !0;
|
|
278
301
|
} catch {
|
|
279
302
|
return !1;
|
|
280
303
|
}
|
|
281
|
-
},
|
|
304
|
+
}, Ge = (e) => {
|
|
282
305
|
let t = Date.now();
|
|
283
|
-
return e.filter((e) =>
|
|
284
|
-
},
|
|
285
|
-
let e = await
|
|
306
|
+
return e.filter((e) => We(e.pid) ? t - new Date(e.heartbeatAt).getTime() < ze : !1);
|
|
307
|
+
}, Ke = async () => {
|
|
308
|
+
let e = await He(), t = Ge(e.apps);
|
|
286
309
|
if (t.length === e.apps.length) return e;
|
|
287
310
|
try {
|
|
288
|
-
await
|
|
311
|
+
await Ue({
|
|
289
312
|
version: 1,
|
|
290
313
|
apps: t
|
|
291
314
|
});
|
|
@@ -294,31 +317,31 @@ boundary, naming, anti-patterns) before editing.
|
|
|
294
317
|
version: 1,
|
|
295
318
|
apps: t
|
|
296
319
|
};
|
|
297
|
-
},
|
|
298
|
-
let t = await
|
|
320
|
+
}, qe = async (e) => {
|
|
321
|
+
let t = await He(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
|
|
299
322
|
...e,
|
|
300
323
|
...i !== void 0 && i !== "" ? { inspectToken: i } : {},
|
|
301
324
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
302
325
|
heartbeatAt: n
|
|
303
326
|
};
|
|
304
|
-
await
|
|
327
|
+
await Ue({
|
|
305
328
|
version: 1,
|
|
306
329
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
|
|
307
330
|
});
|
|
308
|
-
},
|
|
331
|
+
}, Je = async (e) => {
|
|
309
332
|
try {
|
|
310
|
-
let t = await
|
|
333
|
+
let t = await He(), n = t.apps.filter((t) => t.id !== e);
|
|
311
334
|
if (n.length === t.apps.length) return;
|
|
312
|
-
await
|
|
335
|
+
await Ue({
|
|
313
336
|
version: 1,
|
|
314
337
|
apps: n
|
|
315
338
|
});
|
|
316
339
|
} catch {}
|
|
317
|
-
},
|
|
340
|
+
}, Ye = (e, t, n) => `${e}:${t}:${n}`, Xe = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Ze = (e) => {
|
|
318
341
|
try {
|
|
319
342
|
let t = p(e, "tsconfig.json");
|
|
320
343
|
if (!T(t)) return [];
|
|
321
|
-
let n = JSON.parse(
|
|
344
|
+
let n = JSON.parse(Xe(k(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = h(e, n.baseUrl ?? "."), a = [];
|
|
322
345
|
for (let [e, t] of Object.entries(r)) {
|
|
323
346
|
let n = t[0];
|
|
324
347
|
if (!n) continue;
|
|
@@ -338,17 +361,17 @@ boundary, naming, anti-patterns) before editing.
|
|
|
338
361
|
} catch {
|
|
339
362
|
return [];
|
|
340
363
|
}
|
|
341
|
-
},
|
|
364
|
+
}, Qe = (e) => {
|
|
342
365
|
let t = e;
|
|
343
366
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
344
|
-
},
|
|
367
|
+
}, $e = async (e, t) => {
|
|
345
368
|
try {
|
|
346
369
|
return await t();
|
|
347
370
|
} catch (t) {
|
|
348
|
-
throw
|
|
371
|
+
throw Qe(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
|
|
349
372
|
}
|
|
350
|
-
},
|
|
351
|
-
let n =
|
|
373
|
+
}, et = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", tt = (e, t) => t ? `${e} | undefined` : e, nt = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${tt(t.tsType, t.optional)}`).join("\n"), rt = async (e, t) => {
|
|
374
|
+
let n = nt(t, () => !0), r = `${et}
|
|
352
375
|
import '@voltro/env/server'
|
|
353
376
|
|
|
354
377
|
declare module '@voltro/env/server' {
|
|
@@ -358,8 +381,8 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
358
381
|
}
|
|
359
382
|
`;
|
|
360
383
|
await ue(p(e, "env.generated.d.ts"), r, "utf8");
|
|
361
|
-
},
|
|
362
|
-
let n =
|
|
384
|
+
}, it = async (e, t) => {
|
|
385
|
+
let n = nt(t, (e) => e === "public"), r = `${et}
|
|
363
386
|
import '@voltro/env/public'
|
|
364
387
|
|
|
365
388
|
declare module '@voltro/env/public' {
|
|
@@ -369,8 +392,8 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
369
392
|
}
|
|
370
393
|
`, i = p(e, "src");
|
|
371
394
|
await H(i, { recursive: !0 }), await ue(p(i, "voltro-env.d.ts"), r, "utf8");
|
|
372
|
-
},
|
|
373
|
-
let n = `${
|
|
395
|
+
}, at = async (e, t) => {
|
|
396
|
+
let n = `${et}
|
|
374
397
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
375
398
|
|
|
376
399
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -379,13 +402,13 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
379
402
|
__installPublicEnv(publicEnvValues)
|
|
380
403
|
`;
|
|
381
404
|
await H(e, { recursive: !0 }), await ue(p(e, "env.public.ts"), n, "utf8");
|
|
382
|
-
},
|
|
383
|
-
let t =
|
|
405
|
+
}, ot = async (e) => {
|
|
406
|
+
let t = ae(e.rawEnv) ? e.rawEnv : void 0, n = await se({
|
|
384
407
|
contract: t,
|
|
385
|
-
resolveSecret:
|
|
408
|
+
resolveSecret: te
|
|
386
409
|
}), r = [...n.errors, ...z(t, e.appType)];
|
|
387
|
-
if (r.length > 0) throw Error(
|
|
388
|
-
|
|
410
|
+
if (r.length > 0) throw Error(ie(r));
|
|
411
|
+
B(n.values), e.appType === "web" && ce(n.publicValues);
|
|
389
412
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
390
413
|
if (i > 0) {
|
|
391
414
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -397,20 +420,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
397
420
|
n.length > 0 && e.log.warn(`env: ${n.length} secret var(s) declared on a web app — secrets are reachable only from server-side render code and are NEVER bundled. Prefer declaring secrets on the api.`, { keys: n });
|
|
398
421
|
}
|
|
399
422
|
}
|
|
400
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
423
|
+
return e.generateTypes && t && (e.appType === "api" ? await rt(e.root, t) : await it(e.root, t)), {
|
|
401
424
|
resolved: n,
|
|
402
425
|
contract: t
|
|
403
426
|
};
|
|
404
|
-
},
|
|
405
|
-
let t =
|
|
427
|
+
}, st = (e) => {
|
|
428
|
+
let t = re(e.contract), n = (e.plugins ?? []).flatMap((e) => V(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ne, i = /* @__PURE__ */ new Set(), a = [];
|
|
406
429
|
for (let e of [
|
|
407
430
|
...t,
|
|
408
431
|
...n,
|
|
409
432
|
...r
|
|
410
433
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
411
434
|
return a;
|
|
412
|
-
},
|
|
413
|
-
let r =
|
|
435
|
+
}, ct = (e, t, n = (e) => process.env[e]) => {
|
|
436
|
+
let r = st(t).map((e) => {
|
|
414
437
|
let t = n(e.key) !== void 0;
|
|
415
438
|
return {
|
|
416
439
|
...e,
|
|
@@ -427,13 +450,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
427
450
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
428
451
|
}
|
|
429
452
|
};
|
|
430
|
-
},
|
|
453
|
+
}, lt = (e, t) => oe(st({
|
|
431
454
|
...e,
|
|
432
455
|
includeFramework: !1
|
|
433
456
|
}), {
|
|
434
457
|
includeFramework: e.includeFramework !== !1,
|
|
435
458
|
...t ? { header: t } : {}
|
|
436
|
-
}),
|
|
459
|
+
}), ut = () => {
|
|
437
460
|
let e = /* @__PURE__ */ new Map();
|
|
438
461
|
return {
|
|
439
462
|
get(t) {
|
|
@@ -460,7 +483,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
460
483
|
return Array.from(e.entries());
|
|
461
484
|
}
|
|
462
485
|
};
|
|
463
|
-
},
|
|
486
|
+
}, J = (e) => {
|
|
464
487
|
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e * 1e3;
|
|
465
488
|
if (typeof e != "string") return null;
|
|
466
489
|
let t = /^\s*(\d+)\s*(s|seconds?|m|minutes?|h|hours?|d|days?)\s*$/i.exec(e);
|
|
@@ -469,10 +492,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
469
492
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
470
493
|
let r = t[2].toLowerCase();
|
|
471
494
|
return r === "s" || r.startsWith("second") ? n * 1e3 : r === "m" || r.startsWith("minute") ? n * 6e4 : r === "h" || r.startsWith("hour") ? n * 36e5 : r === "d" || r.startsWith("day") ? n * 864e5 : null;
|
|
472
|
-
},
|
|
495
|
+
}, dt = (e, t = {}) => {
|
|
473
496
|
let n = [e];
|
|
474
497
|
return t.tenant !== void 0 && t.tenant !== "" && n.push(`tenant=${t.tenant}`), t.locale !== void 0 && t.locale !== "" && n.push(`lang=${t.locale}`), n.join("|");
|
|
475
|
-
},
|
|
498
|
+
}, ft = (e, t) => e.expiresAt > t, pt = (e, t) => e.expiresAt <= t && e.servableUntil > t, mt = S({ scope: "voltro:cli" }), ht = (e, t) => {
|
|
476
499
|
if (t?.code !== "EACCES") return "";
|
|
477
500
|
if (typeof process.getuid != "function") return " — permission denied";
|
|
478
501
|
try {
|
|
@@ -481,8 +504,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
481
504
|
} catch {
|
|
482
505
|
return " — permission denied (and the file could not be stat-ed either)";
|
|
483
506
|
}
|
|
484
|
-
},
|
|
485
|
-
|
|
507
|
+
}, gt = [], _t = (e) => {
|
|
508
|
+
gt.length = 0;
|
|
486
509
|
let t = e[1] && !e[1].startsWith("-") ? e[1] : void 0, n = t ? f(t) ? t : h(process.cwd(), t) : process.cwd(), r = [], i = n;
|
|
487
510
|
for (;;) {
|
|
488
511
|
r.push(i);
|
|
@@ -493,7 +516,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
493
516
|
for (let e of r) for (let t of [".env.local", ".env"]) {
|
|
494
517
|
let n = h(e, t);
|
|
495
518
|
if (T(n)) {
|
|
496
|
-
|
|
519
|
+
gt.push(n);
|
|
497
520
|
try {
|
|
498
521
|
let e = k(n, "utf8");
|
|
499
522
|
for (let t of e.split(/\r?\n/)) {
|
|
@@ -505,11 +528,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
505
528
|
(i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
|
|
506
529
|
}
|
|
507
530
|
} catch (e) {
|
|
508
|
-
|
|
531
|
+
mt.warn(`failed to load env file (continuing)${ht(n, e)}`, { path: n }, e);
|
|
509
532
|
}
|
|
510
533
|
}
|
|
511
534
|
}
|
|
512
|
-
},
|
|
535
|
+
}, vt = 500, yt = (e, t, n = {}) => {
|
|
513
536
|
if (e.length === 0) return () => {};
|
|
514
537
|
let r = (e) => n.root ? m(n.root, e) : e, i = !1, a = (e) => {
|
|
515
538
|
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(() => {
|
|
@@ -527,25 +550,25 @@ __installPublicEnv(publicEnvValues)
|
|
|
527
550
|
});
|
|
528
551
|
}));
|
|
529
552
|
};
|
|
530
|
-
for (let t of e)
|
|
553
|
+
for (let t of e) ee(t, { interval: vt }, (e, n) => {
|
|
531
554
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
532
555
|
});
|
|
533
556
|
return t.info("watching .env files for changes", {
|
|
534
557
|
files: e.map(r),
|
|
535
|
-
intervalMs:
|
|
558
|
+
intervalMs: vt
|
|
536
559
|
}), () => {
|
|
537
|
-
for (let t of e)
|
|
560
|
+
for (let t of e) N(t);
|
|
538
561
|
};
|
|
539
|
-
},
|
|
562
|
+
}, bt = "VoltroBootRefusal", xt = (e) => {
|
|
540
563
|
let t = Error(e);
|
|
541
|
-
return t.name =
|
|
542
|
-
},
|
|
564
|
+
return t.name = bt, t;
|
|
565
|
+
}, St = [{
|
|
543
566
|
host: "127.0.0.1",
|
|
544
567
|
family: "IPv4"
|
|
545
568
|
}, {
|
|
546
569
|
host: "::1",
|
|
547
570
|
family: "IPv6"
|
|
548
|
-
}],
|
|
571
|
+
}], Ct = (e, t, n) => new Promise((r) => {
|
|
549
572
|
let i = !1, a = (e) => {
|
|
550
573
|
if (!i) {
|
|
551
574
|
i = !0;
|
|
@@ -559,10 +582,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
559
582
|
port: t
|
|
560
583
|
});
|
|
561
584
|
o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
|
|
562
|
-
}),
|
|
585
|
+
}), wt = async (e, t = 400) => ({ families: (await Promise.all(St.map(async (n) => ({
|
|
563
586
|
family: n.family,
|
|
564
|
-
taken: await
|
|
565
|
-
})))).filter((e) => e.taken).map((e) => e.family) }),
|
|
587
|
+
taken: await Ct(n.host, e, t)
|
|
588
|
+
})))).filter((e) => e.taken).map((e) => e.family) }), Tt = (e, t, n) => [
|
|
566
589
|
`${t}: port ${e} is already being served (${n.join(" + ")}).`,
|
|
567
590
|
"",
|
|
568
591
|
" Refusing to start. This is NOT a spurious check — a second listener can",
|
|
@@ -577,52 +600,84 @@ __installPublicEnv(publicEnvValues)
|
|
|
577
600
|
"",
|
|
578
601
|
" Then re-run. To use a different port instead, change `port` in",
|
|
579
602
|
" app.config.ts."
|
|
580
|
-
].join("\n"),
|
|
581
|
-
let { families: n } = await
|
|
582
|
-
if (n.length !== 0) throw
|
|
583
|
-
},
|
|
584
|
-
let t = [], n =
|
|
603
|
+
].join("\n"), Et = async (e, t) => {
|
|
604
|
+
let { families: n } = await wt(e);
|
|
605
|
+
if (n.length !== 0) throw xt(Tt(e, t, n));
|
|
606
|
+
}, Dt = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Ot = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, kt = (e) => {
|
|
607
|
+
let t = [], n = e;
|
|
608
|
+
for (let e = 0; e < 12; e++) {
|
|
609
|
+
let e = p(n, "node_modules");
|
|
610
|
+
T(e) && t.push(e);
|
|
611
|
+
let r = d(n);
|
|
612
|
+
if (r === n) break;
|
|
613
|
+
n = r;
|
|
614
|
+
}
|
|
615
|
+
return t;
|
|
616
|
+
}, At = (e) => {
|
|
617
|
+
let t = /* @__PURE__ */ new Set([e]), n = e;
|
|
585
618
|
for (let e = 0; e < 12; e++) {
|
|
586
|
-
let e
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
619
|
+
for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
|
|
620
|
+
let r;
|
|
621
|
+
try {
|
|
622
|
+
r = k(p(n, e), "utf8");
|
|
623
|
+
} catch {
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
for (let e of r.matchAll(/^\s*-\s*['"]?([^'"\n#]+?)['"]?\s*$/gm)) {
|
|
627
|
+
let r = (e[1] ?? "").trim();
|
|
628
|
+
if (r === "" || r.startsWith("!")) continue;
|
|
629
|
+
let i = r.split("/")[0] ?? "";
|
|
630
|
+
if (i === "" || i.includes("*")) continue;
|
|
631
|
+
let a;
|
|
632
|
+
try {
|
|
633
|
+
a = A(p(n, i), { withFileTypes: !0 });
|
|
634
|
+
} catch {
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
for (let e of a) e.isDirectory() && t.add(p(n, i, e.name));
|
|
638
|
+
}
|
|
591
639
|
}
|
|
592
|
-
let
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
640
|
+
for (let e of ["packages", "apps"]) {
|
|
641
|
+
let r;
|
|
642
|
+
try {
|
|
643
|
+
r = A(p(n, e), { withFileTypes: !0 });
|
|
644
|
+
} catch {
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
for (let i of r) i.isDirectory() && t.add(p(n, e, i.name));
|
|
648
|
+
}
|
|
649
|
+
let e = d(n);
|
|
650
|
+
if (e === n) break;
|
|
651
|
+
n = e;
|
|
652
|
+
}
|
|
653
|
+
return [...t];
|
|
654
|
+
}, jt = (e) => {
|
|
655
|
+
let t = [];
|
|
656
|
+
for (let n of At(e)) {
|
|
657
|
+
let e = p(n, "node_modules", "@voltro"), r;
|
|
601
658
|
try {
|
|
602
|
-
|
|
659
|
+
r = A(e);
|
|
603
660
|
} catch {
|
|
604
661
|
continue;
|
|
605
662
|
}
|
|
606
|
-
for (let
|
|
607
|
-
let n = r
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
version: a,
|
|
613
|
-
dir: p(t, r)
|
|
663
|
+
for (let n of r) {
|
|
664
|
+
let r = p(e, n), i = Mt(r);
|
|
665
|
+
i !== void 0 && t.push({
|
|
666
|
+
pkg: `@voltro/${n}`,
|
|
667
|
+
version: i,
|
|
668
|
+
dir: r
|
|
614
669
|
});
|
|
615
670
|
}
|
|
616
671
|
}
|
|
617
|
-
return
|
|
618
|
-
},
|
|
672
|
+
return t;
|
|
673
|
+
}, Mt = (e) => {
|
|
619
674
|
try {
|
|
620
675
|
let t = JSON.parse(k(p(e, "package.json"), "utf8"));
|
|
621
676
|
return typeof t.version == "string" ? t.version : void 0;
|
|
622
677
|
} catch {
|
|
623
678
|
return;
|
|
624
679
|
}
|
|
625
|
-
},
|
|
680
|
+
}, Nt = (e) => {
|
|
626
681
|
let t = [], n;
|
|
627
682
|
try {
|
|
628
683
|
n = A(e);
|
|
@@ -630,7 +685,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
630
685
|
return t;
|
|
631
686
|
}
|
|
632
687
|
for (let r of n) {
|
|
633
|
-
if (r.startsWith(".") ||
|
|
688
|
+
if (r.startsWith(".") || Ot.test(r)) continue;
|
|
634
689
|
let n = p(e, r);
|
|
635
690
|
if (r.startsWith("@")) {
|
|
636
691
|
let e;
|
|
@@ -656,18 +711,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
656
711
|
});
|
|
657
712
|
}
|
|
658
713
|
return t;
|
|
659
|
-
},
|
|
714
|
+
}, Pt = (e) => {
|
|
660
715
|
let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
|
|
661
|
-
if (!
|
|
716
|
+
if (!Dt(e)) return;
|
|
662
717
|
let i = t.get(e) ?? /* @__PURE__ */ new Map();
|
|
663
718
|
i.has(n) || i.set(n, r), t.set(e, i);
|
|
664
719
|
};
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
let t = At(r);
|
|
720
|
+
for (let t of kt(e)) for (let { pkg: e, dir: r } of Nt(t)) {
|
|
721
|
+
let t = Mt(r);
|
|
668
722
|
t !== void 0 && n(e, t, r);
|
|
669
723
|
}
|
|
670
|
-
for (let { pkg:
|
|
724
|
+
for (let { pkg: t, version: r, dir: i } of jt(e)) n(t, r, i);
|
|
671
725
|
let r = [];
|
|
672
726
|
for (let [n, i] of t) i.size < 2 || r.push({
|
|
673
727
|
pkg: n,
|
|
@@ -675,7 +729,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
675
729
|
paths: [...i.values()].map((t) => m(e, t)).sort()
|
|
676
730
|
});
|
|
677
731
|
return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
|
|
678
|
-
},
|
|
732
|
+
}, Ft = (e) => {
|
|
679
733
|
if (e.length !== 0) return [
|
|
680
734
|
`• ${e.length} package(s) resolved at more than one version:`,
|
|
681
735
|
...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
|
|
@@ -693,12 +747,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
693
747
|
" instrument), then reinstall. Do not silence the generated file — it is where",
|
|
694
748
|
" a genuine mistake in your own descriptors surfaces."
|
|
695
749
|
].join("\n");
|
|
696
|
-
},
|
|
750
|
+
}, It = (e) => {
|
|
697
751
|
let t = /* @__PURE__ */ new Map();
|
|
698
|
-
|
|
699
|
-
for (let n of Dt(e)) for (let { pkg: e, dir: r } of jt(n)) {
|
|
752
|
+
for (let n of kt(e)) for (let { pkg: e, dir: r } of Nt(n)) {
|
|
700
753
|
if (!e.startsWith("@voltro/")) continue;
|
|
701
|
-
let n =
|
|
754
|
+
let n = Mt(r);
|
|
702
755
|
n !== void 0 && !t.has(e) && t.set(e, n);
|
|
703
756
|
}
|
|
704
757
|
if (t.size < 2) return;
|
|
@@ -713,7 +766,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
713
766
|
version: t
|
|
714
767
|
})).sort((e, t) => e.pkg.localeCompare(t.pkg))
|
|
715
768
|
};
|
|
716
|
-
},
|
|
769
|
+
}, Lt = (e) => {
|
|
717
770
|
if (e !== void 0) return [
|
|
718
771
|
`• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
|
|
719
772
|
...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
|
|
@@ -731,60 +784,60 @@ __installPublicEnv(publicEnvValues)
|
|
|
731
784
|
" its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
|
|
732
785
|
" which silently skips `@voltro/i18n` because the name contains digits."
|
|
733
786
|
].join("\n");
|
|
734
|
-
},
|
|
735
|
-
let n =
|
|
787
|
+
}, Rt = (e, t) => {
|
|
788
|
+
let n = It(e);
|
|
736
789
|
n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
|
|
737
790
|
majority: n.majority,
|
|
738
791
|
behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
|
|
739
792
|
fix: "the framework ships in lockstep; bump the listed packages and reinstall"
|
|
740
793
|
});
|
|
741
|
-
},
|
|
794
|
+
}, zt = S({ scope: "vite" }), Bt = /\x1b\[[0-9;]*m/g, Vt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ht = (e) => e.replace(Bt, "").replace(Vt, "").trim(), Ut = /proxy error/i, Wt = [
|
|
742
795
|
"ECONNREFUSED",
|
|
743
796
|
"ECONNRESET",
|
|
744
797
|
"ECONNABORTED",
|
|
745
798
|
"EPIPE",
|
|
746
799
|
"ETIMEDOUT"
|
|
747
|
-
],
|
|
800
|
+
], Gt = (e, t = 0) => {
|
|
748
801
|
if (e == null || t > 5) return !1;
|
|
749
802
|
let n = e;
|
|
750
|
-
return typeof n.code == "string" &&
|
|
751
|
-
},
|
|
803
|
+
return typeof n.code == "string" && Wt.includes(n.code) || typeof n.message == "string" && Wt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Gt(e, t + 1)) ? !0 : Gt(n.cause, t + 1);
|
|
804
|
+
}, Kt = 4e3, qt = () => {
|
|
752
805
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
753
806
|
hasWarned: !1,
|
|
754
807
|
info: (e) => {
|
|
755
|
-
let t =
|
|
756
|
-
t.length !== 0 &&
|
|
808
|
+
let t = Ht(e);
|
|
809
|
+
t.length !== 0 && zt.info(t);
|
|
757
810
|
},
|
|
758
811
|
warn: (e) => {
|
|
759
812
|
n.hasWarned = !0;
|
|
760
|
-
let t =
|
|
761
|
-
t.length !== 0 &&
|
|
813
|
+
let t = Ht(e);
|
|
814
|
+
t.length !== 0 && zt.warn(t);
|
|
762
815
|
},
|
|
763
816
|
warnOnce: (t) => {
|
|
764
|
-
let r =
|
|
765
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
817
|
+
let r = Ht(t);
|
|
818
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && zt.warn(r));
|
|
766
819
|
},
|
|
767
820
|
error: (e, n) => {
|
|
768
|
-
let r =
|
|
821
|
+
let r = Ht(e), i = n?.error;
|
|
769
822
|
if (r.length !== 0) {
|
|
770
|
-
if (
|
|
823
|
+
if (Ut.test(r) && Gt(i)) {
|
|
771
824
|
let e = Date.now();
|
|
772
|
-
e - t >
|
|
825
|
+
e - t > Kt && (t = e, zt.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
773
826
|
return;
|
|
774
827
|
}
|
|
775
|
-
|
|
828
|
+
zt.error(r, {}, i);
|
|
776
829
|
}
|
|
777
830
|
},
|
|
778
831
|
clearScreen: () => {},
|
|
779
832
|
hasErrorLogged: (e) => !1
|
|
780
833
|
};
|
|
781
834
|
return n;
|
|
782
|
-
},
|
|
835
|
+
}, Jt = (e = process.env) => {
|
|
783
836
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
784
837
|
if (t === void 0 || t.trim() === "") return 4;
|
|
785
838
|
let n = Number(t);
|
|
786
839
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
787
|
-
},
|
|
840
|
+
}, Yt = (e) => {
|
|
788
841
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
789
842
|
let e = r.shift();
|
|
790
843
|
e ? e() : n--;
|
|
@@ -802,8 +855,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
802
855
|
return n;
|
|
803
856
|
}
|
|
804
857
|
};
|
|
805
|
-
},
|
|
806
|
-
let t =
|
|
858
|
+
}, Xt = (e) => {
|
|
859
|
+
let t = Yt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
807
860
|
return {
|
|
808
861
|
load: (i, a) => {
|
|
809
862
|
if (r.has(i)) return a();
|
|
@@ -833,7 +886,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
833
886
|
return r.size;
|
|
834
887
|
}
|
|
835
888
|
};
|
|
836
|
-
},
|
|
889
|
+
}, Zt = (e) => {
|
|
837
890
|
let t = [];
|
|
838
891
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
839
892
|
name: n.slice(5, -2),
|
|
@@ -849,7 +902,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
849
902
|
optional: !1
|
|
850
903
|
});
|
|
851
904
|
return t;
|
|
852
|
-
},
|
|
905
|
+
}, Qt = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), $t = async (e) => {
|
|
853
906
|
let t = h(e);
|
|
854
907
|
for (let e = 0; e < 4; e++) {
|
|
855
908
|
let e = p(t, "project.json");
|
|
@@ -867,8 +920,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
867
920
|
t = n;
|
|
868
921
|
}
|
|
869
922
|
return null;
|
|
870
|
-
},
|
|
871
|
-
let t = await
|
|
923
|
+
}, en = async (e) => {
|
|
924
|
+
let t = await $t(e);
|
|
872
925
|
if (!t) return [];
|
|
873
926
|
let { projectDir: n, manifest: r } = t, i = u(e), a = r.apps ?? {}, o = [];
|
|
874
927
|
for (let [e, t] of Object.entries(a)) {
|
|
@@ -880,20 +933,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
880
933
|
let { pages: e } = await $(r);
|
|
881
934
|
a = e.map((e) => ({
|
|
882
935
|
pattern: e.pattern,
|
|
883
|
-
params:
|
|
936
|
+
params: Zt(e.pattern)
|
|
884
937
|
}));
|
|
885
938
|
} catch {
|
|
886
939
|
continue;
|
|
887
940
|
}
|
|
888
941
|
o.push({
|
|
889
|
-
key:
|
|
942
|
+
key: Qt(e),
|
|
890
943
|
origin: `http://localhost:${t.port}`,
|
|
891
944
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
892
945
|
routes: a
|
|
893
946
|
});
|
|
894
947
|
}
|
|
895
948
|
return o;
|
|
896
|
-
},
|
|
949
|
+
}, tn = (e) => {
|
|
897
950
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
898
951
|
let t = e.pattern;
|
|
899
952
|
for (let n of e.params) {
|
|
@@ -901,21 +954,21 @@ __installPublicEnv(publicEnvValues)
|
|
|
901
954
|
t = t.replace(e, r);
|
|
902
955
|
}
|
|
903
956
|
return "`" + t + "`";
|
|
904
|
-
},
|
|
957
|
+
}, nn = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
905
958
|
let t = "string";
|
|
906
959
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
907
|
-
}).join("; ")} }`,
|
|
908
|
-
let r =
|
|
960
|
+
}).join("; ")} }`, rn = (e, t, n) => {
|
|
961
|
+
let r = nn(e), i = tn(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
|
|
909
962
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
910
|
-
},
|
|
963
|
+
}, an = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${rn(e, !1)},`).join("\n")}\n}`, on = (e, t) => {
|
|
911
964
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
912
|
-
let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${
|
|
965
|
+
let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${rn(e, !0, i)},`);
|
|
913
966
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
914
|
-
},
|
|
967
|
+
}, sn = async (e) => {
|
|
915
968
|
let t = e.pages.map((e) => ({
|
|
916
969
|
pattern: e.pattern,
|
|
917
|
-
params:
|
|
918
|
-
})), n = await
|
|
970
|
+
params: Zt(e.pattern)
|
|
971
|
+
})), n = await en(e.appRoot), r = [
|
|
919
972
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
920
973
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
921
974
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -924,7 +977,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
924
977
|
"",
|
|
925
978
|
"type EmptyParams = Record<string, never>",
|
|
926
979
|
""
|
|
927
|
-
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${
|
|
980
|
+
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${an(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => on(e, i)).join("\n")}\n} as const\n`}`, o = p(e.appRoot, ".framework", "routes.generated.ts");
|
|
928
981
|
await O.mkdir(d(o), { recursive: !0 });
|
|
929
982
|
let s = null;
|
|
930
983
|
try {
|
|
@@ -937,37 +990,37 @@ __installPublicEnv(publicEnvValues)
|
|
|
937
990
|
path: o,
|
|
938
991
|
wrote: !0
|
|
939
992
|
});
|
|
940
|
-
},
|
|
993
|
+
}, cn = (e) => {
|
|
941
994
|
if (e === "" || e === "/") return "/";
|
|
942
995
|
let t = e.startsWith("/") ? e : `/${e}`;
|
|
943
996
|
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
944
|
-
},
|
|
945
|
-
let n = e.endsWith("/") ? e.slice(0, -1) : e, r =
|
|
997
|
+
}, ln = (e, t) => {
|
|
998
|
+
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = cn(t);
|
|
946
999
|
return r === "/" ? `${n}/` : `${n}${r}`;
|
|
947
|
-
},
|
|
948
|
-
let r =
|
|
1000
|
+
}, un = (e, t, n) => {
|
|
1001
|
+
let r = cn(e);
|
|
949
1002
|
return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
|
|
950
|
-
},
|
|
1003
|
+
}, dn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), fn = (e) => {
|
|
951
1004
|
let { siteUrl: t, entries: n } = e, r = e.locales && e.locales.length > 1 ? e.locales : void 0, i = e.defaultLocale ?? r?.[0] ?? "en", a = r !== void 0, o = /* @__PURE__ */ new Map(), s = (e) => {
|
|
952
1005
|
if (!r) return "";
|
|
953
|
-
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${
|
|
954
|
-
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${ln(
|
|
1006
|
+
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${dn(n)}" href="${dn(ln(t, un(e, n, i)))}" />`);
|
|
1007
|
+
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${dn(ln(t, un(e, i, i)))}" />`), `\n${n.join("\n")}`;
|
|
955
1008
|
};
|
|
956
1009
|
for (let e of n) {
|
|
957
1010
|
let n = r ?? [i];
|
|
958
1011
|
for (let r of n) {
|
|
959
|
-
let n =
|
|
960
|
-
o.set(n, ` <url>\n <loc>${
|
|
1012
|
+
let n = ln(t, un(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${dn(e.lastmod)}</lastmod>` : "";
|
|
1013
|
+
o.set(n, ` <url>\n <loc>${dn(n)}</loc>${a}${s(e.path)}\n </url>`);
|
|
961
1014
|
}
|
|
962
1015
|
}
|
|
963
1016
|
let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
|
|
964
1017
|
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset${a ? " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"" : " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\""}>\n${c}\n</urlset>\n`;
|
|
965
|
-
},
|
|
1018
|
+
}, pn = (e) => {
|
|
966
1019
|
if (!e.indexable) return "User-agent: *\nDisallow: /\n";
|
|
967
1020
|
let t = ["User-agent: *", "Allow: /"];
|
|
968
|
-
for (let n of e.disallow ?? []) t.push(`Disallow: ${
|
|
1021
|
+
for (let n of e.disallow ?? []) t.push(`Disallow: ${cn(n)}`);
|
|
969
1022
|
return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
|
|
970
|
-
},
|
|
1023
|
+
}, mn = 256, hn = (e = mn) => {
|
|
971
1024
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
972
1025
|
return {
|
|
973
1026
|
emit(r, i) {
|
|
@@ -990,17 +1043,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
990
1043
|
return t.slice();
|
|
991
1044
|
}
|
|
992
1045
|
};
|
|
993
|
-
},
|
|
994
|
-
let n =
|
|
1046
|
+
}, gn = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, _n = () => `: keep-alive ${Date.now()}\n\n`, vn = 8e3, yn = (e, t = vn) => {
|
|
1047
|
+
let n = xn(e);
|
|
995
1048
|
return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
|
|
996
|
-
},
|
|
1049
|
+
}, bn = 4, xn = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
|
|
997
1050
|
if (e instanceof Error) {
|
|
998
1051
|
let r = e.stack ?? `${e.name}: ${e.message}`;
|
|
999
1052
|
if (n.has(e)) return `${r}\n [cycle]`;
|
|
1000
1053
|
n.add(e);
|
|
1001
1054
|
let i = [];
|
|
1002
|
-
if (t <
|
|
1003
|
-
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${
|
|
1055
|
+
if (t < bn) if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Sn(xn(a, t + 1, n))}`);
|
|
1056
|
+
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Sn(xn(e.cause, t + 1, n))}`);
|
|
1004
1057
|
return r + i.join("");
|
|
1005
1058
|
}
|
|
1006
1059
|
try {
|
|
@@ -1008,30 +1061,30 @@ __installPublicEnv(publicEnvValues)
|
|
|
1008
1061
|
} catch {
|
|
1009
1062
|
return "[unstringifiable thrown value]";
|
|
1010
1063
|
}
|
|
1011
|
-
},
|
|
1064
|
+
}, Sn = (e) => {
|
|
1012
1065
|
let t = e.split("\n");
|
|
1013
1066
|
return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
|
|
1014
|
-
},
|
|
1067
|
+
}, Cn = {
|
|
1015
1068
|
trace: 0,
|
|
1016
1069
|
debug: 1,
|
|
1017
1070
|
info: 2,
|
|
1018
1071
|
warn: 3,
|
|
1019
1072
|
error: 4,
|
|
1020
1073
|
fatal: 5
|
|
1021
|
-
},
|
|
1074
|
+
}, wn = 2e3, Tn = 200, En = class {
|
|
1022
1075
|
capacity;
|
|
1023
1076
|
buffer = [];
|
|
1024
|
-
constructor(e =
|
|
1077
|
+
constructor(e = wn) {
|
|
1025
1078
|
this.capacity = e;
|
|
1026
1079
|
}
|
|
1027
1080
|
append(e) {
|
|
1028
1081
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
1029
1082
|
}
|
|
1030
1083
|
query(e = {}) {
|
|
1031
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
1084
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Tn, this.capacity), i = e.minLevel === void 0 ? Cn.trace : Cn[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
1032
1085
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
1033
1086
|
let r = this.buffer[e];
|
|
1034
|
-
r.ts < t || r.ts > n ||
|
|
1087
|
+
r.ts < t || r.ts > n || Cn[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);
|
|
1035
1088
|
}
|
|
1036
1089
|
return l.reverse();
|
|
1037
1090
|
}
|
|
@@ -1044,7 +1097,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1044
1097
|
clear() {
|
|
1045
1098
|
this.buffer = [];
|
|
1046
1099
|
}
|
|
1047
|
-
},
|
|
1100
|
+
}, Dn = null, On = () => (Dn === null && (Dn = new En()), Dn), kn = (e) => {
|
|
1048
1101
|
if (typeof e == "string") return e;
|
|
1049
1102
|
if (e instanceof Error) return e.message;
|
|
1050
1103
|
try {
|
|
@@ -1052,28 +1105,28 @@ __installPublicEnv(publicEnvValues)
|
|
|
1052
1105
|
} catch {
|
|
1053
1106
|
return String(e);
|
|
1054
1107
|
}
|
|
1055
|
-
},
|
|
1108
|
+
}, An = 8e3, jn = (e) => typeof e == "string" ? e.length <= An ? e : `${e.slice(0, An)}… [voltro: truncated]` : typeof e != "object" || !e ? e : yn(e, An), Mn = (e, t) => {
|
|
1056
1109
|
try {
|
|
1057
1110
|
e(...t);
|
|
1058
1111
|
} catch (n) {
|
|
1059
1112
|
try {
|
|
1060
|
-
e(...t.map(
|
|
1113
|
+
e(...t.map(jn)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${An} chars per argument.`);
|
|
1061
1114
|
} catch {
|
|
1062
1115
|
e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
|
|
1063
1116
|
}
|
|
1064
1117
|
}
|
|
1065
|
-
},
|
|
1118
|
+
}, Nn = (e) => {
|
|
1066
1119
|
let t = {
|
|
1067
1120
|
log: console.log.bind(console),
|
|
1068
1121
|
info: console.info.bind(console),
|
|
1069
1122
|
warn: console.warn.bind(console),
|
|
1070
1123
|
error: console.error.bind(console),
|
|
1071
1124
|
debug: console.debug.bind(console)
|
|
1072
|
-
}, n =
|
|
1073
|
-
if (
|
|
1125
|
+
}, n = On(), r = !1, i = (i) => (...a) => {
|
|
1126
|
+
if (Mn(t[i], a), !r) {
|
|
1074
1127
|
r = !0;
|
|
1075
1128
|
try {
|
|
1076
|
-
let t = a.length > 0 ?
|
|
1129
|
+
let t = a.length > 0 ? kn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = F();
|
|
1077
1130
|
e.emit("log", {
|
|
1078
1131
|
level: i,
|
|
1079
1132
|
message: r,
|
|
@@ -1111,7 +1164,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1111
1164
|
argsCount: 1,
|
|
1112
1165
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
1113
1166
|
});
|
|
1114
|
-
let a =
|
|
1167
|
+
let a = F(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
1115
1168
|
...t.fields,
|
|
1116
1169
|
traceId: a.traceId
|
|
1117
1170
|
} : t.fields;
|
|
@@ -1131,24 +1184,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
1131
1184
|
return () => {
|
|
1132
1185
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
1133
1186
|
};
|
|
1134
|
-
},
|
|
1187
|
+
}, Pn = 2e3, Fn = 8, In = 1e3, Ln = 200, Y = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Rn = (e) => {
|
|
1135
1188
|
switch (e) {
|
|
1136
1189
|
case "error": return "error";
|
|
1137
1190
|
case "warn": return "warn";
|
|
1138
1191
|
case "debug": return "debug";
|
|
1139
1192
|
default: return "info";
|
|
1140
1193
|
}
|
|
1141
|
-
},
|
|
1194
|
+
}, zn = S({ scope: "client" }), Bn = (e, t) => {
|
|
1142
1195
|
let n;
|
|
1143
1196
|
try {
|
|
1144
1197
|
n = JSON.parse(e);
|
|
1145
1198
|
} catch {
|
|
1146
|
-
return
|
|
1199
|
+
return Vn(400, { error: "invalid JSON body" });
|
|
1147
1200
|
}
|
|
1148
|
-
if (typeof n != "object" || !n) return
|
|
1201
|
+
if (typeof n != "object" || !n) return Vn(400, { error: "body must be a JSON object" });
|
|
1149
1202
|
let r = n;
|
|
1150
|
-
if (!Array.isArray(r.entries)) return
|
|
1151
|
-
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,
|
|
1203
|
+
if (!Array.isArray(r.entries)) return Vn(400, { error: "entries must be an array" });
|
|
1204
|
+
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, Ln), c = 0;
|
|
1152
1205
|
for (let e of s) {
|
|
1153
1206
|
if (typeof e != "object" || !e) continue;
|
|
1154
1207
|
let n = e;
|
|
@@ -1159,7 +1212,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1159
1212
|
"warn",
|
|
1160
1213
|
"error",
|
|
1161
1214
|
"debug"
|
|
1162
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Y(n.message,
|
|
1215
|
+
].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, Fn).filter((e) => typeof e == "string").map((e) => Y(e, In)) : void 0, d = typeof n.stack == "string" ? Y(n.stack, Pn) : void 0;
|
|
1163
1216
|
t.emit("clientLog", {
|
|
1164
1217
|
ts: s,
|
|
1165
1218
|
level: r,
|
|
@@ -1174,35 +1227,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
1174
1227
|
...i === void 0 ? {} : { app: i },
|
|
1175
1228
|
...a === void 0 ? {} : { page: a },
|
|
1176
1229
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
1177
|
-
}, p =
|
|
1178
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
1230
|
+
}, p = Rn(r);
|
|
1231
|
+
(p === "error" || p === "warn") && d !== void 0 ? zn[p](l, f, { stack: d }) : zn[p](l, {
|
|
1179
1232
|
...f,
|
|
1180
1233
|
...d === void 0 ? {} : { stack: d }
|
|
1181
1234
|
}), c++;
|
|
1182
1235
|
}
|
|
1183
|
-
return
|
|
1236
|
+
return Vn(202, {
|
|
1184
1237
|
accepted: c,
|
|
1185
1238
|
dropped: r.entries.length - c
|
|
1186
1239
|
});
|
|
1187
|
-
},
|
|
1240
|
+
}, Vn = (e, t) => ({
|
|
1188
1241
|
status: e,
|
|
1189
1242
|
contentType: "application/json; charset=utf-8",
|
|
1190
1243
|
body: JSON.stringify(t)
|
|
1191
|
-
}),
|
|
1244
|
+
}), Hn = "/_voltro/inspect/clientLog", Un = [
|
|
1192
1245
|
"trace",
|
|
1193
1246
|
"debug",
|
|
1194
1247
|
"info",
|
|
1195
1248
|
"warn",
|
|
1196
1249
|
"error",
|
|
1197
1250
|
"fatal"
|
|
1198
|
-
],
|
|
1251
|
+
], Wn = {
|
|
1199
1252
|
trace: "TRACE",
|
|
1200
1253
|
debug: "DEBUG",
|
|
1201
1254
|
info: "INFO ",
|
|
1202
1255
|
warn: "WARN ",
|
|
1203
1256
|
error: "ERROR",
|
|
1204
1257
|
fatal: "FATAL"
|
|
1205
|
-
},
|
|
1258
|
+
}, Gn = (e) => Un.includes(e), Kn = (e, t, n = {}) => {
|
|
1206
1259
|
if (c()) return {
|
|
1207
1260
|
status: 503,
|
|
1208
1261
|
contentType: "application/json",
|
|
@@ -1233,7 +1286,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1233
1286
|
Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
|
|
1234
1287
|
}
|
|
1235
1288
|
let f = a.get("level");
|
|
1236
|
-
f !== null &&
|
|
1289
|
+
f !== null && Gn(f) && (o.minLevel = f);
|
|
1237
1290
|
let p = a.get("source");
|
|
1238
1291
|
(p === "server" || p === "client") && (o.source = p);
|
|
1239
1292
|
let m = a.get("scope");
|
|
@@ -1246,7 +1299,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1246
1299
|
if ((a.get("format") ?? "json") === "text") return {
|
|
1247
1300
|
status: 200,
|
|
1248
1301
|
contentType: "text/plain; charset=utf-8",
|
|
1249
|
-
body: _.map(
|
|
1302
|
+
body: _.map(qn).join("\n") + (_.length > 0 ? "\n" : "")
|
|
1250
1303
|
};
|
|
1251
1304
|
let v = {
|
|
1252
1305
|
capturedAt: Date.now(),
|
|
@@ -1260,40 +1313,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
1260
1313
|
contentType: "application/json; charset=utf-8",
|
|
1261
1314
|
body: JSON.stringify(v)
|
|
1262
1315
|
};
|
|
1263
|
-
},
|
|
1264
|
-
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 =
|
|
1265
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1266
|
-
},
|
|
1316
|
+
}, qn = (e) => {
|
|
1317
|
+
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 = Yn(e.fields);
|
|
1318
|
+
return `${n}:${r}:${i}.${a} ${Wn[e.level]} ${o} ${e.message}${s}`;
|
|
1319
|
+
}, Jn = 80, Yn = (e) => {
|
|
1267
1320
|
let t = Object.entries(e);
|
|
1268
1321
|
if (t.length === 0) return "";
|
|
1269
1322
|
let n = [];
|
|
1270
1323
|
for (let [e, r] of t) {
|
|
1271
1324
|
if (r === void 0) continue;
|
|
1272
|
-
let t =
|
|
1325
|
+
let t = Xn(r);
|
|
1273
1326
|
n.push(`${e}=${t}`);
|
|
1274
1327
|
}
|
|
1275
1328
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1276
|
-
},
|
|
1329
|
+
}, Xn = (e) => {
|
|
1277
1330
|
if (typeof e == "string") {
|
|
1278
|
-
let t = e.length >
|
|
1331
|
+
let t = e.length > Jn ? e.slice(0, Jn) + "…" : e;
|
|
1279
1332
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1280
1333
|
}
|
|
1281
1334
|
if (e === null) return "null";
|
|
1282
1335
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1283
1336
|
try {
|
|
1284
1337
|
let t = JSON.stringify(e);
|
|
1285
|
-
return t.length >
|
|
1338
|
+
return t.length > Jn ? t.slice(0, Jn) + "…" : t;
|
|
1286
1339
|
} catch {
|
|
1287
1340
|
return "[unserialisable]";
|
|
1288
1341
|
}
|
|
1289
|
-
},
|
|
1342
|
+
}, Zn = "/_voltro/inspect/logs", Qn = (e, t, n) => {
|
|
1290
1343
|
if (t.headers.authorization !== void 0) return !1;
|
|
1291
1344
|
let { token: r } = n;
|
|
1292
1345
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
1293
1346
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
1294
1347
|
let i = n.writeToken;
|
|
1295
1348
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
1296
|
-
},
|
|
1349
|
+
}, $n = [{
|
|
1297
1350
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1298
1351
|
handle: (e, t) => {
|
|
1299
1352
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1305,13 +1358,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1305
1358
|
});
|
|
1306
1359
|
} else t.info(n);
|
|
1307
1360
|
}
|
|
1308
|
-
}],
|
|
1361
|
+
}], er = () => {
|
|
1309
1362
|
let e = {
|
|
1310
1363
|
warn: console.warn.bind(console),
|
|
1311
1364
|
error: console.error.bind(console)
|
|
1312
1365
|
}, t = S({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1313
1366
|
if (!n) {
|
|
1314
|
-
for (let e of
|
|
1367
|
+
for (let e of $n) if (e.match(i[0])) {
|
|
1315
1368
|
n = !0;
|
|
1316
1369
|
try {
|
|
1317
1370
|
e.handle(i, t);
|
|
@@ -1326,7 +1379,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1326
1379
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1327
1380
|
console.warn = e.warn, console.error = e.error;
|
|
1328
1381
|
};
|
|
1329
|
-
},
|
|
1382
|
+
}, tr = {
|
|
1330
1383
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1331
1384
|
renderMode: "it picks the server render strategy",
|
|
1332
1385
|
dynamic: "it picks the server render strategy",
|
|
@@ -1337,7 +1390,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1337
1390
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1338
1391
|
interactive: "it decides how much client JS the server ships",
|
|
1339
1392
|
tenantAware: "it is part of the server-side cache key"
|
|
1340
|
-
},
|
|
1393
|
+
}, nr = Object.keys(tr), rr = (e) => t.test(e), ir = (e) => e.replace(/page\.tsx$/, "page.test.tsx"), ar = "virtual:voltro-route-refresh", or = `\0${ar}`, sr = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, cr = () => `
|
|
1341
1394
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1342
1395
|
|
|
1343
1396
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1366,11 +1419,11 @@ const stableForm = (value) => {
|
|
|
1366
1419
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1367
1420
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1368
1421
|
* value. Everything else a page exports is plain client-side data. */
|
|
1369
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1422
|
+
const serverRelevantExports = ${JSON.stringify(nr)}
|
|
1370
1423
|
|
|
1371
1424
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1372
1425
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1373
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1426
|
+
const serverExportEffect = ${JSON.stringify(tr)}
|
|
1374
1427
|
|
|
1375
1428
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1376
1429
|
export const serverEffectOf = (name) =>
|
|
@@ -1413,7 +1466,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1413
1466
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1414
1467
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1415
1468
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1416
|
-
`,
|
|
1469
|
+
`, lr = (e) => `
|
|
1417
1470
|
if (import.meta.hot) {
|
|
1418
1471
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1419
1472
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1440,57 +1493,57 @@ import {
|
|
|
1440
1493
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1441
1494
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1442
1495
|
serverEffectOf as __voltro_serverEffect,
|
|
1443
|
-
} from '${
|
|
1444
|
-
`,
|
|
1445
|
-
let [i = "", a] =
|
|
1446
|
-
if (!i.endsWith(".tsx") || a !== void 0 &&
|
|
1447
|
-
let o =
|
|
1496
|
+
} from '${ar}'
|
|
1497
|
+
`, ur = (e) => e.replace(/\\/g, "/"), dr = (e, t) => {
|
|
1498
|
+
let [i = "", a] = ur(e).split("?");
|
|
1499
|
+
if (!i.endsWith(".tsx") || a !== void 0 && sr.test(a)) return !1;
|
|
1500
|
+
let o = ur(t).replace(/\/$/, "");
|
|
1448
1501
|
return i.startsWith(`${o}/`) ? r.test(i) || n.has(i.slice(i.lastIndexOf("/") + 1)) : !1;
|
|
1449
|
-
},
|
|
1502
|
+
}, fr = (e, t, n) => dr(t, n) ? `${e}${lr(ur(t).split("?")[0] ?? t)}` : null, pr = (e) => ({
|
|
1450
1503
|
name: "voltro:route-fast-refresh",
|
|
1451
1504
|
enforce: "pre",
|
|
1452
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1453
|
-
load: (e) => e ===
|
|
1505
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? or : void 0,
|
|
1506
|
+
load: (e) => e === or ? cr() : void 0,
|
|
1454
1507
|
transform: (t, n, r) => {
|
|
1455
1508
|
if (r?.ssr === !0) return null;
|
|
1456
|
-
let i =
|
|
1509
|
+
let i = fr(t, n, e);
|
|
1457
1510
|
return i === null ? null : {
|
|
1458
1511
|
code: i,
|
|
1459
1512
|
map: null
|
|
1460
1513
|
};
|
|
1461
1514
|
}
|
|
1462
|
-
}),
|
|
1515
|
+
}), mr = [
|
|
1463
1516
|
"static",
|
|
1464
1517
|
"spa",
|
|
1465
1518
|
"ssr",
|
|
1466
1519
|
"isr"
|
|
1467
|
-
],
|
|
1520
|
+
], hr = (e) => typeof e == "string" && mr.includes(e), gr = mr.map((e) => `'${e}'`).join(" | "), _r = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${gr}.${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)." : ""}`, vr = class extends Error {
|
|
1468
1521
|
page;
|
|
1469
1522
|
value;
|
|
1470
1523
|
name = "InvalidRenderModeError";
|
|
1471
1524
|
constructor(e, t) {
|
|
1472
|
-
super(
|
|
1525
|
+
super(_r(e, t)), this.page = e, this.value = t;
|
|
1473
1526
|
}
|
|
1474
|
-
},
|
|
1527
|
+
}, yr = (e, t = "<page>") => {
|
|
1475
1528
|
if (e.renderMode !== void 0 && e.renderMode !== null) {
|
|
1476
|
-
if (!
|
|
1529
|
+
if (!hr(e.renderMode)) throw new vr(t, String(e.renderMode));
|
|
1477
1530
|
return e.renderMode;
|
|
1478
1531
|
}
|
|
1479
1532
|
return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
|
|
1480
|
-
},
|
|
1481
|
-
renderMode:
|
|
1533
|
+
}, br = (e, t = "<page>") => ({
|
|
1534
|
+
renderMode: yr(e, t),
|
|
1482
1535
|
tenantAware: e.tenantAware === !0,
|
|
1483
|
-
revalidateMs:
|
|
1484
|
-
staleWhileRevalidateMs:
|
|
1536
|
+
revalidateMs: J(e.revalidate),
|
|
1537
|
+
staleWhileRevalidateMs: J(e.staleWhileRevalidate) ?? 0,
|
|
1485
1538
|
cacheInvalidatesOn: Array.isArray(e.cacheInvalidatesOn) ? e.cacheInvalidatesOn : [],
|
|
1486
1539
|
interactive: e.interactive ?? "full",
|
|
1487
1540
|
hasLoader: typeof e.loader == "function",
|
|
1488
1541
|
hasMeta: e.meta != null,
|
|
1489
1542
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1490
|
-
}),
|
|
1491
|
-
|
|
1543
|
+
}), xr = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Sr = (e) => xr.exec(e)?.[1] ?? null, Cr = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, wr = (e) => {
|
|
1544
|
+
Cr.lastIndex = 0;
|
|
1492
1545
|
let t;
|
|
1493
|
-
for (; (t =
|
|
1546
|
+
for (; (t = Cr.exec(e)) !== null;) {
|
|
1494
1547
|
let e = t[2];
|
|
1495
1548
|
if (e.startsWith(".")) for (let n of t[1].split(",")) {
|
|
1496
1549
|
let t = n.lastIndexOf(" as ");
|
|
@@ -1498,16 +1551,16 @@ import {
|
|
|
1498
1551
|
}
|
|
1499
1552
|
}
|
|
1500
1553
|
return null;
|
|
1501
|
-
},
|
|
1554
|
+
}, Tr = /export\s*\{([^}]*)\}/g, Er = (e) => {
|
|
1502
1555
|
if (/export\s+default\b/.test(e)) return !0;
|
|
1503
|
-
|
|
1556
|
+
Tr.lastIndex = 0;
|
|
1504
1557
|
let t;
|
|
1505
|
-
for (; (t =
|
|
1558
|
+
for (; (t = Tr.exec(e)) !== null;) for (let e of t[1].split(",")) {
|
|
1506
1559
|
let t = e.lastIndexOf(" as ");
|
|
1507
1560
|
if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
|
|
1508
1561
|
}
|
|
1509
1562
|
return !1;
|
|
1510
|
-
},
|
|
1563
|
+
}, Dr = async (e, t) => {
|
|
1511
1564
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1512
1565
|
let n;
|
|
1513
1566
|
try {
|
|
@@ -1515,17 +1568,17 @@ import {
|
|
|
1515
1568
|
} catch {
|
|
1516
1569
|
return null;
|
|
1517
1570
|
}
|
|
1518
|
-
let r =
|
|
1519
|
-
return r !== null && !
|
|
1571
|
+
let r = Sr(n);
|
|
1572
|
+
return r !== null && !hr(r) ? _r(p("src", "pages", t.file), r) : Er(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.`;
|
|
1520
1573
|
}))).filter((e) => e !== null);
|
|
1521
1574
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1522
|
-
}, X = p(
|
|
1575
|
+
}, X = p(L(), ".voltro", "logs"), Or = () => {
|
|
1523
1576
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1524
1577
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1525
|
-
},
|
|
1526
|
-
if (
|
|
1527
|
-
|
|
1528
|
-
let e = Date.now() -
|
|
1578
|
+
}, kr = !1, Ar = () => {
|
|
1579
|
+
if (kr) return;
|
|
1580
|
+
kr = !0;
|
|
1581
|
+
let e = Date.now() - Or(), t = [];
|
|
1529
1582
|
try {
|
|
1530
1583
|
t = A(X);
|
|
1531
1584
|
} catch {
|
|
@@ -1538,8 +1591,8 @@ import {
|
|
|
1538
1591
|
j(t).mtimeMs < e && M(t);
|
|
1539
1592
|
} catch {}
|
|
1540
1593
|
}
|
|
1541
|
-
},
|
|
1542
|
-
let t =
|
|
1594
|
+
}, jr = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), Mr = (e, t) => p(X, `${jr(e)}-${t}.log`), Nr = (e) => {
|
|
1595
|
+
let t = jr(e), n = [];
|
|
1543
1596
|
try {
|
|
1544
1597
|
n = A(X);
|
|
1545
1598
|
} catch {
|
|
@@ -1556,12 +1609,12 @@ import {
|
|
|
1556
1609
|
} catch {}
|
|
1557
1610
|
}
|
|
1558
1611
|
return i;
|
|
1559
|
-
},
|
|
1612
|
+
}, Pr = (e) => {
|
|
1560
1613
|
try {
|
|
1561
1614
|
E(X, { recursive: !0 });
|
|
1562
1615
|
} catch {}
|
|
1563
|
-
|
|
1564
|
-
let t =
|
|
1616
|
+
Ar();
|
|
1617
|
+
let t = Mr(e, process.pid), n = D(t, "w"), r = (e) => {
|
|
1565
1618
|
let t = {
|
|
1566
1619
|
ts: e.ts.getTime(),
|
|
1567
1620
|
level: e.level,
|
|
@@ -1584,7 +1637,7 @@ import {
|
|
|
1584
1637
|
}
|
|
1585
1638
|
}, i = !1, a = x((e) => {
|
|
1586
1639
|
if (!i) try {
|
|
1587
|
-
|
|
1640
|
+
P(n, r(e));
|
|
1588
1641
|
} catch {}
|
|
1589
1642
|
}), o = () => {
|
|
1590
1643
|
if (!i) {
|
|
@@ -1602,7 +1655,7 @@ import {
|
|
|
1602
1655
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1603
1656
|
}
|
|
1604
1657
|
};
|
|
1605
|
-
},
|
|
1658
|
+
}, Fr = async (e, t) => {
|
|
1606
1659
|
let n;
|
|
1607
1660
|
try {
|
|
1608
1661
|
n = await O.readFile(e, "utf8");
|
|
@@ -1616,11 +1669,11 @@ import {
|
|
|
1616
1669
|
i.push(t);
|
|
1617
1670
|
} catch {}
|
|
1618
1671
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1619
|
-
},
|
|
1672
|
+
}, Ir = S({ scope: "voltro:dashboard" }), Lr = R(import.meta.url), Rr = 5179, zr = (e) => {
|
|
1620
1673
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1621
1674
|
if (t && T(p(h(t), "app.config.ts"))) return h(t);
|
|
1622
1675
|
try {
|
|
1623
|
-
let e = d(
|
|
1676
|
+
let e = d(Lr.resolve("@voltro/dashboard/package.json"));
|
|
1624
1677
|
if (T(p(e, "app.config.ts"))) return e;
|
|
1625
1678
|
} catch {}
|
|
1626
1679
|
let n = p("voltro-devtools", "apps", "dashboard"), r = h(e);
|
|
@@ -1632,7 +1685,7 @@ import {
|
|
|
1632
1685
|
r = t;
|
|
1633
1686
|
}
|
|
1634
1687
|
return null;
|
|
1635
|
-
},
|
|
1688
|
+
}, Br = "VOLTRO_IS_DASHBOARD", Vr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1636
1689
|
let i = pe({
|
|
1637
1690
|
port: e,
|
|
1638
1691
|
host: t
|
|
@@ -1640,45 +1693,45 @@ import {
|
|
|
1640
1693
|
a || (a = !0, i.destroy(), r(e));
|
|
1641
1694
|
};
|
|
1642
1695
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1643
|
-
}),
|
|
1696
|
+
}), Hr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Ur = () => process.env[Br] === "1", Wr = () => process.stdout.isTTY === !0, Gr = p(L(), ".voltro", "dashboard-launch.lock"), Kr = 1e4, qr = async () => {
|
|
1644
1697
|
try {
|
|
1645
|
-
await O.mkdir(d(
|
|
1646
|
-
let e = await O.open(
|
|
1698
|
+
await O.mkdir(d(Gr), { recursive: !0 });
|
|
1699
|
+
let e = await O.open(Gr, "wx");
|
|
1647
1700
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1648
1701
|
} catch {
|
|
1649
1702
|
try {
|
|
1650
|
-
let e = await O.stat(
|
|
1651
|
-
if (Date.now() - e.mtimeMs >
|
|
1703
|
+
let e = await O.stat(Gr);
|
|
1704
|
+
if (Date.now() - e.mtimeMs > Kr) return await O.unlink(Gr).catch(() => void 0), qr();
|
|
1652
1705
|
} catch {}
|
|
1653
1706
|
return !1;
|
|
1654
1707
|
}
|
|
1655
|
-
},
|
|
1708
|
+
}, Jr = async () => {
|
|
1656
1709
|
try {
|
|
1657
|
-
await O.unlink(
|
|
1710
|
+
await O.unlink(Gr);
|
|
1658
1711
|
} catch {}
|
|
1659
|
-
},
|
|
1712
|
+
}, Yr = async (e) => {
|
|
1660
1713
|
let t = e.port ?? 5179;
|
|
1661
|
-
if (
|
|
1714
|
+
if (Hr()) return {
|
|
1662
1715
|
status: "skipped",
|
|
1663
1716
|
reason: "disabled by flag/env",
|
|
1664
1717
|
port: t
|
|
1665
1718
|
};
|
|
1666
|
-
if (
|
|
1719
|
+
if (Ur()) return {
|
|
1667
1720
|
status: "skipped",
|
|
1668
1721
|
reason: "this process IS the dashboard",
|
|
1669
1722
|
port: t
|
|
1670
1723
|
};
|
|
1671
|
-
if (!
|
|
1724
|
+
if (!Wr()) return {
|
|
1672
1725
|
status: "skipped",
|
|
1673
1726
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1674
1727
|
port: t
|
|
1675
1728
|
};
|
|
1676
|
-
if (!await
|
|
1729
|
+
if (!await qr()) return {
|
|
1677
1730
|
status: "skipped",
|
|
1678
1731
|
reason: "another voltro process is currently launching the dashboard",
|
|
1679
1732
|
port: t
|
|
1680
1733
|
};
|
|
1681
|
-
if (await
|
|
1734
|
+
if (await Vr(t)) return await Jr(), {
|
|
1682
1735
|
status: "already-running",
|
|
1683
1736
|
port: t
|
|
1684
1737
|
};
|
|
@@ -1695,7 +1748,7 @@ import {
|
|
|
1695
1748
|
stdio: "ignore",
|
|
1696
1749
|
env: {
|
|
1697
1750
|
...process.env,
|
|
1698
|
-
[
|
|
1751
|
+
[Br]: "1",
|
|
1699
1752
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1700
1753
|
}
|
|
1701
1754
|
});
|
|
@@ -1703,22 +1756,22 @@ import {
|
|
|
1703
1756
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1704
1757
|
a.kill("SIGTERM");
|
|
1705
1758
|
} catch {}
|
|
1706
|
-
}),
|
|
1759
|
+
}), Ir.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1707
1760
|
port: t,
|
|
1708
1761
|
mode: i,
|
|
1709
1762
|
prebuilt: r
|
|
1710
|
-
}), r ||
|
|
1711
|
-
|
|
1763
|
+
}), r || Ir.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), Ir.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1764
|
+
Jr();
|
|
1712
1765
|
}, 4e3).unref(), {
|
|
1713
1766
|
status: "launched",
|
|
1714
1767
|
port: t
|
|
1715
1768
|
};
|
|
1716
|
-
},
|
|
1769
|
+
}, Xr = class extends Error {
|
|
1717
1770
|
_voltroDeferral = !0;
|
|
1718
1771
|
constructor(e) {
|
|
1719
1772
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1720
1773
|
}
|
|
1721
|
-
},
|
|
1774
|
+
}, Zr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Qr = (e) => {
|
|
1722
1775
|
if (!(e instanceof Error)) return;
|
|
1723
1776
|
let t = e._voltroControl;
|
|
1724
1777
|
if (t === "redirect") {
|
|
@@ -1740,7 +1793,7 @@ import {
|
|
|
1740
1793
|
},
|
|
1741
1794
|
body: "not found"
|
|
1742
1795
|
};
|
|
1743
|
-
},
|
|
1796
|
+
}, $r = (e) => {
|
|
1744
1797
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1745
1798
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1746
1799
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1755,7 +1808,7 @@ import {
|
|
|
1755
1808
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1756
1809
|
});
|
|
1757
1810
|
} catch (e) {
|
|
1758
|
-
throw new
|
|
1811
|
+
throw new Xr(e instanceof Error ? e.message : String(e));
|
|
1759
1812
|
}
|
|
1760
1813
|
return {
|
|
1761
1814
|
loaderData: n.renderData,
|
|
@@ -1771,8 +1824,8 @@ import {
|
|
|
1771
1824
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1772
1825
|
}
|
|
1773
1826
|
};
|
|
1774
|
-
},
|
|
1775
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1827
|
+
}, ei = (e) => {
|
|
1828
|
+
let { helpers: t, renderInput: n } = e, r = $r({
|
|
1776
1829
|
helpers: t,
|
|
1777
1830
|
page: e.page,
|
|
1778
1831
|
pathname: n.pathname,
|
|
@@ -1793,19 +1846,19 @@ import {
|
|
|
1793
1846
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1794
1847
|
hasDeferred: r.hasDeferred
|
|
1795
1848
|
};
|
|
1796
|
-
},
|
|
1849
|
+
}, ti = (e) => {
|
|
1797
1850
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1798
1851
|
return {
|
|
1799
1852
|
body: t,
|
|
1800
1853
|
meta: n
|
|
1801
1854
|
};
|
|
1802
|
-
},
|
|
1855
|
+
}, ni = (e) => [
|
|
1803
1856
|
...e.extra ?? [],
|
|
1804
1857
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1805
1858
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1806
1859
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1807
1860
|
e.prepared.stateScript
|
|
1808
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1861
|
+
].filter((e) => e.length > 0).join("\n "), ri = (e) => {
|
|
1809
1862
|
let t = e.indexOf("?");
|
|
1810
1863
|
return t === -1 ? {
|
|
1811
1864
|
pathname: e || "/",
|
|
@@ -1814,9 +1867,9 @@ import {
|
|
|
1814
1867
|
pathname: e.slice(0, t) || "/",
|
|
1815
1868
|
search: e.slice(t)
|
|
1816
1869
|
};
|
|
1817
|
-
},
|
|
1870
|
+
}, ii = /Could not find required `intl` object/, ai = "__voltro_i18n_instances__", oi = (e = globalThis) => {
|
|
1818
1871
|
try {
|
|
1819
|
-
let t = e[
|
|
1872
|
+
let t = e[ai]?.records;
|
|
1820
1873
|
return t === void 0 || t.length === 0 ? void 0 : {
|
|
1821
1874
|
instances: t.length,
|
|
1822
1875
|
reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
|
|
@@ -1825,7 +1878,7 @@ import {
|
|
|
1825
1878
|
} catch {
|
|
1826
1879
|
return;
|
|
1827
1880
|
}
|
|
1828
|
-
},
|
|
1881
|
+
}, si = (e, t) => [
|
|
1829
1882
|
"",
|
|
1830
1883
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1831
1884
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1843,7 +1896,7 @@ import {
|
|
|
1843
1896
|
" versions on disk; this counts instances in the running process, and one",
|
|
1844
1897
|
" file loaded down two paths is two instances.",
|
|
1845
1898
|
"───────────────────────────────────────────────────────────────────────"
|
|
1846
|
-
].join("\n"),
|
|
1899
|
+
].join("\n"), ci = (e, t) => [
|
|
1847
1900
|
"",
|
|
1848
1901
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1849
1902
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1859,7 +1912,7 @@ import {
|
|
|
1859
1912
|
" direct import can land on a second copy that this count does not see —",
|
|
1860
1913
|
" it counts what @voltro/i18n is bound to.",
|
|
1861
1914
|
"───────────────────────────────────────────────────────────────────────"
|
|
1862
|
-
].join("\n"),
|
|
1915
|
+
].join("\n"), li = (e) => [
|
|
1863
1916
|
"",
|
|
1864
1917
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1865
1918
|
`${e} DID wrap this render in <I18nProvider> — the framework`,
|
|
@@ -1875,29 +1928,29 @@ import {
|
|
|
1875
1928
|
" Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
|
|
1876
1929
|
" the duplication here is of module instances in one process.",
|
|
1877
1930
|
"───────────────────────────────────────────────────────────────────────"
|
|
1878
|
-
].join("\n"),
|
|
1931
|
+
].join("\n"), ui = (e, t, n, r = oi()) => {
|
|
1879
1932
|
if (!t) return;
|
|
1880
1933
|
let i = String(e?.message ?? e);
|
|
1881
|
-
if (
|
|
1882
|
-
},
|
|
1883
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1884
|
-
let r =
|
|
1934
|
+
if (ii.test(i)) return r === void 0 ? li(n) : r.reactIntlCopies > 1 || r.instances > 1 ? si(n, r) : ci(n, r);
|
|
1935
|
+
}, di = "<div id=\"root\"></div>", fi = "<div id=\"root\">", pi = "</div>", mi = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, hi = /\bsrc=["']([^"']+)["']/i, gi = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, _i = (e) => {
|
|
1936
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(mi, (e) => {
|
|
1937
|
+
let r = hi.exec(e)?.[1];
|
|
1885
1938
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1886
1939
|
});
|
|
1887
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1888
|
-
let i = r.indexOf(
|
|
1889
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1940
|
+
e.inlineModuleScriptsAsync && (r = r.replace(gi, "<script async$1>"));
|
|
1941
|
+
let i = r.indexOf(di);
|
|
1942
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${di}\` 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.`);
|
|
1890
1943
|
return {
|
|
1891
|
-
head: `${r.slice(0, i)}${
|
|
1892
|
-
tail: `${
|
|
1944
|
+
head: `${r.slice(0, i)}${fi}`,
|
|
1945
|
+
tail: `${pi}${r.slice(i + 21)}`,
|
|
1893
1946
|
bootstrapModules: n
|
|
1894
1947
|
};
|
|
1895
|
-
},
|
|
1948
|
+
}, vi = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), yi = (e) => vi(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), bi = (e) => {
|
|
1896
1949
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1897
1950
|
if (s || !o || a === null) return;
|
|
1898
1951
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1899
1952
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1900
|
-
t.flushHeaders?.(), t.write(
|
|
1953
|
+
t.flushHeaders?.(), t.write(yi({
|
|
1901
1954
|
head: n.head,
|
|
1902
1955
|
headInjection: i(a.meta),
|
|
1903
1956
|
htmlLang: r
|
|
@@ -1927,16 +1980,16 @@ import {
|
|
|
1927
1980
|
return;
|
|
1928
1981
|
}
|
|
1929
1982
|
c();
|
|
1930
|
-
},
|
|
1983
|
+
}, xi = (e) => Array.isArray(e.preload) && e.preload.length > 0, Si = (e, t) => typeof e == "string" ? {
|
|
1931
1984
|
tag: e,
|
|
1932
1985
|
input: {}
|
|
1933
1986
|
} : {
|
|
1934
1987
|
tag: e.tag,
|
|
1935
1988
|
input: e.input?.(t) ?? {}
|
|
1936
|
-
},
|
|
1989
|
+
}, Ci = async (e) => {
|
|
1937
1990
|
let { pageMod: t, params: n, query: r, apiName: i, seed: a, onError: o } = e;
|
|
1938
|
-
if (
|
|
1939
|
-
let { tag: t, input: s } =
|
|
1991
|
+
if (xi(t) && !(r === void 0 || i === void 0)) for (let e of t.preload) {
|
|
1992
|
+
let { tag: t, input: s } = Si(e, n);
|
|
1940
1993
|
try {
|
|
1941
1994
|
a(i, t, s, await r(t, s));
|
|
1942
1995
|
} catch (e) {
|
|
@@ -1946,14 +1999,14 @@ import {
|
|
|
1946
1999
|
}, e);
|
|
1947
2000
|
}
|
|
1948
2001
|
}
|
|
1949
|
-
}, Z = S({ scope: "voltro:dev:web" }),
|
|
2002
|
+
}, Z = S({ scope: "voltro:dev:web" }), wi = S({ scope: "vite" }), Ti = await (async () => {
|
|
1950
2003
|
try {
|
|
1951
2004
|
let e = p(d(g(import.meta.url)), "..", "package.json"), t = await O.readFile(e, "utf8");
|
|
1952
2005
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1953
2006
|
} catch {
|
|
1954
2007
|
return "0.0.0";
|
|
1955
2008
|
}
|
|
1956
|
-
})(),
|
|
2009
|
+
})(), Ei = async () => {
|
|
1957
2010
|
try {
|
|
1958
2011
|
let e = d(g(import.meta.url)), t = h(e, "..", "..", "devtools");
|
|
1959
2012
|
if (T(p(t, "package.json"))) return t;
|
|
@@ -1962,7 +2015,7 @@ import {
|
|
|
1962
2015
|
} catch {
|
|
1963
2016
|
return null;
|
|
1964
2017
|
}
|
|
1965
|
-
},
|
|
2018
|
+
}, Di = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1966
2019
|
"",
|
|
1967
2020
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1968
2021
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1972,12 +2025,12 @@ import {
|
|
|
1972
2025
|
" await import('@voltro/devtools/styles.css')",
|
|
1973
2026
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1974
2027
|
"}"
|
|
1975
|
-
],
|
|
2028
|
+
], Oi = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ki = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Ai = (e) => e.sentry ? [
|
|
1976
2029
|
"",
|
|
1977
2030
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1978
2031
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1979
2032
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1980
|
-
] : [],
|
|
2033
|
+
] : [], ji = (e) => e.env ? ["import './env.public'"] : [], Mi = (e) => {
|
|
1981
2034
|
let t = [], n = h(e);
|
|
1982
2035
|
for (;;) {
|
|
1983
2036
|
T(p(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1986,14 +2039,14 @@ import {
|
|
|
1986
2039
|
n = e;
|
|
1987
2040
|
}
|
|
1988
2041
|
return t;
|
|
1989
|
-
},
|
|
2042
|
+
}, Ni = rr, Pi = (e) => {
|
|
1990
2043
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1991
2044
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1992
2045
|
if (t) return `island-${t[1]}`;
|
|
1993
|
-
},
|
|
1994
|
-
let t = e.replace(r, "").split("/").filter(Boolean).filter((e) => !
|
|
2046
|
+
}, Fi = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Ii = (e) => e.startsWith("(") && e.endsWith(")"), Li = (e) => e.filter((e) => !Ii(e)), Ri = (e) => {
|
|
2047
|
+
let t = e.replace(r, "").split("/").filter(Boolean).filter((e) => !Ii(e));
|
|
1995
2048
|
return t.length === 0 ? "/" : "/" + t.join("/");
|
|
1996
|
-
},
|
|
2049
|
+
}, zi = (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) => {
|
|
1997
2050
|
let t = [], i = [], a = async (e, o) => {
|
|
1998
2051
|
let s = [];
|
|
1999
2052
|
try {
|
|
@@ -2001,17 +2054,17 @@ import {
|
|
|
2001
2054
|
} catch {
|
|
2002
2055
|
return;
|
|
2003
2056
|
}
|
|
2004
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
2057
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Ni(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
2005
2058
|
if (l.some((e) => n.has(e))) {
|
|
2006
2059
|
let t = u.has("layout.tsx"), r = !1;
|
|
2007
2060
|
if (t) try {
|
|
2008
2061
|
let t = await O.readFile(p(e, "layout.tsx"), "utf8");
|
|
2009
|
-
r =
|
|
2062
|
+
r = Fi.test(t);
|
|
2010
2063
|
} catch {}
|
|
2011
2064
|
i.push({
|
|
2012
2065
|
dir: d,
|
|
2013
2066
|
chain: o,
|
|
2014
|
-
contributesToUrl: o.length === 0 || !
|
|
2067
|
+
contributesToUrl: o.length === 0 || !Ii(o[o.length - 1]),
|
|
2015
2068
|
hasLayout: t,
|
|
2016
2069
|
hasLayoutLoader: r,
|
|
2017
2070
|
hasError: u.has("error.tsx"),
|
|
@@ -2025,8 +2078,8 @@ import {
|
|
|
2025
2078
|
let n = d ? `${d}/${e}` : e;
|
|
2026
2079
|
t.push({
|
|
2027
2080
|
file: n,
|
|
2028
|
-
pattern:
|
|
2029
|
-
ident:
|
|
2081
|
+
pattern: Ri(n),
|
|
2082
|
+
ident: zi(n),
|
|
2030
2083
|
dirChain: o
|
|
2031
2084
|
});
|
|
2032
2085
|
}
|
|
@@ -2045,14 +2098,14 @@ import {
|
|
|
2045
2098
|
dirs: s,
|
|
2046
2099
|
orphanedSpecials: c
|
|
2047
2100
|
};
|
|
2048
|
-
},
|
|
2101
|
+
}, Bi = (e, t) => {
|
|
2049
2102
|
let n = [];
|
|
2050
2103
|
for (let r = 0; r <= t.length; r++) {
|
|
2051
2104
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
2052
2105
|
a && n.push(a);
|
|
2053
2106
|
}
|
|
2054
2107
|
return n;
|
|
2055
|
-
},
|
|
2108
|
+
}, Vi = async (e) => {
|
|
2056
2109
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
2057
2110
|
return {
|
|
2058
2111
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -2075,10 +2128,10 @@ import {
|
|
|
2075
2128
|
})),
|
|
2076
2129
|
segmentLoaderData: o
|
|
2077
2130
|
};
|
|
2078
|
-
},
|
|
2079
|
-
let t =
|
|
2131
|
+
}, Hi = (e) => {
|
|
2132
|
+
let t = Li(e);
|
|
2080
2133
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
2081
|
-
},
|
|
2134
|
+
}, Ui = [
|
|
2082
2135
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
2083
2136
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
2084
2137
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -2171,7 +2224,7 @@ import {
|
|
|
2171
2224
|
" _vdtErrorStart('Build error')",
|
|
2172
2225
|
" })",
|
|
2173
2226
|
"}"
|
|
2174
|
-
].join("\n"),
|
|
2227
|
+
].join("\n"), Wi = (e) => {
|
|
2175
2228
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
2176
2229
|
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, "\\$&"));
|
|
2177
2230
|
let a = i.join("/");
|
|
@@ -2180,8 +2233,8 @@ import {
|
|
|
2180
2233
|
paramNames: t,
|
|
2181
2234
|
priority: n
|
|
2182
2235
|
};
|
|
2183
|
-
},
|
|
2184
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
2236
|
+
}, Gi = (e) => e.map((e) => {
|
|
2237
|
+
let { regex: t, paramNames: n, priority: r } = Wi(e.pattern);
|
|
2185
2238
|
return {
|
|
2186
2239
|
pattern: e.pattern,
|
|
2187
2240
|
file: e.file,
|
|
@@ -2190,7 +2243,7 @@ import {
|
|
|
2190
2243
|
paramNames: n,
|
|
2191
2244
|
priority: r
|
|
2192
2245
|
};
|
|
2193
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
2246
|
+
}).slice().sort((e, t) => e.priority - t.priority), Ki = (e, t) => {
|
|
2194
2247
|
for (let n of t) {
|
|
2195
2248
|
let t = n.regex.exec(e);
|
|
2196
2249
|
if (!t) continue;
|
|
@@ -2202,7 +2255,7 @@ import {
|
|
|
2202
2255
|
};
|
|
2203
2256
|
}
|
|
2204
2257
|
return null;
|
|
2205
|
-
},
|
|
2258
|
+
}, qi = async (e, t) => {
|
|
2206
2259
|
let n = e;
|
|
2207
2260
|
for (;;) {
|
|
2208
2261
|
let e = p(n, "node_modules", t);
|
|
@@ -2216,7 +2269,7 @@ import {
|
|
|
2216
2269
|
if (r === n) return null;
|
|
2217
2270
|
n = r;
|
|
2218
2271
|
}
|
|
2219
|
-
},
|
|
2272
|
+
}, Ji = async (e) => {
|
|
2220
2273
|
try {
|
|
2221
2274
|
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;
|
|
2222
2275
|
return a ? {
|
|
@@ -2225,7 +2278,7 @@ import {
|
|
|
2225
2278
|
} : { port: r };
|
|
2226
2279
|
} catch {}
|
|
2227
2280
|
return { port: 4e3 };
|
|
2228
|
-
},
|
|
2281
|
+
}, Yi = (e, t) => ({
|
|
2229
2282
|
name: e,
|
|
2230
2283
|
pkg: t.package,
|
|
2231
2284
|
browserWsUrl: t.url,
|
|
@@ -2233,7 +2286,7 @@ import {
|
|
|
2233
2286
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
2234
2287
|
...t.headers ? { headers: t.headers } : {},
|
|
2235
2288
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
2236
|
-
}),
|
|
2289
|
+
}), Xi = (e, t, n) => {
|
|
2237
2290
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
2238
2291
|
return {
|
|
2239
2292
|
name: e,
|
|
@@ -2245,7 +2298,7 @@ import {
|
|
|
2245
2298
|
...t.headers ? { headers: t.headers } : {},
|
|
2246
2299
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
2247
2300
|
};
|
|
2248
|
-
},
|
|
2301
|
+
}, Zi = (e) => {
|
|
2249
2302
|
let t = /* @__PURE__ */ new Map();
|
|
2250
2303
|
for (let n of e) {
|
|
2251
2304
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -2253,43 +2306,43 @@ import {
|
|
|
2253
2306
|
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>.`);
|
|
2254
2307
|
t.set(n.browserWsUrl, n.name);
|
|
2255
2308
|
}
|
|
2256
|
-
},
|
|
2309
|
+
}, Qi = async (e, t) => {
|
|
2257
2310
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
2258
2311
|
for (let [t, i] of n) {
|
|
2259
2312
|
if (i.url) {
|
|
2260
|
-
r.push(
|
|
2313
|
+
r.push(Yi(t, i));
|
|
2261
2314
|
continue;
|
|
2262
2315
|
}
|
|
2263
|
-
let n = await
|
|
2316
|
+
let n = await qi(e, i.package);
|
|
2264
2317
|
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.`);
|
|
2265
|
-
r.push(
|
|
2318
|
+
r.push(Xi(t, i, await Ji(n)));
|
|
2266
2319
|
}
|
|
2267
|
-
return
|
|
2268
|
-
},
|
|
2320
|
+
return Zi(r), r;
|
|
2321
|
+
}, $i = (e) => {
|
|
2269
2322
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
2270
2323
|
let t = new URL(e);
|
|
2271
2324
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
2272
2325
|
} catch {
|
|
2273
2326
|
return;
|
|
2274
2327
|
}
|
|
2275
|
-
},
|
|
2328
|
+
}, ea = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ta = (e) => process.env[ea(e)] ?? process.env.VOLTRO_API_ORIGIN, na = (e, t) => {
|
|
2276
2329
|
if (!e) return;
|
|
2277
|
-
let n =
|
|
2330
|
+
let n = ta(e.name) ?? e.serverOrigin;
|
|
2278
2331
|
if (n) {
|
|
2279
|
-
let e =
|
|
2332
|
+
let e = $i(n);
|
|
2280
2333
|
if (e) return e;
|
|
2281
2334
|
}
|
|
2282
2335
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
2283
|
-
let t =
|
|
2336
|
+
let t = $i(e.proxyTarget);
|
|
2284
2337
|
if (t) return t;
|
|
2285
2338
|
}
|
|
2286
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
2287
|
-
},
|
|
2339
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return $i(e.browserWsUrl);
|
|
2340
|
+
}, ra = (e, t, n) => {
|
|
2288
2341
|
if (!e) {
|
|
2289
2342
|
if (n?.apiName === void 0) return;
|
|
2290
2343
|
let e = n.apiName;
|
|
2291
2344
|
return async () => {
|
|
2292
|
-
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 ${
|
|
2345
|
+
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 ${ea(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.`);
|
|
2293
2346
|
};
|
|
2294
2347
|
}
|
|
2295
2348
|
return async (r, i) => {
|
|
@@ -2311,7 +2364,7 @@ import {
|
|
|
2311
2364
|
});
|
|
2312
2365
|
} catch (t) {
|
|
2313
2366
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2314
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2367
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${ea(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 });
|
|
2315
2368
|
}
|
|
2316
2369
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2317
2370
|
let s = await o.json();
|
|
@@ -2329,8 +2382,8 @@ import {
|
|
|
2329
2382
|
}
|
|
2330
2383
|
if (u) return l;
|
|
2331
2384
|
};
|
|
2332
|
-
},
|
|
2333
|
-
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
|
|
2385
|
+
}, ia = async (e, t, n, r = {}) => {
|
|
2386
|
+
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" ? [
|
|
2334
2387
|
" <script>",
|
|
2335
2388
|
" (function () {",
|
|
2336
2389
|
" var root = document.documentElement",
|
|
@@ -2369,7 +2422,7 @@ import {
|
|
|
2369
2422
|
"</html>",
|
|
2370
2423
|
""
|
|
2371
2424
|
].join("\n"), l = p(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
|
|
2372
|
-
await
|
|
2425
|
+
await Dr(l, u);
|
|
2373
2426
|
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.`);
|
|
2374
2427
|
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'`);
|
|
2375
2428
|
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"));
|
|
@@ -2384,13 +2437,13 @@ import {
|
|
|
2384
2437
|
e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2385
2438
|
}
|
|
2386
2439
|
let i = u.map((e) => {
|
|
2387
|
-
let t =
|
|
2440
|
+
let t = Bi(d, e.dirChain).map((e) => {
|
|
2388
2441
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2389
2442
|
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(", ")} }`;
|
|
2390
2443
|
}).join(",\n");
|
|
2391
2444
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2392
2445
|
}), a = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2393
|
-
let t =
|
|
2446
|
+
let t = Hi(e.chain), n = Bi(d, e.chain).map((e) => {
|
|
2394
2447
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2395
2448
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2396
2449
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2646,14 +2699,14 @@ import {
|
|
|
2646
2699
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2647
2700
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2648
2701
|
"",
|
|
2649
|
-
...
|
|
2702
|
+
...ji(t),
|
|
2650
2703
|
"import { mount } from '@voltro/web'",
|
|
2651
2704
|
...g,
|
|
2652
2705
|
"import { App } from './app'",
|
|
2653
2706
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2654
|
-
...
|
|
2655
|
-
...
|
|
2656
|
-
...
|
|
2707
|
+
...ki(t),
|
|
2708
|
+
...Di(t, o),
|
|
2709
|
+
...Ai(t),
|
|
2657
2710
|
"",
|
|
2658
2711
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2659
2712
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2670,10 +2723,10 @@ import {
|
|
|
2670
2723
|
" apis: {",
|
|
2671
2724
|
..._,
|
|
2672
2725
|
" },",
|
|
2673
|
-
...
|
|
2726
|
+
...Oi(t, o),
|
|
2674
2727
|
"})",
|
|
2675
2728
|
"",
|
|
2676
|
-
|
|
2729
|
+
Ui
|
|
2677
2730
|
].join("\n");
|
|
2678
2731
|
} else v = "", y = "", b = [
|
|
2679
2732
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2681,25 +2734,25 @@ import {
|
|
|
2681
2734
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2682
2735
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2683
2736
|
"",
|
|
2684
|
-
...
|
|
2737
|
+
...ji(t),
|
|
2685
2738
|
"import { mount } from '@voltro/web'",
|
|
2686
2739
|
...g,
|
|
2687
2740
|
"import App from '../src/App'",
|
|
2688
|
-
...
|
|
2689
|
-
...
|
|
2690
|
-
...
|
|
2741
|
+
...ki(t),
|
|
2742
|
+
...Di(t, o),
|
|
2743
|
+
...Ai(t),
|
|
2691
2744
|
"",
|
|
2692
2745
|
"mount(App, {",
|
|
2693
2746
|
" apis: {",
|
|
2694
2747
|
..._,
|
|
2695
2748
|
" },",
|
|
2696
|
-
...
|
|
2749
|
+
...Oi(t, o),
|
|
2697
2750
|
"})",
|
|
2698
2751
|
"",
|
|
2699
|
-
|
|
2752
|
+
Ui
|
|
2700
2753
|
].join("\n");
|
|
2701
2754
|
let x = p(e, ".framework");
|
|
2702
|
-
await O.mkdir(x, { recursive: !0 }), t.env ? await
|
|
2755
|
+
await O.mkdir(x, { recursive: !0 }), t.env ? await at(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 }));
|
|
2703
2756
|
let S = p(e, ".gitignore"), C = "";
|
|
2704
2757
|
try {
|
|
2705
2758
|
C = await O.readFile(S, "utf8");
|
|
@@ -2713,7 +2766,7 @@ import {
|
|
|
2713
2766
|
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) });
|
|
2714
2767
|
}
|
|
2715
2768
|
}
|
|
2716
|
-
},
|
|
2769
|
+
}, aa = async (e, t) => {
|
|
2717
2770
|
try {
|
|
2718
2771
|
let n = p(d(e), "project.json");
|
|
2719
2772
|
if (!T(n)) return;
|
|
@@ -2726,49 +2779,49 @@ import {
|
|
|
2726
2779
|
projectJson: n
|
|
2727
2780
|
});
|
|
2728
2781
|
} catch {}
|
|
2729
|
-
},
|
|
2730
|
-
let
|
|
2782
|
+
}, oa = (e) => p(e, ".framework", "dist", "server", "appConfig.js"), sa = async (e, t = {}) => {
|
|
2783
|
+
let n = oa(e), r = t.preferSource !== !0 && T(n) ? n : p(e, "app.config.ts");
|
|
2731
2784
|
try {
|
|
2732
|
-
let e = (await import(_(
|
|
2785
|
+
let e = (await import(_(r).href)).default;
|
|
2733
2786
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2734
2787
|
} catch {
|
|
2735
2788
|
return null;
|
|
2736
2789
|
}
|
|
2737
|
-
},
|
|
2738
|
-
let t = await
|
|
2790
|
+
}, ca = async (e) => {
|
|
2791
|
+
let t = await sa(e, { preferSource: !0 });
|
|
2739
2792
|
if (!t) return {
|
|
2740
2793
|
ran: !1,
|
|
2741
2794
|
exitCode: 0
|
|
2742
2795
|
};
|
|
2743
|
-
|
|
2744
|
-
let n =
|
|
2745
|
-
|
|
2746
|
-
let r = await
|
|
2796
|
+
er();
|
|
2797
|
+
let n = hn();
|
|
2798
|
+
Nn(n), Z.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" }), Rt(e, Z);
|
|
2799
|
+
let r = await Qi(e, t);
|
|
2747
2800
|
for (let e of r) Z.info("api wired", {
|
|
2748
2801
|
name: e.name,
|
|
2749
2802
|
pkg: e.pkg,
|
|
2750
2803
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
2751
2804
|
});
|
|
2752
|
-
|
|
2805
|
+
Fe(e).then((e) => {
|
|
2753
2806
|
for (let t of e.files) if (t.action === "created") {
|
|
2754
2807
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2755
2808
|
Z.info(`${e} seeded`, { path: t.path });
|
|
2756
2809
|
}
|
|
2757
2810
|
}).catch(() => {});
|
|
2758
|
-
let { resolved: d } = await
|
|
2811
|
+
let { resolved: d } = await ot({
|
|
2759
2812
|
rawEnv: t.env,
|
|
2760
2813
|
appType: "web",
|
|
2761
2814
|
root: e,
|
|
2762
2815
|
log: Z,
|
|
2763
2816
|
generateTypes: !0
|
|
2764
2817
|
}), f = d.publicValues;
|
|
2765
|
-
await
|
|
2818
|
+
await ia(e, t, r, f), Z.debug("generated framework entry files", { files: [
|
|
2766
2819
|
"index.html",
|
|
2767
2820
|
".framework/main.tsx",
|
|
2768
2821
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2769
2822
|
] });
|
|
2770
|
-
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 =
|
|
2771
|
-
await
|
|
2823
|
+
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 = Ye("web", _, g), y = Pr(_);
|
|
2824
|
+
await qe({
|
|
2772
2825
|
id: v,
|
|
2773
2826
|
name: _,
|
|
2774
2827
|
kind: "web",
|
|
@@ -2776,22 +2829,22 @@ import {
|
|
|
2776
2829
|
pid: process.pid,
|
|
2777
2830
|
status: "booting",
|
|
2778
2831
|
logFile: y.path
|
|
2779
|
-
}).catch(() => {}), await
|
|
2832
|
+
}).catch(() => {}), await aa(e, g);
|
|
2780
2833
|
let { pages: b, dirs: x } = await $(p(e, "src", "pages")), S = {
|
|
2781
2834
|
dirs: x,
|
|
2782
|
-
ssrRoutes:
|
|
2835
|
+
ssrRoutes: Gi(b)
|
|
2783
2836
|
}, w = x.map((e) => ({
|
|
2784
2837
|
dir: e.dir,
|
|
2785
2838
|
hasLayout: e.hasLayout,
|
|
2786
2839
|
hasError: e.hasError,
|
|
2787
2840
|
hasPending: e.hasPending,
|
|
2788
2841
|
hasNotFound: e.hasNotFound
|
|
2789
|
-
})), E = await
|
|
2842
|
+
})), E = await sn({
|
|
2790
2843
|
appRoot: e,
|
|
2791
2844
|
pages: b
|
|
2792
2845
|
});
|
|
2793
2846
|
E.wrote && Z.debug("routes codegen wrote", { path: m(e, E.path) });
|
|
2794
|
-
let D = await
|
|
2847
|
+
let D = await $e("vite", () => import("vite")), k = (await import("@vitejs/plugin-react")).default, A = (await import("@tailwindcss/vite")).default, j = p(e, ".framework"), M = p(e, "src"), N = /* @__PURE__ */ new Set([
|
|
2795
2848
|
".framework",
|
|
2796
2849
|
"node_modules",
|
|
2797
2850
|
"dist",
|
|
@@ -2799,11 +2852,11 @@ import {
|
|
|
2799
2852
|
".vite",
|
|
2800
2853
|
".turbo",
|
|
2801
2854
|
".cache"
|
|
2802
|
-
]),
|
|
2855
|
+
]), ee = {
|
|
2803
2856
|
name: "framework:watch-app-sources",
|
|
2804
2857
|
async configureServer(t) {
|
|
2805
2858
|
try {
|
|
2806
|
-
let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !
|
|
2859
|
+
let n = (await O.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !N.has(e.name));
|
|
2807
2860
|
for (let r of n) t.watcher.add(p(e, r.name));
|
|
2808
2861
|
n.length === 0 && t.watcher.add(M);
|
|
2809
2862
|
} catch {
|
|
@@ -2815,7 +2868,7 @@ import {
|
|
|
2815
2868
|
...r.devDependencies
|
|
2816
2869
|
});
|
|
2817
2870
|
await Promise.all(i.map(async (n) => {
|
|
2818
|
-
let r = await
|
|
2871
|
+
let r = await qi(e, n);
|
|
2819
2872
|
if (!r) return;
|
|
2820
2873
|
let i = p(r, "src");
|
|
2821
2874
|
try {
|
|
@@ -2824,15 +2877,15 @@ import {
|
|
|
2824
2877
|
}));
|
|
2825
2878
|
} catch {}
|
|
2826
2879
|
}
|
|
2827
|
-
},
|
|
2880
|
+
}, P = p(e, "src", "pages"), F = (e) => e.endsWith(".tsx") && (e === P || e.startsWith(P + "/")), I = (e) => e === P || e.startsWith(P + "/"), te = async (n) => {
|
|
2828
2881
|
try {
|
|
2829
2882
|
let i = Date.now();
|
|
2830
|
-
await
|
|
2831
|
-
let { pages: a, dirs: o } = await $(
|
|
2832
|
-
await
|
|
2883
|
+
await ia(e, t, r, f);
|
|
2884
|
+
let { pages: a, dirs: o } = await $(P);
|
|
2885
|
+
await sn({
|
|
2833
2886
|
appRoot: e,
|
|
2834
2887
|
pages: a
|
|
2835
|
-
}), S.dirs = o, S.ssrRoutes =
|
|
2888
|
+
}), S.dirs = o, S.ssrRoutes = Gi(a), Z.info("page tree regenerated", {
|
|
2836
2889
|
reason: n,
|
|
2837
2890
|
ms: Date.now() - i,
|
|
2838
2891
|
routes: S.ssrRoutes.length
|
|
@@ -2840,44 +2893,44 @@ import {
|
|
|
2840
2893
|
} catch (e) {
|
|
2841
2894
|
Z.error("page tree regen failed", { reason: n }, e);
|
|
2842
2895
|
}
|
|
2843
|
-
},
|
|
2896
|
+
}, L = {
|
|
2844
2897
|
name: "framework:regenerate-on-page-tree-change",
|
|
2845
2898
|
configureServer(t) {
|
|
2846
2899
|
let n = null, r = [], i = (e) => {
|
|
2847
2900
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
2848
2901
|
n = null;
|
|
2849
2902
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
2850
|
-
r.length = 0,
|
|
2903
|
+
r.length = 0, te(e);
|
|
2851
2904
|
}, 50);
|
|
2852
2905
|
};
|
|
2853
2906
|
t.watcher.on("add", (t) => {
|
|
2854
|
-
|
|
2907
|
+
F(t) && i(`add ${m(e, t)}`);
|
|
2855
2908
|
}), t.watcher.on("unlink", (t) => {
|
|
2856
|
-
|
|
2909
|
+
F(t) && i(`unlink ${m(e, t)}`);
|
|
2857
2910
|
}), t.watcher.on("addDir", (t) => {
|
|
2858
|
-
|
|
2911
|
+
I(t) && i(`addDir ${m(e, t)}`);
|
|
2859
2912
|
}), t.watcher.on("unlinkDir", (t) => {
|
|
2860
|
-
|
|
2913
|
+
I(t) && i(`unlinkDir ${m(e, t)}`);
|
|
2861
2914
|
});
|
|
2862
2915
|
}
|
|
2863
|
-
},
|
|
2864
|
-
if (!
|
|
2916
|
+
}, R = p(e, "app.config.ts"), ne = (e) => {
|
|
2917
|
+
if (!ae(e.env)) return "";
|
|
2865
2918
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
2866
2919
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
2867
|
-
},
|
|
2920
|
+
}, re = (e, t) => {
|
|
2868
2921
|
let n = [];
|
|
2869
|
-
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"),
|
|
2870
|
-
}, z = t,
|
|
2922
|
+
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"), ne(e) !== ne(t) && n.push("env"), n;
|
|
2923
|
+
}, z = t, ie = h(R), B = {
|
|
2871
2924
|
name: "framework:watch-app-config",
|
|
2872
2925
|
async configureServer(t) {
|
|
2873
|
-
t.watcher.add(
|
|
2926
|
+
t.watcher.add(R), Z.info("watching app.config.ts for changes", { path: m(e, R) });
|
|
2874
2927
|
let n = async () => {
|
|
2875
2928
|
try {
|
|
2876
2929
|
try {
|
|
2877
|
-
let e = t.moduleGraph.getModuleById(
|
|
2930
|
+
let e = t.moduleGraph.getModuleById(R);
|
|
2878
2931
|
e && t.moduleGraph.invalidateModule(e);
|
|
2879
2932
|
} catch {}
|
|
2880
|
-
let e = (await t.ssrLoadModule(
|
|
2933
|
+
let e = (await t.ssrLoadModule(R, { fixStacktrace: !0 })).default;
|
|
2881
2934
|
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);
|
|
2882
2935
|
} catch (e) {
|
|
2883
2936
|
return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
@@ -2900,7 +2953,7 @@ import {
|
|
|
2900
2953
|
Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2901
2954
|
return;
|
|
2902
2955
|
}
|
|
2903
|
-
let i =
|
|
2956
|
+
let i = re(z, r);
|
|
2904
2957
|
if (i.length > 0) {
|
|
2905
2958
|
Z.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
2906
2959
|
try {
|
|
@@ -2922,7 +2975,7 @@ import {
|
|
|
2922
2975
|
}
|
|
2923
2976
|
try {
|
|
2924
2977
|
let n = Date.now();
|
|
2925
|
-
await
|
|
2978
|
+
await ia(e, r, await Qi(e, r)), z = r, t.ws && t.ws.send({
|
|
2926
2979
|
type: "full-reload",
|
|
2927
2980
|
path: "*"
|
|
2928
2981
|
}), Z.info("app.config.ts soft-regen", {
|
|
@@ -2932,7 +2985,7 @@ import {
|
|
|
2932
2985
|
} catch (e) {
|
|
2933
2986
|
Z.error("app.config.ts soft-regen failed", {}, e);
|
|
2934
2987
|
}
|
|
2935
|
-
}, o = (e) => u(e) === "app.config.ts" ? e ===
|
|
2988
|
+
}, o = (e) => u(e) === "app.config.ts" ? e === R || h(e) === ie : !1;
|
|
2936
2989
|
t.watcher.on("change", (e) => {
|
|
2937
2990
|
o(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), i());
|
|
2938
2991
|
}), t.watcher.on("add", (e) => {
|
|
@@ -2940,21 +2993,21 @@ import {
|
|
|
2940
2993
|
});
|
|
2941
2994
|
try {
|
|
2942
2995
|
let { watchFile: e } = await import("node:fs");
|
|
2943
|
-
e(
|
|
2996
|
+
e(R, { interval: 500 }, (e, t) => {
|
|
2944
2997
|
e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), i());
|
|
2945
2998
|
}), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
2946
2999
|
} catch (e) {
|
|
2947
3000
|
Z.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
2948
3001
|
}
|
|
2949
|
-
|
|
3002
|
+
yt(gt, Z, {
|
|
2950
3003
|
root: e,
|
|
2951
3004
|
onBeforeRestart: () => t.close()
|
|
2952
3005
|
});
|
|
2953
3006
|
}
|
|
2954
|
-
},
|
|
3007
|
+
}, V = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, oe = 0, se = {
|
|
2955
3008
|
name: "framework:suppress-api-hmr",
|
|
2956
3009
|
handleHotUpdate(e) {
|
|
2957
|
-
if (oe += 1,
|
|
3010
|
+
if (oe += 1, V.test(e.file)) return [];
|
|
2958
3011
|
}
|
|
2959
3012
|
}, ce = {
|
|
2960
3013
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
@@ -2962,7 +3015,7 @@ import {
|
|
|
2962
3015
|
let n = /* @__PURE__ */ new Map();
|
|
2963
3016
|
for (let i of r) {
|
|
2964
3017
|
if (!i.proxyTarget) continue;
|
|
2965
|
-
let r = await
|
|
3018
|
+
let r = await qi(e, i.pkg);
|
|
2966
3019
|
if (!r) continue;
|
|
2967
3020
|
let a = p(r, "rpcGroup.generated.ts");
|
|
2968
3021
|
try {
|
|
@@ -3007,7 +3060,7 @@ import {
|
|
|
3007
3060
|
}
|
|
3008
3061
|
}, H = {}, le = (e) => (t) => {
|
|
3009
3062
|
t.on("proxyReq", (t, n) => {
|
|
3010
|
-
|
|
3063
|
+
Qn(t, n, {
|
|
3011
3064
|
target: e,
|
|
3012
3065
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
3013
3066
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
@@ -3058,11 +3111,11 @@ import {
|
|
|
3058
3111
|
pattern: n.pattern,
|
|
3059
3112
|
file: n.file,
|
|
3060
3113
|
dirChain: n.dirChain,
|
|
3061
|
-
renderMode:
|
|
3114
|
+
renderMode: yr(i, p("src", "pages", n.file)),
|
|
3062
3115
|
interactive: i.interactive ?? "full",
|
|
3063
3116
|
tenantAware: i.tenantAware === !0,
|
|
3064
|
-
revalidateMs:
|
|
3065
|
-
staleWhileRevalidateMs:
|
|
3117
|
+
revalidateMs: J(i.revalidate),
|
|
3118
|
+
staleWhileRevalidateMs: J(i.staleWhileRevalidate) ?? 0,
|
|
3066
3119
|
cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
|
|
3067
3120
|
hasLoader: typeof i.loader == "function",
|
|
3068
3121
|
hasMeta: i.meta != null,
|
|
@@ -3089,9 +3142,9 @@ import {
|
|
|
3089
3142
|
}), r();
|
|
3090
3143
|
}), r.middlewares.use((t, n, r) => {
|
|
3091
3144
|
if (t.method !== "GET" && t.method !== "HEAD") return r();
|
|
3092
|
-
let { pathname: i } =
|
|
3145
|
+
let { pathname: i } = ri(t.url ?? "/");
|
|
3093
3146
|
if (i !== "/robots.txt" || T(p(e, "public", "robots.txt"))) return r();
|
|
3094
|
-
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(
|
|
3147
|
+
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(pn({ indexable: !1 }));
|
|
3095
3148
|
}), t.name === "voltroDashboard" && r.middlewares.use(async (e, t, n) => {
|
|
3096
3149
|
let r = e.url ?? "", a = r.split("?")[0];
|
|
3097
3150
|
if (a === "/api/dashboard/proxy") {
|
|
@@ -3182,7 +3235,7 @@ import {
|
|
|
3182
3235
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (u[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
3183
3236
|
let f = o.split("?")[0];
|
|
3184
3237
|
if (e.method === "GET" && (f === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
|
|
3185
|
-
let e = a(u.origin), t =
|
|
3238
|
+
let e = a(u.origin), t = Kn(o, On(), u);
|
|
3186
3239
|
r.statusCode = t.status, r.setHeader("content-type", t.contentType);
|
|
3187
3240
|
for (let [t, n] of Object.entries(e)) r.setHeader(t, n);
|
|
3188
3241
|
r.end(t.body);
|
|
@@ -3200,7 +3253,7 @@ import {
|
|
|
3200
3253
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
3201
3254
|
i += e;
|
|
3202
3255
|
}), e.on("end", () => {
|
|
3203
|
-
let e =
|
|
3256
|
+
let e = Bn(i, n);
|
|
3204
3257
|
r.statusCode = e.status, r.setHeader("content-type", e.contentType);
|
|
3205
3258
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
3206
3259
|
r.end(e.body);
|
|
@@ -3231,14 +3284,14 @@ import {
|
|
|
3231
3284
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
3232
3285
|
r.flushHeaders?.(), r.write("retry: 5000\n\n");
|
|
3233
3286
|
let l = o.indexOf("?");
|
|
3234
|
-
if (!(l !== -1 && new URLSearchParams(o.slice(l + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(
|
|
3287
|
+
if (!(l !== -1 && new URLSearchParams(o.slice(l + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(gn(e));
|
|
3235
3288
|
let d = n.subscribe((e) => {
|
|
3236
3289
|
try {
|
|
3237
|
-
r.write(
|
|
3290
|
+
r.write(gn(e));
|
|
3238
3291
|
} catch {}
|
|
3239
3292
|
}), f = setInterval(() => {
|
|
3240
3293
|
try {
|
|
3241
|
-
r.write(
|
|
3294
|
+
r.write(_n());
|
|
3242
3295
|
} catch {}
|
|
3243
3296
|
}, 15e3), p = () => {
|
|
3244
3297
|
clearInterval(f), d();
|
|
@@ -3251,7 +3304,7 @@ import {
|
|
|
3251
3304
|
kind: "web",
|
|
3252
3305
|
meta: {
|
|
3253
3306
|
name: t.name ?? "(unnamed)",
|
|
3254
|
-
voltroVersion:
|
|
3307
|
+
voltroVersion: Ti,
|
|
3255
3308
|
port: g,
|
|
3256
3309
|
mode: "dev",
|
|
3257
3310
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -3269,7 +3322,7 @@ import {
|
|
|
3269
3322
|
size: 0,
|
|
3270
3323
|
entries: []
|
|
3271
3324
|
}),
|
|
3272
|
-
env: () =>
|
|
3325
|
+
env: () => ct(t.name ?? "app", { contract: ae(t.env) ? t.env : void 0 })
|
|
3273
3326
|
}, u, { method: e.method ?? "GET" });
|
|
3274
3327
|
if (n === null) return i();
|
|
3275
3328
|
r.statusCode = n.status, r.setHeader("content-type", n.contentType);
|
|
@@ -3286,19 +3339,19 @@ import {
|
|
|
3286
3339
|
e.middlewares.use(async (e, t, n) => {
|
|
3287
3340
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
3288
3341
|
try {
|
|
3289
|
-
let e = await
|
|
3342
|
+
let e = await Ke();
|
|
3290
3343
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
3291
3344
|
} catch (e) {
|
|
3292
3345
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
3293
3346
|
}
|
|
3294
3347
|
});
|
|
3295
3348
|
}
|
|
3296
|
-
} : null, me = /* @__PURE__ */ new Set(),
|
|
3297
|
-
let o =
|
|
3349
|
+
} : null, me = /* @__PURE__ */ new Set(), U = (e, t, n, r, i, a = !1) => {
|
|
3350
|
+
let o = ui(i, a, t) ?? "";
|
|
3298
3351
|
if (Z.error(`${t} render failed`, {
|
|
3299
3352
|
pathname: n,
|
|
3300
3353
|
pattern: r,
|
|
3301
|
-
cause:
|
|
3354
|
+
cause: yn(i) + o
|
|
3302
3355
|
}), e.headersSent) {
|
|
3303
3356
|
e.end();
|
|
3304
3357
|
return;
|
|
@@ -3309,9 +3362,9 @@ import {
|
|
|
3309
3362
|
"x-voltro-ssr-generation": String(oe)
|
|
3310
3363
|
});
|
|
3311
3364
|
let s = oe === 0 ? "" : `\n[voltro] this process has absorbed ${oe} 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`;
|
|
3312
|
-
e.end(`${t} render failed for ${n}\n\n${
|
|
3313
|
-
},
|
|
3314
|
-
limit:
|
|
3365
|
+
e.end(`${t} render failed for ${n}\n\n${yn(i)}\n${o}\n${s}`);
|
|
3366
|
+
}, W = Jt(), he = Xt({
|
|
3367
|
+
limit: W,
|
|
3315
3368
|
onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
|
|
3316
3369
|
onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
3317
3370
|
id: e,
|
|
@@ -3319,45 +3372,57 @@ import {
|
|
|
3319
3372
|
...n ? { failed: !0 } : {}
|
|
3320
3373
|
})
|
|
3321
3374
|
});
|
|
3322
|
-
Z.debug(`ssr cold-compile concurrency ${
|
|
3323
|
-
let
|
|
3375
|
+
Z.debug(`ssr cold-compile concurrency ${W}`, { concurrency: W });
|
|
3376
|
+
let G = null, ge = async () => (G === null && (G = await O.readFile(p(e, ".framework", "index.html"), "utf8")), G), _e = {
|
|
3324
3377
|
name: "framework:ssr",
|
|
3325
3378
|
configureServer(n) {
|
|
3326
|
-
let i = (e) =>
|
|
3379
|
+
let i = (e) => he.load(e, async () => await n.ssrLoadModule(e)), a, o = !1, s = () => {
|
|
3327
3380
|
if (a !== void 0) return a;
|
|
3328
3381
|
let n = t.locales ?? [], r = t.defaultLocale ?? n[0] ?? "en";
|
|
3329
3382
|
return n.length === 0 ? (a = Promise.resolve(() => void 0), a) : (a = (async () => {
|
|
3330
|
-
let [{ makeSsgWrap: t }, { makeSsrI18nResolver: a }] = await Promise.all([i("@voltro/i18n"), i("@voltro/i18n/server")]),
|
|
3383
|
+
let [{ makeSsgWrap: t }, { makeSsrI18nResolver: a }] = await Promise.all([i("@voltro/i18n"), i("@voltro/i18n/server")]), s = {};
|
|
3331
3384
|
for (let a of n) if (T(p(e, "src", "locales", `${a}.ts`))) try {
|
|
3332
3385
|
let n = (await i(p(e, "src", "locales", `${a}.ts`))).default;
|
|
3333
|
-
n !== void 0 && (
|
|
3386
|
+
n !== void 0 && (s[a] = t(a, n, r));
|
|
3334
3387
|
} catch (e) {
|
|
3335
3388
|
Z.warn("locale catalog failed to load for SSR", { locale: a }, e);
|
|
3336
3389
|
}
|
|
3390
|
+
if (o = Object.keys(s).length > 0, Object.keys(s).length === 0) {
|
|
3391
|
+
let { resolveLocale: e } = await i("@voltro/i18n/server");
|
|
3392
|
+
return (t, i) => ({
|
|
3393
|
+
locale: e({
|
|
3394
|
+
cookieHeader: t ?? null,
|
|
3395
|
+
acceptLanguageHeader: i ?? null,
|
|
3396
|
+
supported: n,
|
|
3397
|
+
defaultLocale: r
|
|
3398
|
+
}),
|
|
3399
|
+
outerWrap: (e) => e
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3337
3402
|
return a({
|
|
3338
|
-
wraps:
|
|
3403
|
+
wraps: s,
|
|
3339
3404
|
supported: n,
|
|
3340
3405
|
defaultLocale: r
|
|
3341
3406
|
});
|
|
3342
3407
|
})(), a);
|
|
3343
3408
|
};
|
|
3344
|
-
n.middlewares.use(async (a,
|
|
3345
|
-
if (a.method !== "GET" && a.method !== "HEAD") return
|
|
3346
|
-
let
|
|
3347
|
-
|
|
3348
|
-
let { pathname:
|
|
3349
|
-
if (
|
|
3350
|
-
let
|
|
3351
|
-
if (!
|
|
3352
|
-
let
|
|
3353
|
-
|
|
3354
|
-
pattern:
|
|
3355
|
-
pathname:
|
|
3409
|
+
n.middlewares.use(async (a, c, l) => {
|
|
3410
|
+
if (a.method !== "GET" && a.method !== "HEAD") return l();
|
|
3411
|
+
let u = a.url ?? "/";
|
|
3412
|
+
u.indexOf("?");
|
|
3413
|
+
let { pathname: d, search: f } = ri(u);
|
|
3414
|
+
if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt" || /\.[a-z0-9]+$/i.test(d)) return l();
|
|
3415
|
+
let m = Ki(d, S.ssrRoutes);
|
|
3416
|
+
if (!m) return l();
|
|
3417
|
+
let h = !me.has(m.route.pattern), g = Date.now();
|
|
3418
|
+
h && Z.info(`ssr compiling ${m.route.pattern}`, {
|
|
3419
|
+
pattern: m.route.pattern,
|
|
3420
|
+
pathname: d
|
|
3356
3421
|
});
|
|
3357
|
-
let
|
|
3422
|
+
let _ = {}, v = async (e, t) => {
|
|
3358
3423
|
let n = Date.now(), r = await t();
|
|
3359
|
-
return
|
|
3360
|
-
},
|
|
3424
|
+
return _[e] = (_[e] ?? 0) + (Date.now() - n), r;
|
|
3425
|
+
}, y = async (e, t, r) => {
|
|
3361
3426
|
let i = await n.moduleGraph.getModuleById(e);
|
|
3362
3427
|
if (!(!i || t.has(e))) {
|
|
3363
3428
|
if (t.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
|
|
@@ -3365,124 +3430,124 @@ import {
|
|
|
3365
3430
|
r.includes(e) || r.push(e);
|
|
3366
3431
|
return;
|
|
3367
3432
|
}
|
|
3368
|
-
for (let e of i.importedModules ?? []) e.id && await
|
|
3433
|
+
for (let e of i.importedModules ?? []) e.id && await y(e.id, t, r);
|
|
3369
3434
|
}
|
|
3370
|
-
},
|
|
3435
|
+
}, b = !1;
|
|
3371
3436
|
try {
|
|
3372
|
-
let
|
|
3373
|
-
if (
|
|
3374
|
-
let
|
|
3375
|
-
for (let [e, t] of Object.entries(a.headers ?? {})) typeof t == "string" ?
|
|
3376
|
-
let
|
|
3377
|
-
|
|
3378
|
-
let
|
|
3437
|
+
let x = await v("loadPage", async () => await i(p(e, "src", "pages", m.route.file))), C = yr(x, p("src", "pages", m.route.file)), w = Bi(S.dirs, m.route.dirChain), T = C === "spa" && w.some((e) => e.hasLayout);
|
|
3438
|
+
if (C !== "ssr" && C !== "isr" && !T) return l();
|
|
3439
|
+
let E = {};
|
|
3440
|
+
for (let [e, t] of Object.entries(a.headers ?? {})) typeof t == "string" ? E[e] = t : Array.isArray(t) && (E[e] = t.join(", "));
|
|
3441
|
+
let D = ra(na(r[0], { allowDevProxy: !0 }), E.cookie, { apiName: r[0]?.name }), O = new AbortController(), k = () => O.abort();
|
|
3442
|
+
c.once("close", k);
|
|
3443
|
+
let A = null, j = [], M = {};
|
|
3379
3444
|
try {
|
|
3380
|
-
(await i("@voltro/web/ssr")).beginStoreSeeds(), {chain:
|
|
3381
|
-
entries:
|
|
3445
|
+
(await i("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => Vi({
|
|
3446
|
+
entries: w,
|
|
3382
3447
|
loadLayout: (t) => i(p(e, "src", "pages", t.dir, "layout.tsx")),
|
|
3383
3448
|
loadError: (t) => i(p(e, "src", "pages", t.dir, "error.tsx")),
|
|
3384
3449
|
loadPending: (t) => i(p(e, "src", "pages", t.dir, "loading.tsx")),
|
|
3385
3450
|
ctx: {
|
|
3386
|
-
params:
|
|
3387
|
-
pathname:
|
|
3388
|
-
search:
|
|
3389
|
-
signal:
|
|
3390
|
-
headers:
|
|
3391
|
-
query:
|
|
3451
|
+
params: m.params,
|
|
3452
|
+
pathname: d,
|
|
3453
|
+
search: f,
|
|
3454
|
+
signal: O.signal,
|
|
3455
|
+
headers: E,
|
|
3456
|
+
query: D
|
|
3392
3457
|
}
|
|
3393
3458
|
}));
|
|
3394
|
-
let t =
|
|
3395
|
-
typeof t == "function" && !
|
|
3396
|
-
params:
|
|
3397
|
-
pathname:
|
|
3398
|
-
search:
|
|
3399
|
-
signal:
|
|
3400
|
-
headers:
|
|
3401
|
-
query:
|
|
3459
|
+
let t = x.loader;
|
|
3460
|
+
typeof t == "function" && !T && (A = await v("loader", () => t({
|
|
3461
|
+
params: m.params,
|
|
3462
|
+
pathname: d,
|
|
3463
|
+
search: f,
|
|
3464
|
+
signal: O.signal,
|
|
3465
|
+
headers: E,
|
|
3466
|
+
query: D
|
|
3402
3467
|
})));
|
|
3403
3468
|
} finally {
|
|
3404
|
-
|
|
3469
|
+
c.off("close", k);
|
|
3405
3470
|
}
|
|
3406
|
-
let
|
|
3407
|
-
|
|
3408
|
-
pageMod:
|
|
3409
|
-
params:
|
|
3410
|
-
query:
|
|
3471
|
+
let N = await v("loadSsrHelpers", async () => await i("@voltro/web/ssr"));
|
|
3472
|
+
T || await Ci({
|
|
3473
|
+
pageMod: x,
|
|
3474
|
+
params: m.params,
|
|
3475
|
+
query: D,
|
|
3411
3476
|
apiName: r[0]?.name,
|
|
3412
|
-
seed:
|
|
3477
|
+
seed: N.seedPreloadedSubscription,
|
|
3413
3478
|
onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
|
|
3414
3479
|
tag: e,
|
|
3415
3480
|
apiName: t,
|
|
3416
|
-
pathname:
|
|
3481
|
+
pathname: d
|
|
3417
3482
|
}, n)
|
|
3418
3483
|
});
|
|
3419
3484
|
let ee = {
|
|
3420
|
-
pattern:
|
|
3421
|
-
Component:
|
|
3422
|
-
meta:
|
|
3423
|
-
loader:
|
|
3424
|
-
ErrorBoundary:
|
|
3425
|
-
Pending:
|
|
3426
|
-
renderMode:
|
|
3427
|
-
chain:
|
|
3428
|
-
},
|
|
3429
|
-
cookies:
|
|
3430
|
-
headers:
|
|
3431
|
-
url:
|
|
3432
|
-
},
|
|
3433
|
-
|
|
3434
|
-
let
|
|
3435
|
-
outerWrap:
|
|
3436
|
-
locale:
|
|
3437
|
-
} : {},
|
|
3438
|
-
helpers:
|
|
3439
|
-
page: `src/pages/${
|
|
3440
|
-
interactive:
|
|
3485
|
+
pattern: m.route.pattern,
|
|
3486
|
+
Component: x.default,
|
|
3487
|
+
meta: x.meta,
|
|
3488
|
+
loader: x.loader,
|
|
3489
|
+
ErrorBoundary: x.ErrorBoundary,
|
|
3490
|
+
Pending: x.Pending,
|
|
3491
|
+
renderMode: C,
|
|
3492
|
+
chain: j
|
|
3493
|
+
}, P = {
|
|
3494
|
+
cookies: N.parseCookieHeader(E.cookie),
|
|
3495
|
+
headers: E,
|
|
3496
|
+
url: u
|
|
3497
|
+
}, F = x.interactive ?? "full", I = (await s())(E.cookie, E["accept-language"]);
|
|
3498
|
+
b = I !== void 0 && o;
|
|
3499
|
+
let te = I ? {
|
|
3500
|
+
outerWrap: I.outerWrap,
|
|
3501
|
+
locale: I.locale
|
|
3502
|
+
} : {}, L = T ? ei({
|
|
3503
|
+
helpers: N,
|
|
3504
|
+
page: `src/pages/${m.route.file}`,
|
|
3505
|
+
interactive: F,
|
|
3441
3506
|
delivery: "stream",
|
|
3442
3507
|
renderInput: {
|
|
3443
3508
|
descriptor: ee,
|
|
3444
|
-
params:
|
|
3445
|
-
pathname:
|
|
3446
|
-
search:
|
|
3447
|
-
segmentLoaderData:
|
|
3448
|
-
requestContext:
|
|
3449
|
-
...
|
|
3509
|
+
params: m.params,
|
|
3510
|
+
pathname: d,
|
|
3511
|
+
search: f,
|
|
3512
|
+
segmentLoaderData: M,
|
|
3513
|
+
requestContext: P,
|
|
3514
|
+
...te
|
|
3450
3515
|
}
|
|
3451
|
-
}) : null,
|
|
3452
|
-
helpers:
|
|
3453
|
-
page: `src/pages/${
|
|
3454
|
-
pathname:
|
|
3455
|
-
renderMode:
|
|
3456
|
-
interactive:
|
|
3457
|
-
loaderData:
|
|
3458
|
-
segmentLoaderData:
|
|
3459
|
-
pageLoaderRan: typeof
|
|
3460
|
-
}),
|
|
3461
|
-
await
|
|
3516
|
+
}) : null, R = T ? null : $r({
|
|
3517
|
+
helpers: N,
|
|
3518
|
+
page: `src/pages/${m.route.file}`,
|
|
3519
|
+
pathname: d,
|
|
3520
|
+
renderMode: C,
|
|
3521
|
+
interactive: F,
|
|
3522
|
+
loaderData: A,
|
|
3523
|
+
segmentLoaderData: M,
|
|
3524
|
+
pageLoaderRan: typeof x.loader == "function"
|
|
3525
|
+
}), ne = [];
|
|
3526
|
+
await v("collectCss", async () => {
|
|
3462
3527
|
let t = /* @__PURE__ */ new Set(), n = [
|
|
3463
|
-
p(e, "src", "pages",
|
|
3464
|
-
...
|
|
3528
|
+
p(e, "src", "pages", m.route.file),
|
|
3529
|
+
...w.flatMap((t) => [
|
|
3465
3530
|
...t.hasLayout ? [p(e, "src", "pages", t.dir, "layout.tsx")] : [],
|
|
3466
3531
|
...t.hasError ? [p(e, "src", "pages", t.dir, "error.tsx")] : [],
|
|
3467
3532
|
...t.hasPending ? [p(e, "src", "pages", t.dir, "loading.tsx")] : []
|
|
3468
3533
|
]),
|
|
3469
3534
|
p(e, ".framework", "main.tsx")
|
|
3470
3535
|
];
|
|
3471
|
-
for (let e of n) await
|
|
3536
|
+
for (let e of n) await y(e, t, ne);
|
|
3472
3537
|
});
|
|
3473
|
-
let re = await
|
|
3474
|
-
if (
|
|
3475
|
-
let e = (e) =>
|
|
3476
|
-
helpers:
|
|
3477
|
-
prepared:
|
|
3538
|
+
let re = await v("readShell", ge), z = await v("transformShell", () => n.transformIndexHtml(u, re)), ie = ne.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), B = I?.locale ?? P.cookies["voltro:locale"] ?? t.defaultLocale ?? (t.locales ?? [])[0] ?? "en", ae = Date.now();
|
|
3539
|
+
if (L) {
|
|
3540
|
+
let e = (e) => ni({
|
|
3541
|
+
helpers: N,
|
|
3542
|
+
prepared: L,
|
|
3478
3543
|
meta: e,
|
|
3479
|
-
interactive:
|
|
3480
|
-
extra: [
|
|
3544
|
+
interactive: F,
|
|
3545
|
+
extra: [ie]
|
|
3481
3546
|
});
|
|
3482
|
-
if (
|
|
3483
|
-
res:
|
|
3484
|
-
shell:
|
|
3485
|
-
shell:
|
|
3547
|
+
if (L.hasDeferred) bi({
|
|
3548
|
+
res: c,
|
|
3549
|
+
shell: _i({
|
|
3550
|
+
shell: z,
|
|
3486
3551
|
inlineModuleScriptsAsync: !0
|
|
3487
3552
|
}),
|
|
3488
3553
|
htmlLang: B,
|
|
@@ -3491,42 +3556,42 @@ import {
|
|
|
3491
3556
|
"x-voltro-rendered-by": "spa-shell-dev"
|
|
3492
3557
|
},
|
|
3493
3558
|
headInjection: e,
|
|
3494
|
-
render: (e) =>
|
|
3495
|
-
...
|
|
3559
|
+
render: (e) => N.renderPageToStream({
|
|
3560
|
+
...L.renderInput,
|
|
3496
3561
|
...e
|
|
3497
3562
|
}),
|
|
3498
3563
|
onShellError: (e) => {
|
|
3499
|
-
|
|
3564
|
+
U(c, "spa-shell-dev", d, m.route.pattern, e, b);
|
|
3500
3565
|
}
|
|
3501
3566
|
});
|
|
3502
3567
|
else {
|
|
3503
|
-
let t =
|
|
3504
|
-
helpers:
|
|
3505
|
-
prepared:
|
|
3506
|
-
}), n =
|
|
3507
|
-
|
|
3568
|
+
let t = ti({
|
|
3569
|
+
helpers: N,
|
|
3570
|
+
prepared: L
|
|
3571
|
+
}), n = z.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="${B}"`);
|
|
3572
|
+
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
|
|
3508
3573
|
}
|
|
3509
|
-
} else if (
|
|
3574
|
+
} else if (R) {
|
|
3510
3575
|
let e = (e) => [
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
`<meta name="voltro-interactive" content="${
|
|
3514
|
-
...
|
|
3515
|
-
|
|
3576
|
+
ie,
|
|
3577
|
+
N.renderMetaToHtml(e),
|
|
3578
|
+
`<meta name="voltro-interactive" content="${F}" />`,
|
|
3579
|
+
...R.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
|
|
3580
|
+
N.renderRouterStateScript(R.stateInput)
|
|
3516
3581
|
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3517
3582
|
descriptor: ee,
|
|
3518
|
-
params:
|
|
3519
|
-
pathname:
|
|
3520
|
-
search:
|
|
3521
|
-
loaderData:
|
|
3522
|
-
segmentLoaderData:
|
|
3523
|
-
requestContext:
|
|
3524
|
-
...
|
|
3583
|
+
params: m.params,
|
|
3584
|
+
pathname: d,
|
|
3585
|
+
search: f,
|
|
3586
|
+
loaderData: R.loaderData,
|
|
3587
|
+
segmentLoaderData: R.segmentLoaderData,
|
|
3588
|
+
requestContext: P,
|
|
3589
|
+
...te
|
|
3525
3590
|
};
|
|
3526
|
-
if (
|
|
3527
|
-
res:
|
|
3528
|
-
shell:
|
|
3529
|
-
shell:
|
|
3591
|
+
if (C === "ssr" && F === "full") bi({
|
|
3592
|
+
res: c,
|
|
3593
|
+
shell: _i({
|
|
3594
|
+
shell: z,
|
|
3530
3595
|
inlineModuleScriptsAsync: !0
|
|
3531
3596
|
}),
|
|
3532
3597
|
htmlLang: B,
|
|
@@ -3535,58 +3600,58 @@ import {
|
|
|
3535
3600
|
"x-voltro-rendered-by": "ssr-dev"
|
|
3536
3601
|
},
|
|
3537
3602
|
headInjection: e,
|
|
3538
|
-
render: (e) =>
|
|
3603
|
+
render: (e) => N.renderPageToStream({
|
|
3539
3604
|
...t,
|
|
3540
3605
|
...e
|
|
3541
3606
|
}),
|
|
3542
3607
|
onShellError: (e) => {
|
|
3543
|
-
|
|
3608
|
+
U(c, "ssr-dev", d, m.route.pattern, e, b);
|
|
3544
3609
|
}
|
|
3545
3610
|
});
|
|
3546
3611
|
else {
|
|
3547
|
-
let { html: n, meta: r } =
|
|
3548
|
-
|
|
3612
|
+
let { html: n, meta: r } = N.renderPageToHtml(t), i = z.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${B}"`);
|
|
3613
|
+
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
|
|
3549
3614
|
}
|
|
3550
3615
|
}
|
|
3551
|
-
|
|
3552
|
-
let V = Date.now() -
|
|
3553
|
-
|
|
3554
|
-
pattern:
|
|
3555
|
-
pathname:
|
|
3616
|
+
_.render = Date.now() - ae;
|
|
3617
|
+
let V = Date.now() - g;
|
|
3618
|
+
h ? (me.add(m.route.pattern), Z.info(`ssr compiled ${m.route.pattern} in ${V}ms`, {
|
|
3619
|
+
pattern: m.route.pattern,
|
|
3620
|
+
pathname: d,
|
|
3556
3621
|
elapsedMs: V,
|
|
3557
3622
|
cold: !0,
|
|
3558
|
-
phases:
|
|
3559
|
-
})) : V > 200 && Z.info(`ssr rendered ${
|
|
3560
|
-
pattern:
|
|
3561
|
-
pathname:
|
|
3623
|
+
phases: _
|
|
3624
|
+
})) : V > 200 && Z.info(`ssr rendered ${d} in ${V}ms`, {
|
|
3625
|
+
pattern: m.route.pattern,
|
|
3626
|
+
pathname: d,
|
|
3562
3627
|
elapsedMs: V,
|
|
3563
3628
|
cold: !1,
|
|
3564
|
-
phases:
|
|
3629
|
+
phases: _
|
|
3565
3630
|
});
|
|
3566
3631
|
} catch (e) {
|
|
3567
|
-
if (
|
|
3632
|
+
if (Zr(e)) {
|
|
3568
3633
|
Z.error("ssr-dev render refused", {
|
|
3569
|
-
pathname:
|
|
3570
|
-
pattern:
|
|
3571
|
-
}, e),
|
|
3634
|
+
pathname: d,
|
|
3635
|
+
pattern: m.route.pattern
|
|
3636
|
+
}, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
|
|
3572
3637
|
return;
|
|
3573
3638
|
}
|
|
3574
|
-
let t =
|
|
3639
|
+
let t = Qr(e);
|
|
3575
3640
|
if (t) {
|
|
3576
|
-
|
|
3577
|
-
for (let [e, n] of Object.entries(t.headers))
|
|
3578
|
-
|
|
3641
|
+
c.statusCode = t.status;
|
|
3642
|
+
for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
|
|
3643
|
+
c.end(t.body);
|
|
3579
3644
|
return;
|
|
3580
3645
|
}
|
|
3581
|
-
|
|
3646
|
+
U(c, "ssr-dev", d, m.route.pattern, e, b);
|
|
3582
3647
|
}
|
|
3583
3648
|
});
|
|
3584
3649
|
}
|
|
3585
|
-
},
|
|
3650
|
+
}, ve = Date.now(), ye = D.version ?? "?", be = await Ei(), K = p(e, "node_modules", "@voltro", "ui-shadcn"), q = T(p(K, "package.json")) ? K : null, xe = [], Se = await (async () => {
|
|
3586
3651
|
let t = [];
|
|
3587
3652
|
for (let n of r) {
|
|
3588
3653
|
if (!n.proxyTarget) continue;
|
|
3589
|
-
let r = await
|
|
3654
|
+
let r = await qi(e, n.pkg);
|
|
3590
3655
|
if (r) try {
|
|
3591
3656
|
t.push(await O.readFile(p(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3592
3657
|
} catch {}
|
|
@@ -3602,9 +3667,9 @@ import {
|
|
|
3602
3667
|
} catch {}
|
|
3603
3668
|
return !0;
|
|
3604
3669
|
})();
|
|
3605
|
-
|
|
3670
|
+
Se && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
|
|
3606
3671
|
try {
|
|
3607
|
-
await
|
|
3672
|
+
await Et(g, "voltro dev (web)");
|
|
3608
3673
|
} catch (e) {
|
|
3609
3674
|
Z.error(String(e.message ?? e)), process.exit(1);
|
|
3610
3675
|
}
|
|
@@ -3620,50 +3685,50 @@ import {
|
|
|
3620
3685
|
"@voltro/i18n"
|
|
3621
3686
|
],
|
|
3622
3687
|
alias: [
|
|
3623
|
-
...
|
|
3688
|
+
...be ? [{
|
|
3624
3689
|
find: "@voltro/devtools/styles.css",
|
|
3625
|
-
replacement: p(
|
|
3690
|
+
replacement: p(be, "src/styles.css")
|
|
3626
3691
|
}, {
|
|
3627
3692
|
find: "@voltro/devtools",
|
|
3628
|
-
replacement: p(
|
|
3693
|
+
replacement: p(be, "src/index.ts")
|
|
3629
3694
|
}] : [],
|
|
3630
|
-
...
|
|
3695
|
+
...q ? [
|
|
3631
3696
|
{
|
|
3632
3697
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3633
|
-
replacement: p(
|
|
3698
|
+
replacement: p(q, "src/tokens.css")
|
|
3634
3699
|
},
|
|
3635
3700
|
{
|
|
3636
3701
|
find: "@voltro/ui-shadcn/cn",
|
|
3637
|
-
replacement: p(
|
|
3702
|
+
replacement: p(q, "src/cn.ts")
|
|
3638
3703
|
},
|
|
3639
3704
|
{
|
|
3640
3705
|
find: "@voltro/ui-shadcn/brand",
|
|
3641
|
-
replacement: p(
|
|
3706
|
+
replacement: p(q, "src/brand/voltroLogo.tsx")
|
|
3642
3707
|
},
|
|
3643
3708
|
{
|
|
3644
3709
|
find: "@voltro/ui-shadcn",
|
|
3645
|
-
replacement: p(
|
|
3710
|
+
replacement: p(q, "src/index.ts")
|
|
3646
3711
|
}
|
|
3647
3712
|
] : [],
|
|
3648
|
-
...
|
|
3713
|
+
...Ze(e)
|
|
3649
3714
|
]
|
|
3650
3715
|
},
|
|
3651
3716
|
optimizeDeps: {
|
|
3652
|
-
include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...
|
|
3653
|
-
force:
|
|
3717
|
+
include: [...r.map((e) => `${e.pkg}/rpcGroup`), ...xe],
|
|
3718
|
+
force: Se
|
|
3654
3719
|
},
|
|
3655
|
-
customLogger:
|
|
3720
|
+
customLogger: qt(),
|
|
3656
3721
|
plugins: [
|
|
3657
|
-
|
|
3722
|
+
pr(p(e, "src", "pages")),
|
|
3658
3723
|
k(),
|
|
3659
3724
|
A(),
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3725
|
+
ee,
|
|
3726
|
+
L,
|
|
3727
|
+
B,
|
|
3663
3728
|
se,
|
|
3664
3729
|
ce,
|
|
3665
3730
|
ue,
|
|
3666
|
-
|
|
3731
|
+
_e,
|
|
3667
3732
|
...pe ? [pe] : []
|
|
3668
3733
|
],
|
|
3669
3734
|
server: {
|
|
@@ -3672,14 +3737,14 @@ import {
|
|
|
3672
3737
|
host: !0,
|
|
3673
3738
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3674
3739
|
proxy: H,
|
|
3675
|
-
fs: { allow: [e, ...
|
|
3740
|
+
fs: { allow: [e, ...Mi(e)] }
|
|
3676
3741
|
},
|
|
3677
3742
|
appType: "spa",
|
|
3678
3743
|
cacheDir: p(j, ".vite"),
|
|
3679
3744
|
publicDir: p(e, "public")
|
|
3680
|
-
})).listen(),
|
|
3681
|
-
version:
|
|
3682
|
-
bootMs: Date.now() -
|
|
3745
|
+
})).listen(), wi.info(`v${ye} ready in ${Date.now() - ve}ms`, {
|
|
3746
|
+
version: ye,
|
|
3747
|
+
bootMs: Date.now() - ve
|
|
3683
3748
|
}), Z.info(`listening on http://localhost:${g}`, {
|
|
3684
3749
|
port: g,
|
|
3685
3750
|
app: t.name ?? "(unnamed)"
|
|
@@ -3689,7 +3754,7 @@ import {
|
|
|
3689
3754
|
target: e.proxyTarget
|
|
3690
3755
|
}), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3691
3756
|
try {
|
|
3692
|
-
await
|
|
3757
|
+
await qe({
|
|
3693
3758
|
id: v,
|
|
3694
3759
|
name: _,
|
|
3695
3760
|
kind: "web",
|
|
@@ -3698,13 +3763,13 @@ import {
|
|
|
3698
3763
|
status: "live",
|
|
3699
3764
|
logFile: y.path
|
|
3700
3765
|
});
|
|
3701
|
-
let t =
|
|
3766
|
+
let t = zr(e);
|
|
3702
3767
|
if (t) {
|
|
3703
|
-
let e = await
|
|
3768
|
+
let e = await Yr({ dashboardAppPath: t });
|
|
3704
3769
|
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 });
|
|
3705
3770
|
}
|
|
3706
3771
|
setInterval(() => {
|
|
3707
|
-
|
|
3772
|
+
qe({
|
|
3708
3773
|
id: v,
|
|
3709
3774
|
name: _,
|
|
3710
3775
|
kind: "web",
|
|
@@ -3715,7 +3780,7 @@ import {
|
|
|
3715
3780
|
}).catch(() => {});
|
|
3716
3781
|
}, 1e4).unref();
|
|
3717
3782
|
let n = () => {
|
|
3718
|
-
|
|
3783
|
+
Je(v), y.dispose();
|
|
3719
3784
|
};
|
|
3720
3785
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3721
3786
|
} catch (e) {
|
|
@@ -3725,36 +3790,36 @@ import {
|
|
|
3725
3790
|
app: t.name ?? "unnamed",
|
|
3726
3791
|
kind: "web",
|
|
3727
3792
|
url: `http://localhost:${g}`,
|
|
3728
|
-
bootMs: Date.now() -
|
|
3793
|
+
bootMs: Date.now() - ve
|
|
3729
3794
|
}), new Promise(() => {});
|
|
3730
|
-
},
|
|
3795
|
+
}, la = async (e) => {
|
|
3731
3796
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3732
|
-
let t = await
|
|
3797
|
+
let t = await sa(e);
|
|
3733
3798
|
if (!t) return {
|
|
3734
3799
|
ran: !1,
|
|
3735
3800
|
exitCode: 0
|
|
3736
3801
|
};
|
|
3737
3802
|
let n = Date.now(), r = Z.child("serve");
|
|
3738
3803
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3739
|
-
let i = await
|
|
3804
|
+
let i = await Qi(e, t);
|
|
3740
3805
|
for (let e of i) r.info("api wired", {
|
|
3741
3806
|
name: e.name,
|
|
3742
3807
|
pkg: e.pkg
|
|
3743
3808
|
});
|
|
3744
|
-
await
|
|
3809
|
+
await ia(e, t, i);
|
|
3745
3810
|
{
|
|
3746
3811
|
let { pages: t } = await $(p(e, "src", "pages"));
|
|
3747
|
-
await
|
|
3812
|
+
await sn({
|
|
3748
3813
|
appRoot: e,
|
|
3749
3814
|
pages: t
|
|
3750
3815
|
});
|
|
3751
3816
|
}
|
|
3752
|
-
let a = t.port ?? 5173, o = await
|
|
3817
|
+
let a = t.port ?? 5173, o = await $e("vite", () => import("vite")), s = (await import("@vitejs/plugin-react")).default, c = p(e, ".framework");
|
|
3753
3818
|
Z.info("running production build"), await o.build({
|
|
3754
3819
|
root: c,
|
|
3755
3820
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3756
3821
|
plugins: [s()],
|
|
3757
|
-
customLogger:
|
|
3822
|
+
customLogger: qt(),
|
|
3758
3823
|
resolve: { dedupe: [
|
|
3759
3824
|
"react",
|
|
3760
3825
|
"react-dom",
|
|
@@ -3763,7 +3828,7 @@ import {
|
|
|
3763
3828
|
] },
|
|
3764
3829
|
build: {
|
|
3765
3830
|
outDir: "dist",
|
|
3766
|
-
rollupOptions: { output: { manualChunks:
|
|
3831
|
+
rollupOptions: { output: { manualChunks: Pi } }
|
|
3767
3832
|
},
|
|
3768
3833
|
publicDir: p(e, "public")
|
|
3769
3834
|
});
|
|
@@ -3783,14 +3848,14 @@ import {
|
|
|
3783
3848
|
extras: d,
|
|
3784
3849
|
bootMs: Date.now() - n
|
|
3785
3850
|
}), new Promise(() => {});
|
|
3786
|
-
},
|
|
3851
|
+
}, ua = 5e3, da = 6e4, fa = (e, t) => {
|
|
3787
3852
|
if (e.length === 0) return 0;
|
|
3788
3853
|
if (e.length === 1) return e[0];
|
|
3789
3854
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3790
3855
|
if (r === i) return e[r];
|
|
3791
3856
|
let a = n - r;
|
|
3792
3857
|
return e[r] * (1 - a) + e[i] * a;
|
|
3793
|
-
},
|
|
3858
|
+
}, pa = (e) => {
|
|
3794
3859
|
if (e.length === 0) return {
|
|
3795
3860
|
p50: 0,
|
|
3796
3861
|
p95: 0,
|
|
@@ -3802,18 +3867,18 @@ import {
|
|
|
3802
3867
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3803
3868
|
for (let e of t) n += e;
|
|
3804
3869
|
return {
|
|
3805
|
-
p50:
|
|
3806
|
-
p95:
|
|
3807
|
-
p99:
|
|
3870
|
+
p50: fa(t, .5),
|
|
3871
|
+
p95: fa(t, .95),
|
|
3872
|
+
p99: fa(t, .99),
|
|
3808
3873
|
mean: n / t.length,
|
|
3809
3874
|
min: t[0],
|
|
3810
3875
|
max: t[t.length - 1]
|
|
3811
3876
|
};
|
|
3812
|
-
},
|
|
3813
|
-
let t = e.maxSamples ??
|
|
3877
|
+
}, ma = (e = {}) => {
|
|
3878
|
+
let t = e.maxSamples ?? ua, n = e.defaultWindowMs ?? da, r = [];
|
|
3814
3879
|
return {
|
|
3815
3880
|
record(e) {
|
|
3816
|
-
|
|
3881
|
+
I(e), r.push({
|
|
3817
3882
|
...e,
|
|
3818
3883
|
ts: Date.now()
|
|
3819
3884
|
}), r.length > t && r.shift();
|
|
@@ -3839,7 +3904,7 @@ import {
|
|
|
3839
3904
|
tag: e.tag,
|
|
3840
3905
|
count: e.samples.length,
|
|
3841
3906
|
errorCount: n,
|
|
3842
|
-
latencyMs:
|
|
3907
|
+
latencyMs: pa(t)
|
|
3843
3908
|
});
|
|
3844
3909
|
}
|
|
3845
3910
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3852,4 +3917,4 @@ import {
|
|
|
3852
3917
|
};
|
|
3853
3918
|
};
|
|
3854
3919
|
//#endregion
|
|
3855
|
-
export {
|
|
3920
|
+
export { Jt as $, Fr as A, Zn as B, ri as C, Ke as Ct, zr as D, Ie as Dt, Yr as E, Fe as Et, hr as F, On as G, Hn as H, _r as I, _n as J, gn as K, yr as L, wr as M, mr as N, Nr as O, br as P, Xt as Q, rr as R, ni as S, Ye as St, Rr as T, qe as Tt, Bn as U, Kn as V, Nn as W, fn as X, pn as Y, sn as Z, bi as _, ot as _t, Vi as a, Et as at, ei as b, $e as bt, Qi as c, _t as ct, Pi as d, ft as dt, Pt as et, $ as f, pt as ft, _i as g, lt as gt, vi as h, ct as ht, ra as i, Rt as it, Sr as j, Pr as k, ca as l, gt as lt, Ci as m, J as mt, Fi as n, Ft as nt, Bi as o, xt as ot, ia as p, ut as pt, hn as q, na as r, Lt as rt, sa as s, yt as st, ma as t, It as tt, la as u, dt as ut, Zr as v, it as vt, Br as w, Je as wt, ti as x, Ze as xt, $r as y, rt as yt, ir as z };
|