@voltro/cli 0.51.0 → 0.52.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 +127 -0
- package/dist/{agentsMd-D6yD7IQv.js → agentsMd-0l980yhL.js} +4 -1
- package/dist/agentsMd-SDDSkyl4.js +2 -0
- package/dist/apiBuild-BYBpL7Pz.js +2 -0
- package/dist/{apiBuild-CPDHXF72.js → apiBuild-CSFI8QGq.js} +3 -3
- package/dist/bin.js +1 -1
- package/dist/build-CPgcMQug.js +793 -0
- package/dist/checkCommand-2SbqzukH.js +2 -0
- package/dist/{checkCommand-DNuPiWMc.js → checkCommand-COmqc2cB.js} +92 -46
- package/dist/{cloudCmd-F4YJeqM3.js → cloudCmd-QUXh-b5w.js} +1 -1
- package/dist/codegen-CctkDO-1.js +2 -0
- package/dist/{codegen-CrMXs4hb.js → codegen-VF479Cnb.js} +1 -1
- package/dist/{codegenCommand-BNBHcNNj.js → codegenCommand-DCdG2JN-.js} +12 -12
- package/dist/{codemodRunner-BDVixlSw.js → codemodRunner-r7J9lIa7.js} +588 -540
- package/dist/{commands-B1OiS9bX.js → commands-Cc_nV8WI.js} +35 -35
- package/dist/{dashboardCommand-C-vvPY1B.js → dashboardCommand-C-gKvwqh.js} +5 -5
- package/dist/{dataCommand-C1GxXW5q.js → dataCommand-BgpBHnlB.js} +27 -27
- package/dist/dbCommand-DNb6yeOG.js +2 -0
- package/dist/{dbCommand-If4Y1xQ-.js → dbCommand-sHedr-NJ.js} +2 -2
- package/dist/dev--A3nsxA3.js +3 -0
- package/dist/{dev-kdAg9Q7l.js → dev-CRHoCEiy.js} +2142 -2103
- package/dist/doctorCommand-CqoWA2p5.js +2 -0
- package/dist/{doctorCommand-nKmeW78u.js → doctorCommand-DtfJ3FA6.js} +314 -234
- package/dist/{dormancyCommand-CY3wa_SW.js → dormancyCommand-Drn7o0No.js} +1 -1
- package/dist/{embeddingsCommand-BDLIgje_.js → embeddingsCommand-Z-jO1fWN.js} +1 -1
- package/dist/{envCommand-C6V_xVlT.js → envCommand-D4gCrrTZ.js} +8 -8
- package/dist/{evolveCommand-D3c4DSfN.js → evolveCommand-CMROeKeA.js} +2 -2
- package/dist/fileConventions-DOqD3lPS.js +34 -0
- package/dist/{fileTaxonomy-CJfgOllU.js → fileTaxonomy-DvDUV9wq.js} +1 -1
- package/dist/frameworkTableAssembly-C6ETawPR.js +2 -0
- package/dist/{frameworkTableAssembly-BwJVEKLr.js → frameworkTableAssembly-w-XnLa3q.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{infoCommand-BnRFEF1o.js → infoCommand-DXM868o_.js} +1 -1
- package/dist/inspectMetrics-CGF94puw.js +143 -0
- package/dist/{metaCommands-CfRLra0s.js → metaCommands-C6RFmF1r.js} +2 -2
- package/dist/{migrate-DehuBakM.js → migrate-D0F-eTlK.js} +2 -2
- package/dist/{pageConvention-cEiRxdab.js → pageConvention-CzUiSbtU.js} +1 -1
- package/dist/{privacyCommand-XejDMvmu.js → privacyCommand-DGdopOI6.js} +1 -1
- package/dist/{projectScaffold-mIX_DpSe.js → projectScaffold-B4dmTlwT.js} +1 -1
- package/dist/{projectScaffold-BIl97_E6.js → projectScaffold-EzlErR4E.js} +1 -1
- package/dist/{renderModeScan-D7J1B7Kw.js → renderModeScan-CcH2X1_D.js} +25 -10
- package/dist/{renderProfile-1OWWAAtx.js → renderProfile-Ck32Fzxr.js} +2 -2
- package/dist/{runtimeTrace-ZsBU7Tkx.js → runtimeTrace-BPQyCmC5.js} +1 -1
- package/dist/{sdkgen-O4XqWOjM.js → sdkgen-Se88ifTd.js} +1 -1
- package/dist/serveCommand-DLc-BznW.js +2 -0
- package/dist/{serveCommand-DdiYNBBu.js → serveCommand-DkP3OT0W.js} +885 -868
- package/dist/serveEntry.js +1 -1
- package/dist/start-DfL3fOiN.js +3 -0
- package/dist/start-jw89Xbqy.js +1339 -0
- package/dist/startEntry.js +1 -1
- package/dist/{staticCommand-Dr2M6tpU.js → staticCommand-BwNEDlSU.js} +1 -1
- package/dist/{test-rXFq4S76.js → test-f3amja6a.js} +1 -1
- package/dist/updateCommand-5gFVfK5q.js +2 -0
- package/dist/{updateCommand-Bs322Q78.js → updateCommand-BMk2e4ky.js} +1 -1
- package/dist/{webDev-B-ubQEMX.js → webDev-BgWL9gKV.js} +1156 -835
- package/dist/webDev-CZbTsDcH.js +2 -0
- package/dist/{webhooksCommand-FLYY9IXh.js → webhooksCommand-CoIO3jbj.js} +1 -1
- package/package.json +30 -17
- package/templates/AGENTS.core.md +11 -0
- package/templates/AGENTS.md +15 -4
- package/templates/agent-docs/_index.md +4 -4
- package/templates/agent-docs/_manifest.json +11 -11
- package/templates/agent-docs/cli.md +96 -14
- package/templates/agent-docs/data.md +210 -7
- package/templates/agent-docs/database/schema.md +1 -1
- package/templates/agent-docs/database/seedsdialects.md +1 -1
- package/templates/agent-docs/deployment.md +22 -3
- package/templates/agent-docs/introduction.md +46 -0
- package/templates/agent-docs/local-first-mobile.md +34 -7
- package/templates/agent-docs/plugins/ai-flows.md +1 -1
- package/templates/agent-docs/plugins/audit.md +5 -5
- package/templates/agent-docs/plugins/cdc-out.md +2 -2
- package/templates/agent-docs/plugins/{versioning.md → row-history.md} +22 -22
- package/templates/agent-docs/plugins/storage.md +2 -2
- package/templates/agent-docs/plugins.md +29 -7
- package/templates/agent-docs/reference.md +39 -2
- package/templates/agent-docs/routing.md +341 -47
- package/templates/agent-docs/schema-driven-ui.md +78 -2
- package/templates/agent-docs/security.md +125 -8
- package/templates/agent-docs/templates/apibackends.md +14 -14
- package/templates/agent-docs/templates/overview.md +1 -1
- package/templates/agent-docs/whats-new.md +76 -53
- package/templates/apps/api-ai/package.json +6 -7
- package/templates/apps/api-ai/tests/summarize.test.ts +1 -1
- 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 -10
- package/templates/apps/api-collab/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/{api-versioning → api-row-history}/README.md +3 -3
- package/templates/apps/{api-versioning → api-row-history}/actions/documents.asOf.action.server.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/actions/documents.history.action.server.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/app.config.ts +3 -3
- package/templates/apps/{api-versioning → api-row-history}/database/schema.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/mutations/documents.create.mutation.server.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/mutations/documents.create.mutation.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/mutations/documents.update.mutation.ts +1 -1
- package/templates/apps/{api-versioning → api-row-history}/package.json +8 -8
- package/templates/apps/api-row-history/template.json +6 -0
- package/templates/apps/{api-versioning → api-row-history}/tests/documents.create.test.ts +1 -1
- package/templates/apps/api-saas/app.config.ts +1 -0
- package/templates/apps/api-saas/package.json +10 -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 +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +9 -9
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +10 -10
- package/templates/apps/frontend-collab/src/pages/page.test.tsx +10 -9
- package/templates/apps/frontend-collab/src/pages/page.tsx +42 -65
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +6 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +6 -7
- package/templates/apps/frontend-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/agentsMd-Bu_XQgVf.js +0 -2
- package/dist/apiBuild-GDKuGOMV.js +0 -2
- package/dist/build-DETLZAFt.js +0 -752
- package/dist/checkCommand-CWcnDArJ.js +0 -2
- package/dist/codegen-DiMn2KkZ.js +0 -2
- package/dist/dbCommand-C27HIsGE.js +0 -2
- package/dist/dev-CK522MV5.js +0 -3
- package/dist/doctorCommand-BK4l18eG.js +0 -2
- package/dist/fileConventions-Cof68_BL.js +0 -33
- package/dist/frameworkTableAssembly-CVDB2hCq.js +0 -2
- package/dist/inspectMetrics-CfdKLh6t.js +0 -72
- package/dist/serveCommand-BRnPCxVd.js +0 -2
- package/dist/start-BLNmWkLa.js +0 -1154
- package/dist/start-Dzicuyw8.js +0 -3
- package/dist/updateCommand-eXB35SEv.js +0 -2
- package/dist/webDev-DposiF3j.js +0 -2
- package/templates/apps/api-versioning/template.json +0 -6
- /package/templates/apps/{api-versioning → api-row-history}/actions/documents.asOf.action.ts +0 -0
- /package/templates/apps/{api-versioning → api-row-history}/actions/documents.history.action.ts +0 -0
- /package/templates/apps/{api-versioning → api-row-history}/mutations/documents.update.mutation.server.ts +0 -0
- /package/templates/apps/{api-versioning → api-row-history}/tsconfig.json +0 -0
|
@@ -2,39 +2,40 @@ import { t as e } from "./nodeEnvironment-cGFAj1J8.js";
|
|
|
2
2
|
import { n as t } from "./loadEnv-D9nEOClM.js";
|
|
3
3
|
import { t as n } from "./bootRefusal-pgvDxlrU.js";
|
|
4
4
|
import { r } from "./appPort-B_HpJ_ck.js";
|
|
5
|
-
import { A as i, _ as a, g as o, h as s, m as c, o as l } from "./fileConventions-
|
|
5
|
+
import { A as i, _ as a, g as o, h as s, m as c, o as l } from "./fileConventions-DOqD3lPS.js";
|
|
6
6
|
import { A as u, D as d, a as f, h as p, j as m, k as h } from "./inspect-CtL_xTbu.js";
|
|
7
|
-
import { n as g } from "./agentsMd-
|
|
8
|
-
import { c as _, p as v, t as y } from "./renderModeScan-
|
|
9
|
-
import { t as b } from "./pageConvention-
|
|
7
|
+
import { n as g } from "./agentsMd-0l980yhL.js";
|
|
8
|
+
import { c as _, p as v, t as y } from "./renderModeScan-CcH2X1_D.js";
|
|
9
|
+
import { t as b } from "./pageConvention-CzUiSbtU.js";
|
|
10
10
|
import { i as x, n as S, r as C, t as w } from "./runtimeRegistry-DMeKfTHP.js";
|
|
11
11
|
import { n as T } from "./logFileSink-B4uP8pvf.js";
|
|
12
|
-
import { basename as E, dirname as D, join as O, relative as k, resolve as A } from "node:path";
|
|
13
|
-
import { existsSync as
|
|
14
|
-
import { fileURLToPath as
|
|
15
|
-
import { addSink as
|
|
16
|
-
import { createRequire as
|
|
17
|
-
import { currentTraceContext as V, resolveSecret as
|
|
12
|
+
import { basename as E, dirname as D, join as O, relative as k, resolve as A, sep as j } from "node:path";
|
|
13
|
+
import { existsSync as M, promises as N, readFileSync as P, readdirSync as F, statSync as ee, unwatchFile as te, watchFile as ne } from "node:fs";
|
|
14
|
+
import { fileURLToPath as re, pathToFileURL as I } from "node:url";
|
|
15
|
+
import { addSink as L, createLogger as R, printReadyBlock as z } from "@voltro/logger";
|
|
16
|
+
import { createRequire as ie } from "node:module";
|
|
17
|
+
import { classifyRequestOrigin as B, currentTraceContext as V, resolveOriginGuardConfig as ae, resolveSecret as oe } from "@voltro/runtime";
|
|
18
18
|
import { homedir as H } from "node:os";
|
|
19
|
-
import { FRAMEWORK_ENV_CATALOG as
|
|
20
|
-
import { __installPublicEnv as
|
|
21
|
-
import { mkdir as
|
|
22
|
-
import { createHash as
|
|
23
|
-
import { spawn as
|
|
19
|
+
import { FRAMEWORK_ENV_CATALOG as se, appEnvEntries as U, checkEnvNaming as ce, formatEnvErrors as le, installEnvSnapshot as W, isEnvContract as ue, pluginEnvEntries as de, renderDotEnvExample as fe, resolveEnv as pe } from "@voltro/env";
|
|
20
|
+
import { __installPublicEnv as me } from "@voltro/env/public";
|
|
21
|
+
import { mkdir as G, writeFile as he } from "node:fs/promises";
|
|
22
|
+
import { createHash as ge } from "node:crypto";
|
|
23
|
+
import { spawn as _e } from "node:child_process";
|
|
24
24
|
import { createConnection as K } from "node:net";
|
|
25
|
-
import {
|
|
25
|
+
import { FORM_FLASH_SCRIPT_ID as ve, FORM_KEY_FIELD as ye, FORM_PATH_PREFIX as be, FORM_PATH_PREFIX as xe, FORM_REDIRECT_FIELD as Se, formDataToInput as Ce, validateFields as we } from "@voltro/client/form";
|
|
26
|
+
import { PassThrough as Te } from "node:stream";
|
|
26
27
|
//#region src/buildToolImport.ts
|
|
27
|
-
var
|
|
28
|
+
var Ee = (e) => {
|
|
28
29
|
let t = e;
|
|
29
30
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
30
|
-
},
|
|
31
|
+
}, De = async (e, t) => {
|
|
31
32
|
try {
|
|
32
33
|
return await t();
|
|
33
34
|
} catch (t) {
|
|
34
|
-
throw
|
|
35
|
+
throw Ee(t) ? Error(`voltro: the build tool '${e}' is not installed.\n\nIt's an OPTIONAL dependency of @voltro/cli — needed by 'voltro dev' and 'voltro build', but excluded from a serve-only production install (that's how prod images stay lean). If you are building, reinstall WITHOUT '--no-optional' (e.g. 'pnpm install'). A production SERVE container does not need '${e}' — it boots from the precompiled bundle.`) : t;
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
-
let n =
|
|
37
|
+
}, Oe = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", ke = (e, t) => t ? `${e} | undefined` : e, Ae = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${ke(t.tsType, t.optional)}`).join("\n"), je = async (e, t) => {
|
|
38
|
+
let n = Ae(t, () => !0), r = `${Oe}
|
|
38
39
|
import '@voltro/env/server'
|
|
39
40
|
|
|
40
41
|
declare module '@voltro/env/server' {
|
|
@@ -43,9 +44,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
`;
|
|
46
|
-
await
|
|
47
|
-
},
|
|
48
|
-
let n =
|
|
47
|
+
await he(O(e, "env.generated.d.ts"), r, "utf8");
|
|
48
|
+
}, Me = async (e, t) => {
|
|
49
|
+
let n = Ae(t, (e) => e === "public"), r = `${Oe}
|
|
49
50
|
import '@voltro/env/public'
|
|
50
51
|
|
|
51
52
|
declare module '@voltro/env/public' {
|
|
@@ -54,9 +55,9 @@ ${n.length > 0 ? n : " // (no public variables declared)"}
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
`, i = O(e, "src");
|
|
57
|
-
await
|
|
58
|
-
},
|
|
59
|
-
let n = `${
|
|
58
|
+
await G(i, { recursive: !0 }), await he(O(i, "voltro-env.d.ts"), r, "utf8");
|
|
59
|
+
}, Ne = async (e, t) => {
|
|
60
|
+
let n = `${Oe}
|
|
60
61
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
61
62
|
|
|
62
63
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -64,14 +65,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
64
65
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
65
66
|
__installPublicEnv(publicEnvValues)
|
|
66
67
|
`;
|
|
67
|
-
await
|
|
68
|
-
},
|
|
69
|
-
let t =
|
|
68
|
+
await G(e, { recursive: !0 }), await he(O(e, "env.public.ts"), n, "utf8");
|
|
69
|
+
}, Pe = async (e) => {
|
|
70
|
+
let t = ue(e.rawEnv) ? e.rawEnv : void 0, n = await pe({
|
|
70
71
|
contract: t,
|
|
71
|
-
resolveSecret:
|
|
72
|
-
}), r = [...n.errors, ...
|
|
73
|
-
if (r.length > 0) throw Error(
|
|
74
|
-
W(n.values), e.appType === "web" &&
|
|
72
|
+
resolveSecret: oe
|
|
73
|
+
}), r = [...n.errors, ...ce(t, e.appType)];
|
|
74
|
+
if (r.length > 0) throw Error(le(r));
|
|
75
|
+
W(n.values), e.appType === "web" && me(n.publicValues);
|
|
75
76
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
76
77
|
if (i > 0) {
|
|
77
78
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -83,20 +84,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
83
84
|
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 });
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
87
|
+
return e.generateTypes && t && (e.appType === "api" ? await je(e.root, t) : await Me(e.root, t)), {
|
|
87
88
|
resolved: n,
|
|
88
89
|
contract: t
|
|
89
90
|
};
|
|
90
|
-
},
|
|
91
|
-
let t =
|
|
91
|
+
}, q = (e) => {
|
|
92
|
+
let t = U(e.contract), n = (e.plugins ?? []).flatMap((e) => de(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : se, i = /* @__PURE__ */ new Set(), a = [];
|
|
92
93
|
for (let e of [
|
|
93
94
|
...t,
|
|
94
95
|
...n,
|
|
95
96
|
...r
|
|
96
97
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
97
98
|
return a;
|
|
98
|
-
},
|
|
99
|
-
let r =
|
|
99
|
+
}, Fe = (e, t, n = (e) => process.env[e]) => {
|
|
100
|
+
let r = q(t).map((e) => {
|
|
100
101
|
let t = n(e.key) !== void 0;
|
|
101
102
|
return {
|
|
102
103
|
...e,
|
|
@@ -113,22 +114,22 @@ __installPublicEnv(publicEnvValues)
|
|
|
113
114
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
114
115
|
}
|
|
115
116
|
};
|
|
116
|
-
},
|
|
117
|
-
let n =
|
|
117
|
+
}, Ie = (e, t) => {
|
|
118
|
+
let n = q({
|
|
118
119
|
...e,
|
|
119
120
|
includeFramework: !1
|
|
120
121
|
});
|
|
121
|
-
return
|
|
122
|
+
return fe(n, {
|
|
122
123
|
includeFramework: e.includeFramework !== !1,
|
|
123
124
|
...t ? { header: t } : {}
|
|
124
125
|
});
|
|
125
|
-
},
|
|
126
|
+
}, Le = async (e, t) => {
|
|
126
127
|
let n = e;
|
|
127
128
|
for (;;) {
|
|
128
129
|
let e = O(n, "node_modules", t);
|
|
129
130
|
try {
|
|
130
|
-
if ((await
|
|
131
|
-
let t = await
|
|
131
|
+
if ((await N.stat(e)).isDirectory()) {
|
|
132
|
+
let t = await N.realpath(e);
|
|
132
133
|
return t.includes("/node_modules/") ? null : t;
|
|
133
134
|
}
|
|
134
135
|
} catch {}
|
|
@@ -136,10 +137,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
136
137
|
if (r === n) return null;
|
|
137
138
|
n = r;
|
|
138
139
|
}
|
|
139
|
-
},
|
|
140
|
+
}, Re = async (e) => {
|
|
140
141
|
let t;
|
|
141
142
|
try {
|
|
142
|
-
let n = await
|
|
143
|
+
let n = await N.readFile(O(e, "package.json"), "utf8"), r = JSON.parse(n);
|
|
143
144
|
t = Object.keys({
|
|
144
145
|
...r.dependencies,
|
|
145
146
|
...r.devDependencies
|
|
@@ -148,11 +149,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
148
149
|
return [];
|
|
149
150
|
}
|
|
150
151
|
return (await Promise.all(t.map(async (t) => {
|
|
151
|
-
let n = await
|
|
152
|
+
let n = await Le(e, t);
|
|
152
153
|
if (n === null) return null;
|
|
153
154
|
let r = O(n, "src");
|
|
154
155
|
try {
|
|
155
|
-
if (!(await
|
|
156
|
+
if (!(await N.stat(r)).isDirectory()) return null;
|
|
156
157
|
} catch {
|
|
157
158
|
return null;
|
|
158
159
|
}
|
|
@@ -161,11 +162,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
161
162
|
dir: r
|
|
162
163
|
};
|
|
163
164
|
}))).filter((e) => e !== null);
|
|
164
|
-
},
|
|
165
|
+
}, ze = 500, Be = (e, t, n = {}) => {
|
|
165
166
|
if (e.length === 0) return () => {};
|
|
166
167
|
let r = (e) => n.root ? k(n.root, e) : e, i = !1, a = (e) => {
|
|
167
168
|
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(() => {
|
|
168
|
-
let e =
|
|
169
|
+
let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
169
170
|
stdio: "inherit",
|
|
170
171
|
env: process.env,
|
|
171
172
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -179,22 +180,22 @@ __installPublicEnv(publicEnvValues)
|
|
|
179
180
|
});
|
|
180
181
|
}));
|
|
181
182
|
};
|
|
182
|
-
for (let t of e)
|
|
183
|
+
for (let t of e) ne(t, { interval: ze }, (e, n) => {
|
|
183
184
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
184
185
|
});
|
|
185
186
|
return t.info("watching .env files for changes", {
|
|
186
187
|
files: e.map(r),
|
|
187
|
-
intervalMs:
|
|
188
|
+
intervalMs: ze
|
|
188
189
|
}), () => {
|
|
189
|
-
for (let t of e)
|
|
190
|
+
for (let t of e) te(t);
|
|
190
191
|
};
|
|
191
|
-
},
|
|
192
|
+
}, Ve = [{
|
|
192
193
|
host: "127.0.0.1",
|
|
193
194
|
family: "IPv4"
|
|
194
195
|
}, {
|
|
195
196
|
host: "::1",
|
|
196
197
|
family: "IPv6"
|
|
197
|
-
}],
|
|
198
|
+
}], J = (e, t, n) => new Promise((r) => {
|
|
198
199
|
let i = !1, a = (e) => {
|
|
199
200
|
if (!i) {
|
|
200
201
|
i = !0;
|
|
@@ -208,10 +209,10 @@ __installPublicEnv(publicEnvValues)
|
|
|
208
209
|
port: t
|
|
209
210
|
});
|
|
210
211
|
o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
|
|
211
|
-
}),
|
|
212
|
+
}), He = async (e, t = 400) => ({ families: (await Promise.all(Ve.map(async (n) => ({
|
|
212
213
|
family: n.family,
|
|
213
|
-
taken: await
|
|
214
|
-
})))).filter((e) => e.taken).map((e) => e.family) }),
|
|
214
|
+
taken: await J(n.host, e, t)
|
|
215
|
+
})))).filter((e) => e.taken).map((e) => e.family) }), Ue = (e, t, n) => [
|
|
215
216
|
`${t}: port ${e} is already being served (${n.join(" + ")}).`,
|
|
216
217
|
"",
|
|
217
218
|
" Refusing to start. This is NOT a spurious check — a second listener can",
|
|
@@ -226,26 +227,26 @@ __installPublicEnv(publicEnvValues)
|
|
|
226
227
|
"",
|
|
227
228
|
" Then re-run. To use a different port instead, change `port` in",
|
|
228
229
|
" app.config.ts."
|
|
229
|
-
].join("\n"),
|
|
230
|
-
let { families: r } = await
|
|
231
|
-
if (r.length !== 0) throw n(
|
|
232
|
-
},
|
|
230
|
+
].join("\n"), We = async (e, t) => {
|
|
231
|
+
let { families: r } = await He(e);
|
|
232
|
+
if (r.length !== 0) throw n(Ue(e, t, r));
|
|
233
|
+
}, Ge = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Ke = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, qe = (e) => {
|
|
233
234
|
let t = [], n = e;
|
|
234
235
|
for (let e = 0; e < 12; e++) {
|
|
235
236
|
let e = O(n, "node_modules");
|
|
236
|
-
|
|
237
|
+
M(e) && t.push(e);
|
|
237
238
|
let r = D(n);
|
|
238
239
|
if (r === n) break;
|
|
239
240
|
n = r;
|
|
240
241
|
}
|
|
241
242
|
return t;
|
|
242
|
-
},
|
|
243
|
+
}, Je = (e) => {
|
|
243
244
|
let t = /* @__PURE__ */ new Set([e]), n = e;
|
|
244
245
|
for (let e = 0; e < 12; e++) {
|
|
245
246
|
for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
|
|
246
247
|
let r;
|
|
247
248
|
try {
|
|
248
|
-
r =
|
|
249
|
+
r = P(O(n, e), "utf8");
|
|
249
250
|
} catch {
|
|
250
251
|
continue;
|
|
251
252
|
}
|
|
@@ -256,7 +257,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
256
257
|
if (i === "" || i.includes("*")) continue;
|
|
257
258
|
let a;
|
|
258
259
|
try {
|
|
259
|
-
a =
|
|
260
|
+
a = F(O(n, i), { withFileTypes: !0 });
|
|
260
261
|
} catch {
|
|
261
262
|
continue;
|
|
262
263
|
}
|
|
@@ -266,7 +267,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
266
267
|
for (let e of ["packages", "apps"]) {
|
|
267
268
|
let r;
|
|
268
269
|
try {
|
|
269
|
-
r =
|
|
270
|
+
r = F(O(n, e), { withFileTypes: !0 });
|
|
270
271
|
} catch {
|
|
271
272
|
continue;
|
|
272
273
|
}
|
|
@@ -277,17 +278,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
277
278
|
n = e;
|
|
278
279
|
}
|
|
279
280
|
return [...t];
|
|
280
|
-
},
|
|
281
|
+
}, Ye = (e) => {
|
|
281
282
|
let t = [];
|
|
282
|
-
for (let n of
|
|
283
|
+
for (let n of Je(e)) {
|
|
283
284
|
let e = O(n, "node_modules", "@voltro"), r;
|
|
284
285
|
try {
|
|
285
|
-
r =
|
|
286
|
+
r = F(e);
|
|
286
287
|
} catch {
|
|
287
288
|
continue;
|
|
288
289
|
}
|
|
289
290
|
for (let n of r) {
|
|
290
|
-
let r = O(e, n), i =
|
|
291
|
+
let r = O(e, n), i = Xe(r);
|
|
291
292
|
i !== void 0 && t.push({
|
|
292
293
|
pkg: `@voltro/${n}`,
|
|
293
294
|
version: i,
|
|
@@ -296,27 +297,27 @@ __installPublicEnv(publicEnvValues)
|
|
|
296
297
|
}
|
|
297
298
|
}
|
|
298
299
|
return t;
|
|
299
|
-
},
|
|
300
|
+
}, Xe = (e) => {
|
|
300
301
|
try {
|
|
301
|
-
let t = JSON.parse(
|
|
302
|
+
let t = JSON.parse(P(O(e, "package.json"), "utf8"));
|
|
302
303
|
return typeof t.version == "string" ? t.version : void 0;
|
|
303
304
|
} catch {
|
|
304
305
|
return;
|
|
305
306
|
}
|
|
306
|
-
},
|
|
307
|
+
}, Ze = (e) => {
|
|
307
308
|
let t = [], n;
|
|
308
309
|
try {
|
|
309
|
-
n =
|
|
310
|
+
n = F(e);
|
|
310
311
|
} catch {
|
|
311
312
|
return t;
|
|
312
313
|
}
|
|
313
314
|
for (let r of n) {
|
|
314
|
-
if (r.startsWith(".") ||
|
|
315
|
+
if (r.startsWith(".") || Ke.test(r)) continue;
|
|
315
316
|
let n = O(e, r);
|
|
316
317
|
if (r.startsWith("@")) {
|
|
317
318
|
let e;
|
|
318
319
|
try {
|
|
319
|
-
e =
|
|
320
|
+
e = F(n);
|
|
320
321
|
} catch {
|
|
321
322
|
continue;
|
|
322
323
|
}
|
|
@@ -327,7 +328,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
327
328
|
continue;
|
|
328
329
|
}
|
|
329
330
|
try {
|
|
330
|
-
if (!
|
|
331
|
+
if (!ee(n).isDirectory()) continue;
|
|
331
332
|
} catch {
|
|
332
333
|
continue;
|
|
333
334
|
}
|
|
@@ -337,17 +338,17 @@ __installPublicEnv(publicEnvValues)
|
|
|
337
338
|
});
|
|
338
339
|
}
|
|
339
340
|
return t;
|
|
340
|
-
},
|
|
341
|
+
}, Qe = (e) => {
|
|
341
342
|
let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
|
|
342
|
-
if (!
|
|
343
|
+
if (!Ge(e)) return;
|
|
343
344
|
let i = t.get(e) ?? /* @__PURE__ */ new Map();
|
|
344
345
|
i.has(n) || i.set(n, r), t.set(e, i);
|
|
345
346
|
};
|
|
346
|
-
for (let t of
|
|
347
|
-
let t =
|
|
347
|
+
for (let t of qe(e)) for (let { pkg: e, dir: r } of Ze(t)) {
|
|
348
|
+
let t = Xe(r);
|
|
348
349
|
t !== void 0 && n(e, t, r);
|
|
349
350
|
}
|
|
350
|
-
for (let { pkg: t, version: r, dir: i } of
|
|
351
|
+
for (let { pkg: t, version: r, dir: i } of Ye(e)) n(t, r, i);
|
|
351
352
|
let r = [];
|
|
352
353
|
for (let [n, i] of t) i.size < 2 || r.push({
|
|
353
354
|
pkg: n,
|
|
@@ -355,7 +356,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
355
356
|
paths: [...i.values()].map((t) => k(e, t)).sort()
|
|
356
357
|
});
|
|
357
358
|
return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
|
|
358
|
-
},
|
|
359
|
+
}, $e = (e) => {
|
|
359
360
|
if (e.length !== 0) return [
|
|
360
361
|
`• ${e.length} package(s) resolved at more than one version:`,
|
|
361
362
|
...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
|
|
@@ -373,11 +374,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
373
374
|
" instrument), then reinstall. Do not silence the generated file — it is where",
|
|
374
375
|
" a genuine mistake in your own descriptors surfaces."
|
|
375
376
|
].join("\n");
|
|
376
|
-
},
|
|
377
|
+
}, et = (e) => {
|
|
377
378
|
let t = /* @__PURE__ */ new Map();
|
|
378
|
-
for (let n of
|
|
379
|
+
for (let n of qe(e)) for (let { pkg: e, dir: r } of Ze(n)) {
|
|
379
380
|
if (!e.startsWith("@voltro/")) continue;
|
|
380
|
-
let n =
|
|
381
|
+
let n = Xe(r);
|
|
381
382
|
n !== void 0 && !t.has(e) && t.set(e, n);
|
|
382
383
|
}
|
|
383
384
|
if (t.size < 2) return;
|
|
@@ -392,7 +393,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
392
393
|
version: t
|
|
393
394
|
})).sort((e, t) => e.pkg.localeCompare(t.pkg))
|
|
394
395
|
};
|
|
395
|
-
},
|
|
396
|
+
}, tt = (e) => {
|
|
396
397
|
if (e !== void 0) return [
|
|
397
398
|
`• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
|
|
398
399
|
...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
|
|
@@ -410,59 +411,59 @@ __installPublicEnv(publicEnvValues)
|
|
|
410
411
|
" its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
|
|
411
412
|
" which silently skips `@voltro/i18n` because the name contains digits."
|
|
412
413
|
].join("\n");
|
|
413
|
-
},
|
|
414
|
-
let n =
|
|
414
|
+
}, nt = (e, t) => {
|
|
415
|
+
let n = et(e);
|
|
415
416
|
n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
|
|
416
417
|
majority: n.majority,
|
|
417
418
|
behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
|
|
418
419
|
fix: "the framework ships in lockstep; bump the listed packages and reinstall"
|
|
419
420
|
});
|
|
420
|
-
},
|
|
421
|
+
}, rt = R({ scope: "vite" }), it = /\x1b\[[0-9;]*m/g, at = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, ot = (e) => e.replace(it, "").replace(at, "").trim(), st = /proxy error/i, ct = [
|
|
421
422
|
"ECONNREFUSED",
|
|
422
423
|
"ECONNRESET",
|
|
423
424
|
"ECONNABORTED",
|
|
424
425
|
"EPIPE",
|
|
425
426
|
"ETIMEDOUT"
|
|
426
|
-
],
|
|
427
|
+
], lt = (e, t = 0) => {
|
|
427
428
|
if (e == null || t > 5) return !1;
|
|
428
429
|
let n = e;
|
|
429
|
-
return typeof n.code == "string" &&
|
|
430
|
-
},
|
|
430
|
+
return typeof n.code == "string" && ct.includes(n.code) || typeof n.message == "string" && ct.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => lt(e, t + 1)) ? !0 : lt(n.cause, t + 1);
|
|
431
|
+
}, ut = 4e3, dt = () => {
|
|
431
432
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
432
433
|
hasWarned: !1,
|
|
433
434
|
info: (e) => {
|
|
434
|
-
let t =
|
|
435
|
-
t.length !== 0 &&
|
|
435
|
+
let t = ot(e);
|
|
436
|
+
t.length !== 0 && rt.info(t);
|
|
436
437
|
},
|
|
437
438
|
warn: (e) => {
|
|
438
439
|
n.hasWarned = !0;
|
|
439
|
-
let t =
|
|
440
|
-
t.length !== 0 &&
|
|
440
|
+
let t = ot(e);
|
|
441
|
+
t.length !== 0 && rt.warn(t);
|
|
441
442
|
},
|
|
442
443
|
warnOnce: (t) => {
|
|
443
|
-
let r =
|
|
444
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
444
|
+
let r = ot(t);
|
|
445
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && rt.warn(r));
|
|
445
446
|
},
|
|
446
447
|
error: (e, n) => {
|
|
447
|
-
let r =
|
|
448
|
+
let r = ot(e), i = n?.error;
|
|
448
449
|
if (r.length !== 0) {
|
|
449
|
-
if (
|
|
450
|
+
if (st.test(r) && lt(i)) {
|
|
450
451
|
let e = Date.now();
|
|
451
|
-
e - t >
|
|
452
|
+
e - t > ut && (t = e, rt.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
452
453
|
return;
|
|
453
454
|
}
|
|
454
|
-
|
|
455
|
+
rt.error(r, {}, i);
|
|
455
456
|
}
|
|
456
457
|
},
|
|
457
458
|
clearScreen: () => {},
|
|
458
459
|
hasErrorLogged: (e) => !1
|
|
459
460
|
};
|
|
460
461
|
return n;
|
|
461
|
-
},
|
|
462
|
+
}, ft = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), pt = (e) => {
|
|
462
463
|
try {
|
|
463
464
|
let t = O(e, "tsconfig.json");
|
|
464
|
-
if (!
|
|
465
|
-
let n = JSON.parse(
|
|
465
|
+
if (!M(t)) return [];
|
|
466
|
+
let n = JSON.parse(ft(P(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = A(e, i), o = [];
|
|
466
467
|
for (let [e, t] of Object.entries(r)) {
|
|
467
468
|
let n = t[0];
|
|
468
469
|
if (!n) continue;
|
|
@@ -484,12 +485,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
484
485
|
} catch {
|
|
485
486
|
return [];
|
|
486
487
|
}
|
|
487
|
-
},
|
|
488
|
+
}, mt = (e = process.env) => {
|
|
488
489
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
489
490
|
if (t === void 0 || t.trim() === "") return 4;
|
|
490
491
|
let n = Number(t);
|
|
491
492
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
492
|
-
},
|
|
493
|
+
}, ht = (e) => {
|
|
493
494
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
494
495
|
let e = r.shift();
|
|
495
496
|
e ? e() : n--;
|
|
@@ -507,8 +508,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
507
508
|
return n;
|
|
508
509
|
}
|
|
509
510
|
};
|
|
510
|
-
},
|
|
511
|
-
let t =
|
|
511
|
+
}, gt = (e) => {
|
|
512
|
+
let t = ht(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
512
513
|
return {
|
|
513
514
|
load: (i, a) => {
|
|
514
515
|
if (r.has(i)) return a();
|
|
@@ -538,7 +539,340 @@ __installPublicEnv(publicEnvValues)
|
|
|
538
539
|
return r.size;
|
|
539
540
|
}
|
|
540
541
|
};
|
|
541
|
-
},
|
|
542
|
+
}, _t = 1048576, vt = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), yt = (e) => JSON.stringify(e).replace(/</g, "\\u003c"), bt = (e, t) => {
|
|
543
|
+
let n = `<script type="application/json" id="${ve}">${yt(t)}<\/script>`;
|
|
544
|
+
return e.includes("</body>") ? e.replace("</body>", `${n}</body>`) : e + n;
|
|
545
|
+
}, xt = (e) => {
|
|
546
|
+
let t = Object.entries(e.errors).map(([e, t]) => `<li><strong>${vt(e)}</strong>: ${vt(t)}</li>`).join("");
|
|
547
|
+
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>${vt(e.formError)}</p>`}<ul>${t}</ul><p><a href="javascript:history.back()">Go back</a> to correct the form.</p></body></html>`;
|
|
548
|
+
}, Y = (e, t, n, r = "text/plain; charset=utf-8") => {
|
|
549
|
+
e.statusCode = t, e.setHeader("content-type", r), e.end(n);
|
|
550
|
+
}, St = (e, t, n) => {
|
|
551
|
+
e.setHeader("cache-control", "no-store"), Y(e, t, n, "text/html; charset=utf-8");
|
|
552
|
+
}, Ct = (e) => {
|
|
553
|
+
if (e !== void 0 && e !== "" && !(!e.startsWith("/") || e.startsWith("//") || e.includes("\\"))) return e;
|
|
554
|
+
}, wt = (e) => {
|
|
555
|
+
let t = e.referer;
|
|
556
|
+
if (t !== void 0) try {
|
|
557
|
+
let e = new URL(t);
|
|
558
|
+
return e.pathname + e.search;
|
|
559
|
+
} catch {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
}, Tt = (e) => new Promise((t) => {
|
|
563
|
+
let n = [], r = 0;
|
|
564
|
+
e.on("data", (i) => {
|
|
565
|
+
if (r += i.length, r > _t) {
|
|
566
|
+
e.removeAllListeners("data"), e.removeAllListeners("end"), t({ ok: !1 });
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
n.push(i);
|
|
570
|
+
}), e.on("end", () => t({
|
|
571
|
+
ok: !0,
|
|
572
|
+
body: Buffer.concat(n).toString("utf8")
|
|
573
|
+
})), e.on("error", () => t({ ok: !1 }));
|
|
574
|
+
}), Et = (e) => {
|
|
575
|
+
let t = {};
|
|
576
|
+
for (let [n, r] of Object.entries(e.headers)) typeof r == "string" ? t[n.toLowerCase()] = r : Array.isArray(r) && (t[n.toLowerCase()] = r.join(", "));
|
|
577
|
+
return t;
|
|
578
|
+
}, Dt = (e) => {
|
|
579
|
+
let t = e.originGuard ?? ae(void 0, process.env);
|
|
580
|
+
return async (n, r, i) => {
|
|
581
|
+
let a = (n.url ?? "/").split("?")[0];
|
|
582
|
+
if (!a.startsWith(be)) return !1;
|
|
583
|
+
if (n.method !== "POST") return r.setHeader("allow", "POST"), Y(r, 405, "method not allowed — a /form/* endpoint accepts native form POSTs only"), !0;
|
|
584
|
+
let o = Et(n);
|
|
585
|
+
if (!B({
|
|
586
|
+
headers: o,
|
|
587
|
+
config: t
|
|
588
|
+
}).allowed) return Y(r, 403, "origin not allowed"), !0;
|
|
589
|
+
if ((o["content-type"] ?? "").includes("multipart/form-data")) return Y(r, 415, "file uploads need JavaScript — the no-JS form path accepts application/x-www-form-urlencoded only"), !0;
|
|
590
|
+
let s = await Tt(n);
|
|
591
|
+
if (!s.ok) return Y(r, 413, `form body exceeds ${_t} bytes`), !0;
|
|
592
|
+
let c = new URLSearchParams(s.body), l = decodeURIComponent(a.slice(be.length)), u = (await e.loadDescriptors())?.[l];
|
|
593
|
+
if (u === void 0 || u.kind !== "mutation") return Y(r, 404, `no mutation '${l}' — /form/* serves declared mutations only`), !0;
|
|
594
|
+
let d = c.get(ye) ?? l, f = Ct(c.get(Se) ?? void 0), p = [];
|
|
595
|
+
for (let [e, t] of c) e !== ye && e !== Se && p.push([e, t]);
|
|
596
|
+
let m = u.input;
|
|
597
|
+
if (m === void 0) return Y(r, 404, `mutation '${l}' carries no input schema — the no-JS path cannot map its POST`), !0;
|
|
598
|
+
let h = Ce(m, p), g = we(m, h), _ = async (t) => {
|
|
599
|
+
let n = wt(o);
|
|
600
|
+
if (n !== void 0) {
|
|
601
|
+
if (i !== void 0) {
|
|
602
|
+
i(n, t);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
let a = await e.renderErrorPage({
|
|
606
|
+
path: n,
|
|
607
|
+
headers: o,
|
|
608
|
+
flash: t
|
|
609
|
+
});
|
|
610
|
+
if (a !== void 0) {
|
|
611
|
+
St(r, 422, bt(a, t));
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
St(r, 422, xt(t));
|
|
616
|
+
};
|
|
617
|
+
if (!g.valid) return await _({
|
|
618
|
+
formKey: d,
|
|
619
|
+
values: h,
|
|
620
|
+
errors: g.errors
|
|
621
|
+
}), !0;
|
|
622
|
+
let v = e.rpcQuery(o.cookie, o);
|
|
623
|
+
if (v === void 0) return Y(r, 503, `api '${e.apiName ?? "?"}' has no server-side origin — the no-JS form path forwards over POST /rpc; set VOLTRO_API_ORIGIN (or apis.<name>.serverUrl) as for SSR loaders`), !0;
|
|
624
|
+
try {
|
|
625
|
+
await v(l, h);
|
|
626
|
+
} catch (e) {
|
|
627
|
+
let t = e.voltroError;
|
|
628
|
+
return await _({
|
|
629
|
+
formKey: d,
|
|
630
|
+
values: h,
|
|
631
|
+
errors: {},
|
|
632
|
+
formError: t?.message ?? t?._tag ?? "The server rejected this submission. Please try again."
|
|
633
|
+
}), !0;
|
|
634
|
+
}
|
|
635
|
+
let y = f ?? wt(o) ?? "/";
|
|
636
|
+
return r.statusCode = 303, r.setHeader("location", y), r.end(), !0;
|
|
637
|
+
};
|
|
638
|
+
}, Ot = /^\s*(?:import|export)\s[^;'"]*?['"]([^'"]+)['"]/gm, kt = [
|
|
639
|
+
"",
|
|
640
|
+
".tsx",
|
|
641
|
+
".ts",
|
|
642
|
+
".jsx",
|
|
643
|
+
".js",
|
|
644
|
+
"/index.tsx",
|
|
645
|
+
"/index.ts"
|
|
646
|
+
], At = (e) => /\.island\.(tsx|ts|jsx|js)$/.test(e), jt = ["@voltro/web", "@voltro/i18n"], Mt = ["@voltro/client", "@voltro/ui"], Nt = (e, t) => e === t || e.startsWith(`${t}/`), Pt = (e) => e !== "@voltro/web/islands" && jt.some((t) => Nt(e, t)), Ft = (e) => {
|
|
647
|
+
let t = [];
|
|
648
|
+
for (let n of e.matchAll(Ot)) t.push(n[1]);
|
|
649
|
+
return t;
|
|
650
|
+
}, It = async (e, t) => {
|
|
651
|
+
let n = A(D(e), t);
|
|
652
|
+
for (let e of kt) {
|
|
653
|
+
let t = n + e;
|
|
654
|
+
try {
|
|
655
|
+
if ((await N.stat(t)).isFile()) return t;
|
|
656
|
+
} catch {}
|
|
657
|
+
}
|
|
658
|
+
}, Lt = async (e, t) => {
|
|
659
|
+
let n = O(e, "src", "pages", t), r = /* @__PURE__ */ new Set(), i = [], a = !1, o = [], s = async (t, n) => {
|
|
660
|
+
let c = `${t}\u0000${n ? "i" : "p"}`;
|
|
661
|
+
if (r.has(c)) return;
|
|
662
|
+
r.add(c);
|
|
663
|
+
let l;
|
|
664
|
+
try {
|
|
665
|
+
l = await N.readFile(t, "utf8");
|
|
666
|
+
} catch {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
for (let r of Ft(l)) {
|
|
670
|
+
if (n) {
|
|
671
|
+
if (Pt(r)) {
|
|
672
|
+
o.push([k(e, t).split(j).join("/"), r]);
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
if (Mt.some((e) => Nt(r, e))) {
|
|
676
|
+
a = !0;
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (!r.startsWith(".")) continue;
|
|
681
|
+
let c = await It(t, r);
|
|
682
|
+
if (c === void 0) continue;
|
|
683
|
+
let l = n || At(c);
|
|
684
|
+
if (!n && At(c)) {
|
|
685
|
+
let t = k(e, c).split(j).join("/");
|
|
686
|
+
i.includes(t) || i.push(t);
|
|
687
|
+
}
|
|
688
|
+
await s(c, l);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
return await s(n, At(n)), At(n) && i.unshift(k(e, n).split(j).join("/")), {
|
|
692
|
+
islandFiles: i,
|
|
693
|
+
usesClient: a,
|
|
694
|
+
violations: o
|
|
695
|
+
};
|
|
696
|
+
}, Rt = (e) => {
|
|
697
|
+
let t = /^export const interactive\s*=\s*['"](full|islands|none)['"]/m.exec(e);
|
|
698
|
+
return t === null ? void 0 : t[1];
|
|
699
|
+
}, zt = (e) => {
|
|
700
|
+
let t = e.indexOf("</head>"), n = t === -1 ? e : e.slice(0, t), r = [];
|
|
701
|
+
for (let e of n.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)) {
|
|
702
|
+
let t = e[1] ?? "";
|
|
703
|
+
/\bsrc\s*=/.test(t) || /type\s*=\s*["']module["']/.test(t) || r.push(e[0]);
|
|
704
|
+
}
|
|
705
|
+
return r.map((e) => ` ${e}`).join("\n");
|
|
706
|
+
}, Bt = (e) => [...e.matchAll(/<link\b[^>]*\brel\s*=\s*["']stylesheet["'][^>]*>/gi)].map((e) => e[0]), Vt = (e, t) => {
|
|
707
|
+
let n = Bt(t).filter((t) => !e.includes(t));
|
|
708
|
+
if (n.length === 0) return e;
|
|
709
|
+
let r = n.map((e) => ` ${e}`).join("\n");
|
|
710
|
+
return e.includes("</head>") ? e.replace("</head>", `${r}\n </head>`) : e + r;
|
|
711
|
+
}, Ht = (e) => {
|
|
712
|
+
let t = e.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
713
|
+
return t === "" ? "root" : t;
|
|
714
|
+
}, Ut = class extends Error {
|
|
715
|
+
constructor(e, t) {
|
|
716
|
+
let n = t.map(([e, t]) => ` ${e} imports '${t}'`).join("\n");
|
|
717
|
+
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";
|
|
718
|
+
}
|
|
719
|
+
}, Wt = async (e) => {
|
|
720
|
+
let t = O(e.webRoot, ".framework", "island-shells"), n = [];
|
|
721
|
+
if (e.pages.length === 0) return n;
|
|
722
|
+
await N.mkdir(t, { recursive: !0 });
|
|
723
|
+
for (let r of e.pages) {
|
|
724
|
+
let i = await Lt(e.webRoot, r.file);
|
|
725
|
+
if (i.violations.length > 0) throw new Ut(r.pattern, i.violations);
|
|
726
|
+
let a = Ht(r.pattern), o = `island-shells/${a}.tsx`, s = `island-shells/${a}.html`, c = i.islandFiles.map((e) => `import '../../${e}'`).join("\n"), l = i.usesClient ? [
|
|
727
|
+
`// GENERATED by voltro — the islands entry for '${r.pattern}' (client boot:`,
|
|
728
|
+
"// an island here imports @voltro/client, so the roots get a live runtime).",
|
|
729
|
+
...e.apiImports ?? [],
|
|
730
|
+
"import { VoltroRuntimeProvider } from '@voltro/web/runtime'",
|
|
731
|
+
"import { hydrateIslandsOnPage } from '@voltro/web/islands'",
|
|
732
|
+
c,
|
|
733
|
+
"hydrateIslandsOnPage({",
|
|
734
|
+
" wrap: (children) => (",
|
|
735
|
+
` <VoltroRuntimeProvider apis={${e.apiEntriesLiteral ?? "{}"}}>{children}</VoltroRuntimeProvider>`,
|
|
736
|
+
" ),",
|
|
737
|
+
"})",
|
|
738
|
+
""
|
|
739
|
+
].join("\n") : [
|
|
740
|
+
`// GENERATED by voltro — the slim islands entry for '${r.pattern}'.`,
|
|
741
|
+
"// react + the island runtime + this page's islands; no router, no",
|
|
742
|
+
"// Effect runtime, no subscription cache.",
|
|
743
|
+
"import { hydrateIslandsOnPage } from '@voltro/web/islands'",
|
|
744
|
+
c,
|
|
745
|
+
"hydrateIslandsOnPage()",
|
|
746
|
+
""
|
|
747
|
+
].join("\n"), u = [
|
|
748
|
+
"<!doctype html>",
|
|
749
|
+
"<html lang=\"en\">",
|
|
750
|
+
" <head>",
|
|
751
|
+
" <meta charset=\"UTF-8\" />",
|
|
752
|
+
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />",
|
|
753
|
+
...e.headSnippets !== void 0 && e.headSnippets !== "" ? [e.headSnippets] : [],
|
|
754
|
+
" </head>",
|
|
755
|
+
" <body>",
|
|
756
|
+
" <div id=\"root\"></div>",
|
|
757
|
+
` <script type="module" src="/island-shells/${a}.tsx"><\/script>`,
|
|
758
|
+
" </body>",
|
|
759
|
+
"</html>",
|
|
760
|
+
""
|
|
761
|
+
].join("\n");
|
|
762
|
+
await N.writeFile(O(t, `${a}.tsx`), l), await N.writeFile(O(t, `${a}.html`), u), n.push({
|
|
763
|
+
pattern: r.pattern,
|
|
764
|
+
name: a,
|
|
765
|
+
htmlFile: s,
|
|
766
|
+
entryFile: o,
|
|
767
|
+
usesClient: i.usesClient
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
return n;
|
|
771
|
+
}, Gt = class extends Error {
|
|
772
|
+
_voltroDeferral = !0;
|
|
773
|
+
constructor(e) {
|
|
774
|
+
super(e), this.name = "DeferralNotSupportedError";
|
|
775
|
+
}
|
|
776
|
+
}, Kt = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, qt = (e) => {
|
|
777
|
+
if (!(e instanceof Error)) return;
|
|
778
|
+
let t = e._voltroControl;
|
|
779
|
+
if (t === "redirect") {
|
|
780
|
+
let { location: t, status: n } = e;
|
|
781
|
+
return typeof t == "string" ? {
|
|
782
|
+
status: n === 307 || n === 308 ? n : 303,
|
|
783
|
+
headers: {
|
|
784
|
+
location: t,
|
|
785
|
+
"x-voltro-rendered-by": "loader-redirect"
|
|
786
|
+
},
|
|
787
|
+
body: ""
|
|
788
|
+
} : void 0;
|
|
789
|
+
}
|
|
790
|
+
if (t === "not-found") return {
|
|
791
|
+
status: 404,
|
|
792
|
+
headers: {
|
|
793
|
+
"content-type": "text/plain; charset=utf-8",
|
|
794
|
+
"x-voltro-rendered-by": "loader-not-found"
|
|
795
|
+
},
|
|
796
|
+
body: "not found"
|
|
797
|
+
};
|
|
798
|
+
}, Jt = (e) => {
|
|
799
|
+
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
800
|
+
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
801
|
+
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
802
|
+
r[e] = s.renderData, i[e] = s.stateData, s.deferredIds && (a[e] = s.deferredIds);
|
|
803
|
+
}
|
|
804
|
+
let o = n.deferredIds !== void 0 || Object.keys(a).length > 0;
|
|
805
|
+
if (o) try {
|
|
806
|
+
t.assertDeferralSupported({
|
|
807
|
+
page: e.page,
|
|
808
|
+
renderMode: e.renderMode,
|
|
809
|
+
interactive: e.interactive,
|
|
810
|
+
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
811
|
+
});
|
|
812
|
+
} catch (e) {
|
|
813
|
+
throw new Gt(e instanceof Error ? e.message : String(e));
|
|
814
|
+
}
|
|
815
|
+
return {
|
|
816
|
+
loaderData: n.renderData,
|
|
817
|
+
segmentLoaderData: r,
|
|
818
|
+
hasDeferred: o,
|
|
819
|
+
stateInput: {
|
|
820
|
+
path: e.pathname,
|
|
821
|
+
loaderData: n.stateData,
|
|
822
|
+
segmentLoaderData: i,
|
|
823
|
+
pageLoaderRan: e.pageLoaderRan,
|
|
824
|
+
...e.layoutShell ? { pageClientOnly: !0 } : {},
|
|
825
|
+
...n.deferredIds ? { deferredPageIds: n.deferredIds } : {},
|
|
826
|
+
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
}, Yt = (e) => {
|
|
830
|
+
let { helpers: t, renderInput: n } = e, r = Jt({
|
|
831
|
+
helpers: t,
|
|
832
|
+
page: e.page,
|
|
833
|
+
pathname: n.pathname,
|
|
834
|
+
renderMode: "spa",
|
|
835
|
+
interactive: e.interactive,
|
|
836
|
+
loaderData: null,
|
|
837
|
+
segmentLoaderData: n.segmentLoaderData ?? {},
|
|
838
|
+
pageLoaderRan: !1,
|
|
839
|
+
layoutShell: e.delivery
|
|
840
|
+
});
|
|
841
|
+
return {
|
|
842
|
+
renderInput: {
|
|
843
|
+
...n,
|
|
844
|
+
pageSlot: !0,
|
|
845
|
+
loaderData: null,
|
|
846
|
+
segmentLoaderData: r.segmentLoaderData
|
|
847
|
+
},
|
|
848
|
+
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
849
|
+
hasDeferred: r.hasDeferred
|
|
850
|
+
};
|
|
851
|
+
}, Xt = (e) => {
|
|
852
|
+
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
853
|
+
return {
|
|
854
|
+
body: t,
|
|
855
|
+
meta: n
|
|
856
|
+
};
|
|
857
|
+
}, Zt = (e) => [
|
|
858
|
+
...e.extra ?? [],
|
|
859
|
+
e.helpers.renderMetaToHtml(e.meta),
|
|
860
|
+
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
861
|
+
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
862
|
+
e.prepared.stateScript
|
|
863
|
+
].filter((e) => e.length > 0).join("\n "), Qt = (e, t) => {
|
|
864
|
+
let n = t.replace(/[^A-Za-z0-9+/=_-]/g, "");
|
|
865
|
+
return e.replace(/<script(?![^>]*\bnonce=)/gi, `<script nonce="${n}"`);
|
|
866
|
+
}, $t = (e) => {
|
|
867
|
+
let t = e.indexOf("?");
|
|
868
|
+
return t === -1 ? {
|
|
869
|
+
pathname: e || "/",
|
|
870
|
+
search: ""
|
|
871
|
+
} : {
|
|
872
|
+
pathname: e.slice(0, t) || "/",
|
|
873
|
+
search: e.slice(t)
|
|
874
|
+
};
|
|
875
|
+
}, en = (e) => {
|
|
542
876
|
let t = [];
|
|
543
877
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
544
878
|
name: n.slice(5, -2),
|
|
@@ -554,12 +888,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
554
888
|
optional: !1
|
|
555
889
|
});
|
|
556
890
|
return t;
|
|
557
|
-
},
|
|
891
|
+
}, tn = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), nn = async (e) => {
|
|
558
892
|
let t = A(e);
|
|
559
893
|
for (let e = 0; e < 4; e++) {
|
|
560
894
|
let e = O(t, "project.json");
|
|
561
|
-
if (
|
|
562
|
-
let n = await
|
|
895
|
+
if (M(e)) try {
|
|
896
|
+
let n = await N.readFile(e, "utf8");
|
|
563
897
|
return {
|
|
564
898
|
projectDir: t,
|
|
565
899
|
manifest: JSON.parse(n)
|
|
@@ -572,33 +906,33 @@ __installPublicEnv(publicEnvValues)
|
|
|
572
906
|
t = n;
|
|
573
907
|
}
|
|
574
908
|
return null;
|
|
575
|
-
},
|
|
576
|
-
let t = await
|
|
909
|
+
}, rn = async (e) => {
|
|
910
|
+
let t = await nn(e);
|
|
577
911
|
if (!t) return [];
|
|
578
912
|
let { projectDir: n, manifest: r } = t, i = E(e), a = r.apps ?? {}, o = [];
|
|
579
913
|
for (let [e, t] of Object.entries(a)) {
|
|
580
914
|
if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
|
|
581
915
|
let r = O(n, t.path ?? e), a = O(r, "src", "pages");
|
|
582
|
-
if (!
|
|
916
|
+
if (!M(a)) continue;
|
|
583
917
|
let s;
|
|
584
918
|
try {
|
|
585
|
-
let { pages: e } = await
|
|
919
|
+
let { pages: e } = await $(a);
|
|
586
920
|
s = e.map((e) => ({
|
|
587
921
|
pattern: e.pattern,
|
|
588
|
-
params:
|
|
922
|
+
params: en(e.pattern)
|
|
589
923
|
}));
|
|
590
924
|
} catch {
|
|
591
925
|
continue;
|
|
592
926
|
}
|
|
593
927
|
o.push({
|
|
594
|
-
key:
|
|
928
|
+
key: tn(e),
|
|
595
929
|
origin: `http://localhost:${t.port}`,
|
|
596
930
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
597
931
|
routes: s
|
|
598
932
|
});
|
|
599
933
|
}
|
|
600
934
|
return o;
|
|
601
|
-
},
|
|
935
|
+
}, an = (e) => {
|
|
602
936
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
603
937
|
let t = e.pattern;
|
|
604
938
|
for (let n of e.params) {
|
|
@@ -606,73 +940,91 @@ __installPublicEnv(publicEnvValues)
|
|
|
606
940
|
t = t.replace(e, r);
|
|
607
941
|
}
|
|
608
942
|
return "`" + t + "`";
|
|
609
|
-
},
|
|
943
|
+
}, on = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
610
944
|
let t = "string";
|
|
611
945
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
612
|
-
}).join("; ")} }`,
|
|
613
|
-
let r =
|
|
946
|
+
}).join("; ")} }`, sn = (e, t, n) => {
|
|
947
|
+
let r = on(e), i = an(e), a = t ? "VoltroExternalUrl" : e.search === void 0 ? "VoltroRouteUrl" : `VoltroRouteUrl<Schema.Schema.Type<typeof ${e.search.alias}>>`, o = t && n ? `${n} + ` : "";
|
|
614
948
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
615
|
-
},
|
|
949
|
+
}, cn = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${sn(e, !1)},`).join("\n")}\n}`, ln = (e, t) => {
|
|
616
950
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
617
|
-
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)}: ${
|
|
951
|
+
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)}: ${sn(e, !0, i)},`);
|
|
618
952
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
619
|
-
},
|
|
620
|
-
let t = e.pages.map((
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
953
|
+
}, un = async (e) => {
|
|
954
|
+
let t = await Promise.all(e.pages.map(async (t) => {
|
|
955
|
+
let n;
|
|
956
|
+
try {
|
|
957
|
+
let r = await N.readFile(O(e.appRoot, "src", "pages", t.file), "utf8");
|
|
958
|
+
/^export const searchParams\b/m.test(r) && (n = {
|
|
959
|
+
alias: `SP_${t.ident}`,
|
|
960
|
+
specifier: `../src/pages/${t.file.replace(/\.tsx?$/, "")}`
|
|
961
|
+
});
|
|
962
|
+
} catch {}
|
|
963
|
+
return {
|
|
964
|
+
pattern: t.pattern,
|
|
965
|
+
params: en(t.pattern),
|
|
966
|
+
...n === void 0 ? {} : { search: n }
|
|
967
|
+
};
|
|
968
|
+
})), n = await rn(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 = [
|
|
624
969
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
625
970
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
626
971
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
627
972
|
"",
|
|
628
973
|
"import type { VoltroRouteUrl, VoltroExternalUrl } from '@voltro/web'",
|
|
974
|
+
...r.length > 0 ? [
|
|
975
|
+
"// Type-ONLY page imports: they brand each schema-carrying route's URL with",
|
|
976
|
+
"// its searchParams shape and are erased at compile time — no page enters",
|
|
977
|
+
"// this module's value graph (plans/parity/05, the code-splitting decision).",
|
|
978
|
+
"import type { Schema } from 'effect'",
|
|
979
|
+
...r
|
|
980
|
+
] : [],
|
|
629
981
|
"",
|
|
630
982
|
"type EmptyParams = Record<string, never>",
|
|
631
983
|
""
|
|
632
|
-
].join("\n"),
|
|
633
|
-
await
|
|
634
|
-
let
|
|
984
|
+
].join("\n"), a = e.mode ?? "dev", o = `${i}\n${`export const routes = ${cn(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => ln(e, a)).join("\n")}\n} as const\n`}`, s = O(e.appRoot, ".framework", "routes.generated.ts");
|
|
985
|
+
await N.mkdir(D(s), { recursive: !0 });
|
|
986
|
+
let c = null;
|
|
635
987
|
try {
|
|
636
|
-
|
|
988
|
+
c = await N.readFile(s, "utf8");
|
|
637
989
|
} catch {}
|
|
638
|
-
return
|
|
639
|
-
path:
|
|
990
|
+
return c === o ? {
|
|
991
|
+
path: s,
|
|
640
992
|
wrote: !1
|
|
641
|
-
} : (await
|
|
642
|
-
path:
|
|
993
|
+
} : (await N.writeFile(s, o, "utf8"), {
|
|
994
|
+
path: s,
|
|
643
995
|
wrote: !0
|
|
644
996
|
});
|
|
645
|
-
},
|
|
997
|
+
}, dn = (e) => {
|
|
646
998
|
if (e === "" || e === "/") return "/";
|
|
647
999
|
let t = e.startsWith("/") ? e : `/${e}`;
|
|
648
1000
|
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
649
|
-
},
|
|
650
|
-
let n = e.endsWith("/") ? e.slice(0, -1) : e, r =
|
|
1001
|
+
}, fn = (e, t) => {
|
|
1002
|
+
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = dn(t);
|
|
651
1003
|
return r === "/" ? `${n}/` : `${n}${r}`;
|
|
652
|
-
},
|
|
653
|
-
let r =
|
|
1004
|
+
}, pn = (e, t, n) => {
|
|
1005
|
+
let r = dn(e);
|
|
654
1006
|
return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
|
|
655
|
-
},
|
|
1007
|
+
}, mn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), hn = (e) => {
|
|
656
1008
|
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) => {
|
|
657
1009
|
if (!r) return "";
|
|
658
|
-
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${
|
|
659
|
-
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${
|
|
1010
|
+
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${mn(n)}" href="${mn(fn(t, pn(e, n, i)))}" />`);
|
|
1011
|
+
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${mn(fn(t, pn(e, i, i)))}" />`), `\n${n.join("\n")}`;
|
|
660
1012
|
};
|
|
661
1013
|
for (let e of n) {
|
|
662
1014
|
let n = r ?? [i];
|
|
663
1015
|
for (let r of n) {
|
|
664
|
-
let n =
|
|
665
|
-
o.set(n, ` <url>\n <loc>${
|
|
1016
|
+
let n = fn(t, pn(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${mn(e.lastmod)}</lastmod>` : "";
|
|
1017
|
+
o.set(n, ` <url>\n <loc>${mn(n)}</loc>${a}${s(e.path)}\n </url>`);
|
|
666
1018
|
}
|
|
667
1019
|
}
|
|
668
1020
|
let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
|
|
669
1021
|
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`;
|
|
670
|
-
},
|
|
1022
|
+
}, gn = (e) => {
|
|
671
1023
|
if (!e.indexable) return "User-agent: *\nDisallow: /\n";
|
|
672
1024
|
let t = ["User-agent: *", "Allow: /"];
|
|
673
|
-
for (let n of e.disallow ?? []) t.push(`Disallow: ${
|
|
1025
|
+
for (let n of e.disallow ?? []) t.push(`Disallow: ${dn(n)}`);
|
|
674
1026
|
return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
|
|
675
|
-
},
|
|
1027
|
+
}, _n = 256, vn = (e = _n) => {
|
|
676
1028
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
677
1029
|
return {
|
|
678
1030
|
emit(r, i) {
|
|
@@ -695,18 +1047,18 @@ __installPublicEnv(publicEnvValues)
|
|
|
695
1047
|
return t.slice();
|
|
696
1048
|
}
|
|
697
1049
|
};
|
|
698
|
-
},
|
|
699
|
-
let n =
|
|
1050
|
+
}, yn = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, bn = () => `: keep-alive ${Date.now()}\n\n`, xn = 8e3, Sn = (e, t = xn) => {
|
|
1051
|
+
let n = wn(e);
|
|
700
1052
|
return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
|
|
701
|
-
},
|
|
1053
|
+
}, Cn = 4, wn = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
|
|
702
1054
|
if (e instanceof Error) {
|
|
703
1055
|
let r = e.stack ?? `${e.name}: ${e.message}`;
|
|
704
1056
|
if (n.has(e)) return `${r}\n [cycle]`;
|
|
705
1057
|
n.add(e);
|
|
706
1058
|
let i = [];
|
|
707
|
-
if (t <
|
|
708
|
-
if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${
|
|
709
|
-
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${
|
|
1059
|
+
if (t < Cn) {
|
|
1060
|
+
if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${Tn(wn(a, t + 1, n))}`);
|
|
1061
|
+
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${Tn(wn(e.cause, t + 1, n))}`);
|
|
710
1062
|
}
|
|
711
1063
|
return r + i.join("");
|
|
712
1064
|
}
|
|
@@ -715,30 +1067,30 @@ __installPublicEnv(publicEnvValues)
|
|
|
715
1067
|
} catch {
|
|
716
1068
|
return "[unstringifiable thrown value]";
|
|
717
1069
|
}
|
|
718
|
-
},
|
|
1070
|
+
}, Tn = (e) => {
|
|
719
1071
|
let t = e.split("\n");
|
|
720
1072
|
return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
|
|
721
|
-
},
|
|
1073
|
+
}, En = {
|
|
722
1074
|
trace: 0,
|
|
723
1075
|
debug: 1,
|
|
724
1076
|
info: 2,
|
|
725
1077
|
warn: 3,
|
|
726
1078
|
error: 4,
|
|
727
1079
|
fatal: 5
|
|
728
|
-
},
|
|
1080
|
+
}, Dn = 2e3, On = 200, kn = class {
|
|
729
1081
|
capacity;
|
|
730
1082
|
buffer = [];
|
|
731
|
-
constructor(e =
|
|
1083
|
+
constructor(e = Dn) {
|
|
732
1084
|
this.capacity = e;
|
|
733
1085
|
}
|
|
734
1086
|
append(e) {
|
|
735
1087
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
736
1088
|
}
|
|
737
1089
|
query(e = {}) {
|
|
738
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
1090
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? On, this.capacity), i = e.minLevel === void 0 ? En.trace : En[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
739
1091
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
740
1092
|
let r = this.buffer[e];
|
|
741
|
-
r.ts < t || r.ts > n ||
|
|
1093
|
+
r.ts < t || r.ts > n || En[r.level] < i || (o === void 0 || r.source === o) && (a !== void 0 && (r.scope === void 0 || !r.scope.toLowerCase().includes(a)) || s !== void 0 && !r.message.toLowerCase().includes(s) || (c === void 0 || r.fields.traceId === c) && l.push(r));
|
|
742
1094
|
}
|
|
743
1095
|
return l.reverse();
|
|
744
1096
|
}
|
|
@@ -751,7 +1103,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
751
1103
|
clear() {
|
|
752
1104
|
this.buffer = [];
|
|
753
1105
|
}
|
|
754
|
-
},
|
|
1106
|
+
}, An = null, jn = () => (An === null && (An = new kn()), An), Mn = (e) => {
|
|
755
1107
|
if (typeof e == "string") return e;
|
|
756
1108
|
if (e instanceof Error) return e.message;
|
|
757
1109
|
try {
|
|
@@ -759,28 +1111,28 @@ __installPublicEnv(publicEnvValues)
|
|
|
759
1111
|
} catch {
|
|
760
1112
|
return String(e);
|
|
761
1113
|
}
|
|
762
|
-
},
|
|
1114
|
+
}, Nn = 8e3, Pn = (e) => typeof e == "string" ? e.length <= Nn ? e : `${e.slice(0, Nn)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Sn(e, Nn), Fn = (e, t) => {
|
|
763
1115
|
try {
|
|
764
1116
|
e(...t);
|
|
765
1117
|
} catch (n) {
|
|
766
1118
|
try {
|
|
767
|
-
e(...t.map(
|
|
1119
|
+
e(...t.map(Pn)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Nn} chars per argument.`);
|
|
768
1120
|
} catch {
|
|
769
1121
|
e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
|
|
770
1122
|
}
|
|
771
1123
|
}
|
|
772
|
-
},
|
|
1124
|
+
}, In = (e) => {
|
|
773
1125
|
let t = {
|
|
774
1126
|
log: console.log.bind(console),
|
|
775
1127
|
info: console.info.bind(console),
|
|
776
1128
|
warn: console.warn.bind(console),
|
|
777
1129
|
error: console.error.bind(console),
|
|
778
1130
|
debug: console.debug.bind(console)
|
|
779
|
-
}, n =
|
|
780
|
-
if (
|
|
1131
|
+
}, n = jn(), r = !1, i = (i) => (...a) => {
|
|
1132
|
+
if (Fn(t[i], a), !r) {
|
|
781
1133
|
r = !0;
|
|
782
1134
|
try {
|
|
783
|
-
let t = a.length > 0 ?
|
|
1135
|
+
let t = a.length > 0 ? Mn(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = V();
|
|
784
1136
|
e.emit("log", {
|
|
785
1137
|
level: i,
|
|
786
1138
|
message: r,
|
|
@@ -807,7 +1159,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
807
1159
|
}
|
|
808
1160
|
};
|
|
809
1161
|
console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
|
|
810
|
-
let a =
|
|
1162
|
+
let a = L((t) => {
|
|
811
1163
|
if (!r) {
|
|
812
1164
|
r = !0;
|
|
813
1165
|
try {
|
|
@@ -838,24 +1190,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
838
1190
|
return () => {
|
|
839
1191
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
840
1192
|
};
|
|
841
|
-
},
|
|
1193
|
+
}, Ln = 2e3, Rn = 8, zn = 1e3, Bn = 200, Vn = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Hn = (e) => {
|
|
842
1194
|
switch (e) {
|
|
843
1195
|
case "error": return "error";
|
|
844
1196
|
case "warn": return "warn";
|
|
845
1197
|
case "debug": return "debug";
|
|
846
1198
|
default: return "info";
|
|
847
1199
|
}
|
|
848
|
-
},
|
|
1200
|
+
}, Un = R({ scope: "client" }), Wn = (e, t) => {
|
|
849
1201
|
let n;
|
|
850
1202
|
try {
|
|
851
1203
|
n = JSON.parse(e);
|
|
852
1204
|
} catch {
|
|
853
|
-
return
|
|
1205
|
+
return Gn(400, { error: "invalid JSON body" });
|
|
854
1206
|
}
|
|
855
|
-
if (typeof n != "object" || !n) return
|
|
1207
|
+
if (typeof n != "object" || !n) return Gn(400, { error: "body must be a JSON object" });
|
|
856
1208
|
let r = n;
|
|
857
|
-
if (!Array.isArray(r.entries)) return
|
|
858
|
-
let i = typeof r.app == "string" ?
|
|
1209
|
+
if (!Array.isArray(r.entries)) return Gn(400, { error: "entries must be an array" });
|
|
1210
|
+
let i = typeof r.app == "string" ? Vn(r.app, 120) : void 0, a = typeof r.page == "string" ? Vn(r.page, 200) : void 0, o = typeof r.ua == "string" ? Vn(r.ua, 200) : void 0, s = r.entries.slice(0, Bn), c = 0;
|
|
859
1211
|
for (let e of s) {
|
|
860
1212
|
if (typeof e != "object" || !e) continue;
|
|
861
1213
|
let n = e;
|
|
@@ -866,7 +1218,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
866
1218
|
"warn",
|
|
867
1219
|
"error",
|
|
868
1220
|
"debug"
|
|
869
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l =
|
|
1221
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = Vn(n.message, Ln), u = Array.isArray(n.args) ? n.args.slice(0, Rn).filter((e) => typeof e == "string").map((e) => Vn(e, zn)) : void 0, d = typeof n.stack == "string" ? Vn(n.stack, Ln) : void 0;
|
|
870
1222
|
t.emit("clientLog", {
|
|
871
1223
|
ts: s,
|
|
872
1224
|
level: r,
|
|
@@ -881,35 +1233,35 @@ __installPublicEnv(publicEnvValues)
|
|
|
881
1233
|
...i === void 0 ? {} : { app: i },
|
|
882
1234
|
...a === void 0 ? {} : { page: a },
|
|
883
1235
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
884
|
-
}, p =
|
|
885
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
1236
|
+
}, p = Hn(r);
|
|
1237
|
+
(p === "error" || p === "warn") && d !== void 0 ? Un[p](l, f, { stack: d }) : Un[p](l, {
|
|
886
1238
|
...f,
|
|
887
1239
|
...d === void 0 ? {} : { stack: d }
|
|
888
1240
|
}), c++;
|
|
889
1241
|
}
|
|
890
|
-
return
|
|
1242
|
+
return Gn(202, {
|
|
891
1243
|
accepted: c,
|
|
892
1244
|
dropped: r.entries.length - c
|
|
893
1245
|
});
|
|
894
|
-
},
|
|
1246
|
+
}, Gn = (e, t) => ({
|
|
895
1247
|
status: e,
|
|
896
1248
|
contentType: "application/json; charset=utf-8",
|
|
897
1249
|
body: JSON.stringify(t)
|
|
898
|
-
}),
|
|
1250
|
+
}), Kn = "/_voltro/inspect/clientLog", qn = [
|
|
899
1251
|
"trace",
|
|
900
1252
|
"debug",
|
|
901
1253
|
"info",
|
|
902
1254
|
"warn",
|
|
903
1255
|
"error",
|
|
904
1256
|
"fatal"
|
|
905
|
-
],
|
|
1257
|
+
], Jn = {
|
|
906
1258
|
trace: "TRACE",
|
|
907
1259
|
debug: "DEBUG",
|
|
908
1260
|
info: "INFO ",
|
|
909
1261
|
warn: "WARN ",
|
|
910
1262
|
error: "ERROR",
|
|
911
1263
|
fatal: "FATAL"
|
|
912
|
-
},
|
|
1264
|
+
}, Yn = (e) => qn.includes(e), Xn = (e, t, n = {}) => {
|
|
913
1265
|
if (u()) return {
|
|
914
1266
|
status: 503,
|
|
915
1267
|
contentType: "application/json",
|
|
@@ -940,7 +1292,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
940
1292
|
Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
|
|
941
1293
|
}
|
|
942
1294
|
let d = a.get("level");
|
|
943
|
-
d !== null &&
|
|
1295
|
+
d !== null && Yn(d) && (o.minLevel = d);
|
|
944
1296
|
let p = a.get("source");
|
|
945
1297
|
(p === "server" || p === "client") && (o.source = p);
|
|
946
1298
|
let m = a.get("scope");
|
|
@@ -953,7 +1305,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
953
1305
|
if ((a.get("format") ?? "json") === "text") return {
|
|
954
1306
|
status: 200,
|
|
955
1307
|
contentType: "text/plain; charset=utf-8",
|
|
956
|
-
body: _.map(
|
|
1308
|
+
body: _.map(Zn).join("\n") + (_.length > 0 ? "\n" : "")
|
|
957
1309
|
};
|
|
958
1310
|
let v = {
|
|
959
1311
|
capturedAt: Date.now(),
|
|
@@ -967,40 +1319,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
967
1319
|
contentType: "application/json; charset=utf-8",
|
|
968
1320
|
body: JSON.stringify(v)
|
|
969
1321
|
};
|
|
970
|
-
},
|
|
971
|
-
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 =
|
|
972
|
-
return `${n}:${r}:${i}.${a} ${
|
|
973
|
-
},
|
|
1322
|
+
}, Zn = (e) => {
|
|
1323
|
+
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 = $n(e.fields);
|
|
1324
|
+
return `${n}:${r}:${i}.${a} ${Jn[e.level]} ${o} ${e.message}${s}`;
|
|
1325
|
+
}, Qn = 80, $n = (e) => {
|
|
974
1326
|
let t = Object.entries(e);
|
|
975
1327
|
if (t.length === 0) return "";
|
|
976
1328
|
let n = [];
|
|
977
1329
|
for (let [e, r] of t) {
|
|
978
1330
|
if (r === void 0) continue;
|
|
979
|
-
let t =
|
|
1331
|
+
let t = er(r);
|
|
980
1332
|
n.push(`${e}=${t}`);
|
|
981
1333
|
}
|
|
982
1334
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
983
|
-
},
|
|
1335
|
+
}, er = (e) => {
|
|
984
1336
|
if (typeof e == "string") {
|
|
985
|
-
let t = e.length >
|
|
1337
|
+
let t = e.length > Qn ? e.slice(0, Qn) + "…" : e;
|
|
986
1338
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
987
1339
|
}
|
|
988
1340
|
if (e === null) return "null";
|
|
989
1341
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
990
1342
|
try {
|
|
991
1343
|
let t = JSON.stringify(e);
|
|
992
|
-
return t.length >
|
|
1344
|
+
return t.length > Qn ? t.slice(0, Qn) + "…" : t;
|
|
993
1345
|
} catch {
|
|
994
1346
|
return "[unserialisable]";
|
|
995
1347
|
}
|
|
996
|
-
},
|
|
1348
|
+
}, tr = "/_voltro/inspect/logs", nr = (e, t, n) => {
|
|
997
1349
|
if (t.headers.authorization !== void 0) return !1;
|
|
998
1350
|
let { token: r } = n;
|
|
999
1351
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
1000
1352
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
1001
1353
|
let i = n.writeToken;
|
|
1002
1354
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
1003
|
-
},
|
|
1355
|
+
}, rr = [{
|
|
1004
1356
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1005
1357
|
handle: (e, t) => {
|
|
1006
1358
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1012,13 +1364,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1012
1364
|
});
|
|
1013
1365
|
} else t.info(n);
|
|
1014
1366
|
}
|
|
1015
|
-
}],
|
|
1367
|
+
}], ir = () => {
|
|
1016
1368
|
let e = {
|
|
1017
1369
|
warn: console.warn.bind(console),
|
|
1018
1370
|
error: console.error.bind(console)
|
|
1019
|
-
}, t =
|
|
1371
|
+
}, t = R({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1020
1372
|
if (!n) {
|
|
1021
|
-
for (let e of
|
|
1373
|
+
for (let e of rr) if (e.match(i[0])) {
|
|
1022
1374
|
n = !0;
|
|
1023
1375
|
try {
|
|
1024
1376
|
e.handle(i, t);
|
|
@@ -1033,7 +1385,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1033
1385
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1034
1386
|
console.warn = e.warn, console.error = e.error;
|
|
1035
1387
|
};
|
|
1036
|
-
},
|
|
1388
|
+
}, ar = {
|
|
1037
1389
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1038
1390
|
renderMode: "it picks the server render strategy",
|
|
1039
1391
|
dynamic: "it picks the server render strategy",
|
|
@@ -1044,7 +1396,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1044
1396
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1045
1397
|
interactive: "it decides how much client JS the server ships",
|
|
1046
1398
|
tenantAware: "it is part of the server-side cache key"
|
|
1047
|
-
},
|
|
1399
|
+
}, or = Object.keys(ar), sr = "virtual:voltro-route-refresh", cr = `\0${sr}`, lr = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, ur = () => `
|
|
1048
1400
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1049
1401
|
|
|
1050
1402
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1073,11 +1425,11 @@ const stableForm = (value) => {
|
|
|
1073
1425
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1074
1426
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1075
1427
|
* value. Everything else a page exports is plain client-side data. */
|
|
1076
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1428
|
+
const serverRelevantExports = ${JSON.stringify(or)}
|
|
1077
1429
|
|
|
1078
1430
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1079
1431
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1080
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1432
|
+
const serverExportEffect = ${JSON.stringify(ar)}
|
|
1081
1433
|
|
|
1082
1434
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1083
1435
|
export const serverEffectOf = (name) =>
|
|
@@ -1120,7 +1472,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1120
1472
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1121
1473
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1122
1474
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1123
|
-
`,
|
|
1475
|
+
`, dr = (e) => `
|
|
1124
1476
|
if (import.meta.hot) {
|
|
1125
1477
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1126
1478
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1147,42 +1499,42 @@ import {
|
|
|
1147
1499
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1148
1500
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1149
1501
|
serverEffectOf as __voltro_serverEffect,
|
|
1150
|
-
} from '${
|
|
1151
|
-
`,
|
|
1152
|
-
let [n = "", r] =
|
|
1153
|
-
if (!n.endsWith(".tsx") || r !== void 0 &&
|
|
1154
|
-
let i =
|
|
1502
|
+
} from '${sr}'
|
|
1503
|
+
`, fr = (e) => e.replace(/\\/g, "/"), pr = (e, t) => {
|
|
1504
|
+
let [n = "", r] = fr(e).split("?");
|
|
1505
|
+
if (!n.endsWith(".tsx") || r !== void 0 && lr.test(r)) return !1;
|
|
1506
|
+
let i = fr(t).replace(/\/$/, "");
|
|
1155
1507
|
return n.startsWith(`${i}/`) ? c.test(n) || s.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
|
|
1156
|
-
},
|
|
1508
|
+
}, mr = (e, t, n) => pr(t, n) ? `${e}${dr(fr(t).split("?")[0] ?? t)}` : null, hr = (e) => ({
|
|
1157
1509
|
name: "voltro:route-fast-refresh",
|
|
1158
1510
|
enforce: "pre",
|
|
1159
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1160
|
-
load: (e) => e ===
|
|
1511
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? cr : void 0,
|
|
1512
|
+
load: (e) => e === cr ? ur() : void 0,
|
|
1161
1513
|
transform: (t, n, r) => {
|
|
1162
1514
|
if (r?.ssr === !0) return null;
|
|
1163
|
-
let i =
|
|
1515
|
+
let i = mr(t, n, e);
|
|
1164
1516
|
return i === null ? null : {
|
|
1165
1517
|
code: i,
|
|
1166
1518
|
map: null
|
|
1167
1519
|
};
|
|
1168
1520
|
}
|
|
1169
|
-
}),
|
|
1521
|
+
}), gr = R({ scope: "voltro:dashboard" }), _r = ie(import.meta.url), vr = 5179, yr = (e) => {
|
|
1170
1522
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1171
|
-
if (t &&
|
|
1523
|
+
if (t && M(O(A(t), "app.config.ts"))) return A(t);
|
|
1172
1524
|
try {
|
|
1173
|
-
let e = D(
|
|
1174
|
-
if (
|
|
1525
|
+
let e = D(_r.resolve("@voltro/dashboard/package.json"));
|
|
1526
|
+
if (M(O(e, "app.config.ts"))) return e;
|
|
1175
1527
|
} catch {}
|
|
1176
1528
|
let n = O("voltro-devtools", "apps", "dashboard"), r = A(e);
|
|
1177
1529
|
for (let e = 0; e < 10; e++) {
|
|
1178
1530
|
let e = O(r, n);
|
|
1179
|
-
if (
|
|
1531
|
+
if (M(O(e, "app.config.ts"))) return e;
|
|
1180
1532
|
let t = D(r);
|
|
1181
1533
|
if (t === r) break;
|
|
1182
1534
|
r = t;
|
|
1183
1535
|
}
|
|
1184
1536
|
return null;
|
|
1185
|
-
},
|
|
1537
|
+
}, br = "VOLTRO_IS_DASHBOARD", xr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1186
1538
|
let i = K({
|
|
1187
1539
|
port: e,
|
|
1188
1540
|
host: t
|
|
@@ -1190,45 +1542,45 @@ import {
|
|
|
1190
1542
|
a || (a = !0, i.destroy(), r(e));
|
|
1191
1543
|
};
|
|
1192
1544
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1193
|
-
}),
|
|
1545
|
+
}), Sr = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), Cr = () => process.env[br] === "1", wr = () => process.stdout.isTTY === !0, Tr = O(H(), ".voltro", "dashboard-launch.lock"), Er = 1e4, Dr = async () => {
|
|
1194
1546
|
try {
|
|
1195
|
-
await
|
|
1196
|
-
let e = await
|
|
1547
|
+
await N.mkdir(D(Tr), { recursive: !0 });
|
|
1548
|
+
let e = await N.open(Tr, "wx");
|
|
1197
1549
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1198
1550
|
} catch {
|
|
1199
1551
|
try {
|
|
1200
|
-
let e = await
|
|
1201
|
-
if (Date.now() - e.mtimeMs >
|
|
1552
|
+
let e = await N.stat(Tr);
|
|
1553
|
+
if (Date.now() - e.mtimeMs > Er) return await N.unlink(Tr).catch(() => void 0), Dr();
|
|
1202
1554
|
} catch {}
|
|
1203
1555
|
return !1;
|
|
1204
1556
|
}
|
|
1205
|
-
},
|
|
1557
|
+
}, Or = async () => {
|
|
1206
1558
|
try {
|
|
1207
|
-
await
|
|
1559
|
+
await N.unlink(Tr);
|
|
1208
1560
|
} catch {}
|
|
1209
|
-
},
|
|
1561
|
+
}, kr = async (e) => {
|
|
1210
1562
|
let t = e.port ?? 5179;
|
|
1211
|
-
if (
|
|
1563
|
+
if (Sr()) return {
|
|
1212
1564
|
status: "skipped",
|
|
1213
1565
|
reason: "disabled by flag/env",
|
|
1214
1566
|
port: t
|
|
1215
1567
|
};
|
|
1216
|
-
if (
|
|
1568
|
+
if (Cr()) return {
|
|
1217
1569
|
status: "skipped",
|
|
1218
1570
|
reason: "this process IS the dashboard",
|
|
1219
1571
|
port: t
|
|
1220
1572
|
};
|
|
1221
|
-
if (!
|
|
1573
|
+
if (!wr()) return {
|
|
1222
1574
|
status: "skipped",
|
|
1223
1575
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1224
1576
|
port: t
|
|
1225
1577
|
};
|
|
1226
|
-
if (!await
|
|
1578
|
+
if (!await Dr()) return {
|
|
1227
1579
|
status: "skipped",
|
|
1228
1580
|
reason: "another voltro process is currently launching the dashboard",
|
|
1229
1581
|
port: t
|
|
1230
1582
|
};
|
|
1231
|
-
if (await
|
|
1583
|
+
if (await xr(t)) return await Or(), {
|
|
1232
1584
|
status: "already-running",
|
|
1233
1585
|
port: t
|
|
1234
1586
|
};
|
|
@@ -1237,7 +1589,7 @@ import {
|
|
|
1237
1589
|
let e = process.argv[1];
|
|
1238
1590
|
n = e && e.endsWith("/src/bin.ts") ? O(D(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
1239
1591
|
}
|
|
1240
|
-
let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i =
|
|
1592
|
+
let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = M(r), a = i ? "start" : "dev", o = _e(process.execPath, [
|
|
1241
1593
|
n,
|
|
1242
1594
|
a,
|
|
1243
1595
|
e.dashboardAppPath
|
|
@@ -1245,7 +1597,7 @@ import {
|
|
|
1245
1597
|
stdio: "ignore",
|
|
1246
1598
|
env: {
|
|
1247
1599
|
...process.env,
|
|
1248
|
-
[
|
|
1600
|
+
[br]: "1",
|
|
1249
1601
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1250
1602
|
}
|
|
1251
1603
|
});
|
|
@@ -1253,120 +1605,19 @@ import {
|
|
|
1253
1605
|
if (o.exitCode === null && o.signalCode === null) try {
|
|
1254
1606
|
o.kill("SIGTERM");
|
|
1255
1607
|
} catch {}
|
|
1256
|
-
}),
|
|
1608
|
+
}), gr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1257
1609
|
port: t,
|
|
1258
1610
|
mode: a,
|
|
1259
1611
|
prebuilt: i
|
|
1260
|
-
}), i ||
|
|
1261
|
-
|
|
1612
|
+
}), i || gr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), gr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1613
|
+
Or();
|
|
1262
1614
|
}, 4e3).unref(), {
|
|
1263
1615
|
status: "launched",
|
|
1264
1616
|
port: t
|
|
1265
1617
|
};
|
|
1266
|
-
},
|
|
1267
|
-
_voltroDeferral = !0;
|
|
1268
|
-
constructor(e) {
|
|
1269
|
-
super(e), this.name = "DeferralNotSupportedError";
|
|
1270
|
-
}
|
|
1271
|
-
}, In = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Ln = (e) => {
|
|
1272
|
-
if (!(e instanceof Error)) return;
|
|
1273
|
-
let t = e._voltroControl;
|
|
1274
|
-
if (t === "redirect") {
|
|
1275
|
-
let { location: t, status: n } = e;
|
|
1276
|
-
return typeof t == "string" ? {
|
|
1277
|
-
status: n === 307 || n === 308 ? n : 303,
|
|
1278
|
-
headers: {
|
|
1279
|
-
location: t,
|
|
1280
|
-
"x-voltro-rendered-by": "loader-redirect"
|
|
1281
|
-
},
|
|
1282
|
-
body: ""
|
|
1283
|
-
} : void 0;
|
|
1284
|
-
}
|
|
1285
|
-
if (t === "not-found") return {
|
|
1286
|
-
status: 404,
|
|
1287
|
-
headers: {
|
|
1288
|
-
"content-type": "text/plain; charset=utf-8",
|
|
1289
|
-
"x-voltro-rendered-by": "loader-not-found"
|
|
1290
|
-
},
|
|
1291
|
-
body: "not found"
|
|
1292
|
-
};
|
|
1293
|
-
}, Rn = (e) => {
|
|
1294
|
-
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1295
|
-
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1296
|
-
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
1297
|
-
r[e] = s.renderData, i[e] = s.stateData, s.deferredIds && (a[e] = s.deferredIds);
|
|
1298
|
-
}
|
|
1299
|
-
let o = n.deferredIds !== void 0 || Object.keys(a).length > 0;
|
|
1300
|
-
if (o) try {
|
|
1301
|
-
t.assertDeferralSupported({
|
|
1302
|
-
page: e.page,
|
|
1303
|
-
renderMode: e.renderMode,
|
|
1304
|
-
interactive: e.interactive,
|
|
1305
|
-
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1306
|
-
});
|
|
1307
|
-
} catch (e) {
|
|
1308
|
-
throw new Fn(e instanceof Error ? e.message : String(e));
|
|
1309
|
-
}
|
|
1310
|
-
return {
|
|
1311
|
-
loaderData: n.renderData,
|
|
1312
|
-
segmentLoaderData: r,
|
|
1313
|
-
hasDeferred: o,
|
|
1314
|
-
stateInput: {
|
|
1315
|
-
path: e.pathname,
|
|
1316
|
-
loaderData: n.stateData,
|
|
1317
|
-
segmentLoaderData: i,
|
|
1318
|
-
pageLoaderRan: e.pageLoaderRan,
|
|
1319
|
-
...e.layoutShell ? { pageClientOnly: !0 } : {},
|
|
1320
|
-
...n.deferredIds ? { deferredPageIds: n.deferredIds } : {},
|
|
1321
|
-
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1322
|
-
}
|
|
1323
|
-
};
|
|
1324
|
-
}, zn = (e) => {
|
|
1325
|
-
let { helpers: t, renderInput: n } = e, r = Rn({
|
|
1326
|
-
helpers: t,
|
|
1327
|
-
page: e.page,
|
|
1328
|
-
pathname: n.pathname,
|
|
1329
|
-
renderMode: "spa",
|
|
1330
|
-
interactive: e.interactive,
|
|
1331
|
-
loaderData: null,
|
|
1332
|
-
segmentLoaderData: n.segmentLoaderData ?? {},
|
|
1333
|
-
pageLoaderRan: !1,
|
|
1334
|
-
layoutShell: e.delivery
|
|
1335
|
-
});
|
|
1336
|
-
return {
|
|
1337
|
-
renderInput: {
|
|
1338
|
-
...n,
|
|
1339
|
-
pageSlot: !0,
|
|
1340
|
-
loaderData: null,
|
|
1341
|
-
segmentLoaderData: r.segmentLoaderData
|
|
1342
|
-
},
|
|
1343
|
-
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1344
|
-
hasDeferred: r.hasDeferred
|
|
1345
|
-
};
|
|
1346
|
-
}, Bn = (e) => {
|
|
1347
|
-
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1348
|
-
return {
|
|
1349
|
-
body: t,
|
|
1350
|
-
meta: n
|
|
1351
|
-
};
|
|
1352
|
-
}, Vn = (e) => [
|
|
1353
|
-
...e.extra ?? [],
|
|
1354
|
-
e.helpers.renderMetaToHtml(e.meta),
|
|
1355
|
-
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1356
|
-
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1357
|
-
e.prepared.stateScript
|
|
1358
|
-
].filter((e) => e.length > 0).join("\n "), Hn = (e) => {
|
|
1359
|
-
let t = e.indexOf("?");
|
|
1360
|
-
return t === -1 ? {
|
|
1361
|
-
pathname: e || "/",
|
|
1362
|
-
search: ""
|
|
1363
|
-
} : {
|
|
1364
|
-
pathname: e.slice(0, t) || "/",
|
|
1365
|
-
search: e.slice(t)
|
|
1366
|
-
};
|
|
1367
|
-
}, Un = /Could not find required `intl` object/, Wn = "__voltro_i18n_instances__", Gn = (e = globalThis) => {
|
|
1618
|
+
}, Ar = /Could not find required `intl` object/, jr = "__voltro_i18n_instances__", Mr = (e = globalThis) => {
|
|
1368
1619
|
try {
|
|
1369
|
-
let t = e[
|
|
1620
|
+
let t = e[jr]?.records;
|
|
1370
1621
|
return t === void 0 || t.length === 0 ? void 0 : {
|
|
1371
1622
|
instances: t.length,
|
|
1372
1623
|
reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
|
|
@@ -1375,7 +1626,7 @@ import {
|
|
|
1375
1626
|
} catch {
|
|
1376
1627
|
return;
|
|
1377
1628
|
}
|
|
1378
|
-
},
|
|
1629
|
+
}, Nr = (e, t) => [
|
|
1379
1630
|
"",
|
|
1380
1631
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1381
1632
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1393,7 +1644,7 @@ import {
|
|
|
1393
1644
|
" versions on disk; this counts instances in the running process, and one",
|
|
1394
1645
|
" file loaded down two paths is two instances.",
|
|
1395
1646
|
"───────────────────────────────────────────────────────────────────────"
|
|
1396
|
-
].join("\n"),
|
|
1647
|
+
].join("\n"), Pr = (e, t) => [
|
|
1397
1648
|
"",
|
|
1398
1649
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1399
1650
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1409,7 +1660,7 @@ import {
|
|
|
1409
1660
|
" direct import can land on a second copy that this count does not see —",
|
|
1410
1661
|
" it counts what @voltro/i18n is bound to.",
|
|
1411
1662
|
"───────────────────────────────────────────────────────────────────────"
|
|
1412
|
-
].join("\n"),
|
|
1663
|
+
].join("\n"), Fr = (e) => [
|
|
1413
1664
|
"",
|
|
1414
1665
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1415
1666
|
`${e} DID wrap this render in <I18nProvider> — the framework`,
|
|
@@ -1425,37 +1676,37 @@ import {
|
|
|
1425
1676
|
" Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
|
|
1426
1677
|
" the duplication here is of module instances in one process.",
|
|
1427
1678
|
"───────────────────────────────────────────────────────────────────────"
|
|
1428
|
-
].join("\n"),
|
|
1679
|
+
].join("\n"), Ir = (e, t, n, r = Mr()) => {
|
|
1429
1680
|
if (!t) return;
|
|
1430
1681
|
let i = String(e?.message ?? e);
|
|
1431
|
-
if (
|
|
1432
|
-
},
|
|
1433
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1434
|
-
let r =
|
|
1682
|
+
if (Ar.test(i)) return r === void 0 ? Fr(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Nr(n, r) : Pr(n, r);
|
|
1683
|
+
}, Lr = "<div id=\"root\"></div>", Rr = "<div id=\"root\">", zr = "</div>", Br = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Vr = /\bsrc=["']([^"']+)["']/i, Hr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Ur = (e) => {
|
|
1684
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Br, (e) => {
|
|
1685
|
+
let r = Vr.exec(e)?.[1];
|
|
1435
1686
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1436
1687
|
});
|
|
1437
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1438
|
-
let i = r.indexOf(
|
|
1439
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1688
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Hr, "<script async$1>"));
|
|
1689
|
+
let i = r.indexOf(Lr);
|
|
1690
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Lr}\` 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.`);
|
|
1440
1691
|
return {
|
|
1441
|
-
head: `${r.slice(0, i)}${
|
|
1442
|
-
tail: `${
|
|
1692
|
+
head: `${r.slice(0, i)}${Rr}`,
|
|
1693
|
+
tail: `${zr}${r.slice(i + 21)}`,
|
|
1443
1694
|
bootstrapModules: n
|
|
1444
1695
|
};
|
|
1445
|
-
},
|
|
1446
|
-
let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${
|
|
1447
|
-
return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${
|
|
1448
|
-
},
|
|
1696
|
+
}, Wr = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), Gr = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), Kr = (e, t) => {
|
|
1697
|
+
let n = [t.timeZone === void 0 ? "" : ` data-voltro-tz="${Gr(t.timeZone)}"`, t.renderedAt === void 0 ? "" : ` data-voltro-now="${t.renderedAt}"`].join("");
|
|
1698
|
+
return e.replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${Gr(t.lang)}"${n}`);
|
|
1699
|
+
}, qr = (e) => Kr(Wr(e.head, e.headInjection), e.documentAttrs), Jr = (e) => {
|
|
1449
1700
|
let { res: t, shell: n, documentAttrs: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1450
1701
|
if (s || !o || a === null) return;
|
|
1451
1702
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1452
1703
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1453
|
-
t.flushHeaders?.(), t.write(
|
|
1704
|
+
t.flushHeaders?.(), t.write(qr({
|
|
1454
1705
|
head: n.head,
|
|
1455
1706
|
headInjection: i(a.meta),
|
|
1456
1707
|
documentAttrs: r
|
|
1457
1708
|
}));
|
|
1458
|
-
let c = new
|
|
1709
|
+
let c = new Te();
|
|
1459
1710
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
1460
1711
|
t.end(n.tail);
|
|
1461
1712
|
}), a.stream.pipe(c);
|
|
@@ -1480,16 +1731,16 @@ import {
|
|
|
1480
1731
|
return;
|
|
1481
1732
|
}
|
|
1482
1733
|
c();
|
|
1483
|
-
},
|
|
1734
|
+
}, Yr = (e) => Array.isArray(e.preload) && e.preload.length > 0, Xr = (e, t) => typeof e == "string" ? {
|
|
1484
1735
|
tag: e,
|
|
1485
1736
|
input: {}
|
|
1486
1737
|
} : {
|
|
1487
1738
|
tag: e.tag,
|
|
1488
1739
|
input: e.input?.(t) ?? {}
|
|
1489
|
-
},
|
|
1740
|
+
}, Zr = async (e) => {
|
|
1490
1741
|
let { pageMod: t, params: n, query: r, apiName: i, seed: a, seedFailure: o, onError: s } = e;
|
|
1491
|
-
if (
|
|
1492
|
-
let { tag: t, input: c } =
|
|
1742
|
+
if (Yr(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
|
|
1743
|
+
let { tag: t, input: c } = Xr(e, n);
|
|
1493
1744
|
try {
|
|
1494
1745
|
a(i, t, c, await r(t, c));
|
|
1495
1746
|
} catch (e) {
|
|
@@ -1499,62 +1750,62 @@ import {
|
|
|
1499
1750
|
}, e);
|
|
1500
1751
|
}
|
|
1501
1752
|
}
|
|
1502
|
-
},
|
|
1753
|
+
}, Qr = (e) => a.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : o.test(e) || l.test(e) || i.test(e), $r = /* @__PURE__ */ new Set([
|
|
1503
1754
|
"node_modules",
|
|
1504
1755
|
"dist",
|
|
1505
1756
|
".framework",
|
|
1506
1757
|
".git"
|
|
1507
|
-
]),
|
|
1758
|
+
]), ei = async (e) => {
|
|
1508
1759
|
let t = [], n = async (e) => {
|
|
1509
1760
|
let r;
|
|
1510
1761
|
try {
|
|
1511
|
-
r = await
|
|
1762
|
+
r = await N.readdir(e, { withFileTypes: !0 });
|
|
1512
1763
|
} catch {
|
|
1513
1764
|
return;
|
|
1514
1765
|
}
|
|
1515
1766
|
for (let i of r) if (!(i.name.startsWith(".") && i.isDirectory())) {
|
|
1516
1767
|
if (i.isDirectory()) {
|
|
1517
|
-
if (
|
|
1768
|
+
if ($r.has(i.name)) continue;
|
|
1518
1769
|
await n(O(e, i.name));
|
|
1519
|
-
} else
|
|
1770
|
+
} else Qr(i.name) && t.push(O(e, i.name));
|
|
1520
1771
|
}
|
|
1521
1772
|
};
|
|
1522
1773
|
return await n(e), t.sort();
|
|
1523
|
-
},
|
|
1524
|
-
let t =
|
|
1525
|
-
for (let n of await
|
|
1774
|
+
}, ti = async (e) => {
|
|
1775
|
+
let t = ge("sha1");
|
|
1776
|
+
for (let n of await ei(e)) {
|
|
1526
1777
|
t.update(n.slice(e.length)), t.update("\0");
|
|
1527
1778
|
try {
|
|
1528
|
-
t.update(await
|
|
1779
|
+
t.update(await N.readFile(n));
|
|
1529
1780
|
} catch {}
|
|
1530
1781
|
t.update("\0");
|
|
1531
1782
|
}
|
|
1532
1783
|
try {
|
|
1533
|
-
t.update(await
|
|
1784
|
+
t.update(await N.readFile(O(e, "rpcGroup.generated.ts")));
|
|
1534
1785
|
} catch {}
|
|
1535
1786
|
return t.digest("hex");
|
|
1536
|
-
},
|
|
1787
|
+
}, ni = async (e) => {
|
|
1537
1788
|
if (e.length === 0) return;
|
|
1538
1789
|
let t = [];
|
|
1539
|
-
for (let n of [...e].sort()) t.push(await
|
|
1540
|
-
return
|
|
1541
|
-
},
|
|
1790
|
+
for (let n of [...e].sort()) t.push(await ti(n));
|
|
1791
|
+
return ge("sha1").update(t.join("\0")).digest("hex");
|
|
1792
|
+
}, ri = (e) => typeof e == "object" && !!e && e._tag === "VoltroMiddleware" && typeof e.run == "function", ii = ["middleware.ts", "middleware.tsx"], ai = (e) => {
|
|
1542
1793
|
let t = e.replace(/\/+$/, "");
|
|
1543
1794
|
return t === "" ? "/" : t;
|
|
1544
|
-
},
|
|
1545
|
-
let n =
|
|
1795
|
+
}, X = (e, t) => {
|
|
1796
|
+
let n = ai(e);
|
|
1546
1797
|
if (n === "/") return !0;
|
|
1547
|
-
let r =
|
|
1798
|
+
let r = ai(t);
|
|
1548
1799
|
return r === n || r.startsWith(`${n}/`);
|
|
1549
|
-
},
|
|
1800
|
+
}, oi = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, si = (e, t) => {
|
|
1550
1801
|
if (e === void 0) return !0;
|
|
1551
|
-
let n =
|
|
1552
|
-
return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) =>
|
|
1553
|
-
},
|
|
1802
|
+
let n = oi(e.under), r = e.routes ?? [];
|
|
1803
|
+
return n.length === 0 && r.length === 0 || r.includes(t) || n.some((e) => X(e, t)) ? !(e.except ?? []).some((e) => e === t || X(e, t)) : !1;
|
|
1804
|
+
}, ci = (e) => {
|
|
1554
1805
|
if (e?.assets !== !0) return [];
|
|
1555
|
-
let t =
|
|
1806
|
+
let t = oi(e.under);
|
|
1556
1807
|
return t.length > 0 ? t : (e.routes ?? []).length > 0 ? [] : ["/"];
|
|
1557
|
-
},
|
|
1808
|
+
}, li = (e, t) => ci(e).some((e) => X(e, t)) ? !(e?.except ?? []).some((e) => X(e, t)) : !1, ui = (e, t) => e.find(({ middleware: e }) => t.route === void 0 ? li(e.match, t.pathname) : si(e.match, t.route))?.middleware, di = (e, t) => {
|
|
1558
1809
|
let n = [];
|
|
1559
1810
|
for (let { exportName: r, middleware: i } of e) {
|
|
1560
1811
|
let e = i.match;
|
|
@@ -1562,13 +1813,13 @@ import {
|
|
|
1562
1813
|
kind: "dead-matcher",
|
|
1563
1814
|
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]\`.`
|
|
1564
1815
|
});
|
|
1565
|
-
if (e?.assets !== !0) for (let [i, a] of [["under",
|
|
1816
|
+
if (e?.assets !== !0) for (let [i, a] of [["under", oi(e?.under)], ["except", e?.except ?? []]]) for (let e of a) t.some((t) => X(e, t)) || n.push({
|
|
1566
1817
|
kind: "dead-matcher",
|
|
1567
1818
|
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.")
|
|
1568
1819
|
});
|
|
1569
1820
|
}
|
|
1570
1821
|
for (let r = 0; r < e.length; r += 1) for (let i = r + 1; i < e.length; i += 1) {
|
|
1571
|
-
let a = e[r], o = e[i], s = t.find((e) =>
|
|
1822
|
+
let a = e[r], o = e[i], s = t.find((e) => si(a.middleware.match, e) && si(o.middleware.match, e));
|
|
1572
1823
|
if (s !== void 0) {
|
|
1573
1824
|
n.push({
|
|
1574
1825
|
kind: "overlap",
|
|
@@ -1577,7 +1828,7 @@ import {
|
|
|
1577
1828
|
continue;
|
|
1578
1829
|
}
|
|
1579
1830
|
{
|
|
1580
|
-
let e =
|
|
1831
|
+
let e = ci(a.middleware.match), t = ci(o.middleware.match), r = e.some((e) => t.some((t) => X(e, t) || X(t, e))), i = (a.middleware.match?.except ?? []).some((e) => t.length > 0 && t.every((t) => X(e, t))) || (o.middleware.match?.except ?? []).some((t) => e.length > 0 && e.every((e) => X(t, e)));
|
|
1581
1832
|
r && !i && n.push({
|
|
1582
1833
|
kind: "overlap",
|
|
1583
1834
|
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.`
|
|
@@ -1585,10 +1836,10 @@ import {
|
|
|
1585
1836
|
}
|
|
1586
1837
|
}
|
|
1587
1838
|
return n;
|
|
1588
|
-
},
|
|
1589
|
-
let r =
|
|
1839
|
+
}, fi = (e, t) => {
|
|
1840
|
+
let r = di(e, t);
|
|
1590
1841
|
if (r.length !== 0) throw n(`middleware.ts: ${r.length} problem(s)\n\n` + r.map((e) => ` • ${e.message}`).join("\n\n"));
|
|
1591
|
-
},
|
|
1842
|
+
}, pi = (e) => {
|
|
1592
1843
|
let t = {};
|
|
1593
1844
|
if (!e) return t;
|
|
1594
1845
|
for (let n of e.split(";")) {
|
|
@@ -1602,11 +1853,11 @@ import {
|
|
|
1602
1853
|
}
|
|
1603
1854
|
}
|
|
1604
1855
|
return t;
|
|
1605
|
-
},
|
|
1856
|
+
}, mi = (e) => Object.entries(e).map(([e, t]) => `${e}=${encodeURIComponent(t)}`).join("; "), hi = /(^|[-_.])(auth[-_.]?token|session|access[-_.]?token)([-_.]|$)|^sb-.*-auth-token$/i, gi = (e) => e.httpOnly === void 0 && hi.test(e.name), _i = (e) => {
|
|
1606
1857
|
let t = [`${e.name}=${encodeURIComponent(e.value)}`];
|
|
1607
1858
|
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("; ");
|
|
1608
|
-
},
|
|
1609
|
-
for (let r of
|
|
1859
|
+
}, vi = (e) => e.length === 0 ? {} : { "set-cookie": e.map(_i) }, yi = async (e, t = (e) => import(I(e).href)) => {
|
|
1860
|
+
for (let r of ii) {
|
|
1610
1861
|
let i;
|
|
1611
1862
|
try {
|
|
1612
1863
|
i = await t(O(e, r));
|
|
@@ -1615,7 +1866,7 @@ import {
|
|
|
1615
1866
|
if (t === "ERR_MODULE_NOT_FOUND" || t === "MODULE_NOT_FOUND") continue;
|
|
1616
1867
|
throw e;
|
|
1617
1868
|
}
|
|
1618
|
-
let a = Object.entries(i ?? {}), o = a.filter((e) =>
|
|
1869
|
+
let a = Object.entries(i ?? {}), o = a.filter((e) => ri(e[1])).map(([e, t]) => ({
|
|
1619
1870
|
exportName: e,
|
|
1620
1871
|
middleware: t
|
|
1621
1872
|
}));
|
|
@@ -1633,50 +1884,78 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1633
1884
|
return o;
|
|
1634
1885
|
}
|
|
1635
1886
|
return [];
|
|
1636
|
-
},
|
|
1887
|
+
}, bi = async (e, t, n) => {
|
|
1637
1888
|
let r = {
|
|
1638
1889
|
headers: t.headers,
|
|
1639
1890
|
cookies: t.cookies,
|
|
1640
|
-
setCookies: []
|
|
1891
|
+
setCookies: [],
|
|
1892
|
+
responseHeaders: {}
|
|
1641
1893
|
};
|
|
1642
1894
|
if (e === void 0) return r;
|
|
1643
1895
|
let i = await e.run(t);
|
|
1644
1896
|
if (!i) return r;
|
|
1645
1897
|
let a = i.setCookies ?? [];
|
|
1646
|
-
if (n !== void 0) for (let e of a)
|
|
1898
|
+
if (n !== void 0) for (let e of a) gi(e) && n(e);
|
|
1647
1899
|
let o = i.headers ? {
|
|
1648
1900
|
...t.headers,
|
|
1649
1901
|
...i.headers
|
|
1650
|
-
} : { ...t.headers };
|
|
1902
|
+
} : { ...t.headers }, s = i.responseHeaders ?? {}, c = i.cspNonce === void 0 ? {} : { cspNonce: i.cspNonce };
|
|
1651
1903
|
if (a.length === 0) return {
|
|
1652
1904
|
headers: o,
|
|
1653
1905
|
cookies: t.cookies,
|
|
1654
|
-
setCookies: a
|
|
1906
|
+
setCookies: a,
|
|
1907
|
+
responseHeaders: s,
|
|
1908
|
+
...c
|
|
1655
1909
|
};
|
|
1656
|
-
let
|
|
1657
|
-
for (let e of a) e.maxAge !== void 0 && e.maxAge <= 0 ? delete
|
|
1658
|
-
return i.headers?.cookie === void 0 && (o.cookie =
|
|
1910
|
+
let l = { ...t.cookies };
|
|
1911
|
+
for (let e of a) e.maxAge !== void 0 && e.maxAge <= 0 ? delete l[e.name] : l[e.name] = e.value;
|
|
1912
|
+
return i.headers?.cookie === void 0 && (o.cookie = mi(l)), {
|
|
1659
1913
|
headers: o,
|
|
1660
|
-
cookies:
|
|
1661
|
-
setCookies: a
|
|
1914
|
+
cookies: l,
|
|
1915
|
+
setCookies: a,
|
|
1916
|
+
responseHeaders: s,
|
|
1917
|
+
...c
|
|
1662
1918
|
};
|
|
1663
|
-
},
|
|
1919
|
+
}, xi = /* @__PURE__ */ new Set(["voltro:locale"]), Si = /* @__PURE__ */ new Set(["authorization", "cookie"]), Ci = (e) => {
|
|
1920
|
+
let t = e.split(";").map((e) => e.trim()).filter((e) => {
|
|
1921
|
+
let t = e.indexOf("="), n = (t === -1 ? e : e.slice(0, t)).trim();
|
|
1922
|
+
return xi.has(n);
|
|
1923
|
+
});
|
|
1924
|
+
return t.length > 0 ? t.join("; ") : void 0;
|
|
1925
|
+
}, wi = (e) => {
|
|
1926
|
+
let t = {};
|
|
1927
|
+
for (let [n, r] of Object.entries(e)) if (!n.startsWith("x-voltro-")) {
|
|
1928
|
+
if (Si.has(n)) {
|
|
1929
|
+
if (n === "cookie") {
|
|
1930
|
+
let e = Ci(r);
|
|
1931
|
+
e !== void 0 && (t.cookie = e);
|
|
1932
|
+
}
|
|
1933
|
+
continue;
|
|
1934
|
+
}
|
|
1935
|
+
t[n] = r;
|
|
1936
|
+
}
|
|
1937
|
+
return t;
|
|
1938
|
+
}, Ti = (e) => {
|
|
1939
|
+
let t = {};
|
|
1940
|
+
for (let [n, r] of Object.entries(e)) xi.has(n) && (t[n] = r);
|
|
1941
|
+
return t;
|
|
1942
|
+
}, Z = R({ scope: "voltro:dev:web" }), Ei = R({ scope: "vite" }), Di = await (async () => {
|
|
1664
1943
|
try {
|
|
1665
|
-
let e = O(D(
|
|
1944
|
+
let e = O(D(re(import.meta.url)), "..", "package.json"), t = await N.readFile(e, "utf8");
|
|
1666
1945
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1667
1946
|
} catch {
|
|
1668
1947
|
return "0.0.0";
|
|
1669
1948
|
}
|
|
1670
|
-
})(),
|
|
1949
|
+
})(), Oi = async () => {
|
|
1671
1950
|
try {
|
|
1672
|
-
let e = D(
|
|
1673
|
-
if (
|
|
1951
|
+
let e = D(re(import.meta.url)), t = A(e, "..", "..", "devtools");
|
|
1952
|
+
if (M(O(t, "package.json"))) return t;
|
|
1674
1953
|
let n = A(e, "..", "..", "..", "devtools");
|
|
1675
|
-
return
|
|
1954
|
+
return M(O(n, "package.json")) ? n : null;
|
|
1676
1955
|
} catch {
|
|
1677
1956
|
return null;
|
|
1678
1957
|
}
|
|
1679
|
-
},
|
|
1958
|
+
}, ki = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1680
1959
|
"",
|
|
1681
1960
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1682
1961
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1686,46 +1965,44 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1686
1965
|
" await import('@voltro/devtools/styles.css')",
|
|
1687
1966
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1688
1967
|
"}"
|
|
1689
|
-
],
|
|
1968
|
+
], Ai = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], ji = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Mi = (e) => e.sentry ? [
|
|
1690
1969
|
"",
|
|
1691
1970
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1692
1971
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1693
1972
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1694
|
-
] : [],
|
|
1973
|
+
] : [], Ni = (e) => e.env ? ["import './env.public'"] : [], Pi = (e) => {
|
|
1695
1974
|
let t = [], n = A(e);
|
|
1696
1975
|
for (;;) {
|
|
1697
|
-
|
|
1976
|
+
M(O(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
1698
1977
|
let e = D(n);
|
|
1699
1978
|
if (e === n) break;
|
|
1700
1979
|
n = e;
|
|
1701
1980
|
}
|
|
1702
1981
|
return t;
|
|
1703
|
-
},
|
|
1982
|
+
}, Fi = b, Ii = (e) => {
|
|
1704
1983
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
}, Gr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Kr = (e) => e.startsWith("(") && e.endsWith(")"), qr = (e) => e.filter((e) => !Kr(e)), Jr = (e) => {
|
|
1708
|
-
let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Kr(e));
|
|
1984
|
+
}, Li = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Ri = (e) => e.startsWith("(") && e.endsWith(")"), zi = (e) => e.filter((e) => !Ri(e)), Bi = (e) => {
|
|
1985
|
+
let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Ri(e));
|
|
1709
1986
|
return t.length === 0 ? "/" : "/" + t.join("/");
|
|
1710
|
-
},
|
|
1987
|
+
}, Vi = (e) => `${e.replace(c, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Q = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, $ = async (e) => {
|
|
1711
1988
|
let t = [], n = [], r = async (e, i) => {
|
|
1712
1989
|
let a = [];
|
|
1713
1990
|
try {
|
|
1714
|
-
a = await
|
|
1991
|
+
a = await N.readdir(e, { withFileTypes: !0 });
|
|
1715
1992
|
} catch {
|
|
1716
1993
|
return;
|
|
1717
1994
|
}
|
|
1718
|
-
let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1995
|
+
let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Fi(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
|
|
1719
1996
|
if (l.some((e) => s.has(e))) {
|
|
1720
1997
|
let t = u.has("layout.tsx"), r = !1;
|
|
1721
1998
|
if (t) try {
|
|
1722
|
-
let t = await
|
|
1723
|
-
r =
|
|
1999
|
+
let t = await N.readFile(O(e, "layout.tsx"), "utf8");
|
|
2000
|
+
r = Li.test(t);
|
|
1724
2001
|
} catch {}
|
|
1725
2002
|
n.push({
|
|
1726
2003
|
dir: d,
|
|
1727
2004
|
chain: i,
|
|
1728
|
-
contributesToUrl: i.length === 0 || !
|
|
2005
|
+
contributesToUrl: i.length === 0 || !Ri(i[i.length - 1]),
|
|
1729
2006
|
hasLayout: t,
|
|
1730
2007
|
hasLayoutLoader: r,
|
|
1731
2008
|
hasError: u.has("error.tsx"),
|
|
@@ -1739,8 +2016,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1739
2016
|
let n = d ? `${d}/${e}` : e;
|
|
1740
2017
|
t.push({
|
|
1741
2018
|
file: n,
|
|
1742
|
-
pattern:
|
|
1743
|
-
ident:
|
|
2019
|
+
pattern: Bi(n),
|
|
2020
|
+
ident: Vi(n),
|
|
1744
2021
|
dirChain: i
|
|
1745
2022
|
});
|
|
1746
2023
|
}
|
|
@@ -1759,14 +2036,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1759
2036
|
dirs: a,
|
|
1760
2037
|
orphanedSpecials: o
|
|
1761
2038
|
};
|
|
1762
|
-
},
|
|
2039
|
+
}, Hi = (e, t) => {
|
|
1763
2040
|
let n = [];
|
|
1764
2041
|
for (let r = 0; r <= t.length; r++) {
|
|
1765
2042
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1766
2043
|
a && n.push(a);
|
|
1767
2044
|
}
|
|
1768
2045
|
return n;
|
|
1769
|
-
},
|
|
2046
|
+
}, Ui = async (e) => {
|
|
1770
2047
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1771
2048
|
return {
|
|
1772
2049
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1790,10 +2067,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1790
2067
|
})),
|
|
1791
2068
|
segmentLoaderData: o
|
|
1792
2069
|
};
|
|
1793
|
-
},
|
|
1794
|
-
let t =
|
|
2070
|
+
}, Wi = (e) => {
|
|
2071
|
+
let t = zi(e);
|
|
1795
2072
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1796
|
-
},
|
|
2073
|
+
}, Gi = [
|
|
1797
2074
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1798
2075
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1799
2076
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1886,7 +2163,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1886
2163
|
" _vdtErrorStart('Build error')",
|
|
1887
2164
|
" })",
|
|
1888
2165
|
"}"
|
|
1889
|
-
].join("\n"),
|
|
2166
|
+
].join("\n"), Ki = (e) => {
|
|
1890
2167
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1891
2168
|
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, "\\$&"));
|
|
1892
2169
|
let a = i.join("/");
|
|
@@ -1895,8 +2172,8 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1895
2172
|
paramNames: t,
|
|
1896
2173
|
priority: n
|
|
1897
2174
|
};
|
|
1898
|
-
},
|
|
1899
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
2175
|
+
}, qi = (e) => e.map((e) => {
|
|
2176
|
+
let { regex: t, paramNames: n, priority: r } = Ki(e.pattern);
|
|
1900
2177
|
return {
|
|
1901
2178
|
pattern: e.pattern,
|
|
1902
2179
|
file: e.file,
|
|
@@ -1905,7 +2182,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1905
2182
|
paramNames: n,
|
|
1906
2183
|
priority: r
|
|
1907
2184
|
};
|
|
1908
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
2185
|
+
}).slice().sort((e, t) => e.priority - t.priority), Ji = (e, t) => {
|
|
1909
2186
|
for (let n of t) {
|
|
1910
2187
|
let t = n.regex.exec(e);
|
|
1911
2188
|
if (!t) continue;
|
|
@@ -1917,9 +2194,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1917
2194
|
};
|
|
1918
2195
|
}
|
|
1919
2196
|
return null;
|
|
1920
|
-
},
|
|
2197
|
+
}, Yi = Le, Xi = async (e) => {
|
|
1921
2198
|
try {
|
|
1922
|
-
let t = await import(
|
|
2199
|
+
let t = await import(I(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
|
|
1923
2200
|
kind: "api",
|
|
1924
2201
|
configPort: typeof n == "number" ? n : void 0,
|
|
1925
2202
|
env: {}
|
|
@@ -1933,7 +2210,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1933
2210
|
kind: "api",
|
|
1934
2211
|
env: {}
|
|
1935
2212
|
}).port };
|
|
1936
|
-
},
|
|
2213
|
+
}, Zi = (e, t) => ({
|
|
1937
2214
|
name: e,
|
|
1938
2215
|
pkg: t.package,
|
|
1939
2216
|
browserWsUrl: t.url,
|
|
@@ -1941,7 +2218,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1941
2218
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1942
2219
|
...t.headers ? { headers: t.headers } : {},
|
|
1943
2220
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1944
|
-
}),
|
|
2221
|
+
}), Qi = (e, t, n) => {
|
|
1945
2222
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1946
2223
|
return {
|
|
1947
2224
|
name: e,
|
|
@@ -1953,7 +2230,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1953
2230
|
...t.headers ? { headers: t.headers } : {},
|
|
1954
2231
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1955
2232
|
};
|
|
1956
|
-
},
|
|
2233
|
+
}, $i = (e) => {
|
|
1957
2234
|
let t = /* @__PURE__ */ new Map();
|
|
1958
2235
|
for (let n of e) {
|
|
1959
2236
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1961,43 +2238,43 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
1961
2238
|
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>.`);
|
|
1962
2239
|
t.set(n.browserWsUrl, n.name);
|
|
1963
2240
|
}
|
|
1964
|
-
},
|
|
2241
|
+
}, ea = async (e, t) => {
|
|
1965
2242
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1966
2243
|
for (let [t, i] of n) {
|
|
1967
2244
|
if (i.url) {
|
|
1968
|
-
r.push(
|
|
2245
|
+
r.push(Zi(t, i));
|
|
1969
2246
|
continue;
|
|
1970
2247
|
}
|
|
1971
|
-
let n = await
|
|
2248
|
+
let n = await Yi(e, i.package);
|
|
1972
2249
|
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.`);
|
|
1973
|
-
r.push(
|
|
2250
|
+
r.push(Qi(t, i, await Xi(n)));
|
|
1974
2251
|
}
|
|
1975
|
-
return
|
|
1976
|
-
},
|
|
2252
|
+
return $i(r), r;
|
|
2253
|
+
}, ta = (e) => {
|
|
1977
2254
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1978
2255
|
let t = new URL(e);
|
|
1979
2256
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1980
2257
|
} catch {
|
|
1981
2258
|
return;
|
|
1982
2259
|
}
|
|
1983
|
-
},
|
|
2260
|
+
}, na = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, ra = (e) => process.env[na(e)] ?? process.env.VOLTRO_API_ORIGIN, ia = (e, t) => {
|
|
1984
2261
|
if (!e) return;
|
|
1985
|
-
let n =
|
|
2262
|
+
let n = ra(e.name) ?? e.serverOrigin;
|
|
1986
2263
|
if (n) {
|
|
1987
|
-
let e =
|
|
2264
|
+
let e = ta(n);
|
|
1988
2265
|
if (e) return e;
|
|
1989
2266
|
}
|
|
1990
2267
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1991
|
-
let t =
|
|
2268
|
+
let t = ta(e.proxyTarget);
|
|
1992
2269
|
if (t) return t;
|
|
1993
2270
|
}
|
|
1994
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1995
|
-
},
|
|
2271
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return ta(e.browserWsUrl);
|
|
2272
|
+
}, aa = (e, t, n) => {
|
|
1996
2273
|
if (!e) {
|
|
1997
2274
|
if (n?.apiName === void 0) return;
|
|
1998
2275
|
let e = n.apiName;
|
|
1999
2276
|
return async () => {
|
|
2000
|
-
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 ${
|
|
2277
|
+
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 ${na(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.`);
|
|
2001
2278
|
};
|
|
2002
2279
|
}
|
|
2003
2280
|
return async (r, i) => {
|
|
@@ -2020,7 +2297,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2020
2297
|
});
|
|
2021
2298
|
} catch (t) {
|
|
2022
2299
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
2023
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2300
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${na(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 });
|
|
2024
2301
|
}
|
|
2025
2302
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
2026
2303
|
let s = await o.json();
|
|
@@ -2050,8 +2327,20 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2050
2327
|
}
|
|
2051
2328
|
if (u) return l;
|
|
2052
2329
|
};
|
|
2053
|
-
},
|
|
2054
|
-
let
|
|
2330
|
+
}, oa = (e, t) => {
|
|
2331
|
+
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'`);
|
|
2332
|
+
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"));
|
|
2333
|
+
let a = (e) => {
|
|
2334
|
+
let t = [`group: ${n(e.name)}`];
|
|
2335
|
+
return t.push(`descriptors: ${r(e.name)}`), t.push(`wsUrl: ${JSON.stringify(e.browserWsUrl)}`), e.hasAuthHeaders ? t.push(`headers: __voltroAuthHeaders?.[${JSON.stringify(e.name)}]?.authHeaders`) : e.headers && t.push(`headers: ${JSON.stringify(e.headers)}`), t;
|
|
2336
|
+
};
|
|
2337
|
+
return {
|
|
2338
|
+
imports: i,
|
|
2339
|
+
entryLines: e.map((e) => ` ${JSON.stringify(e.name)}: { ${a(e).join(", ")} },`),
|
|
2340
|
+
providerEntryLines: e.map((e) => ` { name: ${JSON.stringify(e.name)}, ${a(e).join(", ")} },`)
|
|
2341
|
+
};
|
|
2342
|
+
}, sa = async (e, t, n, r = {}) => {
|
|
2343
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = M(O(e, "node_modules", "@voltro", "devtools", "package.json")) || await Oi() !== null, s = t.theme === "system" ? [
|
|
2055
2344
|
" <script>",
|
|
2056
2345
|
" (function () {",
|
|
2057
2346
|
" var root = document.documentElement",
|
|
@@ -2102,53 +2391,48 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2102
2391
|
" </body>",
|
|
2103
2392
|
"</html>",
|
|
2104
2393
|
""
|
|
2105
|
-
].join("\n"), u = O(e, "src", "pages"), { pages: d, dirs: f, orphanedSpecials: p } = await
|
|
2394
|
+
].join("\n"), u = O(e, "src", "pages"), { pages: d, dirs: f, orphanedSpecials: p } = await $(u);
|
|
2106
2395
|
await y(u, d);
|
|
2107
|
-
for (let e of p)
|
|
2108
|
-
let
|
|
2109
|
-
n.some((e) => e.hasAuthHeaders) && (g.push("import __voltroAppConfig from '../app.config'"), g.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
|
|
2110
|
-
let _ = n.map((e) => {
|
|
2111
|
-
let t = [`group: ${m(e.name)}`];
|
|
2112
|
-
return t.push(`descriptors: ${h(e.name)}`), t.push(`wsUrl: ${JSON.stringify(e.browserWsUrl)}`), e.hasAuthHeaders ? t.push(`headers: __voltroAuthHeaders?.[${JSON.stringify(e.name)}]?.authHeaders`) : e.headers && t.push(`headers: ${JSON.stringify(e.headers)}`), ` ${JSON.stringify(e.name)}: { ${t.join(", ")} },`;
|
|
2113
|
-
}), v, b, x;
|
|
2396
|
+
for (let e of p) Z.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
|
|
2397
|
+
let { imports: m, entryLines: h } = oa(n, "../app.config"), g, _, v;
|
|
2114
2398
|
if (d.length > 0) {
|
|
2115
2399
|
let n = d.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
|
|
2116
2400
|
for (let e of f) {
|
|
2117
2401
|
let t = e.dir === "" ? "../src/pages" : `../src/pages/${e.dir}`;
|
|
2118
|
-
e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${
|
|
2402
|
+
e.hasLayout && e.hasLayoutLoader ? r.push(`import * as ${Q(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && r.push(`import ${Q(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && r.push(`import ${Q(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && r.push(`import ${Q(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && r.push(`import ${Q(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2119
2403
|
}
|
|
2120
2404
|
let i = d.map((e) => {
|
|
2121
|
-
let t =
|
|
2405
|
+
let t = Hi(f, e.dirChain).map((e) => {
|
|
2122
2406
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2123
2407
|
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(", ")} }`;
|
|
2124
2408
|
}).join(",\n");
|
|
2125
2409
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2126
2410
|
}), a = f.filter((e) => e.hasNotFound).map((e) => {
|
|
2127
|
-
let t =
|
|
2411
|
+
let t = Wi(e.chain), n = Hi(f, e.chain).map((e) => {
|
|
2128
2412
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2129
2413
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2130
2414
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
2131
2415
|
return ` {\n prefix: ${JSON.stringify(t)},\n Component: refs.notFounds[${JSON.stringify(e.dir)}],${r}\n },`;
|
|
2132
|
-
}), s = [], c = [], l = [], u = [], p = [],
|
|
2416
|
+
}), s = [], c = [], l = [], u = [], p = [], y = [];
|
|
2133
2417
|
for (let e of f) {
|
|
2134
2418
|
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);
|
|
2135
|
-
e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${
|
|
2419
|
+
e.hasLayout && e.hasLayoutLoader ? (c.push(` ${a}: ${Q(e.dir, "Layout")}Mod.default,`), l.push(` ${a}: ${Q(e.dir, "Layout")}Mod.loader,`), s.push({
|
|
2136
2420
|
relPath: t,
|
|
2137
2421
|
kind: "layout",
|
|
2138
2422
|
slotKey: e.dir
|
|
2139
|
-
})) : e.hasLayout && (c.push(` ${a}: ${
|
|
2423
|
+
})) : e.hasLayout && (c.push(` ${a}: ${Q(e.dir, "Layout")},`), s.push({
|
|
2140
2424
|
relPath: t,
|
|
2141
2425
|
kind: "layout",
|
|
2142
2426
|
slotKey: e.dir
|
|
2143
|
-
})), e.hasError && (u.push(` ${a}: ${
|
|
2427
|
+
})), e.hasError && (u.push(` ${a}: ${Q(e.dir, "Error")},`), s.push({
|
|
2144
2428
|
relPath: n,
|
|
2145
2429
|
kind: "error",
|
|
2146
2430
|
slotKey: e.dir
|
|
2147
|
-
})), e.hasPending && (p.push(` ${a}: ${
|
|
2431
|
+
})), e.hasPending && (p.push(` ${a}: ${Q(e.dir, "Pending")},`), s.push({
|
|
2148
2432
|
relPath: r,
|
|
2149
2433
|
kind: "pending",
|
|
2150
2434
|
slotKey: e.dir
|
|
2151
|
-
})), e.hasNotFound && (
|
|
2435
|
+
})), e.hasNotFound && (y.push(` ${a}: ${Q(e.dir, "NotFound")},`), s.push({
|
|
2152
2436
|
relPath: i,
|
|
2153
2437
|
kind: "notFound",
|
|
2154
2438
|
slotKey: e.dir
|
|
@@ -2159,18 +2443,18 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2159
2443
|
kind: "page",
|
|
2160
2444
|
slotKey: e.pattern
|
|
2161
2445
|
});
|
|
2162
|
-
let
|
|
2446
|
+
let b = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
|
|
2163
2447
|
let n = JSON.stringify(e.slotKey);
|
|
2164
2448
|
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 }`;
|
|
2165
|
-
}), S = t.locales ?? [], C = S.length > 0 && S.every((t) =>
|
|
2166
|
-
if (S.length > 0 && !C &&
|
|
2167
|
-
let
|
|
2449
|
+
}), S = t.locales ?? [], C = S.length > 0 && S.every((t) => M(O(e, "src", "locales", `${t}.ts`)) || M(O(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en", E = t.router?.viewTransitions === !0 ? " viewTransitions" : "";
|
|
2450
|
+
if (S.length > 0 && !C && Z.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(", ")}]`);
|
|
2451
|
+
let D = w ? [
|
|
2168
2452
|
"import { I18nProvider } from '@voltro/i18n'",
|
|
2169
2453
|
"import { resolveLocale } from '@voltro/i18n/server'",
|
|
2170
2454
|
"import { useServerRequest } from '@voltro/web'",
|
|
2171
2455
|
...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
|
|
2172
2456
|
] : [];
|
|
2173
|
-
|
|
2457
|
+
_ = [
|
|
2174
2458
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2175
2459
|
"// Routes + per-page chain + not-found scopes assembled from src/pages/.",
|
|
2176
2460
|
"//",
|
|
@@ -2216,7 +2500,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2216
2500
|
...p,
|
|
2217
2501
|
" },",
|
|
2218
2502
|
" notFounds: {",
|
|
2219
|
-
...
|
|
2503
|
+
...y,
|
|
2220
2504
|
" },",
|
|
2221
2505
|
" pages: {},",
|
|
2222
2506
|
"}",
|
|
@@ -2281,17 +2565,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2281
2565
|
"if (import.meta.hot) {",
|
|
2282
2566
|
" import.meta.hot.accept(",
|
|
2283
2567
|
" [",
|
|
2284
|
-
...
|
|
2568
|
+
...b,
|
|
2285
2569
|
" ],",
|
|
2286
2570
|
" (newMods: Array<Record<string, unknown> | undefined>) => {",
|
|
2287
2571
|
" let changed = false",
|
|
2288
|
-
...
|
|
2572
|
+
...x,
|
|
2289
2573
|
" if (changed) bump()",
|
|
2290
2574
|
" },",
|
|
2291
2575
|
" )",
|
|
2292
2576
|
"}",
|
|
2293
2577
|
""
|
|
2294
|
-
].join("\n"),
|
|
2578
|
+
].join("\n"), g = [
|
|
2295
2579
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2296
2580
|
"// The app's root component. It exports `App` and NOTHING ELSE: react-refresh",
|
|
2297
2581
|
"// only accepts a module whose every export is a component, and a module it",
|
|
@@ -2302,7 +2586,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2302
2586
|
"",
|
|
2303
2587
|
"import { useMemo, useSyncExternalStore } from 'react'",
|
|
2304
2588
|
"import { Router } from '@voltro/web'",
|
|
2305
|
-
...
|
|
2589
|
+
...D,
|
|
2306
2590
|
"import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
|
|
2307
2591
|
"",
|
|
2308
2592
|
...w ? [
|
|
@@ -2400,26 +2684,26 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2400
2684
|
" defaultLocale={I18N_DEFAULT}",
|
|
2401
2685
|
" {...published}",
|
|
2402
2686
|
" >",
|
|
2403
|
-
|
|
2687
|
+
` <Router routes={routes} notFounds={notFounds}${E} />`,
|
|
2404
2688
|
" </I18nProvider>",
|
|
2405
2689
|
" )"
|
|
2406
|
-
] : [
|
|
2690
|
+
] : [` return <Router routes={routes} notFounds={notFounds}${E} />`],
|
|
2407
2691
|
"}",
|
|
2408
2692
|
""
|
|
2409
|
-
].join("\n"),
|
|
2693
|
+
].join("\n"), v = [
|
|
2410
2694
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2411
2695
|
"// Entry: imports the generated App component and calls mount() with the",
|
|
2412
2696
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2413
2697
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2414
2698
|
"",
|
|
2415
|
-
...
|
|
2699
|
+
...Ni(t),
|
|
2416
2700
|
"import { mount } from '@voltro/web'",
|
|
2417
|
-
...
|
|
2701
|
+
...m,
|
|
2418
2702
|
"import { App } from './app'",
|
|
2419
2703
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2420
|
-
...
|
|
2421
|
-
...
|
|
2422
|
-
...
|
|
2704
|
+
...ji(t),
|
|
2705
|
+
...ki(t, o),
|
|
2706
|
+
...Mi(t),
|
|
2423
2707
|
"",
|
|
2424
2708
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2425
2709
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2434,83 +2718,83 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2434
2718
|
"",
|
|
2435
2719
|
"mount(App, {",
|
|
2436
2720
|
" apis: {",
|
|
2437
|
-
...
|
|
2721
|
+
...h,
|
|
2438
2722
|
" },",
|
|
2439
|
-
...
|
|
2723
|
+
...Ai(t, o),
|
|
2440
2724
|
"})",
|
|
2441
2725
|
"",
|
|
2442
|
-
|
|
2726
|
+
Gi
|
|
2443
2727
|
].join("\n");
|
|
2444
|
-
} else
|
|
2728
|
+
} else g = "", _ = "", v = [
|
|
2445
2729
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2446
2730
|
"// The user's root component lives at ../src/App.tsx; this file imports it",
|
|
2447
2731
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2448
2732
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2449
2733
|
"",
|
|
2450
|
-
...
|
|
2734
|
+
...Ni(t),
|
|
2451
2735
|
"import { mount } from '@voltro/web'",
|
|
2452
|
-
...
|
|
2736
|
+
...m,
|
|
2453
2737
|
"import App from '../src/App'",
|
|
2454
|
-
...
|
|
2455
|
-
...
|
|
2456
|
-
...
|
|
2738
|
+
...ji(t),
|
|
2739
|
+
...ki(t, o),
|
|
2740
|
+
...Mi(t),
|
|
2457
2741
|
"",
|
|
2458
2742
|
"mount(App, {",
|
|
2459
2743
|
" apis: {",
|
|
2460
|
-
...
|
|
2744
|
+
...h,
|
|
2461
2745
|
" },",
|
|
2462
|
-
...
|
|
2746
|
+
...Ai(t, o),
|
|
2463
2747
|
"})",
|
|
2464
2748
|
"",
|
|
2465
|
-
|
|
2749
|
+
Gi
|
|
2466
2750
|
].join("\n");
|
|
2467
|
-
let
|
|
2468
|
-
await
|
|
2469
|
-
let
|
|
2751
|
+
let b = O(e, ".framework");
|
|
2752
|
+
await N.mkdir(b, { recursive: !0 }), t.env ? await Ne(b, r) : await N.rm(O(b, "env.public.ts"), { force: !0 }), await N.writeFile(O(b, "index.html"), l, "utf8"), await N.writeFile(O(b, "main.tsx"), v, "utf8"), g ? (await N.writeFile(O(b, "app.tsx"), g, "utf8"), await N.writeFile(O(b, "routeTable.ts"), _, "utf8")) : (await N.rm(O(b, "app.tsx"), { force: !0 }), await N.rm(O(b, "routeTable.ts"), { force: !0 }));
|
|
2753
|
+
let x = O(e, ".gitignore"), S = "";
|
|
2470
2754
|
try {
|
|
2471
|
-
|
|
2755
|
+
S = await N.readFile(x, "utf8");
|
|
2472
2756
|
} catch {}
|
|
2473
|
-
let
|
|
2474
|
-
if (
|
|
2475
|
-
let e =
|
|
2757
|
+
let C = ["/.framework/"], w = new Set(S.split("\n").map((e) => e.trim())), T = C.filter((e) => !w.has(e));
|
|
2758
|
+
if (T.length > 0) {
|
|
2759
|
+
let e = S === "" || S.endsWith("\n") ? "" : "\n";
|
|
2476
2760
|
try {
|
|
2477
|
-
await
|
|
2761
|
+
await N.appendFile(x, `${e}${T.join("\n")}\n`, "utf8");
|
|
2478
2762
|
} catch (e) {
|
|
2479
|
-
|
|
2763
|
+
Z.warn(`could not add ${T.join(", ")} to ${x} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2480
2764
|
}
|
|
2481
2765
|
}
|
|
2482
|
-
},
|
|
2766
|
+
}, ca = async (e, t) => {
|
|
2483
2767
|
try {
|
|
2484
2768
|
let n = D(e), r = O(n, "project.json");
|
|
2485
|
-
if (!
|
|
2486
|
-
let i = await
|
|
2769
|
+
if (!M(r)) return;
|
|
2770
|
+
let i = await N.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
|
|
2487
2771
|
for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
|
|
2488
2772
|
if (s.length === 0) return;
|
|
2489
|
-
|
|
2773
|
+
Z.warn("sibling app(s) claim the same port — only one boots", {
|
|
2490
2774
|
port: t,
|
|
2491
2775
|
conflicts: s,
|
|
2492
2776
|
projectJson: r
|
|
2493
2777
|
});
|
|
2494
2778
|
} catch {}
|
|
2495
|
-
},
|
|
2496
|
-
let n =
|
|
2779
|
+
}, la = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), ua = async (e, t = {}) => {
|
|
2780
|
+
let n = la(e), r = t.preferSource !== !0 && M(n) ? n : O(e, "app.config.ts");
|
|
2497
2781
|
try {
|
|
2498
|
-
let e = (await import(
|
|
2782
|
+
let e = (await import(I(r).href)).default;
|
|
2499
2783
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2500
2784
|
} catch {
|
|
2501
2785
|
return null;
|
|
2502
2786
|
}
|
|
2503
|
-
},
|
|
2504
|
-
let n = await
|
|
2787
|
+
}, da = async (e) => {
|
|
2788
|
+
let n = await ua(e, { preferSource: !0 });
|
|
2505
2789
|
if (!n) return {
|
|
2506
2790
|
ran: !1,
|
|
2507
2791
|
exitCode: 0
|
|
2508
2792
|
};
|
|
2509
|
-
|
|
2510
|
-
let i =
|
|
2511
|
-
|
|
2512
|
-
let a = await
|
|
2513
|
-
for (let e of a)
|
|
2793
|
+
ir();
|
|
2794
|
+
let i = vn();
|
|
2795
|
+
In(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), nt(e, Z);
|
|
2796
|
+
let a = await ea(e, n);
|
|
2797
|
+
for (let e of a) Z.info("api wired", {
|
|
2514
2798
|
name: e.name,
|
|
2515
2799
|
pkg: e.pkg,
|
|
2516
2800
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
@@ -2518,17 +2802,17 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2518
2802
|
g(e).then((e) => {
|
|
2519
2803
|
for (let t of e.files) if (t.action === "created") {
|
|
2520
2804
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2521
|
-
|
|
2805
|
+
Z.info(`${e} seeded`, { path: t.path });
|
|
2522
2806
|
}
|
|
2523
2807
|
}).catch(() => {});
|
|
2524
|
-
let { resolved: o } = await
|
|
2808
|
+
let { resolved: o } = await Pe({
|
|
2525
2809
|
rawEnv: n.env,
|
|
2526
2810
|
appType: "web",
|
|
2527
2811
|
root: e,
|
|
2528
|
-
log:
|
|
2812
|
+
log: Z,
|
|
2529
2813
|
generateTypes: !0
|
|
2530
2814
|
}), s = o.publicValues;
|
|
2531
|
-
await
|
|
2815
|
+
await sa(e, n, a, s), Z.debug("generated framework entry files", { files: [
|
|
2532
2816
|
"index.html",
|
|
2533
2817
|
".framework/main.tsx",
|
|
2534
2818
|
...n.env ? [".framework/env.public.ts"] : []
|
|
@@ -2537,9 +2821,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2537
2821
|
kind: "web",
|
|
2538
2822
|
configPort: n.port,
|
|
2539
2823
|
env: process.env,
|
|
2540
|
-
dashboardPin: process.env[
|
|
2824
|
+
dashboardPin: process.env[br] === "1"
|
|
2541
2825
|
});
|
|
2542
|
-
for (let e of c.warnings)
|
|
2826
|
+
for (let e of c.warnings) Z.warn(e);
|
|
2543
2827
|
let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
|
|
2544
2828
|
await x({
|
|
2545
2829
|
id: b,
|
|
@@ -2549,22 +2833,22 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2549
2833
|
pid: process.pid,
|
|
2550
2834
|
status: "booting",
|
|
2551
2835
|
logFile: D.path
|
|
2552
|
-
}).catch(() => {}), await
|
|
2553
|
-
let { pages:
|
|
2836
|
+
}).catch(() => {}), await ca(e, l);
|
|
2837
|
+
let { pages: j, dirs: P } = await $(O(e, "src", "pages")), F = {
|
|
2554
2838
|
dirs: P,
|
|
2555
|
-
ssrRoutes:
|
|
2839
|
+
ssrRoutes: qi(j)
|
|
2556
2840
|
}, ee = P.map((e) => ({
|
|
2557
2841
|
dir: e.dir,
|
|
2558
2842
|
hasLayout: e.hasLayout,
|
|
2559
2843
|
hasError: e.hasError,
|
|
2560
2844
|
hasPending: e.hasPending,
|
|
2561
2845
|
hasNotFound: e.hasNotFound
|
|
2562
|
-
})),
|
|
2846
|
+
})), te = await un({
|
|
2563
2847
|
appRoot: e,
|
|
2564
|
-
pages:
|
|
2848
|
+
pages: j
|
|
2565
2849
|
});
|
|
2566
|
-
|
|
2567
|
-
let
|
|
2850
|
+
te.wrote && Z.debug("routes codegen wrote", { path: k(e, te.path) });
|
|
2851
|
+
let ne = await De("vite", () => import("vite")), re = (await import("@vitejs/plugin-react")).default, I = (await import("@tailwindcss/vite")).default, L = O(e, ".framework"), R = O(e, "src"), ie = /* @__PURE__ */ new Set([
|
|
2568
2852
|
".framework",
|
|
2569
2853
|
"node_modules",
|
|
2570
2854
|
"dist",
|
|
@@ -2572,64 +2856,64 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2572
2856
|
".vite",
|
|
2573
2857
|
".turbo",
|
|
2574
2858
|
".cache"
|
|
2575
|
-
]),
|
|
2859
|
+
]), B = {
|
|
2576
2860
|
name: "framework:watch-app-sources",
|
|
2577
2861
|
async configureServer(t) {
|
|
2578
2862
|
try {
|
|
2579
|
-
let n = (await
|
|
2863
|
+
let n = (await N.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !ie.has(e.name));
|
|
2580
2864
|
for (let r of n) t.watcher.add(O(e, r.name));
|
|
2581
|
-
n.length === 0 && t.watcher.add(
|
|
2865
|
+
n.length === 0 && t.watcher.add(R);
|
|
2582
2866
|
} catch {
|
|
2583
|
-
t.watcher.add(
|
|
2867
|
+
t.watcher.add(R);
|
|
2584
2868
|
}
|
|
2585
|
-
for (let n of await
|
|
2869
|
+
for (let n of await Re(e)) t.watcher.add(n.dir);
|
|
2586
2870
|
}
|
|
2587
|
-
},
|
|
2871
|
+
}, V = O(e, "src", "pages"), ae = (e) => e.endsWith(".tsx") && (e === V || e.startsWith(V + "/")), oe = (e) => e === V || e.startsWith(V + "/"), H = async (t) => {
|
|
2588
2872
|
try {
|
|
2589
2873
|
let r = Date.now();
|
|
2590
|
-
await
|
|
2591
|
-
let { pages: i, dirs: o } = await
|
|
2592
|
-
await
|
|
2874
|
+
await sa(e, n, a, s);
|
|
2875
|
+
let { pages: i, dirs: o } = await $(V);
|
|
2876
|
+
await un({
|
|
2593
2877
|
appRoot: e,
|
|
2594
2878
|
pages: i
|
|
2595
|
-
}), F.dirs = o, F.ssrRoutes =
|
|
2879
|
+
}), F.dirs = o, F.ssrRoutes = qi(i), Z.info("page tree regenerated", {
|
|
2596
2880
|
reason: t,
|
|
2597
2881
|
ms: Date.now() - r,
|
|
2598
2882
|
routes: F.ssrRoutes.length
|
|
2599
2883
|
});
|
|
2600
|
-
for (let e of
|
|
2884
|
+
for (let e of di(J, F.ssrRoutes.map((e) => e.pattern))) Z.error(`middleware.ts: ${e.message}`);
|
|
2601
2885
|
} catch (e) {
|
|
2602
|
-
|
|
2886
|
+
Z.error("page tree regen failed", { reason: t }, e);
|
|
2603
2887
|
}
|
|
2604
|
-
},
|
|
2888
|
+
}, se = {
|
|
2605
2889
|
name: "framework:regenerate-on-page-tree-change",
|
|
2606
2890
|
configureServer(t) {
|
|
2607
2891
|
let n = null, r = [], i = (e) => {
|
|
2608
2892
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
2609
2893
|
n = null;
|
|
2610
2894
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
2611
|
-
r.length = 0,
|
|
2895
|
+
r.length = 0, H(e);
|
|
2612
2896
|
}, 50);
|
|
2613
2897
|
};
|
|
2614
2898
|
t.watcher.on("add", (t) => {
|
|
2615
|
-
|
|
2899
|
+
ae(t) && i(`add ${k(e, t)}`);
|
|
2616
2900
|
}), t.watcher.on("unlink", (t) => {
|
|
2617
|
-
|
|
2901
|
+
ae(t) && i(`unlink ${k(e, t)}`);
|
|
2618
2902
|
}), t.watcher.on("addDir", (t) => {
|
|
2619
|
-
|
|
2903
|
+
oe(t) && i(`addDir ${k(e, t)}`);
|
|
2620
2904
|
}), t.watcher.on("unlinkDir", (t) => {
|
|
2621
|
-
|
|
2905
|
+
oe(t) && i(`unlinkDir ${k(e, t)}`);
|
|
2622
2906
|
});
|
|
2623
2907
|
}
|
|
2624
|
-
},
|
|
2625
|
-
if (!
|
|
2908
|
+
}, U = O(e, "app.config.ts"), ce = (e) => {
|
|
2909
|
+
if (!ue(e.env)) return "";
|
|
2626
2910
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
2627
2911
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
2628
|
-
},
|
|
2912
|
+
}, le = (e, t) => {
|
|
2629
2913
|
let n = [];
|
|
2630
|
-
return e.port !== t.port && n.push(`port ${e.port ?? "(default)"} → ${t.port ?? "(default)"}`), JSON.stringify(e.proxies) !== JSON.stringify(t.proxies) && n.push("proxies"), JSON.stringify(e.allowedHosts) !== JSON.stringify(t.allowedHosts) && n.push("allowedHosts"), JSON.stringify(e.apis) !== JSON.stringify(t.apis) && n.push("apis"),
|
|
2631
|
-
},
|
|
2632
|
-
let e =
|
|
2914
|
+
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"), ce(e) !== ce(t) && n.push("env"), n;
|
|
2915
|
+
}, W = n, de = A(U), fe = () => {
|
|
2916
|
+
let e = _e(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
2633
2917
|
stdio: "inherit",
|
|
2634
2918
|
env: process.env,
|
|
2635
2919
|
cwd: process.cwd()
|
|
@@ -2639,29 +2923,29 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2639
2923
|
process.on("SIGINT", n), process.on("SIGTERM", r), e.on("exit", (e, t) => {
|
|
2640
2924
|
process.off("SIGINT", n), process.off("SIGTERM", r), t ? process.kill(process.pid, t) : process.exit(e ?? 0);
|
|
2641
2925
|
}), e.on("error", (e) => {
|
|
2642
|
-
|
|
2926
|
+
Z.error("restart spawn failed", {}, e), process.exit(1);
|
|
2643
2927
|
});
|
|
2644
|
-
},
|
|
2928
|
+
}, pe = {
|
|
2645
2929
|
name: "framework:watch-app-config",
|
|
2646
2930
|
async configureServer(n) {
|
|
2647
|
-
n.watcher.add(
|
|
2648
|
-
let r =
|
|
2931
|
+
n.watcher.add(U), Z.info("watching app.config.ts for changes", { path: k(e, U) });
|
|
2932
|
+
let r = ii.map((t) => O(e, t)), i = new Set(r.map((e) => A(e)));
|
|
2649
2933
|
for (let e of r) n.watcher.add(e);
|
|
2650
2934
|
n.watcher.on("all", (t, r) => {
|
|
2651
|
-
i.has(A(r)) && (
|
|
2652
|
-
|
|
2935
|
+
i.has(A(r)) && (Z.warn("middleware.ts changed — restarting (it is loaded once per boot)", { path: k(e, r) }), n.close().catch(() => void 0).then(() => {
|
|
2936
|
+
fe();
|
|
2653
2937
|
}));
|
|
2654
2938
|
});
|
|
2655
2939
|
let a = async () => {
|
|
2656
2940
|
try {
|
|
2657
2941
|
try {
|
|
2658
|
-
let e = n.moduleGraph.getModuleById(
|
|
2942
|
+
let e = n.moduleGraph.getModuleById(U);
|
|
2659
2943
|
e && n.moduleGraph.invalidateModule(e);
|
|
2660
2944
|
} catch {}
|
|
2661
|
-
let e = (await n.ssrLoadModule(
|
|
2662
|
-
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (
|
|
2945
|
+
let e = (await n.ssrLoadModule(U, { fixStacktrace: !0 })).default;
|
|
2946
|
+
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : (Z.warn("app.config.ts re-load returned wrong shape", { hasDefault: e !== void 0 }), null);
|
|
2663
2947
|
} catch (e) {
|
|
2664
|
-
return
|
|
2948
|
+
return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
2665
2949
|
}
|
|
2666
2950
|
}, o = null, s = () => {
|
|
2667
2951
|
o && clearTimeout(o), o = setTimeout(() => {
|
|
@@ -2670,104 +2954,104 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2670
2954
|
}, c = async () => {
|
|
2671
2955
|
let t = await a();
|
|
2672
2956
|
if (!t) {
|
|
2673
|
-
|
|
2957
|
+
Z.info("app.config.ts onConfigChange: load returned null — skipping");
|
|
2674
2958
|
return;
|
|
2675
2959
|
}
|
|
2676
|
-
if (
|
|
2960
|
+
if (Z.info("app.config.ts onConfigChange: loaded", {
|
|
2677
2961
|
theme: t.theme,
|
|
2678
2962
|
port: t.port,
|
|
2679
2963
|
name: t.name
|
|
2680
|
-
}), JSON.stringify(t) === JSON.stringify(
|
|
2681
|
-
|
|
2964
|
+
}), JSON.stringify(t) === JSON.stringify(W)) {
|
|
2965
|
+
Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2682
2966
|
return;
|
|
2683
2967
|
}
|
|
2684
|
-
let r =
|
|
2968
|
+
let r = le(W, t);
|
|
2685
2969
|
if (r.length > 0) {
|
|
2686
|
-
|
|
2970
|
+
Z.warn("app.config.ts changed — hard restart required", { fields: r });
|
|
2687
2971
|
try {
|
|
2688
2972
|
await n.close();
|
|
2689
2973
|
} catch {}
|
|
2690
|
-
|
|
2974
|
+
fe();
|
|
2691
2975
|
return;
|
|
2692
2976
|
}
|
|
2693
2977
|
try {
|
|
2694
2978
|
let r = Date.now();
|
|
2695
|
-
await
|
|
2979
|
+
await sa(e, t, await ea(e, t)), W = t, n.ws && n.ws.send({
|
|
2696
2980
|
type: "full-reload",
|
|
2697
2981
|
path: "*"
|
|
2698
|
-
}),
|
|
2982
|
+
}), Z.info("app.config.ts soft-regen", {
|
|
2699
2983
|
ms: Date.now() - r,
|
|
2700
2984
|
reload: "full"
|
|
2701
2985
|
});
|
|
2702
2986
|
} catch (e) {
|
|
2703
|
-
|
|
2987
|
+
Z.error("app.config.ts soft-regen failed", {}, e);
|
|
2704
2988
|
}
|
|
2705
|
-
}, l = (e) => E(e) === "app.config.ts" ? e ===
|
|
2989
|
+
}, l = (e) => E(e) === "app.config.ts" ? e === U || A(e) === de : !1;
|
|
2706
2990
|
n.watcher.on("change", (e) => {
|
|
2707
|
-
l(e) && (
|
|
2991
|
+
l(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), s());
|
|
2708
2992
|
}), n.watcher.on("add", (e) => {
|
|
2709
|
-
l(e) && (
|
|
2993
|
+
l(e) && (Z.info("app.config.ts add event (chokidar)", { file: e }), s());
|
|
2710
2994
|
});
|
|
2711
2995
|
try {
|
|
2712
2996
|
let { watchFile: e } = await import("node:fs");
|
|
2713
|
-
e(
|
|
2714
|
-
e.mtimeMs !== t.mtimeMs && (
|
|
2715
|
-
}),
|
|
2997
|
+
e(U, { interval: 500 }, (e, t) => {
|
|
2998
|
+
e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), s());
|
|
2999
|
+
}), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
2716
3000
|
} catch (e) {
|
|
2717
|
-
|
|
3001
|
+
Z.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
2718
3002
|
}
|
|
2719
|
-
|
|
3003
|
+
Be(t, Z, {
|
|
2720
3004
|
root: e,
|
|
2721
3005
|
onBeforeRestart: () => n.close()
|
|
2722
3006
|
});
|
|
2723
3007
|
}
|
|
2724
|
-
},
|
|
3008
|
+
}, me = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, G = 0, he = {
|
|
2725
3009
|
name: "framework:suppress-api-hmr",
|
|
2726
3010
|
handleHotUpdate(e) {
|
|
2727
|
-
if (
|
|
3011
|
+
if (G += 1, me.test(e.file)) return [];
|
|
2728
3012
|
}
|
|
2729
3013
|
}, ge = {
|
|
2730
3014
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
2731
3015
|
async configureServer(t) {
|
|
2732
3016
|
let n = [];
|
|
2733
3017
|
for (let r of a) {
|
|
2734
|
-
let i = await
|
|
3018
|
+
let i = await Yi(e, r.pkg);
|
|
2735
3019
|
if (i) {
|
|
2736
3020
|
n.push(i);
|
|
2737
3021
|
try {
|
|
2738
3022
|
t.watcher.add(O(i, "rpcGroup.generated.ts"));
|
|
2739
3023
|
} catch {}
|
|
2740
|
-
for (let e of await
|
|
3024
|
+
for (let e of await ei(i)) try {
|
|
2741
3025
|
t.watcher.add(e);
|
|
2742
3026
|
} catch {}
|
|
2743
3027
|
}
|
|
2744
3028
|
}
|
|
2745
3029
|
if (n.length === 0) return;
|
|
2746
|
-
let r = await
|
|
3030
|
+
let r = await ni(n), i = null, o = !1, s = async () => {
|
|
2747
3031
|
if (o) return;
|
|
2748
|
-
let e = await
|
|
3032
|
+
let e = await ni(n);
|
|
2749
3033
|
if (e !== void 0 && e !== r) {
|
|
2750
|
-
r = e, o = !0,
|
|
3034
|
+
r = e, o = !0, Z.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
|
|
2751
3035
|
try {
|
|
2752
|
-
await
|
|
3036
|
+
await N.rm(O(L, ".vite", "deps"), {
|
|
2753
3037
|
recursive: !0,
|
|
2754
3038
|
force: !0
|
|
2755
3039
|
}), await t.restart(!0);
|
|
2756
3040
|
} catch (e) {
|
|
2757
|
-
o = !1,
|
|
3041
|
+
o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
|
|
2758
3042
|
}
|
|
2759
3043
|
}
|
|
2760
3044
|
}, c = (e) => {
|
|
2761
3045
|
let t = A(e);
|
|
2762
|
-
!
|
|
3046
|
+
!Qr(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
|
|
2763
3047
|
s();
|
|
2764
3048
|
}, 120));
|
|
2765
3049
|
};
|
|
2766
3050
|
t.watcher.on("change", c), t.watcher.on("add", c);
|
|
2767
3051
|
}
|
|
2768
|
-
},
|
|
3052
|
+
}, K = {}, ve = (e) => (t) => {
|
|
2769
3053
|
t.on("proxyReq", (t, n) => {
|
|
2770
|
-
|
|
3054
|
+
nr(t, n, {
|
|
2771
3055
|
target: e,
|
|
2772
3056
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
2773
3057
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
@@ -2777,14 +3061,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2777
3061
|
};
|
|
2778
3062
|
for (let e of a) {
|
|
2779
3063
|
if (!e.proxyTarget) continue;
|
|
2780
|
-
|
|
3064
|
+
K[e.browserWsUrl] = {
|
|
2781
3065
|
target: e.proxyTarget,
|
|
2782
3066
|
ws: !0,
|
|
2783
3067
|
changeOrigin: !0,
|
|
2784
3068
|
...e.wsPath ? {} : { rewrite: () => "/ws" }
|
|
2785
3069
|
};
|
|
2786
3070
|
let t = e.proxyTarget.replace(/^ws/, "http");
|
|
2787
|
-
|
|
3071
|
+
K[`/_voltro/api/${e.name}`] = {
|
|
2788
3072
|
target: t,
|
|
2789
3073
|
changeOrigin: !0,
|
|
2790
3074
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
@@ -2792,15 +3076,15 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2792
3076
|
};
|
|
2793
3077
|
}
|
|
2794
3078
|
for (let [e, t] of Object.entries(n.proxies ?? {})) {
|
|
2795
|
-
if (
|
|
2796
|
-
|
|
3079
|
+
if (K[e]) {
|
|
3080
|
+
Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
2797
3081
|
continue;
|
|
2798
3082
|
}
|
|
2799
|
-
|
|
3083
|
+
K[e] = {
|
|
2800
3084
|
target: t.target,
|
|
2801
3085
|
changeOrigin: t.changeOrigin ?? !0,
|
|
2802
3086
|
...t.rewrite === void 0 ? {} : { rewrite: (n) => n.replace(RegExp(`^${e}`), t.rewrite) }
|
|
2803
|
-
},
|
|
3087
|
+
}, Z.info(`proxy ${e} → ${t.target}`, {
|
|
2804
3088
|
prefix: e,
|
|
2805
3089
|
target: t.target,
|
|
2806
3090
|
...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
|
|
@@ -2812,7 +3096,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2812
3096
|
let r = null, a = async () => {
|
|
2813
3097
|
if (r !== null) return r;
|
|
2814
3098
|
let n = [];
|
|
2815
|
-
for (let r of
|
|
3099
|
+
for (let r of j) try {
|
|
2816
3100
|
let i = await t.ssrLoadModule(O(e, "src", "pages", r.file));
|
|
2817
3101
|
n.push({
|
|
2818
3102
|
pattern: r.pattern,
|
|
@@ -2829,7 +3113,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2829
3113
|
hasGetStaticPaths: typeof i.getStaticPaths == "function"
|
|
2830
3114
|
});
|
|
2831
3115
|
} catch (e) {
|
|
2832
|
-
|
|
3116
|
+
Z.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
|
|
2833
3117
|
}
|
|
2834
3118
|
return r = n, n;
|
|
2835
3119
|
};
|
|
@@ -2849,9 +3133,9 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2849
3133
|
}), n();
|
|
2850
3134
|
}), t.middlewares.use((t, n, r) => {
|
|
2851
3135
|
if (t.method !== "GET" && t.method !== "HEAD") return r();
|
|
2852
|
-
let { pathname: i } =
|
|
2853
|
-
if (i !== "/robots.txt" ||
|
|
2854
|
-
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(
|
|
3136
|
+
let { pathname: i } = $t(t.url ?? "/");
|
|
3137
|
+
if (i !== "/robots.txt" || M(O(e, "public", "robots.txt"))) return r();
|
|
3138
|
+
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(gn({ indexable: !1 }));
|
|
2855
3139
|
}), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
|
|
2856
3140
|
let r = e.url ?? "", i = r.split("?")[0];
|
|
2857
3141
|
if (i === "/api/dashboard/proxy") {
|
|
@@ -2942,7 +3226,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2942
3226
|
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
2943
3227
|
let c = o.split("?")[0];
|
|
2944
3228
|
if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
|
|
2945
|
-
let e = d(s.origin), n =
|
|
3229
|
+
let e = d(s.origin), n = Xn(o, jn(), s);
|
|
2946
3230
|
t.statusCode = n.status, t.setHeader("content-type", n.contentType);
|
|
2947
3231
|
for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
|
|
2948
3232
|
t.end(n.body);
|
|
@@ -2960,7 +3244,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2960
3244
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
2961
3245
|
r += e;
|
|
2962
3246
|
}), e.on("end", () => {
|
|
2963
|
-
let e =
|
|
3247
|
+
let e = Wn(r, i);
|
|
2964
3248
|
t.statusCode = e.status, t.setHeader("content-type", e.contentType);
|
|
2965
3249
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2966
3250
|
t.end(e.body);
|
|
@@ -2991,14 +3275,14 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
2991
3275
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2992
3276
|
t.flushHeaders?.(), t.write("retry: 5000\n\n");
|
|
2993
3277
|
let a = o.indexOf("?");
|
|
2994
|
-
if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(
|
|
3278
|
+
if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(yn(e));
|
|
2995
3279
|
let c = i.subscribe((e) => {
|
|
2996
3280
|
try {
|
|
2997
|
-
t.write(
|
|
3281
|
+
t.write(yn(e));
|
|
2998
3282
|
} catch {}
|
|
2999
3283
|
}), l = setInterval(() => {
|
|
3000
3284
|
try {
|
|
3001
|
-
t.write(
|
|
3285
|
+
t.write(bn());
|
|
3002
3286
|
} catch {}
|
|
3003
3287
|
}, 15e3), p = () => {
|
|
3004
3288
|
clearInterval(l), c();
|
|
@@ -3011,7 +3295,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3011
3295
|
kind: "web",
|
|
3012
3296
|
meta: {
|
|
3013
3297
|
name: n.name ?? "(unnamed)",
|
|
3014
|
-
voltroVersion:
|
|
3298
|
+
voltroVersion: Di,
|
|
3015
3299
|
port: l,
|
|
3016
3300
|
mode: "dev",
|
|
3017
3301
|
apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
|
|
@@ -3029,7 +3313,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3029
3313
|
size: 0,
|
|
3030
3314
|
entries: []
|
|
3031
3315
|
}),
|
|
3032
|
-
env: () =>
|
|
3316
|
+
env: () => Fe(n.name ?? "app", { contract: ue(n.env) ? n.env : void 0 })
|
|
3033
3317
|
}, c = p(o, i, s, { method: e.method ?? "GET" });
|
|
3034
3318
|
if (c === null) return r();
|
|
3035
3319
|
t.statusCode = c.status, t.setHeader("content-type", c.contentType);
|
|
@@ -3053,12 +3337,12 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3053
3337
|
}
|
|
3054
3338
|
});
|
|
3055
3339
|
}
|
|
3056
|
-
} : null,
|
|
3057
|
-
let o =
|
|
3058
|
-
if (
|
|
3340
|
+
} : null, Se = /* @__PURE__ */ new Set(), Ce = (e, t, n, r, i, a = !1) => {
|
|
3341
|
+
let o = Ir(i, a, t) ?? "";
|
|
3342
|
+
if (Z.error(`${t} render failed`, {
|
|
3059
3343
|
pathname: n,
|
|
3060
3344
|
pattern: r,
|
|
3061
|
-
cause:
|
|
3345
|
+
cause: Sn(i) + o
|
|
3062
3346
|
}), e.headersSent) {
|
|
3063
3347
|
e.end();
|
|
3064
3348
|
return;
|
|
@@ -3066,33 +3350,33 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3066
3350
|
e.writeHead(500, {
|
|
3067
3351
|
"content-type": "text/plain; charset=utf-8",
|
|
3068
3352
|
"x-voltro-rendered-by": `${t}-failed`,
|
|
3069
|
-
"x-voltro-ssr-generation": String(
|
|
3353
|
+
"x-voltro-ssr-generation": String(G)
|
|
3070
3354
|
});
|
|
3071
|
-
let s =
|
|
3072
|
-
e.end(`${t} render failed for ${n}\n\n${
|
|
3073
|
-
}, we =
|
|
3355
|
+
let s = G === 0 ? "" : `\n[voltro] this process has absorbed ${G} 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`;
|
|
3356
|
+
e.end(`${t} render failed for ${n}\n\n${Sn(i)}\n${o}\n${s}`);
|
|
3357
|
+
}, we = mt(), Te = gt({
|
|
3074
3358
|
limit: we,
|
|
3075
|
-
onColdStart: (e) =>
|
|
3076
|
-
onColdEnd: (e, { durationMs: t, failed: n }) =>
|
|
3359
|
+
onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
|
|
3360
|
+
onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
3077
3361
|
id: e,
|
|
3078
3362
|
ms: t,
|
|
3079
3363
|
...n ? { failed: !0 } : {}
|
|
3080
3364
|
})
|
|
3081
3365
|
});
|
|
3082
|
-
|
|
3083
|
-
let
|
|
3366
|
+
Z.debug(`ssr cold-compile concurrency ${we}`, { concurrency: we });
|
|
3367
|
+
let Ee = null, Oe = async () => (Ee === null && (Ee = await N.readFile(O(e, ".framework", "index.html"), "utf8")), Ee), ke = {
|
|
3084
3368
|
name: "framework:ssr",
|
|
3085
3369
|
configureServer(t) {
|
|
3086
|
-
let r = (e) =>
|
|
3370
|
+
let r = (e) => Te.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
|
|
3087
3371
|
if (i !== void 0) return i;
|
|
3088
3372
|
let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
|
|
3089
3373
|
return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
|
|
3090
3374
|
let [{ makeSsgWrap: i }, { makeSsrI18nResolver: s }] = await Promise.all([r("@voltro/i18n"), r("@voltro/i18n/server")]), c = {};
|
|
3091
|
-
for (let n of t) if (
|
|
3375
|
+
for (let n of t) if (M(O(e, "src", "locales", `${n}.ts`))) try {
|
|
3092
3376
|
let t = (await r(O(e, "src", "locales", `${n}.ts`))).default;
|
|
3093
3377
|
t !== void 0 && (c[n] = i(n, t, a));
|
|
3094
3378
|
} catch (e) {
|
|
3095
|
-
|
|
3379
|
+
Z.warn("locale catalog failed to load for SSR", { locale: n }, e);
|
|
3096
3380
|
}
|
|
3097
3381
|
if (o = Object.keys(c).length > 0, Object.keys(c).length === 0) {
|
|
3098
3382
|
let { resolveLocale: e, resolveTimeZone: i } = await r("@voltro/i18n/server");
|
|
@@ -3119,43 +3403,62 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3119
3403
|
defaultTimeZone: n.defaultTimeZone ?? null
|
|
3120
3404
|
});
|
|
3121
3405
|
})(), i);
|
|
3122
|
-
}
|
|
3123
|
-
|
|
3406
|
+
}, c = Dt({
|
|
3407
|
+
apiName: a[0]?.name,
|
|
3408
|
+
apiOrigin: ia(a[0], { allowDevProxy: !0 }),
|
|
3409
|
+
loadDescriptors: async () => {
|
|
3410
|
+
let e = a[0];
|
|
3411
|
+
if (e !== void 0) return (await r(`${e.pkg}/rpcGroup`)).appDescriptors;
|
|
3412
|
+
},
|
|
3413
|
+
rpcQuery: (e, t) => aa(ia(a[0], { allowDevProxy: !0 }), e, {
|
|
3414
|
+
apiName: a[0]?.name,
|
|
3415
|
+
headers: t
|
|
3416
|
+
}),
|
|
3417
|
+
renderErrorPage: async () => void 0
|
|
3418
|
+
});
|
|
3419
|
+
t.middlewares.use((e, t, n) => {
|
|
3420
|
+
if (!(e.url ?? "/").split("?")[0].startsWith(xe)) return n();
|
|
3421
|
+
c(e, t, (t, r) => {
|
|
3422
|
+
e.url = t, e.method = "GET", e.__voltroFormFlash = r, n();
|
|
3423
|
+
}).then((e) => {
|
|
3424
|
+
e || n();
|
|
3425
|
+
});
|
|
3426
|
+
}), t.middlewares.use(async (i, c, l) => {
|
|
3124
3427
|
if (i.method !== "GET" && i.method !== "HEAD") return l();
|
|
3125
3428
|
let u = i.url ?? "/";
|
|
3126
3429
|
u.indexOf("?");
|
|
3127
|
-
let { pathname: d, search: f } =
|
|
3430
|
+
let { pathname: d, search: f } = $t(u), p = i.__voltroFormFlash;
|
|
3128
3431
|
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 l();
|
|
3129
|
-
let
|
|
3130
|
-
if (
|
|
3131
|
-
let e =
|
|
3432
|
+
let m = async () => {
|
|
3433
|
+
if (J.length === 0) return;
|
|
3434
|
+
let e = ui(J, {
|
|
3132
3435
|
route: void 0,
|
|
3133
3436
|
pathname: d
|
|
3134
3437
|
});
|
|
3135
3438
|
if (e === void 0) return;
|
|
3136
3439
|
let t = {};
|
|
3137
3440
|
for (let [e, n] of Object.entries(i.headers ?? {})) typeof n == "string" ? t[e] = n : Array.isArray(n) && (t[e] = n.join(", "));
|
|
3138
|
-
let n = await
|
|
3441
|
+
let n = await bi(e, {
|
|
3139
3442
|
pathname: d,
|
|
3140
3443
|
search: f,
|
|
3141
3444
|
headers: t,
|
|
3142
|
-
cookies:
|
|
3445
|
+
cookies: pi(t.cookie),
|
|
3143
3446
|
route: void 0
|
|
3144
3447
|
});
|
|
3145
|
-
for (let e of n.setCookies) c.appendHeader("set-cookie",
|
|
3448
|
+
for (let e of n.setCookies) c.appendHeader("set-cookie", _i(e));
|
|
3146
3449
|
};
|
|
3147
|
-
if (/\.[a-z0-9]+$/i.test(d)) return await
|
|
3148
|
-
let
|
|
3149
|
-
if (!
|
|
3150
|
-
let
|
|
3151
|
-
|
|
3152
|
-
pattern:
|
|
3450
|
+
if (/\.[a-z0-9]+$/i.test(d)) return await m(), l();
|
|
3451
|
+
let h = Ji(d, F.ssrRoutes);
|
|
3452
|
+
if (!h) return await m(), l();
|
|
3453
|
+
let g = !Se.has(h.route.pattern), v = Date.now();
|
|
3454
|
+
g && Z.info(`ssr compiling ${h.route.pattern}`, {
|
|
3455
|
+
pattern: h.route.pattern,
|
|
3153
3456
|
pathname: d
|
|
3154
3457
|
});
|
|
3155
|
-
let
|
|
3458
|
+
let y = {}, b = async (e, t) => {
|
|
3156
3459
|
let n = Date.now(), r = await t();
|
|
3157
|
-
return
|
|
3158
|
-
},
|
|
3460
|
+
return y[e] = (y[e] ?? 0) + (Date.now() - n), r;
|
|
3461
|
+
}, x = async (e, n, r) => {
|
|
3159
3462
|
let i = await t.moduleGraph.getModuleById(e);
|
|
3160
3463
|
if (!(!i || n.has(e))) {
|
|
3161
3464
|
if (n.add(e), i.id && /\.(css|sass|scss|less|stylus|pcss|postcss)(\?|$)/.test(i.id)) {
|
|
@@ -3163,148 +3466,163 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3163
3466
|
r.includes(e) || r.push(e);
|
|
3164
3467
|
return;
|
|
3165
3468
|
}
|
|
3166
|
-
for (let e of i.importedModules ?? []) e.id && await
|
|
3469
|
+
for (let e of i.importedModules ?? []) e.id && await x(e.id, n, r);
|
|
3167
3470
|
}
|
|
3168
|
-
},
|
|
3471
|
+
}, S = !1;
|
|
3169
3472
|
try {
|
|
3170
|
-
let
|
|
3171
|
-
if (
|
|
3172
|
-
let
|
|
3173
|
-
for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ?
|
|
3174
|
-
let
|
|
3175
|
-
route:
|
|
3473
|
+
let C = await b("loadPage", async () => await r(O(e, "src", "pages", h.route.file))), w = _(C, O("src", "pages", h.route.file)), T = Hi(F.dirs, h.route.dirChain), E = w === "spa" && T.some((e) => e.hasLayout), D = C.interactive ?? "full";
|
|
3474
|
+
if (w !== "ssr" && w !== "isr" && !E && D !== "islands") return await m(), l();
|
|
3475
|
+
let k = {};
|
|
3476
|
+
for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? k[e] = t : Array.isArray(t) && (k[e] = t.join(", "));
|
|
3477
|
+
let A = await bi(ui(J, {
|
|
3478
|
+
route: h.route.pattern,
|
|
3176
3479
|
pathname: d
|
|
3177
3480
|
}), {
|
|
3178
3481
|
pathname: d,
|
|
3179
3482
|
search: f,
|
|
3180
|
-
headers:
|
|
3181
|
-
cookies:
|
|
3182
|
-
route:
|
|
3183
|
-
},
|
|
3184
|
-
for (let e of
|
|
3185
|
-
let
|
|
3483
|
+
headers: k,
|
|
3484
|
+
cookies: pi(k.cookie),
|
|
3485
|
+
route: h.route.pattern
|
|
3486
|
+
}, Ve);
|
|
3487
|
+
for (let e of A.setCookies) c.appendHeader("set-cookie", _i(e));
|
|
3488
|
+
for (let [e, t] of Object.entries(A.responseHeaders)) c.setHeader(e, t);
|
|
3489
|
+
if (w === "isr" && A.cspNonce !== void 0) throw Error(`page '${h.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.`);
|
|
3490
|
+
let j = w === "isr" ? wi(A.headers) : A.headers, M = aa(ia(a[0], { allowDevProxy: !0 }), j.cookie, {
|
|
3186
3491
|
apiName: a[0]?.name,
|
|
3187
|
-
headers:
|
|
3188
|
-
}),
|
|
3189
|
-
c.once("close",
|
|
3190
|
-
let
|
|
3492
|
+
headers: j
|
|
3493
|
+
}), P = new AbortController(), ee = () => P.abort();
|
|
3494
|
+
c.once("close", ee);
|
|
3495
|
+
let te = null, ne = [], re = {};
|
|
3191
3496
|
try {
|
|
3192
|
-
(await r("@voltro/web/ssr")).beginStoreSeeds(), {chain:
|
|
3193
|
-
entries:
|
|
3497
|
+
(await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: ne, segmentLoaderData: re} = await b("loadChain", () => Ui({
|
|
3498
|
+
entries: T,
|
|
3194
3499
|
loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
|
|
3195
3500
|
loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
|
|
3196
3501
|
loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
|
|
3197
3502
|
ctx: {
|
|
3198
|
-
params:
|
|
3503
|
+
params: h.params,
|
|
3199
3504
|
pathname: d,
|
|
3200
3505
|
search: f,
|
|
3201
|
-
signal:
|
|
3202
|
-
headers:
|
|
3203
|
-
query:
|
|
3506
|
+
signal: P.signal,
|
|
3507
|
+
headers: j,
|
|
3508
|
+
query: M,
|
|
3204
3509
|
isServer: !0
|
|
3205
3510
|
}
|
|
3206
3511
|
}));
|
|
3207
|
-
let t =
|
|
3208
|
-
typeof t == "function" && !
|
|
3209
|
-
params:
|
|
3512
|
+
let t = C.loader;
|
|
3513
|
+
typeof t == "function" && !E && (te = await b("loader", () => t({
|
|
3514
|
+
params: h.params,
|
|
3210
3515
|
pathname: d,
|
|
3211
3516
|
search: f,
|
|
3212
|
-
signal:
|
|
3213
|
-
headers:
|
|
3214
|
-
query:
|
|
3517
|
+
signal: P.signal,
|
|
3518
|
+
headers: j,
|
|
3519
|
+
query: M,
|
|
3215
3520
|
isServer: !0
|
|
3216
3521
|
})));
|
|
3217
3522
|
} finally {
|
|
3218
|
-
c.off("close",
|
|
3523
|
+
c.off("close", ee);
|
|
3219
3524
|
}
|
|
3220
|
-
let I = await
|
|
3221
|
-
|
|
3222
|
-
pageMod:
|
|
3223
|
-
params:
|
|
3224
|
-
query:
|
|
3525
|
+
let I = await b("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
|
|
3526
|
+
E || await Zr({
|
|
3527
|
+
pageMod: C,
|
|
3528
|
+
params: h.params,
|
|
3529
|
+
query: M,
|
|
3225
3530
|
apiName: a[0]?.name,
|
|
3226
3531
|
seed: I.seedPreloadedSubscription,
|
|
3227
3532
|
seedFailure: I.seedPreloadedSubscriptionFailure,
|
|
3228
|
-
onError: ({ tag: e, apiName: t }, n) =>
|
|
3533
|
+
onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
|
|
3229
3534
|
tag: e,
|
|
3230
3535
|
apiName: t,
|
|
3231
3536
|
pathname: d
|
|
3232
3537
|
}, n)
|
|
3233
3538
|
});
|
|
3234
|
-
let
|
|
3235
|
-
pattern:
|
|
3236
|
-
Component:
|
|
3237
|
-
meta:
|
|
3238
|
-
loader:
|
|
3239
|
-
ErrorBoundary:
|
|
3240
|
-
Pending:
|
|
3241
|
-
renderMode:
|
|
3242
|
-
chain:
|
|
3243
|
-
},
|
|
3244
|
-
cookies:
|
|
3245
|
-
headers:
|
|
3246
|
-
url: u
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3539
|
+
let L = {
|
|
3540
|
+
pattern: h.route.pattern,
|
|
3541
|
+
Component: C.default,
|
|
3542
|
+
meta: C.meta,
|
|
3543
|
+
loader: C.loader,
|
|
3544
|
+
ErrorBoundary: C.ErrorBoundary,
|
|
3545
|
+
Pending: C.Pending,
|
|
3546
|
+
renderMode: w,
|
|
3547
|
+
chain: ne
|
|
3548
|
+
}, R = {
|
|
3549
|
+
cookies: w === "isr" ? Ti(A.cookies) : A.cookies,
|
|
3550
|
+
headers: j,
|
|
3551
|
+
url: u,
|
|
3552
|
+
...p === void 0 ? {} : { formFlash: p }
|
|
3553
|
+
}, z = (await s())(j.cookie, j["accept-language"]);
|
|
3554
|
+
S = z !== void 0 && o;
|
|
3555
|
+
let ie = z ? {
|
|
3250
3556
|
outerWrap: z.outerWrap,
|
|
3251
3557
|
locale: z.locale
|
|
3252
|
-
} : {}, B =
|
|
3558
|
+
} : {}, B = E ? Yt({
|
|
3253
3559
|
helpers: I,
|
|
3254
|
-
page: `src/pages/${
|
|
3255
|
-
interactive:
|
|
3560
|
+
page: `src/pages/${h.route.file}`,
|
|
3561
|
+
interactive: D,
|
|
3256
3562
|
delivery: "stream",
|
|
3257
3563
|
renderInput: {
|
|
3258
|
-
descriptor:
|
|
3259
|
-
params:
|
|
3564
|
+
descriptor: L,
|
|
3565
|
+
params: h.params,
|
|
3260
3566
|
pathname: d,
|
|
3261
3567
|
search: f,
|
|
3262
|
-
segmentLoaderData:
|
|
3263
|
-
requestContext:
|
|
3264
|
-
...
|
|
3568
|
+
segmentLoaderData: re,
|
|
3569
|
+
requestContext: R,
|
|
3570
|
+
...ie
|
|
3265
3571
|
}
|
|
3266
|
-
}) : null, V =
|
|
3572
|
+
}) : null, V = E ? null : Jt({
|
|
3267
3573
|
helpers: I,
|
|
3268
|
-
page: `src/pages/${
|
|
3574
|
+
page: `src/pages/${h.route.file}`,
|
|
3269
3575
|
pathname: d,
|
|
3270
|
-
renderMode:
|
|
3271
|
-
interactive:
|
|
3272
|
-
loaderData:
|
|
3273
|
-
segmentLoaderData:
|
|
3274
|
-
pageLoaderRan: typeof
|
|
3275
|
-
}),
|
|
3276
|
-
await
|
|
3576
|
+
renderMode: w,
|
|
3577
|
+
interactive: D,
|
|
3578
|
+
loaderData: te,
|
|
3579
|
+
segmentLoaderData: re,
|
|
3580
|
+
pageLoaderRan: typeof C.loader == "function"
|
|
3581
|
+
}), ae = [];
|
|
3582
|
+
await b("collectCss", async () => {
|
|
3277
3583
|
let t = /* @__PURE__ */ new Set(), n = [
|
|
3278
|
-
O(e, "src", "pages",
|
|
3279
|
-
...
|
|
3584
|
+
O(e, "src", "pages", h.route.file),
|
|
3585
|
+
...T.flatMap((t) => [
|
|
3280
3586
|
...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
|
|
3281
3587
|
...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
|
|
3282
3588
|
...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
|
|
3283
3589
|
]),
|
|
3284
3590
|
O(e, ".framework", "main.tsx")
|
|
3285
3591
|
];
|
|
3286
|
-
for (let e of n) await
|
|
3592
|
+
for (let e of n) await x(e, t, ae);
|
|
3287
3593
|
});
|
|
3288
|
-
let
|
|
3289
|
-
|
|
3594
|
+
let oe = (D === "islands" ? await b("islandsEntry", async () => {
|
|
3595
|
+
let t = oa(a, "../../app.config"), n = (await Wt({
|
|
3596
|
+
webRoot: e,
|
|
3597
|
+
pages: [{
|
|
3598
|
+
pattern: h.route.pattern,
|
|
3599
|
+
file: h.route.file
|
|
3600
|
+
}],
|
|
3601
|
+
headSnippets: zt(await Oe()),
|
|
3602
|
+
apiImports: t.imports,
|
|
3603
|
+
apiEntriesLiteral: `[\n${t.providerEntryLines.join("\n")}\n ]`
|
|
3604
|
+
}))[0];
|
|
3605
|
+
return n === void 0 ? void 0 : await N.readFile(O(e, ".framework", n.htmlFile), "utf8");
|
|
3606
|
+
}) : void 0) ?? await b("readShell", Oe), H = await b("transformShell", () => t.transformIndexHtml(u, oe)), se = ae.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), U = z?.locale ?? R.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", ce = Date.now(), le = {
|
|
3607
|
+
lang: U,
|
|
3290
3608
|
...z?.timeZone === void 0 ? {} : { timeZone: z.timeZone },
|
|
3291
|
-
renderedAt:
|
|
3609
|
+
renderedAt: ce
|
|
3292
3610
|
};
|
|
3293
3611
|
if (B) {
|
|
3294
|
-
let e = (e) =>
|
|
3612
|
+
let e = (e) => Zt({
|
|
3295
3613
|
helpers: I,
|
|
3296
3614
|
prepared: B,
|
|
3297
3615
|
meta: e,
|
|
3298
|
-
interactive:
|
|
3299
|
-
extra: [
|
|
3616
|
+
interactive: D,
|
|
3617
|
+
extra: [se]
|
|
3300
3618
|
});
|
|
3301
|
-
if (B.hasDeferred)
|
|
3619
|
+
if (B.hasDeferred) Jr({
|
|
3302
3620
|
res: c,
|
|
3303
|
-
shell:
|
|
3304
|
-
shell:
|
|
3621
|
+
shell: Ur({
|
|
3622
|
+
shell: H,
|
|
3305
3623
|
inlineModuleScriptsAsync: !0
|
|
3306
3624
|
}),
|
|
3307
|
-
documentAttrs:
|
|
3625
|
+
documentAttrs: le,
|
|
3308
3626
|
headers: {
|
|
3309
3627
|
"content-type": "text/html; charset=utf-8",
|
|
3310
3628
|
"x-voltro-rendered-by": "spa-shell-dev"
|
|
@@ -3315,40 +3633,40 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3315
3633
|
...e
|
|
3316
3634
|
}),
|
|
3317
3635
|
onShellError: (e) => {
|
|
3318
|
-
|
|
3636
|
+
Ce(c, "spa-shell-dev", d, h.route.pattern, e, S);
|
|
3319
3637
|
}
|
|
3320
3638
|
});
|
|
3321
3639
|
else {
|
|
3322
|
-
let t =
|
|
3640
|
+
let t = Xt({
|
|
3323
3641
|
helpers: I,
|
|
3324
3642
|
prepared: B
|
|
3325
|
-
}), n =
|
|
3643
|
+
}), n = Kr(H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`), le);
|
|
3326
3644
|
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
|
|
3327
3645
|
}
|
|
3328
3646
|
} else if (V) {
|
|
3329
3647
|
let e = (e) => [
|
|
3330
|
-
|
|
3648
|
+
se,
|
|
3331
3649
|
I.renderMetaToHtml(e),
|
|
3332
|
-
`<meta name="voltro-interactive" content="${
|
|
3650
|
+
`<meta name="voltro-interactive" content="${D}" />`,
|
|
3333
3651
|
...V.hasDeferred ? [I.renderDeferredRegistryScript()] : [],
|
|
3334
3652
|
I.renderRouterStateScript(V.stateInput)
|
|
3335
3653
|
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3336
|
-
descriptor:
|
|
3337
|
-
params:
|
|
3654
|
+
descriptor: L,
|
|
3655
|
+
params: h.params,
|
|
3338
3656
|
pathname: d,
|
|
3339
3657
|
search: f,
|
|
3340
3658
|
loaderData: V.loaderData,
|
|
3341
3659
|
segmentLoaderData: V.segmentLoaderData,
|
|
3342
|
-
requestContext:
|
|
3343
|
-
...
|
|
3660
|
+
requestContext: R,
|
|
3661
|
+
...ie
|
|
3344
3662
|
};
|
|
3345
|
-
if (
|
|
3663
|
+
if (w === "ssr" && D === "full" && p === void 0) Jr({
|
|
3346
3664
|
res: c,
|
|
3347
|
-
shell:
|
|
3348
|
-
shell:
|
|
3665
|
+
shell: Ur({
|
|
3666
|
+
shell: H,
|
|
3349
3667
|
inlineModuleScriptsAsync: !0
|
|
3350
3668
|
}),
|
|
3351
|
-
documentAttrs:
|
|
3669
|
+
documentAttrs: le,
|
|
3352
3670
|
headers: {
|
|
3353
3671
|
"content-type": "text/html; charset=utf-8",
|
|
3354
3672
|
"x-voltro-rendered-by": "ssr-dev"
|
|
@@ -3356,82 +3674,85 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3356
3674
|
headInjection: e,
|
|
3357
3675
|
render: (e) => I.renderPageToStream({
|
|
3358
3676
|
...t,
|
|
3359
|
-
...e
|
|
3677
|
+
...e,
|
|
3678
|
+
...A.cspNonce === void 0 ? {} : { nonce: A.cspNonce }
|
|
3360
3679
|
}),
|
|
3361
3680
|
onShellError: (e) => {
|
|
3362
|
-
|
|
3681
|
+
Ce(c, "ssr-dev", d, h.route.pattern, e, S);
|
|
3363
3682
|
}
|
|
3364
3683
|
});
|
|
3365
3684
|
else {
|
|
3366
|
-
let { html: n, meta: r } = I.renderPageToHtml(t), i =
|
|
3367
|
-
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.
|
|
3685
|
+
let { html: n, meta: r } = I.renderPageToHtml(t), i = Kr(H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`), le);
|
|
3686
|
+
c.statusCode = p === void 0 ? 200 : 422, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), p !== void 0 && c.setHeader("cache-control", "no-store");
|
|
3687
|
+
let a = p === void 0 ? i : bt(i, p);
|
|
3688
|
+
c.end(A.cspNonce === void 0 ? a : Qt(a, A.cspNonce));
|
|
3368
3689
|
}
|
|
3369
3690
|
}
|
|
3370
|
-
|
|
3371
|
-
let
|
|
3372
|
-
|
|
3373
|
-
pattern:
|
|
3691
|
+
y.render = Date.now() - ce;
|
|
3692
|
+
let W = Date.now() - v;
|
|
3693
|
+
g ? (Se.add(h.route.pattern), Z.info(`ssr compiled ${h.route.pattern} in ${W}ms`, {
|
|
3694
|
+
pattern: h.route.pattern,
|
|
3374
3695
|
pathname: d,
|
|
3375
|
-
elapsedMs:
|
|
3696
|
+
elapsedMs: W,
|
|
3376
3697
|
cold: !0,
|
|
3377
|
-
phases:
|
|
3378
|
-
})) :
|
|
3379
|
-
pattern:
|
|
3698
|
+
phases: y
|
|
3699
|
+
})) : W > 200 && Z.info(`ssr rendered ${d} in ${W}ms`, {
|
|
3700
|
+
pattern: h.route.pattern,
|
|
3380
3701
|
pathname: d,
|
|
3381
|
-
elapsedMs:
|
|
3702
|
+
elapsedMs: W,
|
|
3382
3703
|
cold: !1,
|
|
3383
|
-
phases:
|
|
3704
|
+
phases: y
|
|
3384
3705
|
});
|
|
3385
3706
|
} catch (e) {
|
|
3386
|
-
if (
|
|
3387
|
-
|
|
3707
|
+
if (Kt(e)) {
|
|
3708
|
+
Z.error("ssr-dev render refused", {
|
|
3388
3709
|
pathname: d,
|
|
3389
|
-
pattern:
|
|
3710
|
+
pattern: h.route.pattern
|
|
3390
3711
|
}, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
|
|
3391
3712
|
return;
|
|
3392
3713
|
}
|
|
3393
|
-
let t =
|
|
3714
|
+
let t = qt(e);
|
|
3394
3715
|
if (t) {
|
|
3395
3716
|
c.statusCode = t.status;
|
|
3396
3717
|
for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
|
|
3397
3718
|
c.end(t.body);
|
|
3398
3719
|
return;
|
|
3399
3720
|
}
|
|
3400
|
-
|
|
3721
|
+
Ce(c, "ssr-dev", d, h.route.pattern, e, S);
|
|
3401
3722
|
}
|
|
3402
3723
|
});
|
|
3403
3724
|
}
|
|
3404
|
-
},
|
|
3725
|
+
}, Ae = Date.now(), je = ne.version ?? "?", Me = await Oi(), Ne = O(e, "node_modules", "@voltro", "ui-shadcn"), q = M(O(Ne, "package.json")) ? Ne : null, Ie = [], Le = await (async () => {
|
|
3405
3726
|
let t = [];
|
|
3406
3727
|
for (let n of a) {
|
|
3407
|
-
let r = await
|
|
3728
|
+
let r = await Yi(e, n.pkg);
|
|
3408
3729
|
r && t.push(r);
|
|
3409
3730
|
}
|
|
3410
|
-
let n = await
|
|
3731
|
+
let n = await ni(t);
|
|
3411
3732
|
if (n === void 0) return !1;
|
|
3412
|
-
let r = O(
|
|
3733
|
+
let r = O(L, ".voltro-rpcgroup-optimize"), i = "";
|
|
3413
3734
|
try {
|
|
3414
|
-
i = (await
|
|
3735
|
+
i = (await N.readFile(r, "utf8")).trim();
|
|
3415
3736
|
} catch {}
|
|
3416
3737
|
if (i === n) return !1;
|
|
3417
3738
|
try {
|
|
3418
|
-
await
|
|
3739
|
+
await N.writeFile(r, n);
|
|
3419
3740
|
} catch {}
|
|
3420
3741
|
return !0;
|
|
3421
|
-
})(),
|
|
3422
|
-
|
|
3742
|
+
})(), ze = /* @__PURE__ */ new Set(), Ve = (e) => {
|
|
3743
|
+
ze.has(e.name) || (ze.add(e.name), Z.warn(`middleware.ts wrote the cookie "${e.name}" with the HttpOnly default — a browser SDK cannot read it`, {
|
|
3423
3744
|
cookie: e.name,
|
|
3424
3745
|
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."
|
|
3425
3746
|
}));
|
|
3426
|
-
},
|
|
3427
|
-
|
|
3747
|
+
}, J = await yi(e);
|
|
3748
|
+
J.length > 0 && Z.info(`middleware.ts loaded — ${J.length} middleware(s): ` + J.map((e) => e.exportName).join(", ")), fi(J, F.ssrRoutes.map((e) => e.pattern)), Le && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
|
|
3428
3749
|
try {
|
|
3429
|
-
await
|
|
3750
|
+
await We(l, "voltro dev (web)");
|
|
3430
3751
|
} catch (e) {
|
|
3431
|
-
|
|
3752
|
+
Z.error(String(e.message ?? e)), process.exit(1);
|
|
3432
3753
|
}
|
|
3433
|
-
await (await
|
|
3434
|
-
root:
|
|
3754
|
+
await (await ne.createServer({
|
|
3755
|
+
root: L,
|
|
3435
3756
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3436
3757
|
ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
|
|
3437
3758
|
resolve: {
|
|
@@ -3442,50 +3763,50 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3442
3763
|
"@voltro/i18n"
|
|
3443
3764
|
],
|
|
3444
3765
|
alias: [
|
|
3445
|
-
...
|
|
3766
|
+
...Me ? [{
|
|
3446
3767
|
find: "@voltro/devtools/styles.css",
|
|
3447
|
-
replacement: O(
|
|
3768
|
+
replacement: O(Me, "src/styles.css")
|
|
3448
3769
|
}, {
|
|
3449
3770
|
find: "@voltro/devtools",
|
|
3450
|
-
replacement: O(
|
|
3771
|
+
replacement: O(Me, "src/index.ts")
|
|
3451
3772
|
}] : [],
|
|
3452
|
-
...
|
|
3773
|
+
...q ? [
|
|
3453
3774
|
{
|
|
3454
3775
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3455
|
-
replacement: O(
|
|
3776
|
+
replacement: O(q, "src/tokens.css")
|
|
3456
3777
|
},
|
|
3457
3778
|
{
|
|
3458
3779
|
find: "@voltro/ui-shadcn/cn",
|
|
3459
|
-
replacement: O(
|
|
3780
|
+
replacement: O(q, "src/cn.ts")
|
|
3460
3781
|
},
|
|
3461
3782
|
{
|
|
3462
3783
|
find: "@voltro/ui-shadcn/brand",
|
|
3463
|
-
replacement: O(
|
|
3784
|
+
replacement: O(q, "src/brand/voltroLogo.tsx")
|
|
3464
3785
|
},
|
|
3465
3786
|
{
|
|
3466
3787
|
find: "@voltro/ui-shadcn",
|
|
3467
|
-
replacement: O(
|
|
3788
|
+
replacement: O(q, "src/index.ts")
|
|
3468
3789
|
}
|
|
3469
3790
|
] : [],
|
|
3470
|
-
...
|
|
3791
|
+
...pt(e)
|
|
3471
3792
|
]
|
|
3472
3793
|
},
|
|
3473
3794
|
optimizeDeps: {
|
|
3474
3795
|
include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Ie],
|
|
3475
3796
|
force: Le
|
|
3476
3797
|
},
|
|
3477
|
-
customLogger:
|
|
3798
|
+
customLogger: dt(),
|
|
3478
3799
|
plugins: [
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3800
|
+
hr(O(e, "src", "pages")),
|
|
3801
|
+
re(),
|
|
3802
|
+
I(),
|
|
3803
|
+
B,
|
|
3804
|
+
se,
|
|
3805
|
+
pe,
|
|
3485
3806
|
he,
|
|
3486
3807
|
ge,
|
|
3487
3808
|
ye,
|
|
3488
|
-
|
|
3809
|
+
ke,
|
|
3489
3810
|
...be ? [be] : []
|
|
3490
3811
|
],
|
|
3491
3812
|
server: {
|
|
@@ -3493,23 +3814,23 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3493
3814
|
strictPort: !0,
|
|
3494
3815
|
host: !0,
|
|
3495
3816
|
allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
|
|
3496
|
-
proxy:
|
|
3497
|
-
fs: { allow: [e, ...
|
|
3817
|
+
proxy: K,
|
|
3818
|
+
fs: { allow: [e, ...Pi(e)] }
|
|
3498
3819
|
},
|
|
3499
3820
|
appType: "spa",
|
|
3500
|
-
cacheDir: O(
|
|
3821
|
+
cacheDir: O(L, ".vite"),
|
|
3501
3822
|
publicDir: O(e, "public")
|
|
3502
|
-
})).listen(),
|
|
3503
|
-
version:
|
|
3504
|
-
bootMs: Date.now() -
|
|
3505
|
-
}),
|
|
3823
|
+
})).listen(), Ei.info(`v${je} ready in ${Date.now() - Ae}ms`, {
|
|
3824
|
+
version: je,
|
|
3825
|
+
bootMs: Date.now() - Ae
|
|
3826
|
+
}), Z.info(`listening on http://localhost:${l}`, {
|
|
3506
3827
|
port: l,
|
|
3507
3828
|
app: n.name ?? "(unnamed)"
|
|
3508
3829
|
});
|
|
3509
|
-
for (let e of a) e.proxyTarget && (
|
|
3830
|
+
for (let e of a) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
|
|
3510
3831
|
api: e.name,
|
|
3511
3832
|
target: e.proxyTarget
|
|
3512
|
-
}),
|
|
3833
|
+
}), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3513
3834
|
try {
|
|
3514
3835
|
await x({
|
|
3515
3836
|
id: b,
|
|
@@ -3520,10 +3841,10 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3520
3841
|
status: "live",
|
|
3521
3842
|
logFile: D.path
|
|
3522
3843
|
});
|
|
3523
|
-
let t =
|
|
3844
|
+
let t = yr(e);
|
|
3524
3845
|
if (t) {
|
|
3525
|
-
let e = await
|
|
3526
|
-
e.status === "launched" ?
|
|
3846
|
+
let e = await kr({ dashboardAppPath: t });
|
|
3847
|
+
e.status === "launched" ? Z.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && Z.debug(`dashboard already running on :${e.port}`, { port: e.port });
|
|
3527
3848
|
}
|
|
3528
3849
|
setInterval(() => {
|
|
3529
3850
|
x({
|
|
@@ -3541,32 +3862,32 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3541
3862
|
};
|
|
3542
3863
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3543
3864
|
} catch (e) {
|
|
3544
|
-
|
|
3865
|
+
Z.warn("runtime-registry write failed", {}, e);
|
|
3545
3866
|
}
|
|
3546
|
-
return
|
|
3867
|
+
return z({
|
|
3547
3868
|
app: n.name ?? "unnamed",
|
|
3548
3869
|
kind: "web",
|
|
3549
3870
|
url: `http://localhost:${l}`,
|
|
3550
|
-
bootMs: Date.now() -
|
|
3871
|
+
bootMs: Date.now() - Ae
|
|
3551
3872
|
}), new Promise(() => {});
|
|
3552
|
-
},
|
|
3873
|
+
}, fa = async (t) => {
|
|
3553
3874
|
e("serve");
|
|
3554
|
-
let n = await
|
|
3875
|
+
let n = await ua(t);
|
|
3555
3876
|
if (!n) return {
|
|
3556
3877
|
ran: !1,
|
|
3557
3878
|
exitCode: 0
|
|
3558
3879
|
};
|
|
3559
|
-
let i = Date.now(), a =
|
|
3880
|
+
let i = Date.now(), a = Z.child("serve");
|
|
3560
3881
|
a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
|
|
3561
|
-
let o = await
|
|
3882
|
+
let o = await ea(t, n);
|
|
3562
3883
|
for (let e of o) a.info("api wired", {
|
|
3563
3884
|
name: e.name,
|
|
3564
3885
|
pkg: e.pkg
|
|
3565
3886
|
});
|
|
3566
|
-
await
|
|
3887
|
+
await sa(t, n, o);
|
|
3567
3888
|
{
|
|
3568
|
-
let { pages: e } = await
|
|
3569
|
-
await
|
|
3889
|
+
let { pages: e } = await $(O(t, "src", "pages"));
|
|
3890
|
+
await un({
|
|
3570
3891
|
appRoot: t,
|
|
3571
3892
|
pages: e
|
|
3572
3893
|
});
|
|
@@ -3575,12 +3896,12 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3575
3896
|
kind: "web",
|
|
3576
3897
|
configPort: n.port,
|
|
3577
3898
|
env: process.env
|
|
3578
|
-
}).port, c = await
|
|
3579
|
-
|
|
3899
|
+
}).port, c = await De("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
|
|
3900
|
+
Z.info("running production build"), await c.build({
|
|
3580
3901
|
root: u,
|
|
3581
3902
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3582
3903
|
plugins: [l()],
|
|
3583
|
-
customLogger:
|
|
3904
|
+
customLogger: dt(),
|
|
3584
3905
|
resolve: { dedupe: [
|
|
3585
3906
|
"react",
|
|
3586
3907
|
"react-dom",
|
|
@@ -3589,7 +3910,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3589
3910
|
] },
|
|
3590
3911
|
build: {
|
|
3591
3912
|
outDir: "dist",
|
|
3592
|
-
rollupOptions: { output: { manualChunks:
|
|
3913
|
+
rollupOptions: { output: { manualChunks: Ii } }
|
|
3593
3914
|
},
|
|
3594
3915
|
publicDir: O(t, "public")
|
|
3595
3916
|
});
|
|
@@ -3602,7 +3923,7 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3602
3923
|
label: "Local",
|
|
3603
3924
|
url: e
|
|
3604
3925
|
})) ?? [];
|
|
3605
|
-
return
|
|
3926
|
+
return z({
|
|
3606
3927
|
app: n.name ?? "unnamed",
|
|
3607
3928
|
kind: "preview",
|
|
3608
3929
|
url: f,
|
|
@@ -3611,4 +3932,4 @@ The wrapper is what carries \`match\`, and what lets \`voltro doctor\` report wh
|
|
|
3611
3932
|
}), new Promise(() => {});
|
|
3612
3933
|
};
|
|
3613
3934
|
//#endregion
|
|
3614
|
-
export {
|
|
3935
|
+
export { Kt as $, ui as A, De as At, yr as B, wi as C, Le as Ct, di as D, Pe as Dt, yi as E, Ie as Et, Ur as F, In as G, Xn as H, Jr as I, vn as J, jn as K, br as L, Zr as M, Kr as N, pi as O, Me as Ot, Wr as P, un as Q, vr as R, Ti as S, Be as St, vi as T, Fe as Tt, Kn as U, tr as V, Wn as W, gn as X, bn as Y, hn as Z, da as _, et as _t, aa as a, Qt as at, $ as b, nt as bt, Hi as c, Ht as ct, Vi as d, xe as dt, Jt as et, ua as f, Dt as ft, na as g, Qe as gt, Qi as h, pt as ht, oa as i, $t as it, _i as j, bi as k, je as kt, Bi as l, Rt as lt, Zi as m, mt, ia as n, Xt as nt, Ui as o, Wt as ot, ea as p, gt as pt, yn as q, $i as r, Zt as rt, la as s, zt as st, Li as t, Yt as tt, Q as u, Vt as ut, fa as v, $e as vt, fi as w, Re as wt, sa as x, We as xt, Ii as y, tt as yt, kr as z };
|