@voltro/cli 0.22.1 → 0.24.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 +427 -0
- package/bin/voltro.mjs +39 -4
- package/dist/{apiBuild-DiWxVz-M.js → apiBuild-B2m4XK_8.js} +45 -23
- package/dist/apiBuild-UEM3QBke.js +2 -0
- package/dist/bin.js +3 -3
- package/dist/{commands-BxRaIOBG.js → commands-CaIhTsC2.js} +2944 -2557
- package/dist/{dbCommand-DVASmZj2.js → dbCommand-CC61CsAc.js} +474 -263
- package/dist/dbCommand-Cr__4ATv.js +2 -0
- package/dist/{dev-Dd3EZzj5.js → dev-DPkQVUTP.js} +1 -1
- package/dist/{dev-BRiPgbKw.js → dev-NCuEhNxs.js} +1593 -1575
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-9ZSuDeqD.js → inspectMetrics-dcC7gnxu.js} +566 -552
- package/dist/{serveCommand-DXJOARkO.js → serveCommand-C4gzDZzc.js} +425 -411
- package/dist/serveEntry.js +2 -2
- package/dist/{start-CsIjcOi-.js → start-C_4VUDT8.js} +327 -325
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/_manifest.json +1 -1
- package/templates/agent-docs/authentication.md +21 -0
- package/templates/agent-docs/caching.md +21 -5
- package/templates/agent-docs/cli.md +61 -0
- package/templates/agent-docs/data.md +208 -170
- package/templates/agent-docs/database/migrations.md +123 -0
- package/templates/agent-docs/database/seedsdialects.md +12 -0
- package/templates/agent-docs/deployment.md +66 -1
- package/templates/agent-docs/plugins.md +42 -0
- package/templates/agent-docs/routing.md +23 -1
- package/templates/agent-docs/templates/apibackends.md +2 -2
- package/templates/agent-docs/whats-new.md +281 -32
- package/templates/agent-docs/workflows.md +30 -0
- package/templates/apps/api-ai/package.json +8 -7
- package/templates/apps/api-auth/package.json +9 -8
- package/templates/apps/api-backend/package.json +8 -7
- package/templates/apps/api-backend-deactivation/package.json +8 -7
- package/templates/apps/api-backend-mail/package.json +9 -8
- package/templates/apps/api-backend-mariadb/package.json +10 -9
- package/templates/apps/api-backend-storage/package.json +9 -8
- package/templates/apps/api-data-advanced/package.json +9 -8
- package/templates/apps/api-durable/package.json +9 -8
- package/templates/apps/api-feature-flags/package.json +10 -9
- package/templates/apps/api-governance/package.json +9 -8
- package/templates/apps/api-kv/package.json +9 -8
- package/templates/apps/api-moderation/package.json +9 -8
- package/templates/apps/api-observability/package.json +9 -8
- package/templates/apps/api-ratelimit/package.json +9 -8
- package/templates/apps/api-rbac/package.json +9 -8
- package/templates/apps/api-rest/package.json +8 -7
- package/templates/apps/api-saas/package.json +12 -11
- package/templates/apps/api-search/package.json +9 -8
- package/templates/apps/api-versioning/app.config.ts +6 -4
- package/templates/apps/api-versioning/package.json +9 -8
- package/templates/apps/api-webhooks/package.json +10 -9
- package/templates/apps/changelog/package.json +7 -6
- package/templates/apps/edge-functions/package.json +3 -2
- package/templates/apps/frontend-admin/package.json +9 -8
- package/templates/apps/frontend-app/package.json +9 -8
- package/templates/apps/frontend-blank/package.json +8 -7
- package/templates/apps/frontend-contact/package.json +8 -7
- package/templates/apps/frontend-contact/src/globals.d.ts +6 -0
- package/templates/apps/frontend-dashboard/package.json +8 -7
- package/templates/apps/frontend-docs/package.json +8 -7
- package/templates/apps/frontend-docs/src/globals.d.ts +6 -0
- package/templates/apps/frontend-i18n/package.json +7 -6
- package/templates/apps/frontend-landing/package.json +8 -7
- package/templates/apps/frontend-landing/src/globals.d.ts +6 -0
- package/templates/apps/frontend-spa/package.json +8 -7
- package/templates/apps/frontend-spa/src/globals.d.ts +6 -0
- package/templates/apps/frontend-ssr/package.json +8 -7
- package/templates/apps/frontend-ssr/src/globals.d.ts +6 -0
- package/templates/apps/frontend-ssr-api/package.json +9 -8
- package/templates/apps/frontend-static-blog/package.json +7 -6
- package/templates/apps/frontend-static-blog/src/globals.d.ts +6 -0
- package/dist/apiBuild-COyPDf3R.js +0 -2
- package/dist/dbCommand-CO3eSAZR.js +0 -2
|
@@ -6,19 +6,19 @@ import { FileSystem as _ } from "@effect/platform";
|
|
|
6
6
|
import { NodeContext as v, NodeRuntime as y } from "@effect/platform-node";
|
|
7
7
|
import { Cause as b, Effect as x, Layer as S } from "effect";
|
|
8
8
|
import { LoggerLayer as C, addSink as w, createLogger as T, printReadyBlock as E } from "@voltro/logger";
|
|
9
|
-
import { closeSync as
|
|
10
|
-
import { currentTraceContext as
|
|
11
|
-
import { homedir as
|
|
12
|
-
import { createRequire as
|
|
13
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
14
|
-
import { __installPublicEnv as
|
|
15
|
-
import { mkdir as
|
|
16
|
-
import { createHash as
|
|
17
|
-
import { spawn as
|
|
18
|
-
import { createConnection as
|
|
19
|
-
import { PassThrough as
|
|
9
|
+
import { closeSync as ee, existsSync as D, mkdirSync as O, openSync as k, promises as A, readFileSync as j, readdirSync as M, statSync as N, unlinkSync as P, unwatchFile as te, watchFile as F, writeSync as ne } from "node:fs";
|
|
10
|
+
import { currentTraceContext as I, recordSample as L, resolveSecret as R } from "@voltro/runtime";
|
|
11
|
+
import { homedir as re } from "node:os";
|
|
12
|
+
import { createRequire as ie } from "node:module";
|
|
13
|
+
import { FRAMEWORK_ENV_CATALOG as ae, appEnvEntries as oe, checkEnvNaming as se, formatEnvErrors as ce, installEnvSnapshot as le, isEnvContract as ue, pluginEnvEntries as z, renderDotEnvExample as de, resolveEnv as fe } from "@voltro/env";
|
|
14
|
+
import { __installPublicEnv as pe } from "@voltro/env/public";
|
|
15
|
+
import { mkdir as me, readFile as he, writeFile as B } from "node:fs/promises";
|
|
16
|
+
import { createHash as ge } from "node:crypto";
|
|
17
|
+
import { spawn as _e } from "node:child_process";
|
|
18
|
+
import { createConnection as ve } from "node:net";
|
|
19
|
+
import { PassThrough as ye } from "node:stream";
|
|
20
20
|
//#region src/cliRuntime.ts
|
|
21
|
-
var
|
|
21
|
+
var be = [
|
|
22
22
|
"severity",
|
|
23
23
|
"code",
|
|
24
24
|
"detail",
|
|
@@ -35,14 +35,14 @@ var xe = [
|
|
|
35
35
|
"file",
|
|
36
36
|
"line",
|
|
37
37
|
"routine"
|
|
38
|
-
],
|
|
38
|
+
], xe = (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 be) r[t] !== void 0 && (e[t] = r[t]);
|
|
46
46
|
return e;
|
|
47
47
|
}
|
|
48
48
|
for (let e of [
|
|
@@ -55,19 +55,19 @@ var xe = [
|
|
|
55
55
|
]) {
|
|
56
56
|
let i = r[e];
|
|
57
57
|
if (i !== void 0) {
|
|
58
|
-
let e =
|
|
58
|
+
let e = xe(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 = xe(e, t + 1, n);
|
|
64
64
|
if (r) return r;
|
|
65
65
|
}
|
|
66
66
|
return null;
|
|
67
|
-
},
|
|
67
|
+
}, V = (e) => ({
|
|
68
68
|
...e.scope ? { defaultScope: e.scope } : {},
|
|
69
69
|
...e.logger
|
|
70
|
-
}),
|
|
70
|
+
}), Se = (e = {}) => S.merge(v.layer, C(V(e))), H = async (e, t = {}) => {
|
|
71
71
|
let n = e.pipe(x.provide(v.layer));
|
|
72
72
|
return await x.runPromise(x.matchCauseEffect(n, {
|
|
73
73
|
onSuccess: (e) => x.succeed(e),
|
|
@@ -84,7 +84,7 @@ var xe = [
|
|
|
84
84
|
}
|
|
85
85
|
let n = null;
|
|
86
86
|
for (let e of t) {
|
|
87
|
-
let t =
|
|
87
|
+
let t = xe(e);
|
|
88
88
|
if (t) {
|
|
89
89
|
n = t;
|
|
90
90
|
break;
|
|
@@ -103,42 +103,42 @@ var xe = [
|
|
|
103
103
|
} : { causePretty: b.pretty(e) };
|
|
104
104
|
return x.zipRight(x.logError("cli command failed", r), x.succeed(1));
|
|
105
105
|
}
|
|
106
|
-
}).pipe(x.provide(C(
|
|
107
|
-
},
|
|
108
|
-
let n = e.pipe(x.provide(
|
|
106
|
+
}).pipe(x.provide(C(V(t)))));
|
|
107
|
+
}, Ce = (e, t = {}) => {
|
|
108
|
+
let n = e.pipe(x.provide(Se(t)));
|
|
109
109
|
y.runMain(n, { disableErrorReporting: !1 });
|
|
110
|
-
},
|
|
110
|
+
}, U = u(h(import.meta.url)), we = [m(U, "..", "templates"), m(U, "..", "..", "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 -->", W = (e, t) => e.exists(t).pipe(x.orElseSucceed(() => !1)), G = (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* W(t, f(n, ".git"))) || (yield* W(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* W(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* W(e, i))) return {
|
|
142
142
|
apis: n,
|
|
143
143
|
webs: r
|
|
144
144
|
};
|
|
@@ -146,8 +146,8 @@ var xe = [
|
|
|
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* W(e, o))) continue;
|
|
150
|
+
let s = yield* G(e, o);
|
|
151
151
|
/type:\s*['"]web['"]/.test(s) ? r.push(i) : n.push(i);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -155,7 +155,7 @@ var xe = [
|
|
|
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 xe = [
|
|
|
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* W(e, t);
|
|
264
264
|
if (i) {
|
|
265
|
-
if ((yield*
|
|
265
|
+
if ((yield* G(e, t)).slice(0, Oe).includes("voltro:agents-md:keep")) return {
|
|
266
266
|
path: t,
|
|
267
267
|
action: "protected"
|
|
268
268
|
};
|
|
@@ -275,67 +275,67 @@ 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* W(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* W(n, f(e, "AGENTS.md"))) {
|
|
286
|
+
let i = yield* G(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* G(n, f(i, "AGENTS.core.md")), o = yield* G(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* W(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) => G(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* W(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 H(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 = f(re(), ".voltro"), qe = f(Ke, "runtime-registry.json"), Je = 3e4, Ye = () => {
|
|
332
332
|
let e = Math.random().toString(36).slice(2, 10);
|
|
333
|
-
return `${
|
|
333
|
+
return `${qe}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
334
|
+
}, Xe = async () => {
|
|
335
|
+
await A.mkdir(Ke, { recursive: !0 });
|
|
334
336
|
}, Ze = async () => {
|
|
335
|
-
await A.mkdir(qe, { recursive: !0 });
|
|
336
|
-
}, Qe = async () => {
|
|
337
337
|
try {
|
|
338
|
-
let e = await A.readFile(
|
|
338
|
+
let e = await A.readFile(qe, "utf8"), t = JSON.parse(e);
|
|
339
339
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
340
340
|
version: 1,
|
|
341
341
|
apps: []
|
|
@@ -346,34 +346,34 @@ boundary, naming, anti-patterns) before editing.
|
|
|
346
346
|
apps: []
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
|
-
},
|
|
350
|
-
await
|
|
351
|
-
let t =
|
|
349
|
+
}, Qe = async (e) => {
|
|
350
|
+
await Xe();
|
|
351
|
+
let t = Ye();
|
|
352
352
|
try {
|
|
353
353
|
await A.writeFile(t, JSON.stringify(e, null, 2), {
|
|
354
354
|
encoding: "utf8",
|
|
355
355
|
mode: 384
|
|
356
|
-
}), await A.rename(t,
|
|
356
|
+
}), await A.rename(t, qe), await A.chmod(qe, 384).catch(() => {});
|
|
357
357
|
} catch (e) {
|
|
358
358
|
try {
|
|
359
359
|
await A.unlink(t);
|
|
360
360
|
} catch {}
|
|
361
361
|
throw e;
|
|
362
362
|
}
|
|
363
|
-
},
|
|
363
|
+
}, $e = (e) => {
|
|
364
364
|
try {
|
|
365
365
|
return process.kill(e, 0), !0;
|
|
366
366
|
} catch {
|
|
367
367
|
return !1;
|
|
368
368
|
}
|
|
369
|
-
},
|
|
369
|
+
}, et = (e) => {
|
|
370
370
|
let t = Date.now();
|
|
371
|
-
return e.filter((e) =>
|
|
372
|
-
},
|
|
373
|
-
let e = await
|
|
371
|
+
return e.filter((e) => $e(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Je : !1);
|
|
372
|
+
}, tt = async () => {
|
|
373
|
+
let e = await Ze(), t = et(e.apps);
|
|
374
374
|
if (t.length === e.apps.length) return e;
|
|
375
375
|
try {
|
|
376
|
-
await
|
|
376
|
+
await Qe({
|
|
377
377
|
version: 1,
|
|
378
378
|
apps: t
|
|
379
379
|
});
|
|
@@ -382,31 +382,31 @@ boundary, naming, anti-patterns) before editing.
|
|
|
382
382
|
version: 1,
|
|
383
383
|
apps: t
|
|
384
384
|
};
|
|
385
|
-
},
|
|
386
|
-
let t = await
|
|
385
|
+
}, nt = async (e) => {
|
|
386
|
+
let t = await Ze(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
|
|
387
387
|
...e,
|
|
388
388
|
...i !== void 0 && i !== "" ? { inspectToken: i } : {},
|
|
389
389
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
390
390
|
heartbeatAt: n
|
|
391
391
|
};
|
|
392
|
-
await
|
|
392
|
+
await Qe({
|
|
393
393
|
version: 1,
|
|
394
394
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
|
|
395
395
|
});
|
|
396
|
-
},
|
|
396
|
+
}, rt = async (e) => {
|
|
397
397
|
try {
|
|
398
|
-
let t = await
|
|
398
|
+
let t = await Ze(), n = t.apps.filter((t) => t.id !== e);
|
|
399
399
|
if (n.length === t.apps.length) return;
|
|
400
|
-
await
|
|
400
|
+
await Qe({
|
|
401
401
|
version: 1,
|
|
402
402
|
apps: n
|
|
403
403
|
});
|
|
404
404
|
} catch {}
|
|
405
|
-
},
|
|
405
|
+
}, it = (e, t, n) => `${e}:${t}:${n}`, at = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), ot = (e) => {
|
|
406
406
|
try {
|
|
407
407
|
let t = f(e, "tsconfig.json");
|
|
408
|
-
if (!
|
|
409
|
-
let n = JSON.parse(
|
|
408
|
+
if (!D(t)) return [];
|
|
409
|
+
let n = JSON.parse(at(j(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = m(e, n.baseUrl ?? "."), a = [];
|
|
410
410
|
for (let [e, t] of Object.entries(r)) {
|
|
411
411
|
let n = t[0];
|
|
412
412
|
if (!n) continue;
|
|
@@ -426,17 +426,17 @@ boundary, naming, anti-patterns) before editing.
|
|
|
426
426
|
} catch {
|
|
427
427
|
return [];
|
|
428
428
|
}
|
|
429
|
-
},
|
|
429
|
+
}, st = (e) => {
|
|
430
430
|
let t = e;
|
|
431
431
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
432
|
-
},
|
|
432
|
+
}, ct = async (e, t) => {
|
|
433
433
|
try {
|
|
434
434
|
return await t();
|
|
435
435
|
} catch (t) {
|
|
436
|
-
throw
|
|
436
|
+
throw st(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;
|
|
437
437
|
}
|
|
438
|
-
},
|
|
439
|
-
let n =
|
|
438
|
+
}, lt = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", ut = (e, t) => t ? `${e} | undefined` : e, dt = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${ut(t.tsType, t.optional)}`).join("\n"), ft = async (e, t) => {
|
|
439
|
+
let n = dt(t, () => !0), r = `${lt}
|
|
440
440
|
import '@voltro/env/server'
|
|
441
441
|
|
|
442
442
|
declare module '@voltro/env/server' {
|
|
@@ -445,9 +445,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
447
|
`;
|
|
448
|
-
await
|
|
449
|
-
},
|
|
450
|
-
let n =
|
|
448
|
+
await B(f(e, "env.generated.d.ts"), r, "utf8");
|
|
449
|
+
}, pt = async (e, t) => {
|
|
450
|
+
let n = dt(t, (e) => e === "public"), r = `${lt}
|
|
451
451
|
import '@voltro/env/public'
|
|
452
452
|
|
|
453
453
|
declare module '@voltro/env/public' {
|
|
@@ -456,9 +456,9 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
`, i = f(e, "src");
|
|
459
|
-
await
|
|
460
|
-
},
|
|
461
|
-
let n = `${
|
|
459
|
+
await me(i, { recursive: !0 }), await B(f(i, "voltro-env.d.ts"), r, "utf8");
|
|
460
|
+
}, mt = async (e, t) => {
|
|
461
|
+
let n = `${lt}
|
|
462
462
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
463
463
|
|
|
464
464
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -466,14 +466,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
466
466
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
467
467
|
__installPublicEnv(publicEnvValues)
|
|
468
468
|
`;
|
|
469
|
-
await
|
|
470
|
-
},
|
|
471
|
-
let t =
|
|
469
|
+
await me(e, { recursive: !0 }), await B(f(e, "env.public.ts"), n, "utf8");
|
|
470
|
+
}, ht = async (e) => {
|
|
471
|
+
let t = ue(e.rawEnv) ? e.rawEnv : void 0, n = await fe({
|
|
472
472
|
contract: t,
|
|
473
|
-
resolveSecret:
|
|
474
|
-
}), r = [...n.errors, ...
|
|
475
|
-
if (r.length > 0) throw Error(
|
|
476
|
-
|
|
473
|
+
resolveSecret: R
|
|
474
|
+
}), r = [...n.errors, ...se(t, e.appType)];
|
|
475
|
+
if (r.length > 0) throw Error(ce(r));
|
|
476
|
+
le(n.values), e.appType === "web" && pe(n.publicValues);
|
|
477
477
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
478
478
|
if (i > 0) {
|
|
479
479
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -485,20 +485,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
485
485
|
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 });
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
488
|
+
return e.generateTypes && t && (e.appType === "api" ? await ft(e.root, t) : await pt(e.root, t)), {
|
|
489
489
|
resolved: n,
|
|
490
490
|
contract: t
|
|
491
491
|
};
|
|
492
|
-
},
|
|
493
|
-
let t =
|
|
492
|
+
}, gt = (e) => {
|
|
493
|
+
let t = oe(e.contract), n = (e.plugins ?? []).flatMap((e) => z(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ae, i = /* @__PURE__ */ new Set(), a = [];
|
|
494
494
|
for (let e of [
|
|
495
495
|
...t,
|
|
496
496
|
...n,
|
|
497
497
|
...r
|
|
498
498
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
499
499
|
return a;
|
|
500
|
-
},
|
|
501
|
-
let r =
|
|
500
|
+
}, _t = (e, t, n = (e) => process.env[e]) => {
|
|
501
|
+
let r = gt(t).map((e) => {
|
|
502
502
|
let t = n(e.key) !== void 0;
|
|
503
503
|
return {
|
|
504
504
|
...e,
|
|
@@ -515,13 +515,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
515
515
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
|
-
},
|
|
518
|
+
}, vt = (e, t) => de(gt({
|
|
519
519
|
...e,
|
|
520
520
|
includeFramework: !1
|
|
521
521
|
}), {
|
|
522
522
|
includeFramework: e.includeFramework !== !1,
|
|
523
523
|
...t ? { header: t } : {}
|
|
524
|
-
}),
|
|
524
|
+
}), yt = () => {
|
|
525
525
|
let e = /* @__PURE__ */ new Map();
|
|
526
526
|
return {
|
|
527
527
|
get(t) {
|
|
@@ -548,7 +548,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
548
548
|
return Array.from(e.entries());
|
|
549
549
|
}
|
|
550
550
|
};
|
|
551
|
-
},
|
|
551
|
+
}, K = (e) => {
|
|
552
552
|
if (typeof e == "number" && Number.isFinite(e) && e > 0) return e * 1e3;
|
|
553
553
|
if (typeof e != "string") return null;
|
|
554
554
|
let t = /^\s*(\d+)\s*(s|seconds?|m|minutes?|h|hours?|d|days?)\s*$/i.exec(e);
|
|
@@ -557,10 +557,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
557
557
|
if (!Number.isFinite(n) || n <= 0) return null;
|
|
558
558
|
let r = t[2].toLowerCase();
|
|
559
559
|
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;
|
|
560
|
-
},
|
|
560
|
+
}, bt = (e, t = {}) => {
|
|
561
561
|
let n = [e];
|
|
562
562
|
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("|");
|
|
563
|
-
},
|
|
563
|
+
}, xt = (e, t) => e.expiresAt > t, St = (e, t) => e.expiresAt <= t && e.servableUntil > t, Ct = T({ scope: "voltro:cli" }), wt = (e, t) => {
|
|
564
564
|
if (t?.code !== "EACCES") return "";
|
|
565
565
|
if (typeof process.getuid != "function") return " — permission denied";
|
|
566
566
|
try {
|
|
@@ -569,8 +569,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
569
569
|
} catch {
|
|
570
570
|
return " — permission denied (and the file could not be stat-ed either)";
|
|
571
571
|
}
|
|
572
|
-
},
|
|
573
|
-
|
|
572
|
+
}, Tt = [], Et = (e) => {
|
|
573
|
+
Tt.length = 0;
|
|
574
574
|
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;
|
|
575
575
|
for (;;) {
|
|
576
576
|
r.push(i);
|
|
@@ -580,8 +580,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
580
580
|
}
|
|
581
581
|
for (let e of r) for (let t of [".env.local", ".env"]) {
|
|
582
582
|
let n = m(e, t);
|
|
583
|
-
if (
|
|
584
|
-
|
|
583
|
+
if (D(n)) {
|
|
584
|
+
Tt.push(n);
|
|
585
585
|
try {
|
|
586
586
|
let e = j(n, "utf8");
|
|
587
587
|
for (let t of e.split(/\r?\n/)) {
|
|
@@ -593,15 +593,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
593
593
|
(i.startsWith("\"") && i.endsWith("\"") || i.startsWith("'") && i.endsWith("'")) && (i = i.slice(1, -1)), process.env[r] === void 0 && (process.env[r] = i);
|
|
594
594
|
}
|
|
595
595
|
} catch (e) {
|
|
596
|
-
|
|
596
|
+
Ct.warn(`failed to load env file (continuing)${wt(n, e)}`, { path: n }, e);
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
},
|
|
600
|
+
}, Dt = 500, Ot = (e, t, n = {}) => {
|
|
601
601
|
if (e.length === 0) return () => {};
|
|
602
602
|
let r = (e) => n.root ? p(n.root, e) : e, i = !1, a = (e) => {
|
|
603
603
|
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(() => {
|
|
604
|
-
let e =
|
|
604
|
+
let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
605
605
|
stdio: "inherit",
|
|
606
606
|
env: process.env,
|
|
607
607
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -615,62 +615,62 @@ __installPublicEnv(publicEnvValues)
|
|
|
615
615
|
});
|
|
616
616
|
}));
|
|
617
617
|
};
|
|
618
|
-
for (let t of e)
|
|
618
|
+
for (let t of e) F(t, { interval: Dt }, (e, n) => {
|
|
619
619
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
620
620
|
});
|
|
621
621
|
return t.info("watching .env files for changes", {
|
|
622
622
|
files: e.map(r),
|
|
623
|
-
intervalMs:
|
|
623
|
+
intervalMs: Dt
|
|
624
624
|
}), () => {
|
|
625
|
-
for (let t of e)
|
|
625
|
+
for (let t of e) te(t);
|
|
626
626
|
};
|
|
627
|
-
},
|
|
627
|
+
}, q = T({ scope: "vite" }), kt = /\x1b\[[0-9;]*m/g, At = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, jt = (e) => e.replace(kt, "").replace(At, "").trim(), Mt = /proxy error/i, Nt = [
|
|
628
628
|
"ECONNREFUSED",
|
|
629
629
|
"ECONNRESET",
|
|
630
630
|
"ECONNABORTED",
|
|
631
631
|
"EPIPE",
|
|
632
632
|
"ETIMEDOUT"
|
|
633
|
-
],
|
|
633
|
+
], Pt = (e, t = 0) => {
|
|
634
634
|
if (e == null || t > 5) return !1;
|
|
635
635
|
let n = e;
|
|
636
|
-
return typeof n.code == "string" &&
|
|
637
|
-
},
|
|
636
|
+
return typeof n.code == "string" && Nt.includes(n.code) || typeof n.message == "string" && Nt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Pt(e, t + 1)) ? !0 : Pt(n.cause, t + 1);
|
|
637
|
+
}, Ft = 4e3, It = () => {
|
|
638
638
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
639
639
|
hasWarned: !1,
|
|
640
640
|
info: (e) => {
|
|
641
|
-
let t =
|
|
642
|
-
t.length !== 0 &&
|
|
641
|
+
let t = jt(e);
|
|
642
|
+
t.length !== 0 && q.info(t);
|
|
643
643
|
},
|
|
644
644
|
warn: (e) => {
|
|
645
645
|
n.hasWarned = !0;
|
|
646
|
-
let t =
|
|
647
|
-
t.length !== 0 &&
|
|
646
|
+
let t = jt(e);
|
|
647
|
+
t.length !== 0 && q.warn(t);
|
|
648
648
|
},
|
|
649
649
|
warnOnce: (t) => {
|
|
650
|
-
let r =
|
|
651
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
650
|
+
let r = jt(t);
|
|
651
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && q.warn(r));
|
|
652
652
|
},
|
|
653
653
|
error: (e, n) => {
|
|
654
|
-
let r =
|
|
654
|
+
let r = jt(e), i = n?.error;
|
|
655
655
|
if (r.length !== 0) {
|
|
656
|
-
if (
|
|
656
|
+
if (Mt.test(r) && Pt(i)) {
|
|
657
657
|
let e = Date.now();
|
|
658
|
-
e - t >
|
|
658
|
+
e - t > Ft && (t = e, q.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
|
-
|
|
661
|
+
q.error(r, {}, i);
|
|
662
662
|
}
|
|
663
663
|
},
|
|
664
664
|
clearScreen: () => {},
|
|
665
665
|
hasErrorLogged: (e) => !1
|
|
666
666
|
};
|
|
667
667
|
return n;
|
|
668
|
-
},
|
|
668
|
+
}, Lt = (e = process.env) => {
|
|
669
669
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
670
670
|
if (t === void 0 || t.trim() === "") return 4;
|
|
671
671
|
let n = Number(t);
|
|
672
672
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
673
|
-
},
|
|
673
|
+
}, Rt = (e) => {
|
|
674
674
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
675
675
|
let e = r.shift();
|
|
676
676
|
e ? e() : n--;
|
|
@@ -688,8 +688,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
688
688
|
return n;
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
|
-
},
|
|
692
|
-
let t =
|
|
691
|
+
}, zt = (e) => {
|
|
692
|
+
let t = Rt(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
693
693
|
return {
|
|
694
694
|
load: (i, a) => {
|
|
695
695
|
if (r.has(i)) return a();
|
|
@@ -719,7 +719,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
719
719
|
return r.size;
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
|
-
},
|
|
722
|
+
}, Bt = (e) => {
|
|
723
723
|
let t = [];
|
|
724
724
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
725
725
|
name: n.slice(5, -2),
|
|
@@ -735,11 +735,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
735
735
|
optional: !1
|
|
736
736
|
});
|
|
737
737
|
return t;
|
|
738
|
-
},
|
|
738
|
+
}, Vt = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), Ht = async (e) => {
|
|
739
739
|
let t = m(e);
|
|
740
740
|
for (let e = 0; e < 4; e++) {
|
|
741
741
|
let e = f(t, "project.json");
|
|
742
|
-
if (
|
|
742
|
+
if (D(e)) try {
|
|
743
743
|
let n = await A.readFile(e, "utf8");
|
|
744
744
|
return {
|
|
745
745
|
projectDir: t,
|
|
@@ -753,33 +753,33 @@ __installPublicEnv(publicEnvValues)
|
|
|
753
753
|
t = n;
|
|
754
754
|
}
|
|
755
755
|
return null;
|
|
756
|
-
},
|
|
757
|
-
let t = await
|
|
756
|
+
}, Ut = async (e) => {
|
|
757
|
+
let t = await Ht(e);
|
|
758
758
|
if (!t) return [];
|
|
759
759
|
let { projectDir: n, manifest: r } = t, i = l(e), a = r.apps ?? {}, o = [];
|
|
760
760
|
for (let [e, t] of Object.entries(a)) {
|
|
761
761
|
if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
|
|
762
762
|
let r = f(f(n, t.path ?? e), "src", "pages");
|
|
763
|
-
if (!
|
|
763
|
+
if (!D(r)) continue;
|
|
764
764
|
let a;
|
|
765
765
|
try {
|
|
766
766
|
let { pages: e } = await Q(r);
|
|
767
767
|
a = e.map((e) => ({
|
|
768
768
|
pattern: e.pattern,
|
|
769
|
-
params:
|
|
769
|
+
params: Bt(e.pattern)
|
|
770
770
|
}));
|
|
771
771
|
} catch {
|
|
772
772
|
continue;
|
|
773
773
|
}
|
|
774
774
|
o.push({
|
|
775
|
-
key:
|
|
775
|
+
key: Vt(e),
|
|
776
776
|
origin: `http://localhost:${t.port}`,
|
|
777
777
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
778
778
|
routes: a
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
781
|
return o;
|
|
782
|
-
},
|
|
782
|
+
}, Wt = (e) => {
|
|
783
783
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
784
784
|
let t = e.pattern;
|
|
785
785
|
for (let n of e.params) {
|
|
@@ -787,21 +787,21 @@ __installPublicEnv(publicEnvValues)
|
|
|
787
787
|
t = t.replace(e, r);
|
|
788
788
|
}
|
|
789
789
|
return "`" + t + "`";
|
|
790
|
-
},
|
|
790
|
+
}, Gt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
791
791
|
let t = "string";
|
|
792
792
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
793
|
-
}).join("; ")} }`,
|
|
794
|
-
let r =
|
|
793
|
+
}).join("; ")} }`, Kt = (e, t, n) => {
|
|
794
|
+
let r = Gt(e), i = Wt(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
|
|
795
795
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
796
|
-
},
|
|
796
|
+
}, qt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${Kt(e, !1)},`).join("\n")}\n}`, Jt = (e, t) => {
|
|
797
797
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
798
|
-
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)}: ${
|
|
798
|
+
let n = [...e.routes].sort((e, t) => e.pattern.localeCompare(t.pattern)), r = t === "prod" && e.prodOrigin ? e.prodOrigin : e.origin, i = JSON.stringify(r), a = n.map((e) => ` ${JSON.stringify(e.pattern)}: ${Kt(e, !0, i)},`);
|
|
799
799
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
800
|
-
},
|
|
800
|
+
}, Yt = async (e) => {
|
|
801
801
|
let t = e.pages.map((e) => ({
|
|
802
802
|
pattern: e.pattern,
|
|
803
|
-
params:
|
|
804
|
-
})), n = await
|
|
803
|
+
params: Bt(e.pattern)
|
|
804
|
+
})), n = await Ut(e.appRoot), r = [
|
|
805
805
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
806
806
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
807
807
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -810,7 +810,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
810
810
|
"",
|
|
811
811
|
"type EmptyParams = Record<string, never>",
|
|
812
812
|
""
|
|
813
|
-
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${
|
|
813
|
+
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${qt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => Jt(e, i)).join("\n")}\n} as const\n`}`, o = f(e.appRoot, ".framework", "routes.generated.ts");
|
|
814
814
|
await A.mkdir(u(o), { recursive: !0 });
|
|
815
815
|
let s = null;
|
|
816
816
|
try {
|
|
@@ -823,7 +823,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
823
823
|
path: o,
|
|
824
824
|
wrote: !0
|
|
825
825
|
});
|
|
826
|
-
},
|
|
826
|
+
}, Xt = 256, Zt = (e = Xt) => {
|
|
827
827
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
828
828
|
return {
|
|
829
829
|
emit(r, i) {
|
|
@@ -846,27 +846,27 @@ __installPublicEnv(publicEnvValues)
|
|
|
846
846
|
return t.slice();
|
|
847
847
|
}
|
|
848
848
|
};
|
|
849
|
-
},
|
|
849
|
+
}, Qt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, $t = () => `: keep-alive ${Date.now()}\n\n`, en = {
|
|
850
850
|
trace: 0,
|
|
851
851
|
debug: 1,
|
|
852
852
|
info: 2,
|
|
853
853
|
warn: 3,
|
|
854
854
|
error: 4,
|
|
855
855
|
fatal: 5
|
|
856
|
-
},
|
|
856
|
+
}, tn = 2e3, nn = 200, rn = class {
|
|
857
857
|
capacity;
|
|
858
858
|
buffer = [];
|
|
859
|
-
constructor(e =
|
|
859
|
+
constructor(e = tn) {
|
|
860
860
|
this.capacity = e;
|
|
861
861
|
}
|
|
862
862
|
append(e) {
|
|
863
863
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
864
864
|
}
|
|
865
865
|
query(e = {}) {
|
|
866
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
866
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? nn, this.capacity), i = e.minLevel === void 0 ? en.trace : en[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
867
867
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
868
868
|
let r = this.buffer[e];
|
|
869
|
-
r.ts < t || r.ts > n ||
|
|
869
|
+
r.ts < t || r.ts > n || en[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);
|
|
870
870
|
}
|
|
871
871
|
return l.reverse();
|
|
872
872
|
}
|
|
@@ -879,7 +879,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
879
879
|
clear() {
|
|
880
880
|
this.buffer = [];
|
|
881
881
|
}
|
|
882
|
-
},
|
|
882
|
+
}, an = null, on = () => (an === null && (an = new rn()), an), sn = (e) => {
|
|
883
883
|
if (typeof e == "string") return e;
|
|
884
884
|
if (e instanceof Error) return e.message;
|
|
885
885
|
try {
|
|
@@ -887,18 +887,18 @@ __installPublicEnv(publicEnvValues)
|
|
|
887
887
|
} catch {
|
|
888
888
|
return String(e);
|
|
889
889
|
}
|
|
890
|
-
},
|
|
890
|
+
}, cn = (e) => {
|
|
891
891
|
let t = {
|
|
892
892
|
log: console.log.bind(console),
|
|
893
893
|
info: console.info.bind(console),
|
|
894
894
|
warn: console.warn.bind(console),
|
|
895
895
|
error: console.error.bind(console),
|
|
896
896
|
debug: console.debug.bind(console)
|
|
897
|
-
}, n =
|
|
897
|
+
}, n = on(), r = !1, i = (i) => (...a) => {
|
|
898
898
|
if (t[i](...a), !r) {
|
|
899
899
|
r = !0;
|
|
900
900
|
try {
|
|
901
|
-
let t = a.length > 0 ?
|
|
901
|
+
let t = a.length > 0 ? sn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = I();
|
|
902
902
|
e.emit("log", {
|
|
903
903
|
level: i,
|
|
904
904
|
message: r,
|
|
@@ -936,7 +936,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
936
936
|
argsCount: 1,
|
|
937
937
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
938
938
|
});
|
|
939
|
-
let a =
|
|
939
|
+
let a = I(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
940
940
|
...t.fields,
|
|
941
941
|
traceId: a.traceId
|
|
942
942
|
} : t.fields;
|
|
@@ -956,24 +956,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
956
956
|
return () => {
|
|
957
957
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
958
958
|
};
|
|
959
|
-
},
|
|
959
|
+
}, ln = 2e3, un = 8, dn = 1e3, fn = 200, J = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, pn = (e) => {
|
|
960
960
|
switch (e) {
|
|
961
961
|
case "error": return "error";
|
|
962
962
|
case "warn": return "warn";
|
|
963
963
|
case "debug": return "debug";
|
|
964
964
|
default: return "info";
|
|
965
965
|
}
|
|
966
|
-
},
|
|
966
|
+
}, mn = T({ scope: "client" }), hn = (e, t) => {
|
|
967
967
|
let n;
|
|
968
968
|
try {
|
|
969
969
|
n = JSON.parse(e);
|
|
970
970
|
} catch {
|
|
971
|
-
return
|
|
971
|
+
return gn(400, { error: "invalid JSON body" });
|
|
972
972
|
}
|
|
973
|
-
if (typeof n != "object" || !n) return
|
|
973
|
+
if (typeof n != "object" || !n) return gn(400, { error: "body must be a JSON object" });
|
|
974
974
|
let r = n;
|
|
975
|
-
if (!Array.isArray(r.entries)) return
|
|
976
|
-
let i = typeof r.app == "string" ?
|
|
975
|
+
if (!Array.isArray(r.entries)) return gn(400, { error: "entries must be an array" });
|
|
976
|
+
let i = typeof r.app == "string" ? J(r.app, 120) : void 0, a = typeof r.page == "string" ? J(r.page, 200) : void 0, o = typeof r.ua == "string" ? J(r.ua, 200) : void 0, s = r.entries.slice(0, fn), c = 0;
|
|
977
977
|
for (let e of s) {
|
|
978
978
|
if (typeof e != "object" || !e) continue;
|
|
979
979
|
let n = e;
|
|
@@ -984,7 +984,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
984
984
|
"warn",
|
|
985
985
|
"error",
|
|
986
986
|
"debug"
|
|
987
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l =
|
|
987
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = J(n.message, ln), u = Array.isArray(n.args) ? n.args.slice(0, un).filter((e) => typeof e == "string").map((e) => J(e, dn)) : void 0, d = typeof n.stack == "string" ? J(n.stack, ln) : void 0;
|
|
988
988
|
t.emit("clientLog", {
|
|
989
989
|
ts: s,
|
|
990
990
|
level: r,
|
|
@@ -999,35 +999,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
999
999
|
...i === void 0 ? {} : { app: i },
|
|
1000
1000
|
...a === void 0 ? {} : { page: a },
|
|
1001
1001
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
1002
|
-
}, p =
|
|
1003
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
1002
|
+
}, p = pn(r);
|
|
1003
|
+
(p === "error" || p === "warn") && d !== void 0 ? mn[p](l, f, { stack: d }) : mn[p](l, {
|
|
1004
1004
|
...f,
|
|
1005
1005
|
...d === void 0 ? {} : { stack: d }
|
|
1006
1006
|
}), c++;
|
|
1007
1007
|
}
|
|
1008
|
-
return
|
|
1008
|
+
return gn(202, {
|
|
1009
1009
|
accepted: c,
|
|
1010
1010
|
dropped: r.entries.length - c
|
|
1011
1011
|
});
|
|
1012
|
-
},
|
|
1012
|
+
}, gn = (e, t) => ({
|
|
1013
1013
|
status: e,
|
|
1014
1014
|
contentType: "application/json; charset=utf-8",
|
|
1015
1015
|
body: JSON.stringify(t)
|
|
1016
|
-
}),
|
|
1016
|
+
}), _n = "/_voltro/inspect/clientLog", vn = [
|
|
1017
1017
|
"trace",
|
|
1018
1018
|
"debug",
|
|
1019
1019
|
"info",
|
|
1020
1020
|
"warn",
|
|
1021
1021
|
"error",
|
|
1022
1022
|
"fatal"
|
|
1023
|
-
],
|
|
1023
|
+
], yn = {
|
|
1024
1024
|
trace: "TRACE",
|
|
1025
1025
|
debug: "DEBUG",
|
|
1026
1026
|
info: "INFO ",
|
|
1027
1027
|
warn: "WARN ",
|
|
1028
1028
|
error: "ERROR",
|
|
1029
1029
|
fatal: "FATAL"
|
|
1030
|
-
},
|
|
1030
|
+
}, bn = (e) => vn.includes(e), xn = (e, t, n = {}) => {
|
|
1031
1031
|
if (i()) return {
|
|
1032
1032
|
status: 503,
|
|
1033
1033
|
contentType: "application/json",
|
|
@@ -1058,7 +1058,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1058
1058
|
Number.isFinite(e) && e > 0 && (c.max = Math.floor(e));
|
|
1059
1059
|
}
|
|
1060
1060
|
let f = s.get("level");
|
|
1061
|
-
f !== null &&
|
|
1061
|
+
f !== null && bn(f) && (c.minLevel = f);
|
|
1062
1062
|
let p = s.get("source");
|
|
1063
1063
|
(p === "server" || p === "client") && (c.source = p);
|
|
1064
1064
|
let m = s.get("scope");
|
|
@@ -1071,7 +1071,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1071
1071
|
if ((s.get("format") ?? "json") === "text") return {
|
|
1072
1072
|
status: 200,
|
|
1073
1073
|
contentType: "text/plain; charset=utf-8",
|
|
1074
|
-
body: _.map(
|
|
1074
|
+
body: _.map(Sn).join("\n") + (_.length > 0 ? "\n" : "")
|
|
1075
1075
|
};
|
|
1076
1076
|
let v = {
|
|
1077
1077
|
capturedAt: Date.now(),
|
|
@@ -1085,40 +1085,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
1085
1085
|
contentType: "application/json; charset=utf-8",
|
|
1086
1086
|
body: JSON.stringify(v)
|
|
1087
1087
|
};
|
|
1088
|
-
},
|
|
1089
|
-
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 =
|
|
1090
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1091
|
-
},
|
|
1088
|
+
}, Sn = (e) => {
|
|
1089
|
+
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 = wn(e.fields);
|
|
1090
|
+
return `${n}:${r}:${i}.${a} ${yn[e.level]} ${o} ${e.message}${s}`;
|
|
1091
|
+
}, Cn = 80, wn = (e) => {
|
|
1092
1092
|
let t = Object.entries(e);
|
|
1093
1093
|
if (t.length === 0) return "";
|
|
1094
1094
|
let n = [];
|
|
1095
1095
|
for (let [e, r] of t) {
|
|
1096
1096
|
if (r === void 0) continue;
|
|
1097
|
-
let t =
|
|
1097
|
+
let t = Tn(r);
|
|
1098
1098
|
n.push(`${e}=${t}`);
|
|
1099
1099
|
}
|
|
1100
1100
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1101
|
-
},
|
|
1101
|
+
}, Tn = (e) => {
|
|
1102
1102
|
if (typeof e == "string") {
|
|
1103
|
-
let t = e.length >
|
|
1103
|
+
let t = e.length > Cn ? e.slice(0, Cn) + "…" : e;
|
|
1104
1104
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1105
1105
|
}
|
|
1106
1106
|
if (e === null) return "null";
|
|
1107
1107
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1108
1108
|
try {
|
|
1109
1109
|
let t = JSON.stringify(e);
|
|
1110
|
-
return t.length >
|
|
1110
|
+
return t.length > Cn ? t.slice(0, Cn) + "…" : t;
|
|
1111
1111
|
} catch {
|
|
1112
1112
|
return "[unserialisable]";
|
|
1113
1113
|
}
|
|
1114
|
-
},
|
|
1114
|
+
}, En = "/_voltro/inspect/logs", Dn = (e, t, n) => {
|
|
1115
1115
|
if (t.headers.authorization !== void 0) return !1;
|
|
1116
1116
|
let { token: r } = n;
|
|
1117
1117
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
1118
1118
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
1119
1119
|
let i = n.writeToken;
|
|
1120
1120
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
1121
|
-
},
|
|
1121
|
+
}, On = [{
|
|
1122
1122
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1123
1123
|
handle: (e, t) => {
|
|
1124
1124
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1130,13 +1130,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1130
1130
|
});
|
|
1131
1131
|
} else t.info(n);
|
|
1132
1132
|
}
|
|
1133
|
-
}],
|
|
1133
|
+
}], kn = () => {
|
|
1134
1134
|
let e = {
|
|
1135
1135
|
warn: console.warn.bind(console),
|
|
1136
1136
|
error: console.error.bind(console)
|
|
1137
1137
|
}, t = T({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1138
1138
|
if (!n) {
|
|
1139
|
-
for (let e of
|
|
1139
|
+
for (let e of On) if (e.match(i[0])) {
|
|
1140
1140
|
n = !0;
|
|
1141
1141
|
try {
|
|
1142
1142
|
e.handle(i, t);
|
|
@@ -1151,7 +1151,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1151
1151
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1152
1152
|
console.warn = e.warn, console.error = e.error;
|
|
1153
1153
|
};
|
|
1154
|
-
},
|
|
1154
|
+
}, An = {
|
|
1155
1155
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1156
1156
|
renderMode: "it picks the server render strategy",
|
|
1157
1157
|
dynamic: "it picks the server render strategy",
|
|
@@ -1162,7 +1162,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1162
1162
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1163
1163
|
interactive: "it decides how much client JS the server ships",
|
|
1164
1164
|
tenantAware: "it is part of the server-side cache key"
|
|
1165
|
-
},
|
|
1165
|
+
}, jn = Object.keys(An), Mn = (e) => n.test(e), Nn = (e) => e.replace(/page\.tsx$/, "page.test.tsx"), Pn = "virtual:voltro-route-refresh", Fn = `\0${Pn}`, In = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, Ln = () => `
|
|
1166
1166
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1167
1167
|
|
|
1168
1168
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1191,11 +1191,11 @@ const stableForm = (value) => {
|
|
|
1191
1191
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1192
1192
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1193
1193
|
* value. Everything else a page exports is plain client-side data. */
|
|
1194
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1194
|
+
const serverRelevantExports = ${JSON.stringify(jn)}
|
|
1195
1195
|
|
|
1196
1196
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1197
1197
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1198
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1198
|
+
const serverExportEffect = ${JSON.stringify(An)}
|
|
1199
1199
|
|
|
1200
1200
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1201
1201
|
export const serverEffectOf = (name) =>
|
|
@@ -1238,7 +1238,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1238
1238
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1239
1239
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1240
1240
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1241
|
-
`,
|
|
1241
|
+
`, Rn = (e) => `
|
|
1242
1242
|
if (import.meta.hot) {
|
|
1243
1243
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1244
1244
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1265,57 +1265,57 @@ import {
|
|
|
1265
1265
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1266
1266
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1267
1267
|
serverEffectOf as __voltro_serverEffect,
|
|
1268
|
-
} from '${
|
|
1269
|
-
`,
|
|
1270
|
-
let [i = "", a] =
|
|
1271
|
-
if (!i.endsWith(".tsx") || a !== void 0 &&
|
|
1272
|
-
let o =
|
|
1268
|
+
} from '${Pn}'
|
|
1269
|
+
`, zn = (e) => e.replace(/\\/g, "/"), Bn = (n, r) => {
|
|
1270
|
+
let [i = "", a] = zn(n).split("?");
|
|
1271
|
+
if (!i.endsWith(".tsx") || a !== void 0 && In.test(a)) return !1;
|
|
1272
|
+
let o = zn(r).replace(/\/$/, "");
|
|
1273
1273
|
return i.startsWith(`${o}/`) ? t.test(i) || e.has(i.slice(i.lastIndexOf("/") + 1)) : !1;
|
|
1274
|
-
},
|
|
1274
|
+
}, Vn = (e, t, n) => Bn(t, n) ? `${e}${Rn(zn(t).split("?")[0] ?? t)}` : null, Hn = (e) => ({
|
|
1275
1275
|
name: "voltro:route-fast-refresh",
|
|
1276
1276
|
enforce: "pre",
|
|
1277
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1278
|
-
load: (e) => e ===
|
|
1277
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? Fn : void 0,
|
|
1278
|
+
load: (e) => e === Fn ? Ln() : void 0,
|
|
1279
1279
|
transform: (t, n, r) => {
|
|
1280
1280
|
if (r?.ssr === !0) return null;
|
|
1281
|
-
let i =
|
|
1281
|
+
let i = Vn(t, n, e);
|
|
1282
1282
|
return i === null ? null : {
|
|
1283
1283
|
code: i,
|
|
1284
1284
|
map: null
|
|
1285
1285
|
};
|
|
1286
1286
|
}
|
|
1287
|
-
}),
|
|
1287
|
+
}), Un = [
|
|
1288
1288
|
"static",
|
|
1289
1289
|
"spa",
|
|
1290
1290
|
"ssr",
|
|
1291
1291
|
"isr"
|
|
1292
|
-
],
|
|
1292
|
+
], Wn = (e) => typeof e == "string" && Un.includes(e), Gn = Un.map((e) => `'${e}'`).join(" | "), Kn = (e, t) => `[voltro] ${e}: unknown renderMode '${t}'.\n Valid values: ${Gn}.${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)." : ""}`, qn = class extends Error {
|
|
1293
1293
|
page;
|
|
1294
1294
|
value;
|
|
1295
1295
|
name = "InvalidRenderModeError";
|
|
1296
1296
|
constructor(e, t) {
|
|
1297
|
-
super(
|
|
1297
|
+
super(Kn(e, t)), this.page = e, this.value = t;
|
|
1298
1298
|
}
|
|
1299
|
-
},
|
|
1299
|
+
}, Jn = (e, t = "<page>") => {
|
|
1300
1300
|
if (e.renderMode !== void 0 && e.renderMode !== null) {
|
|
1301
|
-
if (!
|
|
1301
|
+
if (!Wn(e.renderMode)) throw new qn(t, String(e.renderMode));
|
|
1302
1302
|
return e.renderMode;
|
|
1303
1303
|
}
|
|
1304
1304
|
return e.dynamic === "force-dynamic" ? "ssr" : (e.dynamic, "static");
|
|
1305
|
-
},
|
|
1306
|
-
renderMode:
|
|
1305
|
+
}, Yn = (e, t = "<page>") => ({
|
|
1306
|
+
renderMode: Jn(e, t),
|
|
1307
1307
|
tenantAware: e.tenantAware === !0,
|
|
1308
|
-
revalidateMs:
|
|
1309
|
-
staleWhileRevalidateMs:
|
|
1308
|
+
revalidateMs: K(e.revalidate),
|
|
1309
|
+
staleWhileRevalidateMs: K(e.staleWhileRevalidate) ?? 0,
|
|
1310
1310
|
cacheInvalidatesOn: Array.isArray(e.cacheInvalidatesOn) ? e.cacheInvalidatesOn : [],
|
|
1311
1311
|
interactive: e.interactive ?? "full",
|
|
1312
1312
|
hasLoader: typeof e.loader == "function",
|
|
1313
1313
|
hasMeta: e.meta != null,
|
|
1314
1314
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1315
|
-
}),
|
|
1316
|
-
|
|
1315
|
+
}), Xn = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Zn = (e) => Xn.exec(e)?.[1] ?? null, Qn = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, $n = (e) => {
|
|
1316
|
+
Qn.lastIndex = 0;
|
|
1317
1317
|
let t;
|
|
1318
|
-
for (; (t =
|
|
1318
|
+
for (; (t = Qn.exec(e)) !== null;) {
|
|
1319
1319
|
let e = t[2];
|
|
1320
1320
|
if (e.startsWith(".")) for (let n of t[1].split(",")) {
|
|
1321
1321
|
let t = n.lastIndexOf(" as ");
|
|
@@ -1323,50 +1323,50 @@ import {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
1325
|
return null;
|
|
1326
|
-
},
|
|
1326
|
+
}, er = /export\s*\{([^}]*)\}/g, tr = (e) => {
|
|
1327
1327
|
if (/export\s+default\b/.test(e)) return !0;
|
|
1328
|
-
|
|
1328
|
+
er.lastIndex = 0;
|
|
1329
1329
|
let t;
|
|
1330
|
-
for (; (t =
|
|
1330
|
+
for (; (t = er.exec(e)) !== null;) for (let e of t[1].split(",")) {
|
|
1331
1331
|
let t = e.lastIndexOf(" as ");
|
|
1332
1332
|
if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
|
|
1333
1333
|
}
|
|
1334
1334
|
return !1;
|
|
1335
|
-
},
|
|
1335
|
+
}, nr = async (e, t) => {
|
|
1336
1336
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1337
1337
|
let n;
|
|
1338
1338
|
try {
|
|
1339
|
-
n = await
|
|
1339
|
+
n = await he(f(e, t.file), "utf8");
|
|
1340
1340
|
} catch {
|
|
1341
1341
|
return null;
|
|
1342
1342
|
}
|
|
1343
|
-
let r =
|
|
1344
|
-
return r !== null && !
|
|
1343
|
+
let r = Zn(n);
|
|
1344
|
+
return r !== null && !Wn(r) ? Kn(f("src", "pages", t.file), r) : tr(n) ? null : `${f("src", "pages", t.file)} is a route (a \`page.tsx\` under src/pages/) but exports no default.\n\n A page's default export IS its component — the router has nothing to render without it,\n and the failure would otherwise surface only in \`voltro build\`'s prerender as\n "SSR received a descriptor with no Component", long after the file was written.\n\n Fix: \`export default function Page() { … }\`, or re-export another page's component\n (\`export { default } from '../page'\`). If this file is NOT a route, rename it —\n only the reserved names route, and anything else under src/pages/ is ordinary code\n that may live beside the page that uses it.`;
|
|
1345
1345
|
}))).filter((e) => e !== null);
|
|
1346
1346
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1347
|
-
},
|
|
1347
|
+
}, Y = f(re(), ".voltro", "logs"), rr = () => {
|
|
1348
1348
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1349
1349
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1350
|
-
},
|
|
1351
|
-
if (
|
|
1352
|
-
|
|
1353
|
-
let e = Date.now() -
|
|
1350
|
+
}, ir = !1, ar = () => {
|
|
1351
|
+
if (ir) return;
|
|
1352
|
+
ir = !0;
|
|
1353
|
+
let e = Date.now() - rr(), t = [];
|
|
1354
1354
|
try {
|
|
1355
|
-
t = M(
|
|
1355
|
+
t = M(Y);
|
|
1356
1356
|
} catch {
|
|
1357
1357
|
return;
|
|
1358
1358
|
}
|
|
1359
1359
|
for (let n of t) {
|
|
1360
1360
|
if (!n.endsWith(".log")) continue;
|
|
1361
|
-
let t = f(
|
|
1361
|
+
let t = f(Y, n);
|
|
1362
1362
|
try {
|
|
1363
1363
|
N(t).mtimeMs < e && P(t);
|
|
1364
1364
|
} catch {}
|
|
1365
1365
|
}
|
|
1366
|
-
},
|
|
1367
|
-
let t =
|
|
1366
|
+
}, or = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), sr = (e, t) => f(Y, `${or(e)}-${t}.log`), cr = (e) => {
|
|
1367
|
+
let t = or(e), n = [];
|
|
1368
1368
|
try {
|
|
1369
|
-
n = M(
|
|
1369
|
+
n = M(Y);
|
|
1370
1370
|
} catch {
|
|
1371
1371
|
return;
|
|
1372
1372
|
}
|
|
@@ -1374,19 +1374,19 @@ import {
|
|
|
1374
1374
|
if (r.length === 0) return;
|
|
1375
1375
|
let i, a = -1;
|
|
1376
1376
|
for (let e of r) {
|
|
1377
|
-
let t = f(
|
|
1377
|
+
let t = f(Y, e);
|
|
1378
1378
|
try {
|
|
1379
1379
|
let e = N(t);
|
|
1380
1380
|
e.mtimeMs > a && (a = e.mtimeMs, i = t);
|
|
1381
1381
|
} catch {}
|
|
1382
1382
|
}
|
|
1383
1383
|
return i;
|
|
1384
|
-
},
|
|
1384
|
+
}, lr = (e) => {
|
|
1385
1385
|
try {
|
|
1386
|
-
|
|
1386
|
+
O(Y, { recursive: !0 });
|
|
1387
1387
|
} catch {}
|
|
1388
|
-
|
|
1389
|
-
let t =
|
|
1388
|
+
ar();
|
|
1389
|
+
let t = sr(e, process.pid), n = k(t, "w"), r = (e) => {
|
|
1390
1390
|
let t = {
|
|
1391
1391
|
ts: e.ts.getTime(),
|
|
1392
1392
|
level: e.level,
|
|
@@ -1409,13 +1409,13 @@ import {
|
|
|
1409
1409
|
}
|
|
1410
1410
|
}, i = !1, a = w((e) => {
|
|
1411
1411
|
if (!i) try {
|
|
1412
|
-
|
|
1412
|
+
ne(n, r(e));
|
|
1413
1413
|
} catch {}
|
|
1414
1414
|
}), o = () => {
|
|
1415
1415
|
if (!i) {
|
|
1416
1416
|
i = !0;
|
|
1417
1417
|
try {
|
|
1418
|
-
|
|
1418
|
+
ee(n);
|
|
1419
1419
|
} catch {}
|
|
1420
1420
|
}
|
|
1421
1421
|
};
|
|
@@ -1427,7 +1427,7 @@ import {
|
|
|
1427
1427
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1428
1428
|
}
|
|
1429
1429
|
};
|
|
1430
|
-
},
|
|
1430
|
+
}, ur = async (e, t) => {
|
|
1431
1431
|
let n;
|
|
1432
1432
|
try {
|
|
1433
1433
|
n = await A.readFile(e, "utf8");
|
|
@@ -1441,59 +1441,59 @@ import {
|
|
|
1441
1441
|
i.push(t);
|
|
1442
1442
|
} catch {}
|
|
1443
1443
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1444
|
-
},
|
|
1444
|
+
}, dr = T({ scope: "voltro:dashboard" }), fr = ie(import.meta.url), pr = 5179, mr = (e) => {
|
|
1445
1445
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1446
|
-
if (t &&
|
|
1446
|
+
if (t && D(f(m(t), "app.config.ts"))) return m(t);
|
|
1447
1447
|
try {
|
|
1448
|
-
let e = u(
|
|
1449
|
-
if (
|
|
1448
|
+
let e = u(fr.resolve("@voltro/dashboard/package.json"));
|
|
1449
|
+
if (D(f(e, "app.config.ts"))) return e;
|
|
1450
1450
|
} catch {}
|
|
1451
1451
|
let n = f("voltro-devtools", "apps", "dashboard"), r = m(e);
|
|
1452
1452
|
for (let e = 0; e < 10; e++) {
|
|
1453
1453
|
let e = f(r, n);
|
|
1454
|
-
if (
|
|
1454
|
+
if (D(f(e, "app.config.ts"))) return e;
|
|
1455
1455
|
let t = u(r);
|
|
1456
1456
|
if (t === r) break;
|
|
1457
1457
|
r = t;
|
|
1458
1458
|
}
|
|
1459
1459
|
return null;
|
|
1460
|
-
},
|
|
1461
|
-
let i =
|
|
1460
|
+
}, hr = "VOLTRO_IS_DASHBOARD", gr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1461
|
+
let i = ve({
|
|
1462
1462
|
port: e,
|
|
1463
1463
|
host: t
|
|
1464
1464
|
}), a = !1, o = (e) => {
|
|
1465
1465
|
a || (a = !0, i.destroy(), r(e));
|
|
1466
1466
|
};
|
|
1467
1467
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1468
|
-
}),
|
|
1468
|
+
}), _r = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), vr = () => process.env[hr] === "1", yr = () => process.stdout.isTTY === !0, br = f(re(), ".voltro", "dashboard-launch.lock"), xr = 1e4, Sr = async () => {
|
|
1469
1469
|
try {
|
|
1470
|
-
await A.mkdir(u(
|
|
1471
|
-
let e = await A.open(
|
|
1470
|
+
await A.mkdir(u(br), { recursive: !0 });
|
|
1471
|
+
let e = await A.open(br, "wx");
|
|
1472
1472
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1473
1473
|
} catch {
|
|
1474
1474
|
try {
|
|
1475
|
-
let e = await A.stat(
|
|
1476
|
-
if (Date.now() - e.mtimeMs > xr) return await A.unlink(
|
|
1475
|
+
let e = await A.stat(br);
|
|
1476
|
+
if (Date.now() - e.mtimeMs > xr) return await A.unlink(br).catch(() => void 0), Sr();
|
|
1477
1477
|
} catch {}
|
|
1478
1478
|
return !1;
|
|
1479
1479
|
}
|
|
1480
1480
|
}, Cr = async () => {
|
|
1481
1481
|
try {
|
|
1482
|
-
await A.unlink(
|
|
1482
|
+
await A.unlink(br);
|
|
1483
1483
|
} catch {}
|
|
1484
1484
|
}, wr = async (e) => {
|
|
1485
1485
|
let t = e.port ?? 5179;
|
|
1486
|
-
if (
|
|
1486
|
+
if (_r()) return {
|
|
1487
1487
|
status: "skipped",
|
|
1488
1488
|
reason: "disabled by flag/env",
|
|
1489
1489
|
port: t
|
|
1490
1490
|
};
|
|
1491
|
-
if (
|
|
1491
|
+
if (vr()) return {
|
|
1492
1492
|
status: "skipped",
|
|
1493
1493
|
reason: "this process IS the dashboard",
|
|
1494
1494
|
port: t
|
|
1495
1495
|
};
|
|
1496
|
-
if (!
|
|
1496
|
+
if (!yr()) return {
|
|
1497
1497
|
status: "skipped",
|
|
1498
1498
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1499
1499
|
port: t
|
|
@@ -1503,7 +1503,7 @@ import {
|
|
|
1503
1503
|
reason: "another voltro process is currently launching the dashboard",
|
|
1504
1504
|
port: t
|
|
1505
1505
|
};
|
|
1506
|
-
if (await
|
|
1506
|
+
if (await gr(t)) return await Cr(), {
|
|
1507
1507
|
status: "already-running",
|
|
1508
1508
|
port: t
|
|
1509
1509
|
};
|
|
@@ -1512,7 +1512,7 @@ import {
|
|
|
1512
1512
|
let e = process.argv[1];
|
|
1513
1513
|
n = e && e.endsWith("/src/bin.ts") ? f(u(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
1514
1514
|
}
|
|
1515
|
-
let r =
|
|
1515
|
+
let r = D(f(e.dashboardAppPath, ".framework", "dist", "index.html")), i = r ? "start" : "dev", a = _e(process.execPath, [
|
|
1516
1516
|
n,
|
|
1517
1517
|
i,
|
|
1518
1518
|
e.dashboardAppPath
|
|
@@ -1520,7 +1520,7 @@ import {
|
|
|
1520
1520
|
stdio: "ignore",
|
|
1521
1521
|
env: {
|
|
1522
1522
|
...process.env,
|
|
1523
|
-
[
|
|
1523
|
+
[hr]: "1",
|
|
1524
1524
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1525
1525
|
}
|
|
1526
1526
|
});
|
|
@@ -1528,11 +1528,11 @@ import {
|
|
|
1528
1528
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1529
1529
|
a.kill("SIGTERM");
|
|
1530
1530
|
} catch {}
|
|
1531
|
-
}),
|
|
1531
|
+
}), dr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1532
1532
|
port: t,
|
|
1533
1533
|
mode: i,
|
|
1534
1534
|
prebuilt: r
|
|
1535
|
-
}), r ||
|
|
1535
|
+
}), r || dr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), dr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1536
1536
|
Cr();
|
|
1537
1537
|
}, 4e3).unref(), {
|
|
1538
1538
|
status: "launched",
|
|
@@ -1630,30 +1630,39 @@ import {
|
|
|
1630
1630
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1631
1631
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1632
1632
|
e.prepared.stateScript
|
|
1633
|
-
].filter((e) => e.length > 0).join("\n "), Mr =
|
|
1634
|
-
let t = e.
|
|
1635
|
-
|
|
1633
|
+
].filter((e) => e.length > 0).join("\n "), Mr = (e) => {
|
|
1634
|
+
let t = e.indexOf("?");
|
|
1635
|
+
return t === -1 ? {
|
|
1636
|
+
pathname: e || "/",
|
|
1637
|
+
search: ""
|
|
1638
|
+
} : {
|
|
1639
|
+
pathname: e.slice(0, t) || "/",
|
|
1640
|
+
search: e.slice(t)
|
|
1641
|
+
};
|
|
1642
|
+
}, Nr = "<div id=\"root\"></div>", Pr = "<div id=\"root\">", Fr = "</div>", Ir = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Lr = /\bsrc=["']([^"']+)["']/i, Rr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, zr = (e) => {
|
|
1643
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Ir, (e) => {
|
|
1644
|
+
let r = Lr.exec(e)?.[1];
|
|
1636
1645
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1637
1646
|
});
|
|
1638
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1639
|
-
let i = r.indexOf(
|
|
1640
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1647
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Rr, "<script async$1>"));
|
|
1648
|
+
let i = r.indexOf(Nr);
|
|
1649
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Nr}\` 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.`);
|
|
1641
1650
|
return {
|
|
1642
|
-
head: `${r.slice(0, i)}${
|
|
1643
|
-
tail: `${
|
|
1651
|
+
head: `${r.slice(0, i)}${Pr}`,
|
|
1652
|
+
tail: `${Fr}${r.slice(i + 21)}`,
|
|
1644
1653
|
bootstrapModules: n
|
|
1645
1654
|
};
|
|
1646
|
-
},
|
|
1655
|
+
}, Br = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Vr = (e) => {
|
|
1647
1656
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1648
1657
|
if (s || !o || a === null) return;
|
|
1649
1658
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1650
1659
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1651
|
-
t.flushHeaders?.(), t.write(
|
|
1660
|
+
t.flushHeaders?.(), t.write(Br({
|
|
1652
1661
|
head: n.head,
|
|
1653
1662
|
headInjection: i(a.meta),
|
|
1654
1663
|
htmlLang: r
|
|
1655
1664
|
}));
|
|
1656
|
-
let c = new
|
|
1665
|
+
let c = new ye();
|
|
1657
1666
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
1658
1667
|
t.end(n.tail);
|
|
1659
1668
|
}), a.stream.pipe(c);
|
|
@@ -1678,23 +1687,23 @@ import {
|
|
|
1678
1687
|
return;
|
|
1679
1688
|
}
|
|
1680
1689
|
c();
|
|
1681
|
-
}, X = T({ scope: "voltro:dev:web" }),
|
|
1690
|
+
}, X = T({ scope: "voltro:dev:web" }), Hr = T({ scope: "vite" }), Ur = await (async () => {
|
|
1682
1691
|
try {
|
|
1683
1692
|
let e = f(u(h(import.meta.url)), "..", "package.json"), t = await A.readFile(e, "utf8");
|
|
1684
1693
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1685
1694
|
} catch {
|
|
1686
1695
|
return "0.0.0";
|
|
1687
1696
|
}
|
|
1688
|
-
})(),
|
|
1697
|
+
})(), Wr = async () => {
|
|
1689
1698
|
try {
|
|
1690
1699
|
let e = u(h(import.meta.url)), t = m(e, "..", "..", "devtools");
|
|
1691
|
-
if (
|
|
1700
|
+
if (D(f(t, "package.json"))) return t;
|
|
1692
1701
|
let n = m(e, "..", "..", "..", "devtools");
|
|
1693
|
-
return
|
|
1702
|
+
return D(f(n, "package.json")) ? n : null;
|
|
1694
1703
|
} catch {
|
|
1695
1704
|
return null;
|
|
1696
1705
|
}
|
|
1697
|
-
},
|
|
1706
|
+
}, Gr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1698
1707
|
"",
|
|
1699
1708
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1700
1709
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1704,28 +1713,28 @@ import {
|
|
|
1704
1713
|
" await import('@voltro/devtools/styles.css')",
|
|
1705
1714
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1706
1715
|
"}"
|
|
1707
|
-
],
|
|
1716
|
+
], Kr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], qr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Jr = (e) => e.sentry ? [
|
|
1708
1717
|
"",
|
|
1709
1718
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1710
1719
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1711
1720
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1712
|
-
] : [],
|
|
1721
|
+
] : [], Yr = (e) => e.env ? ["import './env.public'"] : [], Xr = (e) => {
|
|
1713
1722
|
let t = [], n = m(e);
|
|
1714
1723
|
for (;;) {
|
|
1715
|
-
|
|
1724
|
+
D(f(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
1716
1725
|
let e = u(n);
|
|
1717
1726
|
if (e === n) break;
|
|
1718
1727
|
n = e;
|
|
1719
1728
|
}
|
|
1720
1729
|
return t;
|
|
1721
|
-
},
|
|
1730
|
+
}, Zr = Mn, Qr = (e) => {
|
|
1722
1731
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1723
1732
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1724
1733
|
if (t) return `island-${t[1]}`;
|
|
1725
|
-
},
|
|
1726
|
-
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) =>
|
|
1734
|
+
}, $r = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, ei = (e) => e.startsWith("(") && e.endsWith(")"), ti = (e) => e.filter((e) => !ei(e)), ni = (e) => {
|
|
1735
|
+
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !ei(e));
|
|
1727
1736
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
1728
|
-
},
|
|
1737
|
+
}, ri = (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) => {
|
|
1729
1738
|
let r = [], i = [], a = async (n, o) => {
|
|
1730
1739
|
let s = [];
|
|
1731
1740
|
try {
|
|
@@ -1733,17 +1742,17 @@ import {
|
|
|
1733
1742
|
} catch {
|
|
1734
1743
|
return;
|
|
1735
1744
|
}
|
|
1736
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1745
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Zr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
1737
1746
|
if (l.some((t) => e.has(t))) {
|
|
1738
1747
|
let t = u.has("layout.tsx"), r = !1;
|
|
1739
1748
|
if (t) try {
|
|
1740
1749
|
let e = await A.readFile(f(n, "layout.tsx"), "utf8");
|
|
1741
|
-
r =
|
|
1750
|
+
r = $r.test(e);
|
|
1742
1751
|
} catch {}
|
|
1743
1752
|
i.push({
|
|
1744
1753
|
dir: d,
|
|
1745
1754
|
chain: o,
|
|
1746
|
-
contributesToUrl: o.length === 0 ||
|
|
1755
|
+
contributesToUrl: o.length === 0 || !ei(o[o.length - 1]),
|
|
1747
1756
|
hasLayout: t,
|
|
1748
1757
|
hasLayoutLoader: r,
|
|
1749
1758
|
hasError: u.has("error.tsx"),
|
|
@@ -1757,8 +1766,8 @@ import {
|
|
|
1757
1766
|
let n = d ? `${d}/${e}` : e;
|
|
1758
1767
|
r.push({
|
|
1759
1768
|
file: n,
|
|
1760
|
-
pattern:
|
|
1761
|
-
ident:
|
|
1769
|
+
pattern: ni(n),
|
|
1770
|
+
ident: ri(n),
|
|
1762
1771
|
dirChain: o
|
|
1763
1772
|
});
|
|
1764
1773
|
}
|
|
@@ -1777,14 +1786,14 @@ import {
|
|
|
1777
1786
|
dirs: s,
|
|
1778
1787
|
orphanedSpecials: c
|
|
1779
1788
|
};
|
|
1780
|
-
},
|
|
1789
|
+
}, ii = (e, t) => {
|
|
1781
1790
|
let n = [];
|
|
1782
1791
|
for (let r = 0; r <= t.length; r++) {
|
|
1783
1792
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1784
1793
|
a && n.push(a);
|
|
1785
1794
|
}
|
|
1786
1795
|
return n;
|
|
1787
|
-
},
|
|
1796
|
+
}, ai = async (e) => {
|
|
1788
1797
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1789
1798
|
return {
|
|
1790
1799
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1794,6 +1803,7 @@ import {
|
|
|
1794
1803
|
s.Layout = r.default, typeof r.loader == "function" && (s.loader = r.loader, o[t] = await r.loader({
|
|
1795
1804
|
params: a.params,
|
|
1796
1805
|
pathname: a.pathname,
|
|
1806
|
+
search: a.search,
|
|
1797
1807
|
signal: a.signal,
|
|
1798
1808
|
headers: a.headers,
|
|
1799
1809
|
query: a.query
|
|
@@ -1806,10 +1816,10 @@ import {
|
|
|
1806
1816
|
})),
|
|
1807
1817
|
segmentLoaderData: o
|
|
1808
1818
|
};
|
|
1809
|
-
},
|
|
1810
|
-
let t =
|
|
1819
|
+
}, oi = (e) => {
|
|
1820
|
+
let t = ti(e);
|
|
1811
1821
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1812
|
-
},
|
|
1822
|
+
}, si = [
|
|
1813
1823
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1814
1824
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1815
1825
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1902,7 +1912,7 @@ import {
|
|
|
1902
1912
|
" _vdtErrorStart('Build error')",
|
|
1903
1913
|
" })",
|
|
1904
1914
|
"}"
|
|
1905
|
-
].join("\n"),
|
|
1915
|
+
].join("\n"), ci = (e) => {
|
|
1906
1916
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1907
1917
|
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, "\\$&"));
|
|
1908
1918
|
let a = i.join("/");
|
|
@@ -1911,8 +1921,8 @@ import {
|
|
|
1911
1921
|
paramNames: t,
|
|
1912
1922
|
priority: n
|
|
1913
1923
|
};
|
|
1914
|
-
},
|
|
1915
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1924
|
+
}, li = (e) => e.map((e) => {
|
|
1925
|
+
let { regex: t, paramNames: n, priority: r } = ci(e.pattern);
|
|
1916
1926
|
return {
|
|
1917
1927
|
pattern: e.pattern,
|
|
1918
1928
|
file: e.file,
|
|
@@ -1921,7 +1931,7 @@ import {
|
|
|
1921
1931
|
paramNames: n,
|
|
1922
1932
|
priority: r
|
|
1923
1933
|
};
|
|
1924
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1934
|
+
}).slice().sort((e, t) => e.priority - t.priority), ui = (e, t) => {
|
|
1925
1935
|
for (let n of t) {
|
|
1926
1936
|
let t = n.regex.exec(e);
|
|
1927
1937
|
if (!t) continue;
|
|
@@ -1933,7 +1943,7 @@ import {
|
|
|
1933
1943
|
};
|
|
1934
1944
|
}
|
|
1935
1945
|
return null;
|
|
1936
|
-
},
|
|
1946
|
+
}, di = async (e, t) => {
|
|
1937
1947
|
let n = e;
|
|
1938
1948
|
for (;;) {
|
|
1939
1949
|
let e = f(n, "node_modules", t);
|
|
@@ -1947,7 +1957,7 @@ import {
|
|
|
1947
1957
|
if (r === n) return null;
|
|
1948
1958
|
n = r;
|
|
1949
1959
|
}
|
|
1950
|
-
},
|
|
1960
|
+
}, fi = async (e) => {
|
|
1951
1961
|
try {
|
|
1952
1962
|
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;
|
|
1953
1963
|
return a ? {
|
|
@@ -1956,7 +1966,7 @@ import {
|
|
|
1956
1966
|
} : { port: r };
|
|
1957
1967
|
} catch {}
|
|
1958
1968
|
return { port: 4e3 };
|
|
1959
|
-
},
|
|
1969
|
+
}, pi = (e, t) => ({
|
|
1960
1970
|
name: e,
|
|
1961
1971
|
pkg: t.package,
|
|
1962
1972
|
browserWsUrl: t.url,
|
|
@@ -1964,7 +1974,7 @@ import {
|
|
|
1964
1974
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1965
1975
|
...t.headers ? { headers: t.headers } : {},
|
|
1966
1976
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1967
|
-
}),
|
|
1977
|
+
}), mi = (e, t, n) => {
|
|
1968
1978
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1969
1979
|
return {
|
|
1970
1980
|
name: e,
|
|
@@ -1976,7 +1986,7 @@ import {
|
|
|
1976
1986
|
...t.headers ? { headers: t.headers } : {},
|
|
1977
1987
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1978
1988
|
};
|
|
1979
|
-
},
|
|
1989
|
+
}, hi = (e) => {
|
|
1980
1990
|
let t = /* @__PURE__ */ new Map();
|
|
1981
1991
|
for (let n of e) {
|
|
1982
1992
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1984,43 +1994,43 @@ import {
|
|
|
1984
1994
|
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>.`);
|
|
1985
1995
|
t.set(n.browserWsUrl, n.name);
|
|
1986
1996
|
}
|
|
1987
|
-
},
|
|
1997
|
+
}, gi = async (e, t) => {
|
|
1988
1998
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1989
1999
|
for (let [t, i] of n) {
|
|
1990
2000
|
if (i.url) {
|
|
1991
|
-
r.push(
|
|
2001
|
+
r.push(pi(t, i));
|
|
1992
2002
|
continue;
|
|
1993
2003
|
}
|
|
1994
|
-
let n = await
|
|
2004
|
+
let n = await di(e, i.package);
|
|
1995
2005
|
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.`);
|
|
1996
|
-
r.push(
|
|
2006
|
+
r.push(mi(t, i, await fi(n)));
|
|
1997
2007
|
}
|
|
1998
|
-
return
|
|
1999
|
-
},
|
|
2008
|
+
return hi(r), r;
|
|
2009
|
+
}, _i = (e) => {
|
|
2000
2010
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
2001
2011
|
let t = new URL(e);
|
|
2002
2012
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
2003
2013
|
} catch {
|
|
2004
2014
|
return;
|
|
2005
2015
|
}
|
|
2006
|
-
},
|
|
2016
|
+
}, vi = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, yi = (e) => process.env[vi(e)] ?? process.env.VOLTRO_API_ORIGIN, bi = (e, t) => {
|
|
2007
2017
|
if (!e) return;
|
|
2008
|
-
let n =
|
|
2018
|
+
let n = yi(e.name) ?? e.serverOrigin;
|
|
2009
2019
|
if (n) {
|
|
2010
|
-
let e =
|
|
2020
|
+
let e = _i(n);
|
|
2011
2021
|
if (e) return e;
|
|
2012
2022
|
}
|
|
2013
2023
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
2014
|
-
let t =
|
|
2024
|
+
let t = _i(e.proxyTarget);
|
|
2015
2025
|
if (t) return t;
|
|
2016
2026
|
}
|
|
2017
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
2018
|
-
},
|
|
2027
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return _i(e.browserWsUrl);
|
|
2028
|
+
}, xi = (e, t, n) => {
|
|
2019
2029
|
if (!e) {
|
|
2020
2030
|
if (n?.apiName === void 0) return;
|
|
2021
2031
|
let e = n.apiName;
|
|
2022
2032
|
return async () => {
|
|
2023
|
-
throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${
|
|
2033
|
+
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 ${vi(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.`);
|
|
2024
2034
|
};
|
|
2025
2035
|
}
|
|
2026
2036
|
return async (r, i) => {
|
|
@@ -2042,7 +2052,7 @@ import {
|
|
|
2042
2052
|
});
|
|
2043
2053
|
} catch (t) {
|
|
2044
2054
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2045
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2055
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${vi(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 });
|
|
2046
2056
|
}
|
|
2047
2057
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2048
2058
|
let s = await o.json();
|
|
@@ -2061,7 +2071,7 @@ import {
|
|
|
2061
2071
|
if (u) return l;
|
|
2062
2072
|
};
|
|
2063
2073
|
}, $ = async (e, t, n, r = {}) => {
|
|
2064
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o =
|
|
2074
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = D(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await Wr() !== null, s = t.theme === "system" ? [
|
|
2065
2075
|
" <script>",
|
|
2066
2076
|
" (function () {",
|
|
2067
2077
|
" var root = document.documentElement",
|
|
@@ -2100,7 +2110,7 @@ import {
|
|
|
2100
2110
|
"</html>",
|
|
2101
2111
|
""
|
|
2102
2112
|
].join("\n"), l = f(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: p } = await Q(l);
|
|
2103
|
-
await
|
|
2113
|
+
await nr(l, u);
|
|
2104
2114
|
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.`);
|
|
2105
2115
|
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'`);
|
|
2106
2116
|
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"));
|
|
@@ -2115,13 +2125,13 @@ import {
|
|
|
2115
2125
|
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'`);
|
|
2116
2126
|
}
|
|
2117
2127
|
let r = u.map((e) => {
|
|
2118
|
-
let t =
|
|
2128
|
+
let t = ii(d, e.dirChain).map((e) => {
|
|
2119
2129
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2120
2130
|
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(", ")} }`;
|
|
2121
2131
|
}).join(",\n");
|
|
2122
2132
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2123
2133
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2124
|
-
let t =
|
|
2134
|
+
let t = oi(e.chain), n = ii(d, e.chain).map((e) => {
|
|
2125
2135
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2126
2136
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2127
2137
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2360,14 +2370,14 @@ import {
|
|
|
2360
2370
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2361
2371
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2362
2372
|
"",
|
|
2363
|
-
...
|
|
2373
|
+
...Yr(t),
|
|
2364
2374
|
"import { mount } from '@voltro/web'",
|
|
2365
2375
|
...g,
|
|
2366
2376
|
"import { App } from './app'",
|
|
2367
2377
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2368
|
-
...Kr(t),
|
|
2369
|
-
...Wr(t, o),
|
|
2370
2378
|
...qr(t),
|
|
2379
|
+
...Gr(t, o),
|
|
2380
|
+
...Jr(t),
|
|
2371
2381
|
"",
|
|
2372
2382
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2373
2383
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2384,10 +2394,10 @@ import {
|
|
|
2384
2394
|
" apis: {",
|
|
2385
2395
|
..._,
|
|
2386
2396
|
" },",
|
|
2387
|
-
...
|
|
2397
|
+
...Kr(t, o),
|
|
2388
2398
|
"})",
|
|
2389
2399
|
"",
|
|
2390
|
-
|
|
2400
|
+
si
|
|
2391
2401
|
].join("\n");
|
|
2392
2402
|
} else v = "", y = "", b = [
|
|
2393
2403
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2395,25 +2405,25 @@ import {
|
|
|
2395
2405
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2396
2406
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2397
2407
|
"",
|
|
2398
|
-
...
|
|
2408
|
+
...Yr(t),
|
|
2399
2409
|
"import { mount } from '@voltro/web'",
|
|
2400
2410
|
...g,
|
|
2401
2411
|
"import App from '../src/App'",
|
|
2402
|
-
...Kr(t),
|
|
2403
|
-
...Wr(t, o),
|
|
2404
2412
|
...qr(t),
|
|
2413
|
+
...Gr(t, o),
|
|
2414
|
+
...Jr(t),
|
|
2405
2415
|
"",
|
|
2406
2416
|
"mount(App, {",
|
|
2407
2417
|
" apis: {",
|
|
2408
2418
|
..._,
|
|
2409
2419
|
" },",
|
|
2410
|
-
...
|
|
2420
|
+
...Kr(t, o),
|
|
2411
2421
|
"})",
|
|
2412
2422
|
"",
|
|
2413
|
-
|
|
2423
|
+
si
|
|
2414
2424
|
].join("\n");
|
|
2415
2425
|
let x = f(e, ".framework");
|
|
2416
|
-
await A.mkdir(x, { recursive: !0 }), t.env ? await
|
|
2426
|
+
await A.mkdir(x, { recursive: !0 }), t.env ? await mt(x, r) : await A.rm(f(x, "env.public.ts"), { force: !0 }), await A.writeFile(f(x, "index.html"), c, "utf8"), await A.writeFile(f(x, "main.tsx"), b, "utf8"), v ? (await A.writeFile(f(x, "app.tsx"), v, "utf8"), await A.writeFile(f(x, "routeTable.ts"), y, "utf8")) : (await A.rm(f(x, "app.tsx"), { force: !0 }), await A.rm(f(x, "routeTable.ts"), { force: !0 }));
|
|
2417
2427
|
let S = f(e, ".gitignore"), C = "";
|
|
2418
2428
|
try {
|
|
2419
2429
|
C = await A.readFile(S, "utf8");
|
|
@@ -2427,10 +2437,10 @@ import {
|
|
|
2427
2437
|
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) });
|
|
2428
2438
|
}
|
|
2429
2439
|
}
|
|
2430
|
-
},
|
|
2440
|
+
}, Si = async (e, t) => {
|
|
2431
2441
|
try {
|
|
2432
2442
|
let n = f(u(e), "project.json");
|
|
2433
|
-
if (!
|
|
2443
|
+
if (!D(n)) return;
|
|
2434
2444
|
let r = await A.readFile(n, "utf8"), i = JSON.parse(r).apps ?? {}, a = e.split("/").filter(Boolean).pop() ?? "", o = [];
|
|
2435
2445
|
for (let [e, n] of Object.entries(i)) e !== a && n.port === t && o.push(e);
|
|
2436
2446
|
if (o.length === 0) return;
|
|
@@ -2440,36 +2450,36 @@ import {
|
|
|
2440
2450
|
projectJson: n
|
|
2441
2451
|
});
|
|
2442
2452
|
} catch {}
|
|
2443
|
-
},
|
|
2444
|
-
let t =
|
|
2453
|
+
}, Ci = (e) => f(e, ".framework", "dist", "server", "appConfig.js"), wi = async (e) => {
|
|
2454
|
+
let t = Ci(e), n = D(t) ? t : f(e, "app.config.ts");
|
|
2445
2455
|
try {
|
|
2446
2456
|
let e = (await import(g(n).href)).default;
|
|
2447
2457
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2448
2458
|
} catch {
|
|
2449
2459
|
return null;
|
|
2450
2460
|
}
|
|
2451
|
-
},
|
|
2452
|
-
let t = await
|
|
2461
|
+
}, Ti = async (e) => {
|
|
2462
|
+
let t = await wi(e);
|
|
2453
2463
|
if (!t) return {
|
|
2454
2464
|
ran: !1,
|
|
2455
2465
|
exitCode: 0
|
|
2456
2466
|
};
|
|
2457
|
-
|
|
2458
|
-
let n =
|
|
2459
|
-
|
|
2460
|
-
let u = await
|
|
2467
|
+
kn();
|
|
2468
|
+
let n = Zt();
|
|
2469
|
+
cn(n), X.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2470
|
+
let u = await gi(e, t);
|
|
2461
2471
|
for (let e of u) X.info("api wired", {
|
|
2462
2472
|
name: e.name,
|
|
2463
2473
|
pkg: e.pkg,
|
|
2464
2474
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
2465
2475
|
});
|
|
2466
|
-
|
|
2476
|
+
We(e).then((e) => {
|
|
2467
2477
|
for (let t of e.files) if (t.action === "created") {
|
|
2468
2478
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2469
2479
|
X.info(`${e} seeded`, { path: t.path });
|
|
2470
2480
|
}
|
|
2471
2481
|
}).catch(() => {});
|
|
2472
|
-
let { resolved: d } = await
|
|
2482
|
+
let { resolved: d } = await ht({
|
|
2473
2483
|
rawEnv: t.env,
|
|
2474
2484
|
appType: "web",
|
|
2475
2485
|
root: e,
|
|
@@ -2481,8 +2491,8 @@ import {
|
|
|
2481
2491
|
".framework/main.tsx",
|
|
2482
2492
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2483
2493
|
] });
|
|
2484
|
-
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 =
|
|
2485
|
-
await
|
|
2494
|
+
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 = it("web", _, g), y = lr(_);
|
|
2495
|
+
await nt({
|
|
2486
2496
|
id: v,
|
|
2487
2497
|
name: _,
|
|
2488
2498
|
kind: "web",
|
|
@@ -2490,22 +2500,22 @@ import {
|
|
|
2490
2500
|
pid: process.pid,
|
|
2491
2501
|
status: "booting",
|
|
2492
2502
|
logFile: y.path
|
|
2493
|
-
}).catch(() => {}), await
|
|
2503
|
+
}).catch(() => {}), await Si(e, g);
|
|
2494
2504
|
let { pages: b, dirs: x } = await Q(f(e, "src", "pages")), S = {
|
|
2495
2505
|
dirs: x,
|
|
2496
|
-
ssrRoutes:
|
|
2506
|
+
ssrRoutes: li(b)
|
|
2497
2507
|
}, C = x.map((e) => ({
|
|
2498
2508
|
dir: e.dir,
|
|
2499
2509
|
hasLayout: e.hasLayout,
|
|
2500
2510
|
hasError: e.hasError,
|
|
2501
2511
|
hasPending: e.hasPending,
|
|
2502
2512
|
hasNotFound: e.hasNotFound
|
|
2503
|
-
})), w = await
|
|
2513
|
+
})), w = await Yt({
|
|
2504
2514
|
appRoot: e,
|
|
2505
2515
|
pages: b
|
|
2506
2516
|
});
|
|
2507
2517
|
w.wrote && X.debug("routes codegen wrote", { path: p(e, w.path) });
|
|
2508
|
-
let T = await
|
|
2518
|
+
let T = await ct("vite", () => import("vite")), ee = (await import("@vitejs/plugin-react")).default, O = (await import("@tailwindcss/vite")).default, k = f(e, ".framework"), j = f(e, "src"), M = /* @__PURE__ */ new Set([
|
|
2509
2519
|
".framework",
|
|
2510
2520
|
"node_modules",
|
|
2511
2521
|
"dist",
|
|
@@ -2529,7 +2539,7 @@ import {
|
|
|
2529
2539
|
...r.devDependencies
|
|
2530
2540
|
});
|
|
2531
2541
|
await Promise.all(i.map(async (n) => {
|
|
2532
|
-
let r = await
|
|
2542
|
+
let r = await di(e, n);
|
|
2533
2543
|
if (!r) return;
|
|
2534
2544
|
let i = f(r, "src");
|
|
2535
2545
|
try {
|
|
@@ -2538,15 +2548,15 @@ import {
|
|
|
2538
2548
|
}));
|
|
2539
2549
|
} catch {}
|
|
2540
2550
|
}
|
|
2541
|
-
}, P = f(e, "src", "pages"),
|
|
2551
|
+
}, P = f(e, "src", "pages"), te = (e) => e.endsWith(".tsx") && (e === P || e.startsWith(P + "/")), F = (e) => e === P || e.startsWith(P + "/"), ne = async (n) => {
|
|
2542
2552
|
try {
|
|
2543
2553
|
let r = Date.now();
|
|
2544
2554
|
await $(e, t, u, h);
|
|
2545
2555
|
let { pages: i, dirs: a } = await Q(P);
|
|
2546
|
-
await
|
|
2556
|
+
await Yt({
|
|
2547
2557
|
appRoot: e,
|
|
2548
2558
|
pages: i
|
|
2549
|
-
}), S.dirs = a, S.ssrRoutes =
|
|
2559
|
+
}), S.dirs = a, S.ssrRoutes = li(i), X.info("page tree regenerated", {
|
|
2550
2560
|
reason: n,
|
|
2551
2561
|
ms: Date.now() - r,
|
|
2552
2562
|
routes: S.ssrRoutes.length
|
|
@@ -2554,34 +2564,34 @@ import {
|
|
|
2554
2564
|
} catch (e) {
|
|
2555
2565
|
X.error("page tree regen failed", { reason: n }, e);
|
|
2556
2566
|
}
|
|
2557
|
-
},
|
|
2567
|
+
}, I = {
|
|
2558
2568
|
name: "framework:regenerate-on-page-tree-change",
|
|
2559
2569
|
configureServer(t) {
|
|
2560
2570
|
let n = null, r = [], i = (e) => {
|
|
2561
2571
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
2562
2572
|
n = null;
|
|
2563
2573
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
2564
|
-
r.length = 0,
|
|
2574
|
+
r.length = 0, ne(e);
|
|
2565
2575
|
}, 50);
|
|
2566
2576
|
};
|
|
2567
2577
|
t.watcher.on("add", (t) => {
|
|
2568
|
-
|
|
2578
|
+
te(t) && i(`add ${p(e, t)}`);
|
|
2569
2579
|
}), t.watcher.on("unlink", (t) => {
|
|
2570
|
-
|
|
2580
|
+
te(t) && i(`unlink ${p(e, t)}`);
|
|
2571
2581
|
}), t.watcher.on("addDir", (t) => {
|
|
2572
|
-
|
|
2582
|
+
F(t) && i(`addDir ${p(e, t)}`);
|
|
2573
2583
|
}), t.watcher.on("unlinkDir", (t) => {
|
|
2574
|
-
|
|
2584
|
+
F(t) && i(`unlinkDir ${p(e, t)}`);
|
|
2575
2585
|
});
|
|
2576
2586
|
}
|
|
2577
|
-
}, L = f(e, "app.config.ts"),
|
|
2578
|
-
if (!
|
|
2587
|
+
}, L = f(e, "app.config.ts"), R = (e) => {
|
|
2588
|
+
if (!ue(e.env)) return "";
|
|
2579
2589
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
2580
2590
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
2581
|
-
},
|
|
2591
|
+
}, re = (e, t) => {
|
|
2582
2592
|
let n = [];
|
|
2583
|
-
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"),
|
|
2584
|
-
},
|
|
2593
|
+
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"), R(e) !== R(t) && n.push("env"), n;
|
|
2594
|
+
}, ie = t, ae = m(L), oe = {
|
|
2585
2595
|
name: "framework:watch-app-config",
|
|
2586
2596
|
async configureServer(t) {
|
|
2587
2597
|
t.watcher.add(L), X.info("watching app.config.ts for changes", { path: p(e, L) });
|
|
@@ -2610,17 +2620,17 @@ import {
|
|
|
2610
2620
|
theme: r.theme,
|
|
2611
2621
|
port: r.port,
|
|
2612
2622
|
name: r.name
|
|
2613
|
-
}), JSON.stringify(r) === JSON.stringify(
|
|
2623
|
+
}), JSON.stringify(r) === JSON.stringify(ie)) {
|
|
2614
2624
|
X.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2615
2625
|
return;
|
|
2616
2626
|
}
|
|
2617
|
-
let i = ie
|
|
2627
|
+
let i = re(ie, r);
|
|
2618
2628
|
if (i.length > 0) {
|
|
2619
2629
|
X.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
2620
2630
|
try {
|
|
2621
2631
|
await t.close();
|
|
2622
2632
|
} catch {}
|
|
2623
|
-
let e =
|
|
2633
|
+
let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
2624
2634
|
stdio: "inherit",
|
|
2625
2635
|
env: process.env,
|
|
2626
2636
|
cwd: process.cwd()
|
|
@@ -2636,7 +2646,7 @@ import {
|
|
|
2636
2646
|
}
|
|
2637
2647
|
try {
|
|
2638
2648
|
let n = Date.now();
|
|
2639
|
-
await $(e, r, await
|
|
2649
|
+
await $(e, r, await gi(e, r)), ie = r, t.ws && t.ws.send({
|
|
2640
2650
|
type: "full-reload",
|
|
2641
2651
|
path: "*"
|
|
2642
2652
|
}), X.info("app.config.ts soft-regen", {
|
|
@@ -2646,7 +2656,7 @@ import {
|
|
|
2646
2656
|
} catch (e) {
|
|
2647
2657
|
X.error("app.config.ts soft-regen failed", {}, e);
|
|
2648
2658
|
}
|
|
2649
|
-
}, o = (e) => l(e) === "app.config.ts" ? e === L || m(e) ===
|
|
2659
|
+
}, o = (e) => l(e) === "app.config.ts" ? e === L || m(e) === ae : !1;
|
|
2650
2660
|
t.watcher.on("change", (e) => {
|
|
2651
2661
|
o(e) && (X.info("app.config.ts change event (chokidar)", { file: e }), i());
|
|
2652
2662
|
}), t.watcher.on("add", (e) => {
|
|
@@ -2660,23 +2670,23 @@ import {
|
|
|
2660
2670
|
} catch (e) {
|
|
2661
2671
|
X.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
2662
2672
|
}
|
|
2663
|
-
|
|
2673
|
+
Ot(Tt, X, {
|
|
2664
2674
|
root: e,
|
|
2665
2675
|
onBeforeRestart: () => t.close()
|
|
2666
2676
|
});
|
|
2667
2677
|
}
|
|
2668
|
-
},
|
|
2678
|
+
}, se = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, ce = {
|
|
2669
2679
|
name: "framework:suppress-api-hmr",
|
|
2670
2680
|
handleHotUpdate(e) {
|
|
2671
|
-
if (
|
|
2681
|
+
if (se.test(e.file)) return [];
|
|
2672
2682
|
}
|
|
2673
|
-
},
|
|
2683
|
+
}, le = {
|
|
2674
2684
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
2675
2685
|
async configureServer(t) {
|
|
2676
2686
|
let n = /* @__PURE__ */ new Map();
|
|
2677
2687
|
for (let r of u) {
|
|
2678
2688
|
if (!r.proxyTarget) continue;
|
|
2679
|
-
let i = await
|
|
2689
|
+
let i = await di(e, r.pkg);
|
|
2680
2690
|
if (!i) continue;
|
|
2681
2691
|
let a = f(i, "rpcGroup.generated.ts");
|
|
2682
2692
|
try {
|
|
@@ -2719,9 +2729,9 @@ import {
|
|
|
2719
2729
|
};
|
|
2720
2730
|
t.watcher.on("change", o), t.watcher.on("add", o);
|
|
2721
2731
|
}
|
|
2722
|
-
},
|
|
2732
|
+
}, z = {}, de = (e) => (t) => {
|
|
2723
2733
|
t.on("proxyReq", (t, n) => {
|
|
2724
|
-
|
|
2734
|
+
Dn(t, n, {
|
|
2725
2735
|
target: e,
|
|
2726
2736
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
2727
2737
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
@@ -2731,26 +2741,26 @@ import {
|
|
|
2731
2741
|
};
|
|
2732
2742
|
for (let e of u) {
|
|
2733
2743
|
if (!e.proxyTarget) continue;
|
|
2734
|
-
|
|
2744
|
+
z[e.browserWsUrl] = {
|
|
2735
2745
|
target: e.proxyTarget,
|
|
2736
2746
|
ws: !0,
|
|
2737
2747
|
changeOrigin: !0,
|
|
2738
2748
|
...e.wsPath ? {} : { rewrite: () => "/ws" }
|
|
2739
2749
|
};
|
|
2740
2750
|
let t = e.proxyTarget.replace(/^ws/, "http");
|
|
2741
|
-
|
|
2751
|
+
z[`/_voltro/api/${e.name}`] = {
|
|
2742
2752
|
target: t,
|
|
2743
2753
|
changeOrigin: !0,
|
|
2744
2754
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
2745
|
-
configure:
|
|
2755
|
+
configure: de(t)
|
|
2746
2756
|
};
|
|
2747
2757
|
}
|
|
2748
2758
|
for (let [e, n] of Object.entries(t.proxies ?? {})) {
|
|
2749
|
-
if (
|
|
2759
|
+
if (z[e]) {
|
|
2750
2760
|
X.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
2751
2761
|
continue;
|
|
2752
2762
|
}
|
|
2753
|
-
|
|
2763
|
+
z[e] = {
|
|
2754
2764
|
target: n.target,
|
|
2755
2765
|
changeOrigin: n.changeOrigin ?? !0,
|
|
2756
2766
|
...n.rewrite === void 0 ? {} : { rewrite: (t) => t.replace(RegExp(`^${e}`), n.rewrite) }
|
|
@@ -2760,7 +2770,7 @@ import {
|
|
|
2760
2770
|
...n.rewrite === void 0 ? {} : { rewrite: n.rewrite }
|
|
2761
2771
|
});
|
|
2762
2772
|
}
|
|
2763
|
-
let
|
|
2773
|
+
let fe = {
|
|
2764
2774
|
name: "framework:inspect",
|
|
2765
2775
|
configureServer(l) {
|
|
2766
2776
|
let u = null, d = async () => {
|
|
@@ -2772,11 +2782,11 @@ import {
|
|
|
2772
2782
|
pattern: n.pattern,
|
|
2773
2783
|
file: n.file,
|
|
2774
2784
|
dirChain: n.dirChain,
|
|
2775
|
-
renderMode:
|
|
2785
|
+
renderMode: Jn(r, f("src", "pages", n.file)),
|
|
2776
2786
|
interactive: r.interactive ?? "full",
|
|
2777
2787
|
tenantAware: r.tenantAware === !0,
|
|
2778
|
-
revalidateMs:
|
|
2779
|
-
staleWhileRevalidateMs:
|
|
2788
|
+
revalidateMs: K(r.revalidate),
|
|
2789
|
+
staleWhileRevalidateMs: K(r.staleWhileRevalidate) ?? 0,
|
|
2780
2790
|
cacheInvalidatesOn: Array.isArray(r.cacheInvalidatesOn) ? r.cacheInvalidatesOn : [],
|
|
2781
2791
|
hasLoader: typeof r.loader == "function",
|
|
2782
2792
|
hasMeta: r.meta != null,
|
|
@@ -2891,7 +2901,7 @@ import {
|
|
|
2891
2901
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (u[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
2892
2902
|
let f = l.split("?")[0];
|
|
2893
2903
|
if (e.method === "GET" && (f === "/_voltro/inspect/logs" || l.startsWith("/_voltro/inspect/logs?"))) {
|
|
2894
|
-
let e = c(u.origin), t =
|
|
2904
|
+
let e = c(u.origin), t = xn(l, on(), u);
|
|
2895
2905
|
r.statusCode = t.status, r.setHeader("content-type", t.contentType);
|
|
2896
2906
|
for (let [t, n] of Object.entries(e)) r.setHeader(t, n);
|
|
2897
2907
|
r.end(t.body);
|
|
@@ -2909,7 +2919,7 @@ import {
|
|
|
2909
2919
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
2910
2920
|
a += e;
|
|
2911
2921
|
}), e.on("end", () => {
|
|
2912
|
-
let e =
|
|
2922
|
+
let e = hn(a, n);
|
|
2913
2923
|
r.statusCode = e.status, r.setHeader("content-type", e.contentType);
|
|
2914
2924
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2915
2925
|
r.end(e.body);
|
|
@@ -2940,14 +2950,14 @@ import {
|
|
|
2940
2950
|
for (let [e, n] of Object.entries(t)) r.setHeader(e, n);
|
|
2941
2951
|
r.flushHeaders?.(), r.write("retry: 5000\n\n");
|
|
2942
2952
|
let s = l.indexOf("?");
|
|
2943
|
-
if (!(s !== -1 && new URLSearchParams(l.slice(s + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(
|
|
2953
|
+
if (!(s !== -1 && new URLSearchParams(l.slice(s + 1)).get("live") === "1")) for (let e of n.buffered()) r.write(Qt(e));
|
|
2944
2954
|
let d = n.subscribe((e) => {
|
|
2945
2955
|
try {
|
|
2946
|
-
r.write(
|
|
2956
|
+
r.write(Qt(e));
|
|
2947
2957
|
} catch {}
|
|
2948
2958
|
}), f = setInterval(() => {
|
|
2949
2959
|
try {
|
|
2950
|
-
r.write(
|
|
2960
|
+
r.write($t());
|
|
2951
2961
|
} catch {}
|
|
2952
2962
|
}, 15e3), p = () => {
|
|
2953
2963
|
clearInterval(f), d();
|
|
@@ -2960,7 +2970,7 @@ import {
|
|
|
2960
2970
|
kind: "web",
|
|
2961
2971
|
meta: {
|
|
2962
2972
|
name: t.name ?? "(unnamed)",
|
|
2963
|
-
voltroVersion:
|
|
2973
|
+
voltroVersion: Ur,
|
|
2964
2974
|
port: g,
|
|
2965
2975
|
mode: "dev",
|
|
2966
2976
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -2978,7 +2988,7 @@ import {
|
|
|
2978
2988
|
size: 0,
|
|
2979
2989
|
entries: []
|
|
2980
2990
|
}),
|
|
2981
|
-
env: () =>
|
|
2991
|
+
env: () => _t(t.name ?? "app", { contract: ue(t.env) ? t.env : void 0 })
|
|
2982
2992
|
}, u, { method: e.method ?? "GET" });
|
|
2983
2993
|
if (n === null) return a();
|
|
2984
2994
|
r.statusCode = n.status, r.setHeader("content-type", n.contentType);
|
|
@@ -2989,20 +2999,20 @@ import {
|
|
|
2989
2999
|
}
|
|
2990
3000
|
});
|
|
2991
3001
|
}
|
|
2992
|
-
},
|
|
3002
|
+
}, pe = t.name === "voltroDashboard" ? {
|
|
2993
3003
|
name: "framework:dashboard-registry",
|
|
2994
3004
|
configureServer(e) {
|
|
2995
3005
|
e.middlewares.use(async (e, t, n) => {
|
|
2996
3006
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
2997
3007
|
try {
|
|
2998
|
-
let e = await
|
|
3008
|
+
let e = await tt();
|
|
2999
3009
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
3000
3010
|
} catch (e) {
|
|
3001
3011
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
3002
3012
|
}
|
|
3003
3013
|
});
|
|
3004
3014
|
}
|
|
3005
|
-
} : null,
|
|
3015
|
+
} : null, me = /* @__PURE__ */ new Set(), he = (e, t, n, r, i) => {
|
|
3006
3016
|
if (X.error(`${t} render failed`, {
|
|
3007
3017
|
pathname: n,
|
|
3008
3018
|
pattern: r
|
|
@@ -3016,8 +3026,8 @@ import {
|
|
|
3016
3026
|
});
|
|
3017
3027
|
let a = i instanceof Error ? i.stack ?? i.message : String(i);
|
|
3018
3028
|
e.end(`${t} render failed for ${n}\n\n${a}\n`);
|
|
3019
|
-
},
|
|
3020
|
-
limit:
|
|
3029
|
+
}, B = Lt(), ve = zt({
|
|
3030
|
+
limit: B,
|
|
3021
3031
|
onColdStart: (e) => X.debug("ssr cold-compile start", { id: e }),
|
|
3022
3032
|
onColdEnd: (e, { durationMs: t, failed: n }) => X.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
3023
3033
|
id: e,
|
|
@@ -3025,21 +3035,23 @@ import {
|
|
|
3025
3035
|
...n ? { failed: !0 } : {}
|
|
3026
3036
|
})
|
|
3027
3037
|
});
|
|
3028
|
-
X.debug(`ssr cold-compile concurrency ${
|
|
3029
|
-
let
|
|
3038
|
+
X.debug(`ssr cold-compile concurrency ${B}`, { concurrency: B });
|
|
3039
|
+
let ye = null, be = async () => (ye === null && (ye = await A.readFile(f(e, ".framework", "index.html"), "utf8")), ye), xe = {
|
|
3030
3040
|
name: "framework:ssr",
|
|
3031
3041
|
configureServer(t) {
|
|
3032
|
-
let n = (e) =>
|
|
3042
|
+
let n = (e) => ve.load(e, async () => await t.ssrLoadModule(e));
|
|
3033
3043
|
t.middlewares.use(async (r, i, a) => {
|
|
3034
3044
|
if (r.method !== "GET" && r.method !== "HEAD") return a();
|
|
3035
|
-
let o = r.url ?? "/"
|
|
3036
|
-
|
|
3037
|
-
let
|
|
3045
|
+
let o = r.url ?? "/";
|
|
3046
|
+
o.indexOf("?");
|
|
3047
|
+
let { pathname: s, search: c } = Mr(o);
|
|
3048
|
+
if (s.startsWith("/@") || s.startsWith("/node_modules/") || s.startsWith("/.framework/") || s.startsWith("/_voltro/") || s === "/main.tsx" || s === "/index.html" || s === "/sw.js" || s === "/favicon.ico" || s === "/robots.txt" || /\.[a-z0-9]+$/i.test(s)) return a();
|
|
3049
|
+
let l = ui(s, S.ssrRoutes);
|
|
3038
3050
|
if (!l) return a();
|
|
3039
|
-
let d = !
|
|
3051
|
+
let d = !me.has(l.route.pattern), p = Date.now();
|
|
3040
3052
|
d && X.info(`ssr compiling ${l.route.pattern}`, {
|
|
3041
3053
|
pattern: l.route.pattern,
|
|
3042
|
-
pathname:
|
|
3054
|
+
pathname: s
|
|
3043
3055
|
});
|
|
3044
3056
|
let m = {}, h = async (e, t) => {
|
|
3045
3057
|
let n = Date.now(), r = await t();
|
|
@@ -3056,97 +3068,99 @@ import {
|
|
|
3056
3068
|
}
|
|
3057
3069
|
};
|
|
3058
3070
|
try {
|
|
3059
|
-
let
|
|
3060
|
-
if (
|
|
3061
|
-
let
|
|
3062
|
-
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ?
|
|
3063
|
-
let
|
|
3064
|
-
i.once("close",
|
|
3065
|
-
let
|
|
3071
|
+
let _ = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), v = Jn(_, f("src", "pages", l.route.file)), y = ii(S.dirs, l.route.dirChain), b = v === "spa" && y.some((e) => e.hasLayout);
|
|
3072
|
+
if (v !== "ssr" && v !== "isr" && !b) return a();
|
|
3073
|
+
let x = {};
|
|
3074
|
+
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ? x[e] = t : Array.isArray(t) && (x[e] = t.join(", "));
|
|
3075
|
+
let C = xi(bi(u[0], { allowDevProxy: !0 }), x.cookie, { apiName: u[0]?.name }), w = new AbortController(), T = () => w.abort();
|
|
3076
|
+
i.once("close", T);
|
|
3077
|
+
let E = null, ee = [], D = {};
|
|
3066
3078
|
try {
|
|
3067
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain:
|
|
3068
|
-
entries:
|
|
3079
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: ee, segmentLoaderData: D} = await h("loadChain", () => ai({
|
|
3080
|
+
entries: y,
|
|
3069
3081
|
loadLayout: (t) => n(f(e, "src", "pages", t.dir, "layout.tsx")),
|
|
3070
3082
|
loadError: (t) => n(f(e, "src", "pages", t.dir, "error.tsx")),
|
|
3071
3083
|
loadPending: (t) => n(f(e, "src", "pages", t.dir, "loading.tsx")),
|
|
3072
3084
|
ctx: {
|
|
3073
3085
|
params: l.params,
|
|
3074
|
-
pathname:
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3086
|
+
pathname: s,
|
|
3087
|
+
search: c,
|
|
3088
|
+
signal: w.signal,
|
|
3089
|
+
headers: x,
|
|
3090
|
+
query: C
|
|
3078
3091
|
}
|
|
3079
3092
|
}));
|
|
3080
|
-
let t =
|
|
3081
|
-
typeof t == "function" && !
|
|
3093
|
+
let t = _.loader;
|
|
3094
|
+
typeof t == "function" && !b && (E = await h("loader", () => t({
|
|
3082
3095
|
params: l.params,
|
|
3083
|
-
pathname:
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3096
|
+
pathname: s,
|
|
3097
|
+
search: c,
|
|
3098
|
+
signal: w.signal,
|
|
3099
|
+
headers: x,
|
|
3100
|
+
query: C
|
|
3087
3101
|
})));
|
|
3088
3102
|
} finally {
|
|
3089
|
-
i.off("close",
|
|
3103
|
+
i.off("close", T);
|
|
3090
3104
|
}
|
|
3091
|
-
let O = await h("loadSsrHelpers", async () => await n("@voltro/web/ssr")),
|
|
3105
|
+
let O = await h("loadSsrHelpers", async () => await n("@voltro/web/ssr")), k = {
|
|
3092
3106
|
pattern: l.route.pattern,
|
|
3093
|
-
Component:
|
|
3094
|
-
meta:
|
|
3095
|
-
loader:
|
|
3096
|
-
ErrorBoundary:
|
|
3097
|
-
Pending:
|
|
3098
|
-
renderMode:
|
|
3099
|
-
chain:
|
|
3100
|
-
},
|
|
3101
|
-
cookies: O.parseCookieHeader(
|
|
3102
|
-
headers:
|
|
3107
|
+
Component: _.default,
|
|
3108
|
+
meta: _.meta,
|
|
3109
|
+
loader: _.loader,
|
|
3110
|
+
ErrorBoundary: _.ErrorBoundary,
|
|
3111
|
+
Pending: _.Pending,
|
|
3112
|
+
renderMode: v,
|
|
3113
|
+
chain: ee
|
|
3114
|
+
}, A = {
|
|
3115
|
+
cookies: O.parseCookieHeader(x.cookie),
|
|
3116
|
+
headers: x,
|
|
3103
3117
|
url: o
|
|
3104
|
-
},
|
|
3118
|
+
}, j = _.interactive ?? "full", M = b ? kr({
|
|
3105
3119
|
helpers: O,
|
|
3106
3120
|
page: `src/pages/${l.route.file}`,
|
|
3107
|
-
interactive:
|
|
3121
|
+
interactive: j,
|
|
3108
3122
|
delivery: "stream",
|
|
3109
3123
|
renderInput: {
|
|
3110
|
-
descriptor:
|
|
3124
|
+
descriptor: k,
|
|
3111
3125
|
params: l.params,
|
|
3112
|
-
pathname:
|
|
3126
|
+
pathname: s,
|
|
3113
3127
|
segmentLoaderData: D,
|
|
3114
|
-
requestContext:
|
|
3128
|
+
requestContext: A
|
|
3115
3129
|
}
|
|
3116
|
-
}) : null,
|
|
3130
|
+
}) : null, N = b ? null : Or({
|
|
3117
3131
|
helpers: O,
|
|
3118
3132
|
page: `src/pages/${l.route.file}`,
|
|
3119
|
-
pathname:
|
|
3120
|
-
renderMode:
|
|
3121
|
-
interactive:
|
|
3122
|
-
loaderData:
|
|
3133
|
+
pathname: s,
|
|
3134
|
+
renderMode: v,
|
|
3135
|
+
interactive: j,
|
|
3136
|
+
loaderData: E,
|
|
3123
3137
|
segmentLoaderData: D,
|
|
3124
|
-
pageLoaderRan: typeof
|
|
3125
|
-
}),
|
|
3138
|
+
pageLoaderRan: typeof _.loader == "function"
|
|
3139
|
+
}), P = [];
|
|
3126
3140
|
await h("collectCss", async () => {
|
|
3127
3141
|
let t = /* @__PURE__ */ new Set(), n = [
|
|
3128
3142
|
f(e, "src", "pages", l.route.file),
|
|
3129
|
-
...
|
|
3143
|
+
...y.flatMap((t) => [
|
|
3130
3144
|
...t.hasLayout ? [f(e, "src", "pages", t.dir, "layout.tsx")] : [],
|
|
3131
3145
|
...t.hasError ? [f(e, "src", "pages", t.dir, "error.tsx")] : [],
|
|
3132
3146
|
...t.hasPending ? [f(e, "src", "pages", t.dir, "loading.tsx")] : []
|
|
3133
3147
|
]),
|
|
3134
3148
|
f(e, ".framework", "main.tsx")
|
|
3135
3149
|
];
|
|
3136
|
-
for (let e of n) await g(e, t,
|
|
3150
|
+
for (let e of n) await g(e, t, P);
|
|
3137
3151
|
});
|
|
3138
|
-
let
|
|
3139
|
-
if (
|
|
3152
|
+
let te = await h("readShell", be), F = await h("transformShell", () => t.transformIndexHtml(o, te)), ne = P.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), I = A.cookies["voltro:locale"] ?? "en", L = Date.now();
|
|
3153
|
+
if (M) {
|
|
3140
3154
|
let e = (e) => jr({
|
|
3141
3155
|
helpers: O,
|
|
3142
|
-
prepared:
|
|
3156
|
+
prepared: M,
|
|
3143
3157
|
meta: e,
|
|
3144
|
-
interactive:
|
|
3145
|
-
extra: [
|
|
3158
|
+
interactive: j,
|
|
3159
|
+
extra: [ne]
|
|
3146
3160
|
});
|
|
3147
|
-
if (
|
|
3161
|
+
if (M.hasDeferred) Vr({
|
|
3148
3162
|
res: i,
|
|
3149
|
-
shell:
|
|
3163
|
+
shell: zr({
|
|
3150
3164
|
shell: F,
|
|
3151
3165
|
inlineModuleScriptsAsync: !0
|
|
3152
3166
|
}),
|
|
@@ -3157,38 +3171,38 @@ import {
|
|
|
3157
3171
|
},
|
|
3158
3172
|
headInjection: e,
|
|
3159
3173
|
render: (e) => O.renderPageToStream({
|
|
3160
|
-
...
|
|
3174
|
+
...M.renderInput,
|
|
3161
3175
|
...e
|
|
3162
3176
|
}),
|
|
3163
3177
|
onShellError: (e) => {
|
|
3164
|
-
|
|
3178
|
+
he(i, "spa-shell-dev", s, l.route.pattern, e);
|
|
3165
3179
|
}
|
|
3166
3180
|
});
|
|
3167
3181
|
else {
|
|
3168
3182
|
let t = Ar({
|
|
3169
3183
|
helpers: O,
|
|
3170
|
-
prepared:
|
|
3184
|
+
prepared: M
|
|
3171
3185
|
}), 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}"`);
|
|
3172
3186
|
i.statusCode = 200, i.setHeader("content-type", "text/html; charset=utf-8"), i.setHeader("x-voltro-rendered-by", "spa-shell-dev"), i.end(n);
|
|
3173
3187
|
}
|
|
3174
|
-
} else if (
|
|
3188
|
+
} else if (N) {
|
|
3175
3189
|
let e = (e) => [
|
|
3176
|
-
|
|
3190
|
+
ne,
|
|
3177
3191
|
O.renderMetaToHtml(e),
|
|
3178
|
-
`<meta name="voltro-interactive" content="${
|
|
3179
|
-
...
|
|
3180
|
-
O.renderRouterStateScript(
|
|
3192
|
+
`<meta name="voltro-interactive" content="${j}" />`,
|
|
3193
|
+
...N.hasDeferred ? [O.renderDeferredRegistryScript()] : [],
|
|
3194
|
+
O.renderRouterStateScript(N.stateInput)
|
|
3181
3195
|
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3182
|
-
descriptor:
|
|
3196
|
+
descriptor: k,
|
|
3183
3197
|
params: l.params,
|
|
3184
|
-
pathname:
|
|
3185
|
-
loaderData:
|
|
3186
|
-
segmentLoaderData:
|
|
3187
|
-
requestContext:
|
|
3198
|
+
pathname: s,
|
|
3199
|
+
loaderData: N.loaderData,
|
|
3200
|
+
segmentLoaderData: N.segmentLoaderData,
|
|
3201
|
+
requestContext: A
|
|
3188
3202
|
};
|
|
3189
|
-
if (
|
|
3203
|
+
if (v === "ssr" && j === "full") Vr({
|
|
3190
3204
|
res: i,
|
|
3191
|
-
shell:
|
|
3205
|
+
shell: zr({
|
|
3192
3206
|
shell: F,
|
|
3193
3207
|
inlineModuleScriptsAsync: !0
|
|
3194
3208
|
}),
|
|
@@ -3203,7 +3217,7 @@ import {
|
|
|
3203
3217
|
...e
|
|
3204
3218
|
}),
|
|
3205
3219
|
onShellError: (e) => {
|
|
3206
|
-
|
|
3220
|
+
he(i, "ssr-dev", s, l.route.pattern, e);
|
|
3207
3221
|
}
|
|
3208
3222
|
});
|
|
3209
3223
|
else {
|
|
@@ -3211,25 +3225,25 @@ import {
|
|
|
3211
3225
|
i.statusCode = 200, i.setHeader("content-type", "text/html; charset=utf-8"), i.setHeader("x-voltro-rendered-by", "ssr-dev"), i.end(a);
|
|
3212
3226
|
}
|
|
3213
3227
|
}
|
|
3214
|
-
m.render = Date.now() -
|
|
3215
|
-
let
|
|
3216
|
-
d ? (
|
|
3228
|
+
m.render = Date.now() - L;
|
|
3229
|
+
let R = Date.now() - p;
|
|
3230
|
+
d ? (me.add(l.route.pattern), X.info(`ssr compiled ${l.route.pattern} in ${R}ms`, {
|
|
3217
3231
|
pattern: l.route.pattern,
|
|
3218
|
-
pathname:
|
|
3219
|
-
elapsedMs:
|
|
3232
|
+
pathname: s,
|
|
3233
|
+
elapsedMs: R,
|
|
3220
3234
|
cold: !0,
|
|
3221
3235
|
phases: m
|
|
3222
|
-
})) :
|
|
3236
|
+
})) : R > 200 && X.info(`ssr rendered ${s} in ${R}ms`, {
|
|
3223
3237
|
pattern: l.route.pattern,
|
|
3224
|
-
pathname:
|
|
3225
|
-
elapsedMs:
|
|
3238
|
+
pathname: s,
|
|
3239
|
+
elapsedMs: R,
|
|
3226
3240
|
cold: !1,
|
|
3227
3241
|
phases: m
|
|
3228
3242
|
});
|
|
3229
3243
|
} catch (e) {
|
|
3230
3244
|
if (Er(e)) {
|
|
3231
3245
|
X.error("ssr-dev render refused", {
|
|
3232
|
-
pathname:
|
|
3246
|
+
pathname: s,
|
|
3233
3247
|
pattern: l.route.pattern
|
|
3234
3248
|
}, e), i.statusCode = 500, i.setHeader("content-type", "text/plain; charset=utf-8"), i.end(e.message);
|
|
3235
3249
|
return;
|
|
@@ -3241,21 +3255,21 @@ import {
|
|
|
3241
3255
|
i.end(t.body);
|
|
3242
3256
|
return;
|
|
3243
3257
|
}
|
|
3244
|
-
|
|
3258
|
+
he(i, "ssr-dev", s, l.route.pattern, e);
|
|
3245
3259
|
}
|
|
3246
3260
|
});
|
|
3247
3261
|
}
|
|
3248
|
-
},
|
|
3262
|
+
}, V = Date.now(), Se = T.version ?? "?", H = await Wr(), Ce = f(e, "node_modules", "@voltro", "ui-shadcn"), U = D(f(Ce, "package.json")) ? Ce : null, we = [], Te = await (async () => {
|
|
3249
3263
|
let t = [];
|
|
3250
3264
|
for (let n of u) {
|
|
3251
3265
|
if (!n.proxyTarget) continue;
|
|
3252
|
-
let r = await
|
|
3266
|
+
let r = await di(e, n.pkg);
|
|
3253
3267
|
if (r) try {
|
|
3254
3268
|
t.push(await A.readFile(f(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3255
3269
|
} catch {}
|
|
3256
3270
|
}
|
|
3257
3271
|
if (t.length === 0) return !1;
|
|
3258
|
-
let n =
|
|
3272
|
+
let n = ge("sha1").update(t.join("\0")).digest("hex"), r = f(k, ".voltro-rpcgroup-optimize"), i = "";
|
|
3259
3273
|
try {
|
|
3260
3274
|
i = (await A.readFile(r, "utf8")).trim();
|
|
3261
3275
|
} catch {}
|
|
@@ -3265,73 +3279,73 @@ import {
|
|
|
3265
3279
|
} catch {}
|
|
3266
3280
|
return !0;
|
|
3267
3281
|
})();
|
|
3268
|
-
|
|
3282
|
+
Te && X.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client"), await (await T.createServer({
|
|
3269
3283
|
root: k,
|
|
3270
3284
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3271
3285
|
ssr: { noExternal: ["react-intl"] },
|
|
3272
3286
|
resolve: {
|
|
3273
3287
|
dedupe: ["react", "react-dom"],
|
|
3274
3288
|
alias: [
|
|
3275
|
-
...
|
|
3289
|
+
...H ? [{
|
|
3276
3290
|
find: "@voltro/devtools/styles.css",
|
|
3277
|
-
replacement: f(
|
|
3291
|
+
replacement: f(H, "src/styles.css")
|
|
3278
3292
|
}, {
|
|
3279
3293
|
find: "@voltro/devtools",
|
|
3280
|
-
replacement: f(
|
|
3294
|
+
replacement: f(H, "src/index.ts")
|
|
3281
3295
|
}] : [],
|
|
3282
|
-
...
|
|
3296
|
+
...U ? [
|
|
3283
3297
|
{
|
|
3284
3298
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3285
|
-
replacement: f(
|
|
3299
|
+
replacement: f(U, "src/tokens.css")
|
|
3286
3300
|
},
|
|
3287
3301
|
{
|
|
3288
3302
|
find: "@voltro/ui-shadcn/cn",
|
|
3289
|
-
replacement: f(
|
|
3303
|
+
replacement: f(U, "src/cn.ts")
|
|
3290
3304
|
},
|
|
3291
3305
|
{
|
|
3292
3306
|
find: "@voltro/ui-shadcn/brand",
|
|
3293
|
-
replacement: f(
|
|
3307
|
+
replacement: f(U, "src/brand/voltroLogo.tsx")
|
|
3294
3308
|
},
|
|
3295
3309
|
{
|
|
3296
3310
|
find: "@voltro/ui-shadcn",
|
|
3297
|
-
replacement: f(
|
|
3311
|
+
replacement: f(U, "src/index.ts")
|
|
3298
3312
|
}
|
|
3299
3313
|
] : [],
|
|
3300
|
-
...
|
|
3314
|
+
...ot(e)
|
|
3301
3315
|
]
|
|
3302
3316
|
},
|
|
3303
3317
|
optimizeDeps: {
|
|
3304
|
-
include: [...u.map((e) => `${e.pkg}/rpcGroup`), ...
|
|
3305
|
-
force:
|
|
3318
|
+
include: [...u.map((e) => `${e.pkg}/rpcGroup`), ...we],
|
|
3319
|
+
force: Te
|
|
3306
3320
|
},
|
|
3307
|
-
customLogger:
|
|
3321
|
+
customLogger: It(),
|
|
3308
3322
|
plugins: [
|
|
3309
|
-
|
|
3310
|
-
D(),
|
|
3323
|
+
Hn(f(e, "src", "pages")),
|
|
3311
3324
|
ee(),
|
|
3325
|
+
O(),
|
|
3312
3326
|
N,
|
|
3313
|
-
|
|
3314
|
-
|
|
3327
|
+
I,
|
|
3328
|
+
oe,
|
|
3329
|
+
ce,
|
|
3315
3330
|
le,
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
...me ? [me] : []
|
|
3331
|
+
fe,
|
|
3332
|
+
xe,
|
|
3333
|
+
...pe ? [pe] : []
|
|
3320
3334
|
],
|
|
3321
3335
|
server: {
|
|
3322
3336
|
port: g,
|
|
3323
3337
|
strictPort: !0,
|
|
3324
3338
|
host: !0,
|
|
3325
3339
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3326
|
-
proxy:
|
|
3327
|
-
fs: { allow: [e, ...
|
|
3340
|
+
proxy: z,
|
|
3341
|
+
fs: { allow: [e, ...Xr(e)] }
|
|
3328
3342
|
},
|
|
3329
3343
|
appType: "spa",
|
|
3330
3344
|
cacheDir: f(k, ".vite"),
|
|
3331
3345
|
publicDir: f(e, "public")
|
|
3332
|
-
})).listen(),
|
|
3333
|
-
version:
|
|
3334
|
-
bootMs: Date.now() -
|
|
3346
|
+
})).listen(), Hr.info(`v${Se} ready in ${Date.now() - V}ms`, {
|
|
3347
|
+
version: Se,
|
|
3348
|
+
bootMs: Date.now() - V
|
|
3335
3349
|
}), X.info(`listening on http://localhost:${g}`, {
|
|
3336
3350
|
port: g,
|
|
3337
3351
|
app: t.name ?? "(unnamed)"
|
|
@@ -3341,7 +3355,7 @@ import {
|
|
|
3341
3355
|
target: e.proxyTarget
|
|
3342
3356
|
}), X.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3343
3357
|
try {
|
|
3344
|
-
await
|
|
3358
|
+
await nt({
|
|
3345
3359
|
id: v,
|
|
3346
3360
|
name: _,
|
|
3347
3361
|
kind: "web",
|
|
@@ -3350,13 +3364,13 @@ import {
|
|
|
3350
3364
|
status: "live",
|
|
3351
3365
|
logFile: y.path
|
|
3352
3366
|
});
|
|
3353
|
-
let t =
|
|
3367
|
+
let t = mr(e);
|
|
3354
3368
|
if (t) {
|
|
3355
3369
|
let e = await wr({ dashboardAppPath: t });
|
|
3356
3370
|
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 });
|
|
3357
3371
|
}
|
|
3358
3372
|
setInterval(() => {
|
|
3359
|
-
|
|
3373
|
+
nt({
|
|
3360
3374
|
id: v,
|
|
3361
3375
|
name: _,
|
|
3362
3376
|
kind: "web",
|
|
@@ -3367,7 +3381,7 @@ import {
|
|
|
3367
3381
|
}).catch(() => {});
|
|
3368
3382
|
}, 1e4).unref();
|
|
3369
3383
|
let n = () => {
|
|
3370
|
-
|
|
3384
|
+
rt(v), y.dispose();
|
|
3371
3385
|
};
|
|
3372
3386
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3373
3387
|
} catch (e) {
|
|
@@ -3377,18 +3391,18 @@ import {
|
|
|
3377
3391
|
app: t.name ?? "unnamed",
|
|
3378
3392
|
kind: "web",
|
|
3379
3393
|
url: `http://localhost:${g}`,
|
|
3380
|
-
bootMs: Date.now() -
|
|
3394
|
+
bootMs: Date.now() - V
|
|
3381
3395
|
}), new Promise(() => {});
|
|
3382
|
-
},
|
|
3396
|
+
}, Ei = async (e) => {
|
|
3383
3397
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3384
|
-
let t = await
|
|
3398
|
+
let t = await wi(e);
|
|
3385
3399
|
if (!t) return {
|
|
3386
3400
|
ran: !1,
|
|
3387
3401
|
exitCode: 0
|
|
3388
3402
|
};
|
|
3389
3403
|
let n = Date.now(), r = X.child("serve");
|
|
3390
3404
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3391
|
-
let i = await
|
|
3405
|
+
let i = await gi(e, t);
|
|
3392
3406
|
for (let e of i) r.info("api wired", {
|
|
3393
3407
|
name: e.name,
|
|
3394
3408
|
pkg: e.pkg
|
|
@@ -3396,21 +3410,21 @@ import {
|
|
|
3396
3410
|
await $(e, t, i);
|
|
3397
3411
|
{
|
|
3398
3412
|
let { pages: t } = await Q(f(e, "src", "pages"));
|
|
3399
|
-
await
|
|
3413
|
+
await Yt({
|
|
3400
3414
|
appRoot: e,
|
|
3401
3415
|
pages: t
|
|
3402
3416
|
});
|
|
3403
3417
|
}
|
|
3404
|
-
let a = t.port ?? 5173, o = await
|
|
3418
|
+
let a = t.port ?? 5173, o = await ct("vite", () => import("vite")), s = (await import("@vitejs/plugin-react")).default, c = f(e, ".framework");
|
|
3405
3419
|
X.info("running production build"), await o.build({
|
|
3406
3420
|
root: c,
|
|
3407
3421
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3408
3422
|
plugins: [s()],
|
|
3409
|
-
customLogger:
|
|
3423
|
+
customLogger: It(),
|
|
3410
3424
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3411
3425
|
build: {
|
|
3412
3426
|
outDir: "dist",
|
|
3413
|
-
rollupOptions: { output: { manualChunks:
|
|
3427
|
+
rollupOptions: { output: { manualChunks: Qr } }
|
|
3414
3428
|
},
|
|
3415
3429
|
publicDir: f(e, "public")
|
|
3416
3430
|
});
|
|
@@ -3430,14 +3444,14 @@ import {
|
|
|
3430
3444
|
extras: d,
|
|
3431
3445
|
bootMs: Date.now() - n
|
|
3432
3446
|
}), new Promise(() => {});
|
|
3433
|
-
},
|
|
3447
|
+
}, Di = 5e3, Oi = 6e4, ki = (e, t) => {
|
|
3434
3448
|
if (e.length === 0) return 0;
|
|
3435
3449
|
if (e.length === 1) return e[0];
|
|
3436
3450
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3437
3451
|
if (r === i) return e[r];
|
|
3438
3452
|
let a = n - r;
|
|
3439
3453
|
return e[r] * (1 - a) + e[i] * a;
|
|
3440
|
-
},
|
|
3454
|
+
}, Ai = (e) => {
|
|
3441
3455
|
if (e.length === 0) return {
|
|
3442
3456
|
p50: 0,
|
|
3443
3457
|
p95: 0,
|
|
@@ -3449,15 +3463,15 @@ import {
|
|
|
3449
3463
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3450
3464
|
for (let e of t) n += e;
|
|
3451
3465
|
return {
|
|
3452
|
-
p50:
|
|
3453
|
-
p95:
|
|
3454
|
-
p99:
|
|
3466
|
+
p50: ki(t, .5),
|
|
3467
|
+
p95: ki(t, .95),
|
|
3468
|
+
p99: ki(t, .99),
|
|
3455
3469
|
mean: n / t.length,
|
|
3456
3470
|
min: t[0],
|
|
3457
3471
|
max: t[t.length - 1]
|
|
3458
3472
|
};
|
|
3459
|
-
},
|
|
3460
|
-
let t = e.maxSamples ??
|
|
3473
|
+
}, ji = (e = {}) => {
|
|
3474
|
+
let t = e.maxSamples ?? Di, n = e.defaultWindowMs ?? Oi, r = [];
|
|
3461
3475
|
return {
|
|
3462
3476
|
record(e) {
|
|
3463
3477
|
L(e), r.push({
|
|
@@ -3486,7 +3500,7 @@ import {
|
|
|
3486
3500
|
tag: e.tag,
|
|
3487
3501
|
count: e.samples.length,
|
|
3488
3502
|
errorCount: n,
|
|
3489
|
-
latencyMs:
|
|
3503
|
+
latencyMs: Ai(t)
|
|
3490
3504
|
});
|
|
3491
3505
|
}
|
|
3492
3506
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3499,4 +3513,4 @@ import {
|
|
|
3499
3513
|
};
|
|
3500
3514
|
};
|
|
3501
3515
|
//#endregion
|
|
3502
|
-
export {
|
|
3516
|
+
export { bt as $, $n as A, _n as B, pr as C, lr as D, cr as E, Jn as F, Zt as G, cn as H, Mn as I, zt as J, $t as K, Nn as L, Yn as M, Wn as N, ur as O, Kn as P, Tt as Q, En as R, hr as S, mr as T, on as U, hn as V, Qt as W, Ot as X, Lt as Y, Et as Z, Or as _, H as _t, ai as a, vt as at, jr as b, gi as c, ft as ct, Qr as d, it as dt, xt as et, Q as f, tt as ft, Er as g, Ge as gt, Vr as h, We as ht, xi as i, _t as it, Un as j, Zn as k, Ti as l, ct as lt, zr as m, nt as mt, $r as n, yt as nt, ii as o, ht as ot, $ as p, rt as pt, Yt as q, bi as r, K as rt, wi as s, pt as st, ji as t, St as tt, Ei as u, ot as ut, kr as v, Ce as vt, wr as w, Mr as x, Ar as y, xn as z };
|