@voltro/cli 0.37.0 → 0.39.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 +316 -0
- package/THIRD-PARTY-NOTICES.md +80 -45
- package/dist/{addCommand-BNeoeSxe.js → addCommand-C05L9tZh.js} +2 -2
- package/dist/addCommand-C3MdJG-a.js +2 -0
- package/dist/{agentsMd-mhQMF1bx.js → agentsMd-7zI2h5l9.js} +3 -3
- package/dist/agentsMd-BFCXh2gl.js +2 -0
- package/dist/apiBuild-2GvK8CUB.js +2 -0
- package/dist/{apiBuild-DGsShRuF.js → apiBuild-DGalUk9v.js} +3 -3
- package/dist/baselineCommand-CXv680Dc.js +2 -0
- package/dist/{baselineCommand-C6NMt-oa.js → baselineCommand-Ck2Xm8M7.js} +18 -18
- package/dist/bin.js +1 -1
- package/dist/bootRefusal-pgvDxlrU.js +7 -0
- package/dist/{build-CiFA-E19.js → build-CfF6t0UM.js} +88 -81
- package/dist/{capabilitiesCommand-nq_pz5xd.js → capabilitiesCommand-D5gucwYa.js} +8 -8
- package/dist/{checkCommand-CIPYyNyc.js → checkCommand-BV56Pcc1.js} +1 -1
- package/dist/{checkCommand-CLPTzYqM.js → checkCommand-CBtynBKW.js} +34 -34
- package/dist/{cloudCmd-NQSwe_Qk.js → cloudCmd-C42gaO8s.js} +16 -16
- package/dist/{clusterCmd-D5wsCmA_.js → clusterCmd-DrVFCzSj.js} +8 -4
- package/dist/{codegen-GYYcdpCg.js → codegen-CbpGCWLG.js} +1 -1
- package/dist/codegen-i8QGcHsi.js +2 -0
- package/dist/codegenCommand-W7SDdiAQ.js +129 -0
- package/dist/{codemodRunner-cyqu5oxr.js → codemodRunner-D-jTyvWo.js} +679 -495
- package/dist/{commands-BwG9A9Vv.js → commands-BD9eBRY3.js} +48 -48
- package/dist/{connectionConfig-UFlIEiys.js → connectionConfig-Bk9IC7D0.js} +1 -1
- package/dist/{dashboardCommand-C7U146xQ.js → dashboardCommand-7qGylm0F.js} +3 -3
- package/dist/{dataCommand-BOwd8_aJ.js → dataCommand-C_F2DYxe.js} +14 -11
- package/dist/{dbCommand-C4UW8cVN.js → dbCommand-DSwGv9wS.js} +50 -49
- package/dist/dbCommand-DcqEyxju.js +2 -0
- package/dist/dev-alhkKoEX.js +3 -0
- package/dist/{dev-bwDgSObH.js → dev-gqpnzVhI.js} +2357 -2280
- package/dist/{dialectDriver-CgXnDfec.js → dialectDriver-czCHYpeH.js} +2 -1
- package/dist/{doctorCommand-BXyrtN2l.js → doctorCommand-Bvs-BQrM.js} +242 -238
- package/dist/doctorCommand-CVXfRrng.js +2 -0
- package/dist/{dormancyCommand-BDdRRLsa.js → dormancyCommand-B-PPHc9Q.js} +1 -1
- package/dist/{e2eCmd-BRabZww-.js → e2eCmd-uFHig1hV.js} +8 -2
- package/dist/{embeddingsCommand-CjWGcAE6.js → embeddingsCommand-OKY6XjUf.js} +6 -6
- package/dist/{envCommand-B_TeG297.js → envCommand-B1-Zm85H.js} +2 -2
- package/dist/{evolveCommand-D6N-WfA4.js → evolveCommand-C4-NlFbd.js} +6 -8
- package/dist/{generateCommand-DbgcUpGw.js → generateCommand-CcyvH2ve.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{infoCommand-BHKTprrx.js → infoCommand-CTo8Jnhq.js} +7 -7
- package/dist/inspect-B7U7Cl_Z.js +1192 -0
- package/dist/inspect-DUze25t0.js +2 -0
- package/dist/{inspectCmd-EHFZ9yYu.js → inspectCmd-niF97fAq.js} +5 -5
- package/dist/inspectGateHint-BjnFubmH.js +7 -0
- package/dist/{logFileSink-C_D2wRN1.js → logFileSink-B4uP8pvf.js} +1 -1
- package/dist/{logsCmd-D36xK7Zu.js → logsCmd-B6oNsfaZ.js} +10 -7
- package/dist/{manifestBuild-hpPLaGxV.js → manifestBuild-BK42hu0k.js} +1 -1
- package/dist/manifestBuild-j0n109tt.js +2 -0
- package/dist/{metaCommands-CIoQNlaQ.js → metaCommands-DUYR--Ts.js} +1 -1
- package/dist/{migrate-RwgUWXfc.js → migrate-BnPw2zC8.js} +7 -4
- package/dist/{packageCommand-Cug_3Ogl.js → packageCommand-9SVyvsSo.js} +3 -2
- package/dist/{probeCommand-BPEpwT32.js → probeCommand-C9gazU0H.js} +35 -24
- package/dist/{projectScaffold-CxgtJvlb.js → projectScaffold-BEhhHjPr.js} +1 -1
- package/dist/{projectScaffold-DDgWbNLe.js → projectScaffold-BvhLOrLq.js} +17 -15
- package/dist/{runtimeTrace-WYV7qYvz.js → runtimeTrace-DzZOCd94.js} +1 -1
- package/dist/{scheduleManifestCmd-D2x0CTTY.js → scheduleManifestCmd-kmWzrO_w.js} +6 -9
- package/dist/{sdkgen-TM5sSdf7.js → sdkgen-C4roLErM.js} +4 -4
- package/dist/{seedRunner-ZmLSqNe2.js → seedRunner-IdHEprqf.js} +1 -4
- package/dist/serveCommand-B6TATyCj.js +1770 -0
- package/dist/serveCommand-CNR0gI9V.js +2 -0
- package/dist/serveEntry.js +2 -2
- package/dist/{serverlessCommand-CfJZy6dS.js → serverlessCommand-DbJ7Plg9.js} +3 -3
- package/dist/{start-BgN62boB.js → start-BNuTWdRd.js} +1 -1
- package/dist/{start-T4VesWiM.js → start-ft_KzFTd.js} +240 -237
- package/dist/startEntry.js +1 -1
- package/dist/startup.d.ts +40 -1
- package/dist/startup.js +2 -2
- package/dist/startupRunner-CEqQq7ax.js +108 -0
- package/dist/{test-DIQ0jlkQ.js → test-CLYXrZ2F.js} +1 -1
- package/dist/{tracesCmd-DStmCJPi.js → tracesCmd-DgtgOUdi.js} +7 -4
- package/dist/{typecheckCommand-BlsWiCNq.js → typecheckCommand-BuCtT92o.js} +7 -7
- package/dist/updateCommand-6FMU2klq.js +2 -0
- package/dist/{updateCommand-9GHHsmDf.js → updateCommand-CHBmCB17.js} +5 -3
- package/dist/{webDev-Dybxew86.js → webDev-CTpSY-e_.js} +892 -856
- package/dist/webDev-id3I5PvG.js +2 -0
- package/dist/{webhookDiscovery-D7VaeMlz.js → webhookDiscovery-CphsQe59.js} +4 -6
- package/dist/{webhookDiscovery-CrGAfhIG.js → webhookDiscovery-il9ti-HE.js} +1 -1
- package/dist/{webhooksCommand-CHWSPk5z.js → webhooksCommand-BVvOtZ1B.js} +1 -1
- package/package.json +39 -21
- package/templates/AGENTS.md +2 -2
- package/templates/agent-docs/_index.md +2 -2
- package/templates/agent-docs/_manifest.json +2 -2
- package/templates/agent-docs/authentication.md +30 -0
- package/templates/agent-docs/cli.md +17 -13
- package/templates/agent-docs/data.md +44 -1
- package/templates/agent-docs/database/migrations.md +2 -2
- package/templates/agent-docs/database/seedsdialects.md +2 -2
- package/templates/agent-docs/deployment.md +21 -7
- package/templates/agent-docs/internationalization.md +10 -3
- package/templates/agent-docs/local-first-mobile.md +141 -20
- package/templates/agent-docs/plugins/audit.md +4 -0
- package/templates/agent-docs/plugins/auth.md +4 -6
- package/templates/agent-docs/plugins/mail.md +1 -1
- package/templates/agent-docs/plugins/ratelimit.md +1 -1
- package/templates/agent-docs/plugins.md +3 -1
- package/templates/agent-docs/reference.md +3 -2
- package/templates/agent-docs/releases.md +130 -1
- package/templates/agent-docs/routing.md +34 -2
- package/templates/agent-docs/templates/apibackends.md +1 -1
- package/templates/agent-docs/templates/mobile.md +1 -1
- package/templates/agent-docs/whats-new.md +178 -44
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-cms/tests/content.write.test.ts +16 -2
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.server.ts +11 -5
- package/templates/apps/api-collab/package.json +8 -8
- package/templates/apps/api-collab/tests/documents.setBody.test.ts +8 -2
- 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/authz.ts +16 -1
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-versioning/mutations/documents.update.mutation.server.ts +7 -5
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +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-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/README.md +41 -17
- package/templates/apps/mobile-app/app.config.ts +1 -1
- package/templates/apps/mobile-app/package.json +15 -11
- package/templates/apps/mobile-app/src/app/_layout.tsx +44 -13
- package/templates/apps/mobile-app/src/app/index.tsx +1 -1
- package/templates/apps/mobile-app/src/app/settings.tsx +4 -1
- package/templates/apps/mobile-app/src/client.ts +74 -57
- package/templates/apps/mobile-app/src/lib/api.ts +4 -4
- package/templates/apps/mobile-app/src/lib/deeplinks.ts +6 -6
- package/templates/apps/mobile-app/src/persistence.ts +24 -3
- package/templates/apps/mobile-app/tsconfig.json +17 -3
- package/templates/patches/@effect__cluster@0.60.0.patch +51 -3
- package/dist/addCommand-aXSQveak.js +0 -2
- package/dist/agentsMd-BTchIZku.js +0 -2
- package/dist/apiBuild-D0f6hYbH.js +0 -2
- package/dist/baselineCommand-Cfw2Afwm.js +0 -2
- package/dist/codegen-uYrrDzQv.js +0 -2
- package/dist/codegenCommand-BxS3sCeJ.js +0 -30
- package/dist/dbCommand-CC-qNzpz.js +0 -2
- package/dist/dev-BV6XNYKf.js +0 -3
- package/dist/doctorCommand-C4L61G_L.js +0 -2
- package/dist/inspect-CjTYzAs_.js +0 -1190
- package/dist/inspect-P4pxoMaV.js +0 -2
- package/dist/inspectGateHint-BF6608UT.js +0 -4
- package/dist/manifestBuild-COkJoyAr.js +0 -2
- package/dist/serveCommand-CyZsXL1l.js +0 -1766
- package/dist/serveCommand-qumm7jdF.js +0 -2
- package/dist/startupRunner-DPGFchOa.js +0 -71
- package/dist/updateCommand-BN0tkl9-.js +0 -2
- package/dist/webDev-BcykISYQ2.js +0 -2
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { t as e } from "./nodeEnvironment-cGFAj1J8.js";
|
|
2
2
|
import { n as t } from "./loadEnv-D9nEOClM.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { A as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
3
|
+
import { t as n } from "./bootRefusal-pgvDxlrU.js";
|
|
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-Cof68_BL.js";
|
|
6
|
+
import { A as u, D as d, a as f, h as p, j as m, k as h } from "./inspect-B7U7Cl_Z.js";
|
|
7
|
+
import { n as g } from "./agentsMd-7zI2h5l9.js";
|
|
8
|
+
import { c as _, p as v, t as y } from "./renderModeScan-D7J1B7Kw.js";
|
|
9
|
+
import { t as b } from "./pageConvention-cEiRxdab.js";
|
|
10
|
+
import { i as x, n as S, r as C, t as w } from "./runtimeRegistry-DMeKfTHP.js";
|
|
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 j, promises as M, readFileSync as N, readdirSync as P, statSync as F, unwatchFile as I, watchFile as L } from "node:fs";
|
|
14
|
+
import { fileURLToPath as R, pathToFileURL as z } from "node:url";
|
|
15
|
+
import { addSink as B, createLogger as V, printReadyBlock as ee } from "@voltro/logger";
|
|
16
|
+
import { createRequire as te } from "node:module";
|
|
17
|
+
import { homedir as H } from "node:os";
|
|
18
|
+
import { currentTraceContext as U, resolveSecret as W } from "@voltro/runtime";
|
|
19
|
+
import { FRAMEWORK_ENV_CATALOG as ne, appEnvEntries as G, checkEnvNaming as re, formatEnvErrors as ie, installEnvSnapshot as K, isEnvContract as ae, pluginEnvEntries as oe, renderDotEnvExample as se, resolveEnv as ce } from "@voltro/env";
|
|
20
|
+
import { __installPublicEnv as le } from "@voltro/env/public";
|
|
21
|
+
import { mkdir as ue, writeFile as de } from "node:fs/promises";
|
|
22
|
+
import { createHash as q } from "node:crypto";
|
|
23
|
+
import { spawn as fe } from "node:child_process";
|
|
24
|
+
import { createConnection as pe } from "node:net";
|
|
25
|
+
import { PassThrough as me } from "node:stream";
|
|
25
26
|
//#region src/buildToolImport.ts
|
|
26
|
-
var
|
|
27
|
+
var J = (e) => {
|
|
27
28
|
let t = e;
|
|
28
29
|
return t?.code === "ERR_MODULE_NOT_FOUND" || /Cannot find (package|module)/.test(String(t?.message ?? ""));
|
|
29
|
-
},
|
|
30
|
+
}, he = async (e, t) => {
|
|
30
31
|
try {
|
|
31
32
|
return await t();
|
|
32
33
|
} catch (t) {
|
|
33
|
-
throw
|
|
34
|
+
throw J(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;
|
|
34
35
|
}
|
|
35
|
-
},
|
|
36
|
-
let n =
|
|
36
|
+
}, ge = "// AUTO-GENERATED by Voltro — DO NOT EDIT.\n// Source: app.config.ts `env` (defineEnv). Regenerated on every `voltro dev` boot.\n", _e = (e, t) => t ? `${e} | undefined` : e, ve = (e, t) => Object.entries(e.vars).filter(([, e]) => t(e.access)).map(([e, t]) => `${t.description ? ` /** ${t.description} */\n` : ""} readonly ${e}: ${_e(t.tsType, t.optional)}`).join("\n"), ye = async (e, t) => {
|
|
37
|
+
let n = ve(t, () => !0), r = `${ge}
|
|
37
38
|
import '@voltro/env/server'
|
|
38
39
|
|
|
39
40
|
declare module '@voltro/env/server' {
|
|
@@ -42,9 +43,9 @@ ${n.length > 0 ? n : " // (no variables declared)"}
|
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
`;
|
|
45
|
-
await
|
|
46
|
-
},
|
|
47
|
-
let n =
|
|
46
|
+
await de(O(e, "env.generated.d.ts"), r, "utf8");
|
|
47
|
+
}, be = async (e, t) => {
|
|
48
|
+
let n = ve(t, (e) => e === "public"), r = `${ge}
|
|
48
49
|
import '@voltro/env/public'
|
|
49
50
|
|
|
50
51
|
declare module '@voltro/env/public' {
|
|
@@ -52,10 +53,10 @@ declare module '@voltro/env/public' {
|
|
|
52
53
|
${n.length > 0 ? n : " // (no public variables declared)"}
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
`, i =
|
|
56
|
-
await
|
|
57
|
-
},
|
|
58
|
-
let n = `${
|
|
56
|
+
`, i = O(e, "src");
|
|
57
|
+
await ue(i, { recursive: !0 }), await de(O(i, "voltro-env.d.ts"), r, "utf8");
|
|
58
|
+
}, xe = async (e, t) => {
|
|
59
|
+
let n = `${ge}
|
|
59
60
|
import { __installPublicEnv } from '@voltro/env/public'
|
|
60
61
|
|
|
61
62
|
export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
@@ -63,14 +64,14 @@ export const publicEnvValues = ${JSON.stringify(t, null, 2)} as const
|
|
|
63
64
|
// Set the browser/SSR-shared global the \`publicEnv\` accessor reads.
|
|
64
65
|
__installPublicEnv(publicEnvValues)
|
|
65
66
|
`;
|
|
66
|
-
await
|
|
67
|
-
},
|
|
68
|
-
let t =
|
|
67
|
+
await ue(e, { recursive: !0 }), await de(O(e, "env.public.ts"), n, "utf8");
|
|
68
|
+
}, Se = async (e) => {
|
|
69
|
+
let t = ae(e.rawEnv) ? e.rawEnv : void 0, n = await ce({
|
|
69
70
|
contract: t,
|
|
70
|
-
resolveSecret:
|
|
71
|
-
}), r = [...n.errors, ...
|
|
72
|
-
if (r.length > 0) throw Error(
|
|
73
|
-
|
|
71
|
+
resolveSecret: W
|
|
72
|
+
}), r = [...n.errors, ...re(t, e.appType)];
|
|
73
|
+
if (r.length > 0) throw Error(ie(r));
|
|
74
|
+
K(n.values), e.appType === "web" && le(n.publicValues);
|
|
74
75
|
let i = t ? Object.keys(t.vars).length : 0;
|
|
75
76
|
if (i > 0) {
|
|
76
77
|
let r = Object.keys(n.publicValues).length;
|
|
@@ -82,20 +83,20 @@ __installPublicEnv(publicEnvValues)
|
|
|
82
83
|
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 });
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
return e.generateTypes && t && (e.appType === "api" ? await
|
|
86
|
+
return e.generateTypes && t && (e.appType === "api" ? await ye(e.root, t) : await be(e.root, t)), {
|
|
86
87
|
resolved: n,
|
|
87
88
|
contract: t
|
|
88
89
|
};
|
|
89
|
-
},
|
|
90
|
-
let t =
|
|
90
|
+
}, Ce = (e) => {
|
|
91
|
+
let t = G(e.contract), n = (e.plugins ?? []).flatMap((e) => oe(e.name, e.declaredEnv)), r = e.includeFramework === !1 ? [] : ne, i = /* @__PURE__ */ new Set(), a = [];
|
|
91
92
|
for (let e of [
|
|
92
93
|
...t,
|
|
93
94
|
...n,
|
|
94
95
|
...r
|
|
95
96
|
]) i.has(e.key) || (i.add(e.key), a.push(e));
|
|
96
97
|
return a;
|
|
97
|
-
},
|
|
98
|
-
let r =
|
|
98
|
+
}, we = (e, t, n = (e) => process.env[e]) => {
|
|
99
|
+
let r = Ce(t).map((e) => {
|
|
99
100
|
let t = n(e.key) !== void 0;
|
|
100
101
|
return {
|
|
101
102
|
...e,
|
|
@@ -112,30 +113,33 @@ __installPublicEnv(publicEnvValues)
|
|
|
112
113
|
missingRequired: r.filter((e) => e.required && !e.isSet && e.default === void 0).length
|
|
113
114
|
}
|
|
114
115
|
};
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
}, Te = (e, t) => {
|
|
117
|
+
let n = Ce({
|
|
118
|
+
...e,
|
|
119
|
+
includeFramework: !1
|
|
120
|
+
});
|
|
121
|
+
return se(n, {
|
|
122
|
+
includeFramework: e.includeFramework !== !1,
|
|
123
|
+
...t ? { header: t } : {}
|
|
124
|
+
});
|
|
125
|
+
}, Ee = async (e, t) => {
|
|
122
126
|
let n = e;
|
|
123
127
|
for (;;) {
|
|
124
|
-
let e =
|
|
128
|
+
let e = O(n, "node_modules", t);
|
|
125
129
|
try {
|
|
126
|
-
if ((await
|
|
127
|
-
let t = await
|
|
130
|
+
if ((await M.stat(e)).isDirectory()) {
|
|
131
|
+
let t = await M.realpath(e);
|
|
128
132
|
return t.includes("/node_modules/") ? null : t;
|
|
129
133
|
}
|
|
130
134
|
} catch {}
|
|
131
|
-
let r =
|
|
135
|
+
let r = D(n);
|
|
132
136
|
if (r === n) return null;
|
|
133
137
|
n = r;
|
|
134
138
|
}
|
|
135
|
-
},
|
|
139
|
+
}, De = async (e) => {
|
|
136
140
|
let t;
|
|
137
141
|
try {
|
|
138
|
-
let n = await
|
|
142
|
+
let n = await M.readFile(O(e, "package.json"), "utf8"), r = JSON.parse(n);
|
|
139
143
|
t = Object.keys({
|
|
140
144
|
...r.dependencies,
|
|
141
145
|
...r.devDependencies
|
|
@@ -144,11 +148,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
144
148
|
return [];
|
|
145
149
|
}
|
|
146
150
|
return (await Promise.all(t.map(async (t) => {
|
|
147
|
-
let n = await
|
|
151
|
+
let n = await Ee(e, t);
|
|
148
152
|
if (n === null) return null;
|
|
149
|
-
let r =
|
|
153
|
+
let r = O(n, "src");
|
|
150
154
|
try {
|
|
151
|
-
if (!(await
|
|
155
|
+
if (!(await M.stat(r)).isDirectory()) return null;
|
|
152
156
|
} catch {
|
|
153
157
|
return null;
|
|
154
158
|
}
|
|
@@ -157,11 +161,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
157
161
|
dir: r
|
|
158
162
|
};
|
|
159
163
|
}))).filter((e) => e !== null);
|
|
160
|
-
},
|
|
164
|
+
}, Oe = 500, ke = (e, t, n = {}) => {
|
|
161
165
|
if (e.length === 0) return () => {};
|
|
162
|
-
let r = (e) => n.root ?
|
|
166
|
+
let r = (e) => n.root ? k(n.root, e) : e, i = !1, a = (e) => {
|
|
163
167
|
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(() => {
|
|
164
|
-
let e =
|
|
168
|
+
let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
165
169
|
stdio: "inherit",
|
|
166
170
|
env: process.env,
|
|
167
171
|
cwd: n.cwd ?? process.cwd()
|
|
@@ -175,25 +179,22 @@ __installPublicEnv(publicEnvValues)
|
|
|
175
179
|
});
|
|
176
180
|
}));
|
|
177
181
|
};
|
|
178
|
-
for (let t of e)
|
|
182
|
+
for (let t of e) L(t, { interval: Oe }, (e, n) => {
|
|
179
183
|
e.mtimeMs !== n.mtimeMs && a(t);
|
|
180
184
|
});
|
|
181
185
|
return t.info("watching .env files for changes", {
|
|
182
186
|
files: e.map(r),
|
|
183
|
-
intervalMs:
|
|
187
|
+
intervalMs: Oe
|
|
184
188
|
}), () => {
|
|
185
|
-
for (let t of e)
|
|
189
|
+
for (let t of e) I(t);
|
|
186
190
|
};
|
|
187
|
-
},
|
|
188
|
-
let t = Error(e);
|
|
189
|
-
return t.name = Te, t;
|
|
190
|
-
}, De = [{
|
|
191
|
+
}, Ae = [{
|
|
191
192
|
host: "127.0.0.1",
|
|
192
193
|
family: "IPv4"
|
|
193
194
|
}, {
|
|
194
195
|
host: "::1",
|
|
195
196
|
family: "IPv6"
|
|
196
|
-
}],
|
|
197
|
+
}], je = (e, t, n) => new Promise((r) => {
|
|
197
198
|
let i = !1, a = (e) => {
|
|
198
199
|
if (!i) {
|
|
199
200
|
i = !0;
|
|
@@ -202,15 +203,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
202
203
|
} catch {}
|
|
203
204
|
r(e);
|
|
204
205
|
}
|
|
205
|
-
}, o =
|
|
206
|
+
}, o = pe({
|
|
206
207
|
host: e,
|
|
207
208
|
port: t
|
|
208
209
|
});
|
|
209
210
|
o.once("connect", () => a(!0)), o.once("error", () => a(!1)), o.setTimeout(n, () => a(!1));
|
|
210
|
-
}),
|
|
211
|
+
}), Me = async (e, t = 400) => ({ families: (await Promise.all(Ae.map(async (n) => ({
|
|
211
212
|
family: n.family,
|
|
212
|
-
taken: await
|
|
213
|
-
})))).filter((e) => e.taken).map((e) => e.family) }),
|
|
213
|
+
taken: await je(n.host, e, t)
|
|
214
|
+
})))).filter((e) => e.taken).map((e) => e.family) }), Ne = (e, t, n) => [
|
|
214
215
|
`${t}: port ${e} is already being served (${n.join(" + ")}).`,
|
|
215
216
|
"",
|
|
216
217
|
" Refusing to start. This is NOT a spurious check — a second listener can",
|
|
@@ -225,26 +226,26 @@ __installPublicEnv(publicEnvValues)
|
|
|
225
226
|
"",
|
|
226
227
|
" Then re-run. To use a different port instead, change `port` in",
|
|
227
228
|
" app.config.ts."
|
|
228
|
-
].join("\n"),
|
|
229
|
-
let { families:
|
|
230
|
-
if (
|
|
231
|
-
},
|
|
229
|
+
].join("\n"), Pe = async (e, t) => {
|
|
230
|
+
let { families: r } = await Me(e);
|
|
231
|
+
if (r.length !== 0) throw n(Ne(e, t, r));
|
|
232
|
+
}, Y = (e) => e === "effect" || e.startsWith("@effect/") || e.startsWith("@voltro/") || e === "react" || e === "react-dom", Fe = /(^|\/)(\.bin|\.cache|\.pnpm-store|dist|build)(\/|$)/, Ie = (e) => {
|
|
232
233
|
let t = [], n = e;
|
|
233
234
|
for (let e = 0; e < 12; e++) {
|
|
234
|
-
let e =
|
|
235
|
-
|
|
236
|
-
let r =
|
|
235
|
+
let e = O(n, "node_modules");
|
|
236
|
+
j(e) && t.push(e);
|
|
237
|
+
let r = D(n);
|
|
237
238
|
if (r === n) break;
|
|
238
239
|
n = r;
|
|
239
240
|
}
|
|
240
241
|
return t;
|
|
241
|
-
},
|
|
242
|
+
}, Le = (e) => {
|
|
242
243
|
let t = /* @__PURE__ */ new Set([e]), n = e;
|
|
243
244
|
for (let e = 0; e < 12; e++) {
|
|
244
245
|
for (let e of ["pnpm-workspace.yaml", "pnpm-workspace.yml"]) {
|
|
245
246
|
let r;
|
|
246
247
|
try {
|
|
247
|
-
r = O(
|
|
248
|
+
r = N(O(n, e), "utf8");
|
|
248
249
|
} catch {
|
|
249
250
|
continue;
|
|
250
251
|
}
|
|
@@ -255,38 +256,38 @@ __installPublicEnv(publicEnvValues)
|
|
|
255
256
|
if (i === "" || i.includes("*")) continue;
|
|
256
257
|
let a;
|
|
257
258
|
try {
|
|
258
|
-
a =
|
|
259
|
+
a = P(O(n, i), { withFileTypes: !0 });
|
|
259
260
|
} catch {
|
|
260
261
|
continue;
|
|
261
262
|
}
|
|
262
|
-
for (let e of a) e.isDirectory() && t.add(
|
|
263
|
+
for (let e of a) e.isDirectory() && t.add(O(n, i, e.name));
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
for (let e of ["packages", "apps"]) {
|
|
266
267
|
let r;
|
|
267
268
|
try {
|
|
268
|
-
r =
|
|
269
|
+
r = P(O(n, e), { withFileTypes: !0 });
|
|
269
270
|
} catch {
|
|
270
271
|
continue;
|
|
271
272
|
}
|
|
272
|
-
for (let i of r) i.isDirectory() && t.add(
|
|
273
|
+
for (let i of r) i.isDirectory() && t.add(O(n, e, i.name));
|
|
273
274
|
}
|
|
274
|
-
let e =
|
|
275
|
+
let e = D(n);
|
|
275
276
|
if (e === n) break;
|
|
276
277
|
n = e;
|
|
277
278
|
}
|
|
278
279
|
return [...t];
|
|
279
|
-
},
|
|
280
|
+
}, Re = (e) => {
|
|
280
281
|
let t = [];
|
|
281
|
-
for (let n of
|
|
282
|
-
let e =
|
|
282
|
+
for (let n of Le(e)) {
|
|
283
|
+
let e = O(n, "node_modules", "@voltro"), r;
|
|
283
284
|
try {
|
|
284
|
-
r =
|
|
285
|
+
r = P(e);
|
|
285
286
|
} catch {
|
|
286
287
|
continue;
|
|
287
288
|
}
|
|
288
289
|
for (let n of r) {
|
|
289
|
-
let r =
|
|
290
|
+
let r = O(e, n), i = ze(r);
|
|
290
291
|
i !== void 0 && t.push({
|
|
291
292
|
pkg: `@voltro/${n}`,
|
|
292
293
|
version: i,
|
|
@@ -295,38 +296,38 @@ __installPublicEnv(publicEnvValues)
|
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
298
|
return t;
|
|
298
|
-
},
|
|
299
|
+
}, ze = (e) => {
|
|
299
300
|
try {
|
|
300
|
-
let t = JSON.parse(O(
|
|
301
|
+
let t = JSON.parse(N(O(e, "package.json"), "utf8"));
|
|
301
302
|
return typeof t.version == "string" ? t.version : void 0;
|
|
302
303
|
} catch {
|
|
303
304
|
return;
|
|
304
305
|
}
|
|
305
|
-
},
|
|
306
|
+
}, Be = (e) => {
|
|
306
307
|
let t = [], n;
|
|
307
308
|
try {
|
|
308
|
-
n =
|
|
309
|
+
n = P(e);
|
|
309
310
|
} catch {
|
|
310
311
|
return t;
|
|
311
312
|
}
|
|
312
313
|
for (let r of n) {
|
|
313
|
-
if (r.startsWith(".") ||
|
|
314
|
-
let n =
|
|
314
|
+
if (r.startsWith(".") || Fe.test(r)) continue;
|
|
315
|
+
let n = O(e, r);
|
|
315
316
|
if (r.startsWith("@")) {
|
|
316
317
|
let e;
|
|
317
318
|
try {
|
|
318
|
-
e =
|
|
319
|
+
e = P(n);
|
|
319
320
|
} catch {
|
|
320
321
|
continue;
|
|
321
322
|
}
|
|
322
323
|
for (let i of e) t.push({
|
|
323
324
|
pkg: `${r}/${i}`,
|
|
324
|
-
dir:
|
|
325
|
+
dir: O(n, i)
|
|
325
326
|
});
|
|
326
327
|
continue;
|
|
327
328
|
}
|
|
328
329
|
try {
|
|
329
|
-
if (!
|
|
330
|
+
if (!F(n).isDirectory()) continue;
|
|
330
331
|
} catch {
|
|
331
332
|
continue;
|
|
332
333
|
}
|
|
@@ -336,25 +337,25 @@ __installPublicEnv(publicEnvValues)
|
|
|
336
337
|
});
|
|
337
338
|
}
|
|
338
339
|
return t;
|
|
339
|
-
},
|
|
340
|
+
}, Ve = (e) => {
|
|
340
341
|
let t = /* @__PURE__ */ new Map(), n = (e, n, r) => {
|
|
341
|
-
if (!
|
|
342
|
+
if (!Y(e)) return;
|
|
342
343
|
let i = t.get(e) ?? /* @__PURE__ */ new Map();
|
|
343
344
|
i.has(n) || i.set(n, r), t.set(e, i);
|
|
344
345
|
};
|
|
345
|
-
for (let t of
|
|
346
|
-
let t =
|
|
346
|
+
for (let t of Ie(e)) for (let { pkg: e, dir: r } of Be(t)) {
|
|
347
|
+
let t = ze(r);
|
|
347
348
|
t !== void 0 && n(e, t, r);
|
|
348
349
|
}
|
|
349
|
-
for (let { pkg: t, version: r, dir: i } of
|
|
350
|
+
for (let { pkg: t, version: r, dir: i } of Re(e)) n(t, r, i);
|
|
350
351
|
let r = [];
|
|
351
352
|
for (let [n, i] of t) i.size < 2 || r.push({
|
|
352
353
|
pkg: n,
|
|
353
354
|
versions: [...i.keys()].sort(),
|
|
354
|
-
paths: [...i.values()].map((t) =>
|
|
355
|
+
paths: [...i.values()].map((t) => k(e, t)).sort()
|
|
355
356
|
});
|
|
356
357
|
return r.sort((e, t) => e.pkg.localeCompare(t.pkg));
|
|
357
|
-
},
|
|
358
|
+
}, He = (e) => {
|
|
358
359
|
if (e.length !== 0) return [
|
|
359
360
|
`• ${e.length} package(s) resolved at more than one version:`,
|
|
360
361
|
...e.flatMap((e) => [` ${e.pkg} — ${e.versions.join(", ")}`, ...e.paths.map((e) => ` ${e}`)]),
|
|
@@ -372,11 +373,11 @@ __installPublicEnv(publicEnvValues)
|
|
|
372
373
|
" instrument), then reinstall. Do not silence the generated file — it is where",
|
|
373
374
|
" a genuine mistake in your own descriptors surfaces."
|
|
374
375
|
].join("\n");
|
|
375
|
-
},
|
|
376
|
+
}, Ue = (e) => {
|
|
376
377
|
let t = /* @__PURE__ */ new Map();
|
|
377
|
-
for (let n of
|
|
378
|
+
for (let n of Ie(e)) for (let { pkg: e, dir: r } of Be(n)) {
|
|
378
379
|
if (!e.startsWith("@voltro/")) continue;
|
|
379
|
-
let n =
|
|
380
|
+
let n = ze(r);
|
|
380
381
|
n !== void 0 && !t.has(e) && t.set(e, n);
|
|
381
382
|
}
|
|
382
383
|
if (t.size < 2) return;
|
|
@@ -391,7 +392,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
391
392
|
version: t
|
|
392
393
|
})).sort((e, t) => e.pkg.localeCompare(t.pkg))
|
|
393
394
|
};
|
|
394
|
-
},
|
|
395
|
+
}, We = (e) => {
|
|
395
396
|
if (e !== void 0) return [
|
|
396
397
|
`• ${e.behind.length} @voltro/* package(s) are not on ${e.majority}:`,
|
|
397
398
|
...e.behind.map((e) => ` ${e.pkg} ${e.version}`),
|
|
@@ -409,84 +410,86 @@ __installPublicEnv(publicEnvValues)
|
|
|
409
410
|
" its pattern: the one that produced this report was `@voltro/[a-z-]+`,",
|
|
410
411
|
" which silently skips `@voltro/i18n` because the name contains digits."
|
|
411
412
|
].join("\n");
|
|
412
|
-
},
|
|
413
|
-
let n =
|
|
413
|
+
}, Ge = (e, t) => {
|
|
414
|
+
let n = Ue(e);
|
|
414
415
|
n !== void 0 && t.warn?.(`@voltro/* version skew: ${n.behind.length} package(s) are not on ${n.majority}`, {
|
|
415
416
|
majority: n.majority,
|
|
416
417
|
behind: n.behind.map((e) => `${e.pkg}@${e.version}`),
|
|
417
418
|
fix: "the framework ships in lockstep; bump the listed packages and reinstall"
|
|
418
419
|
});
|
|
419
|
-
},
|
|
420
|
+
}, Ke = V({ scope: "vite" }), qe = /\x1b\[[0-9;]*m/g, Je = /^\s*\[?vite\]?\s*(\([a-z-]+\)\s*)?/, Ye = (e) => e.replace(qe, "").replace(Je, "").trim(), Xe = /proxy error/i, Ze = [
|
|
420
421
|
"ECONNREFUSED",
|
|
421
422
|
"ECONNRESET",
|
|
422
423
|
"ECONNABORTED",
|
|
423
424
|
"EPIPE",
|
|
424
425
|
"ETIMEDOUT"
|
|
425
|
-
],
|
|
426
|
+
], Qe = (e, t = 0) => {
|
|
426
427
|
if (e == null || t > 5) return !1;
|
|
427
428
|
let n = e;
|
|
428
|
-
return typeof n.code == "string" &&
|
|
429
|
-
},
|
|
429
|
+
return typeof n.code == "string" && Ze.includes(n.code) || typeof n.message == "string" && Ze.some((e) => n.message.includes(e)) || Array.isArray(n.errors) && n.errors.some((e) => Qe(e, t + 1)) ? !0 : Qe(n.cause, t + 1);
|
|
430
|
+
}, $e = 4e3, et = () => {
|
|
430
431
|
let e = /* @__PURE__ */ new Set(), t = 0, n = {
|
|
431
432
|
hasWarned: !1,
|
|
432
433
|
info: (e) => {
|
|
433
|
-
let t =
|
|
434
|
-
t.length !== 0 &&
|
|
434
|
+
let t = Ye(e);
|
|
435
|
+
t.length !== 0 && Ke.info(t);
|
|
435
436
|
},
|
|
436
437
|
warn: (e) => {
|
|
437
438
|
n.hasWarned = !0;
|
|
438
|
-
let t =
|
|
439
|
-
t.length !== 0 &&
|
|
439
|
+
let t = Ye(e);
|
|
440
|
+
t.length !== 0 && Ke.warn(t);
|
|
440
441
|
},
|
|
441
442
|
warnOnce: (t) => {
|
|
442
|
-
let r =
|
|
443
|
-
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 &&
|
|
443
|
+
let r = Ye(t);
|
|
444
|
+
e.has(r) || (e.add(r), n.hasWarned = !0, r.length !== 0 && Ke.warn(r));
|
|
444
445
|
},
|
|
445
446
|
error: (e, n) => {
|
|
446
|
-
let r =
|
|
447
|
+
let r = Ye(e), i = n?.error;
|
|
447
448
|
if (r.length !== 0) {
|
|
448
|
-
if (
|
|
449
|
+
if (Xe.test(r) && Qe(i)) {
|
|
449
450
|
let e = Date.now();
|
|
450
|
-
e - t >
|
|
451
|
+
e - t > $e && (t = e, Ke.info("waiting for api — proxy upstream not accepting connections yet (still starting?)"));
|
|
451
452
|
return;
|
|
452
453
|
}
|
|
453
|
-
|
|
454
|
+
Ke.error(r, {}, i);
|
|
454
455
|
}
|
|
455
456
|
},
|
|
456
457
|
clearScreen: () => {},
|
|
457
458
|
hasErrorLogged: (e) => !1
|
|
458
459
|
};
|
|
459
460
|
return n;
|
|
460
|
-
},
|
|
461
|
+
}, tt = (e) => e.replace(/\\"|"(?:[^"\\]|\\.)*"|(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e, t) => t ? "" : e), nt = (e) => {
|
|
461
462
|
try {
|
|
462
|
-
let t =
|
|
463
|
-
if (!
|
|
464
|
-
let n = JSON.parse(
|
|
463
|
+
let t = O(e, "tsconfig.json");
|
|
464
|
+
if (!j(t)) return [];
|
|
465
|
+
let n = JSON.parse(tt(N(t, "utf8"))).compilerOptions ?? {}, r = n.paths ?? {}, i = n.baseUrl ?? ".", a = A(e, i), o = [];
|
|
465
466
|
for (let [e, t] of Object.entries(r)) {
|
|
466
467
|
let n = t[0];
|
|
467
468
|
if (!n) continue;
|
|
468
469
|
let r = n.replace(/\\/g, "/");
|
|
469
|
-
if (!(r.includes("/@types/") || r.endsWith(".d.ts")))
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
470
|
+
if (!(r.includes("/@types/") || r.endsWith(".d.ts"))) {
|
|
471
|
+
if (e.endsWith("/*") && n.endsWith("/*")) {
|
|
472
|
+
let t = e.slice(0, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
473
|
+
o.push({
|
|
474
|
+
find: RegExp(`^${t}/(.*)$`),
|
|
475
|
+
replacement: `${O(a, n.slice(0, -2))}/$1`
|
|
476
|
+
});
|
|
477
|
+
} else o.push({
|
|
478
|
+
find: e,
|
|
479
|
+
replacement: O(a, n)
|
|
474
480
|
});
|
|
475
|
-
}
|
|
476
|
-
find: e,
|
|
477
|
-
replacement: C(i, n)
|
|
478
|
-
});
|
|
481
|
+
}
|
|
479
482
|
}
|
|
480
|
-
return
|
|
483
|
+
return o;
|
|
481
484
|
} catch {
|
|
482
485
|
return [];
|
|
483
486
|
}
|
|
484
|
-
},
|
|
487
|
+
}, rt = (e = process.env) => {
|
|
485
488
|
let t = e.VOLTRO_DEV_SSR_COMPILE_CONCURRENCY;
|
|
486
489
|
if (t === void 0 || t.trim() === "") return 4;
|
|
487
490
|
let n = Number(t);
|
|
488
491
|
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 4;
|
|
489
|
-
},
|
|
492
|
+
}, it = (e) => {
|
|
490
493
|
let t = Math.max(1, Math.floor(e)), n = 0, r = [], i = () => n < t ? (n++, Promise.resolve()) : new Promise((e) => r.push(e)), a = () => {
|
|
491
494
|
let e = r.shift();
|
|
492
495
|
e ? e() : n--;
|
|
@@ -504,8 +507,8 @@ __installPublicEnv(publicEnvValues)
|
|
|
504
507
|
return n;
|
|
505
508
|
}
|
|
506
509
|
};
|
|
507
|
-
},
|
|
508
|
-
let t =
|
|
510
|
+
}, at = (e) => {
|
|
511
|
+
let t = it(e.limit), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
509
512
|
return {
|
|
510
513
|
load: (i, a) => {
|
|
511
514
|
if (r.has(i)) return a();
|
|
@@ -535,7 +538,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
535
538
|
return r.size;
|
|
536
539
|
}
|
|
537
540
|
};
|
|
538
|
-
},
|
|
541
|
+
}, ot = (e) => {
|
|
539
542
|
let t = [];
|
|
540
543
|
for (let n of e.split("/").filter(Boolean)) n.startsWith("[[...") && n.endsWith("]]") ? t.push({
|
|
541
544
|
name: n.slice(5, -2),
|
|
@@ -551,12 +554,12 @@ __installPublicEnv(publicEnvValues)
|
|
|
551
554
|
optional: !1
|
|
552
555
|
});
|
|
553
556
|
return t;
|
|
554
|
-
},
|
|
555
|
-
let t =
|
|
557
|
+
}, st = (e) => e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase()), ct = async (e) => {
|
|
558
|
+
let t = A(e);
|
|
556
559
|
for (let e = 0; e < 4; e++) {
|
|
557
|
-
let e =
|
|
558
|
-
if (
|
|
559
|
-
let n = await
|
|
560
|
+
let e = O(t, "project.json");
|
|
561
|
+
if (j(e)) try {
|
|
562
|
+
let n = await M.readFile(e, "utf8");
|
|
560
563
|
return {
|
|
561
564
|
projectDir: t,
|
|
562
565
|
manifest: JSON.parse(n)
|
|
@@ -564,38 +567,38 @@ __installPublicEnv(publicEnvValues)
|
|
|
564
567
|
} catch {
|
|
565
568
|
return null;
|
|
566
569
|
}
|
|
567
|
-
let n =
|
|
570
|
+
let n = D(t);
|
|
568
571
|
if (n === t) break;
|
|
569
572
|
t = n;
|
|
570
573
|
}
|
|
571
574
|
return null;
|
|
572
|
-
},
|
|
573
|
-
let t = await
|
|
575
|
+
}, lt = async (e) => {
|
|
576
|
+
let t = await ct(e);
|
|
574
577
|
if (!t) return [];
|
|
575
|
-
let { projectDir: n, manifest: r } = t, i =
|
|
578
|
+
let { projectDir: n, manifest: r } = t, i = E(e), a = r.apps ?? {}, o = [];
|
|
576
579
|
for (let [e, t] of Object.entries(a)) {
|
|
577
580
|
if (e === i || t.kind !== "web" || typeof t.port != "number") continue;
|
|
578
|
-
let r =
|
|
579
|
-
if (!
|
|
580
|
-
let
|
|
581
|
+
let r = O(n, t.path ?? e), a = O(r, "src", "pages");
|
|
582
|
+
if (!j(a)) continue;
|
|
583
|
+
let s;
|
|
581
584
|
try {
|
|
582
|
-
let { pages: e } = await $(
|
|
583
|
-
|
|
585
|
+
let { pages: e } = await $(a);
|
|
586
|
+
s = e.map((e) => ({
|
|
584
587
|
pattern: e.pattern,
|
|
585
|
-
params:
|
|
588
|
+
params: ot(e.pattern)
|
|
586
589
|
}));
|
|
587
590
|
} catch {
|
|
588
591
|
continue;
|
|
589
592
|
}
|
|
590
593
|
o.push({
|
|
591
|
-
key:
|
|
594
|
+
key: st(e),
|
|
592
595
|
origin: `http://localhost:${t.port}`,
|
|
593
596
|
...typeof t.origin == "string" && t.origin.length > 0 ? { prodOrigin: t.origin } : {},
|
|
594
|
-
routes:
|
|
597
|
+
routes: s
|
|
595
598
|
});
|
|
596
599
|
}
|
|
597
600
|
return o;
|
|
598
|
-
},
|
|
601
|
+
}, ut = (e) => {
|
|
599
602
|
if (e.params.length === 0) return `'${e.pattern}'`;
|
|
600
603
|
let t = e.pattern;
|
|
601
604
|
for (let n of e.params) {
|
|
@@ -603,21 +606,21 @@ __installPublicEnv(publicEnvValues)
|
|
|
603
606
|
t = t.replace(e, r);
|
|
604
607
|
}
|
|
605
608
|
return "`" + t + "`";
|
|
606
|
-
},
|
|
609
|
+
}, dt = (e) => e.params.length === 0 ? "EmptyParams" : `{ ${e.params.map((e) => {
|
|
607
610
|
let t = "string";
|
|
608
611
|
return e.optional ? `readonly ${e.name}?: ${t}` : `readonly ${e.name}: ${t}`;
|
|
609
|
-
}).join("; ")} }`,
|
|
610
|
-
let r =
|
|
612
|
+
}).join("; ")} }`, ft = (e, t, n) => {
|
|
613
|
+
let r = dt(e), i = ut(e), a = t ? "VoltroExternalUrl" : "VoltroRouteUrl", o = t && n ? `${n} + ` : "";
|
|
611
614
|
return e.params.length === 0 ? `() => (${o}${i}) as ${a}` : `({ ${e.params.map((e) => e.name).join(", ")} }: ${r}) => (${o}${i}) as ${a}`;
|
|
612
|
-
},
|
|
615
|
+
}, pt = (e) => `{\n${[...e].sort((e, t) => e.pattern.localeCompare(t.pattern)).map((e) => ` ${JSON.stringify(e.pattern)}: ${ft(e, !1)},`).join("\n")}\n}`, mt = (e, t) => {
|
|
613
616
|
if (e.routes.length === 0) return ` ${e.key}: {} as Record<string, never>,`;
|
|
614
|
-
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)}: ${
|
|
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)}: ${ft(e, !0, i)},`);
|
|
615
618
|
return ` ${e.key}: {\n${a.join("\n")}\n },`;
|
|
616
|
-
},
|
|
619
|
+
}, ht = async (e) => {
|
|
617
620
|
let t = e.pages.map((e) => ({
|
|
618
621
|
pattern: e.pattern,
|
|
619
|
-
params:
|
|
620
|
-
})), n = await
|
|
622
|
+
params: ot(e.pattern)
|
|
623
|
+
})), n = await lt(e.appRoot), r = [
|
|
621
624
|
"// THIS FILE IS GENERATED — DO NOT EDIT BY HAND.",
|
|
622
625
|
"// Re-emitted by `voltro dev` whenever `src/pages/**` changes.",
|
|
623
626
|
"// Type-safe route builders consumed by <Link to={...}>.",
|
|
@@ -626,50 +629,50 @@ __installPublicEnv(publicEnvValues)
|
|
|
626
629
|
"",
|
|
627
630
|
"type EmptyParams = Record<string, never>",
|
|
628
631
|
""
|
|
629
|
-
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${
|
|
630
|
-
await
|
|
632
|
+
].join("\n"), i = e.mode ?? "dev", a = `${r}\n${`export const routes = ${pt(t)} as const\n`}\n${n.length === 0 ? "export const siblingApps = {} as Record<string, never>\n" : `export const siblingApps = {\n${n.map((e) => mt(e, i)).join("\n")}\n} as const\n`}`, o = O(e.appRoot, ".framework", "routes.generated.ts");
|
|
633
|
+
await M.mkdir(D(o), { recursive: !0 });
|
|
631
634
|
let s = null;
|
|
632
635
|
try {
|
|
633
|
-
s = await
|
|
636
|
+
s = await M.readFile(o, "utf8");
|
|
634
637
|
} catch {}
|
|
635
638
|
return s === a ? {
|
|
636
639
|
path: o,
|
|
637
640
|
wrote: !1
|
|
638
|
-
} : (await
|
|
641
|
+
} : (await M.writeFile(o, a, "utf8"), {
|
|
639
642
|
path: o,
|
|
640
643
|
wrote: !0
|
|
641
644
|
});
|
|
642
|
-
},
|
|
645
|
+
}, gt = (e) => {
|
|
643
646
|
if (e === "" || e === "/") return "/";
|
|
644
647
|
let t = e.startsWith("/") ? e : `/${e}`;
|
|
645
648
|
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
646
|
-
},
|
|
647
|
-
let n = e.endsWith("/") ? e.slice(0, -1) : e, r =
|
|
649
|
+
}, _t = (e, t) => {
|
|
650
|
+
let n = e.endsWith("/") ? e.slice(0, -1) : e, r = gt(t);
|
|
648
651
|
return r === "/" ? `${n}/` : `${n}${r}`;
|
|
649
|
-
},
|
|
650
|
-
let r =
|
|
652
|
+
}, vt = (e, t, n) => {
|
|
653
|
+
let r = gt(e);
|
|
651
654
|
return t === n ? r : r === "/" ? `/${t}` : `/${t}${r}`;
|
|
652
|
-
},
|
|
655
|
+
}, yt = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), bt = (e) => {
|
|
653
656
|
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) => {
|
|
654
657
|
if (!r) return "";
|
|
655
|
-
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${
|
|
656
|
-
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${
|
|
658
|
+
let n = r.map((n) => ` <xhtml:link rel="alternate" hreflang="${yt(n)}" href="${yt(_t(t, vt(e, n, i)))}" />`);
|
|
659
|
+
return n.push(` <xhtml:link rel="alternate" hreflang="x-default" href="${yt(_t(t, vt(e, i, i)))}" />`), `\n${n.join("\n")}`;
|
|
657
660
|
};
|
|
658
661
|
for (let e of n) {
|
|
659
662
|
let n = r ?? [i];
|
|
660
663
|
for (let r of n) {
|
|
661
|
-
let n =
|
|
662
|
-
o.set(n, ` <url>\n <loc>${
|
|
664
|
+
let n = _t(t, vt(e.path, r, i)), a = e.lastmod ? `\n <lastmod>${yt(e.lastmod)}</lastmod>` : "";
|
|
665
|
+
o.set(n, ` <url>\n <loc>${yt(n)}</loc>${a}${s(e.path)}\n </url>`);
|
|
663
666
|
}
|
|
664
667
|
}
|
|
665
668
|
let c = [...o.keys()].sort().map((e) => o.get(e)).join("\n");
|
|
666
669
|
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`;
|
|
667
|
-
},
|
|
670
|
+
}, xt = (e) => {
|
|
668
671
|
if (!e.indexable) return "User-agent: *\nDisallow: /\n";
|
|
669
672
|
let t = ["User-agent: *", "Allow: /"];
|
|
670
|
-
for (let n of e.disallow ?? []) t.push(`Disallow: ${
|
|
673
|
+
for (let n of e.disallow ?? []) t.push(`Disallow: ${gt(n)}`);
|
|
671
674
|
return e.sitemapUrl && t.push("", `Sitemap: ${e.sitemapUrl}`), `${t.join("\n")}\n`;
|
|
672
|
-
},
|
|
675
|
+
}, St = 256, Ct = (e = St) => {
|
|
673
676
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
674
677
|
return {
|
|
675
678
|
emit(r, i) {
|
|
@@ -692,17 +695,19 @@ __installPublicEnv(publicEnvValues)
|
|
|
692
695
|
return t.slice();
|
|
693
696
|
}
|
|
694
697
|
};
|
|
695
|
-
},
|
|
696
|
-
let n =
|
|
698
|
+
}, wt = (e) => `event: ${e.channel}\ndata: ${JSON.stringify(e)}\n\n`, Tt = () => `: keep-alive ${Date.now()}\n\n`, Et = 8e3, Dt = (e, t = Et) => {
|
|
699
|
+
let n = kt(e);
|
|
697
700
|
return n.length <= t ? n : `${n.slice(0, t)}\n… [voltro] truncated at ${t} chars (${n.length} total)`;
|
|
698
|
-
},
|
|
701
|
+
}, Ot = 4, kt = (e, t = 0, n = /* @__PURE__ */ new Set()) => {
|
|
699
702
|
if (e instanceof Error) {
|
|
700
703
|
let r = e.stack ?? `${e.name}: ${e.message}`;
|
|
701
704
|
if (n.has(e)) return `${r}\n [cycle]`;
|
|
702
705
|
n.add(e);
|
|
703
706
|
let i = [];
|
|
704
|
-
if (t <
|
|
705
|
-
|
|
707
|
+
if (t < Ot) {
|
|
708
|
+
if (e instanceof AggregateError && Array.isArray(e.errors)) for (let [r, a] of e.errors.entries()) i.push(`\n [aggregate ${r}] ${At(kt(a, t + 1, n))}`);
|
|
709
|
+
else e.cause !== void 0 && e.cause !== null && i.push(`\n [cause] ${At(kt(e.cause, t + 1, n))}`);
|
|
710
|
+
}
|
|
706
711
|
return r + i.join("");
|
|
707
712
|
}
|
|
708
713
|
try {
|
|
@@ -710,30 +715,30 @@ __installPublicEnv(publicEnvValues)
|
|
|
710
715
|
} catch {
|
|
711
716
|
return "[unstringifiable thrown value]";
|
|
712
717
|
}
|
|
713
|
-
},
|
|
718
|
+
}, At = (e) => {
|
|
714
719
|
let t = e.split("\n");
|
|
715
720
|
return t.length <= 3 ? e : `${t.slice(0, 3).join("\n")}\n …`;
|
|
716
|
-
},
|
|
721
|
+
}, jt = {
|
|
717
722
|
trace: 0,
|
|
718
723
|
debug: 1,
|
|
719
724
|
info: 2,
|
|
720
725
|
warn: 3,
|
|
721
726
|
error: 4,
|
|
722
727
|
fatal: 5
|
|
723
|
-
},
|
|
728
|
+
}, Mt = 2e3, Nt = 200, Pt = class {
|
|
724
729
|
capacity;
|
|
725
730
|
buffer = [];
|
|
726
|
-
constructor(e =
|
|
731
|
+
constructor(e = Mt) {
|
|
727
732
|
this.capacity = e;
|
|
728
733
|
}
|
|
729
734
|
append(e) {
|
|
730
735
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
731
736
|
}
|
|
732
737
|
query(e = {}) {
|
|
733
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
738
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? Nt, this.capacity), i = e.minLevel === void 0 ? jt.trace : jt[e.minLevel], a = e.scope?.toLowerCase(), o = e.source, s = e.filter?.toLowerCase(), c = e.traceId, l = [];
|
|
734
739
|
for (let e = this.buffer.length - 1; e >= 0 && l.length < r; e--) {
|
|
735
740
|
let r = this.buffer[e];
|
|
736
|
-
r.ts < t || r.ts > n ||
|
|
741
|
+
r.ts < t || r.ts > n || jt[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));
|
|
737
742
|
}
|
|
738
743
|
return l.reverse();
|
|
739
744
|
}
|
|
@@ -746,7 +751,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
746
751
|
clear() {
|
|
747
752
|
this.buffer = [];
|
|
748
753
|
}
|
|
749
|
-
},
|
|
754
|
+
}, Ft = null, It = () => (Ft === null && (Ft = new Pt()), Ft), Lt = (e) => {
|
|
750
755
|
if (typeof e == "string") return e;
|
|
751
756
|
if (e instanceof Error) return e.message;
|
|
752
757
|
try {
|
|
@@ -754,28 +759,28 @@ __installPublicEnv(publicEnvValues)
|
|
|
754
759
|
} catch {
|
|
755
760
|
return String(e);
|
|
756
761
|
}
|
|
757
|
-
},
|
|
762
|
+
}, Rt = 8e3, zt = (e) => typeof e == "string" ? e.length <= Rt ? e : `${e.slice(0, Rt)}… [voltro: truncated]` : typeof e != "object" || !e ? e : Dt(e, Rt), Bt = (e, t) => {
|
|
758
763
|
try {
|
|
759
764
|
e(...t);
|
|
760
765
|
} catch (n) {
|
|
761
766
|
try {
|
|
762
|
-
e(...t.map(
|
|
767
|
+
e(...t.map(zt)), e(` ↑ [voltro] an argument above was too large for console formatting (${n?.message ?? "inspect failed"}) — printed bounded to ${Rt} chars per argument.`);
|
|
763
768
|
} catch {
|
|
764
769
|
e(`[voltro] a console.error argument could not be formatted at all (${t.length} arg(s)).`);
|
|
765
770
|
}
|
|
766
771
|
}
|
|
767
|
-
},
|
|
772
|
+
}, Vt = (e) => {
|
|
768
773
|
let t = {
|
|
769
774
|
log: console.log.bind(console),
|
|
770
775
|
info: console.info.bind(console),
|
|
771
776
|
warn: console.warn.bind(console),
|
|
772
777
|
error: console.error.bind(console),
|
|
773
778
|
debug: console.debug.bind(console)
|
|
774
|
-
}, n =
|
|
775
|
-
if (
|
|
779
|
+
}, n = It(), r = !1, i = (i) => (...a) => {
|
|
780
|
+
if (Bt(t[i], a), !r) {
|
|
776
781
|
r = !0;
|
|
777
782
|
try {
|
|
778
|
-
let t = a.length > 0 ?
|
|
783
|
+
let t = a.length > 0 ? Lt(a[0]) : "", r = t.length > 500 ? t.slice(0, 500) + "…" : t, o = U();
|
|
779
784
|
e.emit("log", {
|
|
780
785
|
level: i,
|
|
781
786
|
message: r,
|
|
@@ -802,7 +807,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
802
807
|
}
|
|
803
808
|
};
|
|
804
809
|
console.log = i("log"), console.info = i("info"), console.warn = i("warn"), console.error = i("error"), console.debug = i("debug");
|
|
805
|
-
let a =
|
|
810
|
+
let a = B((t) => {
|
|
806
811
|
if (!r) {
|
|
807
812
|
r = !0;
|
|
808
813
|
try {
|
|
@@ -813,7 +818,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
813
818
|
argsCount: 1,
|
|
814
819
|
...t.scope === void 0 ? {} : { scope: t.scope }
|
|
815
820
|
});
|
|
816
|
-
let a =
|
|
821
|
+
let a = U(), o = a !== void 0 && t.fields.traceId === void 0 ? {
|
|
817
822
|
...t.fields,
|
|
818
823
|
traceId: a.traceId
|
|
819
824
|
} : t.fields;
|
|
@@ -833,24 +838,24 @@ __installPublicEnv(publicEnvValues)
|
|
|
833
838
|
return () => {
|
|
834
839
|
console.log = t.log, console.info = t.info, console.warn = t.warn, console.error = t.error, console.debug = t.debug, a();
|
|
835
840
|
};
|
|
836
|
-
},
|
|
841
|
+
}, Ht = 2e3, Ut = 8, Wt = 1e3, Gt = 200, X = (e, t) => e.length > t ? `${e.slice(0, t)}…` : e, Kt = (e) => {
|
|
837
842
|
switch (e) {
|
|
838
843
|
case "error": return "error";
|
|
839
844
|
case "warn": return "warn";
|
|
840
845
|
case "debug": return "debug";
|
|
841
846
|
default: return "info";
|
|
842
847
|
}
|
|
843
|
-
},
|
|
848
|
+
}, qt = V({ scope: "client" }), Jt = (e, t) => {
|
|
844
849
|
let n;
|
|
845
850
|
try {
|
|
846
851
|
n = JSON.parse(e);
|
|
847
852
|
} catch {
|
|
848
|
-
return
|
|
853
|
+
return Yt(400, { error: "invalid JSON body" });
|
|
849
854
|
}
|
|
850
|
-
if (typeof n != "object" || !n) return
|
|
855
|
+
if (typeof n != "object" || !n) return Yt(400, { error: "body must be a JSON object" });
|
|
851
856
|
let r = n;
|
|
852
|
-
if (!Array.isArray(r.entries)) return
|
|
853
|
-
let i = typeof r.app == "string" ? X(r.app, 120) : void 0, a = typeof r.page == "string" ? X(r.page, 200) : void 0, o = typeof r.ua == "string" ? X(r.ua, 200) : void 0, s = r.entries.slice(0,
|
|
857
|
+
if (!Array.isArray(r.entries)) return Yt(400, { error: "entries must be an array" });
|
|
858
|
+
let i = typeof r.app == "string" ? X(r.app, 120) : void 0, a = typeof r.page == "string" ? X(r.page, 200) : void 0, o = typeof r.ua == "string" ? X(r.ua, 200) : void 0, s = r.entries.slice(0, Gt), c = 0;
|
|
854
859
|
for (let e of s) {
|
|
855
860
|
if (typeof e != "object" || !e) continue;
|
|
856
861
|
let n = e;
|
|
@@ -861,7 +866,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
861
866
|
"warn",
|
|
862
867
|
"error",
|
|
863
868
|
"debug"
|
|
864
|
-
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = X(n.message,
|
|
869
|
+
].includes(n.level) ? n.level : "log", s = typeof n.ts == "number" && Number.isFinite(n.ts) ? n.ts : Date.now(), l = X(n.message, Ht), u = Array.isArray(n.args) ? n.args.slice(0, Ut).filter((e) => typeof e == "string").map((e) => X(e, Wt)) : void 0, d = typeof n.stack == "string" ? X(n.stack, Ht) : void 0;
|
|
865
870
|
t.emit("clientLog", {
|
|
866
871
|
ts: s,
|
|
867
872
|
level: r,
|
|
@@ -876,41 +881,41 @@ __installPublicEnv(publicEnvValues)
|
|
|
876
881
|
...i === void 0 ? {} : { app: i },
|
|
877
882
|
...a === void 0 ? {} : { page: a },
|
|
878
883
|
...u !== void 0 && u.length > 0 ? { args: u } : {}
|
|
879
|
-
}, p =
|
|
880
|
-
(p === "error" || p === "warn") && d !== void 0 ?
|
|
884
|
+
}, p = Kt(r);
|
|
885
|
+
(p === "error" || p === "warn") && d !== void 0 ? qt[p](l, f, { stack: d }) : qt[p](l, {
|
|
881
886
|
...f,
|
|
882
887
|
...d === void 0 ? {} : { stack: d }
|
|
883
888
|
}), c++;
|
|
884
889
|
}
|
|
885
|
-
return
|
|
890
|
+
return Yt(202, {
|
|
886
891
|
accepted: c,
|
|
887
892
|
dropped: r.entries.length - c
|
|
888
893
|
});
|
|
889
|
-
},
|
|
894
|
+
}, Yt = (e, t) => ({
|
|
890
895
|
status: e,
|
|
891
896
|
contentType: "application/json; charset=utf-8",
|
|
892
897
|
body: JSON.stringify(t)
|
|
893
|
-
}),
|
|
898
|
+
}), Xt = "/_voltro/inspect/clientLog", Zt = [
|
|
894
899
|
"trace",
|
|
895
900
|
"debug",
|
|
896
901
|
"info",
|
|
897
902
|
"warn",
|
|
898
903
|
"error",
|
|
899
904
|
"fatal"
|
|
900
|
-
],
|
|
905
|
+
], Qt = {
|
|
901
906
|
trace: "TRACE",
|
|
902
907
|
debug: "DEBUG",
|
|
903
908
|
info: "INFO ",
|
|
904
909
|
warn: "WARN ",
|
|
905
910
|
error: "ERROR",
|
|
906
911
|
fatal: "FATAL"
|
|
907
|
-
},
|
|
908
|
-
if (
|
|
912
|
+
}, $t = (e) => Zt.includes(e), en = (e, t, n = {}) => {
|
|
913
|
+
if (u()) return {
|
|
909
914
|
status: 503,
|
|
910
915
|
contentType: "application/json",
|
|
911
916
|
body: JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" })
|
|
912
917
|
};
|
|
913
|
-
let r =
|
|
918
|
+
let r = f(n, "GET");
|
|
914
919
|
if (!r.ok) return {
|
|
915
920
|
status: 401,
|
|
916
921
|
contentType: "application/json",
|
|
@@ -919,36 +924,36 @@ __installPublicEnv(publicEnvValues)
|
|
|
919
924
|
reason: r.reason
|
|
920
925
|
})
|
|
921
926
|
};
|
|
922
|
-
let i = e.indexOf("?"),
|
|
927
|
+
let i = e.indexOf("?"), a = i === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(i + 1)), o = {}, s = a.get("since");
|
|
928
|
+
if (s !== null) {
|
|
929
|
+
let e = Number(s);
|
|
930
|
+
Number.isFinite(e) && (o.since = e);
|
|
931
|
+
}
|
|
932
|
+
let c = a.get("until");
|
|
933
|
+
if (c !== null) {
|
|
934
|
+
let e = Number(c);
|
|
935
|
+
Number.isFinite(e) && (o.until = e);
|
|
936
|
+
}
|
|
937
|
+
let l = a.get("max");
|
|
923
938
|
if (l !== null) {
|
|
924
939
|
let e = Number(l);
|
|
925
|
-
Number.isFinite(e) && (
|
|
926
|
-
}
|
|
927
|
-
let
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
let
|
|
938
|
-
|
|
939
|
-
let p = o.get("source");
|
|
940
|
-
(p === "server" || p === "client") && (c.source = p);
|
|
941
|
-
let m = o.get("scope");
|
|
942
|
-
m !== null && m.length > 0 && (c.scope = m);
|
|
943
|
-
let h = o.get("filter");
|
|
944
|
-
h !== null && h.length > 0 && (c.filter = h);
|
|
945
|
-
let g = o.get("trace");
|
|
946
|
-
g !== null && g.length > 0 && (c.traceId = g);
|
|
947
|
-
let _ = t.query(c);
|
|
948
|
-
if ((o.get("format") ?? "json") === "text") return {
|
|
940
|
+
Number.isFinite(e) && e > 0 && (o.max = Math.floor(e));
|
|
941
|
+
}
|
|
942
|
+
let d = a.get("level");
|
|
943
|
+
d !== null && $t(d) && (o.minLevel = d);
|
|
944
|
+
let p = a.get("source");
|
|
945
|
+
(p === "server" || p === "client") && (o.source = p);
|
|
946
|
+
let m = a.get("scope");
|
|
947
|
+
m !== null && m.length > 0 && (o.scope = m);
|
|
948
|
+
let h = a.get("filter");
|
|
949
|
+
h !== null && h.length > 0 && (o.filter = h);
|
|
950
|
+
let g = a.get("trace");
|
|
951
|
+
g !== null && g.length > 0 && (o.traceId = g);
|
|
952
|
+
let _ = t.query(o);
|
|
953
|
+
if ((a.get("format") ?? "json") === "text") return {
|
|
949
954
|
status: 200,
|
|
950
955
|
contentType: "text/plain; charset=utf-8",
|
|
951
|
-
body: _.map(
|
|
956
|
+
body: _.map(tn).join("\n") + (_.length > 0 ? "\n" : "")
|
|
952
957
|
};
|
|
953
958
|
let v = {
|
|
954
959
|
capturedAt: Date.now(),
|
|
@@ -962,40 +967,40 @@ __installPublicEnv(publicEnvValues)
|
|
|
962
967
|
contentType: "application/json; charset=utf-8",
|
|
963
968
|
body: JSON.stringify(v)
|
|
964
969
|
};
|
|
965
|
-
},
|
|
966
|
-
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 =
|
|
967
|
-
return `${n}:${r}:${i}.${a} ${
|
|
968
|
-
},
|
|
970
|
+
}, tn = (e) => {
|
|
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 = rn(e.fields);
|
|
972
|
+
return `${n}:${r}:${i}.${a} ${Qt[e.level]} ${o} ${e.message}${s}`;
|
|
973
|
+
}, nn = 80, rn = (e) => {
|
|
969
974
|
let t = Object.entries(e);
|
|
970
975
|
if (t.length === 0) return "";
|
|
971
976
|
let n = [];
|
|
972
977
|
for (let [e, r] of t) {
|
|
973
978
|
if (r === void 0) continue;
|
|
974
|
-
let t =
|
|
979
|
+
let t = an(r);
|
|
975
980
|
n.push(`${e}=${t}`);
|
|
976
981
|
}
|
|
977
982
|
return n.length > 0 ? " " + n.join(" ") : "";
|
|
978
|
-
},
|
|
983
|
+
}, an = (e) => {
|
|
979
984
|
if (typeof e == "string") {
|
|
980
|
-
let t = e.length >
|
|
985
|
+
let t = e.length > nn ? e.slice(0, nn) + "…" : e;
|
|
981
986
|
return /[\s=]/.test(t) ? `"${t.replace(/"/g, "\\\"")}"` : t;
|
|
982
987
|
}
|
|
983
988
|
if (e === null) return "null";
|
|
984
989
|
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
985
990
|
try {
|
|
986
991
|
let t = JSON.stringify(e);
|
|
987
|
-
return t.length >
|
|
992
|
+
return t.length > nn ? t.slice(0, nn) + "…" : t;
|
|
988
993
|
} catch {
|
|
989
994
|
return "[unserialisable]";
|
|
990
995
|
}
|
|
991
|
-
},
|
|
996
|
+
}, on = "/_voltro/inspect/logs", sn = (e, t, n) => {
|
|
992
997
|
if (t.headers.authorization !== void 0) return !1;
|
|
993
998
|
let { token: r } = n;
|
|
994
999
|
if (r === void 0 || r === "" || !n.isLoopback(n.target)) return !1;
|
|
995
1000
|
e.setHeader("authorization", `Bearer ${r}`);
|
|
996
1001
|
let i = n.writeToken;
|
|
997
1002
|
return i !== void 0 && i !== "" && t.headers["x-voltro-inspect-write"] === void 0 && e.setHeader("x-voltro-inspect-write", i), !0;
|
|
998
|
-
},
|
|
1003
|
+
}, cn = [{
|
|
999
1004
|
match: (e) => typeof e == "string" && e.startsWith("[BABEL] Note: The code generator has deoptimised"),
|
|
1000
1005
|
handle: (e, t) => {
|
|
1001
1006
|
let n = e[0], r = n.match(/deoptimised the styling of (.+?) as it exceeds the max of (\d+\w*B)\.?/);
|
|
@@ -1007,13 +1012,13 @@ __installPublicEnv(publicEnvValues)
|
|
|
1007
1012
|
});
|
|
1008
1013
|
} else t.info(n);
|
|
1009
1014
|
}
|
|
1010
|
-
}],
|
|
1015
|
+
}], ln = () => {
|
|
1011
1016
|
let e = {
|
|
1012
1017
|
warn: console.warn.bind(console),
|
|
1013
1018
|
error: console.error.bind(console)
|
|
1014
|
-
}, t =
|
|
1019
|
+
}, t = V({ scope: "babel" }), n = !1, r = (r) => (...i) => {
|
|
1015
1020
|
if (!n) {
|
|
1016
|
-
for (let e of
|
|
1021
|
+
for (let e of cn) if (e.match(i[0])) {
|
|
1017
1022
|
n = !0;
|
|
1018
1023
|
try {
|
|
1019
1024
|
e.handle(i, t);
|
|
@@ -1028,7 +1033,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1028
1033
|
return console.warn = r("warn"), console.error = r("error"), () => {
|
|
1029
1034
|
console.warn = e.warn, console.error = e.error;
|
|
1030
1035
|
};
|
|
1031
|
-
},
|
|
1036
|
+
}, un = {
|
|
1032
1037
|
loader: "it runs on the server, and the router caches its result per route + params",
|
|
1033
1038
|
renderMode: "it picks the server render strategy",
|
|
1034
1039
|
dynamic: "it picks the server render strategy",
|
|
@@ -1039,7 +1044,7 @@ __installPublicEnv(publicEnvValues)
|
|
|
1039
1044
|
cacheInvalidatesOn: "it wires this page into the ISR cache invalidator",
|
|
1040
1045
|
interactive: "it decides how much client JS the server ships",
|
|
1041
1046
|
tenantAware: "it is part of the server-side cache key"
|
|
1042
|
-
},
|
|
1047
|
+
}, dn = Object.keys(un), fn = "virtual:voltro-route-refresh", pn = `\0${fn}`, mn = /(?:^|&)(raw|url|inline|worker|sharedworker|direct)(?:&|=|$)/, hn = () => `
|
|
1043
1048
|
// GENERATED by @voltro/cli — the \`voltro dev\` route Fast Refresh runtime.
|
|
1044
1049
|
|
|
1045
1050
|
/** Mirrors react-refresh's own \`isLikelyComponentType\` closely enough for the
|
|
@@ -1068,11 +1073,11 @@ const stableForm = (value) => {
|
|
|
1068
1073
|
* readers (\`build.ts\` prerender, \`webDev.ts\` dev SSR, \`start.ts\`). A change to
|
|
1069
1074
|
* one of THESE cannot be hot-applied: the server already ran with the old
|
|
1070
1075
|
* value. Everything else a page exports is plain client-side data. */
|
|
1071
|
-
const serverRelevantExports = ${JSON.stringify(
|
|
1076
|
+
const serverRelevantExports = ${JSON.stringify(dn)}
|
|
1072
1077
|
|
|
1073
1078
|
/** Name → the server step that already consumed it, so the reload message can
|
|
1074
1079
|
* say WHY rather than just WHAT. Injected from the same single source. */
|
|
1075
|
-
const serverExportEffect = ${JSON.stringify(
|
|
1080
|
+
const serverExportEffect = ${JSON.stringify(un)}
|
|
1076
1081
|
|
|
1077
1082
|
/** The reason \`name\` forces a reload, for the console line. */
|
|
1078
1083
|
export const serverEffectOf = (name) =>
|
|
@@ -1115,7 +1120,7 @@ export const routeUpdateNeedsReload = (prevExports, nextExports) => {
|
|
|
1115
1120
|
const previousHook = globalThis.__getReactRefreshIgnoredExports
|
|
1116
1121
|
globalThis.__getReactRefreshIgnoredExports = (args) =>
|
|
1117
1122
|
ignoredExports.get(args.id) ?? previousHook?.(args) ?? []
|
|
1118
|
-
`,
|
|
1123
|
+
`, gn = (e) => `
|
|
1119
1124
|
if (import.meta.hot) {
|
|
1120
1125
|
// Self-import to read our OWN exports, the same technique the react plugin
|
|
1121
1126
|
// uses; the namespace is only complete after evaluation, hence the promise.
|
|
@@ -1142,128 +1147,128 @@ import {
|
|
|
1142
1147
|
registerRouteModule as __voltro_registerRouteModule,
|
|
1143
1148
|
routeUpdateNeedsReload as __voltro_routeUpdateNeedsReload,
|
|
1144
1149
|
serverEffectOf as __voltro_serverEffect,
|
|
1145
|
-
} from '${
|
|
1146
|
-
`,
|
|
1147
|
-
let [n = "",
|
|
1148
|
-
if (!n.endsWith(".tsx") ||
|
|
1149
|
-
let
|
|
1150
|
-
return n.startsWith(`${
|
|
1151
|
-
},
|
|
1150
|
+
} from '${fn}'
|
|
1151
|
+
`, _n = (e) => e.replace(/\\/g, "/"), vn = (e, t) => {
|
|
1152
|
+
let [n = "", r] = _n(e).split("?");
|
|
1153
|
+
if (!n.endsWith(".tsx") || r !== void 0 && mn.test(r)) return !1;
|
|
1154
|
+
let i = _n(t).replace(/\/$/, "");
|
|
1155
|
+
return n.startsWith(`${i}/`) ? c.test(n) || s.has(n.slice(n.lastIndexOf("/") + 1)) : !1;
|
|
1156
|
+
}, yn = (e, t, n) => vn(t, n) ? `${e}${gn(_n(t).split("?")[0] ?? t)}` : null, bn = (e) => ({
|
|
1152
1157
|
name: "voltro:route-fast-refresh",
|
|
1153
1158
|
enforce: "pre",
|
|
1154
|
-
resolveId: (e) => e === "virtual:voltro-route-refresh" ?
|
|
1155
|
-
load: (e) => e ===
|
|
1159
|
+
resolveId: (e) => e === "virtual:voltro-route-refresh" ? pn : void 0,
|
|
1160
|
+
load: (e) => e === pn ? hn() : void 0,
|
|
1156
1161
|
transform: (t, n, r) => {
|
|
1157
1162
|
if (r?.ssr === !0) return null;
|
|
1158
|
-
let i =
|
|
1163
|
+
let i = yn(t, n, e);
|
|
1159
1164
|
return i === null ? null : {
|
|
1160
1165
|
code: i,
|
|
1161
1166
|
map: null
|
|
1162
1167
|
};
|
|
1163
1168
|
}
|
|
1164
|
-
}),
|
|
1169
|
+
}), xn = V({ scope: "voltro:dashboard" }), Sn = te(import.meta.url), Cn = 5179, wn = (e) => {
|
|
1165
1170
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1166
|
-
if (t &&
|
|
1171
|
+
if (t && j(O(A(t), "app.config.ts"))) return A(t);
|
|
1167
1172
|
try {
|
|
1168
|
-
let e =
|
|
1169
|
-
if (
|
|
1173
|
+
let e = D(Sn.resolve("@voltro/dashboard/package.json"));
|
|
1174
|
+
if (j(O(e, "app.config.ts"))) return e;
|
|
1170
1175
|
} catch {}
|
|
1171
|
-
let n =
|
|
1176
|
+
let n = O("voltro-devtools", "apps", "dashboard"), r = A(e);
|
|
1172
1177
|
for (let e = 0; e < 10; e++) {
|
|
1173
|
-
let e =
|
|
1174
|
-
if (
|
|
1175
|
-
let t =
|
|
1178
|
+
let e = O(r, n);
|
|
1179
|
+
if (j(O(e, "app.config.ts"))) return e;
|
|
1180
|
+
let t = D(r);
|
|
1176
1181
|
if (t === r) break;
|
|
1177
1182
|
r = t;
|
|
1178
1183
|
}
|
|
1179
1184
|
return null;
|
|
1180
|
-
},
|
|
1181
|
-
let i =
|
|
1185
|
+
}, Tn = "VOLTRO_IS_DASHBOARD", En = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1186
|
+
let i = pe({
|
|
1182
1187
|
port: e,
|
|
1183
1188
|
host: t
|
|
1184
1189
|
}), a = !1, o = (e) => {
|
|
1185
1190
|
a || (a = !0, i.destroy(), r(e));
|
|
1186
1191
|
};
|
|
1187
1192
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1188
|
-
}),
|
|
1193
|
+
}), Dn = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), On = () => process.env[Tn] === "1", kn = () => process.stdout.isTTY === !0, An = O(H(), ".voltro", "dashboard-launch.lock"), jn = 1e4, Mn = async () => {
|
|
1189
1194
|
try {
|
|
1190
|
-
await
|
|
1191
|
-
let e = await
|
|
1195
|
+
await M.mkdir(D(An), { recursive: !0 });
|
|
1196
|
+
let e = await M.open(An, "wx");
|
|
1192
1197
|
return await e.write(`${process.pid}\n${Date.now()}\n`), await e.close(), !0;
|
|
1193
1198
|
} catch {
|
|
1194
1199
|
try {
|
|
1195
|
-
let e = await
|
|
1196
|
-
if (Date.now() - e.mtimeMs >
|
|
1200
|
+
let e = await M.stat(An);
|
|
1201
|
+
if (Date.now() - e.mtimeMs > jn) return await M.unlink(An).catch(() => void 0), Mn();
|
|
1197
1202
|
} catch {}
|
|
1198
1203
|
return !1;
|
|
1199
1204
|
}
|
|
1200
|
-
},
|
|
1205
|
+
}, Nn = async () => {
|
|
1201
1206
|
try {
|
|
1202
|
-
await
|
|
1207
|
+
await M.unlink(An);
|
|
1203
1208
|
} catch {}
|
|
1204
|
-
},
|
|
1209
|
+
}, Pn = async (e) => {
|
|
1205
1210
|
let t = e.port ?? 5179;
|
|
1206
|
-
if (
|
|
1211
|
+
if (Dn()) return {
|
|
1207
1212
|
status: "skipped",
|
|
1208
1213
|
reason: "disabled by flag/env",
|
|
1209
1214
|
port: t
|
|
1210
1215
|
};
|
|
1211
|
-
if (
|
|
1216
|
+
if (On()) return {
|
|
1212
1217
|
status: "skipped",
|
|
1213
1218
|
reason: "this process IS the dashboard",
|
|
1214
1219
|
port: t
|
|
1215
1220
|
};
|
|
1216
|
-
if (!
|
|
1221
|
+
if (!kn()) return {
|
|
1217
1222
|
status: "skipped",
|
|
1218
1223
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1219
1224
|
port: t
|
|
1220
1225
|
};
|
|
1221
|
-
if (!await
|
|
1226
|
+
if (!await Mn()) return {
|
|
1222
1227
|
status: "skipped",
|
|
1223
1228
|
reason: "another voltro process is currently launching the dashboard",
|
|
1224
1229
|
port: t
|
|
1225
1230
|
};
|
|
1226
|
-
if (await
|
|
1231
|
+
if (await En(t)) return await Nn(), {
|
|
1227
1232
|
status: "already-running",
|
|
1228
1233
|
port: t
|
|
1229
1234
|
};
|
|
1230
1235
|
let n = e.voltroBin;
|
|
1231
1236
|
if (!n) {
|
|
1232
1237
|
let e = process.argv[1];
|
|
1233
|
-
n = e && e.endsWith("/src/bin.ts") ?
|
|
1238
|
+
n = e && e.endsWith("/src/bin.ts") ? O(D(e), "..", "bin", "voltro.mjs") : e ?? "voltro";
|
|
1234
1239
|
}
|
|
1235
|
-
let r =
|
|
1240
|
+
let r = O(e.dashboardAppPath, ".framework", "dist", "index.html"), i = j(r), a = i ? "start" : "dev", o = fe(process.execPath, [
|
|
1236
1241
|
n,
|
|
1237
|
-
|
|
1242
|
+
a,
|
|
1238
1243
|
e.dashboardAppPath
|
|
1239
1244
|
], {
|
|
1240
1245
|
stdio: "ignore",
|
|
1241
1246
|
env: {
|
|
1242
1247
|
...process.env,
|
|
1243
|
-
[
|
|
1248
|
+
[Tn]: "1",
|
|
1244
1249
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1245
1250
|
}
|
|
1246
1251
|
});
|
|
1247
1252
|
return process.on("exit", () => {
|
|
1248
|
-
if (
|
|
1249
|
-
|
|
1253
|
+
if (o.exitCode === null && o.signalCode === null) try {
|
|
1254
|
+
o.kill("SIGTERM");
|
|
1250
1255
|
} catch {}
|
|
1251
|
-
}),
|
|
1256
|
+
}), xn.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1252
1257
|
port: t,
|
|
1253
|
-
mode:
|
|
1254
|
-
prebuilt:
|
|
1255
|
-
}),
|
|
1256
|
-
|
|
1258
|
+
mode: a,
|
|
1259
|
+
prebuilt: i
|
|
1260
|
+
}), i || xn.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), xn.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1261
|
+
Nn();
|
|
1257
1262
|
}, 4e3).unref(), {
|
|
1258
1263
|
status: "launched",
|
|
1259
1264
|
port: t
|
|
1260
1265
|
};
|
|
1261
|
-
},
|
|
1266
|
+
}, Fn = class extends Error {
|
|
1262
1267
|
_voltroDeferral = !0;
|
|
1263
1268
|
constructor(e) {
|
|
1264
1269
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1265
1270
|
}
|
|
1266
|
-
},
|
|
1271
|
+
}, In = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Ln = (e) => {
|
|
1267
1272
|
if (!(e instanceof Error)) return;
|
|
1268
1273
|
let t = e._voltroControl;
|
|
1269
1274
|
if (t === "redirect") {
|
|
@@ -1285,7 +1290,7 @@ import {
|
|
|
1285
1290
|
},
|
|
1286
1291
|
body: "not found"
|
|
1287
1292
|
};
|
|
1288
|
-
},
|
|
1293
|
+
}, Rn = (e) => {
|
|
1289
1294
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1290
1295
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1291
1296
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1300,7 +1305,7 @@ import {
|
|
|
1300
1305
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1301
1306
|
});
|
|
1302
1307
|
} catch (e) {
|
|
1303
|
-
throw new
|
|
1308
|
+
throw new Fn(e instanceof Error ? e.message : String(e));
|
|
1304
1309
|
}
|
|
1305
1310
|
return {
|
|
1306
1311
|
loaderData: n.renderData,
|
|
@@ -1316,8 +1321,8 @@ import {
|
|
|
1316
1321
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1317
1322
|
}
|
|
1318
1323
|
};
|
|
1319
|
-
},
|
|
1320
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1324
|
+
}, zn = (e) => {
|
|
1325
|
+
let { helpers: t, renderInput: n } = e, r = Rn({
|
|
1321
1326
|
helpers: t,
|
|
1322
1327
|
page: e.page,
|
|
1323
1328
|
pathname: n.pathname,
|
|
@@ -1338,19 +1343,19 @@ import {
|
|
|
1338
1343
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1339
1344
|
hasDeferred: r.hasDeferred
|
|
1340
1345
|
};
|
|
1341
|
-
},
|
|
1346
|
+
}, Bn = (e) => {
|
|
1342
1347
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1343
1348
|
return {
|
|
1344
1349
|
body: t,
|
|
1345
1350
|
meta: n
|
|
1346
1351
|
};
|
|
1347
|
-
},
|
|
1352
|
+
}, Vn = (e) => [
|
|
1348
1353
|
...e.extra ?? [],
|
|
1349
1354
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1350
1355
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1351
1356
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1352
1357
|
e.prepared.stateScript
|
|
1353
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1358
|
+
].filter((e) => e.length > 0).join("\n "), Hn = (e) => {
|
|
1354
1359
|
let t = e.indexOf("?");
|
|
1355
1360
|
return t === -1 ? {
|
|
1356
1361
|
pathname: e || "/",
|
|
@@ -1359,9 +1364,9 @@ import {
|
|
|
1359
1364
|
pathname: e.slice(0, t) || "/",
|
|
1360
1365
|
search: e.slice(t)
|
|
1361
1366
|
};
|
|
1362
|
-
},
|
|
1367
|
+
}, Un = /Could not find required `intl` object/, Wn = "__voltro_i18n_instances__", Gn = (e = globalThis) => {
|
|
1363
1368
|
try {
|
|
1364
|
-
let t = e[
|
|
1369
|
+
let t = e[Wn]?.records;
|
|
1365
1370
|
return t === void 0 || t.length === 0 ? void 0 : {
|
|
1366
1371
|
instances: t.length,
|
|
1367
1372
|
reactIntlCopies: new Set(t.map((e) => e.intlProvider)).size,
|
|
@@ -1370,7 +1375,7 @@ import {
|
|
|
1370
1375
|
} catch {
|
|
1371
1376
|
return;
|
|
1372
1377
|
}
|
|
1373
|
-
},
|
|
1378
|
+
}, Kn = (e, t) => [
|
|
1374
1379
|
"",
|
|
1375
1380
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1376
1381
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1388,7 +1393,7 @@ import {
|
|
|
1388
1393
|
" versions on disk; this counts instances in the running process, and one",
|
|
1389
1394
|
" file loaded down two paths is two instances.",
|
|
1390
1395
|
"───────────────────────────────────────────────────────────────────────"
|
|
1391
|
-
].join("\n"),
|
|
1396
|
+
].join("\n"), qn = (e, t) => [
|
|
1392
1397
|
"",
|
|
1393
1398
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1394
1399
|
`${e} DID wrap this render in <I18nProvider>, and this process`,
|
|
@@ -1404,7 +1409,7 @@ import {
|
|
|
1404
1409
|
" direct import can land on a second copy that this count does not see —",
|
|
1405
1410
|
" it counts what @voltro/i18n is bound to.",
|
|
1406
1411
|
"───────────────────────────────────────────────────────────────────────"
|
|
1407
|
-
].join("\n"),
|
|
1412
|
+
].join("\n"), Jn = (e) => [
|
|
1408
1413
|
"",
|
|
1409
1414
|
"── voltro diagnosis ───────────────────────────────────────────────────",
|
|
1410
1415
|
`${e} DID wrap this render in <I18nProvider> — the framework`,
|
|
@@ -1420,34 +1425,34 @@ import {
|
|
|
1420
1425
|
" Do NOT use `pnpm ls` to rule that out: it lists versions on disk, and",
|
|
1421
1426
|
" the duplication here is of module instances in one process.",
|
|
1422
1427
|
"───────────────────────────────────────────────────────────────────────"
|
|
1423
|
-
].join("\n"),
|
|
1428
|
+
].join("\n"), Yn = (e, t, n, r = Gn()) => {
|
|
1424
1429
|
if (!t) return;
|
|
1425
1430
|
let i = String(e?.message ?? e);
|
|
1426
|
-
if (
|
|
1427
|
-
},
|
|
1428
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1429
|
-
let r =
|
|
1431
|
+
if (Un.test(i)) return r === void 0 ? Jn(n) : r.reactIntlCopies > 1 || r.instances > 1 ? Kn(n, r) : qn(n, r);
|
|
1432
|
+
}, Xn = "<div id=\"root\"></div>", Zn = "<div id=\"root\">", Qn = "</div>", $n = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, er = /\bsrc=["']([^"']+)["']/i, tr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, nr = (e) => {
|
|
1433
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace($n, (e) => {
|
|
1434
|
+
let r = er.exec(e)?.[1];
|
|
1430
1435
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1431
1436
|
});
|
|
1432
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1433
|
-
let i = r.indexOf(
|
|
1434
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1437
|
+
e.inlineModuleScriptsAsync && (r = r.replace(tr, "<script async$1>"));
|
|
1438
|
+
let i = r.indexOf(Xn);
|
|
1439
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Xn}\` 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.`);
|
|
1435
1440
|
return {
|
|
1436
|
-
head: `${r.slice(0, i)}${
|
|
1437
|
-
tail: `${
|
|
1441
|
+
head: `${r.slice(0, i)}${Zn}`,
|
|
1442
|
+
tail: `${Qn}${r.slice(i + 21)}`,
|
|
1438
1443
|
bootstrapModules: n
|
|
1439
1444
|
};
|
|
1440
|
-
},
|
|
1445
|
+
}, rr = (e, t) => (/<title>/i.test(t) ? e.replace(/[^\S\n]*<title>[\s\S]*?<\/title>\n?/i, "") : e).replace("</head>", ` ${t}\n </head>`), ir = (e) => rr(e.head, e.headInjection).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), ar = (e) => {
|
|
1441
1446
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1442
1447
|
if (s || !o || a === null) return;
|
|
1443
1448
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1444
1449
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1445
|
-
t.flushHeaders?.(), t.write(
|
|
1450
|
+
t.flushHeaders?.(), t.write(ir({
|
|
1446
1451
|
head: n.head,
|
|
1447
1452
|
headInjection: i(a.meta),
|
|
1448
1453
|
htmlLang: r
|
|
1449
1454
|
}));
|
|
1450
|
-
let c = new
|
|
1455
|
+
let c = new me();
|
|
1451
1456
|
c.pipe(t, { end: !1 }), c.on("end", () => {
|
|
1452
1457
|
t.end(n.tail);
|
|
1453
1458
|
}), a.stream.pipe(c);
|
|
@@ -1472,42 +1477,81 @@ import {
|
|
|
1472
1477
|
return;
|
|
1473
1478
|
}
|
|
1474
1479
|
c();
|
|
1475
|
-
},
|
|
1480
|
+
}, or = (e) => Array.isArray(e.preload) && e.preload.length > 0, sr = (e, t) => typeof e == "string" ? {
|
|
1476
1481
|
tag: e,
|
|
1477
1482
|
input: {}
|
|
1478
1483
|
} : {
|
|
1479
1484
|
tag: e.tag,
|
|
1480
1485
|
input: e.input?.(t) ?? {}
|
|
1481
|
-
},
|
|
1482
|
-
let { pageMod: t, params: n, query: r, apiName: i, seed: a,
|
|
1483
|
-
if (
|
|
1484
|
-
let { tag: t, input:
|
|
1486
|
+
}, cr = async (e) => {
|
|
1487
|
+
let { pageMod: t, params: n, query: r, apiName: i, seed: a, seedFailure: o, onError: s } = e;
|
|
1488
|
+
if (or(t) && r !== void 0 && i !== void 0) for (let e of t.preload) {
|
|
1489
|
+
let { tag: t, input: c } = sr(e, n);
|
|
1485
1490
|
try {
|
|
1486
|
-
a(i, t,
|
|
1491
|
+
a(i, t, c, await r(t, c));
|
|
1487
1492
|
} catch (e) {
|
|
1488
|
-
o?.({
|
|
1493
|
+
o(i, t, c), s?.({
|
|
1489
1494
|
tag: t,
|
|
1490
1495
|
apiName: i
|
|
1491
1496
|
}, e);
|
|
1492
1497
|
}
|
|
1493
1498
|
}
|
|
1494
|
-
},
|
|
1499
|
+
}, lr = (e) => a.test(e) || e.endsWith(".workflow.server.tsx") ? !1 : o.test(e) || l.test(e) || i.test(e), ur = /* @__PURE__ */ new Set([
|
|
1500
|
+
"node_modules",
|
|
1501
|
+
"dist",
|
|
1502
|
+
".framework",
|
|
1503
|
+
".git"
|
|
1504
|
+
]), dr = async (e) => {
|
|
1505
|
+
let t = [], n = async (e) => {
|
|
1506
|
+
let r;
|
|
1507
|
+
try {
|
|
1508
|
+
r = await M.readdir(e, { withFileTypes: !0 });
|
|
1509
|
+
} catch {
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
for (let i of r) if (!(i.name.startsWith(".") && i.isDirectory())) {
|
|
1513
|
+
if (i.isDirectory()) {
|
|
1514
|
+
if (ur.has(i.name)) continue;
|
|
1515
|
+
await n(O(e, i.name));
|
|
1516
|
+
} else lr(i.name) && t.push(O(e, i.name));
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
return await n(e), t.sort();
|
|
1520
|
+
}, fr = async (e) => {
|
|
1521
|
+
let t = q("sha1");
|
|
1522
|
+
for (let n of await dr(e)) {
|
|
1523
|
+
t.update(n.slice(e.length)), t.update("\0");
|
|
1524
|
+
try {
|
|
1525
|
+
t.update(await M.readFile(n));
|
|
1526
|
+
} catch {}
|
|
1527
|
+
t.update("\0");
|
|
1528
|
+
}
|
|
1495
1529
|
try {
|
|
1496
|
-
|
|
1530
|
+
t.update(await M.readFile(O(e, "rpcGroup.generated.ts")));
|
|
1531
|
+
} catch {}
|
|
1532
|
+
return t.digest("hex");
|
|
1533
|
+
}, pr = async (e) => {
|
|
1534
|
+
if (e.length === 0) return;
|
|
1535
|
+
let t = [];
|
|
1536
|
+
for (let n of [...e].sort()) t.push(await fr(n));
|
|
1537
|
+
return q("sha1").update(t.join("\0")).digest("hex");
|
|
1538
|
+
}, Z = V({ scope: "voltro:dev:web" }), mr = V({ scope: "vite" }), hr = await (async () => {
|
|
1539
|
+
try {
|
|
1540
|
+
let e = O(D(R(import.meta.url)), "..", "package.json"), t = await M.readFile(e, "utf8");
|
|
1497
1541
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1498
1542
|
} catch {
|
|
1499
1543
|
return "0.0.0";
|
|
1500
1544
|
}
|
|
1501
|
-
})(),
|
|
1545
|
+
})(), gr = async () => {
|
|
1502
1546
|
try {
|
|
1503
|
-
let e =
|
|
1504
|
-
if (
|
|
1505
|
-
let n =
|
|
1506
|
-
return
|
|
1547
|
+
let e = D(R(import.meta.url)), t = A(e, "..", "..", "devtools");
|
|
1548
|
+
if (j(O(t, "package.json"))) return t;
|
|
1549
|
+
let n = A(e, "..", "..", "..", "devtools");
|
|
1550
|
+
return j(O(n, "package.json")) ? n : null;
|
|
1507
1551
|
} catch {
|
|
1508
1552
|
return null;
|
|
1509
1553
|
}
|
|
1510
|
-
},
|
|
1554
|
+
}, _r = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1511
1555
|
"",
|
|
1512
1556
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1513
1557
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1517,87 +1561,87 @@ import {
|
|
|
1517
1561
|
" await import('@voltro/devtools/styles.css')",
|
|
1518
1562
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1519
1563
|
"}"
|
|
1520
|
-
],
|
|
1564
|
+
], vr = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], yr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], br = (e) => e.sentry ? [
|
|
1521
1565
|
"",
|
|
1522
1566
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1523
1567
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1524
1568
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1525
|
-
] : [],
|
|
1526
|
-
let t = [], n =
|
|
1569
|
+
] : [], xr = (e) => e.env ? ["import './env.public'"] : [], Sr = (e) => {
|
|
1570
|
+
let t = [], n = A(e);
|
|
1527
1571
|
for (;;) {
|
|
1528
|
-
|
|
1529
|
-
let e =
|
|
1572
|
+
j(O(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
1573
|
+
let e = D(n);
|
|
1530
1574
|
if (e === n) break;
|
|
1531
1575
|
n = e;
|
|
1532
1576
|
}
|
|
1533
1577
|
return t;
|
|
1534
|
-
},
|
|
1578
|
+
}, Cr = b, wr = (e) => {
|
|
1535
1579
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1536
1580
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1537
1581
|
if (t) return `island-${t[1]}`;
|
|
1538
|
-
},
|
|
1539
|
-
let t = e.replace(
|
|
1582
|
+
}, Tr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Er = (e) => e.startsWith("(") && e.endsWith(")"), Dr = (e) => e.filter((e) => !Er(e)), Or = (e) => {
|
|
1583
|
+
let t = e.replace(c, "").split("/").filter(Boolean).filter((e) => !Er(e));
|
|
1540
1584
|
return t.length === 0 ? "/" : "/" + t.join("/");
|
|
1541
|
-
},
|
|
1542
|
-
let t = [], n = [],
|
|
1543
|
-
let
|
|
1585
|
+
}, kr = (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) => {
|
|
1586
|
+
let t = [], n = [], r = async (e, i) => {
|
|
1587
|
+
let a = [];
|
|
1544
1588
|
try {
|
|
1545
|
-
|
|
1589
|
+
a = await M.readdir(e, { withFileTypes: !0 });
|
|
1546
1590
|
} catch {
|
|
1547
1591
|
return;
|
|
1548
1592
|
}
|
|
1549
|
-
let
|
|
1550
|
-
if (l.some((e) =>
|
|
1551
|
-
let t = u.has("layout.tsx"),
|
|
1593
|
+
let o = a.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = a.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Cr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = i.join("/");
|
|
1594
|
+
if (l.some((e) => s.has(e))) {
|
|
1595
|
+
let t = u.has("layout.tsx"), r = !1;
|
|
1552
1596
|
if (t) try {
|
|
1553
|
-
let t = await
|
|
1554
|
-
|
|
1597
|
+
let t = await M.readFile(O(e, "layout.tsx"), "utf8");
|
|
1598
|
+
r = Tr.test(t);
|
|
1555
1599
|
} catch {}
|
|
1556
1600
|
n.push({
|
|
1557
1601
|
dir: d,
|
|
1558
|
-
chain:
|
|
1559
|
-
contributesToUrl:
|
|
1602
|
+
chain: i,
|
|
1603
|
+
contributesToUrl: i.length === 0 || !Er(i[i.length - 1]),
|
|
1560
1604
|
hasLayout: t,
|
|
1561
|
-
hasLayoutLoader:
|
|
1605
|
+
hasLayoutLoader: r,
|
|
1562
1606
|
hasError: u.has("error.tsx"),
|
|
1563
1607
|
hasPending: u.has("loading.tsx"),
|
|
1564
1608
|
hasNotFound: u.has("not-found.tsx"),
|
|
1565
|
-
specialFiles: l.filter((e) =>
|
|
1609
|
+
specialFiles: l.filter((e) => s.has(e))
|
|
1566
1610
|
});
|
|
1567
1611
|
}
|
|
1568
1612
|
for (let e of l) {
|
|
1569
|
-
if (!
|
|
1613
|
+
if (!c.test(e)) continue;
|
|
1570
1614
|
let n = d ? `${d}/${e}` : e;
|
|
1571
1615
|
t.push({
|
|
1572
1616
|
file: n,
|
|
1573
|
-
pattern:
|
|
1574
|
-
ident:
|
|
1575
|
-
dirChain:
|
|
1617
|
+
pattern: Or(n),
|
|
1618
|
+
ident: kr(n),
|
|
1619
|
+
dirChain: i
|
|
1576
1620
|
});
|
|
1577
1621
|
}
|
|
1578
|
-
for (let t of
|
|
1622
|
+
for (let t of o) await r(O(e, t), [...i, t]);
|
|
1579
1623
|
};
|
|
1580
|
-
await
|
|
1581
|
-
let
|
|
1582
|
-
for (let e of t) for (let t = e.dirChain.length; t >= 0; t--)
|
|
1583
|
-
let
|
|
1584
|
-
for (let { specialFiles: e, ...t } of n)
|
|
1624
|
+
await r(e, []), t.sort((e, t) => e.file < t.file ? -1 : 1);
|
|
1625
|
+
let i = /* @__PURE__ */ new Set();
|
|
1626
|
+
for (let e of t) for (let t = e.dirChain.length; t >= 0; t--) i.add(e.dirChain.slice(0, t).join("/"));
|
|
1627
|
+
let a = [], o = [];
|
|
1628
|
+
for (let { specialFiles: e, ...t } of n) i.has(t.dir) ? a.push(t) : o.push({
|
|
1585
1629
|
dir: t.dir,
|
|
1586
1630
|
files: e
|
|
1587
1631
|
});
|
|
1588
1632
|
return {
|
|
1589
1633
|
pages: t,
|
|
1590
|
-
dirs:
|
|
1591
|
-
orphanedSpecials:
|
|
1634
|
+
dirs: a,
|
|
1635
|
+
orphanedSpecials: o
|
|
1592
1636
|
};
|
|
1593
|
-
},
|
|
1637
|
+
}, Ar = (e, t) => {
|
|
1594
1638
|
let n = [];
|
|
1595
1639
|
for (let r = 0; r <= t.length; r++) {
|
|
1596
1640
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1597
1641
|
a && n.push(a);
|
|
1598
1642
|
}
|
|
1599
1643
|
return n;
|
|
1600
|
-
},
|
|
1644
|
+
}, jr = async (e) => {
|
|
1601
1645
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1602
1646
|
return {
|
|
1603
1647
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1610,7 +1654,8 @@ import {
|
|
|
1610
1654
|
search: a.search,
|
|
1611
1655
|
signal: a.signal,
|
|
1612
1656
|
headers: a.headers,
|
|
1613
|
-
query: a.query
|
|
1657
|
+
query: a.query,
|
|
1658
|
+
isServer: !0
|
|
1614
1659
|
}));
|
|
1615
1660
|
}
|
|
1616
1661
|
return e.hasError && (s.Error = (await r(e)).default), e.hasPending && (s.Pending = (await i(e)).default), {
|
|
@@ -1620,10 +1665,10 @@ import {
|
|
|
1620
1665
|
})),
|
|
1621
1666
|
segmentLoaderData: o
|
|
1622
1667
|
};
|
|
1623
|
-
},
|
|
1624
|
-
let t =
|
|
1668
|
+
}, Mr = (e) => {
|
|
1669
|
+
let t = Dr(e);
|
|
1625
1670
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1626
|
-
},
|
|
1671
|
+
}, Nr = [
|
|
1627
1672
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1628
1673
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1629
1674
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1716,7 +1761,7 @@ import {
|
|
|
1716
1761
|
" _vdtErrorStart('Build error')",
|
|
1717
1762
|
" })",
|
|
1718
1763
|
"}"
|
|
1719
|
-
].join("\n"),
|
|
1764
|
+
].join("\n"), Pr = (e) => {
|
|
1720
1765
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1721
1766
|
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, "\\$&"));
|
|
1722
1767
|
let a = i.join("/");
|
|
@@ -1725,8 +1770,8 @@ import {
|
|
|
1725
1770
|
paramNames: t,
|
|
1726
1771
|
priority: n
|
|
1727
1772
|
};
|
|
1728
|
-
},
|
|
1729
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1773
|
+
}, Fr = (e) => e.map((e) => {
|
|
1774
|
+
let { regex: t, paramNames: n, priority: r } = Pr(e.pattern);
|
|
1730
1775
|
return {
|
|
1731
1776
|
pattern: e.pattern,
|
|
1732
1777
|
file: e.file,
|
|
@@ -1735,7 +1780,7 @@ import {
|
|
|
1735
1780
|
paramNames: n,
|
|
1736
1781
|
priority: r
|
|
1737
1782
|
};
|
|
1738
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1783
|
+
}).slice().sort((e, t) => e.priority - t.priority), Ir = (e, t) => {
|
|
1739
1784
|
for (let n of t) {
|
|
1740
1785
|
let t = n.regex.exec(e);
|
|
1741
1786
|
if (!t) continue;
|
|
@@ -1747,11 +1792,11 @@ import {
|
|
|
1747
1792
|
};
|
|
1748
1793
|
}
|
|
1749
1794
|
return null;
|
|
1750
|
-
},
|
|
1795
|
+
}, Lr = Ee, Rr = async (e) => {
|
|
1751
1796
|
try {
|
|
1752
|
-
let t = await import(
|
|
1797
|
+
let t = await import(z(O(e, "app.config.ts")).href), n = t.default?.port, i = r({
|
|
1753
1798
|
kind: "api",
|
|
1754
|
-
configPort: typeof
|
|
1799
|
+
configPort: typeof n == "number" ? n : void 0,
|
|
1755
1800
|
env: {}
|
|
1756
1801
|
}).port, a = t.default?.transport?.wsPath, o = typeof a == "string" && a.startsWith("/") ? a : void 0;
|
|
1757
1802
|
return o ? {
|
|
@@ -1759,11 +1804,11 @@ import {
|
|
|
1759
1804
|
wsPath: o
|
|
1760
1805
|
} : { port: i };
|
|
1761
1806
|
} catch {}
|
|
1762
|
-
return { port:
|
|
1807
|
+
return { port: r({
|
|
1763
1808
|
kind: "api",
|
|
1764
1809
|
env: {}
|
|
1765
1810
|
}).port };
|
|
1766
|
-
},
|
|
1811
|
+
}, zr = (e, t) => ({
|
|
1767
1812
|
name: e,
|
|
1768
1813
|
pkg: t.package,
|
|
1769
1814
|
browserWsUrl: t.url,
|
|
@@ -1771,7 +1816,7 @@ import {
|
|
|
1771
1816
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1772
1817
|
...t.headers ? { headers: t.headers } : {},
|
|
1773
1818
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1774
|
-
}),
|
|
1819
|
+
}), Br = (e, t, n) => {
|
|
1775
1820
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1776
1821
|
return {
|
|
1777
1822
|
name: e,
|
|
@@ -1783,7 +1828,7 @@ import {
|
|
|
1783
1828
|
...t.headers ? { headers: t.headers } : {},
|
|
1784
1829
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1785
1830
|
};
|
|
1786
|
-
},
|
|
1831
|
+
}, Vr = (e) => {
|
|
1787
1832
|
let t = /* @__PURE__ */ new Map();
|
|
1788
1833
|
for (let n of e) {
|
|
1789
1834
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1791,43 +1836,43 @@ import {
|
|
|
1791
1836
|
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>.`);
|
|
1792
1837
|
t.set(n.browserWsUrl, n.name);
|
|
1793
1838
|
}
|
|
1794
|
-
},
|
|
1839
|
+
}, Hr = async (e, t) => {
|
|
1795
1840
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1796
1841
|
for (let [t, i] of n) {
|
|
1797
1842
|
if (i.url) {
|
|
1798
|
-
r.push(
|
|
1843
|
+
r.push(zr(t, i));
|
|
1799
1844
|
continue;
|
|
1800
1845
|
}
|
|
1801
|
-
let n = await
|
|
1846
|
+
let n = await Lr(e, i.package);
|
|
1802
1847
|
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.`);
|
|
1803
|
-
r.push(
|
|
1848
|
+
r.push(Br(t, i, await Rr(n)));
|
|
1804
1849
|
}
|
|
1805
|
-
return
|
|
1806
|
-
},
|
|
1850
|
+
return Vr(r), r;
|
|
1851
|
+
}, Ur = (e) => {
|
|
1807
1852
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1808
1853
|
let t = new URL(e);
|
|
1809
1854
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1810
1855
|
} catch {
|
|
1811
1856
|
return;
|
|
1812
1857
|
}
|
|
1813
|
-
},
|
|
1858
|
+
}, Wr = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, Gr = (e) => process.env[Wr(e)] ?? process.env.VOLTRO_API_ORIGIN, Kr = (e, t) => {
|
|
1814
1859
|
if (!e) return;
|
|
1815
|
-
let n =
|
|
1860
|
+
let n = Gr(e.name) ?? e.serverOrigin;
|
|
1816
1861
|
if (n) {
|
|
1817
|
-
let e =
|
|
1862
|
+
let e = Ur(n);
|
|
1818
1863
|
if (e) return e;
|
|
1819
1864
|
}
|
|
1820
1865
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1821
|
-
let t =
|
|
1866
|
+
let t = Ur(e.proxyTarget);
|
|
1822
1867
|
if (t) return t;
|
|
1823
1868
|
}
|
|
1824
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1825
|
-
},
|
|
1869
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return Ur(e.browserWsUrl);
|
|
1870
|
+
}, qr = (e, t, n) => {
|
|
1826
1871
|
if (!e) {
|
|
1827
1872
|
if (n?.apiName === void 0) return;
|
|
1828
1873
|
let e = n.apiName;
|
|
1829
1874
|
return async () => {
|
|
1830
|
-
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 ${
|
|
1875
|
+
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 ${Wr(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.`);
|
|
1831
1876
|
};
|
|
1832
1877
|
}
|
|
1833
1878
|
return async (r, i) => {
|
|
@@ -1849,7 +1894,7 @@ import {
|
|
|
1849
1894
|
});
|
|
1850
1895
|
} catch (t) {
|
|
1851
1896
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
1852
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
1897
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${Wr(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 });
|
|
1853
1898
|
}
|
|
1854
1899
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
1855
1900
|
let s = await o.json();
|
|
@@ -1869,7 +1914,7 @@ import {
|
|
|
1869
1914
|
}, l, u = !1;
|
|
1870
1915
|
for (let e of s) {
|
|
1871
1916
|
if (e._tag === "ClientProtocolError") throw Error(`[loader.query] ${r}: protocol error ${JSON.stringify(e.error)}`);
|
|
1872
|
-
if (
|
|
1917
|
+
if (e.requestId === void 0 || String(e.requestId) === "0") {
|
|
1873
1918
|
if (e._tag === "Chunk" && e.values && e.values.length > 0 && !u && (l = c(e.values[0]), u = !0), e._tag === "Defect") throw Error(`[loader.query] ${r}: defect ${JSON.stringify(e)}`);
|
|
1874
1919
|
if (e._tag === "Exit" && e.exit) {
|
|
1875
1920
|
if (e.exit._tag === "Failure") throw Error(`[loader.query] ${r}: rpc failed ${JSON.stringify(e.exit.cause ?? e.exit)}`);
|
|
@@ -1879,8 +1924,8 @@ import {
|
|
|
1879
1924
|
}
|
|
1880
1925
|
if (u) return l;
|
|
1881
1926
|
};
|
|
1882
|
-
},
|
|
1883
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o =
|
|
1927
|
+
}, Jr = async (e, t, n, r = {}) => {
|
|
1928
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = j(O(e, "node_modules", "@voltro", "devtools", "package.json")) || await gr() !== null, s = t.theme === "system" ? [
|
|
1884
1929
|
" <script>",
|
|
1885
1930
|
" (function () {",
|
|
1886
1931
|
" var root = document.documentElement",
|
|
@@ -1918,15 +1963,15 @@ import {
|
|
|
1918
1963
|
" </body>",
|
|
1919
1964
|
"</html>",
|
|
1920
1965
|
""
|
|
1921
|
-
].join("\n"), l =
|
|
1922
|
-
await
|
|
1966
|
+
].join("\n"), l = O(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: f } = await $(l);
|
|
1967
|
+
await y(l, u);
|
|
1923
1968
|
for (let e of f) Z.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
|
|
1924
|
-
let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`,
|
|
1925
|
-
n.some((e) => e.hasAuthHeaders) && (
|
|
1926
|
-
let
|
|
1969
|
+
let p = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, h = n.map((e) => `import { appGroup as ${p(e.name)}, appDescriptors as ${m(e.name)} } from '${e.pkg}/rpcGroup'`);
|
|
1970
|
+
n.some((e) => e.hasAuthHeaders) && (h.push("import __voltroAppConfig from '../app.config'"), h.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
|
|
1971
|
+
let g = n.map((e) => {
|
|
1927
1972
|
let t = [`group: ${p(e.name)}`];
|
|
1928
|
-
return t.push(`descriptors: ${
|
|
1929
|
-
}),
|
|
1973
|
+
return t.push(`descriptors: ${m(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(", ")} },`;
|
|
1974
|
+
}), _, v, b;
|
|
1930
1975
|
if (u.length > 0) {
|
|
1931
1976
|
let n = u.map((e) => ` ${JSON.stringify(e.pattern)}: () => import('../src/pages/${e.file}'),`), r = [];
|
|
1932
1977
|
for (let e of d) {
|
|
@@ -1934,13 +1979,13 @@ import {
|
|
|
1934
1979
|
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'`);
|
|
1935
1980
|
}
|
|
1936
1981
|
let i = u.map((e) => {
|
|
1937
|
-
let t =
|
|
1982
|
+
let t = Ar(d, e.dirChain).map((e) => {
|
|
1938
1983
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
1939
1984
|
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(", ")} }`;
|
|
1940
1985
|
}).join(",\n");
|
|
1941
1986
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
1942
1987
|
}), a = d.filter((e) => e.hasNotFound).map((e) => {
|
|
1943
|
-
let t =
|
|
1988
|
+
let t = Mr(e.chain), n = Ar(d, e.chain).map((e) => {
|
|
1944
1989
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
1945
1990
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
1946
1991
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -1975,18 +2020,18 @@ import {
|
|
|
1975
2020
|
kind: "page",
|
|
1976
2021
|
slotKey: e.pattern
|
|
1977
2022
|
});
|
|
1978
|
-
let
|
|
2023
|
+
let y = s.map((e) => ` ${JSON.stringify(e.relPath)},`), x = s.map((e, t) => {
|
|
1979
2024
|
let n = JSON.stringify(e.slotKey);
|
|
1980
2025
|
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 }`;
|
|
1981
|
-
}), S = t.locales ?? [],
|
|
1982
|
-
if (S.length > 0 && !
|
|
1983
|
-
let
|
|
2026
|
+
}), S = t.locales ?? [], C = S.length > 0 && S.every((t) => j(O(e, "src", "locales", `${t}.ts`)) || j(O(e, "src", "locales", `${t}.tsx`))), w = C, T = t.defaultLocale ?? S[0] ?? "en";
|
|
2027
|
+
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(", ")}]`);
|
|
2028
|
+
let E = w ? [
|
|
1984
2029
|
"import { I18nProvider } from '@voltro/i18n'",
|
|
1985
2030
|
"import { resolveLocale } from '@voltro/i18n/server'",
|
|
1986
2031
|
"import { useServerRequest } from '@voltro/web'",
|
|
1987
2032
|
...S.map((e) => `import i18nCatalog_${e} from '../src/locales/${e}'`)
|
|
1988
2033
|
] : [];
|
|
1989
|
-
|
|
2034
|
+
v = [
|
|
1990
2035
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
1991
2036
|
"// Routes + per-page chain + not-found scopes assembled from src/pages/.",
|
|
1992
2037
|
"//",
|
|
@@ -2097,7 +2142,7 @@ import {
|
|
|
2097
2142
|
"if (import.meta.hot) {",
|
|
2098
2143
|
" import.meta.hot.accept(",
|
|
2099
2144
|
" [",
|
|
2100
|
-
...
|
|
2145
|
+
...y,
|
|
2101
2146
|
" ],",
|
|
2102
2147
|
" (newMods: Array<Record<string, unknown> | undefined>) => {",
|
|
2103
2148
|
" let changed = false",
|
|
@@ -2107,7 +2152,7 @@ import {
|
|
|
2107
2152
|
" )",
|
|
2108
2153
|
"}",
|
|
2109
2154
|
""
|
|
2110
|
-
].join("\n"),
|
|
2155
|
+
].join("\n"), _ = [
|
|
2111
2156
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2112
2157
|
"// The app's root component. It exports `App` and NOTHING ELSE: react-refresh",
|
|
2113
2158
|
"// only accepts a module whose every export is a component, and a module it",
|
|
@@ -2118,16 +2163,16 @@ import {
|
|
|
2118
2163
|
"",
|
|
2119
2164
|
"import { useMemo, useSyncExternalStore } from 'react'",
|
|
2120
2165
|
"import { Router } from '@voltro/web'",
|
|
2121
|
-
...
|
|
2166
|
+
...E,
|
|
2122
2167
|
"import { subscribe, getVersion, buildRoutes, buildNotFounds } from './routeTable'",
|
|
2123
2168
|
"",
|
|
2124
|
-
...
|
|
2169
|
+
...w ? [
|
|
2125
2170
|
`// i18n auto-wiring (config.locales = [${S.map((e) => JSON.stringify(e)).join(", ")}]).`,
|
|
2126
2171
|
"const I18N_CATALOGS: Record<string, import('@voltro/i18n').MessageCatalog> = {",
|
|
2127
2172
|
...S.map((e) => ` ${JSON.stringify(e)}: i18nCatalog_${e},`),
|
|
2128
2173
|
"}",
|
|
2129
2174
|
`const I18N_SUPPORTED: ReadonlyArray<string> = [${S.map((e) => JSON.stringify(e)).join(", ")}]`,
|
|
2130
|
-
`const I18N_DEFAULT = ${JSON.stringify(
|
|
2175
|
+
`const I18N_DEFAULT = ${JSON.stringify(T)}`,
|
|
2131
2176
|
"",
|
|
2132
2177
|
"const pickI18nLocale = (ssr: ReturnType<typeof useServerRequest>): string => {",
|
|
2133
2178
|
" if (ssr) {",
|
|
@@ -2178,7 +2223,7 @@ import {
|
|
|
2178
2223
|
" const v = useSyncExternalStore(subscribe, getVersion, getVersion)",
|
|
2179
2224
|
" const routes = useMemo(() => buildRoutes(), [v])",
|
|
2180
2225
|
" const notFounds = useMemo(() => buildNotFounds(), [v])",
|
|
2181
|
-
...
|
|
2226
|
+
...w ? [
|
|
2182
2227
|
" const ssr = useServerRequest()",
|
|
2183
2228
|
" const locale = pickI18nLocale(ssr)",
|
|
2184
2229
|
" const messages = I18N_CATALOGS[locale] ?? I18N_CATALOGS[I18N_DEFAULT]!",
|
|
@@ -2196,14 +2241,14 @@ import {
|
|
|
2196
2241
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2197
2242
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2198
2243
|
"",
|
|
2199
|
-
...
|
|
2244
|
+
...xr(t),
|
|
2200
2245
|
"import { mount } from '@voltro/web'",
|
|
2201
|
-
...
|
|
2246
|
+
...h,
|
|
2202
2247
|
"import { App } from './app'",
|
|
2203
2248
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2204
|
-
...
|
|
2205
|
-
...
|
|
2206
|
-
...
|
|
2249
|
+
...yr(t),
|
|
2250
|
+
..._r(t, o),
|
|
2251
|
+
...br(t),
|
|
2207
2252
|
"",
|
|
2208
2253
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2209
2254
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2218,137 +2263,137 @@ import {
|
|
|
2218
2263
|
"",
|
|
2219
2264
|
"mount(App, {",
|
|
2220
2265
|
" apis: {",
|
|
2221
|
-
...
|
|
2266
|
+
...g,
|
|
2222
2267
|
" },",
|
|
2223
|
-
...
|
|
2268
|
+
...vr(t, o),
|
|
2224
2269
|
"})",
|
|
2225
2270
|
"",
|
|
2226
|
-
|
|
2271
|
+
Nr
|
|
2227
2272
|
].join("\n");
|
|
2228
|
-
} else
|
|
2273
|
+
} else _ = "", v = "", b = [
|
|
2229
2274
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
2230
2275
|
"// The user's root component lives at ../src/App.tsx; this file imports it",
|
|
2231
2276
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2232
2277
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2233
2278
|
"",
|
|
2234
|
-
...
|
|
2279
|
+
...xr(t),
|
|
2235
2280
|
"import { mount } from '@voltro/web'",
|
|
2236
|
-
...
|
|
2281
|
+
...h,
|
|
2237
2282
|
"import App from '../src/App'",
|
|
2238
|
-
...
|
|
2239
|
-
...
|
|
2240
|
-
...
|
|
2283
|
+
...yr(t),
|
|
2284
|
+
..._r(t, o),
|
|
2285
|
+
...br(t),
|
|
2241
2286
|
"",
|
|
2242
2287
|
"mount(App, {",
|
|
2243
2288
|
" apis: {",
|
|
2244
|
-
...
|
|
2289
|
+
...g,
|
|
2245
2290
|
" },",
|
|
2246
|
-
...
|
|
2291
|
+
...vr(t, o),
|
|
2247
2292
|
"})",
|
|
2248
2293
|
"",
|
|
2249
|
-
|
|
2294
|
+
Nr
|
|
2250
2295
|
].join("\n");
|
|
2251
|
-
let x =
|
|
2252
|
-
await
|
|
2253
|
-
let S =
|
|
2296
|
+
let x = O(e, ".framework");
|
|
2297
|
+
await M.mkdir(x, { recursive: !0 }), t.env ? await xe(x, r) : await M.rm(O(x, "env.public.ts"), { force: !0 }), await M.writeFile(O(x, "index.html"), c, "utf8"), await M.writeFile(O(x, "main.tsx"), b, "utf8"), _ ? (await M.writeFile(O(x, "app.tsx"), _, "utf8"), await M.writeFile(O(x, "routeTable.ts"), v, "utf8")) : (await M.rm(O(x, "app.tsx"), { force: !0 }), await M.rm(O(x, "routeTable.ts"), { force: !0 }));
|
|
2298
|
+
let S = O(e, ".gitignore"), C = "";
|
|
2254
2299
|
try {
|
|
2255
|
-
|
|
2300
|
+
C = await M.readFile(S, "utf8");
|
|
2256
2301
|
} catch {}
|
|
2257
|
-
let
|
|
2258
|
-
if (
|
|
2259
|
-
let e =
|
|
2302
|
+
let w = ["/.framework/"], T = new Set(C.split("\n").map((e) => e.trim())), E = w.filter((e) => !T.has(e));
|
|
2303
|
+
if (E.length > 0) {
|
|
2304
|
+
let e = C === "" || C.endsWith("\n") ? "" : "\n";
|
|
2260
2305
|
try {
|
|
2261
|
-
await
|
|
2306
|
+
await M.appendFile(S, `${e}${E.join("\n")}\n`, "utf8");
|
|
2262
2307
|
} catch (e) {
|
|
2263
|
-
Z.warn(`could not add ${
|
|
2308
|
+
Z.warn(`could not add ${E.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2264
2309
|
}
|
|
2265
2310
|
}
|
|
2266
|
-
},
|
|
2311
|
+
}, Yr = async (e, t) => {
|
|
2267
2312
|
try {
|
|
2268
|
-
let n =
|
|
2269
|
-
if (!
|
|
2270
|
-
let
|
|
2271
|
-
for (let [e, n] of Object.entries(
|
|
2272
|
-
if (
|
|
2313
|
+
let n = D(e), r = O(n, "project.json");
|
|
2314
|
+
if (!j(r)) return;
|
|
2315
|
+
let i = await M.readFile(r, "utf8"), a = JSON.parse(i).apps ?? {}, o = e.split("/").filter(Boolean).pop() ?? "", s = [];
|
|
2316
|
+
for (let [e, n] of Object.entries(a)) e !== o && n.port === t && s.push(e);
|
|
2317
|
+
if (s.length === 0) return;
|
|
2273
2318
|
Z.warn("sibling app(s) claim the same port — only one boots", {
|
|
2274
2319
|
port: t,
|
|
2275
|
-
conflicts:
|
|
2276
|
-
projectJson:
|
|
2320
|
+
conflicts: s,
|
|
2321
|
+
projectJson: r
|
|
2277
2322
|
});
|
|
2278
2323
|
} catch {}
|
|
2279
|
-
},
|
|
2280
|
-
let n =
|
|
2324
|
+
}, Xr = (e) => O(e, ".framework", "dist", "server", "appConfig.js"), Zr = async (e, t = {}) => {
|
|
2325
|
+
let n = Xr(e), r = t.preferSource !== !0 && j(n) ? n : O(e, "app.config.ts");
|
|
2281
2326
|
try {
|
|
2282
|
-
let e = (await import(
|
|
2327
|
+
let e = (await import(z(r).href)).default;
|
|
2283
2328
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2284
2329
|
} catch {
|
|
2285
2330
|
return null;
|
|
2286
2331
|
}
|
|
2287
|
-
},
|
|
2288
|
-
let
|
|
2289
|
-
if (!
|
|
2332
|
+
}, Qr = async (e) => {
|
|
2333
|
+
let n = await Zr(e, { preferSource: !0 });
|
|
2334
|
+
if (!n) return {
|
|
2290
2335
|
ran: !1,
|
|
2291
2336
|
exitCode: 0
|
|
2292
2337
|
};
|
|
2293
|
-
|
|
2294
|
-
let i =
|
|
2295
|
-
|
|
2296
|
-
let
|
|
2297
|
-
for (let e of
|
|
2338
|
+
ln();
|
|
2339
|
+
let i = Ct();
|
|
2340
|
+
Vt(i), Z.info("booting voltro dev (web)", { app: n.name ?? "(unnamed)" }), Ge(e, Z);
|
|
2341
|
+
let a = await Hr(e, n);
|
|
2342
|
+
for (let e of a) Z.info("api wired", {
|
|
2298
2343
|
name: e.name,
|
|
2299
2344
|
pkg: e.pkg,
|
|
2300
2345
|
...e.proxyTarget ? { proxyTo: e.proxyTarget } : { directWs: e.browserWsUrl }
|
|
2301
2346
|
});
|
|
2302
|
-
|
|
2347
|
+
g(e).then((e) => {
|
|
2303
2348
|
for (let t of e.files) if (t.action === "created") {
|
|
2304
2349
|
let e = t.path.split("/").pop() ?? t.path;
|
|
2305
2350
|
Z.info(`${e} seeded`, { path: t.path });
|
|
2306
2351
|
}
|
|
2307
2352
|
}).catch(() => {});
|
|
2308
|
-
let { resolved:
|
|
2309
|
-
rawEnv:
|
|
2353
|
+
let { resolved: o } = await Se({
|
|
2354
|
+
rawEnv: n.env,
|
|
2310
2355
|
appType: "web",
|
|
2311
2356
|
root: e,
|
|
2312
2357
|
log: Z,
|
|
2313
2358
|
generateTypes: !0
|
|
2314
|
-
}),
|
|
2315
|
-
await
|
|
2359
|
+
}), s = o.publicValues;
|
|
2360
|
+
await Jr(e, n, a, s), Z.debug("generated framework entry files", { files: [
|
|
2316
2361
|
"index.html",
|
|
2317
2362
|
".framework/main.tsx",
|
|
2318
|
-
...
|
|
2363
|
+
...n.env ? [".framework/env.public.ts"] : []
|
|
2319
2364
|
] });
|
|
2320
|
-
let
|
|
2365
|
+
let c = r({
|
|
2321
2366
|
kind: "web",
|
|
2322
|
-
configPort:
|
|
2367
|
+
configPort: n.port,
|
|
2323
2368
|
env: process.env,
|
|
2324
|
-
dashboardPin: process.env[
|
|
2369
|
+
dashboardPin: process.env[Tn] === "1"
|
|
2325
2370
|
});
|
|
2326
|
-
for (let e of
|
|
2327
|
-
let
|
|
2328
|
-
await
|
|
2329
|
-
id:
|
|
2330
|
-
name:
|
|
2371
|
+
for (let e of c.warnings) Z.warn(e);
|
|
2372
|
+
let l = c.port, y = n.name ?? "unnamed", b = w("web", y, l), D = T(y);
|
|
2373
|
+
await x({
|
|
2374
|
+
id: b,
|
|
2375
|
+
name: y,
|
|
2331
2376
|
kind: "web",
|
|
2332
|
-
url: `http://localhost:${
|
|
2377
|
+
url: `http://localhost:${l}`,
|
|
2333
2378
|
pid: process.pid,
|
|
2334
2379
|
status: "booting",
|
|
2335
|
-
logFile:
|
|
2336
|
-
}).catch(() => {}), await
|
|
2337
|
-
let { pages: N, dirs: P } = await $(
|
|
2380
|
+
logFile: D.path
|
|
2381
|
+
}).catch(() => {}), await Yr(e, l);
|
|
2382
|
+
let { pages: N, dirs: P } = await $(O(e, "src", "pages")), F = {
|
|
2338
2383
|
dirs: P,
|
|
2339
|
-
ssrRoutes:
|
|
2384
|
+
ssrRoutes: Fr(N)
|
|
2340
2385
|
}, I = P.map((e) => ({
|
|
2341
2386
|
dir: e.dir,
|
|
2342
2387
|
hasLayout: e.hasLayout,
|
|
2343
2388
|
hasError: e.hasError,
|
|
2344
2389
|
hasPending: e.hasPending,
|
|
2345
2390
|
hasNotFound: e.hasNotFound
|
|
2346
|
-
})),
|
|
2391
|
+
})), L = await ht({
|
|
2347
2392
|
appRoot: e,
|
|
2348
2393
|
pages: N
|
|
2349
2394
|
});
|
|
2350
|
-
|
|
2351
|
-
let
|
|
2395
|
+
L.wrote && Z.debug("routes codegen wrote", { path: k(e, L.path) });
|
|
2396
|
+
let R = await he("vite", () => import("vite")), z = (await import("@vitejs/plugin-react")).default, B = (await import("@tailwindcss/vite")).default, V = O(e, ".framework"), te = O(e, "src"), H = /* @__PURE__ */ new Set([
|
|
2352
2397
|
".framework",
|
|
2353
2398
|
"node_modules",
|
|
2354
2399
|
"dist",
|
|
@@ -2356,72 +2401,72 @@ import {
|
|
|
2356
2401
|
".vite",
|
|
2357
2402
|
".turbo",
|
|
2358
2403
|
".cache"
|
|
2359
|
-
]),
|
|
2404
|
+
]), U = {
|
|
2360
2405
|
name: "framework:watch-app-sources",
|
|
2361
2406
|
async configureServer(t) {
|
|
2362
2407
|
try {
|
|
2363
|
-
let n = (await
|
|
2364
|
-
for (let r of n) t.watcher.add(
|
|
2408
|
+
let n = (await M.readdir(e, { withFileTypes: !0 })).filter((e) => e.isDirectory() && !H.has(e.name));
|
|
2409
|
+
for (let r of n) t.watcher.add(O(e, r.name));
|
|
2365
2410
|
n.length === 0 && t.watcher.add(te);
|
|
2366
2411
|
} catch {
|
|
2367
2412
|
t.watcher.add(te);
|
|
2368
2413
|
}
|
|
2369
|
-
for (let n of await
|
|
2414
|
+
for (let n of await De(e)) t.watcher.add(n.dir);
|
|
2370
2415
|
}
|
|
2371
|
-
},
|
|
2416
|
+
}, W = O(e, "src", "pages"), ne = (e) => e.endsWith(".tsx") && (e === W || e.startsWith(W + "/")), G = (e) => e === W || e.startsWith(W + "/"), re = async (t) => {
|
|
2372
2417
|
try {
|
|
2373
|
-
let
|
|
2374
|
-
await
|
|
2375
|
-
let { pages: i, dirs:
|
|
2376
|
-
await
|
|
2418
|
+
let r = Date.now();
|
|
2419
|
+
await Jr(e, n, a, s);
|
|
2420
|
+
let { pages: i, dirs: o } = await $(W);
|
|
2421
|
+
await ht({
|
|
2377
2422
|
appRoot: e,
|
|
2378
2423
|
pages: i
|
|
2379
|
-
}), F.dirs =
|
|
2424
|
+
}), F.dirs = o, F.ssrRoutes = Fr(i), Z.info("page tree regenerated", {
|
|
2380
2425
|
reason: t,
|
|
2381
|
-
ms: Date.now() -
|
|
2426
|
+
ms: Date.now() - r,
|
|
2382
2427
|
routes: F.ssrRoutes.length
|
|
2383
2428
|
});
|
|
2384
2429
|
} catch (e) {
|
|
2385
2430
|
Z.error("page tree regen failed", { reason: t }, e);
|
|
2386
2431
|
}
|
|
2387
|
-
},
|
|
2432
|
+
}, ie = {
|
|
2388
2433
|
name: "framework:regenerate-on-page-tree-change",
|
|
2389
2434
|
configureServer(t) {
|
|
2390
2435
|
let n = null, r = [], i = (e) => {
|
|
2391
2436
|
r.push(e), n && clearTimeout(n), n = setTimeout(() => {
|
|
2392
2437
|
n = null;
|
|
2393
2438
|
let e = r.length === 1 ? r[0] : `${r.length} events (${r[0]}, …)`;
|
|
2394
|
-
r.length = 0,
|
|
2439
|
+
r.length = 0, re(e);
|
|
2395
2440
|
}, 50);
|
|
2396
2441
|
};
|
|
2397
2442
|
t.watcher.on("add", (t) => {
|
|
2398
|
-
|
|
2443
|
+
ne(t) && i(`add ${k(e, t)}`);
|
|
2399
2444
|
}), t.watcher.on("unlink", (t) => {
|
|
2400
|
-
|
|
2445
|
+
ne(t) && i(`unlink ${k(e, t)}`);
|
|
2401
2446
|
}), t.watcher.on("addDir", (t) => {
|
|
2402
|
-
|
|
2447
|
+
G(t) && i(`addDir ${k(e, t)}`);
|
|
2403
2448
|
}), t.watcher.on("unlinkDir", (t) => {
|
|
2404
|
-
|
|
2449
|
+
G(t) && i(`unlinkDir ${k(e, t)}`);
|
|
2405
2450
|
});
|
|
2406
2451
|
}
|
|
2407
|
-
},
|
|
2408
|
-
if (!
|
|
2452
|
+
}, K = O(e, "app.config.ts"), oe = (e) => {
|
|
2453
|
+
if (!ae(e.env)) return "";
|
|
2409
2454
|
let t = Object.entries(e.env.vars).map(([e, t]) => `${e}:${t.access}`).sort();
|
|
2410
2455
|
return `${String(e.env.publicPrefix)}|${t.join(",")}`;
|
|
2411
|
-
},
|
|
2456
|
+
}, se = (e, t) => {
|
|
2412
2457
|
let n = [];
|
|
2413
|
-
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"),
|
|
2414
|
-
},
|
|
2458
|
+
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"), oe(e) !== oe(t) && n.push("env"), n;
|
|
2459
|
+
}, ce = n, le = A(K), ue = {
|
|
2415
2460
|
name: "framework:watch-app-config",
|
|
2416
2461
|
async configureServer(n) {
|
|
2417
|
-
n.watcher.add(
|
|
2462
|
+
n.watcher.add(K), Z.info("watching app.config.ts for changes", { path: k(e, K) });
|
|
2418
2463
|
let r = async () => {
|
|
2419
2464
|
try {
|
|
2420
2465
|
try {
|
|
2421
|
-
let e = n.moduleGraph.getModuleById(
|
|
2466
|
+
let e = n.moduleGraph.getModuleById(K);
|
|
2422
2467
|
e && n.moduleGraph.invalidateModule(e);
|
|
2423
2468
|
} catch {}
|
|
2424
|
-
let e = (await n.ssrLoadModule(
|
|
2469
|
+
let e = (await n.ssrLoadModule(K, { fixStacktrace: !0 })).default;
|
|
2425
2470
|
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);
|
|
2426
2471
|
} catch (e) {
|
|
2427
2472
|
return Z.warn("app.config.ts re-load failed — ignoring this change", {}, e), null;
|
|
@@ -2440,17 +2485,17 @@ import {
|
|
|
2440
2485
|
theme: t.theme,
|
|
2441
2486
|
port: t.port,
|
|
2442
2487
|
name: t.name
|
|
2443
|
-
}), JSON.stringify(t) === JSON.stringify(
|
|
2488
|
+
}), JSON.stringify(t) === JSON.stringify(ce)) {
|
|
2444
2489
|
Z.info("app.config.ts onConfigChange: parsed config unchanged — skipping (no-op edit?)");
|
|
2445
2490
|
return;
|
|
2446
2491
|
}
|
|
2447
|
-
let i =
|
|
2492
|
+
let i = se(ce, t);
|
|
2448
2493
|
if (i.length > 0) {
|
|
2449
2494
|
Z.warn("app.config.ts changed — hard restart required", { fields: i });
|
|
2450
2495
|
try {
|
|
2451
2496
|
await n.close();
|
|
2452
2497
|
} catch {}
|
|
2453
|
-
let e =
|
|
2498
|
+
let e = fe(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
2454
2499
|
stdio: "inherit",
|
|
2455
2500
|
env: process.env,
|
|
2456
2501
|
cwd: process.cwd()
|
|
@@ -2466,7 +2511,7 @@ import {
|
|
|
2466
2511
|
}
|
|
2467
2512
|
try {
|
|
2468
2513
|
let r = Date.now();
|
|
2469
|
-
await
|
|
2514
|
+
await Jr(e, t, await Hr(e, t)), ce = t, n.ws && n.ws.send({
|
|
2470
2515
|
type: "full-reload",
|
|
2471
2516
|
path: "*"
|
|
2472
2517
|
}), Z.info("app.config.ts soft-regen", {
|
|
@@ -2476,7 +2521,7 @@ import {
|
|
|
2476
2521
|
} catch (e) {
|
|
2477
2522
|
Z.error("app.config.ts soft-regen failed", {}, e);
|
|
2478
2523
|
}
|
|
2479
|
-
}, s = (e) =>
|
|
2524
|
+
}, s = (e) => E(e) === "app.config.ts" ? e === K || A(e) === le : !1;
|
|
2480
2525
|
n.watcher.on("change", (e) => {
|
|
2481
2526
|
s(e) && (Z.info("app.config.ts change event (chokidar)", { file: e }), a());
|
|
2482
2527
|
}), n.watcher.on("add", (e) => {
|
|
@@ -2484,82 +2529,72 @@ import {
|
|
|
2484
2529
|
});
|
|
2485
2530
|
try {
|
|
2486
2531
|
let { watchFile: e } = await import("node:fs");
|
|
2487
|
-
e(
|
|
2532
|
+
e(K, { interval: 500 }, (e, t) => {
|
|
2488
2533
|
e.mtimeMs !== t.mtimeMs && (Z.info("app.config.ts change event (poll)", { mtime: e.mtimeMs }), a());
|
|
2489
2534
|
}), Z.info("app.config.ts polling watcher attached", { intervalMs: 500 });
|
|
2490
2535
|
} catch (e) {
|
|
2491
2536
|
Z.warn("app.config.ts polling watcher could not attach", {}, e);
|
|
2492
2537
|
}
|
|
2493
|
-
|
|
2538
|
+
ke(t, Z, {
|
|
2494
2539
|
root: e,
|
|
2495
2540
|
onBeforeRestart: () => n.close()
|
|
2496
2541
|
});
|
|
2497
2542
|
}
|
|
2498
|
-
},
|
|
2543
|
+
}, de = /\/apps\/[^/]+\/.*\.(route|mutation|workflow|schema)\.tsx?$/, q = 0, pe = {
|
|
2499
2544
|
name: "framework:suppress-api-hmr",
|
|
2500
2545
|
handleHotUpdate(e) {
|
|
2501
|
-
if (q += 1,
|
|
2546
|
+
if (q += 1, de.test(e.file)) return [];
|
|
2502
2547
|
}
|
|
2503
|
-
},
|
|
2548
|
+
}, me = {
|
|
2504
2549
|
name: "framework:reoptimize-on-rpcgroup-change",
|
|
2505
2550
|
async configureServer(t) {
|
|
2506
|
-
let n =
|
|
2507
|
-
for (let r of
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
let a = C(i, "rpcGroup.generated.ts");
|
|
2512
|
-
try {
|
|
2513
|
-
n.set(a, await D.readFile(a, "utf8"));
|
|
2514
|
-
} catch {
|
|
2515
|
-
n.set(a, "");
|
|
2516
|
-
}
|
|
2517
|
-
try {
|
|
2518
|
-
t.watcher.add(a);
|
|
2519
|
-
} catch {}
|
|
2520
|
-
}
|
|
2521
|
-
if (n.size === 0) return;
|
|
2522
|
-
let r = null, i = !1, a = async () => {
|
|
2523
|
-
if (i) return;
|
|
2524
|
-
let r = null;
|
|
2525
|
-
for (let [e, t] of n) {
|
|
2526
|
-
let i;
|
|
2551
|
+
let n = [];
|
|
2552
|
+
for (let r of a) {
|
|
2553
|
+
let i = await Lr(e, r.pkg);
|
|
2554
|
+
if (i) {
|
|
2555
|
+
n.push(i);
|
|
2527
2556
|
try {
|
|
2528
|
-
|
|
2529
|
-
} catch {
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2557
|
+
t.watcher.add(O(i, "rpcGroup.generated.ts"));
|
|
2558
|
+
} catch {}
|
|
2559
|
+
for (let e of await dr(i)) try {
|
|
2560
|
+
t.watcher.add(e);
|
|
2561
|
+
} catch {}
|
|
2533
2562
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2563
|
+
}
|
|
2564
|
+
if (n.length === 0) return;
|
|
2565
|
+
let r = await pr(n), i = null, o = !1, s = async () => {
|
|
2566
|
+
if (o) return;
|
|
2567
|
+
let e = await pr(n);
|
|
2568
|
+
if (e !== void 0 && e !== r) {
|
|
2569
|
+
r = e, o = !0, Z.info("the api surface changed — re-bundling the api client + reloading (descriptor edits propagate automatically; no manual restart needed)");
|
|
2536
2570
|
try {
|
|
2537
|
-
await
|
|
2571
|
+
await M.rm(O(V, ".vite", "deps"), {
|
|
2538
2572
|
recursive: !0,
|
|
2539
2573
|
force: !0
|
|
2540
2574
|
}), await t.restart(!0);
|
|
2541
2575
|
} catch (e) {
|
|
2542
|
-
|
|
2576
|
+
o = !1, Z.error("rpcGroup re-optimize failed", {}, e);
|
|
2543
2577
|
}
|
|
2544
2578
|
}
|
|
2545
|
-
},
|
|
2546
|
-
|
|
2547
|
-
|
|
2579
|
+
}, c = (e) => {
|
|
2580
|
+
let t = A(e);
|
|
2581
|
+
!lr(t) && !t.endsWith("rpcGroup.generated.ts") || (i && clearTimeout(i), i = setTimeout(() => {
|
|
2582
|
+
s();
|
|
2548
2583
|
}, 120));
|
|
2549
2584
|
};
|
|
2550
|
-
t.watcher.on("change",
|
|
2585
|
+
t.watcher.on("change", c), t.watcher.on("add", c);
|
|
2551
2586
|
}
|
|
2552
|
-
}, J = {},
|
|
2587
|
+
}, J = {}, ge = (e) => (t) => {
|
|
2553
2588
|
t.on("proxyReq", (t, n) => {
|
|
2554
|
-
|
|
2589
|
+
sn(t, n, {
|
|
2555
2590
|
target: e,
|
|
2556
2591
|
token: process.env.VOLTRO_INSPECT_TOKEN,
|
|
2557
2592
|
writeToken: process.env.VOLTRO_INSPECT_WRITE_TOKEN,
|
|
2558
|
-
isLoopback:
|
|
2593
|
+
isLoopback: m
|
|
2559
2594
|
});
|
|
2560
2595
|
});
|
|
2561
2596
|
};
|
|
2562
|
-
for (let e of
|
|
2597
|
+
for (let e of a) {
|
|
2563
2598
|
if (!e.proxyTarget) continue;
|
|
2564
2599
|
J[e.browserWsUrl] = {
|
|
2565
2600
|
target: e.proxyTarget,
|
|
@@ -2572,10 +2607,10 @@ import {
|
|
|
2572
2607
|
target: t,
|
|
2573
2608
|
changeOrigin: !0,
|
|
2574
2609
|
rewrite: (t) => t.replace(RegExp(`^/_voltro/api/${e.name}`), ""),
|
|
2575
|
-
configure:
|
|
2610
|
+
configure: ge(t)
|
|
2576
2611
|
};
|
|
2577
2612
|
}
|
|
2578
|
-
for (let [e, t] of Object.entries(
|
|
2613
|
+
for (let [e, t] of Object.entries(n.proxies ?? {})) {
|
|
2579
2614
|
if (J[e]) {
|
|
2580
2615
|
Z.warn("user proxy ignored — prefix already claimed by an api ws proxy", { prefix: e });
|
|
2581
2616
|
continue;
|
|
@@ -2590,32 +2625,32 @@ import {
|
|
|
2590
2625
|
...t.rewrite === void 0 ? {} : { rewrite: t.rewrite }
|
|
2591
2626
|
});
|
|
2592
2627
|
}
|
|
2593
|
-
let
|
|
2628
|
+
let _e = {
|
|
2594
2629
|
name: "framework:inspect",
|
|
2595
2630
|
configureServer(t) {
|
|
2596
|
-
let
|
|
2597
|
-
if (
|
|
2598
|
-
let
|
|
2599
|
-
for (let
|
|
2600
|
-
let i = await t.ssrLoadModule(
|
|
2601
|
-
|
|
2602
|
-
pattern:
|
|
2603
|
-
file:
|
|
2604
|
-
dirChain:
|
|
2605
|
-
renderMode:
|
|
2631
|
+
let r = null, a = async () => {
|
|
2632
|
+
if (r !== null) return r;
|
|
2633
|
+
let n = [];
|
|
2634
|
+
for (let r of N) try {
|
|
2635
|
+
let i = await t.ssrLoadModule(O(e, "src", "pages", r.file));
|
|
2636
|
+
n.push({
|
|
2637
|
+
pattern: r.pattern,
|
|
2638
|
+
file: r.file,
|
|
2639
|
+
dirChain: r.dirChain,
|
|
2640
|
+
renderMode: _(i, O("src", "pages", r.file)),
|
|
2606
2641
|
interactive: i.interactive ?? "full",
|
|
2607
2642
|
tenantAware: i.tenantAware === !0,
|
|
2608
|
-
revalidateMs:
|
|
2609
|
-
staleWhileRevalidateMs:
|
|
2643
|
+
revalidateMs: v(i.revalidate),
|
|
2644
|
+
staleWhileRevalidateMs: v(i.staleWhileRevalidate) ?? 0,
|
|
2610
2645
|
cacheInvalidatesOn: Array.isArray(i.cacheInvalidatesOn) ? i.cacheInvalidatesOn : [],
|
|
2611
2646
|
hasLoader: typeof i.loader == "function",
|
|
2612
2647
|
hasMeta: i.meta != null,
|
|
2613
2648
|
hasGetStaticPaths: typeof i.getStaticPaths == "function"
|
|
2614
2649
|
});
|
|
2615
2650
|
} catch (e) {
|
|
2616
|
-
Z.warn("inspect: failed to load page metadata", { pattern:
|
|
2651
|
+
Z.warn("inspect: failed to load page metadata", { pattern: r.pattern }, e);
|
|
2617
2652
|
}
|
|
2618
|
-
return
|
|
2653
|
+
return r = n, n;
|
|
2619
2654
|
};
|
|
2620
2655
|
t.middlewares.use((e, t, n) => {
|
|
2621
2656
|
let r = e.url ?? "/";
|
|
@@ -2633,10 +2668,10 @@ import {
|
|
|
2633
2668
|
}), n();
|
|
2634
2669
|
}), t.middlewares.use((t, n, r) => {
|
|
2635
2670
|
if (t.method !== "GET" && t.method !== "HEAD") return r();
|
|
2636
|
-
let { pathname: i } =
|
|
2637
|
-
if (i !== "/robots.txt" ||
|
|
2638
|
-
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(
|
|
2639
|
-
}),
|
|
2671
|
+
let { pathname: i } = Hn(t.url ?? "/");
|
|
2672
|
+
if (i !== "/robots.txt" || j(O(e, "public", "robots.txt"))) return r();
|
|
2673
|
+
n.statusCode = 200, n.setHeader("Content-Type", "text/plain; charset=utf-8"), n.end(xt({ indexable: !1 }));
|
|
2674
|
+
}), n.name === "voltroDashboard" && t.middlewares.use(async (e, t, n) => {
|
|
2640
2675
|
let r = e.url ?? "", i = r.split("?")[0];
|
|
2641
2676
|
if (i === "/api/dashboard/proxy") {
|
|
2642
2677
|
let n = new URL(r, "http://x").searchParams.get("target");
|
|
@@ -2644,13 +2679,13 @@ import {
|
|
|
2644
2679
|
t.statusCode = 400, t.end("missing ?target=");
|
|
2645
2680
|
return;
|
|
2646
2681
|
}
|
|
2647
|
-
if (!
|
|
2682
|
+
if (!h(n)) {
|
|
2648
2683
|
t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
|
|
2649
2684
|
return;
|
|
2650
2685
|
}
|
|
2651
2686
|
try {
|
|
2652
2687
|
let r = { accept: String(e.headers.accept ?? "application/json") };
|
|
2653
|
-
e.headers.authorization ? r.authorization = String(e.headers.authorization) :
|
|
2688
|
+
e.headers.authorization ? r.authorization = String(e.headers.authorization) : m(n) && process.env.VOLTRO_INSPECT_TOKEN && (r.authorization = `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}`);
|
|
2654
2689
|
let i;
|
|
2655
2690
|
if (e.method && e.method !== "GET" && e.method !== "HEAD") {
|
|
2656
2691
|
let t = [];
|
|
@@ -2677,7 +2712,7 @@ import {
|
|
|
2677
2712
|
t.statusCode = 400, t.end("missing ?target=");
|
|
2678
2713
|
return;
|
|
2679
2714
|
}
|
|
2680
|
-
if (!
|
|
2715
|
+
if (!h(n)) {
|
|
2681
2716
|
t.statusCode = 400, t.end("target not allowed: must be loopback or an origin configured in VOLTRO_DASHBOARD_APPS");
|
|
2682
2717
|
return;
|
|
2683
2718
|
}
|
|
@@ -2689,7 +2724,7 @@ import {
|
|
|
2689
2724
|
method: "GET",
|
|
2690
2725
|
headers: {
|
|
2691
2726
|
accept: "text/event-stream",
|
|
2692
|
-
...e.headers.authorization ? { authorization: String(e.headers.authorization) } :
|
|
2727
|
+
...e.headers.authorization ? { authorization: String(e.headers.authorization) } : m(n) && process.env.VOLTRO_INSPECT_TOKEN ? { authorization: `Bearer ${process.env.VOLTRO_INSPECT_TOKEN}` } : {}
|
|
2693
2728
|
},
|
|
2694
2729
|
signal: i.signal
|
|
2695
2730
|
});
|
|
@@ -2719,22 +2754,22 @@ import {
|
|
|
2719
2754
|
return;
|
|
2720
2755
|
}
|
|
2721
2756
|
n();
|
|
2722
|
-
}), t.middlewares.use(async (e, t,
|
|
2723
|
-
let
|
|
2724
|
-
if (!
|
|
2725
|
-
let
|
|
2726
|
-
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (
|
|
2727
|
-
let
|
|
2728
|
-
if (e.method === "GET" && (
|
|
2729
|
-
let e =
|
|
2757
|
+
}), t.middlewares.use(async (e, t, r) => {
|
|
2758
|
+
let o = e.url ?? "";
|
|
2759
|
+
if (!o.startsWith("/_voltro/inspect")) return r();
|
|
2760
|
+
let s = {};
|
|
2761
|
+
for (let [t, n] of Object.entries(e.headers ?? {})) n !== void 0 && (s[String(t).toLowerCase()] = Array.isArray(n) ? n.join(", ") : String(n));
|
|
2762
|
+
let c = o.split("?")[0];
|
|
2763
|
+
if (e.method === "GET" && (c === "/_voltro/inspect/logs" || o.startsWith("/_voltro/inspect/logs?"))) {
|
|
2764
|
+
let e = d(s.origin), n = en(o, It(), s);
|
|
2730
2765
|
t.statusCode = n.status, t.setHeader("content-type", n.contentType);
|
|
2731
2766
|
for (let [n, r] of Object.entries(e)) t.setHeader(n, r);
|
|
2732
2767
|
t.end(n.body);
|
|
2733
2768
|
return;
|
|
2734
2769
|
}
|
|
2735
|
-
if (e.method === "POST" &&
|
|
2736
|
-
let n =
|
|
2737
|
-
if (
|
|
2770
|
+
if (e.method === "POST" && c === "/_voltro/inspect/clientLog") {
|
|
2771
|
+
let n = d(s.origin);
|
|
2772
|
+
if (u()) {
|
|
2738
2773
|
t.statusCode = 503, t.setHeader("content-type", "application/json");
|
|
2739
2774
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2740
2775
|
t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
@@ -2744,7 +2779,7 @@ import {
|
|
|
2744
2779
|
e.setEncoding("utf-8"), e.on("data", (e) => {
|
|
2745
2780
|
r += e;
|
|
2746
2781
|
}), e.on("end", () => {
|
|
2747
|
-
let e =
|
|
2782
|
+
let e = Jt(r, i);
|
|
2748
2783
|
t.statusCode = e.status, t.setHeader("content-type", e.contentType);
|
|
2749
2784
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2750
2785
|
t.end(e.body);
|
|
@@ -2753,15 +2788,15 @@ import {
|
|
|
2753
2788
|
});
|
|
2754
2789
|
return;
|
|
2755
2790
|
}
|
|
2756
|
-
if (
|
|
2757
|
-
let n =
|
|
2758
|
-
if (
|
|
2791
|
+
if (c === "/_voltro/inspect/stream") {
|
|
2792
|
+
let n = d(s.origin);
|
|
2793
|
+
if (u()) {
|
|
2759
2794
|
t.statusCode = 503, t.setHeader("content-type", "application/json");
|
|
2760
2795
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2761
2796
|
t.end(JSON.stringify({ error: "inspect disabled (VOLTRO_INSPECT=off)" }));
|
|
2762
2797
|
return;
|
|
2763
2798
|
}
|
|
2764
|
-
let r = s
|
|
2799
|
+
let r = f(s, "GET");
|
|
2765
2800
|
if (!r.ok) {
|
|
2766
2801
|
t.statusCode = 401, t.setHeader("content-type", "application/json");
|
|
2767
2802
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
@@ -2774,31 +2809,31 @@ import {
|
|
|
2774
2809
|
t.statusCode = 200, t.setHeader("content-type", "text/event-stream; charset=utf-8"), t.setHeader("cache-control", "no-cache, no-transform"), t.setHeader("connection", "keep-alive"), t.setHeader("x-accel-buffering", "no");
|
|
2775
2810
|
for (let [e, r] of Object.entries(n)) t.setHeader(e, r);
|
|
2776
2811
|
t.flushHeaders?.(), t.write("retry: 5000\n\n");
|
|
2777
|
-
let
|
|
2778
|
-
if (
|
|
2779
|
-
let
|
|
2812
|
+
let a = o.indexOf("?");
|
|
2813
|
+
if (a === -1 || new URLSearchParams(o.slice(a + 1)).get("live") !== "1") for (let e of i.buffered()) t.write(wt(e));
|
|
2814
|
+
let c = i.subscribe((e) => {
|
|
2780
2815
|
try {
|
|
2781
|
-
t.write(
|
|
2816
|
+
t.write(wt(e));
|
|
2782
2817
|
} catch {}
|
|
2783
|
-
}),
|
|
2818
|
+
}), l = setInterval(() => {
|
|
2784
2819
|
try {
|
|
2785
|
-
t.write(
|
|
2820
|
+
t.write(Tt());
|
|
2786
2821
|
} catch {}
|
|
2787
2822
|
}, 15e3), p = () => {
|
|
2788
|
-
clearInterval(
|
|
2823
|
+
clearInterval(l), c();
|
|
2789
2824
|
};
|
|
2790
2825
|
e.on("close", p), t.on("close", p);
|
|
2791
2826
|
return;
|
|
2792
2827
|
}
|
|
2793
2828
|
try {
|
|
2794
|
-
let i =
|
|
2829
|
+
let i = {
|
|
2795
2830
|
kind: "web",
|
|
2796
2831
|
meta: {
|
|
2797
|
-
name:
|
|
2798
|
-
voltroVersion:
|
|
2799
|
-
port:
|
|
2832
|
+
name: n.name ?? "(unnamed)",
|
|
2833
|
+
voltroVersion: hr,
|
|
2834
|
+
port: l,
|
|
2800
2835
|
mode: "dev",
|
|
2801
|
-
apis: Object.entries(
|
|
2836
|
+
apis: Object.entries(n.apis ?? {}).map(([e, t]) => {
|
|
2802
2837
|
let n = {
|
|
2803
2838
|
name: e,
|
|
2804
2839
|
package: t.package
|
|
@@ -2806,43 +2841,43 @@ import {
|
|
|
2806
2841
|
return t.url !== void 0 && (n.url = t.url), n;
|
|
2807
2842
|
})
|
|
2808
2843
|
},
|
|
2809
|
-
routes: await
|
|
2844
|
+
routes: await a(),
|
|
2810
2845
|
dirs: I,
|
|
2811
2846
|
cache: () => ({
|
|
2812
2847
|
backend: "memory",
|
|
2813
2848
|
size: 0,
|
|
2814
2849
|
entries: []
|
|
2815
2850
|
}),
|
|
2816
|
-
env: () =>
|
|
2817
|
-
},
|
|
2818
|
-
if (
|
|
2819
|
-
t.statusCode =
|
|
2820
|
-
for (let [e, n] of Object.entries(
|
|
2821
|
-
t.end(
|
|
2851
|
+
env: () => we(n.name ?? "app", { contract: ae(n.env) ? n.env : void 0 })
|
|
2852
|
+
}, c = p(o, i, s, { method: e.method ?? "GET" });
|
|
2853
|
+
if (c === null) return r();
|
|
2854
|
+
t.statusCode = c.status, t.setHeader("content-type", c.contentType);
|
|
2855
|
+
for (let [e, n] of Object.entries(c.headers ?? {})) t.setHeader(e, n);
|
|
2856
|
+
t.end(c.body);
|
|
2822
2857
|
} catch (e) {
|
|
2823
2858
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`inspect handler error: ${e.message}`);
|
|
2824
2859
|
}
|
|
2825
2860
|
});
|
|
2826
2861
|
}
|
|
2827
|
-
},
|
|
2862
|
+
}, ve = n.name === "voltroDashboard" ? {
|
|
2828
2863
|
name: "framework:dashboard-registry",
|
|
2829
2864
|
configureServer(e) {
|
|
2830
2865
|
e.middlewares.use(async (e, t, n) => {
|
|
2831
2866
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
2832
2867
|
try {
|
|
2833
|
-
let e = await
|
|
2868
|
+
let e = await S();
|
|
2834
2869
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
2835
2870
|
} catch (e) {
|
|
2836
2871
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
2837
2872
|
}
|
|
2838
2873
|
});
|
|
2839
2874
|
}
|
|
2840
|
-
} : null,
|
|
2841
|
-
let o =
|
|
2875
|
+
} : null, ye = /* @__PURE__ */ new Set(), be = (e, t, n, r, i, a = !1) => {
|
|
2876
|
+
let o = Yn(i, a, t) ?? "";
|
|
2842
2877
|
if (Z.error(`${t} render failed`, {
|
|
2843
2878
|
pathname: n,
|
|
2844
2879
|
pattern: r,
|
|
2845
|
-
cause:
|
|
2880
|
+
cause: Dt(i) + o
|
|
2846
2881
|
}), e.headersSent) {
|
|
2847
2882
|
e.end();
|
|
2848
2883
|
return;
|
|
@@ -2853,9 +2888,9 @@ import {
|
|
|
2853
2888
|
"x-voltro-ssr-generation": String(q)
|
|
2854
2889
|
});
|
|
2855
2890
|
let s = q === 0 ? "" : `\n[voltro] this process has absorbed ${q} 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`;
|
|
2856
|
-
e.end(`${t} render failed for ${n}\n\n${
|
|
2857
|
-
},
|
|
2858
|
-
limit:
|
|
2891
|
+
e.end(`${t} render failed for ${n}\n\n${Dt(i)}\n${o}\n${s}`);
|
|
2892
|
+
}, xe = rt(), Ce = at({
|
|
2893
|
+
limit: xe,
|
|
2859
2894
|
onColdStart: (e) => Z.debug("ssr cold-compile start", { id: e }),
|
|
2860
2895
|
onColdEnd: (e, { durationMs: t, failed: n }) => Z.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
2861
2896
|
id: e,
|
|
@@ -2863,29 +2898,29 @@ import {
|
|
|
2863
2898
|
...n ? { failed: !0 } : {}
|
|
2864
2899
|
})
|
|
2865
2900
|
});
|
|
2866
|
-
Z.debug(`ssr cold-compile concurrency ${
|
|
2867
|
-
let
|
|
2901
|
+
Z.debug(`ssr cold-compile concurrency ${xe}`, { concurrency: xe });
|
|
2902
|
+
let Te = null, Ee = async () => (Te === null && (Te = await M.readFile(O(e, ".framework", "index.html"), "utf8")), Te), Oe = {
|
|
2868
2903
|
name: "framework:ssr",
|
|
2869
2904
|
configureServer(t) {
|
|
2870
|
-
let
|
|
2905
|
+
let r = (e) => Ce.load(e, async () => await t.ssrLoadModule(e)), i, o = !1, s = () => {
|
|
2871
2906
|
if (i !== void 0) return i;
|
|
2872
|
-
let t =
|
|
2907
|
+
let t = n.locales ?? [], a = n.defaultLocale ?? t[0] ?? "en";
|
|
2873
2908
|
return t.length === 0 ? (i = Promise.resolve(() => void 0), i) : (i = (async () => {
|
|
2874
|
-
let [{ makeSsgWrap:
|
|
2875
|
-
for (let i of t) if (
|
|
2876
|
-
let t = (await
|
|
2877
|
-
t !== void 0 && (s[i] =
|
|
2909
|
+
let [{ makeSsgWrap: n }, { makeSsrI18nResolver: i }] = await Promise.all([r("@voltro/i18n"), r("@voltro/i18n/server")]), s = {};
|
|
2910
|
+
for (let i of t) if (j(O(e, "src", "locales", `${i}.ts`))) try {
|
|
2911
|
+
let t = (await r(O(e, "src", "locales", `${i}.ts`))).default;
|
|
2912
|
+
t !== void 0 && (s[i] = n(i, t, a));
|
|
2878
2913
|
} catch (e) {
|
|
2879
2914
|
Z.warn("locale catalog failed to load for SSR", { locale: i }, e);
|
|
2880
2915
|
}
|
|
2881
|
-
if (
|
|
2882
|
-
let { resolveLocale: e } = await
|
|
2916
|
+
if (o = Object.keys(s).length > 0, Object.keys(s).length === 0) {
|
|
2917
|
+
let { resolveLocale: e } = await r("@voltro/i18n/server");
|
|
2883
2918
|
return (n, r) => ({
|
|
2884
2919
|
locale: e({
|
|
2885
2920
|
cookieHeader: n ?? null,
|
|
2886
2921
|
acceptLanguageHeader: r ?? null,
|
|
2887
2922
|
supported: t,
|
|
2888
|
-
defaultLocale:
|
|
2923
|
+
defaultLocale: a
|
|
2889
2924
|
}),
|
|
2890
2925
|
outerWrap: (e) => e
|
|
2891
2926
|
});
|
|
@@ -2893,26 +2928,26 @@ import {
|
|
|
2893
2928
|
return i({
|
|
2894
2929
|
wraps: s,
|
|
2895
2930
|
supported: t,
|
|
2896
|
-
defaultLocale:
|
|
2931
|
+
defaultLocale: a
|
|
2897
2932
|
});
|
|
2898
2933
|
})(), i);
|
|
2899
2934
|
};
|
|
2900
|
-
t.middlewares.use(async (i,
|
|
2901
|
-
if (i.method !== "GET" && i.method !== "HEAD") return
|
|
2902
|
-
let
|
|
2903
|
-
|
|
2904
|
-
let { pathname:
|
|
2905
|
-
if (
|
|
2906
|
-
let p =
|
|
2907
|
-
if (!p) return
|
|
2908
|
-
let
|
|
2909
|
-
|
|
2935
|
+
t.middlewares.use(async (i, c, l) => {
|
|
2936
|
+
if (i.method !== "GET" && i.method !== "HEAD") return l();
|
|
2937
|
+
let u = i.url ?? "/";
|
|
2938
|
+
u.indexOf("?");
|
|
2939
|
+
let { pathname: d, search: f } = Hn(u);
|
|
2940
|
+
if (d.startsWith("/@") || d.startsWith("/node_modules/") || d.startsWith("/.framework/") || d.startsWith("/_voltro/") || d === "/main.tsx" || d === "/index.html" || d === "/sw.js" || d === "/favicon.ico" || d === "/robots.txt" || /\.[a-z0-9]+$/i.test(d)) return l();
|
|
2941
|
+
let p = Ir(d, F.ssrRoutes);
|
|
2942
|
+
if (!p) return l();
|
|
2943
|
+
let m = !ye.has(p.route.pattern), h = Date.now();
|
|
2944
|
+
m && Z.info(`ssr compiling ${p.route.pattern}`, {
|
|
2910
2945
|
pattern: p.route.pattern,
|
|
2911
|
-
pathname:
|
|
2946
|
+
pathname: d
|
|
2912
2947
|
});
|
|
2913
|
-
let
|
|
2948
|
+
let g = {}, v = async (e, t) => {
|
|
2914
2949
|
let n = Date.now(), r = await t();
|
|
2915
|
-
return
|
|
2950
|
+
return g[e] = (g[e] ?? 0) + (Date.now() - n), r;
|
|
2916
2951
|
}, y = async (e, n, r) => {
|
|
2917
2952
|
let i = await t.moduleGraph.getModuleById(e);
|
|
2918
2953
|
if (!(!i || n.has(e))) {
|
|
@@ -2925,51 +2960,54 @@ import {
|
|
|
2925
2960
|
}
|
|
2926
2961
|
}, b = !1;
|
|
2927
2962
|
try {
|
|
2928
|
-
let x = await v("loadPage", async () => await
|
|
2929
|
-
if (S !== "ssr" && S !== "isr" && !
|
|
2930
|
-
let
|
|
2931
|
-
for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ?
|
|
2932
|
-
let
|
|
2933
|
-
|
|
2963
|
+
let x = await v("loadPage", async () => await r(O(e, "src", "pages", p.route.file))), S = _(x, O("src", "pages", p.route.file)), C = Ar(F.dirs, p.route.dirChain), w = S === "spa" && C.some((e) => e.hasLayout);
|
|
2964
|
+
if (S !== "ssr" && S !== "isr" && !w) return l();
|
|
2965
|
+
let T = {};
|
|
2966
|
+
for (let [e, t] of Object.entries(i.headers ?? {})) typeof t == "string" ? T[e] = t : Array.isArray(t) && (T[e] = t.join(", "));
|
|
2967
|
+
let E = qr(Kr(a[0], { allowDevProxy: !0 }), T.cookie, { apiName: a[0]?.name }), D = new AbortController(), k = () => D.abort();
|
|
2968
|
+
c.once("close", k);
|
|
2934
2969
|
let A = null, j = [], M = {};
|
|
2935
2970
|
try {
|
|
2936
|
-
(await
|
|
2937
|
-
entries:
|
|
2938
|
-
loadLayout: (t) =>
|
|
2939
|
-
loadError: (t) =>
|
|
2940
|
-
loadPending: (t) =>
|
|
2971
|
+
(await r("@voltro/web/ssr")).beginStoreSeeds(), {chain: j, segmentLoaderData: M} = await v("loadChain", () => jr({
|
|
2972
|
+
entries: C,
|
|
2973
|
+
loadLayout: (t) => r(O(e, "src", "pages", t.dir, "layout.tsx")),
|
|
2974
|
+
loadError: (t) => r(O(e, "src", "pages", t.dir, "error.tsx")),
|
|
2975
|
+
loadPending: (t) => r(O(e, "src", "pages", t.dir, "loading.tsx")),
|
|
2941
2976
|
ctx: {
|
|
2942
2977
|
params: p.params,
|
|
2943
|
-
pathname:
|
|
2944
|
-
search:
|
|
2945
|
-
signal:
|
|
2946
|
-
headers:
|
|
2947
|
-
query:
|
|
2978
|
+
pathname: d,
|
|
2979
|
+
search: f,
|
|
2980
|
+
signal: D.signal,
|
|
2981
|
+
headers: T,
|
|
2982
|
+
query: E,
|
|
2983
|
+
isServer: !0
|
|
2948
2984
|
}
|
|
2949
2985
|
}));
|
|
2950
2986
|
let t = x.loader;
|
|
2951
|
-
typeof t == "function" && !
|
|
2987
|
+
typeof t == "function" && !w && (A = await v("loader", () => t({
|
|
2952
2988
|
params: p.params,
|
|
2953
|
-
pathname:
|
|
2954
|
-
search:
|
|
2955
|
-
signal:
|
|
2956
|
-
headers:
|
|
2957
|
-
query:
|
|
2989
|
+
pathname: d,
|
|
2990
|
+
search: f,
|
|
2991
|
+
signal: D.signal,
|
|
2992
|
+
headers: T,
|
|
2993
|
+
query: E,
|
|
2994
|
+
isServer: !0
|
|
2958
2995
|
})));
|
|
2959
2996
|
} finally {
|
|
2960
|
-
|
|
2997
|
+
c.off("close", k);
|
|
2961
2998
|
}
|
|
2962
|
-
let N = await v("loadSsrHelpers", async () => await
|
|
2963
|
-
|
|
2999
|
+
let N = await v("loadSsrHelpers", async () => await r("@voltro/web/ssr"));
|
|
3000
|
+
w || await cr({
|
|
2964
3001
|
pageMod: x,
|
|
2965
3002
|
params: p.params,
|
|
2966
|
-
query:
|
|
2967
|
-
apiName:
|
|
3003
|
+
query: E,
|
|
3004
|
+
apiName: a[0]?.name,
|
|
2968
3005
|
seed: N.seedPreloadedSubscription,
|
|
3006
|
+
seedFailure: N.seedPreloadedSubscriptionFailure,
|
|
2969
3007
|
onError: ({ tag: e, apiName: t }, n) => Z.warn("preload seed failed", {
|
|
2970
3008
|
tag: e,
|
|
2971
3009
|
apiName: t,
|
|
2972
|
-
pathname:
|
|
3010
|
+
pathname: d
|
|
2973
3011
|
}, n)
|
|
2974
3012
|
});
|
|
2975
3013
|
let P = {
|
|
@@ -2982,15 +3020,15 @@ import {
|
|
|
2982
3020
|
renderMode: S,
|
|
2983
3021
|
chain: j
|
|
2984
3022
|
}, I = {
|
|
2985
|
-
cookies: N.parseCookieHeader(
|
|
2986
|
-
headers:
|
|
2987
|
-
url:
|
|
2988
|
-
}, L = x.interactive ?? "full", R = (await
|
|
2989
|
-
b = R !== void 0 &&
|
|
2990
|
-
let
|
|
3023
|
+
cookies: N.parseCookieHeader(T.cookie),
|
|
3024
|
+
headers: T,
|
|
3025
|
+
url: u
|
|
3026
|
+
}, L = x.interactive ?? "full", R = (await s())(T.cookie, T["accept-language"]);
|
|
3027
|
+
b = R !== void 0 && o;
|
|
3028
|
+
let z = R ? {
|
|
2991
3029
|
outerWrap: R.outerWrap,
|
|
2992
3030
|
locale: R.locale
|
|
2993
|
-
} : {},
|
|
3031
|
+
} : {}, B = w ? zn({
|
|
2994
3032
|
helpers: N,
|
|
2995
3033
|
page: `src/pages/${p.route.file}`,
|
|
2996
3034
|
interactive: L,
|
|
@@ -2998,94 +3036,94 @@ import {
|
|
|
2998
3036
|
renderInput: {
|
|
2999
3037
|
descriptor: P,
|
|
3000
3038
|
params: p.params,
|
|
3001
|
-
pathname:
|
|
3002
|
-
search:
|
|
3039
|
+
pathname: d,
|
|
3040
|
+
search: f,
|
|
3003
3041
|
segmentLoaderData: M,
|
|
3004
3042
|
requestContext: I,
|
|
3005
|
-
...
|
|
3043
|
+
...z
|
|
3006
3044
|
}
|
|
3007
|
-
}) : null,
|
|
3045
|
+
}) : null, V = w ? null : Rn({
|
|
3008
3046
|
helpers: N,
|
|
3009
3047
|
page: `src/pages/${p.route.file}`,
|
|
3010
|
-
pathname:
|
|
3048
|
+
pathname: d,
|
|
3011
3049
|
renderMode: S,
|
|
3012
3050
|
interactive: L,
|
|
3013
3051
|
loaderData: A,
|
|
3014
3052
|
segmentLoaderData: M,
|
|
3015
3053
|
pageLoaderRan: typeof x.loader == "function"
|
|
3016
|
-
}),
|
|
3054
|
+
}), ee = [];
|
|
3017
3055
|
await v("collectCss", async () => {
|
|
3018
3056
|
let t = /* @__PURE__ */ new Set(), n = [
|
|
3019
|
-
|
|
3020
|
-
...
|
|
3021
|
-
...t.hasLayout ? [
|
|
3022
|
-
...t.hasError ? [
|
|
3023
|
-
...t.hasPending ? [
|
|
3057
|
+
O(e, "src", "pages", p.route.file),
|
|
3058
|
+
...C.flatMap((t) => [
|
|
3059
|
+
...t.hasLayout ? [O(e, "src", "pages", t.dir, "layout.tsx")] : [],
|
|
3060
|
+
...t.hasError ? [O(e, "src", "pages", t.dir, "error.tsx")] : [],
|
|
3061
|
+
...t.hasPending ? [O(e, "src", "pages", t.dir, "loading.tsx")] : []
|
|
3024
3062
|
]),
|
|
3025
|
-
|
|
3063
|
+
O(e, ".framework", "main.tsx")
|
|
3026
3064
|
];
|
|
3027
|
-
for (let e of n) await y(e, t,
|
|
3065
|
+
for (let e of n) await y(e, t, ee);
|
|
3028
3066
|
});
|
|
3029
|
-
let te = await v("readShell",
|
|
3030
|
-
if (
|
|
3031
|
-
let e = (e) =>
|
|
3067
|
+
let te = await v("readShell", Ee), H = await v("transformShell", () => t.transformIndexHtml(u, te)), U = ee.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), W = R?.locale ?? I.cookies["voltro:locale"] ?? n.defaultLocale ?? (n.locales ?? [])[0] ?? "en", ne = Date.now();
|
|
3068
|
+
if (B) {
|
|
3069
|
+
let e = (e) => Vn({
|
|
3032
3070
|
helpers: N,
|
|
3033
|
-
prepared:
|
|
3071
|
+
prepared: B,
|
|
3034
3072
|
meta: e,
|
|
3035
3073
|
interactive: L,
|
|
3036
|
-
extra: [
|
|
3074
|
+
extra: [U]
|
|
3037
3075
|
});
|
|
3038
|
-
if (
|
|
3039
|
-
res:
|
|
3040
|
-
shell:
|
|
3076
|
+
if (B.hasDeferred) ar({
|
|
3077
|
+
res: c,
|
|
3078
|
+
shell: nr({
|
|
3041
3079
|
shell: H,
|
|
3042
3080
|
inlineModuleScriptsAsync: !0
|
|
3043
3081
|
}),
|
|
3044
|
-
htmlLang:
|
|
3082
|
+
htmlLang: W,
|
|
3045
3083
|
headers: {
|
|
3046
3084
|
"content-type": "text/html; charset=utf-8",
|
|
3047
3085
|
"x-voltro-rendered-by": "spa-shell-dev"
|
|
3048
3086
|
},
|
|
3049
3087
|
headInjection: e,
|
|
3050
3088
|
render: (e) => N.renderPageToStream({
|
|
3051
|
-
...
|
|
3089
|
+
...B.renderInput,
|
|
3052
3090
|
...e
|
|
3053
3091
|
}),
|
|
3054
3092
|
onShellError: (e) => {
|
|
3055
|
-
|
|
3093
|
+
be(c, "spa-shell-dev", d, p.route.pattern, e, b);
|
|
3056
3094
|
}
|
|
3057
3095
|
});
|
|
3058
3096
|
else {
|
|
3059
|
-
let t =
|
|
3097
|
+
let t = Bn({
|
|
3060
3098
|
helpers: N,
|
|
3061
|
-
prepared:
|
|
3062
|
-
}), n = H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${
|
|
3063
|
-
|
|
3099
|
+
prepared: B
|
|
3100
|
+
}), n = H.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${W}"`);
|
|
3101
|
+
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "spa-shell-dev"), c.end(n);
|
|
3064
3102
|
}
|
|
3065
|
-
} else if (
|
|
3103
|
+
} else if (V) {
|
|
3066
3104
|
let e = (e) => [
|
|
3067
|
-
|
|
3105
|
+
U,
|
|
3068
3106
|
N.renderMetaToHtml(e),
|
|
3069
3107
|
`<meta name="voltro-interactive" content="${L}" />`,
|
|
3070
|
-
...
|
|
3071
|
-
N.renderRouterStateScript(
|
|
3108
|
+
...V.hasDeferred ? [N.renderDeferredRegistryScript()] : [],
|
|
3109
|
+
N.renderRouterStateScript(V.stateInput)
|
|
3072
3110
|
].filter((e) => e.length > 0).join("\n "), t = {
|
|
3073
3111
|
descriptor: P,
|
|
3074
3112
|
params: p.params,
|
|
3075
|
-
pathname:
|
|
3076
|
-
search:
|
|
3077
|
-
loaderData:
|
|
3078
|
-
segmentLoaderData:
|
|
3113
|
+
pathname: d,
|
|
3114
|
+
search: f,
|
|
3115
|
+
loaderData: V.loaderData,
|
|
3116
|
+
segmentLoaderData: V.segmentLoaderData,
|
|
3079
3117
|
requestContext: I,
|
|
3080
|
-
...
|
|
3118
|
+
...z
|
|
3081
3119
|
};
|
|
3082
|
-
if (S === "ssr" && L === "full")
|
|
3083
|
-
res:
|
|
3084
|
-
shell:
|
|
3120
|
+
if (S === "ssr" && L === "full") ar({
|
|
3121
|
+
res: c,
|
|
3122
|
+
shell: nr({
|
|
3085
3123
|
shell: H,
|
|
3086
3124
|
inlineModuleScriptsAsync: !0
|
|
3087
3125
|
}),
|
|
3088
|
-
htmlLang:
|
|
3126
|
+
htmlLang: W,
|
|
3089
3127
|
headers: {
|
|
3090
3128
|
"content-type": "text/html; charset=utf-8",
|
|
3091
3129
|
"x-voltro-rendered-by": "ssr-dev"
|
|
@@ -3096,75 +3134,73 @@ import {
|
|
|
3096
3134
|
...e
|
|
3097
3135
|
}),
|
|
3098
3136
|
onShellError: (e) => {
|
|
3099
|
-
|
|
3137
|
+
be(c, "ssr-dev", d, p.route.pattern, e, b);
|
|
3100
3138
|
}
|
|
3101
3139
|
});
|
|
3102
3140
|
else {
|
|
3103
|
-
let { html: n, meta: r } = N.renderPageToHtml(t), i = H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${
|
|
3104
|
-
|
|
3141
|
+
let { html: n, meta: r } = N.renderPageToHtml(t), i = H.replace("<div id=\"root\"></div>", `<div id="root">${n}</div>`).replace("</head>", ` ${e(r)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${W}"`);
|
|
3142
|
+
c.statusCode = 200, c.setHeader("content-type", "text/html; charset=utf-8"), c.setHeader("x-voltro-rendered-by", "ssr-dev"), c.end(i);
|
|
3105
3143
|
}
|
|
3106
3144
|
}
|
|
3107
|
-
|
|
3108
|
-
let
|
|
3109
|
-
|
|
3145
|
+
g.render = Date.now() - ne;
|
|
3146
|
+
let G = Date.now() - h;
|
|
3147
|
+
m ? (ye.add(p.route.pattern), Z.info(`ssr compiled ${p.route.pattern} in ${G}ms`, {
|
|
3110
3148
|
pattern: p.route.pattern,
|
|
3111
|
-
pathname:
|
|
3112
|
-
elapsedMs:
|
|
3149
|
+
pathname: d,
|
|
3150
|
+
elapsedMs: G,
|
|
3113
3151
|
cold: !0,
|
|
3114
|
-
phases:
|
|
3115
|
-
})) :
|
|
3152
|
+
phases: g
|
|
3153
|
+
})) : G > 200 && Z.info(`ssr rendered ${d} in ${G}ms`, {
|
|
3116
3154
|
pattern: p.route.pattern,
|
|
3117
|
-
pathname:
|
|
3118
|
-
elapsedMs:
|
|
3155
|
+
pathname: d,
|
|
3156
|
+
elapsedMs: G,
|
|
3119
3157
|
cold: !1,
|
|
3120
|
-
phases:
|
|
3158
|
+
phases: g
|
|
3121
3159
|
});
|
|
3122
3160
|
} catch (e) {
|
|
3123
|
-
if (
|
|
3161
|
+
if (In(e)) {
|
|
3124
3162
|
Z.error("ssr-dev render refused", {
|
|
3125
|
-
pathname:
|
|
3163
|
+
pathname: d,
|
|
3126
3164
|
pattern: p.route.pattern
|
|
3127
|
-
}, e),
|
|
3165
|
+
}, e), c.statusCode = 500, c.setHeader("content-type", "text/plain; charset=utf-8"), c.end(e.message);
|
|
3128
3166
|
return;
|
|
3129
3167
|
}
|
|
3130
|
-
let t =
|
|
3168
|
+
let t = Ln(e);
|
|
3131
3169
|
if (t) {
|
|
3132
|
-
|
|
3133
|
-
for (let [e, n] of Object.entries(t.headers))
|
|
3134
|
-
|
|
3170
|
+
c.statusCode = t.status;
|
|
3171
|
+
for (let [e, n] of Object.entries(t.headers)) c.setHeader(e, String(n));
|
|
3172
|
+
c.end(t.body);
|
|
3135
3173
|
return;
|
|
3136
3174
|
}
|
|
3137
|
-
|
|
3175
|
+
be(c, "ssr-dev", d, p.route.pattern, e, b);
|
|
3138
3176
|
}
|
|
3139
3177
|
});
|
|
3140
3178
|
}
|
|
3141
|
-
},
|
|
3179
|
+
}, Ae = Date.now(), je = R.version ?? "?", Me = await gr(), Ne = O(e, "node_modules", "@voltro", "ui-shadcn"), Y = j(O(Ne, "package.json")) ? Ne : null, Fe = [], Ie = await (async () => {
|
|
3142
3180
|
let t = [];
|
|
3143
|
-
for (let n of
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
if (r) try {
|
|
3147
|
-
t.push(await D.readFile(C(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3148
|
-
} catch {}
|
|
3181
|
+
for (let n of a) {
|
|
3182
|
+
let r = await Lr(e, n.pkg);
|
|
3183
|
+
r && t.push(r);
|
|
3149
3184
|
}
|
|
3150
|
-
|
|
3151
|
-
|
|
3185
|
+
let n = await pr(t);
|
|
3186
|
+
if (n === void 0) return !1;
|
|
3187
|
+
let r = O(V, ".voltro-rpcgroup-optimize"), i = "";
|
|
3152
3188
|
try {
|
|
3153
|
-
i = (await
|
|
3189
|
+
i = (await M.readFile(r, "utf8")).trim();
|
|
3154
3190
|
} catch {}
|
|
3155
3191
|
if (i === n) return !1;
|
|
3156
3192
|
try {
|
|
3157
|
-
await
|
|
3193
|
+
await M.writeFile(r, n);
|
|
3158
3194
|
} catch {}
|
|
3159
3195
|
return !0;
|
|
3160
3196
|
})();
|
|
3161
|
-
|
|
3197
|
+
Ie && Z.info("rpcGroup changed since last boot — forcing a dep re-optimize so the browser loads the current api client");
|
|
3162
3198
|
try {
|
|
3163
|
-
await
|
|
3199
|
+
await Pe(l, "voltro dev (web)");
|
|
3164
3200
|
} catch (e) {
|
|
3165
3201
|
Z.error(String(e.message ?? e)), process.exit(1);
|
|
3166
3202
|
}
|
|
3167
|
-
await (await
|
|
3203
|
+
await (await R.createServer({
|
|
3168
3204
|
root: V,
|
|
3169
3205
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3170
3206
|
ssr: { noExternal: ["react-intl", "@voltro/i18n"] },
|
|
@@ -3176,145 +3212,145 @@ import {
|
|
|
3176
3212
|
"@voltro/i18n"
|
|
3177
3213
|
],
|
|
3178
3214
|
alias: [
|
|
3179
|
-
...
|
|
3215
|
+
...Me ? [{
|
|
3180
3216
|
find: "@voltro/devtools/styles.css",
|
|
3181
|
-
replacement:
|
|
3217
|
+
replacement: O(Me, "src/styles.css")
|
|
3182
3218
|
}, {
|
|
3183
3219
|
find: "@voltro/devtools",
|
|
3184
|
-
replacement:
|
|
3220
|
+
replacement: O(Me, "src/index.ts")
|
|
3185
3221
|
}] : [],
|
|
3186
3222
|
...Y ? [
|
|
3187
3223
|
{
|
|
3188
3224
|
find: "@voltro/ui-shadcn/tokens.css",
|
|
3189
|
-
replacement:
|
|
3225
|
+
replacement: O(Y, "src/tokens.css")
|
|
3190
3226
|
},
|
|
3191
3227
|
{
|
|
3192
3228
|
find: "@voltro/ui-shadcn/cn",
|
|
3193
|
-
replacement:
|
|
3229
|
+
replacement: O(Y, "src/cn.ts")
|
|
3194
3230
|
},
|
|
3195
3231
|
{
|
|
3196
3232
|
find: "@voltro/ui-shadcn/brand",
|
|
3197
|
-
replacement:
|
|
3233
|
+
replacement: O(Y, "src/brand/voltroLogo.tsx")
|
|
3198
3234
|
},
|
|
3199
3235
|
{
|
|
3200
3236
|
find: "@voltro/ui-shadcn",
|
|
3201
|
-
replacement:
|
|
3237
|
+
replacement: O(Y, "src/index.ts")
|
|
3202
3238
|
}
|
|
3203
3239
|
] : [],
|
|
3204
|
-
|
|
3240
|
+
...nt(e)
|
|
3205
3241
|
]
|
|
3206
3242
|
},
|
|
3207
3243
|
optimizeDeps: {
|
|
3208
|
-
include: [...
|
|
3209
|
-
force:
|
|
3244
|
+
include: [...a.map((e) => `${e.pkg}/rpcGroup`), ...Fe],
|
|
3245
|
+
force: Ie
|
|
3210
3246
|
},
|
|
3211
|
-
customLogger:
|
|
3247
|
+
customLogger: et(),
|
|
3212
3248
|
plugins: [
|
|
3213
|
-
|
|
3249
|
+
bn(O(e, "src", "pages")),
|
|
3214
3250
|
z(),
|
|
3215
3251
|
B(),
|
|
3216
|
-
|
|
3217
|
-
|
|
3252
|
+
U,
|
|
3253
|
+
ie,
|
|
3254
|
+
ue,
|
|
3218
3255
|
pe,
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
...xe ? [xe] : []
|
|
3256
|
+
me,
|
|
3257
|
+
_e,
|
|
3258
|
+
Oe,
|
|
3259
|
+
...ve ? [ve] : []
|
|
3224
3260
|
],
|
|
3225
3261
|
server: {
|
|
3226
|
-
port:
|
|
3262
|
+
port: l,
|
|
3227
3263
|
strictPort: !0,
|
|
3228
3264
|
host: !0,
|
|
3229
|
-
allowedHosts:
|
|
3265
|
+
allowedHosts: n.allowedHosts === !0 || [...n.allowedHosts ?? []],
|
|
3230
3266
|
proxy: J,
|
|
3231
|
-
fs: { allow: [e, ...
|
|
3267
|
+
fs: { allow: [e, ...Sr(e)] }
|
|
3232
3268
|
},
|
|
3233
3269
|
appType: "spa",
|
|
3234
|
-
cacheDir:
|
|
3235
|
-
publicDir:
|
|
3236
|
-
})).listen(),
|
|
3237
|
-
version:
|
|
3238
|
-
bootMs: Date.now() -
|
|
3239
|
-
}), Z.info(`listening on http://localhost:${
|
|
3240
|
-
port:
|
|
3241
|
-
app:
|
|
3270
|
+
cacheDir: O(V, ".vite"),
|
|
3271
|
+
publicDir: O(e, "public")
|
|
3272
|
+
})).listen(), mr.info(`v${je} ready in ${Date.now() - Ae}ms`, {
|
|
3273
|
+
version: je,
|
|
3274
|
+
bootMs: Date.now() - Ae
|
|
3275
|
+
}), Z.info(`listening on http://localhost:${l}`, {
|
|
3276
|
+
port: l,
|
|
3277
|
+
app: n.name ?? "(unnamed)"
|
|
3242
3278
|
});
|
|
3243
|
-
for (let e of
|
|
3279
|
+
for (let e of a) e.proxyTarget && (Z.info(`proxy /ws/${e.name} → ${e.proxyTarget}`, {
|
|
3244
3280
|
api: e.name,
|
|
3245
3281
|
target: e.proxyTarget
|
|
3246
3282
|
}), Z.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3247
3283
|
try {
|
|
3248
|
-
await
|
|
3249
|
-
id:
|
|
3250
|
-
name:
|
|
3284
|
+
await x({
|
|
3285
|
+
id: b,
|
|
3286
|
+
name: y,
|
|
3251
3287
|
kind: "web",
|
|
3252
|
-
url: `http://localhost:${
|
|
3288
|
+
url: `http://localhost:${l}`,
|
|
3253
3289
|
pid: process.pid,
|
|
3254
3290
|
status: "live",
|
|
3255
|
-
logFile:
|
|
3291
|
+
logFile: D.path
|
|
3256
3292
|
});
|
|
3257
|
-
let t =
|
|
3293
|
+
let t = wn(e);
|
|
3258
3294
|
if (t) {
|
|
3259
|
-
let e = await
|
|
3295
|
+
let e = await Pn({ dashboardAppPath: t });
|
|
3260
3296
|
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 });
|
|
3261
3297
|
}
|
|
3262
3298
|
setInterval(() => {
|
|
3263
|
-
|
|
3264
|
-
id:
|
|
3265
|
-
name:
|
|
3299
|
+
x({
|
|
3300
|
+
id: b,
|
|
3301
|
+
name: y,
|
|
3266
3302
|
kind: "web",
|
|
3267
|
-
url: `http://localhost:${
|
|
3303
|
+
url: `http://localhost:${l}`,
|
|
3268
3304
|
pid: process.pid,
|
|
3269
3305
|
status: "live",
|
|
3270
|
-
logFile:
|
|
3306
|
+
logFile: D.path
|
|
3271
3307
|
}).catch(() => {});
|
|
3272
3308
|
}, 1e4).unref();
|
|
3273
3309
|
let n = () => {
|
|
3274
|
-
|
|
3310
|
+
C(b), D.dispose();
|
|
3275
3311
|
};
|
|
3276
3312
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3277
3313
|
} catch (e) {
|
|
3278
3314
|
Z.warn("runtime-registry write failed", {}, e);
|
|
3279
3315
|
}
|
|
3280
|
-
return
|
|
3281
|
-
app:
|
|
3316
|
+
return ee({
|
|
3317
|
+
app: n.name ?? "unnamed",
|
|
3282
3318
|
kind: "web",
|
|
3283
|
-
url: `http://localhost:${
|
|
3284
|
-
bootMs: Date.now() -
|
|
3319
|
+
url: `http://localhost:${l}`,
|
|
3320
|
+
bootMs: Date.now() - Ae
|
|
3285
3321
|
}), new Promise(() => {});
|
|
3286
|
-
},
|
|
3322
|
+
}, $r = async (t) => {
|
|
3287
3323
|
e("serve");
|
|
3288
|
-
let
|
|
3289
|
-
if (!
|
|
3324
|
+
let n = await Zr(t);
|
|
3325
|
+
if (!n) return {
|
|
3290
3326
|
ran: !1,
|
|
3291
3327
|
exitCode: 0
|
|
3292
3328
|
};
|
|
3293
3329
|
let i = Date.now(), a = Z.child("serve");
|
|
3294
|
-
a.info("booting voltro serve (preview)", { app:
|
|
3295
|
-
let o = await
|
|
3330
|
+
a.info("booting voltro serve (preview)", { app: n.name ?? "(unnamed)" });
|
|
3331
|
+
let o = await Hr(t, n);
|
|
3296
3332
|
for (let e of o) a.info("api wired", {
|
|
3297
3333
|
name: e.name,
|
|
3298
3334
|
pkg: e.pkg
|
|
3299
3335
|
});
|
|
3300
|
-
await
|
|
3336
|
+
await Jr(t, n, o);
|
|
3301
3337
|
{
|
|
3302
|
-
let { pages: e } = await $(
|
|
3303
|
-
await
|
|
3338
|
+
let { pages: e } = await $(O(t, "src", "pages"));
|
|
3339
|
+
await ht({
|
|
3304
3340
|
appRoot: t,
|
|
3305
3341
|
pages: e
|
|
3306
3342
|
});
|
|
3307
3343
|
}
|
|
3308
|
-
let s =
|
|
3344
|
+
let s = r({
|
|
3309
3345
|
kind: "web",
|
|
3310
|
-
configPort:
|
|
3346
|
+
configPort: n.port,
|
|
3311
3347
|
env: process.env
|
|
3312
|
-
}).port, c = await
|
|
3348
|
+
}).port, c = await he("vite", () => import("vite")), l = (await import("@vitejs/plugin-react")).default, u = O(t, ".framework");
|
|
3313
3349
|
Z.info("running production build"), await c.build({
|
|
3314
3350
|
root: u,
|
|
3315
3351
|
envPrefix: "__VOLTRO_VITE_ENV_DISABLED__",
|
|
3316
3352
|
plugins: [l()],
|
|
3317
|
-
customLogger:
|
|
3353
|
+
customLogger: et(),
|
|
3318
3354
|
resolve: { dedupe: [
|
|
3319
3355
|
"react",
|
|
3320
3356
|
"react-dom",
|
|
@@ -3323,9 +3359,9 @@ import {
|
|
|
3323
3359
|
] },
|
|
3324
3360
|
build: {
|
|
3325
3361
|
outDir: "dist",
|
|
3326
|
-
rollupOptions: { output: { manualChunks:
|
|
3362
|
+
rollupOptions: { output: { manualChunks: wr } }
|
|
3327
3363
|
},
|
|
3328
|
-
publicDir:
|
|
3364
|
+
publicDir: O(t, "public")
|
|
3329
3365
|
});
|
|
3330
3366
|
let d = (await c.preview({
|
|
3331
3367
|
root: u,
|
|
@@ -3336,8 +3372,8 @@ import {
|
|
|
3336
3372
|
label: "Local",
|
|
3337
3373
|
url: e
|
|
3338
3374
|
})) ?? [];
|
|
3339
|
-
return
|
|
3340
|
-
app:
|
|
3375
|
+
return ee({
|
|
3376
|
+
app: n.name ?? "unnamed",
|
|
3341
3377
|
kind: "preview",
|
|
3342
3378
|
url: f,
|
|
3343
3379
|
extras: p,
|
|
@@ -3345,4 +3381,4 @@ import {
|
|
|
3345
3381
|
}), new Promise(() => {});
|
|
3346
3382
|
};
|
|
3347
3383
|
//#endregion
|
|
3348
|
-
export {
|
|
3384
|
+
export { We as $, Hn as A, It as B, nr as C, zn as D, Rn as E, on as F, bt as G, Ct as H, en as I, rt as J, ht as K, Xt as L, Cn as M, Pn as N, Bn as O, wn as P, He as Q, Jt as R, rr as S, In as T, Tt as U, wt as V, xt as W, Ve as X, nt as Y, Ue as Z, $r as _, jr as a, we as at, Jr as b, Or as c, be as ct, Zr as d, Ge as et, Hr as f, Qr as g, Wr as h, qr as i, De as it, Tn as j, Vn as k, Q as l, ye as lt, Br as m, Kr as n, ke as nt, Xr as o, Te as ot, zr as p, at as q, Vr as r, Ee as rt, Ar as s, Se as st, Tr as t, Pe as tt, kr as u, he as ut, wr as v, ar as w, cr as x, $ as y, Vt as z };
|