@voltro/cli 0.17.0 → 0.19.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 +423 -0
- package/bin/voltro.mjs +17 -1
- package/dist/apiBuild-9NXH53Sd.js +2 -0
- package/dist/{apiBuild-ChdlLqGv.js → apiBuild-CY5pEwwq.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/{commands-DYQbv-DG.js → commands-BvvoQL0v.js} +2126 -1720
- package/dist/{dev-DB7pbLob.js → dev-B6rfgKfo.js} +1513 -1418
- package/dist/{dev-BCmoJfBm.js → dev-C_E1XxNF.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-DWh56Qas.js → inspectMetrics-D1DmLeJs.js} +507 -494
- package/dist/serveCommand-vPF5ucXC.js +1136 -0
- package/dist/serveEntry.js +2 -2
- package/dist/{start-ksY0wMZG.js → start-Clvz4IJb.js} +1 -1
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.core.md +60 -6
- package/templates/AGENTS.md +61 -7
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/authentication.md +57 -0
- package/templates/agent-docs/cli.md +9 -5
- package/templates/agent-docs/database/misc.md +26 -3
- package/templates/agent-docs/database/querying.md +8 -2
- package/templates/agent-docs/introduction.md +15 -1
- package/templates/agent-docs/routing.md +2 -0
- package/templates/agent-docs/schema-driven-ui.md +6 -3
- package/templates/agent-docs/whats-new.md +121 -31
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-D5WB119b.js +0 -2
- package/dist/serveCommand-DO6qr5Ok.js +0 -1129
|
@@ -12,13 +12,13 @@ import { createRequire as re } from "node:module";
|
|
|
12
12
|
import { homedir as ie } from "node:os";
|
|
13
13
|
import { FRAMEWORK_ENV_CATALOG as ae, appEnvEntries as oe, checkEnvNaming as se, formatEnvErrors as ce, installEnvSnapshot as z, isEnvContract as le, pluginEnvEntries as ue, renderDotEnvExample as de, resolveEnv as fe } from "@voltro/env";
|
|
14
14
|
import { __installPublicEnv as pe } from "@voltro/env/public";
|
|
15
|
-
import { mkdir as
|
|
16
|
-
import { createHash as
|
|
17
|
-
import { spawn as
|
|
18
|
-
import { createConnection as
|
|
19
|
-
import { PassThrough as
|
|
15
|
+
import { mkdir as me, readFile as he, writeFile as ge } from "node:fs/promises";
|
|
16
|
+
import { createHash as _e } from "node:crypto";
|
|
17
|
+
import { spawn as ve } from "node:child_process";
|
|
18
|
+
import { createConnection as ye } from "node:net";
|
|
19
|
+
import { PassThrough as be } from "node:stream";
|
|
20
20
|
//#region src/cliRuntime.ts
|
|
21
|
-
var
|
|
21
|
+
var xe = [
|
|
22
22
|
"severity",
|
|
23
23
|
"code",
|
|
24
24
|
"detail",
|
|
@@ -35,14 +35,14 @@ var ye = [
|
|
|
35
35
|
"file",
|
|
36
36
|
"line",
|
|
37
37
|
"routine"
|
|
38
|
-
],
|
|
38
|
+
], B = (e, t = 0, n = /* @__PURE__ */ new WeakSet()) => {
|
|
39
39
|
if (t > 10 || typeof e != "object" || !e || n.has(e)) return null;
|
|
40
40
|
n.add(e);
|
|
41
41
|
let r = e, i = r.message;
|
|
42
42
|
if (typeof i == "string" && i.length > 0 && i !== "Failed to execute statement") {
|
|
43
43
|
let e = { message: i };
|
|
44
44
|
typeof r.stack == "string" && (e.stack = r.stack);
|
|
45
|
-
for (let t of
|
|
45
|
+
for (let t of xe) r[t] !== void 0 && (e[t] = r[t]);
|
|
46
46
|
return e;
|
|
47
47
|
}
|
|
48
48
|
for (let e of [
|
|
@@ -55,20 +55,20 @@ var ye = [
|
|
|
55
55
|
]) {
|
|
56
56
|
let i = r[e];
|
|
57
57
|
if (i !== void 0) {
|
|
58
|
-
let e =
|
|
58
|
+
let e = B(i, t + 1, n);
|
|
59
59
|
if (e) return e;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
if (Array.isArray(r.failures)) for (let e of r.failures) {
|
|
63
|
-
let r =
|
|
63
|
+
let r = B(e, t + 1, n);
|
|
64
64
|
if (r) return r;
|
|
65
65
|
}
|
|
66
66
|
return null;
|
|
67
|
-
},
|
|
67
|
+
}, Se = (e = {}) => S.merge(v.layer, C({
|
|
68
68
|
...e.scope ? { defaultScope: e.scope } : {},
|
|
69
69
|
...e.logger
|
|
70
|
-
})),
|
|
71
|
-
let n = e.pipe(x.provide(
|
|
70
|
+
})), V = async (e, t = {}) => {
|
|
71
|
+
let n = e.pipe(x.provide(Se(t)));
|
|
72
72
|
return await x.runPromise(x.matchCauseEffect(n, {
|
|
73
73
|
onSuccess: (e) => x.succeed(e),
|
|
74
74
|
onFailure: (e) => {
|
|
@@ -84,7 +84,7 @@ var ye = [
|
|
|
84
84
|
}
|
|
85
85
|
let n = null;
|
|
86
86
|
for (let e of t) {
|
|
87
|
-
let t =
|
|
87
|
+
let t = B(e);
|
|
88
88
|
if (t) {
|
|
89
89
|
n = t;
|
|
90
90
|
break;
|
|
@@ -104,41 +104,41 @@ var ye = [
|
|
|
104
104
|
return x.zipRight(x.logError("cli command failed", r), x.succeed(1));
|
|
105
105
|
}
|
|
106
106
|
}).pipe(x.provide(C(t.logger ?? {}))));
|
|
107
|
-
},
|
|
108
|
-
let n = e.pipe(x.provide(
|
|
107
|
+
}, Ce = (e, t = {}) => {
|
|
108
|
+
let n = e.pipe(x.provide(Se(t)));
|
|
109
109
|
y.runMain(n, { disableErrorReporting: !1 });
|
|
110
|
-
},
|
|
110
|
+
}, H = u(h(import.meta.url)), we = [m(H, "..", "templates"), m(H, "..", "..", "templates")], Te = (e) => ({
|
|
111
111
|
_tag: "TemplateNotFoundError",
|
|
112
112
|
searched: e
|
|
113
|
-
}),
|
|
113
|
+
}), Ee = ["AGENTS.md", "CLAUDE.md"], De = "voltro:agents-md:keep", Oe = 2048, ke = "<!-- VOLTRO:INDEX -->", U = (e, t) => e.exists(t).pipe(x.orElseSucceed(() => !1)), W = (e, t) => e.readFileString(t).pipe(x.orElseSucceed(() => "")), Ae = (e, t) => e.readFileString(t).pipe(x.map((e) => {
|
|
114
114
|
try {
|
|
115
115
|
return JSON.parse(e).workspaces !== void 0;
|
|
116
116
|
} catch {
|
|
117
117
|
return !1;
|
|
118
118
|
}
|
|
119
|
-
}), x.orElseSucceed(() => !1)),
|
|
119
|
+
}), x.orElseSucceed(() => !1)), je = (e) => x.gen(function* () {
|
|
120
120
|
let t = yield* _.FileSystem, n = m(e);
|
|
121
121
|
for (;;) {
|
|
122
|
-
if ((yield*
|
|
122
|
+
if ((yield* U(t, f(n, ".git"))) || (yield* U(t, f(n, "pnpm-workspace.yaml"))) || (yield* Ae(t, f(n, "package.json")))) return n;
|
|
123
123
|
let r = u(n);
|
|
124
124
|
if (r === n) return m(e);
|
|
125
125
|
n = r;
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
127
|
+
}), Me = (e, t, n) => x.gen(function* () {
|
|
128
128
|
yield* e.makeDirectory(n, { recursive: !0 }).pipe(x.orElseSucceed(() => void 0));
|
|
129
129
|
let r = yield* e.readDirectory(t).pipe(x.orElseSucceed(() => []));
|
|
130
130
|
for (let i of r) {
|
|
131
131
|
let r = f(t, i), a = f(n, i);
|
|
132
|
-
(yield* e.stat(r).pipe(x.orElseSucceed(() => null)))?.type === "Directory" ? yield*
|
|
132
|
+
(yield* e.stat(r).pipe(x.orElseSucceed(() => null)))?.type === "Directory" ? yield* Me(e, r, a) : yield* e.copyFile(r, a).pipe(x.orElseSucceed(() => void 0));
|
|
133
133
|
}
|
|
134
|
-
}),
|
|
134
|
+
}), Ne = (e) => typeof e?.name == "string" && e.name.length > 0 ? e.name.split("#")[0] : null, Pe = (e, t) => x.gen(function* () {
|
|
135
135
|
let n = f(t, "app.config.ts");
|
|
136
|
-
if (!(yield*
|
|
136
|
+
if (!(yield* U(e, n))) return null;
|
|
137
137
|
let r = (yield* x.tryPromise(() => import(g(n).href)).pipe(x.orElseSucceed(() => null)))?.default;
|
|
138
|
-
return !r || r.type && r.type !== "api" ? r?.type === "web" ? [] : null : (r.plugins ?? []).map(
|
|
139
|
-
}),
|
|
138
|
+
return !r || r.type && r.type !== "api" ? r?.type === "web" ? [] : null : (r.plugins ?? []).map(Ne).filter((e) => e !== null);
|
|
139
|
+
}), Fe = (e, t) => x.gen(function* () {
|
|
140
140
|
let n = [], r = [], i = f(t, "apps");
|
|
141
|
-
if (!(yield*
|
|
141
|
+
if (!(yield* U(e, i))) return {
|
|
142
142
|
apis: n,
|
|
143
143
|
webs: r
|
|
144
144
|
};
|
|
@@ -146,8 +146,8 @@ var ye = [
|
|
|
146
146
|
let a = f(i, t);
|
|
147
147
|
if ((yield* e.stat(a).pipe(x.orElseSucceed(() => null)))?.type === "Directory") for (let t of yield* e.readDirectory(a).pipe(x.orElseSucceed(() => []))) {
|
|
148
148
|
let i = f(a, t), o = f(i, "app.config.ts");
|
|
149
|
-
if (!(yield*
|
|
150
|
-
let s = yield*
|
|
149
|
+
if (!(yield* U(e, o))) continue;
|
|
150
|
+
let s = yield* W(e, o);
|
|
151
151
|
/type:\s*['"]web['"]/.test(s) ? r.push(i) : n.push(i);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -155,7 +155,7 @@ var ye = [
|
|
|
155
155
|
apis: n,
|
|
156
156
|
webs: r
|
|
157
157
|
};
|
|
158
|
-
}),
|
|
158
|
+
}), Ie = (e) => e.replace(/\|/g, "\\|").replace(/\n/g, " ").trim(), Le = (e, t, n) => {
|
|
159
159
|
let r = [
|
|
160
160
|
"<!-- voltro agent-docs index — regenerated at seed time -->",
|
|
161
161
|
"## Deep reference (read on demand)",
|
|
@@ -167,17 +167,17 @@ var ye = [
|
|
|
167
167
|
"",
|
|
168
168
|
"| Topic | Open | Summary |",
|
|
169
169
|
"|---|---|---|",
|
|
170
|
-
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${
|
|
170
|
+
...e.modules.map((e) => `| ${e.title} | \`${n}${e.path}\` | ${Ie(e.description)} |`),
|
|
171
171
|
""
|
|
172
|
-
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = t === null ? e.plugins.map((e) => `| ${e.slug} | \`node_modules/${e.pkg}/README.md\` | ${
|
|
172
|
+
], i = new Map(e.plugins.map((e) => [e.pkg, e])), a = t === null ? e.plugins.map((e) => `| ${e.slug} | \`node_modules/${e.pkg}/README.md\` | ${Ie(e.description)} |`) : t.map((e) => {
|
|
173
173
|
let t = i.get(e);
|
|
174
|
-
return t ? `| ${t.slug} | \`node_modules/${e}/README.md\` | ${
|
|
174
|
+
return t ? `| ${t.slug} | \`node_modules/${e}/README.md\` | ${Ie(t.description)} |` : `| ${e.replace(/^@[^/]+\//, "")} | \`node_modules/${e}/README.md\` | (see plugin README) |`;
|
|
175
175
|
});
|
|
176
176
|
return r.push(`### Plugins${t === null ? "" : " (installed)"}`, "", "| Plugin | Open | Summary |", "|---|---|---|"), r.push(a.length ? a.join("\n") : "| _(none installed)_ | | |", ""), r.join("\n");
|
|
177
|
-
},
|
|
177
|
+
}, Re = (e, t, n) => {
|
|
178
178
|
let r = t.templates?.[e] ?? t.templates?.[e.replace(/^frontend-/, "")];
|
|
179
179
|
return `\nScaffolded from the \`${e}\` template — see \`${r ? `${n}${r}` : `${n}agent-docs/templates/overview.md`}\`.\n`;
|
|
180
|
-
},
|
|
180
|
+
}, ze = {
|
|
181
181
|
api: (e, t, n = "") => `# api — agent notes
|
|
182
182
|
|
|
183
183
|
You are in a Voltro **api** app. Server primitives live here: \`queries/\`,
|
|
@@ -217,7 +217,7 @@ You are in a Voltro **web** app. File-based routing under \`src/pages/**\`.
|
|
|
217
217
|
Deep reference (paths from the repo root): \`${e}agent-docs/routing.md\`,
|
|
218
218
|
\`${e}agent-docs/schema-driven-ui.md\`, \`${e}agent-docs/internationalization.md\`.
|
|
219
219
|
${t}`
|
|
220
|
-
},
|
|
220
|
+
}, Be = [
|
|
221
221
|
{
|
|
222
222
|
name: "voltro-schema",
|
|
223
223
|
description: "Define or change a Voltro database table/schema (columns, mixins, indexes, relations).",
|
|
@@ -248,7 +248,7 @@ ${t}`
|
|
|
248
248
|
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.",
|
|
249
249
|
module: "cli.md"
|
|
250
250
|
}
|
|
251
|
-
],
|
|
251
|
+
], Ve = (e, t) => `---
|
|
252
252
|
name: ${e.name}
|
|
253
253
|
description: ${e.description}
|
|
254
254
|
---
|
|
@@ -259,10 +259,10 @@ Open the full reference and follow the patterns there:
|
|
|
259
259
|
|
|
260
260
|
Also read the repo-root \`AGENTS.md\` for the always-true rules (browser/server
|
|
261
261
|
boundary, naming, anti-patterns) before editing.
|
|
262
|
-
`,
|
|
263
|
-
let i = yield*
|
|
262
|
+
`, He = (e, t, n, r) => x.gen(function* () {
|
|
263
|
+
let i = yield* U(e, t);
|
|
264
264
|
if (i) {
|
|
265
|
-
if ((yield*
|
|
265
|
+
if ((yield* W(e, t)).slice(0, Oe).includes("voltro:agents-md:keep")) return {
|
|
266
266
|
path: t,
|
|
267
267
|
action: "protected"
|
|
268
268
|
};
|
|
@@ -275,64 +275,64 @@ boundary, naming, anti-patterns) before editing.
|
|
|
275
275
|
path: t,
|
|
276
276
|
action: i ? "overwritten" : "created"
|
|
277
277
|
};
|
|
278
|
-
}),
|
|
279
|
-
let n = yield* _.FileSystem, r = yield*
|
|
280
|
-
for (let e of
|
|
278
|
+
}), Ue = (e, t = {}) => x.gen(function* () {
|
|
279
|
+
let n = yield* _.FileSystem, r = yield* je(e), i = null;
|
|
280
|
+
for (let e of we) if (yield* U(n, f(e, "AGENTS.core.md"))) {
|
|
281
281
|
i = e;
|
|
282
282
|
break;
|
|
283
283
|
}
|
|
284
284
|
if (i === null) {
|
|
285
|
-
for (let e of
|
|
286
|
-
let i = yield*
|
|
287
|
-
for (let e of
|
|
285
|
+
for (let e of we) if (yield* U(n, f(e, "AGENTS.md"))) {
|
|
286
|
+
let i = yield* W(n, f(e, "AGENTS.md")), a = [];
|
|
287
|
+
for (let e of Ee) a.push(yield* He(n, f(r, e), i, t.force ?? !1));
|
|
288
288
|
return { files: a };
|
|
289
289
|
}
|
|
290
|
-
return yield* x.fail(
|
|
290
|
+
return yield* x.fail(Te(we.map((e) => f(e, "AGENTS.core.md"))));
|
|
291
291
|
}
|
|
292
|
-
let a = yield*
|
|
292
|
+
let a = yield* W(n, f(i, "AGENTS.core.md")), o = yield* W(n, f(i, "agent-docs", "_manifest.json")), s = o ? JSON.parse(o) : {
|
|
293
293
|
modules: [],
|
|
294
294
|
plugins: []
|
|
295
|
-
}, c = (t.preferPointer ?? !1) || (yield*
|
|
296
|
-
if ((yield* x.forEach(d, (e) =>
|
|
295
|
+
}, c = (t.preferPointer ?? !1) || (yield* U(n, f(r, "node_modules/@voltro/cli/templates/agent-docs", "_manifest.json"))), l = c ? "node_modules/@voltro/cli/templates/" : "", u = t.force ?? !1, d = Ee.map((e) => f(r, e));
|
|
296
|
+
if ((yield* x.forEach(d, (e) => W(n, e).pipe(x.map((e) => e.slice(0, Oe))))).every((e) => e.includes("voltro:agents-md:keep"))) return { files: d.map((e) => ({
|
|
297
297
|
path: e,
|
|
298
298
|
action: "protected"
|
|
299
299
|
})) };
|
|
300
|
-
let { apis: p, webs: h } = yield*
|
|
300
|
+
let { apis: p, webs: h } = yield* Fe(n, r), g = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), y = !1;
|
|
301
301
|
for (let e of p) {
|
|
302
|
-
let t = yield*
|
|
302
|
+
let t = yield* Pe(n, e);
|
|
303
303
|
if (g.set(e, t), t !== null) {
|
|
304
304
|
y = !0;
|
|
305
305
|
for (let e of t) v.add(e);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
let b = t.plugins ? t.plugins.map(
|
|
309
|
-
for (let e of d) C.push(yield*
|
|
310
|
-
c || (yield*
|
|
308
|
+
let b = t.plugins ? t.plugins.map(Ne).filter((e) => e !== null) : y ? [...v] : null, S = a.includes(ke) ? a.replace(ke, Le(s, b, l)) : a, C = [];
|
|
309
|
+
for (let e of d) C.push(yield* He(n, e, S, u));
|
|
310
|
+
c || (yield* Me(n, f(i, "agent-docs"), f(r, "agent-docs")));
|
|
311
311
|
let w = new Map((t.appTemplates ?? []).map((e) => [m(e.dir), e.template])), T = (e) => {
|
|
312
312
|
let t = w.get(m(e));
|
|
313
|
-
return t ?
|
|
314
|
-
}, E = (e, t) => x.forEach(
|
|
315
|
-
for (let e of p) C.push(...yield* E(e,
|
|
316
|
-
for (let e of h) C.push(...yield* E(e,
|
|
317
|
-
for (let e of
|
|
313
|
+
return t ? Re(t, s, l) : "";
|
|
314
|
+
}, E = (e, t) => x.forEach(Ee, (r) => He(n, f(e, r), t, u));
|
|
315
|
+
for (let e of p) C.push(...yield* E(e, ze.api(l, g.get(e) ?? null, T(e)))), (yield* U(n, f(e, "database"))) && C.push(...yield* E(f(e, "database"), ze.database(l)));
|
|
316
|
+
for (let e of h) C.push(...yield* E(e, ze.web(l, T(e))));
|
|
317
|
+
for (let e of Be) C.push(yield* He(n, f(r, ".claude", "skills", e.name, "SKILL.md"), Ve(e, l), u));
|
|
318
318
|
return { files: C };
|
|
319
|
-
}),
|
|
319
|
+
}), We = (e, t = {}) => x.runPromise(Ue(e, t).pipe(x.provide(v.layer))), Ge = async (e) => {
|
|
320
320
|
let t = e.includes("--force"), n = e.find((e) => !e.startsWith("-")) ?? process.cwd();
|
|
321
|
-
return
|
|
322
|
-
let e = yield*
|
|
321
|
+
return V(x.gen(function* () {
|
|
322
|
+
let e = yield* Ue(n, { force: t });
|
|
323
323
|
for (let t of e.files) {
|
|
324
|
-
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${
|
|
324
|
+
let e = t.action === "created" ? "wrote" : t.action === "overwritten" ? "overwrote" : t.action === "protected" ? `protected (hand-maintained — has "${De}")` : "present (use --force to overwrite)";
|
|
325
325
|
yield* x.logInfo(`${t.path.split("/").slice(-2).join("/")} ${e}`, { action: t.action });
|
|
326
326
|
}
|
|
327
327
|
return 0;
|
|
328
328
|
}).pipe(x.catchTag("TemplateNotFoundError", (e) => x.gen(function* () {
|
|
329
329
|
return yield* x.logError("AGENTS.md template not found", { searched: e.searched }), 1;
|
|
330
330
|
}))), { scope: "voltro:agents-md" });
|
|
331
|
-
},
|
|
331
|
+
}, Ke = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), qe = (e) => {
|
|
332
332
|
try {
|
|
333
333
|
let t = f(e, "tsconfig.json");
|
|
334
334
|
if (!O(t)) return [];
|
|
335
|
-
let n = JSON.parse(
|
|
335
|
+
let n = JSON.parse(Ke(M(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = m(e, n.baseUrl ?? "."), a = [];
|
|
336
336
|
for (let [e, t] of Object.entries(r)) {
|
|
337
337
|
let n = t[0];
|
|
338
338
|
if (!n) continue;
|
|
@@ -352,17 +352,17 @@ boundary, naming, anti-patterns) before editing.
|
|
|
352
352
|
} catch {
|
|
353
353
|
return [];
|
|
354
354
|
}
|
|
355
|
-
},
|
|
355
|
+
}, Je = (e) => {
|
|
356
356
|
let t = e;
|
|
357
357
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
358
|
-
},
|
|
358
|
+
}, Ye = async (e, t) => {
|
|
359
359
|
try {
|
|
360
360
|
return await t();
|
|
361
361
|
} catch (t) {
|
|
362
|
-
throw
|
|
362
|
+
throw Je(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;
|
|
363
363
|
}
|
|
364
|
-
},
|
|
365
|
-
let n =
|
|
364
|
+
}, Xe = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", Ze = (e, t) => t ? `${e} | undefined` : e, Qe = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${Ze(t.tsType, t.optional)}`).join("\n"), $e = async (e, t) => {
|
|
365
|
+
let n = Qe(t, () => !0), r = `${Xe}
|
|
366
366
|
import '@voltro/env/server'
|
|
367
367
|
|
|
368
368
|
declare module '@voltro/env/server' {
|
|
@@ -371,9 +371,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
`;
|
|
374
|
-
await
|
|
375
|
-
},
|
|
376
|
-
let n =
|
|
374
|
+
await ge(f(e, "env.generated.d.ts"), r, "utf8");
|
|
375
|
+
}, et = async (e, t) => {
|
|
376
|
+
let n = Qe(t, (e) => e === "public"), r = `${Xe}
|
|
377
377
|
import '@voltro/env/public'
|
|
378
378
|
|
|
379
379
|
declare module '@voltro/env/public' {
|
|
@@ -382,9 +382,9 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
`, i = f(e, "src");
|
|
385
|
-
await
|
|
386
|
-
},
|
|
387
|
-
let n = `${
|
|
385
|
+
await me(i, { recursive: !0 }), await ge(f(i, "voltro-env.d.ts"), r, "utf8");
|
|
386
|
+
}, tt = async (e, t) => {
|
|
387
|
+
let n = `${Xe}
|
|
388
388
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
389
389
|
|
|
390
390
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -392,8 +392,8 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
392
392
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
393
393
|
__installPublicEnv(publicEnvValues)
|
|
394
394
|
`;
|
|
395
|
-
await
|
|
396
|
-
},
|
|
395
|
+
await me(e, { recursive: !0 }), await ge(f(e, "env.public.ts"), n, "utf8");
|
|
396
|
+
}, nt = async (e) => {
|
|
397
397
|
let t = le(e.rawEnv) ? e.rawEnv : void 0, n = await fe({
|
|
398
398
|
contract: t,
|
|
399
399
|
resolveSecret: ne
|
|
@@ -411,11 +411,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
411
411
|
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 });
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
414
|
+
return e.generateTypes && t && (e.appType === "api" ? await $e(e.root, t) : await et(e.root, t)), {
|
|
415
415
|
resolved: n,
|
|
416
416
|
contract: t
|
|
417
417
|
};
|
|
418
|
-
},
|
|
418
|
+
}, rt = (e) => {
|
|
419
419
|
let t = oe(e.contract), n = (e.plugins ?? []).flatMap((e) => ue(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ae, i = /* @__PURE__ */ new Set(), a = [];
|
|
420
420
|
for (let e of [
|
|
421
421
|
...t,
|
|
@@ -423,8 +423,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
423
423
|
...r
|
|
424
424
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
425
425
|
return a;
|
|
426
|
-
},
|
|
427
|
-
let r =
|
|
426
|
+
}, it = (e, t, n = (e) => process.env[e]) => {
|
|
427
|
+
let r = rt(t).map((e) => {
|
|
428
428
|
let t = n(e.key) !== void 0;
|
|
429
429
|
return {
|
|
430
430
|
...e,
|
|
@@ -441,13 +441,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
441
441
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
442
442
|
}
|
|
443
443
|
};
|
|
444
|
-
},
|
|
444
|
+
}, at = (e, t) => de(rt({
|
|
445
445
|
...e,
|
|
446
446
|
includeFramework: !1
|
|
447
447
|
}), {
|
|
448
448
|
includeFramework: e.includeFramework !== !1,
|
|
449
449
|
...t ? { header: t } : {}
|
|
450
|
-
}),
|
|
450
|
+
}), ot = () => {
|
|
451
451
|
let e = /* @__PURE__ */ new Map();
|
|
452
452
|
return {
|
|
453
453
|
get(t) {
|
|
@@ -474,7 +474,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
474
474
|
return Array.from(e.entries());
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
|
-
},
|
|
477
|
+
}, G = (e) => {
|
|
478
478
|
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e * 1e3;
|
|
479
479
|
if (typeof e != "string") return null;
|
|
480
480
|
let t = /^\s*(\d+)\s*(s|seconds?|m|minutes?|h|hours?|d|days?)\s*$/i.exec(e);
|
|
@@ -483,10 +483,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
483
483
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
484
484
|
let r = t[2].toLowerCase();
|
|
485
485
|
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;
|
|
486
|
-
},
|
|
486
|
+
}, st = (e, t = {}) => {
|
|
487
487
|
let n = [e];
|
|
488
488
|
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("|");
|
|
489
|
-
},
|
|
489
|
+
}, ct = (e, t) => e.expiresAt > t, lt = (e, t) => e.expiresAt <= t && e.servableUntil > t, ut = T({ scope: "voltro:cli" }), dt = (e, t) => {
|
|
490
490
|
if (t?.code !== "EACCES") return "";
|
|
491
491
|
if (typeof process.getuid != "function") return " — permission denied";
|
|
492
492
|
try {
|
|
@@ -495,8 +495,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
495
495
|
} catch {
|
|
496
496
|
return " — permission denied (and the file could not be stat-ed either)";
|
|
497
497
|
}
|
|
498
|
-
},
|
|
499
|
-
|
|
498
|
+
}, ft = [], pt = (e) => {
|
|
499
|
+
ft.length = 0;
|
|
500
500
|
let t = e[1] && !e[1].startsWith("-") ? e[1] : void 0, n = t ? d(t) ? t : m(process.cwd(), t) : process.cwd(), r = [], i = n;
|
|
501
501
|
for (;;) {
|
|
502
502
|
r.push(i);
|
|
@@ -507,7 +507,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
507
507
|
for (let e of r) for (let t of [".env.local", ".env"]) {
|
|
508
508
|
let n = m(e, t);
|
|
509
509
|
if (O(n)) {
|
|
510
|
-
|
|
510
|
+
ft.push(n);
|
|
511
511
|
try {
|
|
512
512
|
let e = M(n, "utf8");
|
|
513
513
|
for (let t of e.split(/\r?\n/)) {
|
|
@@ -519,15 +519,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
519
519
|
(i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
|
|
520
520
|
}
|
|
521
521
|
} catch (e) {
|
|
522
|
-
|
|
522
|
+
ut.warn(`failed to load env file (continuing)${dt(n, e)}`, { path: n }, e);
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
},
|
|
526
|
+
}, mt = 500, ht = (e, t, n = {}) => {
|
|
527
527
|
if (e.length === 0) return () => {};
|
|
528
528
|
let r = (e) => n.root ? p(n.root, e) : e, i = !1, a = (e) => {
|
|
529
529
|
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(() => {
|
|
530
|
-
let e =
|
|
530
|
+
let e = ve(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
531
531
|
stdio: "inherit",
|
|
532
532
|
env: process.env,
|
|
533
533
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -541,62 +541,62 @@ __installPublicEnv(publicEnvValues)
|
|
|
541
541
|
});
|
|
542
542
|
}));
|
|
543
543
|
};
|
|
544
|
-
for (let t of e) te(t, { interval:
|
|
544
|
+
for (let t of e) te(t, { interval: mt }, (e, n) => {
|
|
545
545
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
546
546
|
});
|
|
547
547
|
return t.info("watching .env files for changes", {
|
|
548
548
|
files: e.map(r),
|
|
549
|
-
intervalMs:
|
|
549
|
+
intervalMs: mt
|
|
550
550
|
}), () => {
|
|
551
551
|
for (let t of e) F(t);
|
|
552
552
|
};
|
|
553
|
-
},
|
|
553
|
+
}, K = T({ scope: "vite" }), gt = /\x1b\[[0-9;]*m/g, _t = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, vt = (e) => e.replace(gt, "").replace(_t, "").trim(), yt = /proxy error/i, bt = [
|
|
554
554
|
"ECONNREFUSED",
|
|
555
555
|
"ECONNRESET",
|
|
556
556
|
"ECONNABORTED",
|
|
557
557
|
"EPIPE",
|
|
558
558
|
"ETIMEDOUT"
|
|
559
|
-
],
|
|
559
|
+
], xt = (e, t = 0) => {
|
|
560
560
|
if (e == null || t > 5) return !1;
|
|
561
561
|
let n = e;
|
|
562
|
-
return typeof n.code == "string" &&
|
|
563
|
-
},
|
|
562
|
+
return typeof n.code == "string" && bt.includes(n.code) || typeof n.message == "string" && bt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => xt(e, t + 1)) ? !0 : xt(n.cause, t + 1);
|
|
563
|
+
}, St = 4e3, Ct = () => {
|
|
564
564
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
565
565
|
hasWarned: !1,
|
|
566
566
|
info: (e) => {
|
|
567
|
-
let t =
|
|
568
|
-
t.length !== 0 &&
|
|
567
|
+
let t = vt(e);
|
|
568
|
+
t.length !== 0 && K.info(t);
|
|
569
569
|
},
|
|
570
570
|
warn: (e) => {
|
|
571
571
|
n.hasWarned = !0;
|
|
572
|
-
let t =
|
|
573
|
-
t.length !== 0 &&
|
|
572
|
+
let t = vt(e);
|
|
573
|
+
t.length !== 0 && K.warn(t);
|
|
574
574
|
},
|
|
575
575
|
warnOnce: (t) => {
|
|
576
|
-
let r =
|
|
577
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
576
|
+
let r = vt(t);
|
|
577
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && K.warn(r));
|
|
578
578
|
},
|
|
579
579
|
error: (e, n) => {
|
|
580
|
-
let r =
|
|
580
|
+
let r = vt(e), i = n?.error;
|
|
581
581
|
if (r.length !== 0) {
|
|
582
|
-
if (
|
|
582
|
+
if (yt.test(r) && xt(i)) {
|
|
583
583
|
let e = Date.now();
|
|
584
|
-
e - t >
|
|
584
|
+
e - t > St && (t = e, K.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
585
585
|
return;
|
|
586
586
|
}
|
|
587
|
-
|
|
587
|
+
K.error(r, {}, i);
|
|
588
588
|
}
|
|
589
589
|
},
|
|
590
590
|
clearScreen: () => {},
|
|
591
591
|
hasErrorLogged: (e) => !1
|
|
592
592
|
};
|
|
593
593
|
return n;
|
|
594
|
-
},
|
|
594
|
+
}, wt = (e = process.env) => {
|
|
595
595
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
596
596
|
if (t === void 0 || t.trim() === "") return 4;
|
|
597
597
|
let n = Number(t);
|
|
598
598
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
599
|
-
},
|
|
599
|
+
}, Tt = (e) => {
|
|
600
600
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
601
601
|
let e = r.shift();
|
|
602
602
|
e ? e() : n--;
|
|
@@ -614,8 +614,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
614
614
|
return n;
|
|
615
615
|
}
|
|
616
616
|
};
|
|
617
|
-
},
|
|
618
|
-
let t =
|
|
617
|
+
}, Et = (e) => {
|
|
618
|
+
let t = Tt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
619
619
|
return {
|
|
620
620
|
load: (i, a) => {
|
|
621
621
|
if (r.has(i)) return a();
|
|
@@ -640,7 +640,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
640
640
|
return r.size;
|
|
641
641
|
}
|
|
642
642
|
};
|
|
643
|
-
},
|
|
643
|
+
}, Dt = (e) => {
|
|
644
644
|
let t = [];
|
|
645
645
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
646
646
|
name: n.slice(5, -2),
|
|
@@ -656,7 +656,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
656
656
|
optional: !1
|
|
657
657
|
});
|
|
658
658
|
return t;
|
|
659
|
-
},
|
|
659
|
+
}, Ot = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), kt = async (e) => {
|
|
660
660
|
let t = m(e);
|
|
661
661
|
for (let e = 0; e < 4; e++) {
|
|
662
662
|
let e = f(t, "project.json");
|
|
@@ -674,8 +674,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
674
674
|
t = n;
|
|
675
675
|
}
|
|
676
676
|
return null;
|
|
677
|
-
},
|
|
678
|
-
let t = await
|
|
677
|
+
}, At = async (e) => {
|
|
678
|
+
let t = await kt(e);
|
|
679
679
|
if (!t) return [];
|
|
680
680
|
let { projectDir: n, manifest: r } = t, i = l(e), a = r.apps ?? {}, o = [];
|
|
681
681
|
for (let [e, t] of Object.entries(a)) {
|
|
@@ -684,23 +684,23 @@ __installPublicEnv(publicEnvValues)
|
|
|
684
684
|
if (!O(r)) continue;
|
|
685
685
|
let a;
|
|
686
686
|
try {
|
|
687
|
-
let { pages: e } = await
|
|
687
|
+
let { pages: e } = await Q(r);
|
|
688
688
|
a = e.map((e) => ({
|
|
689
689
|
pattern: e.pattern,
|
|
690
|
-
params:
|
|
690
|
+
params: Dt(e.pattern)
|
|
691
691
|
}));
|
|
692
692
|
} catch {
|
|
693
693
|
continue;
|
|
694
694
|
}
|
|
695
695
|
o.push({
|
|
696
|
-
key:
|
|
696
|
+
key: Ot(e),
|
|
697
697
|
origin: `http://localhost:${t.port}`,
|
|
698
698
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
699
699
|
routes: a
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
702
|
return o;
|
|
703
|
-
},
|
|
703
|
+
}, jt = (e) => {
|
|
704
704
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
705
705
|
let t = e.pattern;
|
|
706
706
|
for (let n of e.params) {
|
|
@@ -708,21 +708,21 @@ __installPublicEnv(publicEnvValues)
|
|
|
708
708
|
t = t.replace(e, r);
|
|
709
709
|
}
|
|
710
710
|
return "`" + t + "`";
|
|
711
|
-
},
|
|
711
|
+
}, Mt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
712
712
|
let t = "string";
|
|
713
713
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
714
|
-
}).join("; ")} }`,
|
|
715
|
-
let r =
|
|
714
|
+
}).join("; ")} }`, Nt = (e, t, n) => {
|
|
715
|
+
let r = Mt(e), i = jt(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
|
|
716
716
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
717
|
-
},
|
|
717
|
+
}, Pt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${Nt(e, !1)},`).join("\n")}\n}`, Ft = (e, t) => {
|
|
718
718
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
719
|
-
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)}: ${
|
|
719
|
+
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)}: ${Nt(e, !0, i)},`);
|
|
720
720
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
721
|
-
},
|
|
721
|
+
}, It = async (e) => {
|
|
722
722
|
let t = e.pages.map((e) => ({
|
|
723
723
|
pattern: e.pattern,
|
|
724
|
-
params:
|
|
725
|
-
})), n = await
|
|
724
|
+
params: Dt(e.pattern)
|
|
725
|
+
})), n = await At(e.appRoot), r = [
|
|
726
726
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
727
727
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
728
728
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -731,7 +731,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
731
731
|
"",
|
|
732
732
|
"type EmptyParams = Record<string, never>",
|
|
733
733
|
""
|
|
734
|
-
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${
|
|
734
|
+
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${Pt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => Ft(e, i)).join("\n")}\n} as const\n`}`, o = f(e.appRoot, ".framework", "routes.generated.ts");
|
|
735
735
|
await j.mkdir(u(o), { recursive: !0 });
|
|
736
736
|
let s = null;
|
|
737
737
|
try {
|
|
@@ -744,7 +744,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
744
744
|
path: o,
|
|
745
745
|
wrote: !0
|
|
746
746
|
});
|
|
747
|
-
},
|
|
747
|
+
}, Lt = 256, Rt = (e = Lt) => {
|
|
748
748
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
749
749
|
return {
|
|
750
750
|
emit(r, i) {
|
|
@@ -767,27 +767,27 @@ __installPublicEnv(publicEnvValues)
|
|
|
767
767
|
return t.slice();
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
|
-
},
|
|
770
|
+
}, zt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Bt = () => `: keep-alive ${Date.now()}\n\n`, Vt = {
|
|
771
771
|
trace: 0,
|
|
772
772
|
debug: 1,
|
|
773
773
|
info: 2,
|
|
774
774
|
warn: 3,
|
|
775
775
|
error: 4,
|
|
776
776
|
fatal: 5
|
|
777
|
-
},
|
|
777
|
+
}, Ht = 2e3, Ut = 200, Wt = class {
|
|
778
778
|
capacity;
|
|
779
779
|
buffer = [];
|
|
780
|
-
constructor(e =
|
|
780
|
+
constructor(e = Ht) {
|
|
781
781
|
this.capacity = e;
|
|
782
782
|
}
|
|
783
783
|
append(e) {
|
|
784
784
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
785
785
|
}
|
|
786
786
|
query(e = {}) {
|
|
787
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
787
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Ut, this.capacity), i = e.minLevel === void 0 ? Vt.trace : Vt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
788
788
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
789
789
|
let r = this.buffer[e];
|
|
790
|
-
r.ts < t || r.ts > n ||
|
|
790
|
+
r.ts < t || r.ts > n || Vt[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);
|
|
791
791
|
}
|
|
792
792
|
return l.reverse();
|
|
793
793
|
}
|
|
@@ -800,7 +800,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
800
800
|
clear() {
|
|
801
801
|
this.buffer = [];
|
|
802
802
|
}
|
|
803
|
-
},
|
|
803
|
+
}, Gt = null, Kt = () => (Gt === null && (Gt = new Wt()), Gt), qt = (e) => {
|
|
804
804
|
if (typeof e == "string") return e;
|
|
805
805
|
if (e instanceof Error) return e.message;
|
|
806
806
|
try {
|
|
@@ -808,18 +808,18 @@ __installPublicEnv(publicEnvValues)
|
|
|
808
808
|
} catch {
|
|
809
809
|
return String(e);
|
|
810
810
|
}
|
|
811
|
-
},
|
|
811
|
+
}, Jt = (e) => {
|
|
812
812
|
let t = {
|
|
813
813
|
log: console.log.bind(console),
|
|
814
814
|
info: console.info.bind(console),
|
|
815
815
|
warn: console.warn.bind(console),
|
|
816
816
|
error: console.error.bind(console),
|
|
817
817
|
debug: console.debug.bind(console)
|
|
818
|
-
}, n =
|
|
818
|
+
}, n = Kt(), r = !1, i = (i) => (...a) => {
|
|
819
819
|
if (t[i](...a), !r) {
|
|
820
820
|
r = !0;
|
|
821
821
|
try {
|
|
822
|
-
let t = a.length > 0 ?
|
|
822
|
+
let t = a.length > 0 ? qt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = L();
|
|
823
823
|
e.emit("log", {
|
|
824
824
|
level: i,
|
|
825
825
|
message: r,
|
|
@@ -877,24 +877,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
877
877
|
return () => {
|
|
878
878
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
879
879
|
};
|
|
880
|
-
},
|
|
880
|
+
}, Yt = 2e3, Xt = 8, Zt = 1e3, Qt = 200, q = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, $t = (e) => {
|
|
881
881
|
switch (e) {
|
|
882
882
|
case "error": return "error";
|
|
883
883
|
case "warn": return "warn";
|
|
884
884
|
case "debug": return "debug";
|
|
885
885
|
default: return "info";
|
|
886
886
|
}
|
|
887
|
-
},
|
|
887
|
+
}, en = T({ scope: "client" }), tn = (e, t) => {
|
|
888
888
|
let n;
|
|
889
889
|
try {
|
|
890
890
|
n = JSON.parse(e);
|
|
891
891
|
} catch {
|
|
892
|
-
return
|
|
892
|
+
return nn(400, { error: "invalid JSON body" });
|
|
893
893
|
}
|
|
894
|
-
if (typeof n != "object" || !n) return
|
|
894
|
+
if (typeof n != "object" || !n) return nn(400, { error: "body must be a JSON object" });
|
|
895
895
|
let r = n;
|
|
896
|
-
if (!Array.isArray(r.entries)) return
|
|
897
|
-
let i = typeof r.app == "string" ?
|
|
896
|
+
if (!Array.isArray(r.entries)) return nn(400, { error: "entries must be an array" });
|
|
897
|
+
let i = typeof r.app == "string" ? q(r.app, 120) : void 0, a = typeof r.page == "string" ? q(r.page, 200) : void 0, o = typeof r.ua == "string" ? q(r.ua, 200) : void 0, s = r.entries.slice(0, Qt), c = 0;
|
|
898
898
|
for (let e of s) {
|
|
899
899
|
if (typeof e != "object" || !e) continue;
|
|
900
900
|
let n = e;
|
|
@@ -905,7 +905,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
905
905
|
"warn",
|
|
906
906
|
"error",
|
|
907
907
|
"debug"
|
|
908
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l =
|
|
908
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = q(n.message, Yt), u = Array.isArray(n.args) ? n.args.slice(0, Xt).filter((e) => typeof e == "string").map((e) => q(e, Zt)) : void 0, d = typeof n.stack == "string" ? q(n.stack, Yt) : void 0;
|
|
909
909
|
t.emit("clientLog", {
|
|
910
910
|
ts: s,
|
|
911
911
|
level: r,
|
|
@@ -920,35 +920,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
920
920
|
...i === void 0 ? {} : { app: i },
|
|
921
921
|
...a === void 0 ? {} : { page: a },
|
|
922
922
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
923
|
-
}, p =
|
|
924
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
923
|
+
}, p = $t(r);
|
|
924
|
+
(p === "error" || p === "warn") && d !== void 0 ? en[p](l, f, { stack: d }) : en[p](l, {
|
|
925
925
|
...f,
|
|
926
926
|
...d === void 0 ? {} : { stack: d }
|
|
927
927
|
}), c++;
|
|
928
928
|
}
|
|
929
|
-
return
|
|
929
|
+
return nn(202, {
|
|
930
930
|
accepted: c,
|
|
931
931
|
dropped: r.entries.length - c
|
|
932
932
|
});
|
|
933
|
-
},
|
|
933
|
+
}, nn = (e, t) => ({
|
|
934
934
|
status: e,
|
|
935
935
|
contentType: "application/json; charset=utf-8",
|
|
936
936
|
body: JSON.stringify(t)
|
|
937
|
-
}),
|
|
937
|
+
}), rn = "/_voltro/inspect/clientLog", an = [
|
|
938
938
|
"trace",
|
|
939
939
|
"debug",
|
|
940
940
|
"info",
|
|
941
941
|
"warn",
|
|
942
942
|
"error",
|
|
943
943
|
"fatal"
|
|
944
|
-
],
|
|
944
|
+
], on = {
|
|
945
945
|
trace: "TRACE",
|
|
946
946
|
debug: "DEBUG",
|
|
947
947
|
info: "INFO ",
|
|
948
948
|
warn: "WARN ",
|
|
949
949
|
error: "ERROR",
|
|
950
950
|
fatal: "FATAL"
|
|
951
|
-
},
|
|
951
|
+
}, sn = (e) => an.includes(e), cn = (e, t, n = {}) => {
|
|
952
952
|
if (i()) return {
|
|
953
953
|
status: 503,
|
|
954
954
|
contentType: "application/json",
|
|
@@ -979,7 +979,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
979
979
|
Number.isFinite(e) && e > 0 && (c.max = Math.floor(e));
|
|
980
980
|
}
|
|
981
981
|
let f = s.get("level");
|
|
982
|
-
f !== null &&
|
|
982
|
+
f !== null && sn(f) && (c.minLevel = f);
|
|
983
983
|
let p = s.get("source");
|
|
984
984
|
(p === "server" || p === "client") && (c.source = p);
|
|
985
985
|
let m = s.get("scope");
|
|
@@ -992,7 +992,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
992
992
|
if ((s.get("format") ?? "json") === "text") return {
|
|
993
993
|
status: 200,
|
|
994
994
|
contentType: "text/plain; charset=utf-8",
|
|
995
|
-
body: _.map(
|
|
995
|
+
body: _.map(ln).join("\n") + (_.length > 0 ? "\n" : "")
|
|
996
996
|
};
|
|
997
997
|
let v = {
|
|
998
998
|
capturedAt: Date.now(),
|
|
@@ -1006,33 +1006,37 @@ __installPublicEnv(publicEnvValues)
|
|
|
1006
1006
|
contentType: "application/json; charset=utf-8",
|
|
1007
1007
|
body: JSON.stringify(v)
|
|
1008
1008
|
};
|
|
1009
|
-
},
|
|
1010
|
-
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 =
|
|
1011
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1012
|
-
},
|
|
1009
|
+
}, ln = (e) => {
|
|
1010
|
+
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 = dn(e.fields);
|
|
1011
|
+
return `${n}:${r}:${i}.${a} ${on[e.level]} ${o} ${e.message}${s}`;
|
|
1012
|
+
}, un = 80, dn = (e) => {
|
|
1013
1013
|
let t = Object.entries(e);
|
|
1014
1014
|
if (t.length === 0) return "";
|
|
1015
1015
|
let n = [];
|
|
1016
1016
|
for (let [e, r] of t) {
|
|
1017
1017
|
if (r === void 0) continue;
|
|
1018
|
-
let t =
|
|
1018
|
+
let t = fn(r);
|
|
1019
1019
|
n.push(`${e}=${t}`);
|
|
1020
1020
|
}
|
|
1021
1021
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1022
|
-
},
|
|
1022
|
+
}, fn = (e) => {
|
|
1023
1023
|
if (typeof e == "string") {
|
|
1024
|
-
let t = e.length >
|
|
1024
|
+
let t = e.length > un ? e.slice(0, un) + "…" : e;
|
|
1025
1025
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1026
1026
|
}
|
|
1027
1027
|
if (e === null) return "null";
|
|
1028
1028
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1029
1029
|
try {
|
|
1030
1030
|
let t = JSON.stringify(e);
|
|
1031
|
-
return t.length >
|
|
1031
|
+
return t.length > un ? t.slice(0, un) + "…" : t;
|
|
1032
1032
|
} catch {
|
|
1033
1033
|
return "[unserialisable]";
|
|
1034
1034
|
}
|
|
1035
|
-
},
|
|
1035
|
+
}, pn = "/_voltro/inspect/logs", mn = (e, t, n) => {
|
|
1036
|
+
if (t.headers.authorization !== void 0) return !1;
|
|
1037
|
+
let { token: r } = n;
|
|
1038
|
+
return r === void 0 || r === "" || !n.isLoopback(n.target) ? !1 : (e.setHeader("authorization", `Bearer ${r}`), !0);
|
|
1039
|
+
}, hn = [{
|
|
1036
1040
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1037
1041
|
handle: (e, t) => {
|
|
1038
1042
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1044,13 +1048,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1044
1048
|
});
|
|
1045
1049
|
} else t.info(n);
|
|
1046
1050
|
}
|
|
1047
|
-
}],
|
|
1051
|
+
}], gn = () => {
|
|
1048
1052
|
let e = {
|
|
1049
1053
|
warn: console.warn.bind(console),
|
|
1050
1054
|
error: console.error.bind(console)
|
|
1051
1055
|
}, t = T({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1052
1056
|
if (!n) {
|
|
1053
|
-
for (let e of
|
|
1057
|
+
for (let e of hn) if (e.match(i[0])) {
|
|
1054
1058
|
n = !0;
|
|
1055
1059
|
try {
|
|
1056
1060
|
e.handle(i, t);
|
|
@@ -1065,7 +1069,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1065
1069
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1066
1070
|
console.warn = e.warn, console.error = e.error;
|
|
1067
1071
|
};
|
|
1068
|
-
},
|
|
1072
|
+
}, _n = {
|
|
1069
1073
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1070
1074
|
renderMode: "it picks the server render strategy",
|
|
1071
1075
|
dynamic: "it picks the server render strategy",
|
|
@@ -1076,7 +1080,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1076
1080
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1077
1081
|
interactive: "it decides how much client JS the server ships",
|
|
1078
1082
|
tenantAware: "it is part of the server-side cache key"
|
|
1079
|
-
},
|
|
1083
|
+
}, vn = Object.keys(_n), yn = (e) => n.test(e), bn = (e) => e.replace(/page\.tsx$/, "page.test.tsx"), xn = "virtual:voltro-route-refresh", Sn = `\0${xn}`, Cn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, wn = () => `
|
|
1080
1084
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1081
1085
|
|
|
1082
1086
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1105,11 +1109,11 @@ const stableForm = (value) => {
|
|
|
1105
1109
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1106
1110
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1107
1111
|
* value. Everything else a page exports is plain client-side data. */
|
|
1108
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1112
|
+
const serverRelevantExports = ${JSON.stringify(vn)}
|
|
1109
1113
|
|
|
1110
1114
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1111
1115
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1112
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1116
|
+
const serverExportEffect = ${JSON.stringify(_n)}
|
|
1113
1117
|
|
|
1114
1118
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1115
1119
|
export const serverEffectOf = (name) =>
|
|
@@ -1152,7 +1156,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1152
1156
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1153
1157
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1154
1158
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1155
|
-
`,
|
|
1159
|
+
`, Tn = (e) => `
|
|
1156
1160
|
if (import.meta.hot) {
|
|
1157
1161
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1158
1162
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1179,73 +1183,73 @@ import {
|
|
|
1179
1183
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1180
1184
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1181
1185
|
serverEffectOf as __voltro_serverEffect,
|
|
1182
|
-
} from '${
|
|
1183
|
-
`,
|
|
1184
|
-
let [i = "", a] =
|
|
1185
|
-
if (!i.endsWith(".tsx") || a !== void 0 &&
|
|
1186
|
-
let o =
|
|
1186
|
+
} from '${xn}'
|
|
1187
|
+
`, En = (e) => e.replace(/\\/g, "/"), Dn = (n, r) => {
|
|
1188
|
+
let [i = "", a] = En(n).split("?");
|
|
1189
|
+
if (!i.endsWith(".tsx") || a !== void 0 && Cn.test(a)) return !1;
|
|
1190
|
+
let o = En(r).replace(/\/$/, "");
|
|
1187
1191
|
return i.startsWith(`${o}/`) ? t.test(i) || e.has(i.slice(i.lastIndexOf("/") + 1)) : !1;
|
|
1188
|
-
},
|
|
1192
|
+
}, On = (e, t, n) => Dn(t, n) ? `${e}${Tn(En(t).split("?")[0] ?? t)}` : null, kn = (e) => ({
|
|
1189
1193
|
name: "voltro:route-fast-refresh",
|
|
1190
1194
|
enforce: "pre",
|
|
1191
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1192
|
-
load: (e) => e ===
|
|
1195
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? Sn : void 0,
|
|
1196
|
+
load: (e) => e === Sn ? wn() : void 0,
|
|
1193
1197
|
transform: (t, n, r) => {
|
|
1194
1198
|
if (r?.ssr === !0) return null;
|
|
1195
|
-
let i =
|
|
1199
|
+
let i = On(t, n, e);
|
|
1196
1200
|
return i === null ? null : {
|
|
1197
1201
|
code: i,
|
|
1198
1202
|
map: null
|
|
1199
1203
|
};
|
|
1200
1204
|
}
|
|
1201
|
-
}),
|
|
1205
|
+
}), An = [
|
|
1202
1206
|
"static",
|
|
1203
1207
|
"spa",
|
|
1204
1208
|
"ssr",
|
|
1205
1209
|
"isr"
|
|
1206
|
-
],
|
|
1210
|
+
], jn = (e) => typeof e == "string" && An.includes(e), Mn = An.map((e) => `'${e}'`).join(" | "), Nn = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${Mn}.${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)." : ""}`, Pn = class extends Error {
|
|
1207
1211
|
page;
|
|
1208
1212
|
value;
|
|
1209
1213
|
name = "InvalidRenderModeError";
|
|
1210
1214
|
constructor(e, t) {
|
|
1211
|
-
super(
|
|
1215
|
+
super(Nn(e, t)), this.page = e, this.value = t;
|
|
1212
1216
|
}
|
|
1213
|
-
},
|
|
1217
|
+
}, Fn = (e, t = "<page>") => {
|
|
1214
1218
|
if (e.renderMode !== void 0 && e.renderMode !== null) {
|
|
1215
|
-
if (!
|
|
1219
|
+
if (!jn(e.renderMode)) throw new Pn(t, String(e.renderMode));
|
|
1216
1220
|
return e.renderMode;
|
|
1217
1221
|
}
|
|
1218
1222
|
return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
|
|
1219
|
-
},
|
|
1220
|
-
renderMode:
|
|
1223
|
+
}, In = (e, t = "<page>") => ({
|
|
1224
|
+
renderMode: Fn(e, t),
|
|
1221
1225
|
tenantAware: e.tenantAware === !0,
|
|
1222
|
-
revalidateMs:
|
|
1223
|
-
staleWhileRevalidateMs:
|
|
1226
|
+
revalidateMs: G(e.revalidate),
|
|
1227
|
+
staleWhileRevalidateMs: G(e.staleWhileRevalidate) ?? 0,
|
|
1224
1228
|
cacheInvalidatesOn: Array.isArray(e.cacheInvalidatesOn) ? e.cacheInvalidatesOn : [],
|
|
1225
1229
|
interactive: e.interactive ?? "full",
|
|
1226
1230
|
hasLoader: typeof e.loader == "function",
|
|
1227
1231
|
hasMeta: e.meta != null,
|
|
1228
1232
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1229
|
-
}),
|
|
1233
|
+
}), Ln = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Rn = (e) => Ln.exec(e)?.[1] ?? null, zn = /export\s+default\b|export\s*\{[^}]*\bas\s+default\b/, Bn = async (e, t) => {
|
|
1230
1234
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1231
1235
|
let n;
|
|
1232
1236
|
try {
|
|
1233
|
-
n = await
|
|
1237
|
+
n = await he(f(e, t.file), "utf8");
|
|
1234
1238
|
} catch {
|
|
1235
1239
|
return null;
|
|
1236
1240
|
}
|
|
1237
|
-
let r =
|
|
1238
|
-
return r !== null && !
|
|
1241
|
+
let r = Rn(n);
|
|
1242
|
+
return r !== null && !jn(r) ? Nn(f("src", "pages", t.file), r) : zn.test(n) ? null : `${f("src", "pages", t.file)} is a route (it ends in .page.tsx) 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 — if this file is NOT a route —\n drop the .page suffix. Anything under src/pages/ without it is ordinary code and may\n live beside the page that uses it.`;
|
|
1239
1243
|
}))).filter((e) => e !== null);
|
|
1240
1244
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1241
|
-
},
|
|
1245
|
+
}, Vn = f(ie(), ".voltro"), Hn = f(Vn, "runtime-registry.json"), Un = 3e4, Wn = () => {
|
|
1242
1246
|
let e = Math.random().toString(36).slice(2, 10);
|
|
1243
|
-
return `${
|
|
1244
|
-
},
|
|
1245
|
-
await j.mkdir(
|
|
1246
|
-
},
|
|
1247
|
+
return `${Hn}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
1248
|
+
}, Gn = async () => {
|
|
1249
|
+
await j.mkdir(Vn, { recursive: !0 });
|
|
1250
|
+
}, Kn = async () => {
|
|
1247
1251
|
try {
|
|
1248
|
-
let e = await j.readFile(
|
|
1252
|
+
let e = await j.readFile(Hn, "utf8"), t = JSON.parse(e);
|
|
1249
1253
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
1250
1254
|
version: 1,
|
|
1251
1255
|
apps: []
|
|
@@ -1256,34 +1260,34 @@ import {
|
|
|
1256
1260
|
apps: []
|
|
1257
1261
|
};
|
|
1258
1262
|
}
|
|
1259
|
-
},
|
|
1260
|
-
await
|
|
1261
|
-
let t =
|
|
1263
|
+
}, qn = async (e) => {
|
|
1264
|
+
await Gn();
|
|
1265
|
+
let t = Wn();
|
|
1262
1266
|
try {
|
|
1263
1267
|
await j.writeFile(t, JSON.stringify(e, null, 2), {
|
|
1264
1268
|
encoding: "utf8",
|
|
1265
1269
|
mode: 384
|
|
1266
|
-
}), await j.rename(t,
|
|
1270
|
+
}), await j.rename(t, Hn), await j.chmod(Hn, 384).catch(() => {});
|
|
1267
1271
|
} catch (e) {
|
|
1268
1272
|
try {
|
|
1269
1273
|
await j.unlink(t);
|
|
1270
1274
|
} catch {}
|
|
1271
1275
|
throw e;
|
|
1272
1276
|
}
|
|
1273
|
-
},
|
|
1277
|
+
}, Jn = (e) => {
|
|
1274
1278
|
try {
|
|
1275
1279
|
return process.kill(e, 0), !0;
|
|
1276
1280
|
} catch {
|
|
1277
1281
|
return !1;
|
|
1278
1282
|
}
|
|
1279
|
-
},
|
|
1283
|
+
}, Yn = (e) => {
|
|
1280
1284
|
let t = Date.now();
|
|
1281
|
-
return e.filter((e) =>
|
|
1282
|
-
},
|
|
1283
|
-
let e = await
|
|
1285
|
+
return e.filter((e) => Jn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Un : !1);
|
|
1286
|
+
}, Xn = async () => {
|
|
1287
|
+
let e = await Kn(), t = Yn(e.apps);
|
|
1284
1288
|
if (t.length === e.apps.length) return e;
|
|
1285
1289
|
try {
|
|
1286
|
-
await
|
|
1290
|
+
await qn({
|
|
1287
1291
|
version: 1,
|
|
1288
1292
|
apps: t
|
|
1289
1293
|
});
|
|
@@ -1292,49 +1296,49 @@ import {
|
|
|
1292
1296
|
version: 1,
|
|
1293
1297
|
apps: t
|
|
1294
1298
|
};
|
|
1295
|
-
},
|
|
1296
|
-
let t = await
|
|
1299
|
+
}, Zn = async (e) => {
|
|
1300
|
+
let t = await Kn(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
|
|
1297
1301
|
...e,
|
|
1298
1302
|
...i !== void 0 && i !== "" ? { inspectToken: i } : {},
|
|
1299
1303
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
1300
1304
|
heartbeatAt: n
|
|
1301
1305
|
};
|
|
1302
|
-
await
|
|
1306
|
+
await qn({
|
|
1303
1307
|
version: 1,
|
|
1304
1308
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
|
|
1305
1309
|
});
|
|
1306
|
-
},
|
|
1310
|
+
}, Qn = async (e) => {
|
|
1307
1311
|
try {
|
|
1308
|
-
let t = await
|
|
1312
|
+
let t = await Kn(), n = t.apps.filter((t) => t.id !== e);
|
|
1309
1313
|
if (n.length === t.apps.length) return;
|
|
1310
|
-
await
|
|
1314
|
+
await qn({
|
|
1311
1315
|
version: 1,
|
|
1312
1316
|
apps: n
|
|
1313
1317
|
});
|
|
1314
1318
|
} catch {}
|
|
1315
|
-
},
|
|
1319
|
+
}, $n = (e, t, n) => `${e}:${t}:${n}`, J = f(ie(), ".voltro", "logs"), er = () => {
|
|
1316
1320
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1317
1321
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1318
|
-
},
|
|
1319
|
-
if (
|
|
1320
|
-
|
|
1321
|
-
let e = Date.now() -
|
|
1322
|
+
}, tr = !1, nr = () => {
|
|
1323
|
+
if (tr) return;
|
|
1324
|
+
tr = !0;
|
|
1325
|
+
let e = Date.now() - er(), t = [];
|
|
1322
1326
|
try {
|
|
1323
|
-
t = N(
|
|
1327
|
+
t = N(J);
|
|
1324
1328
|
} catch {
|
|
1325
1329
|
return;
|
|
1326
1330
|
}
|
|
1327
1331
|
for (let n of t) {
|
|
1328
1332
|
if (!n.endsWith(".log")) continue;
|
|
1329
|
-
let t = f(
|
|
1333
|
+
let t = f(J, n);
|
|
1330
1334
|
try {
|
|
1331
1335
|
P(t).mtimeMs < e && ee(t);
|
|
1332
1336
|
} catch {}
|
|
1333
1337
|
}
|
|
1334
|
-
},
|
|
1335
|
-
let t =
|
|
1338
|
+
}, rr = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), ir = (e, t) => f(J, `${rr(e)}-${t}.log`), ar = (e) => {
|
|
1339
|
+
let t = rr(e), n = [];
|
|
1336
1340
|
try {
|
|
1337
|
-
n = N(
|
|
1341
|
+
n = N(J);
|
|
1338
1342
|
} catch {
|
|
1339
1343
|
return;
|
|
1340
1344
|
}
|
|
@@ -1342,19 +1346,19 @@ import {
|
|
|
1342
1346
|
if (r.length === 0) return;
|
|
1343
1347
|
let i, a = -1;
|
|
1344
1348
|
for (let e of r) {
|
|
1345
|
-
let t = f(
|
|
1349
|
+
let t = f(J, e);
|
|
1346
1350
|
try {
|
|
1347
1351
|
let e = P(t);
|
|
1348
1352
|
e.mtimeMs > a && (a = e.mtimeMs, i = t);
|
|
1349
1353
|
} catch {}
|
|
1350
1354
|
}
|
|
1351
1355
|
return i;
|
|
1352
|
-
},
|
|
1356
|
+
}, or = (e) => {
|
|
1353
1357
|
try {
|
|
1354
|
-
k(
|
|
1358
|
+
k(J, { recursive: !0 });
|
|
1355
1359
|
} catch {}
|
|
1356
|
-
|
|
1357
|
-
let t =
|
|
1360
|
+
nr();
|
|
1361
|
+
let t = ir(e, process.pid), n = A(t, "w"), r = (e) => {
|
|
1358
1362
|
let t = {
|
|
1359
1363
|
ts: e.ts.getTime(),
|
|
1360
1364
|
level: e.level,
|
|
@@ -1395,7 +1399,7 @@ import {
|
|
|
1395
1399
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1396
1400
|
}
|
|
1397
1401
|
};
|
|
1398
|
-
},
|
|
1402
|
+
}, sr = async (e, t) => {
|
|
1399
1403
|
let n;
|
|
1400
1404
|
try {
|
|
1401
1405
|
n = await j.readFile(e, "utf8");
|
|
@@ -1409,11 +1413,11 @@ import {
|
|
|
1409
1413
|
i.push(t);
|
|
1410
1414
|
} catch {}
|
|
1411
1415
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1412
|
-
},
|
|
1416
|
+
}, cr = T({ scope: "voltro:dashboard" }), lr = re(import.meta.url), ur = 5179, dr = (e) => {
|
|
1413
1417
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1414
1418
|
if (t && O(f(m(t), "app.config.ts"))) return m(t);
|
|
1415
1419
|
try {
|
|
1416
|
-
let e = u(
|
|
1420
|
+
let e = u(lr.resolve("@voltro/dashboard/package.json"));
|
|
1417
1421
|
if (O(f(e, "app.config.ts"))) return e;
|
|
1418
1422
|
} catch {}
|
|
1419
1423
|
let n = f("voltro-devtools", "apps", "dashboard"), r = m(e);
|
|
@@ -1425,53 +1429,53 @@ import {
|
|
|
1425
1429
|
r = t;
|
|
1426
1430
|
}
|
|
1427
1431
|
return null;
|
|
1428
|
-
},
|
|
1429
|
-
let i =
|
|
1432
|
+
}, fr = "VOLTRO_IS_DASHBOARD", pr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1433
|
+
let i = ye({
|
|
1430
1434
|
port: e,
|
|
1431
1435
|
host: t
|
|
1432
1436
|
}), a = !1, o = (e) => {
|
|
1433
1437
|
a || (a = !0, i.destroy(), r(e));
|
|
1434
1438
|
};
|
|
1435
1439
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1436
|
-
}),
|
|
1440
|
+
}), mr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), hr = () => process.env[fr] === "1", gr = () => process.stdout.isTTY === !0, Y = f(ie(), ".voltro", "dashboard-launch.lock"), _r = 1e4, vr = async () => {
|
|
1437
1441
|
try {
|
|
1438
|
-
await j.mkdir(u(
|
|
1439
|
-
let e = await j.open(
|
|
1442
|
+
await j.mkdir(u(Y), { recursive: !0 });
|
|
1443
|
+
let e = await j.open(Y, "wx");
|
|
1440
1444
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1441
1445
|
} catch {
|
|
1442
1446
|
try {
|
|
1443
|
-
let e = await j.stat(
|
|
1444
|
-
if (Date.now() - e.mtimeMs >
|
|
1447
|
+
let e = await j.stat(Y);
|
|
1448
|
+
if (Date.now() - e.mtimeMs > _r) return await j.unlink(Y).catch(() => void 0), vr();
|
|
1445
1449
|
} catch {}
|
|
1446
1450
|
return !1;
|
|
1447
1451
|
}
|
|
1448
|
-
},
|
|
1452
|
+
}, yr = async () => {
|
|
1449
1453
|
try {
|
|
1450
|
-
await j.unlink(
|
|
1454
|
+
await j.unlink(Y);
|
|
1451
1455
|
} catch {}
|
|
1452
|
-
},
|
|
1456
|
+
}, br = async (e) => {
|
|
1453
1457
|
let t = e.port ?? 5179;
|
|
1454
|
-
if (
|
|
1458
|
+
if (mr()) return {
|
|
1455
1459
|
status: "skipped",
|
|
1456
1460
|
reason: "disabled by flag/env",
|
|
1457
1461
|
port: t
|
|
1458
1462
|
};
|
|
1459
|
-
if (
|
|
1463
|
+
if (hr()) return {
|
|
1460
1464
|
status: "skipped",
|
|
1461
1465
|
reason: "this process IS the dashboard",
|
|
1462
1466
|
port: t
|
|
1463
1467
|
};
|
|
1464
|
-
if (!
|
|
1468
|
+
if (!gr()) return {
|
|
1465
1469
|
status: "skipped",
|
|
1466
1470
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1467
1471
|
port: t
|
|
1468
1472
|
};
|
|
1469
|
-
if (!await
|
|
1473
|
+
if (!await vr()) return {
|
|
1470
1474
|
status: "skipped",
|
|
1471
1475
|
reason: "another voltro process is currently launching the dashboard",
|
|
1472
1476
|
port: t
|
|
1473
1477
|
};
|
|
1474
|
-
if (await
|
|
1478
|
+
if (await pr(t)) return await yr(), {
|
|
1475
1479
|
status: "already-running",
|
|
1476
1480
|
port: t
|
|
1477
1481
|
};
|
|
@@ -1480,7 +1484,7 @@ import {
|
|
|
1480
1484
|
let e = process.argv[1];
|
|
1481
1485
|
n = e && e.endsWith("/src/bin.ts") ? f(u(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
1482
1486
|
}
|
|
1483
|
-
let r = O(f(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a =
|
|
1487
|
+
let r = O(f(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = ve(process.execPath, [
|
|
1484
1488
|
n,
|
|
1485
1489
|
i,
|
|
1486
1490
|
e.dashboardAppPath
|
|
@@ -1488,7 +1492,7 @@ import {
|
|
|
1488
1492
|
stdio: "ignore",
|
|
1489
1493
|
env: {
|
|
1490
1494
|
...process.env,
|
|
1491
|
-
[
|
|
1495
|
+
[fr]: "1",
|
|
1492
1496
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1493
1497
|
}
|
|
1494
1498
|
});
|
|
@@ -1496,22 +1500,22 @@ import {
|
|
|
1496
1500
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1497
1501
|
a.kill("SIGTERM");
|
|
1498
1502
|
} catch {}
|
|
1499
|
-
}),
|
|
1503
|
+
}), cr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1500
1504
|
port: t,
|
|
1501
1505
|
mode: i,
|
|
1502
1506
|
prebuilt: r
|
|
1503
|
-
}), r ||
|
|
1504
|
-
|
|
1507
|
+
}), r || cr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), cr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1508
|
+
yr();
|
|
1505
1509
|
}, 4e3).unref(), {
|
|
1506
1510
|
status: "launched",
|
|
1507
1511
|
port: t
|
|
1508
1512
|
};
|
|
1509
|
-
},
|
|
1513
|
+
}, xr = class extends Error {
|
|
1510
1514
|
_voltroDeferral = !0;
|
|
1511
1515
|
constructor(e) {
|
|
1512
1516
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1513
1517
|
}
|
|
1514
|
-
},
|
|
1518
|
+
}, Sr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Cr = (e) => {
|
|
1515
1519
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1516
1520
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1517
1521
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1526,7 +1530,7 @@ import {
|
|
|
1526
1530
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1527
1531
|
});
|
|
1528
1532
|
} catch (e) {
|
|
1529
|
-
throw new
|
|
1533
|
+
throw new xr(e instanceof Error ? e.message : String(e));
|
|
1530
1534
|
}
|
|
1531
1535
|
return {
|
|
1532
1536
|
loaderData: n.renderData,
|
|
@@ -1542,8 +1546,8 @@ import {
|
|
|
1542
1546
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1543
1547
|
}
|
|
1544
1548
|
};
|
|
1545
|
-
},
|
|
1546
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1549
|
+
}, wr = (e) => {
|
|
1550
|
+
let { helpers: t, renderInput: n } = e, r = Cr({
|
|
1547
1551
|
helpers: t,
|
|
1548
1552
|
page: e.page,
|
|
1549
1553
|
pathname: n.pathname,
|
|
@@ -1564,42 +1568,42 @@ import {
|
|
|
1564
1568
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1565
1569
|
hasDeferred: r.hasDeferred
|
|
1566
1570
|
};
|
|
1567
|
-
},
|
|
1571
|
+
}, Tr = (e) => {
|
|
1568
1572
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1569
1573
|
return {
|
|
1570
1574
|
body: t,
|
|
1571
1575
|
meta: n
|
|
1572
1576
|
};
|
|
1573
|
-
},
|
|
1577
|
+
}, Er = (e) => [
|
|
1574
1578
|
...e.extra ?? [],
|
|
1575
1579
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1576
1580
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1577
1581
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1578
1582
|
e.prepared.stateScript
|
|
1579
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1580
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1581
|
-
let r =
|
|
1583
|
+
].filter((e) => e.length > 0).join("\n "), Dr = "<div id=\"root\"></div>", Or = "<div id=\"root\">", kr = "</div>", Ar = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, jr = /\bsrc=["']([^"']+)["']/i, Mr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Nr = (e) => {
|
|
1584
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Ar, (e) => {
|
|
1585
|
+
let r = jr.exec(e)?.[1];
|
|
1582
1586
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1583
1587
|
});
|
|
1584
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1585
|
-
let i = r.indexOf(
|
|
1586
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1588
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Mr, "<script async$1>"));
|
|
1589
|
+
let i = r.indexOf(Dr);
|
|
1590
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Dr}\` 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.`);
|
|
1587
1591
|
return {
|
|
1588
|
-
head: `${r.slice(0, i)}${
|
|
1589
|
-
tail: `${
|
|
1592
|
+
head: `${r.slice(0, i)}${Or}`,
|
|
1593
|
+
tail: `${kr}${r.slice(i + 21)}`,
|
|
1590
1594
|
bootstrapModules: n
|
|
1591
1595
|
};
|
|
1592
|
-
},
|
|
1596
|
+
}, Pr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Fr = (e) => {
|
|
1593
1597
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1594
1598
|
if (s || !o || a === null) return;
|
|
1595
1599
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1596
1600
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1597
|
-
t.flushHeaders?.(), t.write(
|
|
1601
|
+
t.flushHeaders?.(), t.write(Pr({
|
|
1598
1602
|
head: n.head,
|
|
1599
1603
|
headInjection: i(a.meta),
|
|
1600
1604
|
htmlLang: r
|
|
1601
1605
|
}));
|
|
1602
|
-
let c = new
|
|
1606
|
+
let c = new be();
|
|
1603
1607
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
1604
1608
|
t.end(n.tail);
|
|
1605
1609
|
}), a.stream.pipe(c);
|
|
@@ -1624,14 +1628,14 @@ import {
|
|
|
1624
1628
|
return;
|
|
1625
1629
|
}
|
|
1626
1630
|
c();
|
|
1627
|
-
},
|
|
1631
|
+
}, X = T({ scope: "voltro:dev:web" }), Ir = T({ scope: "vite" }), Lr = await (async () => {
|
|
1628
1632
|
try {
|
|
1629
1633
|
let e = f(u(h(import.meta.url)), "..", "package.json"), t = await j.readFile(e, "utf8");
|
|
1630
1634
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1631
1635
|
} catch {
|
|
1632
1636
|
return "0.0.0";
|
|
1633
1637
|
}
|
|
1634
|
-
})(),
|
|
1638
|
+
})(), Rr = async () => {
|
|
1635
1639
|
try {
|
|
1636
1640
|
let e = u(h(import.meta.url)), t = m(e, "..", "..", "devtools");
|
|
1637
1641
|
if (O(f(t, "package.json"))) return t;
|
|
@@ -1640,7 +1644,7 @@ import {
|
|
|
1640
1644
|
} catch {
|
|
1641
1645
|
return null;
|
|
1642
1646
|
}
|
|
1643
|
-
},
|
|
1647
|
+
}, zr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1644
1648
|
"",
|
|
1645
1649
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1646
1650
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1650,12 +1654,12 @@ import {
|
|
|
1650
1654
|
" await import('@voltro/devtools/styles.css')",
|
|
1651
1655
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1652
1656
|
"}"
|
|
1653
|
-
],
|
|
1657
|
+
], Br = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Vr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Hr = (e) => e.sentry ? [
|
|
1654
1658
|
"",
|
|
1655
1659
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1656
1660
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1657
1661
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1658
|
-
] : [],
|
|
1662
|
+
] : [], Ur = (e) => e.env ? ["import './env.public'"] : [], Wr = (e) => {
|
|
1659
1663
|
let t = [], n = m(e);
|
|
1660
1664
|
for (;;) {
|
|
1661
1665
|
O(f(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1664,14 +1668,14 @@ import {
|
|
|
1664
1668
|
n = e;
|
|
1665
1669
|
}
|
|
1666
1670
|
return t;
|
|
1667
|
-
},
|
|
1671
|
+
}, Gr = yn, Kr = (e) => {
|
|
1668
1672
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1669
1673
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1670
1674
|
if (t) return `island-${t[1]}`;
|
|
1671
|
-
},
|
|
1672
|
-
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !
|
|
1675
|
+
}, qr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Jr = (e) => e.startsWith("(") && e.endsWith(")"), Yr = (e) => e.filter((e) => !Jr(e)), Xr = (e) => {
|
|
1676
|
+
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !Jr(e));
|
|
1673
1677
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
1674
|
-
},
|
|
1678
|
+
}, Zr = (e) => `${e.replace(t, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Z = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, Q = async (n) => {
|
|
1675
1679
|
let r = [], i = [], a = async (n, o) => {
|
|
1676
1680
|
let s = [];
|
|
1677
1681
|
try {
|
|
@@ -1679,17 +1683,17 @@ import {
|
|
|
1679
1683
|
} catch {
|
|
1680
1684
|
return;
|
|
1681
1685
|
}
|
|
1682
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1686
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Gr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
1683
1687
|
if (l.some((t) => e.has(t))) {
|
|
1684
1688
|
let t = u.has("layout.tsx"), r = !1;
|
|
1685
1689
|
if (t) try {
|
|
1686
1690
|
let e = await j.readFile(f(n, "layout.tsx"), "utf8");
|
|
1687
|
-
r =
|
|
1691
|
+
r = qr.test(e);
|
|
1688
1692
|
} catch {}
|
|
1689
1693
|
i.push({
|
|
1690
1694
|
dir: d,
|
|
1691
1695
|
chain: o,
|
|
1692
|
-
contributesToUrl: o.length === 0 || !
|
|
1696
|
+
contributesToUrl: o.length === 0 || !Jr(o[o.length - 1]),
|
|
1693
1697
|
hasLayout: t,
|
|
1694
1698
|
hasLayoutLoader: r,
|
|
1695
1699
|
hasError: u.has("error.tsx"),
|
|
@@ -1703,8 +1707,8 @@ import {
|
|
|
1703
1707
|
let n = d ? `${d}/${e}` : e;
|
|
1704
1708
|
r.push({
|
|
1705
1709
|
file: n,
|
|
1706
|
-
pattern:
|
|
1707
|
-
ident:
|
|
1710
|
+
pattern: Xr(n),
|
|
1711
|
+
ident: Zr(n),
|
|
1708
1712
|
dirChain: o
|
|
1709
1713
|
});
|
|
1710
1714
|
}
|
|
@@ -1723,14 +1727,14 @@ import {
|
|
|
1723
1727
|
dirs: s,
|
|
1724
1728
|
orphanedSpecials: c
|
|
1725
1729
|
};
|
|
1726
|
-
},
|
|
1730
|
+
}, Qr = (e, t) => {
|
|
1727
1731
|
let n = [];
|
|
1728
1732
|
for (let r = 0; r <= t.length; r++) {
|
|
1729
1733
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1730
1734
|
a && n.push(a);
|
|
1731
1735
|
}
|
|
1732
1736
|
return n;
|
|
1733
|
-
},
|
|
1737
|
+
}, $r = async (e) => {
|
|
1734
1738
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1735
1739
|
return {
|
|
1736
1740
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1752,10 +1756,10 @@ import {
|
|
|
1752
1756
|
})),
|
|
1753
1757
|
segmentLoaderData: o
|
|
1754
1758
|
};
|
|
1755
|
-
},
|
|
1756
|
-
let t =
|
|
1759
|
+
}, ei = (e) => {
|
|
1760
|
+
let t = Yr(e);
|
|
1757
1761
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1758
|
-
},
|
|
1762
|
+
}, ti = [
|
|
1759
1763
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1760
1764
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1761
1765
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1848,7 +1852,7 @@ import {
|
|
|
1848
1852
|
" _vdtErrorStart('Build error')",
|
|
1849
1853
|
" })",
|
|
1850
1854
|
"}"
|
|
1851
|
-
].join("\n"),
|
|
1855
|
+
].join("\n"), ni = (e) => {
|
|
1852
1856
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1853
1857
|
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, "\\$&"));
|
|
1854
1858
|
let a = i.join("/");
|
|
@@ -1857,8 +1861,8 @@ import {
|
|
|
1857
1861
|
paramNames: t,
|
|
1858
1862
|
priority: n
|
|
1859
1863
|
};
|
|
1860
|
-
},
|
|
1861
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1864
|
+
}, ri = (e) => e.map((e) => {
|
|
1865
|
+
let { regex: t, paramNames: n, priority: r } = ni(e.pattern);
|
|
1862
1866
|
return {
|
|
1863
1867
|
pattern: e.pattern,
|
|
1864
1868
|
file: e.file,
|
|
@@ -1867,7 +1871,7 @@ import {
|
|
|
1867
1871
|
paramNames: n,
|
|
1868
1872
|
priority: r
|
|
1869
1873
|
};
|
|
1870
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1874
|
+
}).slice().sort((e, t) => e.priority - t.priority), ii = (e, t) => {
|
|
1871
1875
|
for (let n of t) {
|
|
1872
1876
|
let t = n.regex.exec(e);
|
|
1873
1877
|
if (!t) continue;
|
|
@@ -1879,7 +1883,7 @@ import {
|
|
|
1879
1883
|
};
|
|
1880
1884
|
}
|
|
1881
1885
|
return null;
|
|
1882
|
-
},
|
|
1886
|
+
}, ai = async (e, t) => {
|
|
1883
1887
|
let n = e;
|
|
1884
1888
|
for (;;) {
|
|
1885
1889
|
let e = f(n, "node_modules", t);
|
|
@@ -1893,7 +1897,7 @@ import {
|
|
|
1893
1897
|
if (r === n) return null;
|
|
1894
1898
|
n = r;
|
|
1895
1899
|
}
|
|
1896
|
-
},
|
|
1900
|
+
}, oi = async (e) => {
|
|
1897
1901
|
try {
|
|
1898
1902
|
let t = await import(g(f(e, "app.config.ts")).href), n = t.default?.port, r = typeof n == "number" ? n : 4e3, i = t.default?.transport?.wsPath, a = typeof i == "string" && i.startsWith("/") ? i : void 0;
|
|
1899
1903
|
return a ? {
|
|
@@ -1902,7 +1906,7 @@ import {
|
|
|
1902
1906
|
} : { port: r };
|
|
1903
1907
|
} catch {}
|
|
1904
1908
|
return { port: 4e3 };
|
|
1905
|
-
},
|
|
1909
|
+
}, si = (e, t) => ({
|
|
1906
1910
|
name: e,
|
|
1907
1911
|
pkg: t.package,
|
|
1908
1912
|
browserWsUrl: t.url,
|
|
@@ -1910,7 +1914,7 @@ import {
|
|
|
1910
1914
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1911
1915
|
...t.headers ? { headers: t.headers } : {},
|
|
1912
1916
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1913
|
-
}),
|
|
1917
|
+
}), ci = (e, t, n) => {
|
|
1914
1918
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1915
1919
|
return {
|
|
1916
1920
|
name: e,
|
|
@@ -1922,7 +1926,7 @@ import {
|
|
|
1922
1926
|
...t.headers ? { headers: t.headers } : {},
|
|
1923
1927
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1924
1928
|
};
|
|
1925
|
-
},
|
|
1929
|
+
}, li = (e) => {
|
|
1926
1930
|
let t = /* @__PURE__ */ new Map();
|
|
1927
1931
|
for (let n of e) {
|
|
1928
1932
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1930,43 +1934,43 @@ import {
|
|
|
1930
1934
|
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>.`);
|
|
1931
1935
|
t.set(n.browserWsUrl, n.name);
|
|
1932
1936
|
}
|
|
1933
|
-
},
|
|
1937
|
+
}, ui = async (e, t) => {
|
|
1934
1938
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1935
1939
|
for (let [t, i] of n) {
|
|
1936
1940
|
if (i.url) {
|
|
1937
|
-
r.push(
|
|
1941
|
+
r.push(si(t, i));
|
|
1938
1942
|
continue;
|
|
1939
1943
|
}
|
|
1940
|
-
let n = await
|
|
1944
|
+
let n = await ai(e, i.package);
|
|
1941
1945
|
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.`);
|
|
1942
|
-
r.push(
|
|
1946
|
+
r.push(ci(t, i, await oi(n)));
|
|
1943
1947
|
}
|
|
1944
|
-
return
|
|
1945
|
-
},
|
|
1948
|
+
return li(r), r;
|
|
1949
|
+
}, di = (e) => {
|
|
1946
1950
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1947
1951
|
let t = new URL(e);
|
|
1948
1952
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1949
1953
|
} catch {
|
|
1950
1954
|
return;
|
|
1951
1955
|
}
|
|
1952
|
-
},
|
|
1956
|
+
}, fi = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, pi = (e) => process.env[fi(e)] ?? process.env.VOLTRO_API_ORIGIN, mi = (e, t) => {
|
|
1953
1957
|
if (!e) return;
|
|
1954
|
-
let n =
|
|
1958
|
+
let n = pi(e.name) ?? e.serverOrigin;
|
|
1955
1959
|
if (n) {
|
|
1956
|
-
let e =
|
|
1960
|
+
let e = di(n);
|
|
1957
1961
|
if (e) return e;
|
|
1958
1962
|
}
|
|
1959
1963
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1960
|
-
let t =
|
|
1964
|
+
let t = di(e.proxyTarget);
|
|
1961
1965
|
if (t) return t;
|
|
1962
1966
|
}
|
|
1963
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1964
|
-
},
|
|
1967
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return di(e.browserWsUrl);
|
|
1968
|
+
}, hi = (e, t, n) => {
|
|
1965
1969
|
if (!e) {
|
|
1966
1970
|
if (n?.apiName === void 0) return;
|
|
1967
1971
|
let e = n.apiName;
|
|
1968
1972
|
return async () => {
|
|
1969
|
-
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 ${
|
|
1973
|
+
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 ${fi(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.`);
|
|
1970
1974
|
};
|
|
1971
1975
|
}
|
|
1972
1976
|
return async (r, i) => {
|
|
@@ -1988,7 +1992,7 @@ import {
|
|
|
1988
1992
|
});
|
|
1989
1993
|
} catch (t) {
|
|
1990
1994
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
1991
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
1995
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${fi(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 });
|
|
1992
1996
|
}
|
|
1993
1997
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
1994
1998
|
let s = await o.json();
|
|
@@ -2006,8 +2010,8 @@ import {
|
|
|
2006
2010
|
}
|
|
2007
2011
|
if (u) return l;
|
|
2008
2012
|
};
|
|
2009
|
-
},
|
|
2010
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await
|
|
2013
|
+
}, $ = async (e, t, n, r = {}) => {
|
|
2014
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await Rr() !== null, s = t.theme === "system" ? [
|
|
2011
2015
|
" <script>",
|
|
2012
2016
|
" (function () {",
|
|
2013
2017
|
" var root = document.documentElement",
|
|
@@ -2045,9 +2049,9 @@ import {
|
|
|
2045
2049
|
" </body>",
|
|
2046
2050
|
"</html>",
|
|
2047
2051
|
""
|
|
2048
|
-
].join("\n"), l = f(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: p } = await
|
|
2049
|
-
await
|
|
2050
|
-
for (let e of p)
|
|
2052
|
+
].join("\n"), l = f(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: p } = await Q(l);
|
|
2053
|
+
await Bn(l, u);
|
|
2054
|
+
for (let e of p) X.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.`);
|
|
2051
2055
|
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'`);
|
|
2052
2056
|
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"));
|
|
2053
2057
|
let _ = n.map((e) => {
|
|
@@ -2058,16 +2062,16 @@ import {
|
|
|
2058
2062
|
let e = u.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), n = [];
|
|
2059
2063
|
for (let e of d) {
|
|
2060
2064
|
let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
|
|
2061
|
-
e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${
|
|
2065
|
+
e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${Z(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && n.push(`import ${Z(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && n.push(`import ${Z(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && n.push(`import ${Z(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && n.push(`import ${Z(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2062
2066
|
}
|
|
2063
2067
|
let r = u.map((e) => {
|
|
2064
|
-
let t =
|
|
2068
|
+
let t = Qr(d, e.dirChain).map((e) => {
|
|
2065
2069
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2066
2070
|
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(", ")} }`;
|
|
2067
2071
|
}).join(",\n");
|
|
2068
2072
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2069
2073
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2070
|
-
let t =
|
|
2074
|
+
let t = ei(e.chain), n = Qr(d, e.chain).map((e) => {
|
|
2071
2075
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2072
2076
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2073
2077
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2075,23 +2079,23 @@ import {
|
|
|
2075
2079
|
}), a = [], s = [], c = [], l = [], f = [], p = [];
|
|
2076
2080
|
for (let e of d) {
|
|
2077
2081
|
let t = e.dir === "" ? "../src/pages/layout.tsx" : `../src/pages/${e.dir}/layout.tsx`, n = e.dir === "" ? "../src/pages/error.tsx" : `../src/pages/${e.dir}/error.tsx`, r = e.dir === "" ? "../src/pages/loading.tsx" : `../src/pages/${e.dir}/loading.tsx`, i = e.dir === "" ? "../src/pages/not-found.tsx" : `../src/pages/${e.dir}/not-found.tsx`, o = JSON.stringify(e.dir);
|
|
2078
|
-
e.hasLayout && e.hasLayoutLoader ? (s.push(` ${o}: ${
|
|
2082
|
+
e.hasLayout && e.hasLayoutLoader ? (s.push(` ${o}: ${Z(e.dir, "Layout")}Mod.default,`), c.push(` ${o}: ${Z(e.dir, "Layout")}Mod.loader,`), a.push({
|
|
2079
2083
|
relPath: t,
|
|
2080
2084
|
kind: "layout",
|
|
2081
2085
|
slotKey: e.dir
|
|
2082
|
-
})) : e.hasLayout && (s.push(` ${o}: ${
|
|
2086
|
+
})) : e.hasLayout && (s.push(` ${o}: ${Z(e.dir, "Layout")},`), a.push({
|
|
2083
2087
|
relPath: t,
|
|
2084
2088
|
kind: "layout",
|
|
2085
2089
|
slotKey: e.dir
|
|
2086
|
-
})), e.hasError && (l.push(` ${o}: ${
|
|
2090
|
+
})), e.hasError && (l.push(` ${o}: ${Z(e.dir, "Error")},`), a.push({
|
|
2087
2091
|
relPath: n,
|
|
2088
2092
|
kind: "error",
|
|
2089
2093
|
slotKey: e.dir
|
|
2090
|
-
})), e.hasPending && (f.push(` ${o}: ${
|
|
2094
|
+
})), e.hasPending && (f.push(` ${o}: ${Z(e.dir, "Pending")},`), a.push({
|
|
2091
2095
|
relPath: r,
|
|
2092
2096
|
kind: "pending",
|
|
2093
2097
|
slotKey: e.dir
|
|
2094
|
-
})), e.hasNotFound && (p.push(` ${o}: ${
|
|
2098
|
+
})), e.hasNotFound && (p.push(` ${o}: ${Z(e.dir, "NotFound")},`), a.push({
|
|
2095
2099
|
relPath: i,
|
|
2096
2100
|
kind: "notFound",
|
|
2097
2101
|
slotKey: e.dir
|
|
@@ -2306,14 +2310,14 @@ import {
|
|
|
2306
2310
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2307
2311
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2308
2312
|
"",
|
|
2309
|
-
...
|
|
2313
|
+
...Ur(t),
|
|
2310
2314
|
"import { mount } from '@voltro/web'",
|
|
2311
2315
|
...g,
|
|
2312
2316
|
"import { App } from './app'",
|
|
2313
2317
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2314
|
-
...
|
|
2315
|
-
...
|
|
2316
|
-
...
|
|
2318
|
+
...Vr(t),
|
|
2319
|
+
...zr(t, o),
|
|
2320
|
+
...Hr(t),
|
|
2317
2321
|
"",
|
|
2318
2322
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2319
2323
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2330,10 +2334,10 @@ import {
|
|
|
2330
2334
|
" apis: {",
|
|
2331
2335
|
..._,
|
|
2332
2336
|
" },",
|
|
2333
|
-
...
|
|
2337
|
+
...Br(t, o),
|
|
2334
2338
|
"})",
|
|
2335
2339
|
"",
|
|
2336
|
-
|
|
2340
|
+
ti
|
|
2337
2341
|
].join("\n");
|
|
2338
2342
|
} else v = "", y = "", b = [
|
|
2339
2343
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2341,25 +2345,25 @@ import {
|
|
|
2341
2345
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2342
2346
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2343
2347
|
"",
|
|
2344
|
-
...
|
|
2348
|
+
...Ur(t),
|
|
2345
2349
|
"import { mount } from '@voltro/web'",
|
|
2346
2350
|
...g,
|
|
2347
2351
|
"import App from '../src/App'",
|
|
2348
|
-
...
|
|
2349
|
-
...
|
|
2350
|
-
...
|
|
2352
|
+
...Vr(t),
|
|
2353
|
+
...zr(t, o),
|
|
2354
|
+
...Hr(t),
|
|
2351
2355
|
"",
|
|
2352
2356
|
"mount(App, {",
|
|
2353
2357
|
" apis: {",
|
|
2354
2358
|
..._,
|
|
2355
2359
|
" },",
|
|
2356
|
-
...
|
|
2360
|
+
...Br(t, o),
|
|
2357
2361
|
"})",
|
|
2358
2362
|
"",
|
|
2359
|
-
|
|
2363
|
+
ti
|
|
2360
2364
|
].join("\n");
|
|
2361
2365
|
let x = f(e, ".framework");
|
|
2362
|
-
await j.mkdir(x, { recursive: !0 }), t.env ? await
|
|
2366
|
+
await j.mkdir(x, { recursive: !0 }), t.env ? await tt(x, r) : await j.rm(f(x, "env.public.ts"), { force: !0 }), await j.writeFile(f(x, "index.html"), c, "utf8"), await j.writeFile(f(x, "main.tsx"), b, "utf8"), v ? (await j.writeFile(f(x, "app.tsx"), v, "utf8"), await j.writeFile(f(x, "routeTable.ts"), y, "utf8")) : (await j.rm(f(x, "app.tsx"), { force: !0 }), await j.rm(f(x, "routeTable.ts"), { force: !0 }));
|
|
2363
2367
|
let S = f(e, ".gitignore"), C = "";
|
|
2364
2368
|
try {
|
|
2365
2369
|
C = await j.readFile(S, "utf8");
|
|
@@ -2370,65 +2374,65 @@ import {
|
|
|
2370
2374
|
try {
|
|
2371
2375
|
await j.appendFile(S, `${e}${E.join("\n")}\n`, "utf8");
|
|
2372
2376
|
} catch (e) {
|
|
2373
|
-
|
|
2377
|
+
X.warn(`could not add ${E.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2374
2378
|
}
|
|
2375
2379
|
}
|
|
2376
|
-
},
|
|
2380
|
+
}, gi = async (e, t) => {
|
|
2377
2381
|
try {
|
|
2378
2382
|
let n = f(u(e), "project.json");
|
|
2379
2383
|
if (!O(n)) return;
|
|
2380
2384
|
let r = await j.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
|
|
2381
2385
|
for (let [e, n] of Object.entries(i)) e !== a && n.port === t && o.push(e);
|
|
2382
2386
|
if (o.length === 0) return;
|
|
2383
|
-
|
|
2387
|
+
X.warn("sibling app(s) claim the same port — only one boots", {
|
|
2384
2388
|
port: t,
|
|
2385
2389
|
conflicts: o,
|
|
2386
2390
|
projectJson: n
|
|
2387
2391
|
});
|
|
2388
2392
|
} catch {}
|
|
2389
|
-
},
|
|
2390
|
-
let t =
|
|
2393
|
+
}, _i = (e) => f(e, ".framework", "dist", "server", "appConfig.js"), vi = async (e) => {
|
|
2394
|
+
let t = _i(e), n = O(t) ? t : f(e, "app.config.ts");
|
|
2391
2395
|
try {
|
|
2392
2396
|
let e = (await import(g(n).href)).default;
|
|
2393
2397
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2394
2398
|
} catch {
|
|
2395
2399
|
return null;
|
|
2396
2400
|
}
|
|
2397
|
-
},
|
|
2398
|
-
let t = await
|
|
2401
|
+
}, yi = async (e) => {
|
|
2402
|
+
let t = await vi(e);
|
|
2399
2403
|
if (!t) return {
|
|
2400
2404
|
ran: !1,
|
|
2401
2405
|
exitCode: 0
|
|
2402
2406
|
};
|
|
2403
|
-
|
|
2404
|
-
let n =
|
|
2405
|
-
|
|
2406
|
-
let u = await
|
|
2407
|
-
for (let e of u)
|
|
2407
|
+
gn();
|
|
2408
|
+
let n = Rt();
|
|
2409
|
+
Jt(n), X.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2410
|
+
let u = await ui(e, t);
|
|
2411
|
+
for (let e of u) X.info("api wired", {
|
|
2408
2412
|
name: e.name,
|
|
2409
2413
|
pkg: e.pkg,
|
|
2410
2414
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
2411
2415
|
});
|
|
2412
|
-
|
|
2416
|
+
We(e).then((e) => {
|
|
2413
2417
|
for (let t of e.files) if (t.action === "created") {
|
|
2414
2418
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2415
|
-
|
|
2419
|
+
X.info(`${e} seeded`, { path: t.path });
|
|
2416
2420
|
}
|
|
2417
2421
|
}).catch(() => {});
|
|
2418
|
-
let { resolved: d } = await
|
|
2422
|
+
let { resolved: d } = await nt({
|
|
2419
2423
|
rawEnv: t.env,
|
|
2420
2424
|
appType: "web",
|
|
2421
2425
|
root: e,
|
|
2422
|
-
log:
|
|
2426
|
+
log: X,
|
|
2423
2427
|
generateTypes: !0
|
|
2424
2428
|
}), h = d.publicValues;
|
|
2425
|
-
await
|
|
2429
|
+
await $(e, t, u, h), X.debug("generated framework entry files", { files: [
|
|
2426
2430
|
"index.html",
|
|
2427
2431
|
".framework/main.tsx",
|
|
2428
2432
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2429
2433
|
] });
|
|
2430
|
-
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 =
|
|
2431
|
-
await
|
|
2434
|
+
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 = $n("web", _, g), y = or(_);
|
|
2435
|
+
await Zn({
|
|
2432
2436
|
id: v,
|
|
2433
2437
|
name: _,
|
|
2434
2438
|
kind: "web",
|
|
@@ -2436,19 +2440,19 @@ import {
|
|
|
2436
2440
|
pid: process.pid,
|
|
2437
2441
|
status: "booting",
|
|
2438
2442
|
logFile: y.path
|
|
2439
|
-
}).catch(() => {}), await
|
|
2440
|
-
let { pages: b, dirs: x } = await
|
|
2443
|
+
}).catch(() => {}), await gi(e, g);
|
|
2444
|
+
let { pages: b, dirs: x } = await Q(f(e, "src", "pages")), S = x.map((e) => ({
|
|
2441
2445
|
dir: e.dir,
|
|
2442
2446
|
hasLayout: e.hasLayout,
|
|
2443
2447
|
hasError: e.hasError,
|
|
2444
2448
|
hasPending: e.hasPending,
|
|
2445
2449
|
hasNotFound: e.hasNotFound
|
|
2446
|
-
})), C = await
|
|
2450
|
+
})), C = await It({
|
|
2447
2451
|
appRoot: e,
|
|
2448
2452
|
pages: b
|
|
2449
2453
|
});
|
|
2450
|
-
C.wrote &&
|
|
2451
|
-
let w = await
|
|
2454
|
+
C.wrote && X.debug("routes codegen wrote", { path: p(e, C.path) });
|
|
2455
|
+
let w = await Ye("vite", () => import("vite")), T = (await import("@vitejs/plugin-react")).default, D = (await import("@tailwindcss/vite")).default, k = f(e, ".framework"), A = f(e, "src"), M = /* @__PURE__ */ new Set([
|
|
2452
2456
|
".framework",
|
|
2453
2457
|
"node_modules",
|
|
2454
2458
|
"dist",
|
|
@@ -2472,7 +2476,7 @@ import {
|
|
|
2472
2476
|
...r.devDependencies
|
|
2473
2477
|
});
|
|
2474
2478
|
await Promise.all(i.map(async (n) => {
|
|
2475
|
-
let r = await
|
|
2479
|
+
let r = await ai(e, n);
|
|
2476
2480
|
if (!r) return;
|
|
2477
2481
|
let i = f(r, "src");
|
|
2478
2482
|
try {
|
|
@@ -2484,17 +2488,17 @@ import {
|
|
|
2484
2488
|
}, P = f(e, "src", "pages"), ee = (e) => e.endsWith(".tsx") && (e === P || e.startsWith(P + "/")), F = (e) => e === P || e.startsWith(P + "/"), te = async (n) => {
|
|
2485
2489
|
try {
|
|
2486
2490
|
let r = Date.now();
|
|
2487
|
-
await
|
|
2488
|
-
let { pages: i } = await
|
|
2489
|
-
await
|
|
2491
|
+
await $(e, t, u, h);
|
|
2492
|
+
let { pages: i } = await Q(P);
|
|
2493
|
+
await It({
|
|
2490
2494
|
appRoot: e,
|
|
2491
2495
|
pages: i
|
|
2492
|
-
}),
|
|
2496
|
+
}), X.info("page tree regenerated", {
|
|
2493
2497
|
reason: n,
|
|
2494
2498
|
ms: Date.now() - r
|
|
2495
2499
|
});
|
|
2496
2500
|
} catch (e) {
|
|
2497
|
-
|
|
2501
|
+
X.error("page tree regen failed", { reason: n }, e);
|
|
2498
2502
|
}
|
|
2499
2503
|
}, I = {
|
|
2500
2504
|
name: "framework:regenerate-on-page-tree-change",
|
|
@@ -2526,7 +2530,7 @@ import {
|
|
|
2526
2530
|
}, re = t, ie = m(L), ae = {
|
|
2527
2531
|
name: "framework:watch-app-config",
|
|
2528
2532
|
async configureServer(t) {
|
|
2529
|
-
t.watcher.add(L),
|
|
2533
|
+
t.watcher.add(L), X.info("watching app.config.ts for changes", { path: p(e, L) });
|
|
2530
2534
|
let n = async () => {
|
|
2531
2535
|
try {
|
|
2532
2536
|
try {
|
|
@@ -2534,9 +2538,9 @@ import {
|
|
|
2534
2538
|
e && t.moduleGraph.invalidateModule(e);
|
|
2535
2539
|
} catch {}
|
|
2536
2540
|
let e = (await t.ssrLoadModule(L, { fixStacktrace: !0 })).default;
|
|
2537
|
-
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (
|
|
2541
|
+
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (X.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
|
|
2538
2542
|
} catch (e) {
|
|
2539
|
-
return
|
|
2543
|
+
return X.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
2540
2544
|
}
|
|
2541
2545
|
}, r = null, i = () => {
|
|
2542
2546
|
r && clearTimeout(r), r = setTimeout(() => {
|
|
@@ -2545,24 +2549,24 @@ import {
|
|
|
2545
2549
|
}, a = async () => {
|
|
2546
2550
|
let r = await n();
|
|
2547
2551
|
if (!r) {
|
|
2548
|
-
|
|
2552
|
+
X.info("app.config.ts onConfigChange: load returned null — skipping");
|
|
2549
2553
|
return;
|
|
2550
2554
|
}
|
|
2551
|
-
if (
|
|
2555
|
+
if (X.info("app.config.ts onConfigChange: loaded", {
|
|
2552
2556
|
theme: r.theme,
|
|
2553
2557
|
port: r.port,
|
|
2554
2558
|
name: r.name
|
|
2555
2559
|
}), JSON.stringify(r) === JSON.stringify(re)) {
|
|
2556
|
-
|
|
2560
|
+
X.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2557
2561
|
return;
|
|
2558
2562
|
}
|
|
2559
2563
|
let i = ne(re, r);
|
|
2560
2564
|
if (i.length > 0) {
|
|
2561
|
-
|
|
2565
|
+
X.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
2562
2566
|
try {
|
|
2563
2567
|
await t.close();
|
|
2564
2568
|
} catch {}
|
|
2565
|
-
let e =
|
|
2569
|
+
let e = ve(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
2566
2570
|
stdio: "inherit",
|
|
2567
2571
|
env: process.env,
|
|
2568
2572
|
cwd: process.cwd()
|
|
@@ -2572,37 +2576,37 @@ import {
|
|
|
2572
2576
|
process.on("SIGINT", r), process.on("SIGTERM", a), e.on("exit", (e, t) => {
|
|
2573
2577
|
process.off("SIGINT", r), process.off("SIGTERM", a), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
|
|
2574
2578
|
}), e.on("error", (e) => {
|
|
2575
|
-
|
|
2579
|
+
X.error("restart spawn failed", {}, e), process.exit(1);
|
|
2576
2580
|
});
|
|
2577
2581
|
return;
|
|
2578
2582
|
}
|
|
2579
2583
|
try {
|
|
2580
2584
|
let n = Date.now();
|
|
2581
|
-
await
|
|
2585
|
+
await $(e, r, await ui(e, r)), re = r, t.ws && t.ws.send({
|
|
2582
2586
|
type: "full-reload",
|
|
2583
2587
|
path: "*"
|
|
2584
|
-
}),
|
|
2588
|
+
}), X.info("app.config.ts soft-regen", {
|
|
2585
2589
|
ms: Date.now() - n,
|
|
2586
2590
|
reload: "full"
|
|
2587
2591
|
});
|
|
2588
2592
|
} catch (e) {
|
|
2589
|
-
|
|
2593
|
+
X.error("app.config.ts soft-regen failed", {}, e);
|
|
2590
2594
|
}
|
|
2591
2595
|
}, o = (e) => l(e) === "app.config.ts" ? e === L || m(e) === ie : !1;
|
|
2592
2596
|
t.watcher.on("change", (e) => {
|
|
2593
|
-
o(e) && (
|
|
2597
|
+
o(e) && (X.info("app.config.ts change event (chokidar)", { file: e }), i());
|
|
2594
2598
|
}), t.watcher.on("add", (e) => {
|
|
2595
|
-
o(e) && (
|
|
2599
|
+
o(e) && (X.info("app.config.ts add event (chokidar)", { file: e }), i());
|
|
2596
2600
|
});
|
|
2597
2601
|
try {
|
|
2598
2602
|
let { watchFile: e } = await import("node:fs");
|
|
2599
2603
|
e(L, { interval: 500 }, (e, t) => {
|
|
2600
|
-
e.mtimeMs !== t.mtimeMs && (
|
|
2601
|
-
}),
|
|
2604
|
+
e.mtimeMs !== t.mtimeMs && (X.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), i());
|
|
2605
|
+
}), X.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
2602
2606
|
} catch (e) {
|
|
2603
|
-
|
|
2607
|
+
X.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
2604
2608
|
}
|
|
2605
|
-
ft
|
|
2609
|
+
ht(ft, X, {
|
|
2606
2610
|
root: e,
|
|
2607
2611
|
onBeforeRestart: () => t.close()
|
|
2608
2612
|
});
|
|
@@ -2618,7 +2622,7 @@ import {
|
|
|
2618
2622
|
let n = /* @__PURE__ */ new Map();
|
|
2619
2623
|
for (let r of u) {
|
|
2620
2624
|
if (!r.proxyTarget) continue;
|
|
2621
|
-
let i = await
|
|
2625
|
+
let i = await ai(e, r.pkg);
|
|
2622
2626
|
if (!i) continue;
|
|
2623
2627
|
let a = f(i, "rpcGroup.generated.ts");
|
|
2624
2628
|
try {
|
|
@@ -2644,14 +2648,14 @@ import {
|
|
|
2644
2648
|
i !== t && (n.set(e, i), r = e);
|
|
2645
2649
|
}
|
|
2646
2650
|
if (r !== null) {
|
|
2647
|
-
i = !0,
|
|
2651
|
+
i = !0, X.info(`rpcGroup changed (${p(e, r)}) — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)`);
|
|
2648
2652
|
try {
|
|
2649
2653
|
await j.rm(f(k, ".vite", "deps"), {
|
|
2650
2654
|
recursive: !0,
|
|
2651
2655
|
force: !0
|
|
2652
2656
|
}), await t.restart(!0);
|
|
2653
2657
|
} catch (e) {
|
|
2654
|
-
i = !1,
|
|
2658
|
+
i = !1, X.error("rpcGroup re-optimize failed", {}, e);
|
|
2655
2659
|
}
|
|
2656
2660
|
}
|
|
2657
2661
|
}, o = (e) => {
|
|
@@ -2661,7 +2665,15 @@ import {
|
|
|
2661
2665
|
};
|
|
2662
2666
|
t.watcher.on("change", o), t.watcher.on("add", o);
|
|
2663
2667
|
}
|
|
2664
|
-
}, z = {}
|
|
2668
|
+
}, z = {}, ue = (e) => (t) => {
|
|
2669
|
+
t.on("proxyReq", (t, n) => {
|
|
2670
|
+
mn(t, n, {
|
|
2671
|
+
target: e,
|
|
2672
|
+
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
2673
|
+
isLoopback: r
|
|
2674
|
+
});
|
|
2675
|
+
});
|
|
2676
|
+
};
|
|
2665
2677
|
for (let e of u) {
|
|
2666
2678
|
if (!e.proxyTarget) continue;
|
|
2667
2679
|
z[e.browserWsUrl] = {
|
|
@@ -2674,25 +2686,26 @@ import {
|
|
|
2674
2686
|
z[`/_voltro/api/${e.name}`] = {
|
|
2675
2687
|
target: t,
|
|
2676
2688
|
changeOrigin: !0,
|
|
2677
|
-
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), "")
|
|
2689
|
+
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
2690
|
+
configure: ue(t)
|
|
2678
2691
|
};
|
|
2679
2692
|
}
|
|
2680
2693
|
for (let [e, n] of Object.entries(t.proxies ?? {})) {
|
|
2681
2694
|
if (z[e]) {
|
|
2682
|
-
|
|
2695
|
+
X.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
2683
2696
|
continue;
|
|
2684
2697
|
}
|
|
2685
2698
|
z[e] = {
|
|
2686
2699
|
target: n.target,
|
|
2687
2700
|
changeOrigin: n.changeOrigin ?? !0,
|
|
2688
2701
|
...n.rewrite === void 0 ? {} : { rewrite: (t) => t.replace(RegExp(`^${e}`), n.rewrite) }
|
|
2689
|
-
},
|
|
2702
|
+
}, X.info(`proxy ${e} → ${n.target}`, {
|
|
2690
2703
|
prefix: e,
|
|
2691
2704
|
target: n.target,
|
|
2692
2705
|
...n.rewrite === void 0 ? {} : { rewrite: n.rewrite }
|
|
2693
2706
|
});
|
|
2694
2707
|
}
|
|
2695
|
-
let
|
|
2708
|
+
let de = {
|
|
2696
2709
|
name: "framework:inspect",
|
|
2697
2710
|
configureServer(l) {
|
|
2698
2711
|
let u = null, d = async () => {
|
|
@@ -2704,18 +2717,18 @@ import {
|
|
|
2704
2717
|
pattern: n.pattern,
|
|
2705
2718
|
file: n.file,
|
|
2706
2719
|
dirChain: n.dirChain,
|
|
2707
|
-
renderMode:
|
|
2720
|
+
renderMode: Fn(r, f("src", "pages", n.file)),
|
|
2708
2721
|
interactive: r.interactive ?? "full",
|
|
2709
2722
|
tenantAware: r.tenantAware === !0,
|
|
2710
|
-
revalidateMs:
|
|
2711
|
-
staleWhileRevalidateMs:
|
|
2723
|
+
revalidateMs: G(r.revalidate),
|
|
2724
|
+
staleWhileRevalidateMs: G(r.staleWhileRevalidate) ?? 0,
|
|
2712
2725
|
cacheInvalidatesOn: Array.isArray(r.cacheInvalidatesOn) ? r.cacheInvalidatesOn : [],
|
|
2713
2726
|
hasLoader: typeof r.loader == "function",
|
|
2714
2727
|
hasMeta: r.meta != null,
|
|
2715
2728
|
hasGetStaticPaths: typeof r.getStaticPaths == "function"
|
|
2716
2729
|
});
|
|
2717
2730
|
} catch (e) {
|
|
2718
|
-
|
|
2731
|
+
X.warn("inspect: failed to load page metadata", { pattern: n.pattern }, e);
|
|
2719
2732
|
}
|
|
2720
2733
|
return u = t, t;
|
|
2721
2734
|
};
|
|
@@ -2823,7 +2836,7 @@ import {
|
|
|
2823
2836
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (u[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
2824
2837
|
let f = l.split("?")[0];
|
|
2825
2838
|
if (e.method === "GET" && (f === "/_voltro/inspect/logs" || l.startsWith("/_voltro/inspect/logs?"))) {
|
|
2826
|
-
let e = c(u.origin), t =
|
|
2839
|
+
let e = c(u.origin), t = cn(l, Kt(), u);
|
|
2827
2840
|
r.statusCode = t.status, r.setHeader("content-type", t.contentType);
|
|
2828
2841
|
for (let [t, n] of Object.entries(e)) r.setHeader(t, n);
|
|
2829
2842
|
r.end(t.body);
|
|
@@ -2841,7 +2854,7 @@ import {
|
|
|
2841
2854
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
2842
2855
|
a += e;
|
|
2843
2856
|
}), e.on("end", () => {
|
|
2844
|
-
let e =
|
|
2857
|
+
let e = tn(a, n);
|
|
2845
2858
|
r.statusCode = e.status, r.setHeader("content-type", e.contentType);
|
|
2846
2859
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2847
2860
|
r.end(e.body);
|
|
@@ -2872,14 +2885,14 @@ import {
|
|
|
2872
2885
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2873
2886
|
r.flushHeaders?.(), r.write("retry: 5000\n\n");
|
|
2874
2887
|
let s = l.indexOf("?");
|
|
2875
|
-
if (!(s !== -1 && new URLSearchParams(l.slice(s + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(
|
|
2888
|
+
if (!(s !== -1 && new URLSearchParams(l.slice(s + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(zt(e));
|
|
2876
2889
|
let d = n.subscribe((e) => {
|
|
2877
2890
|
try {
|
|
2878
|
-
r.write(
|
|
2891
|
+
r.write(zt(e));
|
|
2879
2892
|
} catch {}
|
|
2880
2893
|
}), f = setInterval(() => {
|
|
2881
2894
|
try {
|
|
2882
|
-
r.write(
|
|
2895
|
+
r.write(Bt());
|
|
2883
2896
|
} catch {}
|
|
2884
2897
|
}, 15e3), p = () => {
|
|
2885
2898
|
clearInterval(f), d();
|
|
@@ -2892,7 +2905,7 @@ import {
|
|
|
2892
2905
|
kind: "web",
|
|
2893
2906
|
meta: {
|
|
2894
2907
|
name: t.name ?? "(unnamed)",
|
|
2895
|
-
voltroVersion:
|
|
2908
|
+
voltroVersion: Lr,
|
|
2896
2909
|
port: g,
|
|
2897
2910
|
mode: "dev",
|
|
2898
2911
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -2910,7 +2923,7 @@ import {
|
|
|
2910
2923
|
size: 0,
|
|
2911
2924
|
entries: []
|
|
2912
2925
|
}),
|
|
2913
|
-
env: () =>
|
|
2926
|
+
env: () => it(t.name ?? "app", { contract: le(t.env) ? t.env : void 0 })
|
|
2914
2927
|
}, u, { method: e.method ?? "GET" });
|
|
2915
2928
|
if (n === null) return a();
|
|
2916
2929
|
r.statusCode = n.status, r.setHeader("content-type", n.contentType);
|
|
@@ -2921,37 +2934,37 @@ import {
|
|
|
2921
2934
|
}
|
|
2922
2935
|
});
|
|
2923
2936
|
}
|
|
2924
|
-
},
|
|
2937
|
+
}, fe = t.name === "voltroDashboard" ? {
|
|
2925
2938
|
name: "framework:dashboard-registry",
|
|
2926
2939
|
configureServer(e) {
|
|
2927
2940
|
e.middlewares.use(async (e, t, n) => {
|
|
2928
2941
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
2929
2942
|
try {
|
|
2930
|
-
let e = await
|
|
2943
|
+
let e = await Xn();
|
|
2931
2944
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
2932
2945
|
} catch (e) {
|
|
2933
2946
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
2934
2947
|
}
|
|
2935
2948
|
});
|
|
2936
2949
|
}
|
|
2937
|
-
} : null,
|
|
2938
|
-
limit:
|
|
2939
|
-
onColdStart: (e) =>
|
|
2940
|
-
onColdEnd: (e) =>
|
|
2950
|
+
} : null, pe = ri(b), me = /* @__PURE__ */ new Set(), he = wt(), ge = Et({
|
|
2951
|
+
limit: he,
|
|
2952
|
+
onColdStart: (e) => X.debug("ssr cold-compile start", { id: e }),
|
|
2953
|
+
onColdEnd: (e) => X.debug("ssr cold-compile end", { id: e })
|
|
2941
2954
|
});
|
|
2942
|
-
|
|
2943
|
-
let
|
|
2955
|
+
X.debug(`ssr cold-compile concurrency ${he}`, { concurrency: he });
|
|
2956
|
+
let ye = null, be = async () => (ye === null && (ye = await j.readFile(f(e, ".framework", "index.html"), "utf8")), ye), xe = {
|
|
2944
2957
|
name: "framework:ssr",
|
|
2945
2958
|
configureServer(t) {
|
|
2946
|
-
let n = (e) =>
|
|
2959
|
+
let n = (e) => ge.load(e, async () => await t.ssrLoadModule(e));
|
|
2947
2960
|
t.middlewares.use(async (r, i, a) => {
|
|
2948
2961
|
if (r.method !== "GET" && r.method !== "HEAD") return a();
|
|
2949
2962
|
let o = r.url ?? "/", s = o.indexOf("?"), c = (s === -1 ? o : o.slice(0, s)) || "/";
|
|
2950
2963
|
if (c.startsWith("/@") || c.startsWith("/node_modules/") || c.startsWith("/.framework/") || c.startsWith("/_voltro/") || c === "/main.tsx" || c === "/index.html" || c === "/sw.js" || c === "/favicon.ico" || c === "/robots.txt" || /\.[a-z0-9]+$/i.test(c)) return a();
|
|
2951
|
-
let l =
|
|
2964
|
+
let l = ii(c, pe);
|
|
2952
2965
|
if (!l) return a();
|
|
2953
|
-
let d = !
|
|
2954
|
-
d &&
|
|
2966
|
+
let d = !me.has(l.route.pattern), p = Date.now();
|
|
2967
|
+
d && X.info(`ssr compiling ${l.route.pattern}`, {
|
|
2955
2968
|
pattern: l.route.pattern,
|
|
2956
2969
|
pathname: c
|
|
2957
2970
|
});
|
|
@@ -2970,15 +2983,15 @@ import {
|
|
|
2970
2983
|
}
|
|
2971
2984
|
};
|
|
2972
2985
|
try {
|
|
2973
|
-
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ =
|
|
2986
|
+
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ = Fn(s, f("src", "pages", l.route.file)), v = Qr(x, l.route.dirChain), y = _ === "spa" && v.some((e) => e.hasLayout);
|
|
2974
2987
|
if (_ !== "ssr" && _ !== "isr" && !y) return a();
|
|
2975
2988
|
let b = {};
|
|
2976
2989
|
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ? b[e] = t : Array.isArray(t) && (b[e] = t.join(", "));
|
|
2977
|
-
let S =
|
|
2990
|
+
let S = hi(mi(u[0], { allowDevProxy: !0 }), b.cookie, { apiName: u[0]?.name }), C = new AbortController(), w = () => C.abort();
|
|
2978
2991
|
i.once("close", w);
|
|
2979
2992
|
let T = null, E = [], D = {};
|
|
2980
2993
|
try {
|
|
2981
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () =>
|
|
2994
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () => $r({
|
|
2982
2995
|
entries: v,
|
|
2983
2996
|
loadLayout: (t) => n(f(e, "src", "pages", t.dir, "layout.tsx")),
|
|
2984
2997
|
loadError: (t) => n(f(e, "src", "pages", t.dir, "error.tsx")),
|
|
@@ -3015,7 +3028,7 @@ import {
|
|
|
3015
3028
|
cookies: O.parseCookieHeader(b.cookie),
|
|
3016
3029
|
headers: b,
|
|
3017
3030
|
url: o
|
|
3018
|
-
}, j = s.interactive ?? "full", M = y ?
|
|
3031
|
+
}, j = s.interactive ?? "full", M = y ? wr({
|
|
3019
3032
|
helpers: O,
|
|
3020
3033
|
page: `src/pages/${l.route.file}`,
|
|
3021
3034
|
interactive: j,
|
|
@@ -3027,7 +3040,7 @@ import {
|
|
|
3027
3040
|
segmentLoaderData: D,
|
|
3028
3041
|
requestContext: A
|
|
3029
3042
|
}
|
|
3030
|
-
}) : null, N = y ? null :
|
|
3043
|
+
}) : null, N = y ? null : Cr({
|
|
3031
3044
|
helpers: O,
|
|
3032
3045
|
page: `src/pages/${l.route.file}`,
|
|
3033
3046
|
pathname: c,
|
|
@@ -3049,18 +3062,18 @@ import {
|
|
|
3049
3062
|
];
|
|
3050
3063
|
for (let e of n) await g(e, t, P);
|
|
3051
3064
|
});
|
|
3052
|
-
let ee = await h("readShell",
|
|
3065
|
+
let ee = await h("readShell", be), F = await h("transformShell", () => t.transformIndexHtml(o, ee)), te = P.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), I = A.cookies["voltro:locale"] ?? "en", L = Date.now();
|
|
3053
3066
|
if (M) {
|
|
3054
|
-
let e = (e) =>
|
|
3067
|
+
let e = (e) => Er({
|
|
3055
3068
|
helpers: O,
|
|
3056
3069
|
prepared: M,
|
|
3057
3070
|
meta: e,
|
|
3058
3071
|
interactive: j,
|
|
3059
3072
|
extra: [te]
|
|
3060
3073
|
});
|
|
3061
|
-
if (M.hasDeferred)
|
|
3074
|
+
if (M.hasDeferred) Fr({
|
|
3062
3075
|
res: i,
|
|
3063
|
-
shell:
|
|
3076
|
+
shell: Nr({
|
|
3064
3077
|
shell: F,
|
|
3065
3078
|
inlineModuleScriptsAsync: !0
|
|
3066
3079
|
}),
|
|
@@ -3075,14 +3088,14 @@ import {
|
|
|
3075
3088
|
...e
|
|
3076
3089
|
}),
|
|
3077
3090
|
onShellError: (e) => {
|
|
3078
|
-
|
|
3091
|
+
X.warn("spa-shell-dev shell render failed; falling back to SPA shell", {
|
|
3079
3092
|
pathname: c,
|
|
3080
3093
|
pattern: l.route.pattern
|
|
3081
3094
|
}, e), a();
|
|
3082
3095
|
}
|
|
3083
3096
|
});
|
|
3084
3097
|
else {
|
|
3085
|
-
let t =
|
|
3098
|
+
let t = Tr({
|
|
3086
3099
|
helpers: O,
|
|
3087
3100
|
prepared: M
|
|
3088
3101
|
}), n = F.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${I}"`);
|
|
@@ -3103,9 +3116,9 @@ import {
|
|
|
3103
3116
|
segmentLoaderData: N.segmentLoaderData,
|
|
3104
3117
|
requestContext: A
|
|
3105
3118
|
};
|
|
3106
|
-
if (_ === "ssr" && j === "full")
|
|
3119
|
+
if (_ === "ssr" && j === "full") Fr({
|
|
3107
3120
|
res: i,
|
|
3108
|
-
shell:
|
|
3121
|
+
shell: Nr({
|
|
3109
3122
|
shell: F,
|
|
3110
3123
|
inlineModuleScriptsAsync: !0
|
|
3111
3124
|
}),
|
|
@@ -3120,7 +3133,7 @@ import {
|
|
|
3120
3133
|
...e
|
|
3121
3134
|
}),
|
|
3122
3135
|
onShellError: (e) => {
|
|
3123
|
-
|
|
3136
|
+
X.warn("ssr-dev shell render failed; falling back to SPA shell", {
|
|
3124
3137
|
pathname: c,
|
|
3125
3138
|
pattern: l.route.pattern
|
|
3126
3139
|
}, e), a();
|
|
@@ -3133,13 +3146,13 @@ import {
|
|
|
3133
3146
|
}
|
|
3134
3147
|
m.render = Date.now() - L;
|
|
3135
3148
|
let R = Date.now() - p;
|
|
3136
|
-
d ? (
|
|
3149
|
+
d ? (me.add(l.route.pattern), X.info(`ssr compiled ${l.route.pattern} in ${R}ms`, {
|
|
3137
3150
|
pattern: l.route.pattern,
|
|
3138
3151
|
pathname: c,
|
|
3139
3152
|
elapsedMs: R,
|
|
3140
3153
|
cold: !0,
|
|
3141
3154
|
phases: m
|
|
3142
|
-
})) : R > 200 &&
|
|
3155
|
+
})) : R > 200 && X.info(`ssr rendered ${c} in ${R}ms`, {
|
|
3143
3156
|
pattern: l.route.pattern,
|
|
3144
3157
|
pathname: c,
|
|
3145
3158
|
elapsedMs: R,
|
|
@@ -3147,31 +3160,31 @@ import {
|
|
|
3147
3160
|
phases: m
|
|
3148
3161
|
});
|
|
3149
3162
|
} catch (e) {
|
|
3150
|
-
if (
|
|
3151
|
-
|
|
3163
|
+
if (Sr(e)) {
|
|
3164
|
+
X.error("ssr-dev render refused", {
|
|
3152
3165
|
pathname: c,
|
|
3153
3166
|
pattern: l.route.pattern
|
|
3154
3167
|
}, e), i.statusCode = 500, i.setHeader("content-type", "text/plain; charset=utf-8"), i.end(e.message);
|
|
3155
3168
|
return;
|
|
3156
3169
|
}
|
|
3157
|
-
|
|
3170
|
+
X.warn("ssr-dev render failed; falling back to SPA shell", {
|
|
3158
3171
|
pathname: c,
|
|
3159
3172
|
pattern: l.route.pattern
|
|
3160
3173
|
}, e), a();
|
|
3161
3174
|
}
|
|
3162
3175
|
});
|
|
3163
3176
|
}
|
|
3164
|
-
},
|
|
3177
|
+
}, B = Date.now(), Se = w.version ?? "?", V = await Rr(), Ce = f(e, "node_modules", "@voltro", "ui-shadcn"), H = O(f(Ce, "package.json")) ? Ce : null, we = [], Te = await (async () => {
|
|
3165
3178
|
let t = [];
|
|
3166
3179
|
for (let n of u) {
|
|
3167
3180
|
if (!n.proxyTarget) continue;
|
|
3168
|
-
let r = await
|
|
3181
|
+
let r = await ai(e, n.pkg);
|
|
3169
3182
|
if (r) try {
|
|
3170
3183
|
t.push(await j.readFile(f(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3171
3184
|
} catch {}
|
|
3172
3185
|
}
|
|
3173
3186
|
if (t.length === 0) return !1;
|
|
3174
|
-
let n =
|
|
3187
|
+
let n = _e("sha1").update(t.join("\0")).digest("hex"), r = f(k, ".voltro-rpcgroup-optimize"), i = "";
|
|
3175
3188
|
try {
|
|
3176
3189
|
i = (await j.readFile(r, "utf8")).trim();
|
|
3177
3190
|
} catch {}
|
|
@@ -3181,48 +3194,48 @@ import {
|
|
|
3181
3194
|
} catch {}
|
|
3182
3195
|
return !0;
|
|
3183
3196
|
})();
|
|
3184
|
-
|
|
3197
|
+
Te && X.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client"), await (await w.createServer({
|
|
3185
3198
|
root: k,
|
|
3186
3199
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3187
3200
|
ssr: { noExternal: ["react-intl"] },
|
|
3188
3201
|
resolve: {
|
|
3189
3202
|
dedupe: ["react", "react-dom"],
|
|
3190
3203
|
alias: [
|
|
3191
|
-
...
|
|
3204
|
+
...V ? [{
|
|
3192
3205
|
find: "@voltro/devtools/styles.css",
|
|
3193
|
-
replacement: f(
|
|
3206
|
+
replacement: f(V, "src/styles.css")
|
|
3194
3207
|
}, {
|
|
3195
3208
|
find: "@voltro/devtools",
|
|
3196
|
-
replacement: f(
|
|
3209
|
+
replacement: f(V, "src/index.ts")
|
|
3197
3210
|
}] : [],
|
|
3198
|
-
...
|
|
3211
|
+
...H ? [
|
|
3199
3212
|
{
|
|
3200
3213
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3201
|
-
replacement: f(
|
|
3214
|
+
replacement: f(H, "src/tokens.css")
|
|
3202
3215
|
},
|
|
3203
3216
|
{
|
|
3204
3217
|
find: "@voltro/ui-shadcn/cn",
|
|
3205
|
-
replacement: f(
|
|
3218
|
+
replacement: f(H, "src/cn.ts")
|
|
3206
3219
|
},
|
|
3207
3220
|
{
|
|
3208
3221
|
find: "@voltro/ui-shadcn/brand",
|
|
3209
|
-
replacement: f(
|
|
3222
|
+
replacement: f(H, "src/brand/voltroLogo.tsx")
|
|
3210
3223
|
},
|
|
3211
3224
|
{
|
|
3212
3225
|
find: "@voltro/ui-shadcn",
|
|
3213
|
-
replacement: f(
|
|
3226
|
+
replacement: f(H, "src/index.ts")
|
|
3214
3227
|
}
|
|
3215
3228
|
] : [],
|
|
3216
|
-
...
|
|
3229
|
+
...qe(e)
|
|
3217
3230
|
]
|
|
3218
3231
|
},
|
|
3219
3232
|
optimizeDeps: {
|
|
3220
|
-
include: [...u.map((e) => `${e.pkg}/rpcGroup`), ...
|
|
3221
|
-
force:
|
|
3233
|
+
include: [...u.map((e) => `${e.pkg}/rpcGroup`), ...we],
|
|
3234
|
+
force: Te
|
|
3222
3235
|
},
|
|
3223
|
-
customLogger:
|
|
3236
|
+
customLogger: Ct(),
|
|
3224
3237
|
plugins: [
|
|
3225
|
-
|
|
3238
|
+
kn(f(e, "src", "pages")),
|
|
3226
3239
|
T(),
|
|
3227
3240
|
D(),
|
|
3228
3241
|
N,
|
|
@@ -3230,9 +3243,9 @@ import {
|
|
|
3230
3243
|
ae,
|
|
3231
3244
|
se,
|
|
3232
3245
|
ce,
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
...
|
|
3246
|
+
de,
|
|
3247
|
+
xe,
|
|
3248
|
+
...fe ? [fe] : []
|
|
3236
3249
|
],
|
|
3237
3250
|
server: {
|
|
3238
3251
|
port: g,
|
|
@@ -3240,24 +3253,24 @@ import {
|
|
|
3240
3253
|
host: !0,
|
|
3241
3254
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3242
3255
|
proxy: z,
|
|
3243
|
-
fs: { allow: [e, ...
|
|
3256
|
+
fs: { allow: [e, ...Wr(e)] }
|
|
3244
3257
|
},
|
|
3245
3258
|
appType: "spa",
|
|
3246
3259
|
cacheDir: f(k, ".vite"),
|
|
3247
3260
|
publicDir: f(e, "public")
|
|
3248
|
-
})).listen(),
|
|
3249
|
-
version:
|
|
3250
|
-
bootMs: Date.now() -
|
|
3251
|
-
}),
|
|
3261
|
+
})).listen(), Ir.info(`v${Se} ready in ${Date.now() - B}ms`, {
|
|
3262
|
+
version: Se,
|
|
3263
|
+
bootMs: Date.now() - B
|
|
3264
|
+
}), X.info(`listening on http://localhost:${g}`, {
|
|
3252
3265
|
port: g,
|
|
3253
3266
|
app: t.name ?? "(unnamed)"
|
|
3254
3267
|
});
|
|
3255
|
-
for (let e of u) e.proxyTarget && (
|
|
3268
|
+
for (let e of u) e.proxyTarget && (X.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
|
|
3256
3269
|
api: e.name,
|
|
3257
3270
|
target: e.proxyTarget
|
|
3258
|
-
}),
|
|
3271
|
+
}), X.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3259
3272
|
try {
|
|
3260
|
-
await
|
|
3273
|
+
await Zn({
|
|
3261
3274
|
id: v,
|
|
3262
3275
|
name: _,
|
|
3263
3276
|
kind: "web",
|
|
@@ -3266,13 +3279,13 @@ import {
|
|
|
3266
3279
|
status: "live",
|
|
3267
3280
|
logFile: y.path
|
|
3268
3281
|
});
|
|
3269
|
-
let t =
|
|
3282
|
+
let t = dr(e);
|
|
3270
3283
|
if (t) {
|
|
3271
|
-
let e = await
|
|
3272
|
-
e.status === "launched" ?
|
|
3284
|
+
let e = await br({ dashboardAppPath: t });
|
|
3285
|
+
e.status === "launched" ? X.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && X.debug(`dashboard already running on :${e.port}`, { port: e.port });
|
|
3273
3286
|
}
|
|
3274
3287
|
setInterval(() => {
|
|
3275
|
-
|
|
3288
|
+
Zn({
|
|
3276
3289
|
id: v,
|
|
3277
3290
|
name: _,
|
|
3278
3291
|
kind: "web",
|
|
@@ -3283,50 +3296,50 @@ import {
|
|
|
3283
3296
|
}).catch(() => {});
|
|
3284
3297
|
}, 1e4).unref();
|
|
3285
3298
|
let n = () => {
|
|
3286
|
-
|
|
3299
|
+
Qn(v), y.dispose();
|
|
3287
3300
|
};
|
|
3288
3301
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3289
3302
|
} catch (e) {
|
|
3290
|
-
|
|
3303
|
+
X.warn("runtime-registry write failed", {}, e);
|
|
3291
3304
|
}
|
|
3292
3305
|
return E({
|
|
3293
3306
|
app: t.name ?? "unnamed",
|
|
3294
3307
|
kind: "web",
|
|
3295
3308
|
url: `http://localhost:${g}`,
|
|
3296
|
-
bootMs: Date.now() -
|
|
3309
|
+
bootMs: Date.now() - B
|
|
3297
3310
|
}), new Promise(() => {});
|
|
3298
|
-
},
|
|
3311
|
+
}, bi = async (e) => {
|
|
3299
3312
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3300
|
-
let t = await
|
|
3313
|
+
let t = await vi(e);
|
|
3301
3314
|
if (!t) return {
|
|
3302
3315
|
ran: !1,
|
|
3303
3316
|
exitCode: 0
|
|
3304
3317
|
};
|
|
3305
|
-
let n = Date.now(), r =
|
|
3318
|
+
let n = Date.now(), r = X.child("serve");
|
|
3306
3319
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3307
|
-
let i = await
|
|
3320
|
+
let i = await ui(e, t);
|
|
3308
3321
|
for (let e of i) r.info("api wired", {
|
|
3309
3322
|
name: e.name,
|
|
3310
3323
|
pkg: e.pkg
|
|
3311
3324
|
});
|
|
3312
|
-
await
|
|
3325
|
+
await $(e, t, i);
|
|
3313
3326
|
{
|
|
3314
|
-
let { pages: t } = await
|
|
3315
|
-
await
|
|
3327
|
+
let { pages: t } = await Q(f(e, "src", "pages"));
|
|
3328
|
+
await It({
|
|
3316
3329
|
appRoot: e,
|
|
3317
3330
|
pages: t
|
|
3318
3331
|
});
|
|
3319
3332
|
}
|
|
3320
|
-
let a = t.port ?? 5173, o = await
|
|
3321
|
-
|
|
3333
|
+
let a = t.port ?? 5173, o = await Ye("vite", () => import("vite")), s = (await import("@vitejs/plugin-react")).default, c = f(e, ".framework");
|
|
3334
|
+
X.info("running production build"), await o.build({
|
|
3322
3335
|
root: c,
|
|
3323
3336
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3324
3337
|
plugins: [s()],
|
|
3325
|
-
customLogger:
|
|
3338
|
+
customLogger: Ct(),
|
|
3326
3339
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3327
3340
|
build: {
|
|
3328
3341
|
outDir: "dist",
|
|
3329
|
-
rollupOptions: { output: { manualChunks:
|
|
3342
|
+
rollupOptions: { output: { manualChunks: Kr } }
|
|
3330
3343
|
},
|
|
3331
3344
|
publicDir: f(e, "public")
|
|
3332
3345
|
});
|
|
@@ -3346,14 +3359,14 @@ import {
|
|
|
3346
3359
|
extras: d,
|
|
3347
3360
|
bootMs: Date.now() - n
|
|
3348
3361
|
}), new Promise(() => {});
|
|
3349
|
-
},
|
|
3362
|
+
}, xi = 5e3, Si = 6e4, Ci = (e, t) => {
|
|
3350
3363
|
if (e.length === 0) return 0;
|
|
3351
3364
|
if (e.length === 1) return e[0];
|
|
3352
3365
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3353
3366
|
if (r === i) return e[r];
|
|
3354
3367
|
let a = n - r;
|
|
3355
3368
|
return e[r] * (1 - a) + e[i] * a;
|
|
3356
|
-
},
|
|
3369
|
+
}, wi = (e) => {
|
|
3357
3370
|
if (e.length === 0) return {
|
|
3358
3371
|
p50: 0,
|
|
3359
3372
|
p95: 0,
|
|
@@ -3365,15 +3378,15 @@ import {
|
|
|
3365
3378
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3366
3379
|
for (let e of t) n += e;
|
|
3367
3380
|
return {
|
|
3368
|
-
p50:
|
|
3369
|
-
p95:
|
|
3370
|
-
p99:
|
|
3381
|
+
p50: Ci(t, .5),
|
|
3382
|
+
p95: Ci(t, .95),
|
|
3383
|
+
p99: Ci(t, .99),
|
|
3371
3384
|
mean: n / t.length,
|
|
3372
3385
|
min: t[0],
|
|
3373
3386
|
max: t[t.length - 1]
|
|
3374
3387
|
};
|
|
3375
|
-
},
|
|
3376
|
-
let t = e.maxSamples ??
|
|
3388
|
+
}, Ti = (e = {}) => {
|
|
3389
|
+
let t = e.maxSamples ?? xi, n = e.defaultWindowMs ?? Si, r = [];
|
|
3377
3390
|
return {
|
|
3378
3391
|
record(e) {
|
|
3379
3392
|
R(e), r.push({
|
|
@@ -3402,7 +3415,7 @@ import {
|
|
|
3402
3415
|
tag: e.tag,
|
|
3403
3416
|
count: e.samples.length,
|
|
3404
3417
|
errorCount: n,
|
|
3405
|
-
latencyMs:
|
|
3418
|
+
latencyMs: wi(t)
|
|
3406
3419
|
});
|
|
3407
3420
|
}
|
|
3408
3421
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3415,4 +3428,4 @@ import {
|
|
|
3415
3428
|
};
|
|
3416
3429
|
};
|
|
3417
3430
|
//#endregion
|
|
3418
|
-
export {
|
|
3431
|
+
export { ft as $, Qn as A, cn as B, br as C, sr as D, or as E, Nn as F, zt as G, tn as H, Fn as I, It as J, Rt as K, yn as L, An as M, In as N, $n as O, jn as P, pt as Q, bn as R, ur as S, ar as T, Jt as U, rn as V, Kt as W, wt as X, Et as Y, ht as Z, Cr as _, $r as a, it as at, Er as b, ui as c, et as ct, Kr as d, qe as dt, st as et, Q as f, We as ft, Sr as g, Fr as h, Ce as ht, hi as i, G as it, Zn as j, Xn as k, yi as l, $e as lt, Nr as m, V as mt, qr as n, lt as nt, Qr as o, at as ot, $ as p, Ge as pt, Bt as q, mi as r, ot as rt, vi as s, nt as st, Ti as t, ct as tt, bi as u, Ye as ut, wr as v, dr as w, fr as x, Tr as y, pn as z };
|