@voltro/cli 0.56.0 → 0.58.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 +395 -0
- package/dist/apiBuild-CDE4NXNi.js +2 -0
- package/dist/{apiBuild-Bdaetr37.js → apiBuild-CkpsCqIu.js} +2 -2
- package/dist/bin.js +1 -1
- package/dist/build-51qBWfYY.js +981 -0
- package/dist/{checkCommand-D0QV_zM_.js → checkCommand-C1EbNmwl.js} +1 -1
- package/dist/{checkCommand-CAwFXrxA.js → checkCommand-C30J2F18.js} +4 -4
- package/dist/{codegenCommand-CidbQzbv.js → codegenCommand-kS3Twuc9.js} +12 -12
- package/dist/{codemodRunner-BlQPfjzA.js → codemodRunner-BKjCwGiN.js} +1127 -895
- package/dist/{commands-CWjfThXv.js → commands-DowWkYtd.js} +25 -25
- package/dist/{dashboardCommand-BekcY5Ls.js → dashboardCommand-gG1y4PFG.js} +3 -3
- package/dist/{dataCommand-2pccgbIy.js → dataCommand-hNOGKz4K.js} +7 -7
- package/dist/{dbCommand-DpK_vQET.js → dbCommand-CMAIz-Bf.js} +3 -3
- package/dist/dbCommand-DHi_RuDl.js +2 -0
- package/dist/{dev-Dw263KPu.js → dev-Ce2gEziv.js} +2411 -2391
- package/dist/dev-Dff_pdik.js +3 -0
- package/dist/{doctorCommand-aR_bFmIi.js → doctorCommand-5ULMpL10.js} +652 -289
- package/dist/doctorCommand-B8H2MYCE.js +2 -0
- package/dist/{dormancyCommand-eXTQMbHU.js → dormancyCommand-DYgI0Kf-.js} +3 -3
- package/dist/{embeddingsCommand-CTmiQvwa.js → embeddingsCommand-yJivQSrI.js} +2 -2
- package/dist/emptyResultHeadline-Csa5fZOF.js +18 -0
- package/dist/{envCommand-BDUgV7EM.js → envCommand-ORJUf8r_.js} +2 -2
- package/dist/{evolveCommand-YV8qW1LU.js → evolveCommand-DTawtTxf.js} +2 -2
- package/dist/frameworkTableAssembly-B96WCNJA.js +2 -0
- package/dist/{frameworkTableAssembly-DNOFXfEQ.js → frameworkTableAssembly-vfkzuzEo.js} +104 -85
- package/dist/index.js +1 -1
- package/dist/{infoCommand-BjVXpMlP.js → infoCommand-BFksHunl.js} +1 -1
- package/dist/inspect-CZvsmp8t.js +2 -0
- package/dist/{inspect-CNYvNXPU.js → inspect-PcC5J-Dl.js} +74 -59
- package/dist/{logsCmd-BU8uCdys.js → logsCmd-C5y9HyrG.js} +58 -53
- package/dist/manifestBuild-AUh31bFU.js +2 -0
- package/dist/{manifestBuild-CEkjfpwc.js → manifestBuild-BwiS4iYm.js} +1 -1
- package/dist/{migrate-SICulyz1.js → migrate-DtC3lu7H.js} +4 -4
- package/dist/{probeCommand-6HxEkNDG.js → probeCommand-BUYzc0CT.js} +1 -1
- package/dist/{runtimeTrace-DgYMc09E.js → runtimeTrace-BUk5zMXY.js} +1 -1
- package/dist/{sdkgen-PY-umd6O.js → sdkgen-CAhmmbjx.js} +1 -1
- package/dist/serveCommand-BUXUtSF5.js +2 -0
- package/dist/serveCommand-DhtC7WBq.js +2545 -0
- package/dist/serveEntry.js +1 -1
- package/dist/{start-BFQQkL1i.js → start-C75w6ftA.js} +1 -1
- package/dist/{start-B9NGB8gn.js → start-DNtIlBcn.js} +527 -502
- package/dist/startEntry.js +1 -1
- package/dist/{tracesCmd-BWYDqMy6.js → tracesCmd-C1qKa94g.js} +68 -63
- package/dist/{updateCommand-C9n_Z_oG.js → updateCommand-CtuD5r1t.js} +1 -1
- package/dist/updateCommand-eVKVHj3N.js +2 -0
- package/dist/webDev-Bzb8ZFus.js +2 -0
- package/dist/{webDev-C53hJdcL.js → webDev-CBN9KkyQ.js} +949 -834
- package/dist/{webhooksCommand-uuPu8qQX.js → webhooksCommand-BPJQOGTe.js} +2 -2
- package/package.json +61 -19
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/_manifest.json +2 -2
- package/templates/agent-docs/ai.md +175 -1
- package/templates/agent-docs/authentication.md +68 -19
- package/templates/agent-docs/cli.md +48 -0
- package/templates/agent-docs/configuration.md +29 -4
- package/templates/agent-docs/data.md +30 -0
- package/templates/agent-docs/database/scaling.md +10 -1
- package/templates/agent-docs/database/transactions.md +48 -0
- package/templates/agent-docs/deployment.md +22 -0
- package/templates/agent-docs/observability.md +13 -2
- package/templates/agent-docs/plugins/audit.md +21 -5
- package/templates/agent-docs/plugins/auth-supabase.md +21 -0
- package/templates/agent-docs/plugins/billing.md +2 -0
- package/templates/agent-docs/plugins/sentry.md +91 -8
- package/templates/agent-docs/reference.md +1 -0
- package/templates/agent-docs/scheduling.md +23 -0
- package/templates/agent-docs/schema-driven-ui.md +110 -0
- package/templates/agent-docs/whats-new.md +103 -399
- package/templates/apps/api-ai/package.json +6 -6
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +9 -9
- package/templates/apps/api-collab/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-row-history/package.json +8 -8
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +7 -7
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +7 -7
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-auth/package.json +7 -7
- package/templates/apps/frontend-blank/package.json +6 -6
- package/templates/apps/frontend-cms/package.json +8 -8
- package/templates/apps/frontend-collab/package.json +9 -9
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +6 -6
- package/templates/apps/frontend-docs/package.json +8 -8
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-portal/package.json +7 -7
- package/templates/apps/frontend-saas/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +6 -6
- package/templates/apps/frontend-ssr/package.json +6 -6
- package/templates/apps/frontend-ssr-api/package.json +7 -7
- package/templates/apps/frontend-static-blog/package.json +8 -8
- package/templates/apps/frontend-status/package.json +7 -7
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/apiBuild-Vw1figjO.js +0 -2
- package/dist/build-CI36wL4R.js +0 -868
- package/dist/dbCommand-DrycGWWt.js +0 -2
- package/dist/dev-B9Gz0k85.js +0 -3
- package/dist/doctorCommand-BMWs6aVm.js +0 -2
- package/dist/frameworkTableAssembly-CGNC0qr7.js +0 -2
- package/dist/inspect-S2rWy1Ys.js +0 -2
- package/dist/manifestBuild-DIa_s6u0.js +0 -2
- package/dist/serveCommand-BITS8Hpj.js +0 -2
- package/dist/serveCommand-DIJ3ma76.js +0 -2485
- package/dist/updateCommand-DsXEAHbd.js +0 -2
- package/dist/webDev-C2dRz9s5.js +0 -2
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { n as e } from "./loadEnv-D9nEOClM.js";
|
|
2
2
|
import { t } from "./bootRefusal-pgvDxlrU.js";
|
|
3
|
-
import { A as n, I as r, M as i, O as a, g as o, j as s, o as c } from "./inspect-
|
|
3
|
+
import { A as n, I as r, M as i, O as a, g as o, j as s, o as c } from "./inspect-PcC5J-Dl.js";
|
|
4
4
|
import { r as l } from "./appPort-B_HpJ_ck.js";
|
|
5
5
|
import { M as u, _ as d, c as f, g as p, v as m, y as h } from "./fileConventions-l-RIXbx8.js";
|
|
6
6
|
import { n as g, t as _ } from "./workspaceDeps-RKEkX92S.js";
|
|
7
7
|
import { n as v } from "./agentsMd-BaLC10Na.js";
|
|
8
8
|
import { c as y, f as ee, p as b, t as x } from "./renderModeScan-43yQ2opo.js";
|
|
9
|
-
import { a as S, c as C, d as w, f as T, i as E, l as
|
|
10
|
-
import { d as
|
|
11
|
-
import { t as
|
|
9
|
+
import { a as S, c as C, d as w, f as T, i as E, l as D, o as O, p as te, r as k, s as ne, t as A } from "./imagePipeline-CBZmjT4i.js";
|
|
10
|
+
import { d as j, n as M } from "./fontPipeline-Tsh8kZfA.js";
|
|
11
|
+
import { t as re } from "./pageConvention-CMpfDN6r.js";
|
|
12
12
|
import { i as ie, n as ae, r as oe, t as se } from "./runtimeRegistry-DMeKfTHP.js";
|
|
13
13
|
import { n as ce } from "./logFileSink-B4uP8pvf.js";
|
|
14
14
|
import { basename as le, dirname as N, extname as ue, join as P, relative as F, resolve as I, sep as de } from "node:path";
|
|
15
|
-
import { existsSync as L, mkdirSync as R, promises as z, readFileSync as B, readdirSync as V, statSync as
|
|
16
|
-
import { fileURLToPath as
|
|
17
|
-
import { addSink as
|
|
18
|
-
import { replicaId as
|
|
19
|
-
import { classifyRequestOrigin as
|
|
20
|
-
import { Metric as
|
|
21
|
-
import { createRequire as
|
|
22
|
-
import { homedir as
|
|
23
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
24
|
-
import { __installPublicEnv as
|
|
25
|
-
import { mkdir as
|
|
15
|
+
import { existsSync as L, mkdirSync as R, promises as z, readFileSync as B, readdirSync as V, statSync as H, unwatchFile as fe, watchFile as pe, writeFileSync as U } from "node:fs";
|
|
16
|
+
import { fileURLToPath as W, pathToFileURL as G } from "node:url";
|
|
17
|
+
import { addSink as me, createLogger as K, printReadyBlock as he } from "@voltro/logger";
|
|
18
|
+
import { replicaId as ge } from "@voltro/protocol/identity";
|
|
19
|
+
import { classifyRequestOrigin as _e, currentTraceContext as ve, resolveOriginGuardConfig as ye, resolveSecret as be } from "@voltro/runtime";
|
|
20
|
+
import { Metric as xe, MetricBoundaries as Se } from "effect";
|
|
21
|
+
import { createRequire as Ce } from "node:module";
|
|
22
|
+
import { homedir as we } from "node:os";
|
|
23
|
+
import { FRAMEWORK_ENV_CATALOG as Te, appEnvEntries as Ee, checkEnvNaming as De, formatEnvErrors as Oe, installEnvSnapshot as ke, isEnvContract as Ae, pluginEnvEntries as je, renderDotEnvExample as Me, resolveEnv as Ne } from "@voltro/env";
|
|
24
|
+
import { __installPublicEnv as Pe } from "@voltro/env/public";
|
|
25
|
+
import { mkdir as Fe, readFile as Ie, writeFile as q } from "node:fs/promises";
|
|
26
26
|
import { createHash as J, createHmac as Le, randomBytes as Re, timingSafeEqual as ze } from "node:crypto";
|
|
27
27
|
import { spawn as Be } from "node:child_process";
|
|
28
|
-
import { createConnection as
|
|
29
|
-
import { FORM_FLASH_SCRIPT_ID as
|
|
28
|
+
import { createConnection as Ve } from "node:net";
|
|
29
|
+
import { FORM_FLASH_SCRIPT_ID as Y, FORM_KEY_FIELD as He, FORM_PATH_PREFIX as Ue, FORM_PATH_PREFIX as We, FORM_REDIRECT_FIELD as Ge, formDataToInput as Ke, validateFields as qe } from "@voltro/client/form";
|
|
30
30
|
import { buildFeed as Je, contentArtifactPath as Ye, getCollection as Xe, getEntry as Ze, invalidateContentCache as Qe, registeredCollections as $e, setContentAssetResolver as et, setContentRoot as tt, validateReferences as nt } from "@voltro/content";
|
|
31
31
|
import { PassThrough as rt } from "node:stream";
|
|
32
32
|
//#region src/inspectEvents.ts
|
|
@@ -38,7 +38,7 @@ var it = 256, at = (e = it) => {
|
|
|
38
38
|
ts: Date.now(),
|
|
39
39
|
channel: r,
|
|
40
40
|
payload: i,
|
|
41
|
-
origin:
|
|
41
|
+
origin: ge()
|
|
42
42
|
};
|
|
43
43
|
t.push(a), t.length > e && t.shift();
|
|
44
44
|
for (let e of n) try {
|
|
@@ -84,30 +84,88 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
`, i = P(e, "src");
|
|
87
|
-
await
|
|
87
|
+
await Fe(i, { recursive: !0 }), await q(P(i, "voltro-env.d.ts"), r, "utf8");
|
|
88
88
|
}, ht = async (e, t) => {
|
|
89
|
-
let n = `${ut}
|
|
89
|
+
let n = JSON.stringify(t, null, 2), r = `${ut}
|
|
90
90
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
91
91
|
|
|
92
|
-
export const publicEnvValues = ${
|
|
92
|
+
export const publicEnvValues = ${n} as const
|
|
93
93
|
|
|
94
94
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
95
95
|
__installPublicEnv(publicEnvValues)
|
|
96
96
|
`;
|
|
97
|
-
await
|
|
98
|
-
}, gt =
|
|
99
|
-
let
|
|
97
|
+
await Fe(e, { recursive: !0 }), await q(P(e, "env.public.ts"), r, "utf8"), await q(P(e, "env.public.json"), `${n}\n`, "utf8");
|
|
98
|
+
}, gt = (e, t) => {
|
|
99
|
+
let n = new Set(Object.keys(Ae(e) ? e.vars : {})), r = /* @__PURE__ */ new Map();
|
|
100
|
+
for (let [e, i] of (t ?? []).entries()) {
|
|
101
|
+
let t = i.name ?? `plugin #${e + 1}`;
|
|
102
|
+
for (let e of i.declaredEnv ?? []) {
|
|
103
|
+
if (n.has(e.name)) continue;
|
|
104
|
+
let i = r.get(e.name);
|
|
105
|
+
if (i === void 0) {
|
|
106
|
+
if (!e.required) continue;
|
|
107
|
+
r.set(e.name, {
|
|
108
|
+
name: e.name,
|
|
109
|
+
secret: e.secret,
|
|
110
|
+
requiredBy: t,
|
|
111
|
+
...e.description === void 0 ? {} : { description: e.description }
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
r.set(e.name, {
|
|
116
|
+
...i,
|
|
117
|
+
secret: i.secret || e.secret,
|
|
118
|
+
requiredBy: i.requiredBy.includes(t) ? i.requiredBy : `${i.requiredBy} and ${t}`
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return [...r.values()];
|
|
123
|
+
}, _t = async (e, t = {}) => {
|
|
124
|
+
let n = t.readEnv ?? ((e) => process.env[e]), r = t.readSecret ?? be, i = [];
|
|
125
|
+
for (let t of e) {
|
|
126
|
+
let e;
|
|
127
|
+
try {
|
|
128
|
+
e = t.secret ? await r(t.name) : n(t.name);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
i.push({
|
|
131
|
+
name: t.name,
|
|
132
|
+
requiredBy: t.requiredBy,
|
|
133
|
+
reason: "unreadable",
|
|
134
|
+
detail: e instanceof Error ? e.message : String(e),
|
|
135
|
+
...t.description === void 0 ? {} : { description: t.description }
|
|
136
|
+
});
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
(e === void 0 || e === "") && i.push({
|
|
140
|
+
name: t.name,
|
|
141
|
+
requiredBy: t.requiredBy,
|
|
142
|
+
reason: "missing",
|
|
143
|
+
...t.description === void 0 ? {} : { description: t.description }
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return i;
|
|
147
|
+
}, vt = (e) => {
|
|
148
|
+
let t = e.map((e) => {
|
|
149
|
+
let t = e.reason === "missing" ? ` • ${e.name} — required by ${e.requiredBy}, and nothing set it` : ` • ${e.name} — required by ${e.requiredBy}, and the secrets backend could not answer: ${e.detail ?? "no detail"}`;
|
|
150
|
+
return e.description === void 0 ? t : `${t}\n ${e.description}`;
|
|
151
|
+
});
|
|
152
|
+
return `plugin environment validation failed (${e.length} ${e.length === 1 ? "variable" : "variables"}):\n${t.join("\n")}\n → set the variable, or pass the value as a plugin option if the plugin takes one, or
|
|
153
|
+
declare it yourself in app.config.ts's \`env\` (an app declaration overrides a plugin's).`;
|
|
154
|
+
}, yt = async (e) => {
|
|
155
|
+
let t = Ae(e.rawEnv) ? e.rawEnv : void 0, n = await Ne({
|
|
100
156
|
contract: t,
|
|
101
|
-
resolveSecret:
|
|
102
|
-
}), r = [...n.errors, ...
|
|
103
|
-
if (r.length > 0) throw Error(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
resolveSecret: be
|
|
158
|
+
}), r = [...n.errors, ...De(t, e.appType)];
|
|
159
|
+
if (r.length > 0) throw Error(Oe(r));
|
|
160
|
+
let i = await _t(gt(e.rawEnv, e.plugins));
|
|
161
|
+
if (i.length > 0) throw Error(vt(i));
|
|
162
|
+
ke(n.values), e.appType === "web" && Pe(n.publicValues);
|
|
163
|
+
let a = t ? Object.keys(t.vars).length : 0;
|
|
164
|
+
if (a > 0) {
|
|
107
165
|
let r = Object.keys(n.publicValues).length;
|
|
108
|
-
if (e.log.info(`env: ${
|
|
166
|
+
if (e.log.info(`env: ${a} declared var(s) validated`, {
|
|
109
167
|
public: r,
|
|
110
|
-
secret:
|
|
168
|
+
secret: a - r
|
|
111
169
|
}), e.appType === "web" && t) {
|
|
112
170
|
let n = Object.entries(t.vars).filter(([, e]) => e.access === "secret").map(([e]) => e);
|
|
113
171
|
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 });
|
|
@@ -117,16 +175,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
117
175
|
resolved: n,
|
|
118
176
|
contract: t
|
|
119
177
|
};
|
|
120
|
-
},
|
|
121
|
-
let t =
|
|
178
|
+
}, bt = (e) => {
|
|
179
|
+
let t = Ee(e.contract), n = (e.plugins ?? []).flatMap((e) => je(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : Te, i = /* @__PURE__ */ new Set(), a = [];
|
|
122
180
|
for (let e of [
|
|
123
181
|
...t,
|
|
124
182
|
...n,
|
|
125
183
|
...r
|
|
126
184
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
127
185
|
return a;
|
|
128
|
-
},
|
|
129
|
-
let r =
|
|
186
|
+
}, xt = (e, t, n = (e) => process.env[e]) => {
|
|
187
|
+
let r = bt(t).map((e) => {
|
|
130
188
|
let t = n(e.key) !== void 0;
|
|
131
189
|
return {
|
|
132
190
|
...e,
|
|
@@ -143,16 +201,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
143
201
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
144
202
|
}
|
|
145
203
|
};
|
|
146
|
-
},
|
|
147
|
-
let n =
|
|
204
|
+
}, St = (e, t) => {
|
|
205
|
+
let n = bt({
|
|
148
206
|
...e,
|
|
149
207
|
includeFramework: !1
|
|
150
208
|
});
|
|
151
|
-
return
|
|
209
|
+
return Me(n, {
|
|
152
210
|
includeFramework: e.includeFramework !== !1,
|
|
153
211
|
...t ? { header: t } : {}
|
|
154
212
|
});
|
|
155
|
-
},
|
|
213
|
+
}, Ct = 500, wt = (e, t, n = {}) => {
|
|
156
214
|
if (e.length === 0) return () => {};
|
|
157
215
|
let r = (e) => n.root ? F(n.root, e) : e, i = !1, a = (e) => {
|
|
158
216
|
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(() => {
|
|
@@ -170,22 +228,22 @@ __installPublicEnv(publicEnvValues)
|
|
|
170
228
|
});
|
|
171
229
|
}));
|
|
172
230
|
};
|
|
173
|
-
for (let t of e)
|
|
231
|
+
for (let t of e) pe(t, { interval: Ct }, (e, n) => {
|
|
174
232
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
175
233
|
});
|
|
176
234
|
return t.info("watching .env files for changes", {
|
|
177
235
|
files: e.map(r),
|
|
178
|
-
intervalMs:
|
|
236
|
+
intervalMs: Ct
|
|
179
237
|
}), () => {
|
|
180
|
-
for (let t of e)
|
|
238
|
+
for (let t of e) fe(t);
|
|
181
239
|
};
|
|
182
|
-
},
|
|
240
|
+
}, Tt = [{
|
|
183
241
|
host: "127.0.0.1",
|
|
184
242
|
family: "IPv4"
|
|
185
243
|
}, {
|
|
186
244
|
host: "::1",
|
|
187
245
|
family: "IPv6"
|
|
188
|
-
}],
|
|
246
|
+
}], Et = (e, t, n) => new Promise((r) => {
|
|
189
247
|
let i = !1, a = (e) => {
|
|
190
248
|
if (!i) {
|
|
191
249
|
i = !0;
|
|
@@ -194,15 +252,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
194
252
|
} catch {}
|
|
195
253
|
r(e);
|
|
196
254
|
}
|
|
197
|
-
}, o =
|
|
255
|
+
}, o = Ve({
|
|
198
256
|
host: e,
|
|
199
257
|
port: t
|
|
200
258
|
});
|
|
201
259
|
o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
|
|
202
|
-
}),
|
|
260
|
+
}), Dt = async (e, t = 400) => ({ families: (await Promise.all(Tt.map(async (n) => ({
|
|
203
261
|
family: n.family,
|
|
204
|
-
taken: await
|
|
205
|
-
})))).filter((e) => e.taken).map((e) => e.family) }),
|
|
262
|
+
taken: await Et(n.host, e, t)
|
|
263
|
+
})))).filter((e) => e.taken).map((e) => e.family) }), Ot = (e, t, n) => [
|
|
206
264
|
`${t}: port ${e} is already being served (${n.join(" + ")}).`,
|
|
207
265
|
"",
|
|
208
266
|
" Refusing to start. This is NOT a spurious check — a second listener can",
|
|
@@ -217,10 +275,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
217
275
|
"",
|
|
218
276
|
" Then re-run. To use a different port instead, change `port` in",
|
|
219
277
|
" app.config.ts."
|
|
220
|
-
].join("\n"),
|
|
221
|
-
let { families: r } = await
|
|
222
|
-
if (r.length !== 0) throw t(
|
|
223
|
-
},
|
|
278
|
+
].join("\n"), kt = async (e, n) => {
|
|
279
|
+
let { families: r } = await Dt(e);
|
|
280
|
+
if (r.length !== 0) throw t(Ot(e, n, r));
|
|
281
|
+
}, At = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", jt = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Mt = (e) => {
|
|
224
282
|
let t = [], n = e;
|
|
225
283
|
for (let e = 0; e < 12; e++) {
|
|
226
284
|
let e = P(n, "node_modules");
|
|
@@ -230,7 +288,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
230
288
|
n = r;
|
|
231
289
|
}
|
|
232
290
|
return t;
|
|
233
|
-
},
|
|
291
|
+
}, Nt = (e) => {
|
|
234
292
|
let t = /* @__PURE__ */ new Set([e]), n = e;
|
|
235
293
|
for (let e = 0; e < 12; e++) {
|
|
236
294
|
for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
|
|
@@ -268,9 +326,9 @@ __installPublicEnv(publicEnvValues)
|
|
|
268
326
|
n = e;
|
|
269
327
|
}
|
|
270
328
|
return [...t];
|
|
271
|
-
},
|
|
329
|
+
}, Pt = (e) => {
|
|
272
330
|
let t = [];
|
|
273
|
-
for (let n of
|
|
331
|
+
for (let n of Nt(e)) {
|
|
274
332
|
let e = P(n, "node_modules", "@voltro"), r;
|
|
275
333
|
try {
|
|
276
334
|
r = V(e);
|
|
@@ -278,7 +336,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
278
336
|
continue;
|
|
279
337
|
}
|
|
280
338
|
for (let n of r) {
|
|
281
|
-
let r = P(e, n), i =
|
|
339
|
+
let r = P(e, n), i = Ft(r);
|
|
282
340
|
i !== void 0 && t.push({
|
|
283
341
|
pkg: `@voltro/${n}`,
|
|
284
342
|
version: i,
|
|
@@ -287,14 +345,14 @@ __installPublicEnv(publicEnvValues)
|
|
|
287
345
|
}
|
|
288
346
|
}
|
|
289
347
|
return t;
|
|
290
|
-
},
|
|
348
|
+
}, Ft = (e) => {
|
|
291
349
|
try {
|
|
292
350
|
let t = JSON.parse(B(P(e, "package.json"), "utf8"));
|
|
293
351
|
return typeof t.version == "string" ? t.version : void 0;
|
|
294
352
|
} catch {
|
|
295
353
|
return;
|
|
296
354
|
}
|
|
297
|
-
},
|
|
355
|
+
}, It = (e) => {
|
|
298
356
|
let t = [], n;
|
|
299
357
|
try {
|
|
300
358
|
n = V(e);
|
|
@@ -302,7 +360,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
302
360
|
return t;
|
|
303
361
|
}
|
|
304
362
|
for (let r of n) {
|
|
305
|
-
if (r.startsWith(".") ||
|
|
363
|
+
if (r.startsWith(".") || jt.test(r)) continue;
|
|
306
364
|
let n = P(e, r);
|
|
307
365
|
if (r.startsWith("@")) {
|
|
308
366
|
let e;
|
|
@@ -318,7 +376,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
318
376
|
continue;
|
|
319
377
|
}
|
|
320
378
|
try {
|
|
321
|
-
if (!
|
|
379
|
+
if (!H(n).isDirectory()) continue;
|
|
322
380
|
} catch {
|
|
323
381
|
continue;
|
|
324
382
|
}
|
|
@@ -328,17 +386,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
328
386
|
});
|
|
329
387
|
}
|
|
330
388
|
return t;
|
|
331
|
-
},
|
|
389
|
+
}, Lt = (e) => {
|
|
332
390
|
let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
|
|
333
|
-
if (!
|
|
391
|
+
if (!At(e)) return;
|
|
334
392
|
let i = t.get(e) ?? /* @__PURE__ */ new Map();
|
|
335
393
|
i.has(n) || i.set(n, r), t.set(e, i);
|
|
336
394
|
};
|
|
337
|
-
for (let t of
|
|
338
|
-
let t =
|
|
395
|
+
for (let t of Mt(e)) for (let { pkg: e, dir: r } of It(t)) {
|
|
396
|
+
let t = Ft(r);
|
|
339
397
|
t !== void 0 && n(e, t, r);
|
|
340
398
|
}
|
|
341
|
-
for (let { pkg: t, version: r, dir: i } of
|
|
399
|
+
for (let { pkg: t, version: r, dir: i } of Pt(e)) n(t, r, i);
|
|
342
400
|
let r = [];
|
|
343
401
|
for (let [n, i] of t) i.size < 2 || r.push({
|
|
344
402
|
pkg: n,
|
|
@@ -346,7 +404,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
346
404
|
paths: [...i.values()].map((t) => F(e, t)).sort()
|
|
347
405
|
});
|
|
348
406
|
return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
|
|
349
|
-
},
|
|
407
|
+
}, Rt = (e) => {
|
|
350
408
|
if (e.length !== 0) return [
|
|
351
409
|
`• ${e.length} package(s) resolved at more than one version:`,
|
|
352
410
|
...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
|
|
@@ -364,11 +422,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
364
422
|
" instrument), then reinstall. Do not silence the generated file — it is where",
|
|
365
423
|
" a genuine mistake in your own descriptors surfaces."
|
|
366
424
|
].join("\n");
|
|
367
|
-
},
|
|
425
|
+
}, zt = (e) => {
|
|
368
426
|
let t = /* @__PURE__ */ new Map();
|
|
369
|
-
for (let n of
|
|
427
|
+
for (let n of Mt(e)) for (let { pkg: e, dir: r } of It(n)) {
|
|
370
428
|
if (!e.startsWith("@voltro/")) continue;
|
|
371
|
-
let n =
|
|
429
|
+
let n = Ft(r);
|
|
372
430
|
n !== void 0 && !t.has(e) && t.set(e, n);
|
|
373
431
|
}
|
|
374
432
|
if (t.size < 2) return;
|
|
@@ -383,7 +441,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
383
441
|
version: t
|
|
384
442
|
})).sort((e, t) => e.pkg.localeCompare(t.pkg))
|
|
385
443
|
};
|
|
386
|
-
},
|
|
444
|
+
}, Bt = (e) => {
|
|
387
445
|
if (e !== void 0) return [
|
|
388
446
|
`• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
|
|
389
447
|
...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
|
|
@@ -401,59 +459,59 @@ __installPublicEnv(publicEnvValues)
|
|
|
401
459
|
" its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
|
|
402
460
|
" which silently skips `@voltro/i18n` because the name contains digits."
|
|
403
461
|
].join("\n");
|
|
404
|
-
},
|
|
405
|
-
let n =
|
|
462
|
+
}, Vt = (e, t) => {
|
|
463
|
+
let n = zt(e);
|
|
406
464
|
n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
|
|
407
465
|
majority: n.majority,
|
|
408
466
|
behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
|
|
409
467
|
fix: "the framework ships in lockstep; bump the listed packages and reinstall"
|
|
410
468
|
});
|
|
411
|
-
},
|
|
469
|
+
}, Ht = K({ scope: "vite" }), Ut = /\x1b\[[0-9;]*m/g, Wt = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Gt = (e) => e.replace(Ut, "").replace(Wt, "").trim(), Kt = /proxy error/i, qt = [
|
|
412
470
|
"ECONNREFUSED",
|
|
413
471
|
"ECONNRESET",
|
|
414
472
|
"ECONNABORTED",
|
|
415
473
|
"EPIPE",
|
|
416
474
|
"ETIMEDOUT"
|
|
417
|
-
],
|
|
475
|
+
], Jt = (e, t = 0) => {
|
|
418
476
|
if (e == null || t > 5) return !1;
|
|
419
477
|
let n = e;
|
|
420
|
-
return typeof n.code == "string" &&
|
|
421
|
-
},
|
|
478
|
+
return typeof n.code == "string" && qt.includes(n.code) || typeof n.message == "string" && qt.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Jt(e, t + 1)) ? !0 : Jt(n.cause, t + 1);
|
|
479
|
+
}, Yt = 4e3, Xt = () => {
|
|
422
480
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
423
481
|
hasWarned: !1,
|
|
424
482
|
info: (e) => {
|
|
425
|
-
let t =
|
|
426
|
-
t.length !== 0 &&
|
|
483
|
+
let t = Gt(e);
|
|
484
|
+
t.length !== 0 && Ht.info(t);
|
|
427
485
|
},
|
|
428
486
|
warn: (e) => {
|
|
429
487
|
n.hasWarned = !0;
|
|
430
|
-
let t =
|
|
431
|
-
t.length !== 0 &&
|
|
488
|
+
let t = Gt(e);
|
|
489
|
+
t.length !== 0 && Ht.warn(t);
|
|
432
490
|
},
|
|
433
491
|
warnOnce: (t) => {
|
|
434
|
-
let r =
|
|
435
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
492
|
+
let r = Gt(t);
|
|
493
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ht.warn(r));
|
|
436
494
|
},
|
|
437
495
|
error: (e, n) => {
|
|
438
|
-
let r =
|
|
496
|
+
let r = Gt(e), i = n?.error;
|
|
439
497
|
if (r.length !== 0) {
|
|
440
|
-
if (
|
|
498
|
+
if (Kt.test(r) && Jt(i)) {
|
|
441
499
|
let e = Date.now();
|
|
442
|
-
e - t >
|
|
500
|
+
e - t > Yt && (t = e, Ht.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
443
501
|
return;
|
|
444
502
|
}
|
|
445
|
-
|
|
503
|
+
Ht.error(r, {}, i);
|
|
446
504
|
}
|
|
447
505
|
},
|
|
448
506
|
clearScreen: () => {},
|
|
449
507
|
hasErrorLogged: (e) => !1
|
|
450
508
|
};
|
|
451
509
|
return n;
|
|
452
|
-
},
|
|
510
|
+
}, Zt = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), Qt = (e) => {
|
|
453
511
|
try {
|
|
454
512
|
let t = P(e, "tsconfig.json");
|
|
455
513
|
if (!L(t)) return [];
|
|
456
|
-
let n = JSON.parse(
|
|
514
|
+
let n = JSON.parse(Zt(B(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = I(e, i), o = [];
|
|
457
515
|
for (let [e, t] of Object.entries(r)) {
|
|
458
516
|
let n = t[0];
|
|
459
517
|
if (!n) continue;
|
|
@@ -475,12 +533,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
475
533
|
} catch {
|
|
476
534
|
return [];
|
|
477
535
|
}
|
|
478
|
-
},
|
|
536
|
+
}, $t = (e = process.env) => {
|
|
479
537
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
480
538
|
if (t === void 0 || t.trim() === "") return 4;
|
|
481
539
|
let n = Number(t);
|
|
482
540
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
483
|
-
},
|
|
541
|
+
}, en = (e) => {
|
|
484
542
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
485
543
|
let e = r.shift();
|
|
486
544
|
e ? e() : n--;
|
|
@@ -498,8 +556,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
498
556
|
return n;
|
|
499
557
|
}
|
|
500
558
|
};
|
|
501
|
-
},
|
|
502
|
-
let t =
|
|
559
|
+
}, tn = (e) => {
|
|
560
|
+
let t = en(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
503
561
|
return {
|
|
504
562
|
load: (i, a) => {
|
|
505
563
|
if (r.has(i)) return a();
|
|
@@ -529,23 +587,23 @@ __installPublicEnv(publicEnvValues)
|
|
|
529
587
|
return r.size;
|
|
530
588
|
}
|
|
531
589
|
};
|
|
532
|
-
},
|
|
533
|
-
let n = `<script type="application/json" id="${
|
|
590
|
+
}, nn = 1048576, rn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), an = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), on = (e, t) => {
|
|
591
|
+
let n = `<script type="application/json" id="${Y}">${an(t)}<\/script>`;
|
|
534
592
|
return e.includes("</body>") ? e.replace("</body>", `${n}</body>`) : e + n;
|
|
535
|
-
},
|
|
536
|
-
let t = Object.entries(e.errors).map(([e, t]) => `<li><strong>${
|
|
537
|
-
return `<!doctype html><html><head><meta charset="utf-8"><title>Form submission failed</title></head><body><h1>Submission failed</h1>${e.formError === void 0 ? "" : `<p>${
|
|
593
|
+
}, sn = (e) => {
|
|
594
|
+
let t = Object.entries(e.errors).map(([e, t]) => `<li><strong>${rn(e)}</strong>: ${rn(t)}</li>`).join("");
|
|
595
|
+
return `<!doctype html><html><head><meta charset="utf-8"><title>Form submission failed</title></head><body><h1>Submission failed</h1>${e.formError === void 0 ? "" : `<p>${rn(e.formError)}</p>`}<ul>${t}</ul><p><a href="javascript:history.back()">Go back</a> to correct the form.</p></body></html>`;
|
|
538
596
|
}, X = (e, t, n, r = "text/plain; charset=utf-8") => {
|
|
539
597
|
e.statusCode = t, e.setHeader("content-type", r), e.end(n);
|
|
540
|
-
},
|
|
598
|
+
}, cn = (e, t, n) => {
|
|
541
599
|
e.setHeader("cache-control", "no-store"), X(e, t, n, "text/html; charset=utf-8");
|
|
542
|
-
},
|
|
600
|
+
}, ln = (e) => {
|
|
543
601
|
if (e !== void 0 && e !== "" && !(!e.startsWith("/") || e.startsWith("//") || e.includes("\\"))) return e;
|
|
544
|
-
},
|
|
602
|
+
}, un = (e, t) => {
|
|
545
603
|
if (e === void 0 || t === void 0 || t.length === 0) return;
|
|
546
604
|
let n = e.replace(/^\/+/, "").split(/[/?#]/)[0];
|
|
547
605
|
if (n !== void 0 && n !== "") return t.includes(n) ? n : void 0;
|
|
548
|
-
},
|
|
606
|
+
}, dn = (e) => {
|
|
549
607
|
let t = e.referer;
|
|
550
608
|
if (t !== void 0) try {
|
|
551
609
|
let e = new URL(t);
|
|
@@ -553,10 +611,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
553
611
|
} catch {
|
|
554
612
|
return;
|
|
555
613
|
}
|
|
556
|
-
},
|
|
614
|
+
}, fn = (e) => new Promise((t) => {
|
|
557
615
|
let n = [], r = 0;
|
|
558
616
|
e.on("data", (i) => {
|
|
559
|
-
if (r += i.length, r >
|
|
617
|
+
if (r += i.length, r > nn) {
|
|
560
618
|
e.removeAllListeners("data"), e.removeAllListeners("end"), t({ ok: !1 });
|
|
561
619
|
return;
|
|
562
620
|
}
|
|
@@ -565,32 +623,32 @@ __installPublicEnv(publicEnvValues)
|
|
|
565
623
|
ok: !0,
|
|
566
624
|
body: Buffer.concat(n).toString("utf8")
|
|
567
625
|
})), e.on("error", () => t({ ok: !1 }));
|
|
568
|
-
}),
|
|
626
|
+
}), pn = (e) => {
|
|
569
627
|
let t = {};
|
|
570
628
|
for (let [n, r] of Object.entries(e.headers)) typeof r == "string" ? t[n.toLowerCase()] = r : Array.isArray(r) && (t[n.toLowerCase()] = r.join(", "));
|
|
571
629
|
return t;
|
|
572
|
-
},
|
|
573
|
-
let t = e.originGuard ??
|
|
630
|
+
}, mn = (e) => {
|
|
631
|
+
let t = e.originGuard ?? ye(void 0, process.env);
|
|
574
632
|
return async (n, r, i) => {
|
|
575
633
|
let a = (n.url ?? "/").split("?")[0];
|
|
576
634
|
if (!a.startsWith(Ue)) return !1;
|
|
577
635
|
if (n.method !== "POST") return r.setHeader("allow", "POST"), X(r, 405, "method not allowed — a /form/* endpoint accepts native form POSTs only"), !0;
|
|
578
|
-
let o =
|
|
579
|
-
if (!
|
|
636
|
+
let o = pn(n);
|
|
637
|
+
if (!_e({
|
|
580
638
|
headers: o,
|
|
581
639
|
config: t
|
|
582
640
|
}).allowed) return X(r, 403, "origin not allowed"), !0;
|
|
583
641
|
if ((o["content-type"] ?? "").includes("multipart/form-data")) return X(r, 415, "file uploads need JavaScript — the no-JS form path accepts application/x-www-form-urlencoded only"), !0;
|
|
584
|
-
let s = await
|
|
585
|
-
if (!s.ok) return X(r, 413, `form body exceeds ${
|
|
642
|
+
let s = await fn(n);
|
|
643
|
+
if (!s.ok) return X(r, 413, `form body exceeds ${nn} bytes`), !0;
|
|
586
644
|
let c = new URLSearchParams(s.body), l = decodeURIComponent(a.slice(Ue.length)), u = (await e.loadDescriptors())?.[l];
|
|
587
645
|
if (u === void 0 || u.kind !== "mutation") return X(r, 404, `no mutation '${l}' — /form/* serves declared mutations only`), !0;
|
|
588
|
-
let d = c.get(He) ?? l, f =
|
|
646
|
+
let d = c.get(He) ?? l, f = ln(c.get(Ge) ?? void 0), p = [];
|
|
589
647
|
for (let [e, t] of c) e !== He && e !== Ge && p.push([e, t]);
|
|
590
648
|
let m = u.input;
|
|
591
649
|
if (m === void 0) return X(r, 404, `mutation '${l}' carries no input schema — the no-JS path cannot map its POST`), !0;
|
|
592
|
-
let h = Ke(m, p), g = qe(m, h, { locale: await e.resolveLocale(o,
|
|
593
|
-
let n =
|
|
650
|
+
let h = Ke(m, p), g = qe(m, h, { locale: await e.resolveLocale(o, dn(o)) }), _ = async (t) => {
|
|
651
|
+
let n = dn(o);
|
|
594
652
|
if (n !== void 0) {
|
|
595
653
|
if (i !== void 0) {
|
|
596
654
|
i(n, t);
|
|
@@ -602,11 +660,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
602
660
|
flash: t
|
|
603
661
|
});
|
|
604
662
|
if (a !== void 0) {
|
|
605
|
-
|
|
663
|
+
cn(r, 422, on(a, t));
|
|
606
664
|
return;
|
|
607
665
|
}
|
|
608
666
|
}
|
|
609
|
-
|
|
667
|
+
cn(r, 422, sn(t));
|
|
610
668
|
};
|
|
611
669
|
if (!g.valid) return await _({
|
|
612
670
|
formKey: d,
|
|
@@ -626,10 +684,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
626
684
|
formError: t?.message ?? t?._tag ?? "The server rejected this submission. Please try again."
|
|
627
685
|
}), !0;
|
|
628
686
|
}
|
|
629
|
-
let y = f ??
|
|
687
|
+
let y = f ?? dn(o) ?? "/";
|
|
630
688
|
return r.statusCode = 303, r.setHeader("location", y), r.end(), !0;
|
|
631
689
|
};
|
|
632
|
-
},
|
|
690
|
+
}, hn = /^\s*(?:import|export)\s[^;'"]*?['"]([^'"]+)['"]/gm, gn = [
|
|
633
691
|
"",
|
|
634
692
|
".tsx",
|
|
635
693
|
".ts",
|
|
@@ -637,19 +695,19 @@ __installPublicEnv(publicEnvValues)
|
|
|
637
695
|
".js",
|
|
638
696
|
"/index.tsx",
|
|
639
697
|
"/index.ts"
|
|
640
|
-
],
|
|
698
|
+
], _n = (e) => /\.island\.(tsx|ts|jsx|js)$/.test(e), vn = ["@voltro/web", "@voltro/i18n"], yn = ["@voltro/client", "@voltro/ui"], bn = (e, t) => e === t || e.startsWith(`${t}/`), xn = (e) => e !== "@voltro/web/islands" && vn.some((t) => bn(e, t)), Sn = (e) => {
|
|
641
699
|
let t = [];
|
|
642
|
-
for (let n of e.matchAll(
|
|
700
|
+
for (let n of e.matchAll(hn)) t.push(n[1]);
|
|
643
701
|
return t;
|
|
644
|
-
},
|
|
702
|
+
}, Cn = async (e, t) => {
|
|
645
703
|
let n = I(N(e), t);
|
|
646
|
-
for (let e of
|
|
704
|
+
for (let e of gn) {
|
|
647
705
|
let t = n + e;
|
|
648
706
|
try {
|
|
649
707
|
if ((await z.stat(t)).isFile()) return t;
|
|
650
708
|
} catch {}
|
|
651
709
|
}
|
|
652
|
-
},
|
|
710
|
+
}, wn = async (e, t) => {
|
|
653
711
|
let n = P(e, "src", "pages", t), r = /* @__PURE__ */ new Set(), i = [], a = !1, o = [], s = async (t, n) => {
|
|
654
712
|
let c = `${t}\u0000${n ? "i" : "p"}`;
|
|
655
713
|
if (r.has(c)) return;
|
|
@@ -660,64 +718,64 @@ __installPublicEnv(publicEnvValues)
|
|
|
660
718
|
} catch {
|
|
661
719
|
return;
|
|
662
720
|
}
|
|
663
|
-
for (let r of
|
|
721
|
+
for (let r of Sn(l)) {
|
|
664
722
|
if (n) {
|
|
665
|
-
if (
|
|
723
|
+
if (xn(r)) {
|
|
666
724
|
o.push([F(e, t).split(de).join("/"), r]);
|
|
667
725
|
continue;
|
|
668
726
|
}
|
|
669
|
-
if (
|
|
727
|
+
if (yn.some((e) => bn(r, e))) {
|
|
670
728
|
a = !0;
|
|
671
729
|
continue;
|
|
672
730
|
}
|
|
673
731
|
}
|
|
674
732
|
if (!r.startsWith(".")) continue;
|
|
675
|
-
let c = await
|
|
733
|
+
let c = await Cn(t, r);
|
|
676
734
|
if (c === void 0) continue;
|
|
677
|
-
let l = n ||
|
|
678
|
-
if (!n &&
|
|
735
|
+
let l = n || _n(c);
|
|
736
|
+
if (!n && _n(c)) {
|
|
679
737
|
let t = F(e, c).split(de).join("/");
|
|
680
738
|
i.includes(t) || i.push(t);
|
|
681
739
|
}
|
|
682
740
|
await s(c, l);
|
|
683
741
|
}
|
|
684
742
|
};
|
|
685
|
-
return await s(n,
|
|
743
|
+
return await s(n, _n(n)), _n(n) && i.unshift(F(e, n).split(de).join("/")), {
|
|
686
744
|
islandFiles: i,
|
|
687
745
|
usesClient: a,
|
|
688
746
|
violations: o
|
|
689
747
|
};
|
|
690
|
-
},
|
|
748
|
+
}, Tn = (e) => {
|
|
691
749
|
let t = /^export const interactive\s*=\s*['"](full|islands|none)['"]/m.exec(e);
|
|
692
750
|
return t === null ? void 0 : t[1];
|
|
693
|
-
},
|
|
751
|
+
}, En = (e) => {
|
|
694
752
|
let t = e.indexOf("</head>"), n = t === -1 ? e : e.slice(0, t), r = [];
|
|
695
753
|
for (let e of n.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)) {
|
|
696
754
|
let t = e[1] ?? "";
|
|
697
755
|
/\bsrc\s*=/.test(t) || /type\s*=\s*["']module["']/.test(t) || r.push(e[0]);
|
|
698
756
|
}
|
|
699
757
|
return r.map((e) => ` ${e}`).join("\n");
|
|
700
|
-
},
|
|
701
|
-
let n =
|
|
758
|
+
}, Dn = (e) => [...e.matchAll(/<link\b[^>]*\brel\s*=\s*["']stylesheet["'][^>]*>/gi)].map((e) => e[0]), On = (e, t) => {
|
|
759
|
+
let n = Dn(t).filter((t) => !e.includes(t));
|
|
702
760
|
if (n.length === 0) return e;
|
|
703
761
|
let r = n.map((e) => ` ${e}`).join("\n");
|
|
704
762
|
return e.includes("</head>") ? e.replace("</head>", `${r}\n </head>`) : e + r;
|
|
705
|
-
},
|
|
763
|
+
}, kn = (e) => {
|
|
706
764
|
let t = e.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
707
765
|
return t === "" ? "root" : t;
|
|
708
|
-
},
|
|
766
|
+
}, An = class extends Error {
|
|
709
767
|
constructor(e, t) {
|
|
710
768
|
let n = t.map(([e, t]) => ` ${e} imports '${t}'`).join("\n");
|
|
711
769
|
super(`interactive: 'islands' page '${e}' has island code importing the framework barrel:\n${n}\n\nAn island hydrates in its own provider-less root — router hooks, <Link> and useT() throw there, and the '@voltro/web' barrel additionally pulls the Effect runtime into the slim islands entry (the bytes this mode exists to shed).\n\nFix: import island()/hydration APIs from '@voltro/web/islands' (the react-only subpath), move router/i18n-dependent UI out of the island, and keep island files to react + relative browser-safe imports. '@voltro/client' IS allowed — a useSubscription island gets the client boot automatically.`), this.name = "IslandsEntryViolation";
|
|
712
770
|
}
|
|
713
|
-
},
|
|
771
|
+
}, jn = async (e) => {
|
|
714
772
|
let t = P(e.webRoot, ".framework", "island-shells"), n = [];
|
|
715
773
|
if (e.pages.length === 0) return n;
|
|
716
774
|
await z.mkdir(t, { recursive: !0 });
|
|
717
775
|
for (let r of e.pages) {
|
|
718
|
-
let i = await
|
|
719
|
-
if (i.violations.length > 0) throw new
|
|
720
|
-
let a =
|
|
776
|
+
let i = await wn(e.webRoot, r.file);
|
|
777
|
+
if (i.violations.length > 0) throw new An(r.pattern, i.violations);
|
|
778
|
+
let a = kn(r.pattern), o = `island-shells/${a}.tsx`, s = `island-shells/${a}.html`, c = i.islandFiles.map((e) => `import '../../${e}'`).join("\n"), l = i.usesClient ? [
|
|
721
779
|
`// GENERATED by voltro — the islands entry for '${r.pattern}' (client boot:`,
|
|
722
780
|
"// an island here imports @voltro/client, so the roots get a live runtime).",
|
|
723
781
|
...e.apiImports ?? [],
|
|
@@ -762,13 +820,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
762
820
|
});
|
|
763
821
|
}
|
|
764
822
|
return n;
|
|
765
|
-
},
|
|
823
|
+
}, Mn = K({ scope: "voltro:images" }), Nn = /[?&]image(?:&|$)/, Pn = /\.(png|jpe?g|webp|avif)(\?|$)/i, Fn = {
|
|
766
824
|
avif: "image/avif",
|
|
767
825
|
webp: "image/webp",
|
|
768
826
|
jpeg: "image/jpeg",
|
|
769
827
|
png: "image/png"
|
|
770
|
-
},
|
|
771
|
-
let t = e.config ??
|
|
828
|
+
}, In = (e) => J("sha256").update(e).digest("hex").slice(0, 12), Ln = (e) => `export default ${JSON.stringify(e)}\n`, Rn = (e) => {
|
|
829
|
+
let t = e.config ?? A, n = S(e.root), r = /* @__PURE__ */ new Map(), i = "/", a = !1;
|
|
772
830
|
return {
|
|
773
831
|
name: "voltro:image-assets",
|
|
774
832
|
enforce: "pre",
|
|
@@ -776,20 +834,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
776
834
|
i = e.base, a = e.command === "build";
|
|
777
835
|
},
|
|
778
836
|
async load(o) {
|
|
779
|
-
if (!
|
|
780
|
-
let s = o.split("?")[0], c = s, l = await
|
|
781
|
-
if (l === null && s.startsWith("/") && (c = P(e.root, s.slice(1)), l = await
|
|
782
|
-
T(
|
|
837
|
+
if (!Nn.test(o) || !Pn.test(o)) return null;
|
|
838
|
+
let s = o.split("?")[0], c = s, l = await D(c);
|
|
839
|
+
if (l === null && s.startsWith("/") && (c = P(e.root, s.slice(1)), l = await D(c)), l === null && this.error(`?image import points at a file that does not exist or is unreadable: ${s}`), await C() === null) {
|
|
840
|
+
T(Mn);
|
|
783
841
|
let t;
|
|
784
842
|
if (a || e.urlMode === "build-urls") {
|
|
785
|
-
let e = `assets/${
|
|
843
|
+
let e = `assets/${In(c)}${c.slice(c.lastIndexOf("."))}`;
|
|
786
844
|
a && this.emitFile({
|
|
787
845
|
type: "asset",
|
|
788
846
|
fileName: e,
|
|
789
847
|
source: Buffer.from(l)
|
|
790
848
|
}), t = `${i}${e}`;
|
|
791
849
|
} else t = `/@fs${c}`;
|
|
792
|
-
return
|
|
850
|
+
return Ln({
|
|
793
851
|
src: t,
|
|
794
852
|
width: 0,
|
|
795
853
|
height: 0,
|
|
@@ -815,31 +873,31 @@ __installPublicEnv(publicEnvValues)
|
|
|
815
873
|
}), r.set(`${t.format}:${t.width}`, `${i}${n}`);
|
|
816
874
|
}
|
|
817
875
|
let o = (t) => e.widths.map((e) => `${r.get(`${t}:${e}`)} ${e}w`).join(", ");
|
|
818
|
-
return
|
|
876
|
+
return Ln({
|
|
819
877
|
src: r.get(`${e.fallbackFormat}:${e.widths[e.widths.length - 1]}`),
|
|
820
878
|
width: e.width,
|
|
821
879
|
height: e.height,
|
|
822
880
|
blurDataURL: e.blurDataURL,
|
|
823
881
|
srcSet: o(e.fallbackFormat),
|
|
824
882
|
sources: t.formats.map((e) => ({
|
|
825
|
-
type:
|
|
883
|
+
type: Fn[e],
|
|
826
884
|
srcSet: o(e)
|
|
827
885
|
}))
|
|
828
886
|
});
|
|
829
887
|
}
|
|
830
|
-
let u = await
|
|
888
|
+
let u = await ne(l);
|
|
831
889
|
u === null && this.error(`?image import is not a raster image sharp can read: ${c}`);
|
|
832
|
-
let d = J("sha256").update(l).digest("hex").slice(0, 16), f = await
|
|
890
|
+
let d = J("sha256").update(l).digest("hex").slice(0, 16), f = await k(l, d, n), p = In(c);
|
|
833
891
|
r.set(p, c);
|
|
834
|
-
let m =
|
|
835
|
-
return
|
|
892
|
+
let m = te(u.width), h = u.format === "png" ? "png" : "jpeg", g = (e, t) => `/_voltro/image/${p}?w=${e}&f=${t}`, _ = (e) => m.map((t) => `${g(t, e)} ${t}w`).join(", ");
|
|
893
|
+
return Ln({
|
|
836
894
|
src: g(m[m.length - 1], h),
|
|
837
895
|
width: u.width,
|
|
838
896
|
height: u.height,
|
|
839
897
|
blurDataURL: f ?? "",
|
|
840
898
|
srcSet: _(h),
|
|
841
899
|
sources: t.formats.map((e) => ({
|
|
842
|
-
type:
|
|
900
|
+
type: Fn[e],
|
|
843
901
|
srcSet: _(e)
|
|
844
902
|
}))
|
|
845
903
|
});
|
|
@@ -853,11 +911,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
853
911
|
return;
|
|
854
912
|
}
|
|
855
913
|
let c = Number(a.searchParams.get("w")), l = a.searchParams.get("f") ?? "";
|
|
856
|
-
if (!Number.isInteger(c) || c <= 0 || c > 8192 ||
|
|
914
|
+
if (!Number.isInteger(c) || c <= 0 || c > 8192 || Fn[l] === void 0) {
|
|
857
915
|
i.statusCode = 400, i.end("bad transform params");
|
|
858
916
|
return;
|
|
859
917
|
}
|
|
860
|
-
let u = await
|
|
918
|
+
let u = await D(s);
|
|
861
919
|
if (u === null) {
|
|
862
920
|
i.statusCode = 404, i.end("source asset gone");
|
|
863
921
|
return;
|
|
@@ -871,76 +929,76 @@ __installPublicEnv(publicEnvValues)
|
|
|
871
929
|
cacheDir: n
|
|
872
930
|
});
|
|
873
931
|
if (f === null) {
|
|
874
|
-
T(
|
|
932
|
+
T(Mn), i.statusCode = 200, i.setHeader("content-type", Fn[l] ?? "application/octet-stream"), i.end(Buffer.from(u));
|
|
875
933
|
return;
|
|
876
934
|
}
|
|
877
|
-
i.statusCode = 200, i.setHeader("content-type",
|
|
935
|
+
i.statusCode = 200, i.setHeader("content-type", Fn[l]), i.setHeader("cache-control", "max-age=31536000, immutable"), i.end(Buffer.from(f));
|
|
878
936
|
})().catch((e) => {
|
|
879
|
-
|
|
937
|
+
Mn.warn("image transform failed", {}, e), a();
|
|
880
938
|
});
|
|
881
939
|
});
|
|
882
940
|
}
|
|
883
941
|
};
|
|
884
|
-
},
|
|
942
|
+
}, zn = K({ scope: "voltro:fonts" }), Bn = /* @__PURE__ */ new Map(), Vn = async (e, t) => {
|
|
885
943
|
if (t === void 0 || t.length === 0) return null;
|
|
886
|
-
let n =
|
|
887
|
-
return n === void 0 && (n =
|
|
888
|
-
for (let t of e.warnings)
|
|
944
|
+
let n = Bn.get(e);
|
|
945
|
+
return n === void 0 && (n = M(t, async (t) => new Uint8Array(await Ie(P(e, t)))).then((e) => {
|
|
946
|
+
for (let t of e.warnings) j(t, zn);
|
|
889
947
|
return e;
|
|
890
|
-
}),
|
|
891
|
-
},
|
|
948
|
+
}), Bn.set(e, n)), n;
|
|
949
|
+
}, Hn = {
|
|
892
950
|
woff2: "font/woff2",
|
|
893
951
|
woff: "font/woff",
|
|
894
952
|
otf: "font/otf",
|
|
895
953
|
ttf: "font/ttf"
|
|
896
|
-
},
|
|
954
|
+
}, Un = (e, t) => ({
|
|
897
955
|
name: "voltro:font-assets",
|
|
898
956
|
configureServer(n) {
|
|
899
957
|
n.middlewares.use("/assets/fonts", (n, r, i) => {
|
|
900
958
|
(async () => {
|
|
901
|
-
let a = await
|
|
959
|
+
let a = await Vn(e, t), o = (n.url ?? "/").replace(/^\//, "").split("?")[0], s = a?.files.find((e) => e.fileName === `assets/fonts/${o}`);
|
|
902
960
|
if (s === void 0) {
|
|
903
961
|
i();
|
|
904
962
|
return;
|
|
905
963
|
}
|
|
906
964
|
let c = o.slice(o.lastIndexOf(".") + 1);
|
|
907
|
-
r.statusCode = 200, r.setHeader("content-type",
|
|
965
|
+
r.statusCode = 200, r.setHeader("content-type", Hn[c] ?? "application/octet-stream"), r.setHeader("cache-control", "max-age=31536000, immutable"), r.end(Buffer.from(s.bytes));
|
|
908
966
|
})().catch(() => i());
|
|
909
967
|
});
|
|
910
968
|
}
|
|
911
|
-
}),
|
|
969
|
+
}), Wn = K({ scope: "voltro:content" }), Gn = (e) => {
|
|
912
970
|
tt(e);
|
|
913
|
-
},
|
|
971
|
+
}, Kn = (e, t) => `/assets/content-media/${e}${t}`, qn = "assets/content-media", Jn = (e) => {
|
|
914
972
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
915
973
|
return et(({ src: r, entryFile: i }) => {
|
|
916
|
-
let [a = "", o = ""] =
|
|
974
|
+
let [a = "", o = ""] = Qn(r), s = I(N(i), decodeURIComponent(a)), c = t.get(s);
|
|
917
975
|
if (c !== void 0) return c + o;
|
|
918
976
|
if (!L(s)) {
|
|
919
977
|
let e = F(process.cwd(), s);
|
|
920
978
|
return n.includes(e) || n.push(e), r;
|
|
921
979
|
}
|
|
922
|
-
let l = B(s), u = J("sha256").update(l).digest("hex").slice(0, 16), d = ue(s).toLowerCase(), f =
|
|
923
|
-
return R(N(p), { recursive: !0 }),
|
|
980
|
+
let l = B(s), u = J("sha256").update(l).digest("hex").slice(0, 16), d = ue(s).toLowerCase(), f = Kn(u, d), p = P(e, qn, `${u}${d}`);
|
|
981
|
+
return R(N(p), { recursive: !0 }), U(p, l), t.set(s, f), f + o;
|
|
924
982
|
}), { missing: n };
|
|
925
|
-
},
|
|
983
|
+
}, Yn = () => {
|
|
926
984
|
et(({ src: e, entryFile: t }) => {
|
|
927
|
-
let [n = "", r = ""] =
|
|
985
|
+
let [n = "", r = ""] = Qn(e), i = I(N(t), decodeURIComponent(n));
|
|
928
986
|
if (!L(i)) return e;
|
|
929
987
|
let a = B(i), o = J("sha256").update(a).digest("hex").slice(0, 16);
|
|
930
|
-
return
|
|
988
|
+
return Xn.set(o, i), Kn(o, ue(i).toLowerCase()) + r;
|
|
931
989
|
});
|
|
932
|
-
},
|
|
990
|
+
}, Xn = /* @__PURE__ */ new Map(), Zn = (e) => {
|
|
933
991
|
let t = /^\/assets\/content-media\/([0-9a-f]{16})(\.[a-z0-9]+)$/i.exec(e);
|
|
934
992
|
if (t === null) return null;
|
|
935
|
-
let n =
|
|
993
|
+
let n = Xn.get(t[1].toLowerCase());
|
|
936
994
|
return n === void 0 || !L(n) ? null : {
|
|
937
995
|
bytes: B(n),
|
|
938
|
-
contentType:
|
|
996
|
+
contentType: er(t[2])
|
|
939
997
|
};
|
|
940
|
-
},
|
|
998
|
+
}, Qn = (e) => {
|
|
941
999
|
let t = e.search(/[?#]/);
|
|
942
1000
|
return t === -1 ? [e, ""] : [e.slice(0, t), e.slice(t)];
|
|
943
|
-
},
|
|
1001
|
+
}, $n = {
|
|
944
1002
|
".png": "image/png",
|
|
945
1003
|
".jpg": "image/jpeg",
|
|
946
1004
|
".jpeg": "image/jpeg",
|
|
@@ -949,7 +1007,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
949
1007
|
".webp": "image/webp",
|
|
950
1008
|
".avif": "image/avif",
|
|
951
1009
|
".ico": "image/x-icon"
|
|
952
|
-
},
|
|
1010
|
+
}, er = (e) => $n[e.toLowerCase()] ?? "application/octet-stream", tr = async (e, t) => {
|
|
953
1011
|
let n = await Xe(e.collection, e.locale === void 0 ? {} : { locale: e.locale });
|
|
954
1012
|
return Je(n, {
|
|
955
1013
|
title: e.title,
|
|
@@ -958,42 +1016,42 @@ __installPublicEnv(publicEnvValues)
|
|
|
958
1016
|
feedPath: e.path,
|
|
959
1017
|
item: e.item
|
|
960
1018
|
});
|
|
961
|
-
},
|
|
1019
|
+
}, nr = async (e, t, n) => {
|
|
962
1020
|
if (t.length !== 0) {
|
|
963
1021
|
if (n === void 0 || n === "") throw Error("config.feeds needs seo.siteUrl — RSS links must be absolute. Set seo: { siteUrl } in app.config.ts.");
|
|
964
1022
|
for (let r of t) {
|
|
965
|
-
let t = await
|
|
966
|
-
await
|
|
1023
|
+
let t = await tr(r, n), i = P(e, r.path.replace(/^\/+/, ""));
|
|
1024
|
+
await Fe(N(i), { recursive: !0 }), await q(i, t), Wn.info(`feed: ${r.path} (${r.collection})`);
|
|
967
1025
|
}
|
|
968
1026
|
}
|
|
969
|
-
},
|
|
1027
|
+
}, rr = async (e, t) => {
|
|
970
1028
|
let n = await Xe(e, t === void 0 ? {} : { locale: t });
|
|
971
1029
|
return JSON.stringify(n.map(({ html: e, body: t, headings: n, ...r }) => r));
|
|
972
|
-
},
|
|
1030
|
+
}, ir = async (e, t, n) => {
|
|
973
1031
|
let r = await Ze(e, t, n === void 0 ? {} : { locale: n });
|
|
974
1032
|
if (r === null) return null;
|
|
975
1033
|
let { body: i, ...a } = r;
|
|
976
1034
|
return JSON.stringify(a);
|
|
977
|
-
},
|
|
1035
|
+
}, ar = async (e) => {
|
|
978
1036
|
await nt();
|
|
979
|
-
let t =
|
|
1037
|
+
let t = Jn(e), n = 0;
|
|
980
1038
|
for (let t of $e()) {
|
|
981
1039
|
let r = t.i18n?.locales ?? [void 0];
|
|
982
1040
|
for (let i of r) {
|
|
983
|
-
let r = await
|
|
984
|
-
await
|
|
1041
|
+
let r = await rr(t.name, i), a = P(e, Ye(t.name, i));
|
|
1042
|
+
await Fe(N(a), { recursive: !0 }), await q(a, r), n += 1;
|
|
985
1043
|
let o = JSON.parse(r);
|
|
986
1044
|
for (let { slug: r } of o) {
|
|
987
|
-
let a = await
|
|
1045
|
+
let a = await ir(t.name, r, i);
|
|
988
1046
|
if (a === null) continue;
|
|
989
1047
|
let o = P(e, Ye(t.name, i, r));
|
|
990
|
-
await
|
|
1048
|
+
await Fe(N(o), { recursive: !0 }), await q(o, a), n += 1;
|
|
991
1049
|
}
|
|
992
1050
|
}
|
|
993
1051
|
}
|
|
994
1052
|
if (t.missing.length > 0) throw Error(`content: ${t.missing.length} image reference(s) in markdown point at files that do not exist:\n` + t.missing.map((e) => ` - ${e}`).join("\n") + "\n\nA relative image is resolved against the markdown file that references it. Fix the path, or use an absolute `/…` src for an asset you serve yourself.");
|
|
995
|
-
return n > 0 &&
|
|
996
|
-
},
|
|
1053
|
+
return n > 0 && Wn.info(`content: ${n} artifact(s) into dist/assets/content`), n;
|
|
1054
|
+
}, or = async (e) => {
|
|
997
1055
|
let t = /^\/assets\/content\/([A-Za-z0-9_-]+)(?:\.([A-Za-z0-9-]+))?\/(.+)$/.exec(e);
|
|
998
1056
|
if (t === null) return null;
|
|
999
1057
|
let [, n, r, i] = t;
|
|
@@ -1001,9 +1059,9 @@ __installPublicEnv(publicEnvValues)
|
|
|
1001
1059
|
try {
|
|
1002
1060
|
if (i === "index.json") return {
|
|
1003
1061
|
status: 200,
|
|
1004
|
-
body: await
|
|
1062
|
+
body: await rr(n, r)
|
|
1005
1063
|
};
|
|
1006
|
-
let e = await
|
|
1064
|
+
let e = await ir(n, i.replace(/\.json$/, ""), r);
|
|
1007
1065
|
return e === null ? {
|
|
1008
1066
|
status: 404,
|
|
1009
1067
|
body: "\"not found\""
|
|
@@ -1012,12 +1070,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
1012
1070
|
body: e
|
|
1013
1071
|
};
|
|
1014
1072
|
} catch (t) {
|
|
1015
|
-
return
|
|
1073
|
+
return Wn.warn("content request failed", { pathname: e }, t), {
|
|
1016
1074
|
status: 500,
|
|
1017
1075
|
body: "\"content error\""
|
|
1018
1076
|
};
|
|
1019
1077
|
}
|
|
1020
|
-
},
|
|
1078
|
+
}, sr = async (e) => {
|
|
1021
1079
|
let { readdir: t } = await import("node:fs/promises"), n = [], r;
|
|
1022
1080
|
try {
|
|
1023
1081
|
r = await t(e, { withFileTypes: !0 });
|
|
@@ -1027,14 +1085,14 @@ __installPublicEnv(publicEnvValues)
|
|
|
1027
1085
|
for (let t of r) {
|
|
1028
1086
|
if (t.name.startsWith(".") || t.name === "node_modules") continue;
|
|
1029
1087
|
let r = P(e, t.name);
|
|
1030
|
-
t.isDirectory() ? n.push(...await
|
|
1088
|
+
t.isDirectory() ? n.push(...await sr(r)) : /\.collection\.tsx?$/.test(t.name) && n.push(r);
|
|
1031
1089
|
}
|
|
1032
1090
|
return n;
|
|
1033
|
-
},
|
|
1091
|
+
}, cr = (e, t = [], n) => ({
|
|
1034
1092
|
name: "voltro:content",
|
|
1035
1093
|
configureServer(r) {
|
|
1036
|
-
|
|
1037
|
-
let r =
|
|
1094
|
+
Yn(), r.middlewares.use("/assets/content-media", (e, t, n) => {
|
|
1095
|
+
let r = Zn(`/assets/content-media${(e.url ?? "/").split("?")[0]}`);
|
|
1038
1096
|
if (r === null) {
|
|
1039
1097
|
n();
|
|
1040
1098
|
return;
|
|
@@ -1042,10 +1100,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
1042
1100
|
t.setHeader("content-type", r.contentType), t.end(r.bytes);
|
|
1043
1101
|
});
|
|
1044
1102
|
let i = null, a = () => (i ??= (async () => {
|
|
1045
|
-
for (let t of await
|
|
1103
|
+
for (let t of await sr(P(e, "src"))) try {
|
|
1046
1104
|
await r.ssrLoadModule(t);
|
|
1047
1105
|
} catch (e) {
|
|
1048
|
-
|
|
1106
|
+
Wn.warn("failed to load collection module", { file: t }, e);
|
|
1049
1107
|
}
|
|
1050
1108
|
})(), i);
|
|
1051
1109
|
r.watcher.add(P(e, "content")), r.watcher.on("all", (t, n) => {
|
|
@@ -1054,16 +1112,16 @@ __installPublicEnv(publicEnvValues)
|
|
|
1054
1112
|
for (let e of t) r.middlewares.use(e.path, (t, r) => {
|
|
1055
1113
|
(async () => {
|
|
1056
1114
|
await a();
|
|
1057
|
-
let t = await
|
|
1115
|
+
let t = await tr(e, n ?? "http://localhost");
|
|
1058
1116
|
r.setHeader("content-type", "application/rss+xml"), r.end(t);
|
|
1059
1117
|
})().catch((t) => {
|
|
1060
|
-
|
|
1118
|
+
Wn.warn("feed render failed", { path: e.path }, t), r.statusCode = 500, r.end("feed error");
|
|
1061
1119
|
});
|
|
1062
1120
|
});
|
|
1063
1121
|
r.middlewares.use("/assets/content", (e, t, n) => {
|
|
1064
1122
|
(async () => {
|
|
1065
1123
|
await a();
|
|
1066
|
-
let r = await
|
|
1124
|
+
let r = await or(`/assets/content${(e.url ?? "/").split("?")[0]}`);
|
|
1067
1125
|
if (r === null) {
|
|
1068
1126
|
n();
|
|
1069
1127
|
return;
|
|
@@ -1072,24 +1130,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
1072
1130
|
})().catch(() => n());
|
|
1073
1131
|
});
|
|
1074
1132
|
}
|
|
1075
|
-
}),
|
|
1076
|
-
if (
|
|
1133
|
+
}), lr, ur = async () => {
|
|
1134
|
+
if (lr !== void 0) return lr;
|
|
1077
1135
|
try {
|
|
1078
1136
|
let e = await import("satori");
|
|
1079
|
-
|
|
1137
|
+
lr = e.default ?? e;
|
|
1080
1138
|
} catch {
|
|
1081
|
-
|
|
1139
|
+
lr = null;
|
|
1082
1140
|
}
|
|
1083
|
-
return
|
|
1084
|
-
},
|
|
1085
|
-
if (
|
|
1141
|
+
return lr;
|
|
1142
|
+
}, dr, fr = async () => {
|
|
1143
|
+
if (dr !== void 0) return dr;
|
|
1086
1144
|
try {
|
|
1087
|
-
|
|
1145
|
+
dr = await import("@resvg/resvg-js");
|
|
1088
1146
|
} catch {
|
|
1089
|
-
|
|
1147
|
+
dr = null;
|
|
1090
1148
|
}
|
|
1091
|
-
return
|
|
1092
|
-
},
|
|
1149
|
+
return dr;
|
|
1150
|
+
}, pr = async (e, t) => {
|
|
1093
1151
|
if (t === void 0 || t.length === 0) throw Error("ogImage needs a declared font: satori cannot render text without a font buffer, and there is no bundled default (that would ship a license artifact most projects replace). Declare one in app.config.ts — fonts: [{ family: 'Inter', src: [{ path: 'src/fonts/Inter.woff2' }] }] — see the Fonts docs.");
|
|
1094
1152
|
let n = [];
|
|
1095
1153
|
for (let r of t) for (let t of r.src) {
|
|
@@ -1102,8 +1160,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
1102
1160
|
});
|
|
1103
1161
|
}
|
|
1104
1162
|
return n;
|
|
1105
|
-
},
|
|
1106
|
-
let t = await
|
|
1163
|
+
}, mr = async (e) => {
|
|
1164
|
+
let t = await ur(), n = await fr();
|
|
1107
1165
|
if (t === null || n === null) {
|
|
1108
1166
|
let e = [t === null ? "satori" : null, n === null ? "@resvg/resvg-js" : null].filter((e) => e !== null).join(" + ");
|
|
1109
1167
|
throw Error(`ogImage cannot render: ${e} is not loadable. Both ship as optional dependencies of @voltro/cli — if your installer omitted optional dependencies, run \`pnpm add -D satori @resvg/resvg-js\` in this app.`);
|
|
@@ -1120,7 +1178,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1120
1178
|
svg: r,
|
|
1121
1179
|
png: new Uint8Array(new n.Resvg(r).render().asPng())
|
|
1122
1180
|
};
|
|
1123
|
-
},
|
|
1181
|
+
}, hr = (e, t, n, r) => `${e}\u0000${t}\u0000${n}\u0000${r}`, gr = (e, t) => Le("sha256", e).update(t).digest("hex"), _r = () => {
|
|
1124
1182
|
let e = process.env.VOLTRO_OG_SECRET;
|
|
1125
1183
|
return e !== void 0 && e !== "" ? {
|
|
1126
1184
|
secret: e,
|
|
@@ -1129,12 +1187,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
1129
1187
|
secret: Re(32).toString("hex"),
|
|
1130
1188
|
fromEnv: !1
|
|
1131
1189
|
};
|
|
1132
|
-
},
|
|
1133
|
-
let t = e.ttlMs ?? 36e5, n, r = () => (n ??=
|
|
1190
|
+
}, vr = "/_voltro/og", yr = (e) => {
|
|
1191
|
+
let t = e.ttlMs ?? 36e5, n, r = () => (n ??= pr(e.root, e.fonts), n);
|
|
1134
1192
|
return {
|
|
1135
1193
|
signOgUrl: ({ pattern: t, params: n, tenant: r, locale: i }) => {
|
|
1136
|
-
let a = JSON.stringify(n), o = r ?? "", s = i ?? "", c =
|
|
1137
|
-
return `${
|
|
1194
|
+
let a = JSON.stringify(n), o = r ?? "", s = i ?? "", c = gr(e.secret, hr(t, a, o, s));
|
|
1195
|
+
return `${vr}?${new URLSearchParams({
|
|
1138
1196
|
route: t,
|
|
1139
1197
|
p: a,
|
|
1140
1198
|
...o === "" ? {} : { t: o },
|
|
@@ -1144,7 +1202,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1144
1202
|
},
|
|
1145
1203
|
handle: async (n) => {
|
|
1146
1204
|
if (n.pathname !== "/_voltro/og") return null;
|
|
1147
|
-
let i = n.searchParams.get("route") ?? "", a = n.searchParams.get("p") ?? "{}", o = n.searchParams.get("t") ?? "", s = n.searchParams.get("l") ?? "", c = n.searchParams.get("sig") ?? "", l =
|
|
1205
|
+
let i = n.searchParams.get("route") ?? "", a = n.searchParams.get("p") ?? "{}", o = n.searchParams.get("t") ?? "", s = n.searchParams.get("l") ?? "", c = n.searchParams.get("sig") ?? "", l = gr(e.secret, hr(i, a, o, s)), u = Buffer.from(c, "utf8"), d = Buffer.from(l, "utf8");
|
|
1148
1206
|
if (u.length !== d.length || !ze(u, d)) return {
|
|
1149
1207
|
status: 403,
|
|
1150
1208
|
headers: { "content-type": "text/plain" },
|
|
@@ -1170,7 +1228,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1170
1228
|
headers: { "content-type": "text/plain" },
|
|
1171
1229
|
body: new TextEncoder().encode("page has no ogImage")
|
|
1172
1230
|
};
|
|
1173
|
-
let { png: g } = await
|
|
1231
|
+
let { png: g } = await mr({
|
|
1174
1232
|
element: await h({
|
|
1175
1233
|
params: JSON.parse(a),
|
|
1176
1234
|
loaderData: void 0,
|
|
@@ -1196,7 +1254,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1196
1254
|
};
|
|
1197
1255
|
}
|
|
1198
1256
|
};
|
|
1199
|
-
},
|
|
1257
|
+
}, br = (e) => {
|
|
1200
1258
|
let t = [];
|
|
1201
1259
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
1202
1260
|
name: n.slice(5, -2),
|
|
@@ -1212,7 +1270,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1212
1270
|
optional: !1
|
|
1213
1271
|
});
|
|
1214
1272
|
return t;
|
|
1215
|
-
},
|
|
1273
|
+
}, xr = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), Sr = async (e) => {
|
|
1216
1274
|
let t = I(e);
|
|
1217
1275
|
for (let e = 0; e < 4; e++) {
|
|
1218
1276
|
let e = P(t, "project.json");
|
|
@@ -1230,8 +1288,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
1230
1288
|
t = n;
|
|
1231
1289
|
}
|
|
1232
1290
|
return null;
|
|
1233
|
-
},
|
|
1234
|
-
let t = await
|
|
1291
|
+
}, Cr = async (e) => {
|
|
1292
|
+
let t = await Sr(e);
|
|
1235
1293
|
if (!t) return [];
|
|
1236
1294
|
let { projectDir: n, manifest: r } = t, i = le(e), a = r.apps ?? {}, o = [];
|
|
1237
1295
|
for (let [e, t] of Object.entries(a)) {
|
|
@@ -1240,23 +1298,23 @@ __installPublicEnv(publicEnvValues)
|
|
|
1240
1298
|
if (!L(a)) continue;
|
|
1241
1299
|
let s;
|
|
1242
1300
|
try {
|
|
1243
|
-
let { pages: e } = await
|
|
1301
|
+
let { pages: e } = await Wo(a);
|
|
1244
1302
|
s = e.map((e) => ({
|
|
1245
1303
|
pattern: e.pattern,
|
|
1246
|
-
params:
|
|
1304
|
+
params: br(e.pattern)
|
|
1247
1305
|
}));
|
|
1248
1306
|
} catch {
|
|
1249
1307
|
continue;
|
|
1250
1308
|
}
|
|
1251
1309
|
o.push({
|
|
1252
|
-
key:
|
|
1310
|
+
key: xr(e),
|
|
1253
1311
|
origin: `http://localhost:${t.port}`,
|
|
1254
1312
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
1255
1313
|
routes: s
|
|
1256
1314
|
});
|
|
1257
1315
|
}
|
|
1258
1316
|
return o;
|
|
1259
|
-
},
|
|
1317
|
+
}, wr = (e) => {
|
|
1260
1318
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
1261
1319
|
let t = e.pattern;
|
|
1262
1320
|
for (let n of e.params) {
|
|
@@ -1264,17 +1322,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
1264
1322
|
t = t.replace(e, r);
|
|
1265
1323
|
}
|
|
1266
1324
|
return "`" + t + "`";
|
|
1267
|
-
},
|
|
1325
|
+
}, Tr = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
1268
1326
|
let t = "string";
|
|
1269
1327
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
1270
|
-
}).join("; ")} }`,
|
|
1271
|
-
let r =
|
|
1328
|
+
}).join("; ")} }`, Er = (e, t, n) => {
|
|
1329
|
+
let r = Tr(e), i = wr(e), a = t ? "VoltroExternalUrl" : e.search === void 0 ? "VoltroRouteUrl" : `VoltroRouteUrl<Schema.Schema.Type<typeof ${e.search.alias}>>`, o = t && n ? `${n} + ` : "";
|
|
1272
1330
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
1273
|
-
},
|
|
1331
|
+
}, Dr = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${Er(e, !1)},`).join("\n")}\n}`, Or = (e, t) => {
|
|
1274
1332
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
1275
|
-
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)}: ${
|
|
1333
|
+
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)}: ${Er(e, !0, i)},`);
|
|
1276
1334
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
1277
|
-
},
|
|
1335
|
+
}, kr = async (e) => {
|
|
1278
1336
|
let t = await Promise.all(e.pages.map(async (t) => {
|
|
1279
1337
|
let n;
|
|
1280
1338
|
try {
|
|
@@ -1286,10 +1344,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
1286
1344
|
} catch {}
|
|
1287
1345
|
return {
|
|
1288
1346
|
pattern: t.pattern,
|
|
1289
|
-
params:
|
|
1347
|
+
params: br(t.pattern),
|
|
1290
1348
|
...n === void 0 ? {} : { search: n }
|
|
1291
1349
|
};
|
|
1292
|
-
})), n = await
|
|
1350
|
+
})), n = await Cr(e.appRoot), r = t.filter((e) => e.search !== void 0).sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => `import type { searchParams as ${e.search.alias} } from '${e.search.specifier}'`), i = [
|
|
1293
1351
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
1294
1352
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
1295
1353
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -1305,7 +1363,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1305
1363
|
"",
|
|
1306
1364
|
"type EmptyParams = Record<string, never>",
|
|
1307
1365
|
""
|
|
1308
|
-
].join("\n"), a = e.mode ?? "dev", o = `${i}\n${`export const routes = ${
|
|
1366
|
+
].join("\n"), a = e.mode ?? "dev", o = `${i}\n${`export const routes = ${Dr(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => Or(e, a)).join("\n")}\n} as const\n`}`, s = P(e.appRoot, ".framework", "routes.generated.ts");
|
|
1309
1367
|
await z.mkdir(N(s), { recursive: !0 });
|
|
1310
1368
|
let c = null;
|
|
1311
1369
|
try {
|
|
@@ -1318,48 +1376,48 @@ __installPublicEnv(publicEnvValues)
|
|
|
1318
1376
|
path: s,
|
|
1319
1377
|
wrote: !0
|
|
1320
1378
|
});
|
|
1321
|
-
},
|
|
1379
|
+
}, Ar = (e) => {
|
|
1322
1380
|
if (e === "" || e === "/") return "/";
|
|
1323
1381
|
let t = e.startsWith("/") ? e : `/${e}`;
|
|
1324
1382
|
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
1325
|
-
},
|
|
1326
|
-
let n = e.endsWith("/") ? e.slice(0, -1) : e, r =
|
|
1383
|
+
}, jr = (e, t) => {
|
|
1384
|
+
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = Ar(t);
|
|
1327
1385
|
return r === "/" ? `${n}/` : `${n}${r}`;
|
|
1328
|
-
},
|
|
1329
|
-
let r =
|
|
1386
|
+
}, Mr = (e, t, n) => {
|
|
1387
|
+
let r = Ar(e);
|
|
1330
1388
|
return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
|
|
1331
|
-
},
|
|
1389
|
+
}, Nr = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), Pr = (e) => {
|
|
1332
1390
|
let { siteUrl: t, entries: n } = e, r = e.locales && e.locales.length > 1 ? e.locales : void 0, i = e.defaultLocale ?? r?.[0] ?? "en", a = r !== void 0, o = /* @__PURE__ */ new Map(), s = (e) => {
|
|
1333
1391
|
if (!r) return "";
|
|
1334
|
-
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${
|
|
1335
|
-
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${
|
|
1392
|
+
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${Nr(n)}" href="${Nr(jr(t, Mr(e, n, i)))}" />`);
|
|
1393
|
+
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${Nr(jr(t, Mr(e, i, i)))}" />`), `\n${n.join("\n")}`;
|
|
1336
1394
|
};
|
|
1337
1395
|
for (let e of n) {
|
|
1338
1396
|
let n = r ?? [i];
|
|
1339
1397
|
for (let r of n) {
|
|
1340
|
-
let n =
|
|
1341
|
-
o.set(n, ` <url>\n <loc>${
|
|
1398
|
+
let n = jr(t, Mr(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${Nr(e.lastmod)}</lastmod>` : "";
|
|
1399
|
+
o.set(n, ` <url>\n <loc>${Nr(n)}</loc>${a}${s(e.path)}\n </url>`);
|
|
1342
1400
|
}
|
|
1343
1401
|
}
|
|
1344
1402
|
let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
|
|
1345
1403
|
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset${a ? " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"" : " xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\""}>\n${c}\n</urlset>\n`;
|
|
1346
|
-
},
|
|
1404
|
+
}, Fr = (e) => {
|
|
1347
1405
|
if (!e.indexable) return "User-agent: *\nDisallow: /\n";
|
|
1348
1406
|
let t = ["User-agent: *", "Allow: /"];
|
|
1349
|
-
for (let n of e.disallow ?? []) t.push(`Disallow: ${
|
|
1407
|
+
for (let n of e.disallow ?? []) t.push(`Disallow: ${Ar(n)}`);
|
|
1350
1408
|
return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
|
|
1351
|
-
},
|
|
1352
|
-
let n =
|
|
1409
|
+
}, Ir = 8e3, Lr = (e, t = Ir) => {
|
|
1410
|
+
let n = zr(e);
|
|
1353
1411
|
return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
|
|
1354
|
-
},
|
|
1412
|
+
}, Rr = 4, zr = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
|
|
1355
1413
|
if (e instanceof Error) {
|
|
1356
1414
|
let r = e.stack ?? `${e.name}: ${e.message}`;
|
|
1357
1415
|
if (n.has(e)) return `${r}\n [cycle]`;
|
|
1358
1416
|
n.add(e);
|
|
1359
1417
|
let i = [];
|
|
1360
|
-
if (t <
|
|
1361
|
-
if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${
|
|
1362
|
-
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${
|
|
1418
|
+
if (t < Rr) {
|
|
1419
|
+
if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Br(zr(a, t + 1, n))}`);
|
|
1420
|
+
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Br(zr(e.cause, t + 1, n))}`);
|
|
1363
1421
|
}
|
|
1364
1422
|
return r + i.join("");
|
|
1365
1423
|
}
|
|
@@ -1368,30 +1426,30 @@ __installPublicEnv(publicEnvValues)
|
|
|
1368
1426
|
} catch {
|
|
1369
1427
|
return "[unstringifiable thrown value]";
|
|
1370
1428
|
}
|
|
1371
|
-
},
|
|
1429
|
+
}, Br = (e) => {
|
|
1372
1430
|
let t = e.split("\n");
|
|
1373
1431
|
return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
|
|
1374
|
-
},
|
|
1432
|
+
}, Vr = {
|
|
1375
1433
|
trace: 0,
|
|
1376
1434
|
debug: 1,
|
|
1377
1435
|
info: 2,
|
|
1378
1436
|
warn: 3,
|
|
1379
1437
|
error: 4,
|
|
1380
1438
|
fatal: 5
|
|
1381
|
-
},
|
|
1439
|
+
}, Hr = 2e3, Ur = 200, Wr = class {
|
|
1382
1440
|
capacity;
|
|
1383
1441
|
buffer = [];
|
|
1384
|
-
constructor(e =
|
|
1442
|
+
constructor(e = Hr) {
|
|
1385
1443
|
this.capacity = e;
|
|
1386
1444
|
}
|
|
1387
1445
|
append(e) {
|
|
1388
1446
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
1389
1447
|
}
|
|
1390
1448
|
query(e = {}) {
|
|
1391
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
1449
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Ur, this.capacity), i = e.minLevel === void 0 ? Vr.trace : Vr[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
1392
1450
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
1393
1451
|
let r = this.buffer[e];
|
|
1394
|
-
r.ts < t || r.ts > n ||
|
|
1452
|
+
r.ts < t || r.ts > n || Vr[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));
|
|
1395
1453
|
}
|
|
1396
1454
|
return l.reverse();
|
|
1397
1455
|
}
|
|
@@ -1404,7 +1462,9 @@ __installPublicEnv(publicEnvValues)
|
|
|
1404
1462
|
clear() {
|
|
1405
1463
|
this.buffer = [];
|
|
1406
1464
|
}
|
|
1407
|
-
},
|
|
1465
|
+
}, Gr = null, Kr = () => (Gr === null && (Gr = new Wr()), Gr), qr = (e) => {
|
|
1466
|
+
Gr = e;
|
|
1467
|
+
}, Jr = (e) => {
|
|
1408
1468
|
if (typeof e == "string") return e;
|
|
1409
1469
|
if (e instanceof Error) return e.message;
|
|
1410
1470
|
try {
|
|
@@ -1412,28 +1472,28 @@ __installPublicEnv(publicEnvValues)
|
|
|
1412
1472
|
} catch {
|
|
1413
1473
|
return String(e);
|
|
1414
1474
|
}
|
|
1415
|
-
},
|
|
1475
|
+
}, Yr = 8e3, Xr = (e) => typeof e == "string" ? e.length <= Yr ? e : `${e.slice(0, Yr)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Lr(e, Yr), Zr = (e, t) => {
|
|
1416
1476
|
try {
|
|
1417
1477
|
e(...t);
|
|
1418
1478
|
} catch (n) {
|
|
1419
1479
|
try {
|
|
1420
|
-
e(...t.map(
|
|
1480
|
+
e(...t.map(Xr)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Yr} chars per argument.`);
|
|
1421
1481
|
} catch {
|
|
1422
1482
|
e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
|
|
1423
1483
|
}
|
|
1424
1484
|
}
|
|
1425
|
-
},
|
|
1485
|
+
}, Qr = (e) => {
|
|
1426
1486
|
let t = {
|
|
1427
1487
|
log: console.log.bind(console),
|
|
1428
1488
|
info: console.info.bind(console),
|
|
1429
1489
|
warn: console.warn.bind(console),
|
|
1430
1490
|
error: console.error.bind(console),
|
|
1431
1491
|
debug: console.debug.bind(console)
|
|
1432
|
-
}, n =
|
|
1433
|
-
if (
|
|
1492
|
+
}, n = Kr(), r = !1, i = (i) => (...a) => {
|
|
1493
|
+
if (Zr(t[i], a), !r) {
|
|
1434
1494
|
r = !0;
|
|
1435
1495
|
try {
|
|
1436
|
-
let t = a.length > 0 ?
|
|
1496
|
+
let t = a.length > 0 ? Jr(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = ve();
|
|
1437
1497
|
e.emit("log", {
|
|
1438
1498
|
level: i,
|
|
1439
1499
|
message: r,
|
|
@@ -1460,7 +1520,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1460
1520
|
}
|
|
1461
1521
|
};
|
|
1462
1522
|
console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
|
|
1463
|
-
let a =
|
|
1523
|
+
let a = me((t) => {
|
|
1464
1524
|
if (!r) {
|
|
1465
1525
|
r = !0;
|
|
1466
1526
|
try {
|
|
@@ -1471,7 +1531,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1471
1531
|
argsCount: 1,
|
|
1472
1532
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
1473
1533
|
});
|
|
1474
|
-
let a =
|
|
1534
|
+
let a = ve(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
1475
1535
|
...t.fields,
|
|
1476
1536
|
traceId: a.traceId
|
|
1477
1537
|
} : t.fields;
|
|
@@ -1491,24 +1551,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
1491
1551
|
return () => {
|
|
1492
1552
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
1493
1553
|
};
|
|
1494
|
-
},
|
|
1554
|
+
}, $r = 2e3, ei = 8, ti = 1e3, ni = 200, ri = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, ii = (e) => {
|
|
1495
1555
|
switch (e) {
|
|
1496
1556
|
case "error": return "error";
|
|
1497
1557
|
case "warn": return "warn";
|
|
1498
1558
|
case "debug": return "debug";
|
|
1499
1559
|
default: return "info";
|
|
1500
1560
|
}
|
|
1501
|
-
},
|
|
1561
|
+
}, ai = K({ scope: "client" }), oi = (e, t) => {
|
|
1502
1562
|
let n;
|
|
1503
1563
|
try {
|
|
1504
1564
|
n = JSON.parse(e);
|
|
1505
1565
|
} catch {
|
|
1506
|
-
return
|
|
1566
|
+
return si(400, { error: "invalid JSON body" });
|
|
1507
1567
|
}
|
|
1508
|
-
if (typeof n != "object" || !n) return
|
|
1568
|
+
if (typeof n != "object" || !n) return si(400, { error: "body must be a JSON object" });
|
|
1509
1569
|
let r = n;
|
|
1510
|
-
if (!Array.isArray(r.entries)) return
|
|
1511
|
-
let i = typeof r.app == "string" ?
|
|
1570
|
+
if (!Array.isArray(r.entries)) return si(400, { error: "entries must be an array" });
|
|
1571
|
+
let i = typeof r.app == "string" ? ri(r.app, 120) : void 0, a = typeof r.page == "string" ? ri(r.page, 200) : void 0, o = typeof r.ua == "string" ? ri(r.ua, 200) : void 0, s = r.entries.slice(0, ni), c = 0;
|
|
1512
1572
|
for (let e of s) {
|
|
1513
1573
|
if (typeof e != "object" || !e) continue;
|
|
1514
1574
|
let n = e;
|
|
@@ -1519,7 +1579,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1519
1579
|
"warn",
|
|
1520
1580
|
"error",
|
|
1521
1581
|
"debug"
|
|
1522
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l =
|
|
1582
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = ri(n.message, $r), u = Array.isArray(n.args) ? n.args.slice(0, ei).filter((e) => typeof e == "string").map((e) => ri(e, ti)) : void 0, d = typeof n.stack == "string" ? ri(n.stack, $r) : void 0;
|
|
1523
1583
|
t.emit("clientLog", {
|
|
1524
1584
|
ts: s,
|
|
1525
1585
|
level: r,
|
|
@@ -1534,35 +1594,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
1534
1594
|
...i === void 0 ? {} : { app: i },
|
|
1535
1595
|
...a === void 0 ? {} : { page: a },
|
|
1536
1596
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
1537
|
-
}, p =
|
|
1538
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
1597
|
+
}, p = ii(r);
|
|
1598
|
+
(p === "error" || p === "warn") && d !== void 0 ? ai[p](l, f, { stack: d }) : ai[p](l, {
|
|
1539
1599
|
...f,
|
|
1540
1600
|
...d === void 0 ? {} : { stack: d }
|
|
1541
1601
|
}), c++;
|
|
1542
1602
|
}
|
|
1543
|
-
return
|
|
1603
|
+
return si(202, {
|
|
1544
1604
|
accepted: c,
|
|
1545
1605
|
dropped: r.entries.length - c
|
|
1546
1606
|
});
|
|
1547
|
-
},
|
|
1607
|
+
}, si = (e, t) => ({
|
|
1548
1608
|
status: e,
|
|
1549
1609
|
contentType: "application/json; charset=utf-8",
|
|
1550
1610
|
body: JSON.stringify(t)
|
|
1551
|
-
}),
|
|
1611
|
+
}), ci = "/_voltro/inspect/clientLog", li = [
|
|
1552
1612
|
"trace",
|
|
1553
1613
|
"debug",
|
|
1554
1614
|
"info",
|
|
1555
1615
|
"warn",
|
|
1556
1616
|
"error",
|
|
1557
1617
|
"fatal"
|
|
1558
|
-
],
|
|
1618
|
+
], ui = {
|
|
1559
1619
|
trace: "TRACE",
|
|
1560
1620
|
debug: "DEBUG",
|
|
1561
1621
|
info: "INFO ",
|
|
1562
1622
|
warn: "WARN ",
|
|
1563
1623
|
error: "ERROR",
|
|
1564
1624
|
fatal: "FATAL"
|
|
1565
|
-
},
|
|
1625
|
+
}, di = (e) => li.includes(e), fi = (e, t, n = {}) => {
|
|
1566
1626
|
if (s()) return {
|
|
1567
1627
|
status: 503,
|
|
1568
1628
|
contentType: "application/json",
|
|
@@ -1593,7 +1653,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1593
1653
|
Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
|
|
1594
1654
|
}
|
|
1595
1655
|
let f = a.get("level");
|
|
1596
|
-
f !== null &&
|
|
1656
|
+
f !== null && di(f) && (o.minLevel = f);
|
|
1597
1657
|
let p = a.get("source");
|
|
1598
1658
|
(p === "server" || p === "client") && (o.source = p);
|
|
1599
1659
|
let m = a.get("scope");
|
|
@@ -1606,7 +1666,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1606
1666
|
if ((a.get("format") ?? "json") === "text") return {
|
|
1607
1667
|
status: 200,
|
|
1608
1668
|
contentType: "text/plain; charset=utf-8",
|
|
1609
|
-
body: _.map(
|
|
1669
|
+
body: _.map(pi).join("\n") + (_.length > 0 ? "\n" : "")
|
|
1610
1670
|
};
|
|
1611
1671
|
let v = {
|
|
1612
1672
|
capturedAt: Date.now(),
|
|
@@ -1620,40 +1680,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
1620
1680
|
contentType: "application/json; charset=utf-8",
|
|
1621
1681
|
body: JSON.stringify(v)
|
|
1622
1682
|
};
|
|
1623
|
-
},
|
|
1624
|
-
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 =
|
|
1625
|
-
return `${n}:${r}:${i}.${a} ${
|
|
1626
|
-
},
|
|
1683
|
+
}, pi = (e) => {
|
|
1684
|
+
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 = hi(e.fields);
|
|
1685
|
+
return `${n}:${r}:${i}.${a} ${ui[e.level]} ${o} ${e.message}${s}`;
|
|
1686
|
+
}, mi = 80, hi = (e) => {
|
|
1627
1687
|
let t = Object.entries(e);
|
|
1628
1688
|
if (t.length === 0) return "";
|
|
1629
1689
|
let n = [];
|
|
1630
1690
|
for (let [e, r] of t) {
|
|
1631
1691
|
if (r === void 0) continue;
|
|
1632
|
-
let t =
|
|
1692
|
+
let t = gi(r);
|
|
1633
1693
|
n.push(`${e}=${t}`);
|
|
1634
1694
|
}
|
|
1635
1695
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
1636
|
-
},
|
|
1696
|
+
}, gi = (e) => {
|
|
1637
1697
|
if (typeof e == "string") {
|
|
1638
|
-
let t = e.length >
|
|
1698
|
+
let t = e.length > mi ? e.slice(0, mi) + "…" : e;
|
|
1639
1699
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
1640
1700
|
}
|
|
1641
1701
|
if (e === null) return "null";
|
|
1642
1702
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
1643
1703
|
try {
|
|
1644
1704
|
let t = JSON.stringify(e);
|
|
1645
|
-
return t.length >
|
|
1705
|
+
return t.length > mi ? t.slice(0, mi) + "…" : t;
|
|
1646
1706
|
} catch {
|
|
1647
1707
|
return "[unserialisable]";
|
|
1648
1708
|
}
|
|
1649
|
-
},
|
|
1709
|
+
}, _i = "/_voltro/inspect/logs", vi = (e, t, n) => {
|
|
1650
1710
|
if (t.headers.authorization !== void 0) return !1;
|
|
1651
1711
|
let { token: r } = n;
|
|
1652
1712
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
1653
1713
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
1654
1714
|
let i = n.writeToken;
|
|
1655
1715
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
1656
|
-
},
|
|
1716
|
+
}, yi = [{
|
|
1657
1717
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1658
1718
|
handle: (e, t) => {
|
|
1659
1719
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1665,13 +1725,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1665
1725
|
});
|
|
1666
1726
|
} else t.info(n);
|
|
1667
1727
|
}
|
|
1668
|
-
}],
|
|
1728
|
+
}], bi = () => {
|
|
1669
1729
|
let e = {
|
|
1670
1730
|
warn: console.warn.bind(console),
|
|
1671
1731
|
error: console.error.bind(console)
|
|
1672
|
-
}, t =
|
|
1732
|
+
}, t = K({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1673
1733
|
if (!n) {
|
|
1674
|
-
for (let e of
|
|
1734
|
+
for (let e of yi) if (e.match(i[0])) {
|
|
1675
1735
|
n = !0;
|
|
1676
1736
|
try {
|
|
1677
1737
|
e.handle(i, t);
|
|
@@ -1686,7 +1746,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1686
1746
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1687
1747
|
console.warn = e.warn, console.error = e.error;
|
|
1688
1748
|
};
|
|
1689
|
-
},
|
|
1749
|
+
}, xi = {
|
|
1690
1750
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1691
1751
|
renderMode: "it picks the server render strategy",
|
|
1692
1752
|
dynamic: "it picks the server render strategy",
|
|
@@ -1699,7 +1759,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1699
1759
|
tenantAware: "it is part of the server-side cache key",
|
|
1700
1760
|
ogImage: "the server renders it into the og:image PNG",
|
|
1701
1761
|
ppr: "it switches the isr path to partial prerendering (cached shell + per-request holes)"
|
|
1702
|
-
},
|
|
1762
|
+
}, Si = Object.keys(xi), Ci = "virtual:voltro-route-refresh", wi = `\0${Ci}`, Ti = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, Ei = () => `
|
|
1703
1763
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1704
1764
|
|
|
1705
1765
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1728,11 +1788,11 @@ const stableForm = (value) => {
|
|
|
1728
1788
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1729
1789
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1730
1790
|
* value. Everything else a page exports is plain client-side data. */
|
|
1731
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1791
|
+
const serverRelevantExports = ${JSON.stringify(Si)}
|
|
1732
1792
|
|
|
1733
1793
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1734
1794
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1735
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1795
|
+
const serverExportEffect = ${JSON.stringify(xi)}
|
|
1736
1796
|
|
|
1737
1797
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1738
1798
|
export const serverEffectOf = (name) =>
|
|
@@ -1775,7 +1835,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1775
1835
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1776
1836
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1777
1837
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1778
|
-
`,
|
|
1838
|
+
`, Di = (e) => `
|
|
1779
1839
|
if (import.meta.hot) {
|
|
1780
1840
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1781
1841
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1802,30 +1862,30 @@ import {
|
|
|
1802
1862
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1803
1863
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1804
1864
|
serverEffectOf as __voltro_serverEffect,
|
|
1805
|
-
} from '${
|
|
1806
|
-
`,
|
|
1807
|
-
let [n = "", r] =
|
|
1808
|
-
if (!n.endsWith(".tsx") || r !== void 0 &&
|
|
1809
|
-
let i =
|
|
1865
|
+
} from '${Ci}'
|
|
1866
|
+
`, Oi = (e) => e.replace(/\\/g, "/"), ki = (e, t) => {
|
|
1867
|
+
let [n = "", r] = Oi(e).split("?");
|
|
1868
|
+
if (!n.endsWith(".tsx") || r !== void 0 && Ti.test(r)) return !1;
|
|
1869
|
+
let i = Oi(t).replace(/\/$/, "");
|
|
1810
1870
|
return n.startsWith(`${i}/`) ? p.test(n) || d.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
|
|
1811
|
-
},
|
|
1871
|
+
}, Ai = (e, t, n) => ki(t, n) ? `${e}${Di(Oi(t).split("?")[0] ?? t)}` : null, ji = (e) => ({
|
|
1812
1872
|
name: "voltro:route-fast-refresh",
|
|
1813
1873
|
enforce: "pre",
|
|
1814
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1815
|
-
load: (e) => e ===
|
|
1874
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? wi : void 0,
|
|
1875
|
+
load: (e) => e === wi ? Ei() : void 0,
|
|
1816
1876
|
transform: (t, n, r) => {
|
|
1817
1877
|
if (r?.ssr === !0) return null;
|
|
1818
|
-
let i =
|
|
1878
|
+
let i = Ai(t, n, e);
|
|
1819
1879
|
return i === null ? null : {
|
|
1820
1880
|
code: i,
|
|
1821
1881
|
map: null
|
|
1822
1882
|
};
|
|
1823
1883
|
}
|
|
1824
|
-
}),
|
|
1884
|
+
}), Mi = K({ scope: "voltro:dashboard" }), Ni = Ce(import.meta.url), Pi = 5179, Fi = (e) => {
|
|
1825
1885
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1826
1886
|
if (t && L(P(I(t), "app.config.ts"))) return I(t);
|
|
1827
1887
|
try {
|
|
1828
|
-
let e = N(
|
|
1888
|
+
let e = N(Ni.resolve("@voltro/dashboard/package.json"));
|
|
1829
1889
|
if (L(P(e, "app.config.ts"))) return e;
|
|
1830
1890
|
} catch {}
|
|
1831
1891
|
let n = P("voltro-devtools", "apps", "dashboard"), r = I(e);
|
|
@@ -1837,53 +1897,53 @@ import {
|
|
|
1837
1897
|
r = t;
|
|
1838
1898
|
}
|
|
1839
1899
|
return null;
|
|
1840
|
-
},
|
|
1841
|
-
let i =
|
|
1900
|
+
}, Ii = "VOLTRO_IS_DASHBOARD", Li = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1901
|
+
let i = Ve({
|
|
1842
1902
|
port: e,
|
|
1843
1903
|
host: t
|
|
1844
1904
|
}), a = !1, o = (e) => {
|
|
1845
1905
|
a || (a = !0, i.destroy(), r(e));
|
|
1846
1906
|
};
|
|
1847
1907
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1848
|
-
}),
|
|
1908
|
+
}), Ri = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), zi = () => process.env[Ii] === "1", Bi = () => process.stdout.isTTY === !0, Vi = P(we(), ".voltro", "dashboard-launch.lock"), Hi = 1e4, Ui = async () => {
|
|
1849
1909
|
try {
|
|
1850
|
-
await z.mkdir(N(
|
|
1851
|
-
let e = await z.open(
|
|
1910
|
+
await z.mkdir(N(Vi), { recursive: !0 });
|
|
1911
|
+
let e = await z.open(Vi, "wx");
|
|
1852
1912
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1853
1913
|
} catch {
|
|
1854
1914
|
try {
|
|
1855
|
-
let e = await z.stat(
|
|
1856
|
-
if (Date.now() - e.mtimeMs >
|
|
1915
|
+
let e = await z.stat(Vi);
|
|
1916
|
+
if (Date.now() - e.mtimeMs > Hi) return await z.unlink(Vi).catch(() => void 0), Ui();
|
|
1857
1917
|
} catch {}
|
|
1858
1918
|
return !1;
|
|
1859
1919
|
}
|
|
1860
|
-
},
|
|
1920
|
+
}, Wi = async () => {
|
|
1861
1921
|
try {
|
|
1862
|
-
await z.unlink(
|
|
1922
|
+
await z.unlink(Vi);
|
|
1863
1923
|
} catch {}
|
|
1864
|
-
},
|
|
1924
|
+
}, Gi = async (e) => {
|
|
1865
1925
|
let t = e.port ?? 5179;
|
|
1866
|
-
if (
|
|
1926
|
+
if (Ri()) return {
|
|
1867
1927
|
status: "skipped",
|
|
1868
1928
|
reason: "disabled by flag/env",
|
|
1869
1929
|
port: t
|
|
1870
1930
|
};
|
|
1871
|
-
if (
|
|
1931
|
+
if (zi()) return {
|
|
1872
1932
|
status: "skipped",
|
|
1873
1933
|
reason: "this process IS the dashboard",
|
|
1874
1934
|
port: t
|
|
1875
1935
|
};
|
|
1876
|
-
if (!
|
|
1936
|
+
if (!Bi()) return {
|
|
1877
1937
|
status: "skipped",
|
|
1878
1938
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1879
1939
|
port: t
|
|
1880
1940
|
};
|
|
1881
|
-
if (!await
|
|
1941
|
+
if (!await Ui()) return {
|
|
1882
1942
|
status: "skipped",
|
|
1883
1943
|
reason: "another voltro process is currently launching the dashboard",
|
|
1884
1944
|
port: t
|
|
1885
1945
|
};
|
|
1886
|
-
if (await
|
|
1946
|
+
if (await Li(t)) return await Wi(), {
|
|
1887
1947
|
status: "already-running",
|
|
1888
1948
|
port: t
|
|
1889
1949
|
};
|
|
@@ -1900,7 +1960,7 @@ import {
|
|
|
1900
1960
|
stdio: "ignore",
|
|
1901
1961
|
env: {
|
|
1902
1962
|
...process.env,
|
|
1903
|
-
[
|
|
1963
|
+
[Ii]: "1",
|
|
1904
1964
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1905
1965
|
}
|
|
1906
1966
|
});
|
|
@@ -1908,22 +1968,22 @@ import {
|
|
|
1908
1968
|
if (o.exitCode === null && o.signalCode === null) try {
|
|
1909
1969
|
o.kill("SIGTERM");
|
|
1910
1970
|
} catch {}
|
|
1911
|
-
}),
|
|
1971
|
+
}), Mi.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1912
1972
|
port: t,
|
|
1913
1973
|
mode: a,
|
|
1914
1974
|
prebuilt: i
|
|
1915
|
-
}), i ||
|
|
1916
|
-
|
|
1975
|
+
}), i || Mi.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), Mi.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1976
|
+
Wi();
|
|
1917
1977
|
}, 4e3).unref(), {
|
|
1918
1978
|
status: "launched",
|
|
1919
1979
|
port: t
|
|
1920
1980
|
};
|
|
1921
|
-
},
|
|
1981
|
+
}, Ki = class extends Error {
|
|
1922
1982
|
_voltroDeferral = !0;
|
|
1923
1983
|
constructor(e) {
|
|
1924
1984
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1925
1985
|
}
|
|
1926
|
-
},
|
|
1986
|
+
}, qi = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Ji = (e) => {
|
|
1927
1987
|
if (!(e instanceof Error)) return;
|
|
1928
1988
|
let t = e._voltroControl;
|
|
1929
1989
|
if (t === "redirect") {
|
|
@@ -1945,7 +2005,7 @@ import {
|
|
|
1945
2005
|
},
|
|
1946
2006
|
body: "not found"
|
|
1947
2007
|
};
|
|
1948
|
-
},
|
|
2008
|
+
}, Yi = (e) => {
|
|
1949
2009
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1950
2010
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1951
2011
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1961,7 +2021,7 @@ import {
|
|
|
1961
2021
|
...e.ppr === !0 ? { ppr: !0 } : {}
|
|
1962
2022
|
});
|
|
1963
2023
|
} catch (e) {
|
|
1964
|
-
throw new
|
|
2024
|
+
throw new Ki(e instanceof Error ? e.message : String(e));
|
|
1965
2025
|
}
|
|
1966
2026
|
return {
|
|
1967
2027
|
loaderData: n.renderData,
|
|
@@ -1977,8 +2037,8 @@ import {
|
|
|
1977
2037
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1978
2038
|
}
|
|
1979
2039
|
};
|
|
1980
|
-
},
|
|
1981
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
2040
|
+
}, Xi = (e) => {
|
|
2041
|
+
let { helpers: t, renderInput: n } = e, r = Yi({
|
|
1982
2042
|
helpers: t,
|
|
1983
2043
|
page: e.page,
|
|
1984
2044
|
pathname: n.pathname,
|
|
@@ -1999,19 +2059,19 @@ import {
|
|
|
1999
2059
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
2000
2060
|
hasDeferred: r.hasDeferred
|
|
2001
2061
|
};
|
|
2002
|
-
},
|
|
2062
|
+
}, Zi = (e) => {
|
|
2003
2063
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
2004
2064
|
return {
|
|
2005
2065
|
body: t,
|
|
2006
2066
|
meta: n
|
|
2007
2067
|
};
|
|
2008
|
-
},
|
|
2068
|
+
}, Qi = (e) => [
|
|
2009
2069
|
...e.extra ?? [],
|
|
2010
2070
|
e.helpers.renderMetaToHtml(e.meta),
|
|
2011
2071
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
2012
2072
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
2013
2073
|
e.prepared.stateScript
|
|
2014
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
2074
|
+
].filter((e) => e.length > 0).join("\n "), $i = (e) => {
|
|
2015
2075
|
let t = e.indexOf("?");
|
|
2016
2076
|
return t === -1 ? {
|
|
2017
2077
|
pathname: e || "/",
|
|
@@ -2020,9 +2080,9 @@ import {
|
|
|
2020
2080
|
pathname: e.slice(0, t) || "/",
|
|
2021
2081
|
search: e.slice(t)
|
|
2022
2082
|
};
|
|
2023
|
-
},
|
|
2083
|
+
}, ea = /Could not find required `intl` object/, ta = "__voltro_i18n_instances__", na = (e = globalThis) => {
|
|
2024
2084
|
try {
|
|
2025
|
-
let t = e[
|
|
2085
|
+
let t = e[ta]?.records;
|
|
2026
2086
|
return t === void 0 || t.length === 0 ? void 0 : {
|
|
2027
2087
|
instances: t.length,
|
|
2028
2088
|
reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
|
|
@@ -2031,7 +2091,7 @@ import {
|
|
|
2031
2091
|
} catch {
|
|
2032
2092
|
return;
|
|
2033
2093
|
}
|
|
2034
|
-
},
|
|
2094
|
+
}, ra = (e, t) => [
|
|
2035
2095
|
"",
|
|
2036
2096
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
2037
2097
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -2049,7 +2109,7 @@ import {
|
|
|
2049
2109
|
" versions on disk; this counts instances in the running process, and one",
|
|
2050
2110
|
" file loaded down two paths is two instances.",
|
|
2051
2111
|
"───────────────────────────────────────────────────────────────────────"
|
|
2052
|
-
].join("\n"),
|
|
2112
|
+
].join("\n"), ia = (e, t) => [
|
|
2053
2113
|
"",
|
|
2054
2114
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
2055
2115
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -2065,7 +2125,7 @@ import {
|
|
|
2065
2125
|
" direct import can land on a second copy that this count does not see —",
|
|
2066
2126
|
" it counts what @voltro/i18n is bound to.",
|
|
2067
2127
|
"───────────────────────────────────────────────────────────────────────"
|
|
2068
|
-
].join("\n"),
|
|
2128
|
+
].join("\n"), aa = (e) => [
|
|
2069
2129
|
"",
|
|
2070
2130
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
2071
2131
|
`${e} DID wrap this render in <I18nProvider> — the framework`,
|
|
@@ -2081,41 +2141,41 @@ import {
|
|
|
2081
2141
|
" Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
|
|
2082
2142
|
" the duplication here is of module instances in one process.",
|
|
2083
2143
|
"───────────────────────────────────────────────────────────────────────"
|
|
2084
|
-
].join("\n"),
|
|
2144
|
+
].join("\n"), oa = (e, t, n, r = na()) => {
|
|
2085
2145
|
if (!t) return;
|
|
2086
2146
|
let i = String(e?.message ?? e);
|
|
2087
|
-
if (
|
|
2088
|
-
},
|
|
2089
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
2090
|
-
let r =
|
|
2147
|
+
if (ea.test(i)) return r === void 0 ? aa(n) : r.reactIntlCopies > 1 || r.instances > 1 ? ra(n, r) : ia(n, r);
|
|
2148
|
+
}, sa = "<div id=\"root\"></div>", ca = "<div id=\"root\">", la = "</div>", ua = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, da = /\bsrc=["']([^"']+)["']/i, fa = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, pa = (e) => {
|
|
2149
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(ua, (e) => {
|
|
2150
|
+
let r = da.exec(e)?.[1];
|
|
2091
2151
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
2092
2152
|
});
|
|
2093
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
2094
|
-
let i = r.indexOf(
|
|
2095
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
2153
|
+
e.inlineModuleScriptsAsync && (r = r.replace(fa, "<script async$1>"));
|
|
2154
|
+
let i = r.indexOf(sa);
|
|
2155
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${sa}\` 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.`);
|
|
2096
2156
|
return {
|
|
2097
|
-
head: `${r.slice(0, i)}${
|
|
2098
|
-
tail: `${
|
|
2157
|
+
head: `${r.slice(0, i)}${ca}`,
|
|
2158
|
+
tail: `${la}${r.slice(i + 21)}`,
|
|
2099
2159
|
bootstrapModules: n
|
|
2100
2160
|
};
|
|
2101
|
-
},
|
|
2161
|
+
}, ma = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), ha = (e, t) => {
|
|
2102
2162
|
let n = t.replace(/[^A-Za-z0-9+/=_-]/g, "");
|
|
2103
2163
|
return e.replace(/<script(?![^>]*\snonce\s*=)/gi, `<script nonce="${n}"`);
|
|
2104
|
-
},
|
|
2105
|
-
let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${
|
|
2106
|
-
return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${
|
|
2107
|
-
},
|
|
2164
|
+
}, ga = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), _a = (e, t) => {
|
|
2165
|
+
let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${ga(t.timeZone)}"`, t.renderedAt === void 0 ? "" : ` data-voltro-now="${t.renderedAt}"`].join("");
|
|
2166
|
+
return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${ga(t.lang)}"${n}`);
|
|
2167
|
+
}, va = (e) => _a(ma(e.head, e.headInjection), e.documentAttrs), ya = (e) => {
|
|
2108
2168
|
let { res: t, shell: n, documentAttrs: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
2109
2169
|
if (s || !o || a === null) return;
|
|
2110
2170
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
2111
2171
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
2112
2172
|
t.flushHeaders?.();
|
|
2113
|
-
let c =
|
|
2173
|
+
let c = va({
|
|
2114
2174
|
head: n.head,
|
|
2115
2175
|
headInjection: i(a.meta),
|
|
2116
2176
|
documentAttrs: r
|
|
2117
2177
|
});
|
|
2118
|
-
t.write(e.nonce === void 0 ? c :
|
|
2178
|
+
t.write(e.nonce === void 0 ? c : ha(c, e.nonce));
|
|
2119
2179
|
let l = new rt();
|
|
2120
2180
|
l.pipe(t, { end: !1 }), l.on("end", () => {
|
|
2121
2181
|
t.end(n.tail);
|
|
@@ -2141,16 +2201,16 @@ import {
|
|
|
2141
2201
|
return;
|
|
2142
2202
|
}
|
|
2143
2203
|
c();
|
|
2144
|
-
},
|
|
2204
|
+
}, ba = (e) => Array.isArray(e.preload) && e.preload.length > 0, xa = (e, t) => typeof e == "string" ? {
|
|
2145
2205
|
tag: e,
|
|
2146
2206
|
input: {}
|
|
2147
2207
|
} : {
|
|
2148
2208
|
tag: e.tag,
|
|
2149
2209
|
input: e.input?.(t) ?? {}
|
|
2150
|
-
},
|
|
2210
|
+
}, Sa = async (e) => {
|
|
2151
2211
|
let { pageMod: t, params: n, query: r, apiName: i, seed: a, seedFailure: o, onError: s } = e;
|
|
2152
|
-
if (
|
|
2153
|
-
let { tag: t, input: c } =
|
|
2212
|
+
if (ba(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
|
|
2213
|
+
let { tag: t, input: c } = xa(e, n);
|
|
2154
2214
|
try {
|
|
2155
2215
|
a(i, t, c, await r(t, c));
|
|
2156
2216
|
} catch (e) {
|
|
@@ -2160,12 +2220,12 @@ import {
|
|
|
2160
2220
|
}, e);
|
|
2161
2221
|
}
|
|
2162
2222
|
}
|
|
2163
|
-
},
|
|
2223
|
+
}, Ca = (e) => h.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : m.test(e) || f.test(e) || u.test(e), wa = /* @__PURE__ */ new Set([
|
|
2164
2224
|
"node_modules",
|
|
2165
2225
|
"dist",
|
|
2166
2226
|
".framework",
|
|
2167
2227
|
".git"
|
|
2168
|
-
]),
|
|
2228
|
+
]), Ta = async (e) => {
|
|
2169
2229
|
let t = [], n = async (e) => {
|
|
2170
2230
|
let r;
|
|
2171
2231
|
try {
|
|
@@ -2175,15 +2235,15 @@ import {
|
|
|
2175
2235
|
}
|
|
2176
2236
|
for (let i of r) if (!(i.name.startsWith(".") && i.isDirectory())) {
|
|
2177
2237
|
if (i.isDirectory()) {
|
|
2178
|
-
if (
|
|
2238
|
+
if (wa.has(i.name)) continue;
|
|
2179
2239
|
await n(P(e, i.name));
|
|
2180
|
-
} else
|
|
2240
|
+
} else Ca(i.name) && t.push(P(e, i.name));
|
|
2181
2241
|
}
|
|
2182
2242
|
};
|
|
2183
2243
|
return await n(e), t.sort();
|
|
2184
|
-
},
|
|
2244
|
+
}, Ea = async (e) => {
|
|
2185
2245
|
let t = J("sha1");
|
|
2186
|
-
for (let n of await
|
|
2246
|
+
for (let n of await Ta(e)) {
|
|
2187
2247
|
t.update(n.slice(e.length)), t.update("\0");
|
|
2188
2248
|
try {
|
|
2189
2249
|
t.update(await z.readFile(n));
|
|
@@ -2194,28 +2254,28 @@ import {
|
|
|
2194
2254
|
t.update(await z.readFile(P(e, "rpcGroup.generated.ts")));
|
|
2195
2255
|
} catch {}
|
|
2196
2256
|
return t.digest("hex");
|
|
2197
|
-
},
|
|
2257
|
+
}, Da = async (e) => {
|
|
2198
2258
|
if (e.length === 0) return;
|
|
2199
2259
|
let t = [];
|
|
2200
|
-
for (let n of [...e].sort()) t.push(await
|
|
2260
|
+
for (let n of [...e].sort()) t.push(await Ea(n));
|
|
2201
2261
|
return J("sha1").update(t.join("\0")).digest("hex");
|
|
2202
|
-
},
|
|
2262
|
+
}, Oa = (e) => typeof e == "object" && !!e && e._tag === "VoltroMiddleware" && typeof e.run == "function", ka = ["middleware.ts", "middleware.tsx"], Aa = (e) => {
|
|
2203
2263
|
let t = e.replace(/\/+$/, "");
|
|
2204
2264
|
return t === "" ? "/" : t;
|
|
2205
2265
|
}, Z = (e, t) => {
|
|
2206
|
-
let n =
|
|
2266
|
+
let n = Aa(e);
|
|
2207
2267
|
if (n === "/") return !0;
|
|
2208
|
-
let r =
|
|
2268
|
+
let r = Aa(t);
|
|
2209
2269
|
return r === n || r.startsWith(`${n}/`);
|
|
2210
|
-
},
|
|
2270
|
+
}, ja = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, Ma = (e, t) => {
|
|
2211
2271
|
if (e === void 0) return !0;
|
|
2212
|
-
let n =
|
|
2272
|
+
let n = ja(e.under), r = e.routes ?? [];
|
|
2213
2273
|
return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) => Z(e, t)) ? !(e.except ?? []).some((e) => e === t || Z(e, t)) : !1;
|
|
2214
|
-
},
|
|
2274
|
+
}, Na = (e) => {
|
|
2215
2275
|
if (e?.assets !== !0) return [];
|
|
2216
|
-
let t =
|
|
2276
|
+
let t = ja(e.under);
|
|
2217
2277
|
return t.length > 0 ? t : (e.routes ?? []).length > 0 ? [] : ["/"];
|
|
2218
|
-
},
|
|
2278
|
+
}, Pa = (e, t) => Na(e).some((e) => Z(e, t)) ? !(e?.except ?? []).some((e) => Z(e, t)) : !1, Fa = (e, t) => e.find(({ middleware: e }) => t.route === void 0 ? Pa(e.match, t.pathname) : Ma(e.match, t.route))?.middleware, Ia = (e, t) => {
|
|
2219
2279
|
let n = [];
|
|
2220
2280
|
for (let { exportName: r, middleware: i } of e) {
|
|
2221
2281
|
let e = i.match;
|
|
@@ -2223,13 +2283,13 @@ import {
|
|
|
2223
2283
|
kind: "dead-matcher",
|
|
2224
2284
|
message: `\`${r}\` matches routes: ['${i}'], which is not a route in this app. Route patterns are spelled as the router spells them, e.g. \`/notes/[id]\`.`
|
|
2225
2285
|
});
|
|
2226
|
-
if (e?.assets !== !0) for (let [i, a] of [["under",
|
|
2286
|
+
if (e?.assets !== !0) for (let [i, a] of [["under", ja(e?.under)], ["except", e?.except ?? []]]) for (let e of a) t.some((t) => Z(e, t)) || n.push({
|
|
2227
2287
|
kind: "dead-matcher",
|
|
2228
2288
|
message: `\`${r}\` matches ${i}: ['${e}'], which covers no route in this app. ` + (i === "except" ? "An `except` that excludes nothing is a rule that reads as active and is not." : "Add `assets: true` if you meant a path the router does not serve.")
|
|
2229
2289
|
});
|
|
2230
2290
|
}
|
|
2231
2291
|
for (let r = 0; r < e.length; r += 1) for (let i = r + 1; i < e.length; i += 1) {
|
|
2232
|
-
let a = e[r], o = e[i], s = t.find((e) =>
|
|
2292
|
+
let a = e[r], o = e[i], s = t.find((e) => Ma(a.middleware.match, e) && Ma(o.middleware.match, e));
|
|
2233
2293
|
if (s !== void 0) {
|
|
2234
2294
|
n.push({
|
|
2235
2295
|
kind: "overlap",
|
|
@@ -2238,7 +2298,7 @@ import {
|
|
|
2238
2298
|
continue;
|
|
2239
2299
|
}
|
|
2240
2300
|
{
|
|
2241
|
-
let e =
|
|
2301
|
+
let e = Na(a.middleware.match), t = Na(o.middleware.match), r = e.some((e) => t.some((t) => Z(e, t) || Z(t, e))), i = (a.middleware.match?.except ?? []).some((e) => t.length > 0 && t.every((t) => Z(e, t))) || (o.middleware.match?.except ?? []).some((t) => e.length > 0 && e.every((e) => Z(t, e)));
|
|
2242
2302
|
r && !i && n.push({
|
|
2243
2303
|
kind: "overlap",
|
|
2244
2304
|
message: `\`${a.exportName}\` and \`${o.exportName}\` both declare \`assets: true\` over overlapping paths. A non-page request would match both, and there is no route to tell them apart.`
|
|
@@ -2246,10 +2306,10 @@ import {
|
|
|
2246
2306
|
}
|
|
2247
2307
|
}
|
|
2248
2308
|
return n;
|
|
2249
|
-
},
|
|
2250
|
-
let r =
|
|
2309
|
+
}, La = (e, n) => {
|
|
2310
|
+
let r = Ia(e, n);
|
|
2251
2311
|
if (r.length !== 0) throw t(`middleware.ts: ${r.length} problem(s)\n\n` + r.map((e) => ` • ${e.message}`).join("\n\n"));
|
|
2252
|
-
},
|
|
2312
|
+
}, Ra = (e) => {
|
|
2253
2313
|
let t = {};
|
|
2254
2314
|
if (!e) return t;
|
|
2255
2315
|
for (let n of e.split(";")) {
|
|
@@ -2263,11 +2323,11 @@ import {
|
|
|
2263
2323
|
}
|
|
2264
2324
|
}
|
|
2265
2325
|
return t;
|
|
2266
|
-
},
|
|
2326
|
+
}, za = (e) => Object.entries(e).map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join("; "), Ba = /(^|[-_.])(auth[-_.]?token|session|access[-_.]?token)([-_.]|$)|^sb-.*-auth-token$/i, Va = (e) => e.httpOnly === void 0 && Ba.test(e.name), Ha = (e) => {
|
|
2267
2327
|
let t = [`${e.name}=${encodeURIComponent(e.value)}`];
|
|
2268
2328
|
return t.push(`Path=${e.path ?? "/"}`), e.maxAge !== void 0 && t.push(`Max-Age=${Math.trunc(e.maxAge)}`), e.httpOnly !== !1 && t.push("HttpOnly"), e.secure === !0 && t.push("Secure"), t.push(`SameSite=${e.sameSite ?? "lax"}`), t.join("; ");
|
|
2269
|
-
},
|
|
2270
|
-
for (let r of
|
|
2329
|
+
}, Ua = (e) => e.length === 0 ? {} : { "set-cookie": e.map(Ha) }, Wa = async (e, n = (e) => import(G(e).href)) => {
|
|
2330
|
+
for (let r of ka) {
|
|
2271
2331
|
let i;
|
|
2272
2332
|
try {
|
|
2273
2333
|
i = await n(P(e, r));
|
|
@@ -2276,7 +2336,7 @@ import {
|
|
|
2276
2336
|
if (t === "ERR_MODULE_NOT_FOUND" || t === "MODULE_NOT_FOUND") continue;
|
|
2277
2337
|
throw e;
|
|
2278
2338
|
}
|
|
2279
|
-
let a = Object.entries(i ?? {}), o = a.filter((e) =>
|
|
2339
|
+
let a = Object.entries(i ?? {}), o = a.filter((e) => Oa(e[1])).map(([e, t]) => ({
|
|
2280
2340
|
exportName: e,
|
|
2281
2341
|
middleware: t
|
|
2282
2342
|
}));
|
|
@@ -2294,7 +2354,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2294
2354
|
return o;
|
|
2295
2355
|
}
|
|
2296
2356
|
return [];
|
|
2297
|
-
},
|
|
2357
|
+
}, Ga = async (e, t, n) => {
|
|
2298
2358
|
let r = {
|
|
2299
2359
|
headers: t.headers,
|
|
2300
2360
|
cookies: t.cookies,
|
|
@@ -2305,7 +2365,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2305
2365
|
let i = await e.run(t);
|
|
2306
2366
|
if (!i) return r;
|
|
2307
2367
|
let a = i.setCookies ?? [];
|
|
2308
|
-
if (n !== void 0) for (let e of a)
|
|
2368
|
+
if (n !== void 0) for (let e of a) Va(e) && n(e);
|
|
2309
2369
|
let o = i.headers ? {
|
|
2310
2370
|
...t.headers,
|
|
2311
2371
|
...i.headers
|
|
@@ -2319,25 +2379,25 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2319
2379
|
};
|
|
2320
2380
|
let l = { ...t.cookies };
|
|
2321
2381
|
for (let e of a) e.maxAge !== void 0 && e.maxAge <= 0 ? delete l[e.name] : l[e.name] = e.value;
|
|
2322
|
-
return i.headers?.cookie === void 0 && (o.cookie =
|
|
2382
|
+
return i.headers?.cookie === void 0 && (o.cookie = za(l)), {
|
|
2323
2383
|
headers: o,
|
|
2324
2384
|
cookies: l,
|
|
2325
2385
|
setCookies: a,
|
|
2326
2386
|
responseHeaders: s,
|
|
2327
2387
|
...c
|
|
2328
2388
|
};
|
|
2329
|
-
},
|
|
2389
|
+
}, Ka = /* @__PURE__ */ new Set(["voltro:locale"]), qa = /* @__PURE__ */ new Set(["authorization", "cookie"]), Ja = (e) => {
|
|
2330
2390
|
let t = e.split(";").map((e) => e.trim()).filter((e) => {
|
|
2331
2391
|
let t = e.indexOf("="), n = (t === -1 ? e : e.slice(0, t)).trim();
|
|
2332
|
-
return
|
|
2392
|
+
return Ka.has(n);
|
|
2333
2393
|
});
|
|
2334
2394
|
return t.length > 0 ? t.join("; ") : void 0;
|
|
2335
|
-
},
|
|
2395
|
+
}, Ya = (e) => {
|
|
2336
2396
|
let t = {};
|
|
2337
2397
|
for (let [n, r] of Object.entries(e)) if (!n.startsWith("x-voltro-")) {
|
|
2338
|
-
if (
|
|
2398
|
+
if (qa.has(n)) {
|
|
2339
2399
|
if (n === "cookie") {
|
|
2340
|
-
let e =
|
|
2400
|
+
let e = Ja(r);
|
|
2341
2401
|
e !== void 0 && (t.cookie = e);
|
|
2342
2402
|
}
|
|
2343
2403
|
continue;
|
|
@@ -2345,47 +2405,47 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2345
2405
|
t[n] = r;
|
|
2346
2406
|
}
|
|
2347
2407
|
return t;
|
|
2348
|
-
},
|
|
2408
|
+
}, Xa = (e) => {
|
|
2349
2409
|
let t = {};
|
|
2350
|
-
for (let [n, r] of Object.entries(e))
|
|
2410
|
+
for (let [n, r] of Object.entries(e)) Ka.has(n) && (t[n] = r);
|
|
2351
2411
|
return t;
|
|
2352
|
-
},
|
|
2412
|
+
}, Za = Se.exponential({
|
|
2353
2413
|
start: .001,
|
|
2354
2414
|
factor: 2,
|
|
2355
2415
|
count: 16
|
|
2356
|
-
}),
|
|
2357
|
-
let t =
|
|
2416
|
+
}), Qa = xe.counter("voltro_ppr_shell_serves_total", { description: "ppr responses whose cached shell was written, by page." }), $a = xe.counter("voltro_ppr_hole_passes_total", { description: "ppr per-request hole passes started, by page." }), eo = xe.counter("voltro_ppr_hole_settles_total", { description: "Deferred ppr holes settled and appended to a response, by page." }), to = xe.counter("voltro_ppr_hole_errors_total", { description: "ppr hole passes that failed as a whole (every hole stays on its fallback), by page." }), no = xe.histogram("voltro_ppr_hole_pass_seconds", Za, "ppr hole-pass duration in seconds (loader re-run to last hole settled), by page."), ro = [], io = /* @__PURE__ */ new Map(), ao = (e) => {
|
|
2417
|
+
let t = io.get(e);
|
|
2358
2418
|
if (t !== void 0) return t;
|
|
2359
|
-
let n = (t) =>
|
|
2360
|
-
shellServes: n(
|
|
2361
|
-
holePasses: n(
|
|
2362
|
-
holeSettles: n(
|
|
2363
|
-
holeErrors: n(
|
|
2364
|
-
holePassSeconds: n(
|
|
2419
|
+
let n = (t) => xe.tagged(t, "page", e), r = {
|
|
2420
|
+
shellServes: n(Qa),
|
|
2421
|
+
holePasses: n($a),
|
|
2422
|
+
holeSettles: n(eo),
|
|
2423
|
+
holeErrors: n(to),
|
|
2424
|
+
holePassSeconds: n(no)
|
|
2365
2425
|
};
|
|
2366
|
-
return
|
|
2367
|
-
},
|
|
2368
|
-
|
|
2369
|
-
},
|
|
2370
|
-
|
|
2371
|
-
},
|
|
2372
|
-
|
|
2373
|
-
},
|
|
2374
|
-
|
|
2375
|
-
},
|
|
2376
|
-
|
|
2377
|
-
},
|
|
2426
|
+
return io.set(e, r), r;
|
|
2427
|
+
}, oo = (e) => {
|
|
2428
|
+
ao(e).shellServes.unsafeUpdate(1, ro);
|
|
2429
|
+
}, so = (e) => {
|
|
2430
|
+
ao(e).holePasses.unsafeUpdate(1, ro);
|
|
2431
|
+
}, co = (e) => {
|
|
2432
|
+
ao(e).holeSettles.unsafeUpdate(1, ro);
|
|
2433
|
+
}, lo = (e) => {
|
|
2434
|
+
ao(e).holeErrors.unsafeUpdate(1, ro);
|
|
2435
|
+
}, uo = (e, t) => {
|
|
2436
|
+
ao(e).holePassSeconds.unsafeUpdate(t / 1e3, ro);
|
|
2437
|
+
}, fo = ["cookie", "authorization"], po = (e) => fo.includes(e) || e.startsWith("x-voltro-"), mo = ["voltro:locale"], ho = class extends Error {
|
|
2378
2438
|
constructor(e, t, n) {
|
|
2379
2439
|
super(`[voltro] ppr page '${n}': the SHELL render read the ${e} '${t}'. A ppr shell is CACHED and served to every visitor, so it must be computed without credentials — there is no way to prove request-independence by inspection, so the read itself is the error. Move this read into a deferred hole (the second argument of defer(), which runs per request with the full context), or drop ppr and use renderMode 'ssr'.`), this.name = "PprShellCredentialAccessError";
|
|
2380
2440
|
}
|
|
2381
|
-
},
|
|
2382
|
-
if (typeof n == "string" &&
|
|
2441
|
+
}, go = (e, t) => new Proxy({ ...e }, { get(e, n, r) {
|
|
2442
|
+
if (typeof n == "string" && po(n)) throw new ho("header", n, t);
|
|
2383
2443
|
return Reflect.get(e, n, r);
|
|
2384
|
-
} }),
|
|
2385
|
-
if (typeof n == "string" && !
|
|
2444
|
+
} }), _o = (e, t) => new Proxy({ ...e }, { get(e, n, r) {
|
|
2445
|
+
if (typeof n == "string" && !mo.includes(n) && !(n in Object.prototype)) throw new ho("cookie", n, t);
|
|
2386
2446
|
return Reflect.get(e, n, r);
|
|
2387
|
-
} }),
|
|
2388
|
-
|
|
2447
|
+
} }), vo = async (e) => {
|
|
2448
|
+
so(e.page);
|
|
2389
2449
|
let t = Date.now(), n = () => e.res.destroyed === !0 || e.res.writableEnded === !0;
|
|
2390
2450
|
try {
|
|
2391
2451
|
let t = await e.loader(e.ctx), r = e.helpers.prepareDeferredLoaderData(t, "page"), i = r.deferredIds;
|
|
@@ -2396,23 +2456,60 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2396
2456
|
let a = r.renderData;
|
|
2397
2457
|
await Promise.all(Object.entries(i).map(async ([t, r]) => {
|
|
2398
2458
|
let i = await a[t];
|
|
2399
|
-
|
|
2459
|
+
co(e.page), !n() && e.res.write(`<script>${e.helpers.deferredSettleScript(r, i)}<\/script>`);
|
|
2400
2460
|
}));
|
|
2401
2461
|
} catch (t) {
|
|
2402
|
-
|
|
2462
|
+
lo(e.page), e.log.warn("ppr hole pass failed — holes stay on their fallbacks", { page: e.page }, t);
|
|
2403
2463
|
} finally {
|
|
2404
|
-
|
|
2464
|
+
uo(e.page, Date.now() - t), n() || e.res.end();
|
|
2405
2465
|
}
|
|
2406
|
-
},
|
|
2466
|
+
}, yo = (e, t) => {
|
|
2407
2467
|
if (e.deferredSegmentIds !== void 0) throw Error(`[voltro] ppr page '${t}': a LAYOUT loader in its chain uses defer(). ppr appends holes for the PAGE loader only — move the deferred field into the page loader, or return the value directly from the layout.`);
|
|
2408
|
-
},
|
|
2468
|
+
}, bo = "/internal", xo = (e, t) => ({
|
|
2469
|
+
path: (e?.path ?? bo).replace(/\/+$/, "") || bo,
|
|
2470
|
+
liveness: e?.liveness ?? (() => !0),
|
|
2471
|
+
readiness: e?.readiness ?? t
|
|
2472
|
+
}), So = (e, t) => {
|
|
2473
|
+
if (!t.startsWith(`${e.path}/`)) return;
|
|
2474
|
+
let n = t.slice(e.path.length + 1);
|
|
2475
|
+
return n === "liveness" || n === "readiness" || n === "startup" ? n : void 0;
|
|
2476
|
+
}, Co = async (e, t) => {
|
|
2477
|
+
if (t === "liveness") try {
|
|
2478
|
+
return await e.liveness() ? {
|
|
2479
|
+
status: 200,
|
|
2480
|
+
body: "ok"
|
|
2481
|
+
} : {
|
|
2482
|
+
status: 503,
|
|
2483
|
+
body: "not-live"
|
|
2484
|
+
};
|
|
2485
|
+
} catch {
|
|
2486
|
+
return {
|
|
2487
|
+
status: 503,
|
|
2488
|
+
body: "not-live"
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2409
2491
|
try {
|
|
2410
|
-
|
|
2492
|
+
return await e.readiness() ? {
|
|
2493
|
+
status: 200,
|
|
2494
|
+
body: "ready"
|
|
2495
|
+
} : {
|
|
2496
|
+
status: 503,
|
|
2497
|
+
body: "not-ready"
|
|
2498
|
+
};
|
|
2499
|
+
} catch {
|
|
2500
|
+
return {
|
|
2501
|
+
status: 503,
|
|
2502
|
+
body: "not-ready"
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
}, Q = K({ scope: "voltro:dev:web" }), wo = K({ scope: "vite" }), To = await (async () => {
|
|
2506
|
+
try {
|
|
2507
|
+
let e = P(N(W(import.meta.url)), "..", "package.json"), t = await z.readFile(e, "utf8");
|
|
2411
2508
|
return JSON.parse(t).version ?? "0.0.0";
|
|
2412
2509
|
} catch {
|
|
2413
2510
|
return "0.0.0";
|
|
2414
2511
|
}
|
|
2415
|
-
})(),
|
|
2512
|
+
})(), Eo = (e, t) => {
|
|
2416
2513
|
let n;
|
|
2417
2514
|
for (let r of e) {
|
|
2418
2515
|
if (!r.hasNotFound) continue;
|
|
@@ -2420,16 +2517,16 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2420
2517
|
i !== "/" && !(t === i || t.startsWith(i + "/")) || (n === void 0 || r.dir.length > n.dir.length) && (n = r);
|
|
2421
2518
|
}
|
|
2422
2519
|
return n;
|
|
2423
|
-
},
|
|
2520
|
+
}, Do = async () => {
|
|
2424
2521
|
try {
|
|
2425
|
-
let e = N(
|
|
2522
|
+
let e = N(W(import.meta.url)), t = I(e, "..", "..", "devtools");
|
|
2426
2523
|
if (L(P(t, "package.json"))) return t;
|
|
2427
2524
|
let n = I(e, "..", "..", "..", "devtools");
|
|
2428
2525
|
return L(P(n, "package.json")) ? n : null;
|
|
2429
2526
|
} catch {
|
|
2430
2527
|
return null;
|
|
2431
2528
|
}
|
|
2432
|
-
},
|
|
2529
|
+
}, Oo = (e, t) => e.disableDevtools || !t ? [] : [
|
|
2433
2530
|
"",
|
|
2434
2531
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
2435
2532
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -2439,7 +2536,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2439
2536
|
" await import('@voltro/devtools/styles.css')",
|
|
2440
2537
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
2441
2538
|
"}"
|
|
2442
|
-
],
|
|
2539
|
+
], ko = (e) => {
|
|
2443
2540
|
let t = /* @__PURE__ */ new Set();
|
|
2444
2541
|
for (let n of e) {
|
|
2445
2542
|
let e = n.browserWsUrl;
|
|
@@ -2449,12 +2546,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2449
2546
|
} catch {}
|
|
2450
2547
|
}
|
|
2451
2548
|
return [...t].map((e) => ` <link rel="preconnect" href="${e}" crossorigin />`);
|
|
2452
|
-
},
|
|
2453
|
-
|
|
2454
|
-
"
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2549
|
+
}, Ao = (e) => e.web?.api?.connect === "lazy" ? [" connect: 'lazy',"] : [], jo = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Mo = (e, t) => {
|
|
2550
|
+
if (!No(e, t)) return [];
|
|
2551
|
+
let n = ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"], r = typeof e.sentry == "object" ? e.sentry.optionsFrom : void 0;
|
|
2552
|
+
return r !== void 0 && n.push(`import __sentryOptions from '../${r.replace(/^\.?\//, "")}'`), n;
|
|
2553
|
+
}, No = (e, t) => e.sentry !== void 0 || t, Po = (e, t) => {
|
|
2554
|
+
if (!No(e, t)) return [];
|
|
2555
|
+
let { optionsFrom: n, ...r } = e.sentry ?? {};
|
|
2556
|
+
return [
|
|
2557
|
+
"",
|
|
2558
|
+
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
2559
|
+
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
2560
|
+
n === void 0 ? `await initSentryBrowser(${JSON.stringify(r)})` : `await initSentryBrowser({ ...${JSON.stringify(r)}, ...(await __sentryOptions()) })`
|
|
2561
|
+
];
|
|
2562
|
+
}, Fo = (e) => e.env ? ["import './env.public'"] : [], Io = (e) => {
|
|
2458
2563
|
let t = [], n = I(e);
|
|
2459
2564
|
for (;;) {
|
|
2460
2565
|
L(P(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -2463,12 +2568,12 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2463
2568
|
n = e;
|
|
2464
2569
|
}
|
|
2465
2570
|
return t;
|
|
2466
|
-
},
|
|
2571
|
+
}, Lo = re, Ro = (e) => {
|
|
2467
2572
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
2468
|
-
},
|
|
2469
|
-
let t = e.replace(p, "").split("/").filter(Boolean).filter((e) => !
|
|
2573
|
+
}, zo = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Bo = (e) => e.startsWith("(") && e.endsWith(")"), Vo = (e) => e.filter((e) => !Bo(e)), Ho = (e) => {
|
|
2574
|
+
let t = e.replace(p, "").split("/").filter(Boolean).filter((e) => !Bo(e));
|
|
2470
2575
|
return t.length === 0 ? "/" : "/" + t.join("/");
|
|
2471
|
-
},
|
|
2576
|
+
}, Uo = (e) => `${e.replace(p, "").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`, $ = (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}`, Wo = async (e) => {
|
|
2472
2577
|
let t = [], n = [], r = async (e, i) => {
|
|
2473
2578
|
let a = [];
|
|
2474
2579
|
try {
|
|
@@ -2476,17 +2581,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2476
2581
|
} catch {
|
|
2477
2582
|
return;
|
|
2478
2583
|
}
|
|
2479
|
-
let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), s = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
2584
|
+
let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), s = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Lo(e.name)).map((e) => e.name).sort(), c = new Set(s), l = i.join("/");
|
|
2480
2585
|
if (s.some((e) => d.has(e))) {
|
|
2481
2586
|
let t = c.has("layout.tsx"), r = !1;
|
|
2482
2587
|
if (t) try {
|
|
2483
2588
|
let t = await z.readFile(P(e, "layout.tsx"), "utf8");
|
|
2484
|
-
r =
|
|
2589
|
+
r = zo.test(t);
|
|
2485
2590
|
} catch {}
|
|
2486
2591
|
n.push({
|
|
2487
2592
|
dir: l,
|
|
2488
2593
|
chain: i,
|
|
2489
|
-
contributesToUrl: i.length === 0 || !
|
|
2594
|
+
contributesToUrl: i.length === 0 || !Bo(i[i.length - 1]),
|
|
2490
2595
|
hasLayout: t,
|
|
2491
2596
|
hasLayoutLoader: r,
|
|
2492
2597
|
hasError: c.has("error.tsx"),
|
|
@@ -2500,8 +2605,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2500
2605
|
let n = l ? `${l}/${e}` : e;
|
|
2501
2606
|
t.push({
|
|
2502
2607
|
file: n,
|
|
2503
|
-
pattern:
|
|
2504
|
-
ident:
|
|
2608
|
+
pattern: Ho(n),
|
|
2609
|
+
ident: Uo(n),
|
|
2505
2610
|
dirChain: i
|
|
2506
2611
|
});
|
|
2507
2612
|
}
|
|
@@ -2520,14 +2625,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2520
2625
|
dirs: a,
|
|
2521
2626
|
orphanedSpecials: o
|
|
2522
2627
|
};
|
|
2523
|
-
},
|
|
2628
|
+
}, Go = (e, t) => {
|
|
2524
2629
|
let n = [];
|
|
2525
2630
|
for (let r = 0; r <= t.length; r++) {
|
|
2526
2631
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
2527
2632
|
a && n.push(a);
|
|
2528
2633
|
}
|
|
2529
2634
|
return n;
|
|
2530
|
-
},
|
|
2635
|
+
}, Ko = async (e) => {
|
|
2531
2636
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
2532
2637
|
return {
|
|
2533
2638
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -2551,10 +2656,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2551
2656
|
})),
|
|
2552
2657
|
segmentLoaderData: o
|
|
2553
2658
|
};
|
|
2554
|
-
},
|
|
2555
|
-
let t =
|
|
2659
|
+
}, qo = (e) => {
|
|
2660
|
+
let t = Vo(e);
|
|
2556
2661
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
2557
|
-
},
|
|
2662
|
+
}, Jo = [
|
|
2558
2663
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
2559
2664
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
2560
2665
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -2647,7 +2752,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2647
2752
|
" _vdtErrorStart('Build error')",
|
|
2648
2753
|
" })",
|
|
2649
2754
|
"}"
|
|
2650
|
-
].join("\n"),
|
|
2755
|
+
].join("\n"), Yo = (e) => {
|
|
2651
2756
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
2652
2757
|
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, "\\$&"));
|
|
2653
2758
|
let a = i.join("/");
|
|
@@ -2656,8 +2761,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2656
2761
|
paramNames: t,
|
|
2657
2762
|
priority: n
|
|
2658
2763
|
};
|
|
2659
|
-
},
|
|
2660
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
2764
|
+
}, Xo = (e) => e.map((e) => {
|
|
2765
|
+
let { regex: t, paramNames: n, priority: r } = Yo(e.pattern);
|
|
2661
2766
|
return {
|
|
2662
2767
|
pattern: e.pattern,
|
|
2663
2768
|
file: e.file,
|
|
@@ -2666,7 +2771,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2666
2771
|
paramNames: n,
|
|
2667
2772
|
priority: r
|
|
2668
2773
|
};
|
|
2669
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
2774
|
+
}).slice().sort((e, t) => e.priority - t.priority), Zo = (e, t) => {
|
|
2670
2775
|
for (let n of t) {
|
|
2671
2776
|
let t = n.regex.exec(e);
|
|
2672
2777
|
if (!t) continue;
|
|
@@ -2678,9 +2783,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2678
2783
|
};
|
|
2679
2784
|
}
|
|
2680
2785
|
return null;
|
|
2681
|
-
},
|
|
2786
|
+
}, Qo = _, $o = async (e) => {
|
|
2682
2787
|
try {
|
|
2683
|
-
let t = await import(
|
|
2788
|
+
let t = await import(G(P(e, "app.config.ts")).href), n = t.default?.port, r = l({
|
|
2684
2789
|
kind: "api",
|
|
2685
2790
|
configPort: typeof n == "number" ? n : void 0,
|
|
2686
2791
|
env: {}
|
|
@@ -2694,7 +2799,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2694
2799
|
kind: "api",
|
|
2695
2800
|
env: {}
|
|
2696
2801
|
}).port };
|
|
2697
|
-
},
|
|
2802
|
+
}, es = (e, t) => ({
|
|
2698
2803
|
name: e,
|
|
2699
2804
|
pkg: t.package,
|
|
2700
2805
|
browserWsUrl: t.url,
|
|
@@ -2702,7 +2807,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2702
2807
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
2703
2808
|
...t.headers ? { headers: t.headers } : {},
|
|
2704
2809
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
2705
|
-
}),
|
|
2810
|
+
}), ts = (e, t, n) => {
|
|
2706
2811
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
2707
2812
|
return {
|
|
2708
2813
|
name: e,
|
|
@@ -2714,7 +2819,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2714
2819
|
...t.headers ? { headers: t.headers } : {},
|
|
2715
2820
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
2716
2821
|
};
|
|
2717
|
-
},
|
|
2822
|
+
}, ns = (e) => {
|
|
2718
2823
|
let t = /* @__PURE__ */ new Map();
|
|
2719
2824
|
for (let n of e) {
|
|
2720
2825
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -2722,43 +2827,43 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2722
2827
|
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>.`);
|
|
2723
2828
|
t.set(n.browserWsUrl, n.name);
|
|
2724
2829
|
}
|
|
2725
|
-
},
|
|
2830
|
+
}, rs = async (e, t) => {
|
|
2726
2831
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
2727
2832
|
for (let [t, i] of n) {
|
|
2728
2833
|
if (i.url) {
|
|
2729
|
-
r.push(
|
|
2834
|
+
r.push(es(t, i));
|
|
2730
2835
|
continue;
|
|
2731
2836
|
}
|
|
2732
|
-
let n = await
|
|
2837
|
+
let n = await Qo(e, i.package);
|
|
2733
2838
|
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.`);
|
|
2734
|
-
r.push(
|
|
2839
|
+
r.push(ts(t, i, await $o(n)));
|
|
2735
2840
|
}
|
|
2736
|
-
return
|
|
2737
|
-
},
|
|
2841
|
+
return ns(r), r;
|
|
2842
|
+
}, is = (e) => {
|
|
2738
2843
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
2739
2844
|
let t = new URL(e);
|
|
2740
2845
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
2741
2846
|
} catch {
|
|
2742
2847
|
return;
|
|
2743
2848
|
}
|
|
2744
|
-
},
|
|
2849
|
+
}, as = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, os = (e) => process.env[as(e)] ?? process.env.VOLTRO_API_ORIGIN, ss = (e, t) => {
|
|
2745
2850
|
if (!e) return;
|
|
2746
|
-
let n =
|
|
2851
|
+
let n = os(e.name) ?? e.serverOrigin;
|
|
2747
2852
|
if (n) {
|
|
2748
|
-
let e =
|
|
2853
|
+
let e = is(n);
|
|
2749
2854
|
if (e) return e;
|
|
2750
2855
|
}
|
|
2751
2856
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
2752
|
-
let t =
|
|
2857
|
+
let t = is(e.proxyTarget);
|
|
2753
2858
|
if (t) return t;
|
|
2754
2859
|
}
|
|
2755
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
2756
|
-
},
|
|
2860
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return is(e.browserWsUrl);
|
|
2861
|
+
}, cs = (e, t, n) => {
|
|
2757
2862
|
if (!e) {
|
|
2758
2863
|
if (n?.apiName === void 0) return;
|
|
2759
2864
|
let e = n.apiName;
|
|
2760
2865
|
return async () => {
|
|
2761
|
-
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 ${
|
|
2866
|
+
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 ${as(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.`);
|
|
2762
2867
|
};
|
|
2763
2868
|
}
|
|
2764
2869
|
return async (r, i) => {
|
|
@@ -2781,7 +2886,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2781
2886
|
});
|
|
2782
2887
|
} catch (t) {
|
|
2783
2888
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2784
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2889
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${as(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 });
|
|
2785
2890
|
}
|
|
2786
2891
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2787
2892
|
let s = await o.json();
|
|
@@ -2811,7 +2916,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2811
2916
|
}
|
|
2812
2917
|
if (u) return l;
|
|
2813
2918
|
};
|
|
2814
|
-
},
|
|
2919
|
+
}, ls = (e, t) => {
|
|
2815
2920
|
let n = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, r = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, i = e.map((e) => `import { appGroup as ${n(e.name)}, appDescriptors as ${r(e.name)} } from '${e.pkg}/rpcGroup'`);
|
|
2816
2921
|
e.some((e) => e.hasAuthHeaders) && (i.push(`import __voltroAppConfig from '${t}'`), i.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
|
|
2817
2922
|
let a = (e) => {
|
|
@@ -2823,10 +2928,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2823
2928
|
entryLines: e.map((e) => ` ${JSON.stringify(e.name)}: { ${a(e).join(", ")} },`),
|
|
2824
2929
|
providerEntryLines: e.map((e) => ` { name: ${JSON.stringify(e.name)}, ${a(e).join(", ")} },`)
|
|
2825
2930
|
};
|
|
2826
|
-
},
|
|
2931
|
+
}, us = async (e, t, n, r = {}) => {
|
|
2827
2932
|
let i = t.title ?? t.name ?? "app";
|
|
2828
|
-
|
|
2829
|
-
let a = await
|
|
2933
|
+
Gn(e);
|
|
2934
|
+
let a = await Vn(e, t.fonts), o = a === null ? [] : [...a.preloads.map((e) => ` <link rel="preload" as="font" type="font/${e.endsWith(".woff2") ? "woff2" : e.endsWith(".woff") ? "woff" : e.endsWith(".otf") ? "otf" : "ttf"}" href="${e}" crossorigin />`), ` <style data-voltro-fonts>${a.css}</style>`], s = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", c = L(P(e, "node_modules", "@voltro", "devtools", "package.json")) || await Do() !== null, l = L(P(e, "node_modules", "@voltro", "plugin-sentry", "package.json")), u = t.theme === "system" ? [
|
|
2830
2935
|
" <script>",
|
|
2831
2936
|
" (function () {",
|
|
2832
2937
|
" var root = document.documentElement",
|
|
@@ -2847,7 +2952,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2847
2952
|
" }",
|
|
2848
2953
|
" })()",
|
|
2849
2954
|
" <\/script>"
|
|
2850
|
-
].join("\n") : "",
|
|
2955
|
+
].join("\n") : "", d = t.timeZone === "viewer" ? [
|
|
2851
2956
|
" <script>",
|
|
2852
2957
|
" (function () {",
|
|
2853
2958
|
" try {",
|
|
@@ -2859,7 +2964,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2859
2964
|
" } catch (e) {}",
|
|
2860
2965
|
" })()",
|
|
2861
2966
|
" <\/script>"
|
|
2862
|
-
].join("\n") : "",
|
|
2967
|
+
].join("\n") : "", f = [
|
|
2863
2968
|
"<!doctype html>",
|
|
2864
2969
|
"<!-- GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot. -->",
|
|
2865
2970
|
`<html lang="en"${s}>`,
|
|
@@ -2868,10 +2973,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2868
2973
|
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />",
|
|
2869
2974
|
` <title>${i}</title>`,
|
|
2870
2975
|
" <link rel=\"icon\" type=\"image/svg+xml\" href=\"/favicon.svg\" />",
|
|
2871
|
-
...
|
|
2976
|
+
...ko(n),
|
|
2872
2977
|
...o,
|
|
2873
|
-
...l ? [l] : [],
|
|
2874
2978
|
...u ? [u] : [],
|
|
2979
|
+
...d ? [d] : [],
|
|
2875
2980
|
" </head>",
|
|
2876
2981
|
" <body>",
|
|
2877
2982
|
" <div id=\"root\"></div>",
|
|
@@ -2879,32 +2984,32 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2879
2984
|
" </body>",
|
|
2880
2985
|
"</html>",
|
|
2881
2986
|
""
|
|
2882
|
-
].join("\n"),
|
|
2883
|
-
await x(
|
|
2884
|
-
for (let e of
|
|
2885
|
-
let { imports:
|
|
2886
|
-
if (
|
|
2887
|
-
let n =
|
|
2888
|
-
for (let e of
|
|
2987
|
+
].join("\n"), p = P(e, "src", "pages"), { pages: m, dirs: h, orphanedSpecials: g } = await Wo(p);
|
|
2988
|
+
await x(p, m);
|
|
2989
|
+
for (let e of g) Q.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.`);
|
|
2990
|
+
let { imports: _, entryLines: v } = ls(n, "../app.config"), y, ee, b;
|
|
2991
|
+
if (m.length > 0) {
|
|
2992
|
+
let n = m.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
|
|
2993
|
+
for (let e of h) {
|
|
2889
2994
|
let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
|
|
2890
2995
|
e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${$(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${$(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${$(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${$(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${$(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2891
2996
|
}
|
|
2892
|
-
let i =
|
|
2893
|
-
let t =
|
|
2997
|
+
let i = m.map((e) => {
|
|
2998
|
+
let t = Go(h, e.dirChain).map((e) => {
|
|
2894
2999
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2895
3000
|
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(", ")} }`;
|
|
2896
3001
|
}).join(",\n");
|
|
2897
3002
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2898
|
-
}), a =
|
|
2899
|
-
let t =
|
|
3003
|
+
}), a = h.filter((e) => e.hasNotFound).map((e) => {
|
|
3004
|
+
let t = qo(e.chain), n = Go(h, e.chain).map((e) => {
|
|
2900
3005
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2901
3006
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2902
3007
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
2903
3008
|
return ` {\n prefix: ${JSON.stringify(t)},\n Component: refs.notFounds[${JSON.stringify(e.dir)}],${r}\n },`;
|
|
2904
|
-
}), o = [], s = [],
|
|
2905
|
-
for (let e of
|
|
3009
|
+
}), o = [], s = [], u = [], d = [], f = [], p = [];
|
|
3010
|
+
for (let e of h) {
|
|
2906
3011
|
let t = e.dir === "" ? "../src/pages/layout.tsx" : `../src/pages/${e.dir}/layout.tsx`, n = e.dir === "" ? "../src/pages/error.tsx" : `../src/pages/${e.dir}/error.tsx`, r = e.dir === "" ? "../src/pages/loading.tsx" : `../src/pages/${e.dir}/loading.tsx`, i = e.dir === "" ? "../src/pages/not-found.tsx" : `../src/pages/${e.dir}/not-found.tsx`, a = JSON.stringify(e.dir);
|
|
2907
|
-
e.hasLayout && e.hasLayoutLoader ? (s.push(` ${a}: ${$(e.dir, "Layout")}Mod.default,`),
|
|
3012
|
+
e.hasLayout && e.hasLayoutLoader ? (s.push(` ${a}: ${$(e.dir, "Layout")}Mod.default,`), u.push(` ${a}: ${$(e.dir, "Layout")}Mod.loader,`), o.push({
|
|
2908
3013
|
relPath: t,
|
|
2909
3014
|
kind: "layout",
|
|
2910
3015
|
slotKey: e.dir
|
|
@@ -2912,37 +3017,37 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2912
3017
|
relPath: t,
|
|
2913
3018
|
kind: "layout",
|
|
2914
3019
|
slotKey: e.dir
|
|
2915
|
-
})), e.hasError && (
|
|
3020
|
+
})), e.hasError && (d.push(` ${a}: ${$(e.dir, "Error")},`), o.push({
|
|
2916
3021
|
relPath: n,
|
|
2917
3022
|
kind: "error",
|
|
2918
3023
|
slotKey: e.dir
|
|
2919
|
-
})), e.hasPending && (
|
|
3024
|
+
})), e.hasPending && (f.push(` ${a}: ${$(e.dir, "Pending")},`), o.push({
|
|
2920
3025
|
relPath: r,
|
|
2921
3026
|
kind: "pending",
|
|
2922
3027
|
slotKey: e.dir
|
|
2923
|
-
})), e.hasNotFound && (
|
|
3028
|
+
})), e.hasNotFound && (p.push(` ${a}: ${$(e.dir, "NotFound")},`), o.push({
|
|
2924
3029
|
relPath: i,
|
|
2925
3030
|
kind: "notFound",
|
|
2926
3031
|
slotKey: e.dir
|
|
2927
3032
|
}));
|
|
2928
3033
|
}
|
|
2929
|
-
for (let e of
|
|
3034
|
+
for (let e of m) o.push({
|
|
2930
3035
|
relPath: `../src/pages/${e.file}`,
|
|
2931
3036
|
kind: "page",
|
|
2932
3037
|
slotKey: e.pattern
|
|
2933
3038
|
});
|
|
2934
|
-
let
|
|
3039
|
+
let g = o.map((e) => ` ${JSON.stringify(e.relPath)},`), x = o.map((e, t) => {
|
|
2935
3040
|
let n = JSON.stringify(e.slotKey);
|
|
2936
3041
|
return e.kind === "page" ? ` if (newMods[${t}] && refs.pages[${n}] !== undefined) { refs.pages[${n}] = newMods[${t}]; changed = true }` : ` if (newMods[${t}]?.default) { refs.${e.kind === "layout" ? "layouts" : e.kind === "error" ? "errors" : e.kind === "pending" ? "pendings" : "notFounds"}[${n}] = newMods[${t}].default;${e.kind === "layout" ? ` refs.layoutLoaders[${n}] = newMods[${t}].loader;` : ""} changed = true }`;
|
|
2937
|
-
}),
|
|
2938
|
-
if (
|
|
2939
|
-
let
|
|
3042
|
+
}), S = t.locales ?? [], C = S.length > 0 && S.every((t) => L(P(e, "src", "locales", `${t}.ts`)) || L(P(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en", E = t.router?.viewTransitions === !0 ? " viewTransitions" : "";
|
|
3043
|
+
if (S.length > 0 && !C && Q.info(`i18n: locales [${S.join(", ")}] declared with no src/locales/<code>.ts — using them for <html lang> and the resolved locale only. Add the catalogs to get <I18nProvider> wired, or keep your own i18n stack.`), S.length > 0 && !S.includes(T)) throw Error(`[voltro dev] app.config.ts: defaultLocale '${T}' must be one of locales [${S.join(", ")}]`);
|
|
3044
|
+
let D = w ? [
|
|
2940
3045
|
"import { I18nProvider } from '@voltro/i18n'",
|
|
2941
3046
|
"import { resolveLocale } from '@voltro/i18n/server'",
|
|
2942
3047
|
"import { useServerRequest } from '@voltro/web'",
|
|
2943
|
-
...
|
|
3048
|
+
...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
|
|
2944
3049
|
] : [];
|
|
2945
|
-
|
|
3050
|
+
ee = [
|
|
2946
3051
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2947
3052
|
"// Routes + per-page chain + not-found scopes assembled from src/pages/.",
|
|
2948
3053
|
"//",
|
|
@@ -2979,16 +3084,16 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2979
3084
|
...s,
|
|
2980
3085
|
" },",
|
|
2981
3086
|
" layoutLoaders: {",
|
|
2982
|
-
...
|
|
3087
|
+
...u,
|
|
2983
3088
|
" },",
|
|
2984
3089
|
" errors: {",
|
|
2985
|
-
...
|
|
3090
|
+
...d,
|
|
2986
3091
|
" },",
|
|
2987
3092
|
" pendings: {",
|
|
2988
|
-
...
|
|
3093
|
+
...f,
|
|
2989
3094
|
" },",
|
|
2990
3095
|
" notFounds: {",
|
|
2991
|
-
...
|
|
3096
|
+
...p,
|
|
2992
3097
|
" },",
|
|
2993
3098
|
" pages: {},",
|
|
2994
3099
|
"}",
|
|
@@ -3053,17 +3158,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3053
3158
|
"if (import.meta.hot) {",
|
|
3054
3159
|
" import.meta.hot.accept(",
|
|
3055
3160
|
" [",
|
|
3056
|
-
...
|
|
3161
|
+
...g,
|
|
3057
3162
|
" ],",
|
|
3058
3163
|
" (newMods: Array<Record<string, unknown> | undefined>) => {",
|
|
3059
3164
|
" let changed = false",
|
|
3060
|
-
...
|
|
3165
|
+
...x,
|
|
3061
3166
|
" if (changed) bump()",
|
|
3062
3167
|
" },",
|
|
3063
3168
|
" )",
|
|
3064
3169
|
"}",
|
|
3065
3170
|
""
|
|
3066
|
-
].join("\n"),
|
|
3171
|
+
].join("\n"), y = [
|
|
3067
3172
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
3068
3173
|
"// The app's root component. It exports `App` and NOTHING ELSE: react-refresh",
|
|
3069
3174
|
"// only accepts a module whose every export is a component, and a module it",
|
|
@@ -3074,16 +3179,16 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3074
3179
|
"",
|
|
3075
3180
|
"import { useMemo, useSyncExternalStore } from 'react'",
|
|
3076
3181
|
"import { Router } from '@voltro/web'",
|
|
3077
|
-
...
|
|
3182
|
+
...D,
|
|
3078
3183
|
"import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
|
|
3079
3184
|
"",
|
|
3080
|
-
...
|
|
3081
|
-
`// i18n auto-wiring (config.locales = [${
|
|
3185
|
+
...w ? [
|
|
3186
|
+
`// i18n auto-wiring (config.locales = [${S.map((e) => JSON.stringify(e)).join(", ")}]).`,
|
|
3082
3187
|
"const I18N_CATALOGS: Record<string, import('@voltro/i18n').MessageCatalog> = {",
|
|
3083
|
-
...
|
|
3188
|
+
...S.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
|
|
3084
3189
|
"}",
|
|
3085
|
-
`const I18N_SUPPORTED: ReadonlyArray<string> = [${
|
|
3086
|
-
`const I18N_DEFAULT = ${JSON.stringify(
|
|
3190
|
+
`const I18N_SUPPORTED: ReadonlyArray<string> = [${S.map((e) => JSON.stringify(e)).join(", ")}]`,
|
|
3191
|
+
`const I18N_DEFAULT = ${JSON.stringify(T)}`,
|
|
3087
3192
|
"",
|
|
3088
3193
|
"// The zone + clock the SERVER decided for this document, read back off",
|
|
3089
3194
|
"// <html>. Same contract as <html lang> below and for the same reason:",
|
|
@@ -3157,7 +3262,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3157
3262
|
" const v = useSyncExternalStore(subscribe, getVersion, getVersion)",
|
|
3158
3263
|
" const routes = useMemo(() => buildRoutes(), [v])",
|
|
3159
3264
|
" const notFounds = useMemo(() => buildNotFounds(), [v])",
|
|
3160
|
-
...
|
|
3265
|
+
...w ? [
|
|
3161
3266
|
" const ssr = useServerRequest()",
|
|
3162
3267
|
" const locale = pickI18nLocale(ssr)",
|
|
3163
3268
|
" const messages = I18N_CATALOGS[locale] ?? I18N_CATALOGS[I18N_DEFAULT]!",
|
|
@@ -3172,26 +3277,26 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3172
3277
|
" defaultLocale={I18N_DEFAULT}",
|
|
3173
3278
|
" {...published}",
|
|
3174
3279
|
" >",
|
|
3175
|
-
` <Router routes={routes} notFounds={notFounds}${
|
|
3280
|
+
` <Router routes={routes} notFounds={notFounds}${E} />`,
|
|
3176
3281
|
" </I18nProvider>",
|
|
3177
3282
|
" )"
|
|
3178
|
-
] : [` return <Router routes={routes} notFounds={notFounds}${
|
|
3283
|
+
] : [` return <Router routes={routes} notFounds={notFounds}${E} />`],
|
|
3179
3284
|
"}",
|
|
3180
3285
|
""
|
|
3181
|
-
].join("\n"),
|
|
3286
|
+
].join("\n"), b = [
|
|
3182
3287
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
3183
3288
|
"// Entry: imports the generated App component and calls mount() with the",
|
|
3184
3289
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
3185
3290
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
3186
3291
|
"",
|
|
3187
|
-
...
|
|
3292
|
+
...Fo(t),
|
|
3188
3293
|
"import { mount } from '@voltro/web'",
|
|
3189
|
-
...
|
|
3294
|
+
..._,
|
|
3190
3295
|
"import { App } from './app'",
|
|
3191
3296
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
3192
|
-
...
|
|
3193
|
-
...
|
|
3194
|
-
...
|
|
3297
|
+
...Mo(t, l),
|
|
3298
|
+
...Oo(t, c),
|
|
3299
|
+
...Po(t, l),
|
|
3195
3300
|
"",
|
|
3196
3301
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
3197
3302
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -3206,54 +3311,54 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3206
3311
|
"",
|
|
3207
3312
|
"mount(App, {",
|
|
3208
3313
|
" apis: {",
|
|
3209
|
-
...
|
|
3314
|
+
...v,
|
|
3210
3315
|
" },",
|
|
3211
|
-
...
|
|
3212
|
-
...
|
|
3316
|
+
...jo(t, c),
|
|
3317
|
+
...Ao(t),
|
|
3213
3318
|
"})",
|
|
3214
3319
|
"",
|
|
3215
|
-
|
|
3320
|
+
Jo
|
|
3216
3321
|
].join("\n");
|
|
3217
|
-
} else
|
|
3322
|
+
} else y = "", ee = "", b = [
|
|
3218
3323
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
3219
3324
|
"// The user's root component lives at ../src/App.tsx; this file imports it",
|
|
3220
3325
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
3221
3326
|
"// user's component file remains the Fast Refresh boundary.",
|
|
3222
3327
|
"",
|
|
3223
|
-
...
|
|
3328
|
+
...Fo(t),
|
|
3224
3329
|
"import { mount } from '@voltro/web'",
|
|
3225
|
-
...
|
|
3330
|
+
..._,
|
|
3226
3331
|
"import App from '../src/App'",
|
|
3227
|
-
...
|
|
3228
|
-
...
|
|
3229
|
-
...
|
|
3332
|
+
...Mo(t, l),
|
|
3333
|
+
...Oo(t, c),
|
|
3334
|
+
...Po(t, l),
|
|
3230
3335
|
"",
|
|
3231
3336
|
"mount(App, {",
|
|
3232
3337
|
" apis: {",
|
|
3233
|
-
...
|
|
3338
|
+
...v,
|
|
3234
3339
|
" },",
|
|
3235
|
-
...
|
|
3236
|
-
...
|
|
3340
|
+
...jo(t, c),
|
|
3341
|
+
...Ao(t),
|
|
3237
3342
|
"})",
|
|
3238
3343
|
"",
|
|
3239
|
-
|
|
3344
|
+
Jo
|
|
3240
3345
|
].join("\n");
|
|
3241
|
-
let
|
|
3242
|
-
await z.mkdir(
|
|
3243
|
-
let
|
|
3346
|
+
let S = P(e, ".framework");
|
|
3347
|
+
await z.mkdir(S, { recursive: !0 }), t.env ? await ht(S, r) : await z.rm(P(S, "env.public.ts"), { force: !0 }), await z.writeFile(P(S, "index.html"), f, "utf8"), await z.writeFile(P(S, "main.tsx"), b, "utf8"), y ? (await z.writeFile(P(S, "app.tsx"), y, "utf8"), await z.writeFile(P(S, "routeTable.ts"), ee, "utf8")) : (await z.rm(P(S, "app.tsx"), { force: !0 }), await z.rm(P(S, "routeTable.ts"), { force: !0 }));
|
|
3348
|
+
let C = P(e, ".gitignore"), w = "";
|
|
3244
3349
|
try {
|
|
3245
|
-
|
|
3350
|
+
w = await z.readFile(C, "utf8");
|
|
3246
3351
|
} catch {}
|
|
3247
|
-
let
|
|
3248
|
-
if (
|
|
3249
|
-
let e =
|
|
3352
|
+
let T = ["/.framework/"], E = new Set(w.split("\n").map((e) => e.trim())), D = T.filter((e) => !E.has(e));
|
|
3353
|
+
if (D.length > 0) {
|
|
3354
|
+
let e = w === "" || w.endsWith("\n") ? "" : "\n";
|
|
3250
3355
|
try {
|
|
3251
|
-
await z.appendFile(
|
|
3356
|
+
await z.appendFile(C, `${e}${D.join("\n")}\n`, "utf8");
|
|
3252
3357
|
} catch (e) {
|
|
3253
|
-
Q.warn(`could not add ${
|
|
3358
|
+
Q.warn(`could not add ${D.join(", ")} to ${C} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
3254
3359
|
}
|
|
3255
3360
|
}
|
|
3256
|
-
},
|
|
3361
|
+
}, ds = async (e, t) => {
|
|
3257
3362
|
try {
|
|
3258
3363
|
let n = N(e), r = P(n, "project.json");
|
|
3259
3364
|
if (!L(r)) return;
|
|
@@ -3266,35 +3371,36 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3266
3371
|
projectJson: r
|
|
3267
3372
|
});
|
|
3268
3373
|
} catch {}
|
|
3269
|
-
},
|
|
3270
|
-
let n =
|
|
3374
|
+
}, fs = (e) => P(e, ".framework", "dist", "server", "appConfig.js"), ps = async (e, t = {}) => {
|
|
3375
|
+
let n = fs(e), r = t.preferSource !== !0 && L(n) ? n : P(e, "app.config.ts");
|
|
3271
3376
|
try {
|
|
3272
|
-
let e = (await import(
|
|
3377
|
+
let e = (await import(G(r).href)).default;
|
|
3273
3378
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
3274
3379
|
} catch {
|
|
3275
3380
|
return null;
|
|
3276
3381
|
}
|
|
3277
|
-
},
|
|
3382
|
+
}, ms = (e) => {
|
|
3278
3383
|
let t = e.restRoutes;
|
|
3279
3384
|
if (t !== void 0 && t.length !== 0) return `app.config.ts declares ${t.length} restRoute(s) on a type:'web' app — REST routes mount on the API process and were silently ignored here, so a health probe hitting one gets the SPA shell (200) and a POST gets 404.\n Move them to the API app's app.config.ts (they mount under the api origin), and call them there;\n for same-origin paths in front of the web app, terminate them at your ingress/proxy instead.`;
|
|
3280
|
-
},
|
|
3281
|
-
let u = await
|
|
3385
|
+
}, hs = async (t) => {
|
|
3386
|
+
let u = await ps(t, { preferSource: !0 });
|
|
3282
3387
|
if (!u) return {
|
|
3283
3388
|
ran: !1,
|
|
3284
3389
|
exitCode: 0
|
|
3285
3390
|
};
|
|
3391
|
+
let d = xo(u.health, () => !0);
|
|
3286
3392
|
{
|
|
3287
|
-
let e =
|
|
3393
|
+
let e = ms(u);
|
|
3288
3394
|
if (e !== void 0) return Q.error(`voltro dev (web): refusing to boot — ${e}`), {
|
|
3289
3395
|
ran: !0,
|
|
3290
3396
|
exitCode: 1
|
|
3291
3397
|
};
|
|
3292
3398
|
}
|
|
3293
|
-
|
|
3294
|
-
let
|
|
3295
|
-
|
|
3296
|
-
let
|
|
3297
|
-
for (let e of
|
|
3399
|
+
bi();
|
|
3400
|
+
let f = at();
|
|
3401
|
+
Qr(f), Q.info("booting voltro dev (web)", { app: u.name ?? "(unnamed)" }), Vt(t, Q);
|
|
3402
|
+
let p = await rs(t, u);
|
|
3403
|
+
for (let e of p) Q.info("api wired", {
|
|
3298
3404
|
name: e.name,
|
|
3299
3405
|
pkg: e.pkg,
|
|
3300
3406
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
@@ -3305,62 +3411,62 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3305
3411
|
Q.info(`${e} seeded`, { path: t.path });
|
|
3306
3412
|
}
|
|
3307
3413
|
}).catch(() => {});
|
|
3308
|
-
let { resolved:
|
|
3414
|
+
let { resolved: m } = await yt({
|
|
3309
3415
|
rawEnv: u.env,
|
|
3310
3416
|
appType: "web",
|
|
3311
3417
|
root: t,
|
|
3312
3418
|
log: Q,
|
|
3313
3419
|
generateTypes: !0
|
|
3314
|
-
}),
|
|
3315
|
-
await
|
|
3420
|
+
}), h = m.publicValues;
|
|
3421
|
+
await us(t, u, p, h), Q.debug("generated framework entry files", { files: [
|
|
3316
3422
|
"index.html",
|
|
3317
3423
|
".framework/main.tsx",
|
|
3318
3424
|
...u.env ? [".framework/env.public.ts"] : []
|
|
3319
3425
|
] });
|
|
3320
|
-
let
|
|
3426
|
+
let _ = l({
|
|
3321
3427
|
kind: "web",
|
|
3322
3428
|
configPort: u.port,
|
|
3323
3429
|
env: process.env,
|
|
3324
|
-
dashboardPin: process.env[
|
|
3430
|
+
dashboardPin: process.env[Ii] === "1"
|
|
3325
3431
|
});
|
|
3326
|
-
for (let e of
|
|
3327
|
-
let
|
|
3432
|
+
for (let e of _.warnings) Q.warn(e);
|
|
3433
|
+
let x = _.port, S = u.name ?? "unnamed", C = se("web", S, x), w = ce(S);
|
|
3328
3434
|
await ie({
|
|
3329
|
-
id:
|
|
3330
|
-
name:
|
|
3435
|
+
id: C,
|
|
3436
|
+
name: S,
|
|
3331
3437
|
kind: "web",
|
|
3332
|
-
url: `http://localhost:${
|
|
3438
|
+
url: `http://localhost:${x}`,
|
|
3333
3439
|
pid: process.pid,
|
|
3334
3440
|
status: "booting",
|
|
3335
|
-
logFile:
|
|
3336
|
-
}).catch(() => {}), await
|
|
3337
|
-
let { pages:
|
|
3441
|
+
logFile: w.path
|
|
3442
|
+
}).catch(() => {}), await ds(t, x);
|
|
3443
|
+
let { pages: T, dirs: E } = await Wo(P(t, "src", "pages")), D = null, te = u.fonts !== void 0 && u.fonts.length > 0 ? yr({
|
|
3338
3444
|
root: t,
|
|
3339
3445
|
fonts: u.fonts,
|
|
3340
3446
|
cache: ee(),
|
|
3341
|
-
secret:
|
|
3342
|
-
isOgSsrRoute: (e) =>
|
|
3447
|
+
secret: _r().secret,
|
|
3448
|
+
isOgSsrRoute: (e) => k.ssrRoutes.some((t) => t.pattern === e),
|
|
3343
3449
|
getPageModule: async (e) => {
|
|
3344
|
-
let t =
|
|
3345
|
-
if (t === void 0 ||
|
|
3346
|
-
let n = await
|
|
3450
|
+
let t = k.ssrRoutes.find((t) => t.pattern === e);
|
|
3451
|
+
if (t === void 0 || D === null) return null;
|
|
3452
|
+
let n = await D(t.file), r = y(n, t.file);
|
|
3347
3453
|
return r === "ssr" || r === "isr" ? n : null;
|
|
3348
3454
|
}
|
|
3349
|
-
}) : null,
|
|
3350
|
-
dirs:
|
|
3351
|
-
ssrRoutes:
|
|
3352
|
-
},
|
|
3455
|
+
}) : null, k = {
|
|
3456
|
+
dirs: E,
|
|
3457
|
+
ssrRoutes: Xo(T)
|
|
3458
|
+
}, ne = E.map((e) => ({
|
|
3353
3459
|
dir: e.dir,
|
|
3354
3460
|
hasLayout: e.hasLayout,
|
|
3355
3461
|
hasError: e.hasError,
|
|
3356
3462
|
hasPending: e.hasPending,
|
|
3357
3463
|
hasNotFound: e.hasNotFound
|
|
3358
|
-
})),
|
|
3464
|
+
})), A = await kr({
|
|
3359
3465
|
appRoot: t,
|
|
3360
|
-
pages:
|
|
3466
|
+
pages: T
|
|
3361
3467
|
});
|
|
3362
|
-
|
|
3363
|
-
let
|
|
3468
|
+
A.wrote && Q.debug("routes codegen wrote", { path: F(t, A.path) });
|
|
3469
|
+
let j = await lt("vite", () => import("vite")), M = (await import("@vitejs/plugin-react")).default, re = (await import("@tailwindcss/vite")).default, N = P(t, ".framework"), ue = P(t, "src"), de = /* @__PURE__ */ new Set([
|
|
3364
3470
|
".framework",
|
|
3365
3471
|
"node_modules",
|
|
3366
3472
|
"dist",
|
|
@@ -3368,32 +3474,32 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3368
3474
|
".vite",
|
|
3369
3475
|
".turbo",
|
|
3370
3476
|
".cache"
|
|
3371
|
-
]),
|
|
3477
|
+
]), R = {
|
|
3372
3478
|
name: "framework:watch-app-sources",
|
|
3373
3479
|
async configureServer(e) {
|
|
3374
3480
|
try {
|
|
3375
|
-
let n = (await z.readdir(t, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !
|
|
3481
|
+
let n = (await z.readdir(t, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !de.has(e.name));
|
|
3376
3482
|
for (let r of n) e.watcher.add(P(t, r.name));
|
|
3377
|
-
n.length === 0 && e.watcher.add(
|
|
3483
|
+
n.length === 0 && e.watcher.add(ue);
|
|
3378
3484
|
} catch {
|
|
3379
|
-
e.watcher.add(
|
|
3485
|
+
e.watcher.add(ue);
|
|
3380
3486
|
}
|
|
3381
3487
|
for (let n of await g(t)) e.watcher.add(n.dir);
|
|
3382
3488
|
}
|
|
3383
|
-
},
|
|
3489
|
+
}, B = P(t, "src", "pages"), V = (e) => e.endsWith(".tsx") && (e === B || e.startsWith(B + "/")), H = (e) => e === B || e.startsWith(B + "/"), fe = async (e) => {
|
|
3384
3490
|
try {
|
|
3385
3491
|
let n = Date.now();
|
|
3386
|
-
await
|
|
3387
|
-
let { pages: r, dirs: i } = await
|
|
3388
|
-
await
|
|
3492
|
+
await us(t, u, p, h);
|
|
3493
|
+
let { pages: r, dirs: i } = await Wo(B);
|
|
3494
|
+
await kr({
|
|
3389
3495
|
appRoot: t,
|
|
3390
3496
|
pages: r
|
|
3391
|
-
}),
|
|
3497
|
+
}), k.dirs = i, k.ssrRoutes = Xo(r), Q.info("page tree regenerated", {
|
|
3392
3498
|
reason: e,
|
|
3393
3499
|
ms: Date.now() - n,
|
|
3394
|
-
routes:
|
|
3500
|
+
routes: k.ssrRoutes.length
|
|
3395
3501
|
});
|
|
3396
|
-
for (let e of
|
|
3502
|
+
for (let e of Ia(Y, k.ssrRoutes.map((e) => e.pattern))) Q.error(`middleware.ts: ${e.message}`);
|
|
3397
3503
|
} catch (t) {
|
|
3398
3504
|
Q.error("page tree regen failed", { reason: e }, t);
|
|
3399
3505
|
}
|
|
@@ -3408,23 +3514,23 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3408
3514
|
}, 50);
|
|
3409
3515
|
};
|
|
3410
3516
|
e.watcher.on("add", (e) => {
|
|
3411
|
-
|
|
3517
|
+
V(e) && i(`add ${F(t, e)}`);
|
|
3412
3518
|
}), e.watcher.on("unlink", (e) => {
|
|
3413
|
-
|
|
3519
|
+
V(e) && i(`unlink ${F(t, e)}`);
|
|
3414
3520
|
}), e.watcher.on("addDir", (e) => {
|
|
3415
|
-
|
|
3521
|
+
H(e) && i(`addDir ${F(t, e)}`);
|
|
3416
3522
|
}), e.watcher.on("unlinkDir", (e) => {
|
|
3417
|
-
|
|
3523
|
+
H(e) && i(`unlinkDir ${F(t, e)}`);
|
|
3418
3524
|
});
|
|
3419
3525
|
}
|
|
3420
|
-
},
|
|
3421
|
-
if (!
|
|
3526
|
+
}, U = P(t, "app.config.ts"), W = (e) => {
|
|
3527
|
+
if (!Ae(e.env)) return "";
|
|
3422
3528
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
3423
3529
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
3424
|
-
},
|
|
3530
|
+
}, G = (e, t) => {
|
|
3425
3531
|
let n = [];
|
|
3426
|
-
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"),
|
|
3427
|
-
},
|
|
3532
|
+
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"), W(e) !== W(t) && n.push("env"), n;
|
|
3533
|
+
}, me = u, K = I(U), ge = () => {
|
|
3428
3534
|
let e = Be(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
3429
3535
|
stdio: "inherit",
|
|
3430
3536
|
env: process.env,
|
|
@@ -3437,24 +3543,24 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3437
3543
|
}), e.on("error", (e) => {
|
|
3438
3544
|
Q.error("restart spawn failed", {}, e), process.exit(1);
|
|
3439
3545
|
});
|
|
3440
|
-
},
|
|
3546
|
+
}, _e = {
|
|
3441
3547
|
name: "framework:watch-app-config",
|
|
3442
3548
|
async configureServer(n) {
|
|
3443
|
-
n.watcher.add(
|
|
3444
|
-
let r =
|
|
3549
|
+
n.watcher.add(U), Q.info("watching app.config.ts for changes", { path: F(t, U) });
|
|
3550
|
+
let r = ka.map((e) => P(t, e)), i = new Set(r.map((e) => I(e)));
|
|
3445
3551
|
for (let e of r) n.watcher.add(e);
|
|
3446
3552
|
n.watcher.on("all", (e, r) => {
|
|
3447
3553
|
i.has(I(r)) && (Q.warn("middleware.ts changed — restarting (it is loaded once per boot)", { path: F(t, r) }), n.close().catch(() => void 0).then(() => {
|
|
3448
|
-
|
|
3554
|
+
ge();
|
|
3449
3555
|
}));
|
|
3450
3556
|
});
|
|
3451
3557
|
let a = async () => {
|
|
3452
3558
|
try {
|
|
3453
3559
|
try {
|
|
3454
|
-
let e = n.moduleGraph.getModuleById(
|
|
3560
|
+
let e = n.moduleGraph.getModuleById(U);
|
|
3455
3561
|
e && n.moduleGraph.invalidateModule(e);
|
|
3456
3562
|
} catch {}
|
|
3457
|
-
let e = (await n.ssrLoadModule(
|
|
3563
|
+
let e = (await n.ssrLoadModule(U, { fixStacktrace: !0 })).default;
|
|
3458
3564
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Q.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
|
|
3459
3565
|
} catch (e) {
|
|
3460
3566
|
return Q.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
@@ -3473,22 +3579,22 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3473
3579
|
theme: e.theme,
|
|
3474
3580
|
port: e.port,
|
|
3475
3581
|
name: e.name
|
|
3476
|
-
}), JSON.stringify(e) === JSON.stringify(
|
|
3582
|
+
}), JSON.stringify(e) === JSON.stringify(me)) {
|
|
3477
3583
|
Q.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
3478
3584
|
return;
|
|
3479
3585
|
}
|
|
3480
|
-
let r =
|
|
3586
|
+
let r = G(me, e);
|
|
3481
3587
|
if (r.length > 0) {
|
|
3482
3588
|
Q.warn("app.config.ts changed — hard restart required", { fields: r });
|
|
3483
3589
|
try {
|
|
3484
3590
|
await n.close();
|
|
3485
3591
|
} catch {}
|
|
3486
|
-
|
|
3592
|
+
ge();
|
|
3487
3593
|
return;
|
|
3488
3594
|
}
|
|
3489
3595
|
try {
|
|
3490
3596
|
let r = Date.now();
|
|
3491
|
-
await
|
|
3597
|
+
await us(t, e, await rs(t, e)), me = e, n.ws && n.ws.send({
|
|
3492
3598
|
type: "full-reload",
|
|
3493
3599
|
path: "*"
|
|
3494
3600
|
}), Q.info("app.config.ts soft-regen", {
|
|
@@ -3498,7 +3604,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3498
3604
|
} catch (e) {
|
|
3499
3605
|
Q.error("app.config.ts soft-regen failed", {}, e);
|
|
3500
3606
|
}
|
|
3501
|
-
}, l = (e) => le(e) === "app.config.ts" ? e ===
|
|
3607
|
+
}, l = (e) => le(e) === "app.config.ts" ? e === U || I(e) === K : !1;
|
|
3502
3608
|
n.watcher.on("change", (e) => {
|
|
3503
3609
|
l(e) && (Q.info("app.config.ts change event (chokidar)", { file: e }), s());
|
|
3504
3610
|
}), n.watcher.on("add", (e) => {
|
|
@@ -3506,46 +3612,46 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3506
3612
|
});
|
|
3507
3613
|
try {
|
|
3508
3614
|
let { watchFile: e } = await import("node:fs");
|
|
3509
|
-
e(
|
|
3615
|
+
e(U, { interval: 500 }, (e, t) => {
|
|
3510
3616
|
e.mtimeMs !== t.mtimeMs && (Q.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
|
|
3511
3617
|
}), Q.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
3512
3618
|
} catch (e) {
|
|
3513
3619
|
Q.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
3514
3620
|
}
|
|
3515
|
-
|
|
3621
|
+
wt(e, Q, {
|
|
3516
3622
|
root: t,
|
|
3517
3623
|
onBeforeRestart: () => n.close()
|
|
3518
3624
|
});
|
|
3519
3625
|
}
|
|
3520
|
-
},
|
|
3626
|
+
}, ve = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, ye = 0, be = {
|
|
3521
3627
|
name: "framework:suppress-api-hmr",
|
|
3522
3628
|
handleHotUpdate(e) {
|
|
3523
|
-
if (
|
|
3629
|
+
if (ye += 1, ve.test(e.file)) return [];
|
|
3524
3630
|
}
|
|
3525
|
-
},
|
|
3631
|
+
}, xe = {
|
|
3526
3632
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
3527
3633
|
async configureServer(e) {
|
|
3528
3634
|
let n = [];
|
|
3529
|
-
for (let r of
|
|
3530
|
-
let i = await
|
|
3635
|
+
for (let r of p) {
|
|
3636
|
+
let i = await Qo(t, r.pkg);
|
|
3531
3637
|
if (i) {
|
|
3532
3638
|
n.push(i);
|
|
3533
3639
|
try {
|
|
3534
3640
|
e.watcher.add(P(i, "rpcGroup.generated.ts"));
|
|
3535
3641
|
} catch {}
|
|
3536
|
-
for (let t of await
|
|
3642
|
+
for (let t of await Ta(i)) try {
|
|
3537
3643
|
e.watcher.add(t);
|
|
3538
3644
|
} catch {}
|
|
3539
3645
|
}
|
|
3540
3646
|
}
|
|
3541
3647
|
if (n.length === 0) return;
|
|
3542
|
-
let r = await
|
|
3648
|
+
let r = await Da(n), i = null, a = !1, o = async () => {
|
|
3543
3649
|
if (a) return;
|
|
3544
|
-
let t = await
|
|
3650
|
+
let t = await Da(n);
|
|
3545
3651
|
if (t !== void 0 && t !== r) {
|
|
3546
3652
|
r = t, a = !0, Q.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
|
|
3547
3653
|
try {
|
|
3548
|
-
await z.rm(P(
|
|
3654
|
+
await z.rm(P(N, ".vite", "deps"), {
|
|
3549
3655
|
recursive: !0,
|
|
3550
3656
|
force: !0
|
|
3551
3657
|
}), await e.restart(!0);
|
|
@@ -3555,15 +3661,15 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3555
3661
|
}
|
|
3556
3662
|
}, s = (e) => {
|
|
3557
3663
|
let t = I(e);
|
|
3558
|
-
!
|
|
3664
|
+
!Ca(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
|
|
3559
3665
|
o();
|
|
3560
3666
|
}, 120));
|
|
3561
3667
|
};
|
|
3562
3668
|
e.watcher.on("change", s), e.watcher.on("add", s);
|
|
3563
3669
|
}
|
|
3564
|
-
},
|
|
3670
|
+
}, Se = {}, Ce = (e) => (t) => {
|
|
3565
3671
|
t.on("proxyReq", (t, n) => {
|
|
3566
|
-
|
|
3672
|
+
vi(t, n, {
|
|
3567
3673
|
target: e,
|
|
3568
3674
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
3569
3675
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
@@ -3571,16 +3677,16 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3571
3677
|
});
|
|
3572
3678
|
});
|
|
3573
3679
|
};
|
|
3574
|
-
for (let e of
|
|
3680
|
+
for (let e of p) {
|
|
3575
3681
|
if (!e.proxyTarget) continue;
|
|
3576
|
-
|
|
3682
|
+
Se[e.browserWsUrl] = {
|
|
3577
3683
|
target: e.proxyTarget,
|
|
3578
3684
|
ws: !0,
|
|
3579
3685
|
changeOrigin: !0,
|
|
3580
3686
|
...e.wsPath ? {} : { rewrite: () => "/ws" }
|
|
3581
3687
|
};
|
|
3582
3688
|
let t = e.proxyTarget.replace(/^ws/, "http");
|
|
3583
|
-
|
|
3689
|
+
Se[`/_voltro/api/${e.name}`] = {
|
|
3584
3690
|
target: t,
|
|
3585
3691
|
changeOrigin: !0,
|
|
3586
3692
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
@@ -3588,11 +3694,11 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3588
3694
|
};
|
|
3589
3695
|
}
|
|
3590
3696
|
for (let [e, t] of Object.entries(u.proxies ?? {})) {
|
|
3591
|
-
if (
|
|
3697
|
+
if (Se[e]) {
|
|
3592
3698
|
Q.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
3593
3699
|
continue;
|
|
3594
3700
|
}
|
|
3595
|
-
|
|
3701
|
+
Se[e] = {
|
|
3596
3702
|
target: t.target,
|
|
3597
3703
|
changeOrigin: t.changeOrigin ?? !0,
|
|
3598
3704
|
...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
|
|
@@ -3605,10 +3711,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3605
3711
|
let we = {
|
|
3606
3712
|
name: "framework:inspect",
|
|
3607
3713
|
configureServer(e) {
|
|
3608
|
-
let l = null,
|
|
3714
|
+
let l = null, p = async () => {
|
|
3609
3715
|
if (l !== null) return l;
|
|
3610
3716
|
let n = [];
|
|
3611
|
-
for (let r of
|
|
3717
|
+
for (let r of T) try {
|
|
3612
3718
|
let i = await e.ssrLoadModule(P(t, "src", "pages", r.file));
|
|
3613
3719
|
n.push({
|
|
3614
3720
|
pattern: r.pattern,
|
|
@@ -3630,12 +3736,21 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3630
3736
|
return l = n, n;
|
|
3631
3737
|
};
|
|
3632
3738
|
e.middlewares.use((e, t, n) => {
|
|
3739
|
+
let r = So(d, (e.url ?? "/").split("?")[0] ?? "/");
|
|
3740
|
+
if (r === void 0) return n();
|
|
3741
|
+
Co(d, r).then((e) => {
|
|
3742
|
+
t.writeHead(e.status, {
|
|
3743
|
+
"content-type": "text/plain",
|
|
3744
|
+
"cache-control": "no-store"
|
|
3745
|
+
}), t.end(e.body);
|
|
3746
|
+
});
|
|
3747
|
+
}), e.middlewares.use((e, t, n) => {
|
|
3633
3748
|
let r = e.url ?? "/";
|
|
3634
3749
|
if (r.startsWith("/_voltro/inspect") || r.startsWith("/api/dashboard/proxy")) return n();
|
|
3635
3750
|
let i = Date.now(), a = t.end.bind(t);
|
|
3636
3751
|
t.end = ((...e) => {
|
|
3637
3752
|
try {
|
|
3638
|
-
|
|
3753
|
+
f.emit("request", {
|
|
3639
3754
|
url: r.split("?")[0],
|
|
3640
3755
|
status: t.statusCode ?? 0,
|
|
3641
3756
|
durationMs: Date.now() - i
|
|
@@ -3645,9 +3760,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3645
3760
|
}), n();
|
|
3646
3761
|
}), e.middlewares.use((e, n, r) => {
|
|
3647
3762
|
if (e.method !== "GET" && e.method !== "HEAD") return r();
|
|
3648
|
-
let { pathname: i } =
|
|
3763
|
+
let { pathname: i } = $i(e.url ?? "/");
|
|
3649
3764
|
if (i !== "/robots.txt" || L(P(t, "public", "robots.txt"))) return r();
|
|
3650
|
-
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(
|
|
3765
|
+
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(Fr({ indexable: !1 }));
|
|
3651
3766
|
}), u.name === "voltroDashboard" && e.middlewares.use(async (e, t, a) => {
|
|
3652
3767
|
let o = e.url ?? "", s = o.split("?")[0];
|
|
3653
3768
|
if (s === "/api/dashboard/proxy") {
|
|
@@ -3741,7 +3856,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3741
3856
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (i[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
3742
3857
|
let l = r.split("?")[0];
|
|
3743
3858
|
if (e.method === "GET" && (l === "/_voltro/inspect/logs" || r.startsWith("/_voltro/inspect/logs?"))) {
|
|
3744
|
-
let e = a(i.origin), n =
|
|
3859
|
+
let e = a(i.origin), n = fi(r, Kr(), i);
|
|
3745
3860
|
t.statusCode = n.status, t.setHeader("content-type", n.contentType);
|
|
3746
3861
|
for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
|
|
3747
3862
|
t.end(n.body);
|
|
@@ -3759,7 +3874,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3759
3874
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
3760
3875
|
r += e;
|
|
3761
3876
|
}), e.on("end", () => {
|
|
3762
|
-
let e =
|
|
3877
|
+
let e = oi(r, f);
|
|
3763
3878
|
t.statusCode = e.status, t.setHeader("content-type", e.contentType);
|
|
3764
3879
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3765
3880
|
t.end(e.body);
|
|
@@ -3790,17 +3905,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3790
3905
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
3791
3906
|
t.flushHeaders?.(), t.write("retry: 5000\n\n");
|
|
3792
3907
|
let l = r.indexOf("?");
|
|
3793
|
-
if (l === -1 || new URLSearchParams(r.slice(l + 1)).get("live") !== "1") for (let e of
|
|
3794
|
-
let u =
|
|
3908
|
+
if (l === -1 || new URLSearchParams(r.slice(l + 1)).get("live") !== "1") for (let e of f.buffered()) t.write(ot(e));
|
|
3909
|
+
let u = f.subscribe((e) => {
|
|
3795
3910
|
try {
|
|
3796
3911
|
t.write(ot(e));
|
|
3797
3912
|
} catch {}
|
|
3798
|
-
}),
|
|
3913
|
+
}), d = setInterval(() => {
|
|
3799
3914
|
try {
|
|
3800
3915
|
t.write(st());
|
|
3801
3916
|
} catch {}
|
|
3802
3917
|
}, 15e3), p = () => {
|
|
3803
|
-
clearInterval(
|
|
3918
|
+
clearInterval(d), u();
|
|
3804
3919
|
};
|
|
3805
3920
|
e.on("close", p), t.on("close", p);
|
|
3806
3921
|
return;
|
|
@@ -3810,8 +3925,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3810
3925
|
kind: "web",
|
|
3811
3926
|
meta: {
|
|
3812
3927
|
name: u.name ?? "(unnamed)",
|
|
3813
|
-
voltroVersion:
|
|
3814
|
-
port:
|
|
3928
|
+
voltroVersion: To,
|
|
3929
|
+
port: x,
|
|
3815
3930
|
mode: "dev",
|
|
3816
3931
|
apis: Object.entries(u.apis ?? {}).map(([e, t]) => {
|
|
3817
3932
|
let n = {
|
|
@@ -3821,14 +3936,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3821
3936
|
return t.url !== void 0 && (n.url = t.url), n;
|
|
3822
3937
|
})
|
|
3823
3938
|
},
|
|
3824
|
-
routes: await
|
|
3825
|
-
dirs:
|
|
3939
|
+
routes: await p(),
|
|
3940
|
+
dirs: ne,
|
|
3826
3941
|
cache: () => ({
|
|
3827
3942
|
backend: "memory",
|
|
3828
3943
|
size: 0,
|
|
3829
3944
|
entries: []
|
|
3830
3945
|
}),
|
|
3831
|
-
env: () =>
|
|
3946
|
+
env: () => xt(u.name ?? "app", { contract: Ae(u.env) ? u.env : void 0 })
|
|
3832
3947
|
}, s = o(r, a, i, { method: e.method ?? "GET" });
|
|
3833
3948
|
if (s === null) return n();
|
|
3834
3949
|
t.statusCode = s.status, t.setHeader("content-type", s.contentType);
|
|
@@ -3853,11 +3968,11 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3853
3968
|
});
|
|
3854
3969
|
}
|
|
3855
3970
|
} : null, Ee = /* @__PURE__ */ new Set(), De = (e, t, n, r, i, a = !1) => {
|
|
3856
|
-
let o =
|
|
3971
|
+
let o = oa(i, a, t) ?? "";
|
|
3857
3972
|
if (Q.error(`${t} render failed`, {
|
|
3858
3973
|
pathname: n,
|
|
3859
3974
|
pattern: r,
|
|
3860
|
-
cause:
|
|
3975
|
+
cause: Lr(i) + o
|
|
3861
3976
|
}), e.headersSent) {
|
|
3862
3977
|
e.end();
|
|
3863
3978
|
return;
|
|
@@ -3865,11 +3980,11 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3865
3980
|
e.writeHead(500, {
|
|
3866
3981
|
"content-type": "text/plain; charset=utf-8",
|
|
3867
3982
|
"x-voltro-rendered-by": `${t}-failed`,
|
|
3868
|
-
"x-voltro-ssr-generation": String(
|
|
3983
|
+
"x-voltro-ssr-generation": String(ye)
|
|
3869
3984
|
});
|
|
3870
|
-
let s =
|
|
3871
|
-
e.end(`${t} render failed for ${n}\n\n${
|
|
3872
|
-
}, Oe =
|
|
3985
|
+
let s = ye === 0 ? "" : `\n[voltro] this process has absorbed ${ye} hot update(s) since boot, so its SSR\nmodule graph may not match the files on disk. Before reporting this — to us or to\nyourself — restart \`voltro dev\` and measure once from a fresh boot.\n`;
|
|
3986
|
+
e.end(`${t} render failed for ${n}\n\n${Lr(i)}\n${o}\n${s}`);
|
|
3987
|
+
}, Oe = $t(), ke = tn({
|
|
3873
3988
|
limit: Oe,
|
|
3874
3989
|
onColdStart: (e) => Q.debug("ssr cold-compile start", { id: e }),
|
|
3875
3990
|
onColdEnd: (e, { durationMs: t, failed: n }) => Q.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
@@ -3879,7 +3994,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3879
3994
|
})
|
|
3880
3995
|
});
|
|
3881
3996
|
Q.debug(`ssr cold-compile concurrency ${Oe}`, { concurrency: Oe });
|
|
3882
|
-
let
|
|
3997
|
+
let je = null, Me = async () => (je === null && (je = await z.readFile(P(t, ".framework", "index.html"), "utf8")), je), Ne = {
|
|
3883
3998
|
name: "framework:ssr",
|
|
3884
3999
|
configureServer(e) {
|
|
3885
4000
|
let n = (t) => ke.load(t, async () => await e.ssrLoadModule(t)), r, i = !1, a = () => {
|
|
@@ -3920,25 +4035,25 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3920
4035
|
})(), r);
|
|
3921
4036
|
}, o, s = () => (o ??= (async () => {
|
|
3922
4037
|
try {
|
|
3923
|
-
let e =
|
|
4038
|
+
let e = p[0];
|
|
3924
4039
|
if (e === void 0) return;
|
|
3925
4040
|
let t = (await n(`${e.pkg}/rpcGroup`)).appDescriptors;
|
|
3926
4041
|
if (t === void 0) return;
|
|
3927
4042
|
(await n("@voltro/web/ssr")).registerSsrApiDescriptors?.(e.name, t);
|
|
3928
4043
|
} catch {}
|
|
3929
|
-
})(), o), c =
|
|
3930
|
-
apiName:
|
|
3931
|
-
apiOrigin:
|
|
4044
|
+
})(), o), c = mn({
|
|
4045
|
+
apiName: p[0]?.name,
|
|
4046
|
+
apiOrigin: ss(p[0], { allowDevProxy: !0 }),
|
|
3932
4047
|
loadDescriptors: async () => {
|
|
3933
|
-
let e =
|
|
4048
|
+
let e = p[0];
|
|
3934
4049
|
if (e !== void 0) return (await n(`${e.pkg}/rpcGroup`)).appDescriptors;
|
|
3935
4050
|
},
|
|
3936
|
-
rpcQuery: (e, t) =>
|
|
3937
|
-
apiName:
|
|
4051
|
+
rpcQuery: (e, t) => cs(ss(p[0], { allowDevProxy: !0 }), e, {
|
|
4052
|
+
apiName: p[0]?.name,
|
|
3938
4053
|
headers: t
|
|
3939
4054
|
}),
|
|
3940
4055
|
resolveLocale: async (e, t) => {
|
|
3941
|
-
let n =
|
|
4056
|
+
let n = un(t, u.locales);
|
|
3942
4057
|
return n === void 0 ? (await a())(e.cookie, e["accept-language"])?.locale ?? "en" : n;
|
|
3943
4058
|
},
|
|
3944
4059
|
renderErrorPage: async () => void 0
|
|
@@ -3950,7 +4065,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3950
4065
|
}).then((e) => {
|
|
3951
4066
|
e || n();
|
|
3952
4067
|
});
|
|
3953
|
-
}),
|
|
4068
|
+
}), D = async (n) => await e.ssrLoadModule(P(t, "src", "pages", n)), e.middlewares.use(async (e, t, n) => {
|
|
3954
4069
|
let r = e.url ?? "/";
|
|
3955
4070
|
if (!r.startsWith("/_voltro/og") || te === null) return n();
|
|
3956
4071
|
try {
|
|
@@ -3966,30 +4081,30 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3966
4081
|
if (r.method !== "GET" && r.method !== "HEAD") return c();
|
|
3967
4082
|
let l = r.url ?? "/";
|
|
3968
4083
|
l.indexOf("?");
|
|
3969
|
-
let { pathname: d, search:
|
|
4084
|
+
let { pathname: d, search: f } = $i(l), m = r.__voltroFormFlash;
|
|
3970
4085
|
if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt") return c();
|
|
3971
4086
|
let h = async () => {
|
|
3972
4087
|
if (Y.length === 0) return;
|
|
3973
|
-
let e =
|
|
4088
|
+
let e = Fa(Y, {
|
|
3974
4089
|
route: void 0,
|
|
3975
4090
|
pathname: d
|
|
3976
4091
|
});
|
|
3977
4092
|
if (e === void 0) return;
|
|
3978
4093
|
let t = {};
|
|
3979
4094
|
for (let [e, n] of Object.entries(r.headers ?? {})) typeof n == "string" ? t[e] = n : Array.isArray(n) && (t[e] = n.join(", "));
|
|
3980
|
-
let n = await
|
|
4095
|
+
let n = await Ga(e, {
|
|
3981
4096
|
pathname: d,
|
|
3982
|
-
search:
|
|
4097
|
+
search: f,
|
|
3983
4098
|
headers: t,
|
|
3984
|
-
cookies:
|
|
4099
|
+
cookies: Ra(t.cookie),
|
|
3985
4100
|
route: void 0
|
|
3986
4101
|
});
|
|
3987
|
-
for (let e of n.setCookies) o.appendHeader("set-cookie",
|
|
4102
|
+
for (let e of n.setCookies) o.appendHeader("set-cookie", Ha(e));
|
|
3988
4103
|
};
|
|
3989
4104
|
if (/\.[a-z0-9]+$/i.test(d)) return await h(), c();
|
|
3990
|
-
let g =
|
|
4105
|
+
let g = Zo(d, k.ssrRoutes), _ = !1;
|
|
3991
4106
|
if (!g) {
|
|
3992
|
-
let e =
|
|
4107
|
+
let e = Eo(k.dirs, d);
|
|
3993
4108
|
if (e === void 0) return await h(), c();
|
|
3994
4109
|
_ = !0, g = {
|
|
3995
4110
|
route: {
|
|
@@ -4023,31 +4138,31 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4023
4138
|
}
|
|
4024
4139
|
}, C = !1;
|
|
4025
4140
|
try {
|
|
4026
|
-
let w = await x("loadPage", async () => await n(P(t, "src", "pages", g.route.file))), T = _ ? "ssr" : y(w, P("src", "pages", g.route.file)), E =
|
|
4027
|
-
if (T !== "ssr" && T !== "isr" && !
|
|
4028
|
-
let
|
|
4029
|
-
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ?
|
|
4030
|
-
let
|
|
4141
|
+
let w = await x("loadPage", async () => await n(P(t, "src", "pages", g.route.file))), T = _ ? "ssr" : y(w, P("src", "pages", g.route.file)), E = Go(k.dirs, g.route.dirChain), D = T === "spa" && E.some((e) => e.hasLayout), O = w.interactive ?? "full";
|
|
4142
|
+
if (T !== "ssr" && T !== "isr" && !D && O !== "islands") return await h(), c();
|
|
4143
|
+
let ne = {};
|
|
4144
|
+
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ? ne[e] = t : Array.isArray(t) && (ne[e] = t.join(", "));
|
|
4145
|
+
let A = await Ga(Fa(Y, {
|
|
4031
4146
|
route: g.route.pattern,
|
|
4032
4147
|
pathname: d
|
|
4033
4148
|
}), {
|
|
4034
4149
|
pathname: d,
|
|
4035
|
-
search:
|
|
4036
|
-
headers:
|
|
4037
|
-
cookies:
|
|
4150
|
+
search: f,
|
|
4151
|
+
headers: ne,
|
|
4152
|
+
cookies: Ra(ne.cookie),
|
|
4038
4153
|
route: g.route.pattern
|
|
4039
|
-
},
|
|
4040
|
-
for (let e of
|
|
4041
|
-
for (let [e, t] of Object.entries(
|
|
4042
|
-
if (T === "isr" &&
|
|
4043
|
-
let
|
|
4044
|
-
apiName:
|
|
4045
|
-
headers:
|
|
4154
|
+
}, Ve);
|
|
4155
|
+
for (let e of A.setCookies) o.appendHeader("set-cookie", Ha(e));
|
|
4156
|
+
for (let [e, t] of Object.entries(A.responseHeaders)) o.setHeader(e, t);
|
|
4157
|
+
if (T === "isr" && A.cspNonce !== void 0) throw Error(`page '${g.route.pattern}' is renderMode 'isr' while middleware.ts mints a cspNonce — an isr render is CACHED and a cached nonce is a lie the browser enforces. Use renderMode 'ssr' for nonce'd pages, or a hash-based CSP for isr.`);
|
|
4158
|
+
let j = T === "isr" ? Ya(A.headers) : A.headers, M = T === "isr" && w.ppr === !0, re = M ? go(j, g.route.pattern) : j, ie = cs(ss(p[0], { allowDevProxy: !0 }), j.cookie, {
|
|
4159
|
+
apiName: p[0]?.name,
|
|
4160
|
+
headers: j
|
|
4046
4161
|
}), ae = new AbortController(), oe = () => ae.abort();
|
|
4047
4162
|
o.once("close", oe);
|
|
4048
4163
|
let se = null, ce = [], le = {};
|
|
4049
4164
|
try {
|
|
4050
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), await s(), {chain: ce, segmentLoaderData: le} = await x("loadChain", () =>
|
|
4165
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), await s(), {chain: ce, segmentLoaderData: le} = await x("loadChain", () => Ko({
|
|
4051
4166
|
entries: E,
|
|
4052
4167
|
loadLayout: (e) => n(P(t, "src", "pages", e.dir, "layout.tsx")),
|
|
4053
4168
|
loadError: (e) => n(P(t, "src", "pages", e.dir, "error.tsx")),
|
|
@@ -4055,20 +4170,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4055
4170
|
ctx: {
|
|
4056
4171
|
params: g.params,
|
|
4057
4172
|
pathname: d,
|
|
4058
|
-
search:
|
|
4173
|
+
search: f,
|
|
4059
4174
|
signal: ae.signal,
|
|
4060
|
-
headers:
|
|
4175
|
+
headers: re,
|
|
4061
4176
|
query: ie,
|
|
4062
4177
|
isServer: !0
|
|
4063
4178
|
}
|
|
4064
4179
|
}));
|
|
4065
4180
|
let e = w.loader;
|
|
4066
|
-
typeof e == "function" && !
|
|
4181
|
+
typeof e == "function" && !D && (se = await x("loader", () => e({
|
|
4067
4182
|
params: g.params,
|
|
4068
4183
|
pathname: d,
|
|
4069
|
-
search:
|
|
4184
|
+
search: f,
|
|
4070
4185
|
signal: ae.signal,
|
|
4071
|
-
headers:
|
|
4186
|
+
headers: re,
|
|
4072
4187
|
query: ie,
|
|
4073
4188
|
isServer: !0
|
|
4074
4189
|
})));
|
|
@@ -4076,11 +4191,11 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4076
4191
|
o.off("close", oe);
|
|
4077
4192
|
}
|
|
4078
4193
|
let N = await x("loadSsrHelpers", async () => await n("@voltro/web/ssr"));
|
|
4079
|
-
|
|
4194
|
+
D || await Sa({
|
|
4080
4195
|
pageMod: w,
|
|
4081
4196
|
params: g.params,
|
|
4082
4197
|
query: ie,
|
|
4083
|
-
apiName:
|
|
4198
|
+
apiName: p[0]?.name,
|
|
4084
4199
|
seed: N.seedPreloadedSubscription,
|
|
4085
4200
|
seedFailure: N.seedPreloadedSubscriptionFailure,
|
|
4086
4201
|
onError: ({ tag: e, apiName: t }, n) => Q.warn("preload seed failed", {
|
|
@@ -4099,16 +4214,16 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4099
4214
|
renderMode: T,
|
|
4100
4215
|
chain: ce
|
|
4101
4216
|
}, F = {
|
|
4102
|
-
cookies:
|
|
4103
|
-
headers:
|
|
4217
|
+
cookies: M ? _o(Xa(A.cookies), g.route.pattern) : T === "isr" ? Xa(A.cookies) : A.cookies,
|
|
4218
|
+
headers: re,
|
|
4104
4219
|
url: l,
|
|
4105
4220
|
...m === void 0 ? {} : { formFlash: m }
|
|
4106
|
-
}, I = (await a())(
|
|
4221
|
+
}, I = (await a())(j.cookie, j["accept-language"]);
|
|
4107
4222
|
C = I !== void 0 && i;
|
|
4108
4223
|
let de = I ? {
|
|
4109
4224
|
outerWrap: I.outerWrap,
|
|
4110
4225
|
locale: I.locale
|
|
4111
|
-
} : {}, L =
|
|
4226
|
+
} : {}, L = D ? Xi({
|
|
4112
4227
|
helpers: N,
|
|
4113
4228
|
page: `src/pages/${g.route.file}`,
|
|
4114
4229
|
interactive: O,
|
|
@@ -4117,12 +4232,12 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4117
4232
|
descriptor: ue,
|
|
4118
4233
|
params: g.params,
|
|
4119
4234
|
pathname: d,
|
|
4120
|
-
search:
|
|
4235
|
+
search: f,
|
|
4121
4236
|
segmentLoaderData: le,
|
|
4122
4237
|
requestContext: F,
|
|
4123
4238
|
...de
|
|
4124
4239
|
}
|
|
4125
|
-
}) : null, R =
|
|
4240
|
+
}) : null, R = D ? null : Yi({
|
|
4126
4241
|
helpers: N,
|
|
4127
4242
|
page: `src/pages/${g.route.file}`,
|
|
4128
4243
|
pathname: d,
|
|
@@ -4131,9 +4246,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4131
4246
|
loaderData: se,
|
|
4132
4247
|
segmentLoaderData: le,
|
|
4133
4248
|
pageLoaderRan: typeof w.loader == "function",
|
|
4134
|
-
...
|
|
4249
|
+
...M ? { ppr: !0 } : {}
|
|
4135
4250
|
});
|
|
4136
|
-
|
|
4251
|
+
M && R !== null && yo(R.stateInput, g.route.pattern);
|
|
4137
4252
|
let B = [];
|
|
4138
4253
|
await x("collectCss", async () => {
|
|
4139
4254
|
let e = /* @__PURE__ */ new Set(), n = [
|
|
@@ -4148,58 +4263,58 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4148
4263
|
for (let t of n) await S(t, e, B);
|
|
4149
4264
|
});
|
|
4150
4265
|
let V = (O === "islands" ? await x("islandsEntry", async () => {
|
|
4151
|
-
let e =
|
|
4266
|
+
let e = ls(p, "../../app.config"), n = (await jn({
|
|
4152
4267
|
webRoot: t,
|
|
4153
4268
|
pages: [{
|
|
4154
4269
|
pattern: g.route.pattern,
|
|
4155
4270
|
file: g.route.file
|
|
4156
4271
|
}],
|
|
4157
|
-
headSnippets:
|
|
4272
|
+
headSnippets: En(await Me()),
|
|
4158
4273
|
apiImports: e.imports,
|
|
4159
4274
|
apiEntriesLiteral: `[\n${e.providerEntryLines.join("\n")}\n ]`
|
|
4160
4275
|
}))[0];
|
|
4161
4276
|
return n === void 0 ? void 0 : await z.readFile(P(t, ".framework", n.htmlFile), "utf8");
|
|
4162
|
-
}) : void 0) ?? await x("readShell", Me),
|
|
4163
|
-
lang:
|
|
4277
|
+
}) : void 0) ?? await x("readShell", Me), H = await x("transformShell", () => e.transformIndexHtml(l, V)), fe = B.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), pe = I?.locale ?? F.cookies["voltro:locale"] ?? u.defaultLocale ?? (u.locales ?? [])[0] ?? "en", U = Date.now(), W = {
|
|
4278
|
+
lang: pe,
|
|
4164
4279
|
...I?.timeZone === void 0 ? {} : { timeZone: I.timeZone },
|
|
4165
|
-
renderedAt:
|
|
4280
|
+
renderedAt: U
|
|
4166
4281
|
};
|
|
4167
4282
|
if (L) {
|
|
4168
|
-
let e = (e) =>
|
|
4283
|
+
let e = (e) => Qi({
|
|
4169
4284
|
helpers: N,
|
|
4170
4285
|
prepared: L,
|
|
4171
4286
|
meta: e,
|
|
4172
4287
|
interactive: O,
|
|
4173
|
-
extra: [
|
|
4288
|
+
extra: [fe]
|
|
4174
4289
|
});
|
|
4175
|
-
if (L.hasDeferred)
|
|
4290
|
+
if (L.hasDeferred) ya({
|
|
4176
4291
|
res: o,
|
|
4177
|
-
shell:
|
|
4178
|
-
shell:
|
|
4292
|
+
shell: pa({
|
|
4293
|
+
shell: H,
|
|
4179
4294
|
inlineModuleScriptsAsync: !0
|
|
4180
4295
|
}),
|
|
4181
|
-
documentAttrs:
|
|
4296
|
+
documentAttrs: W,
|
|
4182
4297
|
headers: {
|
|
4183
4298
|
"content-type": "text/html; charset=utf-8",
|
|
4184
4299
|
"x-voltro-rendered-by": "spa-shell-dev"
|
|
4185
4300
|
},
|
|
4186
4301
|
headInjection: e,
|
|
4187
|
-
...
|
|
4302
|
+
...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce },
|
|
4188
4303
|
render: (e) => N.renderPageToStream({
|
|
4189
4304
|
...L.renderInput,
|
|
4190
4305
|
...e,
|
|
4191
|
-
...
|
|
4306
|
+
...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce }
|
|
4192
4307
|
}),
|
|
4193
4308
|
onShellError: (e) => {
|
|
4194
4309
|
De(o, "spa-shell-dev", d, g.route.pattern, e, C);
|
|
4195
4310
|
}
|
|
4196
4311
|
});
|
|
4197
4312
|
else {
|
|
4198
|
-
let t =
|
|
4313
|
+
let t = Zi({
|
|
4199
4314
|
helpers: N,
|
|
4200
4315
|
prepared: L
|
|
4201
|
-
}), n =
|
|
4202
|
-
o.statusCode = 200, o.setHeader("content-type", "text/html; charset=utf-8"), o.setHeader("x-voltro-rendered-by", "spa-shell-dev"), o.end(
|
|
4316
|
+
}), n = _a(H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`), W);
|
|
4317
|
+
o.statusCode = 200, o.setHeader("content-type", "text/html; charset=utf-8"), o.setHeader("x-voltro-rendered-by", "spa-shell-dev"), o.end(A.cspNonce === void 0 ? n : ha(n, A.cspNonce));
|
|
4203
4318
|
}
|
|
4204
4319
|
} else if (R) {
|
|
4205
4320
|
let e = (e) => {
|
|
@@ -4211,7 +4326,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4211
4326
|
});
|
|
4212
4327
|
return `<meta property="og:image" content="${n}" /><meta name="twitter:image" content="${n}" /><meta name="twitter:card" content="summary_large_image" />`;
|
|
4213
4328
|
}, t = (t) => [
|
|
4214
|
-
|
|
4329
|
+
fe,
|
|
4215
4330
|
N.renderMetaToHtml(t) + e(N.renderMetaToHtml(t)),
|
|
4216
4331
|
`<meta name="voltro-interactive" content="${O}" />`,
|
|
4217
4332
|
...R.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
|
|
@@ -4220,52 +4335,52 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4220
4335
|
descriptor: ue,
|
|
4221
4336
|
params: g.params,
|
|
4222
4337
|
pathname: d,
|
|
4223
|
-
search:
|
|
4338
|
+
search: f,
|
|
4224
4339
|
loaderData: R.loaderData,
|
|
4225
4340
|
segmentLoaderData: R.segmentLoaderData,
|
|
4226
4341
|
requestContext: F,
|
|
4227
4342
|
...de
|
|
4228
4343
|
};
|
|
4229
|
-
if (T === "ssr" && O === "full" && m === void 0)
|
|
4344
|
+
if (T === "ssr" && O === "full" && m === void 0) ya({
|
|
4230
4345
|
res: o,
|
|
4231
|
-
shell:
|
|
4232
|
-
shell:
|
|
4346
|
+
shell: pa({
|
|
4347
|
+
shell: H,
|
|
4233
4348
|
inlineModuleScriptsAsync: !0
|
|
4234
4349
|
}),
|
|
4235
|
-
documentAttrs:
|
|
4350
|
+
documentAttrs: W,
|
|
4236
4351
|
headers: {
|
|
4237
4352
|
"content-type": "text/html; charset=utf-8",
|
|
4238
4353
|
"x-voltro-rendered-by": "ssr-dev"
|
|
4239
4354
|
},
|
|
4240
4355
|
headInjection: t,
|
|
4241
|
-
...
|
|
4356
|
+
...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce },
|
|
4242
4357
|
render: (e) => N.renderPageToStream({
|
|
4243
4358
|
...n,
|
|
4244
4359
|
...e,
|
|
4245
|
-
...
|
|
4360
|
+
...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce }
|
|
4246
4361
|
}),
|
|
4247
4362
|
onShellError: (e) => {
|
|
4248
4363
|
De(o, "ssr-dev", d, g.route.pattern, e, C);
|
|
4249
4364
|
}
|
|
4250
4365
|
});
|
|
4251
4366
|
else {
|
|
4252
|
-
let { html: e, meta: r } = N.renderPageToHtml(n), i =
|
|
4367
|
+
let { html: e, meta: r } = N.renderPageToHtml(n), i = _a(H.replace("<div id=\"root\"></div>", `<div id="root">${e}</div>`).replace("</head>", ` ${t(r)}\n </head>`), W);
|
|
4253
4368
|
o.statusCode = m === void 0 ? _ ? 404 : 200 : 422, o.setHeader("content-type", "text/html; charset=utf-8"), o.setHeader("x-voltro-rendered-by", _ ? "ssr-not-found" : "ssr-dev"), m !== void 0 && o.setHeader("cache-control", "no-store");
|
|
4254
|
-
let a = m === void 0 ? i :
|
|
4255
|
-
if (
|
|
4256
|
-
o.setHeader("x-voltro-ppr", "shell+holes"),
|
|
4257
|
-
let e =
|
|
4258
|
-
apiName:
|
|
4259
|
-
headers:
|
|
4369
|
+
let a = m === void 0 ? i : on(i, m);
|
|
4370
|
+
if (M && m === void 0 && typeof w.loader == "function") {
|
|
4371
|
+
o.setHeader("x-voltro-ppr", "shell+holes"), oo(g.route.pattern), o.write(a);
|
|
4372
|
+
let e = cs(ss(p[0], { allowDevProxy: !0 }), A.headers.cookie, {
|
|
4373
|
+
apiName: p[0]?.name,
|
|
4374
|
+
headers: A.headers
|
|
4260
4375
|
}), t = new AbortController();
|
|
4261
|
-
await
|
|
4376
|
+
await vo({
|
|
4262
4377
|
loader: w.loader,
|
|
4263
4378
|
ctx: {
|
|
4264
4379
|
params: g.params,
|
|
4265
4380
|
pathname: d,
|
|
4266
|
-
search:
|
|
4381
|
+
search: f,
|
|
4267
4382
|
signal: t.signal,
|
|
4268
|
-
headers:
|
|
4383
|
+
headers: A.headers,
|
|
4269
4384
|
query: e,
|
|
4270
4385
|
isServer: !0
|
|
4271
4386
|
},
|
|
@@ -4274,33 +4389,33 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4274
4389
|
page: g.route.pattern,
|
|
4275
4390
|
log: Q
|
|
4276
4391
|
});
|
|
4277
|
-
} else o.end(
|
|
4392
|
+
} else o.end(A.cspNonce === void 0 ? a : ha(a, A.cspNonce));
|
|
4278
4393
|
}
|
|
4279
4394
|
}
|
|
4280
|
-
b.render = Date.now() -
|
|
4281
|
-
let
|
|
4282
|
-
v ? (Ee.add(g.route.pattern), Q.info(`ssr compiled ${g.route.pattern} in ${
|
|
4395
|
+
b.render = Date.now() - U;
|
|
4396
|
+
let G = Date.now() - ee;
|
|
4397
|
+
v ? (Ee.add(g.route.pattern), Q.info(`ssr compiled ${g.route.pattern} in ${G}ms`, {
|
|
4283
4398
|
pattern: g.route.pattern,
|
|
4284
4399
|
pathname: d,
|
|
4285
|
-
elapsedMs:
|
|
4400
|
+
elapsedMs: G,
|
|
4286
4401
|
cold: !0,
|
|
4287
4402
|
phases: b
|
|
4288
|
-
})) :
|
|
4403
|
+
})) : G > 200 && Q.info(`ssr rendered ${d} in ${G}ms`, {
|
|
4289
4404
|
pattern: g.route.pattern,
|
|
4290
4405
|
pathname: d,
|
|
4291
|
-
elapsedMs:
|
|
4406
|
+
elapsedMs: G,
|
|
4292
4407
|
cold: !1,
|
|
4293
4408
|
phases: b
|
|
4294
4409
|
});
|
|
4295
4410
|
} catch (e) {
|
|
4296
|
-
if (
|
|
4411
|
+
if (qi(e)) {
|
|
4297
4412
|
Q.error("ssr-dev render refused", {
|
|
4298
4413
|
pathname: d,
|
|
4299
4414
|
pattern: g.route.pattern
|
|
4300
4415
|
}, e), o.statusCode = 500, o.setHeader("content-type", "text/plain; charset=utf-8"), o.end(e.message);
|
|
4301
4416
|
return;
|
|
4302
4417
|
}
|
|
4303
|
-
let t =
|
|
4418
|
+
let t = Ji(e);
|
|
4304
4419
|
if (t) {
|
|
4305
4420
|
o.statusCode = t.status;
|
|
4306
4421
|
for (let [e, n] of Object.entries(t.headers)) o.setHeader(e, String(n));
|
|
@@ -4311,15 +4426,15 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4311
4426
|
}
|
|
4312
4427
|
});
|
|
4313
4428
|
}
|
|
4314
|
-
}, Pe = Date.now(), Fe =
|
|
4429
|
+
}, Pe = Date.now(), Fe = j.version ?? "?", Ie = await Do(), q = P(t, "node_modules", "@voltro", "ui-shadcn"), J = L(P(q, "package.json")) ? q : null, Le = [], Re = await (async () => {
|
|
4315
4430
|
let e = [];
|
|
4316
|
-
for (let n of
|
|
4317
|
-
let r = await
|
|
4431
|
+
for (let n of p) {
|
|
4432
|
+
let r = await Qo(t, n.pkg);
|
|
4318
4433
|
r && e.push(r);
|
|
4319
4434
|
}
|
|
4320
|
-
let n = await
|
|
4435
|
+
let n = await Da(e);
|
|
4321
4436
|
if (n === void 0) return !1;
|
|
4322
|
-
let r = P(
|
|
4437
|
+
let r = P(N, ".voltro-rpcgroup-optimize"), i = "";
|
|
4323
4438
|
try {
|
|
4324
4439
|
i = (await z.readFile(r, "utf8")).trim();
|
|
4325
4440
|
} catch {}
|
|
@@ -4328,20 +4443,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4328
4443
|
await z.writeFile(r, n);
|
|
4329
4444
|
} catch {}
|
|
4330
4445
|
return !0;
|
|
4331
|
-
})(),
|
|
4332
|
-
|
|
4446
|
+
})(), ze = /* @__PURE__ */ new Set(), Ve = (e) => {
|
|
4447
|
+
ze.has(e.name) || (ze.add(e.name), Q.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
|
|
4333
4448
|
cookie: e.name,
|
|
4334
4449
|
hint: "If your IdP client reads this from `document.cookie` (Supabase's `createBrowserClient` does), pass `httpOnly: false`. Otherwise the SSR render succeeds and the user is signed out at the first client-side call. Set `httpOnly: true` explicitly to silence this."
|
|
4335
4450
|
}));
|
|
4336
|
-
}, Y = await
|
|
4337
|
-
Y.length > 0 && Q.info(`middleware.ts loaded — ${Y.length} middleware(s): ` + Y.map((e) => e.exportName).join(", ")),
|
|
4451
|
+
}, Y = await Wa(t);
|
|
4452
|
+
Y.length > 0 && Q.info(`middleware.ts loaded — ${Y.length} middleware(s): ` + Y.map((e) => e.exportName).join(", ")), La(Y, k.ssrRoutes.map((e) => e.pattern)), Re && Q.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
|
|
4338
4453
|
try {
|
|
4339
|
-
await
|
|
4454
|
+
await kt(x, "voltro dev (web)");
|
|
4340
4455
|
} catch (e) {
|
|
4341
4456
|
Q.error(String(e.message ?? e)), process.exit(1);
|
|
4342
4457
|
}
|
|
4343
|
-
await (await
|
|
4344
|
-
root:
|
|
4458
|
+
await (await j.createServer({
|
|
4459
|
+
root: N,
|
|
4345
4460
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
4346
4461
|
ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
|
|
4347
4462
|
resolve: {
|
|
@@ -4352,121 +4467,121 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4352
4467
|
"@voltro/i18n"
|
|
4353
4468
|
],
|
|
4354
4469
|
alias: [
|
|
4355
|
-
...
|
|
4470
|
+
...Ie ? [{
|
|
4356
4471
|
find: "@voltro/devtools/styles.css",
|
|
4357
|
-
replacement: P(
|
|
4472
|
+
replacement: P(Ie, "src/styles.css")
|
|
4358
4473
|
}, {
|
|
4359
4474
|
find: "@voltro/devtools",
|
|
4360
|
-
replacement: P(
|
|
4475
|
+
replacement: P(Ie, "src/index.ts")
|
|
4361
4476
|
}] : [],
|
|
4362
|
-
...
|
|
4477
|
+
...J ? [
|
|
4363
4478
|
{
|
|
4364
4479
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
4365
|
-
replacement: P(
|
|
4480
|
+
replacement: P(J, "src/tokens.css")
|
|
4366
4481
|
},
|
|
4367
4482
|
{
|
|
4368
4483
|
find: "@voltro/ui-shadcn/cn",
|
|
4369
|
-
replacement: P(
|
|
4484
|
+
replacement: P(J, "src/cn.ts")
|
|
4370
4485
|
},
|
|
4371
4486
|
{
|
|
4372
4487
|
find: "@voltro/ui-shadcn/brand",
|
|
4373
|
-
replacement: P(
|
|
4488
|
+
replacement: P(J, "src/brand/voltroLogo.tsx")
|
|
4374
4489
|
},
|
|
4375
4490
|
{
|
|
4376
4491
|
find: "@voltro/ui-shadcn",
|
|
4377
|
-
replacement: P(
|
|
4492
|
+
replacement: P(J, "src/index.ts")
|
|
4378
4493
|
}
|
|
4379
4494
|
] : [],
|
|
4380
|
-
...
|
|
4495
|
+
...Qt(t)
|
|
4381
4496
|
]
|
|
4382
4497
|
},
|
|
4383
4498
|
optimizeDeps: {
|
|
4384
|
-
include: [...
|
|
4385
|
-
force:
|
|
4499
|
+
include: [...p.map((e) => `${e.pkg}/rpcGroup`), ...Le],
|
|
4500
|
+
force: Re
|
|
4386
4501
|
},
|
|
4387
|
-
customLogger:
|
|
4502
|
+
customLogger: Xt(),
|
|
4388
4503
|
plugins: [
|
|
4389
|
-
|
|
4390
|
-
|
|
4504
|
+
ji(P(t, "src", "pages")),
|
|
4505
|
+
Rn({
|
|
4391
4506
|
root: t,
|
|
4392
|
-
config:
|
|
4507
|
+
config: O(u.images)
|
|
4393
4508
|
}),
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4509
|
+
Un(t, u.fonts),
|
|
4510
|
+
cr(t, u.feeds ?? [], u.seo?.siteUrl),
|
|
4511
|
+
M(),
|
|
4512
|
+
re(),
|
|
4513
|
+
R,
|
|
4399
4514
|
pe,
|
|
4400
|
-
|
|
4515
|
+
_e,
|
|
4516
|
+
be,
|
|
4401
4517
|
xe,
|
|
4402
|
-
Se,
|
|
4403
4518
|
we,
|
|
4404
4519
|
Ne,
|
|
4405
4520
|
...Te ? [Te] : []
|
|
4406
4521
|
],
|
|
4407
4522
|
server: {
|
|
4408
|
-
port:
|
|
4523
|
+
port: x,
|
|
4409
4524
|
strictPort: !0,
|
|
4410
4525
|
host: !0,
|
|
4411
4526
|
allowedHosts: u.allowedHosts === !0 || [...u.allowedHosts ?? []],
|
|
4412
|
-
proxy:
|
|
4413
|
-
fs: { allow: [t, ...
|
|
4527
|
+
proxy: Se,
|
|
4528
|
+
fs: { allow: [t, ...Io(t)] }
|
|
4414
4529
|
},
|
|
4415
4530
|
appType: "spa",
|
|
4416
|
-
cacheDir: P(
|
|
4531
|
+
cacheDir: P(N, ".vite"),
|
|
4417
4532
|
publicDir: P(t, "public")
|
|
4418
|
-
})).listen(),
|
|
4533
|
+
})).listen(), wo.info(`v${Fe} ready in ${Date.now() - Pe}ms`, {
|
|
4419
4534
|
version: Fe,
|
|
4420
4535
|
bootMs: Date.now() - Pe
|
|
4421
|
-
}), Q.info(`listening on http://localhost:${
|
|
4422
|
-
port:
|
|
4536
|
+
}), Q.info(`listening on http://localhost:${x}`, {
|
|
4537
|
+
port: x,
|
|
4423
4538
|
app: u.name ?? "(unnamed)"
|
|
4424
4539
|
});
|
|
4425
|
-
for (let e of
|
|
4540
|
+
for (let e of p) e.proxyTarget && (Q.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
|
|
4426
4541
|
api: e.name,
|
|
4427
4542
|
target: e.proxyTarget
|
|
4428
4543
|
}), Q.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
4429
4544
|
try {
|
|
4430
4545
|
await ie({
|
|
4431
|
-
id:
|
|
4432
|
-
name:
|
|
4546
|
+
id: C,
|
|
4547
|
+
name: S,
|
|
4433
4548
|
kind: "web",
|
|
4434
|
-
url: `http://localhost:${
|
|
4549
|
+
url: `http://localhost:${x}`,
|
|
4435
4550
|
pid: process.pid,
|
|
4436
4551
|
status: "live",
|
|
4437
|
-
logFile:
|
|
4552
|
+
logFile: w.path
|
|
4438
4553
|
});
|
|
4439
|
-
let e =
|
|
4554
|
+
let e = Fi(t);
|
|
4440
4555
|
if (e) {
|
|
4441
|
-
let t = await
|
|
4556
|
+
let t = await Gi({ dashboardAppPath: e });
|
|
4442
4557
|
t.status === "launched" ? Q.info(`dashboard launched at http://localhost:${t.port}`, { port: t.port }) : t.status === "already-running" && Q.debug(`dashboard already running on :${t.port}`, { port: t.port });
|
|
4443
4558
|
}
|
|
4444
4559
|
setInterval(() => {
|
|
4445
4560
|
ie({
|
|
4446
|
-
id:
|
|
4447
|
-
name:
|
|
4561
|
+
id: C,
|
|
4562
|
+
name: S,
|
|
4448
4563
|
kind: "web",
|
|
4449
|
-
url: `http://localhost:${
|
|
4564
|
+
url: `http://localhost:${x}`,
|
|
4450
4565
|
pid: process.pid,
|
|
4451
4566
|
status: "live",
|
|
4452
|
-
logFile:
|
|
4567
|
+
logFile: w.path
|
|
4453
4568
|
}).catch(() => {});
|
|
4454
4569
|
}, 1e4).unref();
|
|
4455
4570
|
let n = () => {
|
|
4456
|
-
oe(
|
|
4571
|
+
oe(C), w.dispose();
|
|
4457
4572
|
};
|
|
4458
4573
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
4459
4574
|
} catch (e) {
|
|
4460
4575
|
Q.warn("runtime-registry write failed", {}, e);
|
|
4461
4576
|
}
|
|
4462
|
-
return
|
|
4577
|
+
return he({
|
|
4463
4578
|
app: u.name ?? "unnamed",
|
|
4464
4579
|
kind: "web",
|
|
4465
|
-
url: `http://localhost:${
|
|
4580
|
+
url: `http://localhost:${x}`,
|
|
4466
4581
|
bootMs: Date.now() - Pe
|
|
4467
4582
|
}), new Promise(() => {});
|
|
4468
|
-
},
|
|
4469
|
-
let t = await
|
|
4583
|
+
}, gs = async (e) => {
|
|
4584
|
+
let t = await ps(e);
|
|
4470
4585
|
return t ? (Q.child("serve").error("`voltro serve` is the production server for an API app — this is a WEB app.\n\n production voltro start .\n development voltro dev .\n\nBoth read the artefacts `voltro build` produces. `serve` cannot: it has no\nSSR bundle to render from, and building a second time here would overwrite\nthe one `voltro build` wrote.", {
|
|
4471
4586
|
app: t.name ?? "(unnamed)",
|
|
4472
4587
|
root: e
|
|
@@ -4479,4 +4594,4 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
4479
4594
|
};
|
|
4480
4595
|
};
|
|
4481
4596
|
//#endregion
|
|
4482
|
-
export {
|
|
4597
|
+
export { Yi as $, ot as $t, xo as A, En as At, Wa as B, Lt as Bt, gs as C, mr as Ct, us as D, Vn as Dt, ms as E, Gn as Et, oo as F, un as Ft, Ha as G, kt as Gt, Ra as H, Rt as Ht, Xa as I, mn as It, ma as J, St as Jt, Sa as K, wt as Kt, Ya as L, tn as Lt, yo as M, Tn as Mt, _o as N, On as Nt, Co as O, Rn as Ot, go as P, We as Pt, qi as Q, lt as Qt, La as R, $t as Rt, hs as S, pr as St, Wo as T, nr as Tt, Ga as U, Bt as Ut, Ia as V, zt as Vt, Fa as W, Vt as Wt, ha as X, mt as Xt, pa as Y, yt as Yt, ya as Z, pt as Zt, ts as _, Pr as _t, Eo as a, Pi as at, Po as b, yr as bt, Ko as c, _i as ct, Ho as d, oi as dt, at as en, Xi as et, $ as f, Qr as ft, es as g, Fr as gt, rs as h, qr as ht, ns as i, Ii as it, vo as j, kn as jt, So as k, jn as kt, fs as l, fi as lt, ps as m, Kr as mt, ss as n, Qi as nt, ls as o, Gi as ot, Uo as p, Wr as pt, _a as q, xt as qt, ko as r, $i as rt, cs as s, Fi as st, zo as t, st as tn, Zi as tt, Go as u, ci as ut, No as v, kr as vt, Ro as w, ar as wt, as as x, _r as xt, Mo as y, vr as yt, Ua as z, Qt as zt };
|