@voltro/cli 0.19.0 → 0.20.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 +87 -0
- package/dist/apiBuild-B1FDtx1y.js +2 -0
- package/dist/{apiBuild-CY5pEwwq.js → apiBuild-CSCVI1wC.js} +2 -2
- package/dist/bin.js +2 -2
- package/dist/{commands-BvvoQL0v.js → commands-DQ0mUwDe.js} +1854 -1758
- package/dist/{dev-B6rfgKfo.js → dev-DnHlqqoF.js} +1404 -1395
- package/dist/{dev-C_E1XxNF.js → dev-Z1E_twG9.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-D1DmLeJs.js → inspectMetrics-BL8kZOv3.js} +196 -176
- package/dist/{serveCommand-vPF5ucXC.js → serveCommand-Dh4qd49N.js} +3 -3
- package/dist/serveEntry.js +2 -2
- package/dist/{start-Clvz4IJb.js → start-IVgQe2YD.js} +368 -368
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/database/migrations.md +35 -2
- package/templates/agent-docs/database/misc.md +16 -0
- package/templates/agent-docs/routing.md +13 -0
- package/templates/agent-docs/whats-new.md +43 -109
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-9NXH53Sd.js +0 -2
|
@@ -1230,7 +1230,27 @@ import {
|
|
|
1230
1230
|
hasLoader: typeof e.loader == "function",
|
|
1231
1231
|
hasMeta: e.meta != null,
|
|
1232
1232
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1233
|
-
}), Ln = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Rn = (e) => Ln.exec(e)?.[1] ?? null, zn = /export\s
|
|
1233
|
+
}), Ln = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Rn = (e) => Ln.exec(e)?.[1] ?? null, zn = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, Bn = (e) => {
|
|
1234
|
+
zn.lastIndex = 0;
|
|
1235
|
+
let t;
|
|
1236
|
+
for (; (t = zn.exec(e)) !== null;) {
|
|
1237
|
+
let e = t[2];
|
|
1238
|
+
if (e.startsWith(".")) for (let n of t[1].split(",")) {
|
|
1239
|
+
let t = n.lastIndexOf(" as ");
|
|
1240
|
+
if ((t === -1 ? n : n.slice(t + 4)).trim() === "renderMode") return e;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return null;
|
|
1244
|
+
}, Vn = /export\s*\{([^}]*)\}/g, Hn = (e) => {
|
|
1245
|
+
if (/export\s+default\b/.test(e)) return !0;
|
|
1246
|
+
Vn.lastIndex = 0;
|
|
1247
|
+
let t;
|
|
1248
|
+
for (; (t = Vn.exec(e)) !== null;) for (let e of t[1].split(",")) {
|
|
1249
|
+
let t = e.lastIndexOf(" as ");
|
|
1250
|
+
if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
|
|
1251
|
+
}
|
|
1252
|
+
return !1;
|
|
1253
|
+
}, Un = async (e, t) => {
|
|
1234
1254
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1235
1255
|
let n;
|
|
1236
1256
|
try {
|
|
@@ -1239,17 +1259,17 @@ import {
|
|
|
1239
1259
|
return null;
|
|
1240
1260
|
}
|
|
1241
1261
|
let r = Rn(n);
|
|
1242
|
-
return r !== null && !jn(r) ? Nn(f("src", "pages", t.file), r) :
|
|
1262
|
+
return r !== null && !jn(r) ? Nn(f("src", "pages", t.file), r) : Hn(n) ? null : `${f("src", "pages", t.file)} is a route (a \`page.tsx\` under src/pages/) but exports no default.\n\n A page's default export IS its component — the router has nothing to render without it,\n and the failure would otherwise surface only in \`voltro build\`'s prerender as\n "SSR received a descriptor with no Component", long after the file was written.\n\n Fix: \`export default function Page() { … }\`, or re-export another page's component\n (\`export { default } from '../page'\`). If this file is NOT a route, rename it —\n only the reserved names route, and anything else under src/pages/ is ordinary code\n that may live beside the page that uses it.`;
|
|
1243
1263
|
}))).filter((e) => e !== null);
|
|
1244
1264
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1245
|
-
},
|
|
1265
|
+
}, Wn = f(ie(), ".voltro"), Gn = f(Wn, "runtime-registry.json"), Kn = 3e4, qn = () => {
|
|
1246
1266
|
let e = Math.random().toString(36).slice(2, 10);
|
|
1247
|
-
return `${
|
|
1248
|
-
},
|
|
1249
|
-
await j.mkdir(
|
|
1250
|
-
},
|
|
1267
|
+
return `${Gn}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
1268
|
+
}, Jn = async () => {
|
|
1269
|
+
await j.mkdir(Wn, { recursive: !0 });
|
|
1270
|
+
}, Yn = async () => {
|
|
1251
1271
|
try {
|
|
1252
|
-
let e = await j.readFile(
|
|
1272
|
+
let e = await j.readFile(Gn, "utf8"), t = JSON.parse(e);
|
|
1253
1273
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
1254
1274
|
version: 1,
|
|
1255
1275
|
apps: []
|
|
@@ -1260,34 +1280,34 @@ import {
|
|
|
1260
1280
|
apps: []
|
|
1261
1281
|
};
|
|
1262
1282
|
}
|
|
1263
|
-
},
|
|
1264
|
-
await
|
|
1265
|
-
let t =
|
|
1283
|
+
}, Xn = async (e) => {
|
|
1284
|
+
await Jn();
|
|
1285
|
+
let t = qn();
|
|
1266
1286
|
try {
|
|
1267
1287
|
await j.writeFile(t, JSON.stringify(e, null, 2), {
|
|
1268
1288
|
encoding: "utf8",
|
|
1269
1289
|
mode: 384
|
|
1270
|
-
}), await j.rename(t,
|
|
1290
|
+
}), await j.rename(t, Gn), await j.chmod(Gn, 384).catch(() => {});
|
|
1271
1291
|
} catch (e) {
|
|
1272
1292
|
try {
|
|
1273
1293
|
await j.unlink(t);
|
|
1274
1294
|
} catch {}
|
|
1275
1295
|
throw e;
|
|
1276
1296
|
}
|
|
1277
|
-
},
|
|
1297
|
+
}, Zn = (e) => {
|
|
1278
1298
|
try {
|
|
1279
1299
|
return process.kill(e, 0), !0;
|
|
1280
1300
|
} catch {
|
|
1281
1301
|
return !1;
|
|
1282
1302
|
}
|
|
1283
|
-
},
|
|
1303
|
+
}, Qn = (e) => {
|
|
1284
1304
|
let t = Date.now();
|
|
1285
|
-
return e.filter((e) =>
|
|
1286
|
-
},
|
|
1287
|
-
let e = await
|
|
1305
|
+
return e.filter((e) => Zn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Kn : !1);
|
|
1306
|
+
}, $n = async () => {
|
|
1307
|
+
let e = await Yn(), t = Qn(e.apps);
|
|
1288
1308
|
if (t.length === e.apps.length) return e;
|
|
1289
1309
|
try {
|
|
1290
|
-
await
|
|
1310
|
+
await Xn({
|
|
1291
1311
|
version: 1,
|
|
1292
1312
|
apps: t
|
|
1293
1313
|
});
|
|
@@ -1296,33 +1316,33 @@ import {
|
|
|
1296
1316
|
version: 1,
|
|
1297
1317
|
apps: t
|
|
1298
1318
|
};
|
|
1299
|
-
},
|
|
1300
|
-
let t = await
|
|
1319
|
+
}, er = async (e) => {
|
|
1320
|
+
let t = await Yn(), n = (/* @__PURE__ */ new Date()).toISOString(), r = t.apps.findIndex((t) => t.id === e.id), i = e.inspectToken ?? process.env.VOLTRO_INSPECT_TOKEN, a = {
|
|
1301
1321
|
...e,
|
|
1302
1322
|
...i !== void 0 && i !== "" ? { inspectToken: i } : {},
|
|
1303
1323
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
1304
1324
|
heartbeatAt: n
|
|
1305
1325
|
};
|
|
1306
|
-
await
|
|
1326
|
+
await Xn({
|
|
1307
1327
|
version: 1,
|
|
1308
1328
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
|
|
1309
1329
|
});
|
|
1310
|
-
},
|
|
1330
|
+
}, tr = async (e) => {
|
|
1311
1331
|
try {
|
|
1312
|
-
let t = await
|
|
1332
|
+
let t = await Yn(), n = t.apps.filter((t) => t.id !== e);
|
|
1313
1333
|
if (n.length === t.apps.length) return;
|
|
1314
|
-
await
|
|
1334
|
+
await Xn({
|
|
1315
1335
|
version: 1,
|
|
1316
1336
|
apps: n
|
|
1317
1337
|
});
|
|
1318
1338
|
} catch {}
|
|
1319
|
-
},
|
|
1339
|
+
}, nr = (e, t, n) => `${e}:${t}:${n}`, J = f(ie(), ".voltro", "logs"), rr = () => {
|
|
1320
1340
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1321
1341
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1322
|
-
},
|
|
1323
|
-
if (
|
|
1324
|
-
|
|
1325
|
-
let e = Date.now() -
|
|
1342
|
+
}, ir = !1, ar = () => {
|
|
1343
|
+
if (ir) return;
|
|
1344
|
+
ir = !0;
|
|
1345
|
+
let e = Date.now() - rr(), t = [];
|
|
1326
1346
|
try {
|
|
1327
1347
|
t = N(J);
|
|
1328
1348
|
} catch {
|
|
@@ -1335,8 +1355,8 @@ import {
|
|
|
1335
1355
|
P(t).mtimeMs < e && ee(t);
|
|
1336
1356
|
} catch {}
|
|
1337
1357
|
}
|
|
1338
|
-
},
|
|
1339
|
-
let t =
|
|
1358
|
+
}, or = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), sr = (e, t) => f(J, `${or(e)}-${t}.log`), cr = (e) => {
|
|
1359
|
+
let t = or(e), n = [];
|
|
1340
1360
|
try {
|
|
1341
1361
|
n = N(J);
|
|
1342
1362
|
} catch {
|
|
@@ -1353,12 +1373,12 @@ import {
|
|
|
1353
1373
|
} catch {}
|
|
1354
1374
|
}
|
|
1355
1375
|
return i;
|
|
1356
|
-
},
|
|
1376
|
+
}, lr = (e) => {
|
|
1357
1377
|
try {
|
|
1358
1378
|
k(J, { recursive: !0 });
|
|
1359
1379
|
} catch {}
|
|
1360
|
-
|
|
1361
|
-
let t =
|
|
1380
|
+
ar();
|
|
1381
|
+
let t = sr(e, process.pid), n = A(t, "w"), r = (e) => {
|
|
1362
1382
|
let t = {
|
|
1363
1383
|
ts: e.ts.getTime(),
|
|
1364
1384
|
level: e.level,
|
|
@@ -1399,7 +1419,7 @@ import {
|
|
|
1399
1419
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1400
1420
|
}
|
|
1401
1421
|
};
|
|
1402
|
-
},
|
|
1422
|
+
}, ur = async (e, t) => {
|
|
1403
1423
|
let n;
|
|
1404
1424
|
try {
|
|
1405
1425
|
n = await j.readFile(e, "utf8");
|
|
@@ -1413,11 +1433,11 @@ import {
|
|
|
1413
1433
|
i.push(t);
|
|
1414
1434
|
} catch {}
|
|
1415
1435
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1416
|
-
},
|
|
1436
|
+
}, dr = T({ scope: "voltro:dashboard" }), fr = re(import.meta.url), pr = 5179, mr = (e) => {
|
|
1417
1437
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1418
1438
|
if (t && O(f(m(t), "app.config.ts"))) return m(t);
|
|
1419
1439
|
try {
|
|
1420
|
-
let e = u(
|
|
1440
|
+
let e = u(fr.resolve("@voltro/dashboard/package.json"));
|
|
1421
1441
|
if (O(f(e, "app.config.ts"))) return e;
|
|
1422
1442
|
} catch {}
|
|
1423
1443
|
let n = f("voltro-devtools", "apps", "dashboard"), r = m(e);
|
|
@@ -1429,7 +1449,7 @@ import {
|
|
|
1429
1449
|
r = t;
|
|
1430
1450
|
}
|
|
1431
1451
|
return null;
|
|
1432
|
-
},
|
|
1452
|
+
}, hr = "VOLTRO_IS_DASHBOARD", gr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1433
1453
|
let i = ye({
|
|
1434
1454
|
port: e,
|
|
1435
1455
|
host: t
|
|
@@ -1437,7 +1457,7 @@ import {
|
|
|
1437
1457
|
a || (a = !0, i.destroy(), r(e));
|
|
1438
1458
|
};
|
|
1439
1459
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1440
|
-
}),
|
|
1460
|
+
}), _r = () => !!(process.env.VOLTRO_DASHBOARD === "off" || process.argv.includes("--disable-dashboard")), vr = () => process.env[hr] === "1", yr = () => process.stdout.isTTY === !0, Y = f(ie(), ".voltro", "dashboard-launch.lock"), br = 1e4, xr = async () => {
|
|
1441
1461
|
try {
|
|
1442
1462
|
await j.mkdir(u(Y), { recursive: !0 });
|
|
1443
1463
|
let e = await j.open(Y, "wx");
|
|
@@ -1445,37 +1465,37 @@ import {
|
|
|
1445
1465
|
} catch {
|
|
1446
1466
|
try {
|
|
1447
1467
|
let e = await j.stat(Y);
|
|
1448
|
-
if (Date.now() - e.mtimeMs >
|
|
1468
|
+
if (Date.now() - e.mtimeMs > br) return await j.unlink(Y).catch(() => void 0), xr();
|
|
1449
1469
|
} catch {}
|
|
1450
1470
|
return !1;
|
|
1451
1471
|
}
|
|
1452
|
-
},
|
|
1472
|
+
}, Sr = async () => {
|
|
1453
1473
|
try {
|
|
1454
1474
|
await j.unlink(Y);
|
|
1455
1475
|
} catch {}
|
|
1456
|
-
},
|
|
1476
|
+
}, Cr = async (e) => {
|
|
1457
1477
|
let t = e.port ?? 5179;
|
|
1458
|
-
if (
|
|
1478
|
+
if (_r()) return {
|
|
1459
1479
|
status: "skipped",
|
|
1460
1480
|
reason: "disabled by flag/env",
|
|
1461
1481
|
port: t
|
|
1462
1482
|
};
|
|
1463
|
-
if (
|
|
1483
|
+
if (vr()) return {
|
|
1464
1484
|
status: "skipped",
|
|
1465
1485
|
reason: "this process IS the dashboard",
|
|
1466
1486
|
port: t
|
|
1467
1487
|
};
|
|
1468
|
-
if (!
|
|
1488
|
+
if (!yr()) return {
|
|
1469
1489
|
status: "skipped",
|
|
1470
1490
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1471
1491
|
port: t
|
|
1472
1492
|
};
|
|
1473
|
-
if (!await
|
|
1493
|
+
if (!await xr()) return {
|
|
1474
1494
|
status: "skipped",
|
|
1475
1495
|
reason: "another voltro process is currently launching the dashboard",
|
|
1476
1496
|
port: t
|
|
1477
1497
|
};
|
|
1478
|
-
if (await
|
|
1498
|
+
if (await gr(t)) return await Sr(), {
|
|
1479
1499
|
status: "already-running",
|
|
1480
1500
|
port: t
|
|
1481
1501
|
};
|
|
@@ -1492,7 +1512,7 @@ import {
|
|
|
1492
1512
|
stdio: "ignore",
|
|
1493
1513
|
env: {
|
|
1494
1514
|
...process.env,
|
|
1495
|
-
[
|
|
1515
|
+
[hr]: "1",
|
|
1496
1516
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1497
1517
|
}
|
|
1498
1518
|
});
|
|
@@ -1500,22 +1520,22 @@ import {
|
|
|
1500
1520
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1501
1521
|
a.kill("SIGTERM");
|
|
1502
1522
|
} catch {}
|
|
1503
|
-
}),
|
|
1523
|
+
}), dr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1504
1524
|
port: t,
|
|
1505
1525
|
mode: i,
|
|
1506
1526
|
prebuilt: r
|
|
1507
|
-
}), r ||
|
|
1508
|
-
|
|
1527
|
+
}), r || dr.debug("no pre-built dashboard — running `voltro dev`. Build with `cd voltro-devtools && pnpm build` for a fast prod boot."), dr.debug("disable via --disable-dashboard or VOLTRO_DASHBOARD=off"), setTimeout(() => {
|
|
1528
|
+
Sr();
|
|
1509
1529
|
}, 4e3).unref(), {
|
|
1510
1530
|
status: "launched",
|
|
1511
1531
|
port: t
|
|
1512
1532
|
};
|
|
1513
|
-
},
|
|
1533
|
+
}, wr = class extends Error {
|
|
1514
1534
|
_voltroDeferral = !0;
|
|
1515
1535
|
constructor(e) {
|
|
1516
1536
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1517
1537
|
}
|
|
1518
|
-
},
|
|
1538
|
+
}, Tr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Er = (e) => {
|
|
1519
1539
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1520
1540
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1521
1541
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1530,7 +1550,7 @@ import {
|
|
|
1530
1550
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1531
1551
|
});
|
|
1532
1552
|
} catch (e) {
|
|
1533
|
-
throw new
|
|
1553
|
+
throw new wr(e instanceof Error ? e.message : String(e));
|
|
1534
1554
|
}
|
|
1535
1555
|
return {
|
|
1536
1556
|
loaderData: n.renderData,
|
|
@@ -1546,8 +1566,8 @@ import {
|
|
|
1546
1566
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1547
1567
|
}
|
|
1548
1568
|
};
|
|
1549
|
-
},
|
|
1550
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1569
|
+
}, Dr = (e) => {
|
|
1570
|
+
let { helpers: t, renderInput: n } = e, r = Er({
|
|
1551
1571
|
helpers: t,
|
|
1552
1572
|
page: e.page,
|
|
1553
1573
|
pathname: n.pathname,
|
|
@@ -1568,37 +1588,37 @@ import {
|
|
|
1568
1588
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1569
1589
|
hasDeferred: r.hasDeferred
|
|
1570
1590
|
};
|
|
1571
|
-
},
|
|
1591
|
+
}, Or = (e) => {
|
|
1572
1592
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1573
1593
|
return {
|
|
1574
1594
|
body: t,
|
|
1575
1595
|
meta: n
|
|
1576
1596
|
};
|
|
1577
|
-
},
|
|
1597
|
+
}, kr = (e) => [
|
|
1578
1598
|
...e.extra ?? [],
|
|
1579
1599
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1580
1600
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1581
1601
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1582
1602
|
e.prepared.stateScript
|
|
1583
|
-
].filter((e) => e.length > 0).join("\n "),
|
|
1584
|
-
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(
|
|
1585
|
-
let r =
|
|
1603
|
+
].filter((e) => e.length > 0).join("\n "), Ar = "<div id=\"root\"></div>", jr = "<div id=\"root\">", Mr = "</div>", Nr = /<script\b[^>]*\btype=["']module["'][^>]*><\/script>[ \t]*\n?/gi, Pr = /\bsrc=["']([^"']+)["']/i, Fr = /<script(?![^>]*\basync\b)([^>]*\btype=["']module["'][^>]*)>/gi, Ir = (e) => {
|
|
1604
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Nr, (e) => {
|
|
1605
|
+
let r = Pr.exec(e)?.[1];
|
|
1586
1606
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1587
1607
|
});
|
|
1588
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1589
|
-
let i = r.indexOf(
|
|
1590
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1608
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Fr, "<script async$1>"));
|
|
1609
|
+
let i = r.indexOf(Ar);
|
|
1610
|
+
if (i === -1) throw Error(`[voltro] the generated shell has no \`${Ar}\` 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.`);
|
|
1591
1611
|
return {
|
|
1592
|
-
head: `${r.slice(0, i)}${
|
|
1593
|
-
tail: `${
|
|
1612
|
+
head: `${r.slice(0, i)}${jr}`,
|
|
1613
|
+
tail: `${Mr}${r.slice(i + 21)}`,
|
|
1594
1614
|
bootstrapModules: n
|
|
1595
1615
|
};
|
|
1596
|
-
},
|
|
1616
|
+
}, Lr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Rr = (e) => {
|
|
1597
1617
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1598
1618
|
if (s || !o || a === null) return;
|
|
1599
1619
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1600
1620
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1601
|
-
t.flushHeaders?.(), t.write(
|
|
1621
|
+
t.flushHeaders?.(), t.write(Lr({
|
|
1602
1622
|
head: n.head,
|
|
1603
1623
|
headInjection: i(a.meta),
|
|
1604
1624
|
htmlLang: r
|
|
@@ -1628,14 +1648,14 @@ import {
|
|
|
1628
1648
|
return;
|
|
1629
1649
|
}
|
|
1630
1650
|
c();
|
|
1631
|
-
}, X = T({ scope: "voltro:dev:web" }),
|
|
1651
|
+
}, X = T({ scope: "voltro:dev:web" }), zr = T({ scope: "vite" }), Br = await (async () => {
|
|
1632
1652
|
try {
|
|
1633
1653
|
let e = f(u(h(import.meta.url)), "..", "package.json"), t = await j.readFile(e, "utf8");
|
|
1634
1654
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1635
1655
|
} catch {
|
|
1636
1656
|
return "0.0.0";
|
|
1637
1657
|
}
|
|
1638
|
-
})(),
|
|
1658
|
+
})(), Vr = async () => {
|
|
1639
1659
|
try {
|
|
1640
1660
|
let e = u(h(import.meta.url)), t = m(e, "..", "..", "devtools");
|
|
1641
1661
|
if (O(f(t, "package.json"))) return t;
|
|
@@ -1644,7 +1664,7 @@ import {
|
|
|
1644
1664
|
} catch {
|
|
1645
1665
|
return null;
|
|
1646
1666
|
}
|
|
1647
|
-
},
|
|
1667
|
+
}, Hr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1648
1668
|
"",
|
|
1649
1669
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1650
1670
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1654,12 +1674,12 @@ import {
|
|
|
1654
1674
|
" await import('@voltro/devtools/styles.css')",
|
|
1655
1675
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1656
1676
|
"}"
|
|
1657
|
-
],
|
|
1677
|
+
], Ur = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Wr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Gr = (e) => e.sentry ? [
|
|
1658
1678
|
"",
|
|
1659
1679
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1660
1680
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1661
1681
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1662
|
-
] : [],
|
|
1682
|
+
] : [], Kr = (e) => e.env ? ["import './env.public'"] : [], qr = (e) => {
|
|
1663
1683
|
let t = [], n = m(e);
|
|
1664
1684
|
for (;;) {
|
|
1665
1685
|
O(f(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1668,14 +1688,14 @@ import {
|
|
|
1668
1688
|
n = e;
|
|
1669
1689
|
}
|
|
1670
1690
|
return t;
|
|
1671
|
-
},
|
|
1691
|
+
}, Jr = yn, Yr = (e) => {
|
|
1672
1692
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1673
1693
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1674
1694
|
if (t) return `island-${t[1]}`;
|
|
1675
|
-
},
|
|
1676
|
-
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !
|
|
1695
|
+
}, Xr = /export\s+(?:async\s+)?(?:const|function|let|var)\s+loader\b/, Zr = (e) => e.startsWith("(") && e.endsWith(")"), Qr = (e) => e.filter((e) => !Zr(e)), $r = (e) => {
|
|
1696
|
+
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !Zr(e));
|
|
1677
1697
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
1678
|
-
},
|
|
1698
|
+
}, ei = (e) => `${e.replace(t, "").split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Index"}Page`, Z = (e, t) => e === "" ? `Root${t}` : `${e.split("/").filter(Boolean).map((e) => e.replace(/[()]/g, "").replace(/\[\.\.\./g, "_rest_").replace(/[[\]]/g, "_")).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("").replace(/[^A-Za-z0-9_]/g, "_") || "Root"}${t}`, Q = async (n) => {
|
|
1679
1699
|
let r = [], i = [], a = async (n, o) => {
|
|
1680
1700
|
let s = [];
|
|
1681
1701
|
try {
|
|
@@ -1683,17 +1703,17 @@ import {
|
|
|
1683
1703
|
} catch {
|
|
1684
1704
|
return;
|
|
1685
1705
|
}
|
|
1686
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1706
|
+
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !Jr(e.name)).map((e) => e.name).sort(), u = new Set(l), d = o.join("/");
|
|
1687
1707
|
if (l.some((t) => e.has(t))) {
|
|
1688
1708
|
let t = u.has("layout.tsx"), r = !1;
|
|
1689
1709
|
if (t) try {
|
|
1690
1710
|
let e = await j.readFile(f(n, "layout.tsx"), "utf8");
|
|
1691
|
-
r =
|
|
1711
|
+
r = Xr.test(e);
|
|
1692
1712
|
} catch {}
|
|
1693
1713
|
i.push({
|
|
1694
1714
|
dir: d,
|
|
1695
1715
|
chain: o,
|
|
1696
|
-
contributesToUrl: o.length === 0 || !
|
|
1716
|
+
contributesToUrl: o.length === 0 || !Zr(o[o.length - 1]),
|
|
1697
1717
|
hasLayout: t,
|
|
1698
1718
|
hasLayoutLoader: r,
|
|
1699
1719
|
hasError: u.has("error.tsx"),
|
|
@@ -1707,8 +1727,8 @@ import {
|
|
|
1707
1727
|
let n = d ? `${d}/${e}` : e;
|
|
1708
1728
|
r.push({
|
|
1709
1729
|
file: n,
|
|
1710
|
-
pattern:
|
|
1711
|
-
ident:
|
|
1730
|
+
pattern: $r(n),
|
|
1731
|
+
ident: ei(n),
|
|
1712
1732
|
dirChain: o
|
|
1713
1733
|
});
|
|
1714
1734
|
}
|
|
@@ -1727,14 +1747,14 @@ import {
|
|
|
1727
1747
|
dirs: s,
|
|
1728
1748
|
orphanedSpecials: c
|
|
1729
1749
|
};
|
|
1730
|
-
},
|
|
1750
|
+
}, ti = (e, t) => {
|
|
1731
1751
|
let n = [];
|
|
1732
1752
|
for (let r = 0; r <= t.length; r++) {
|
|
1733
1753
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1734
1754
|
a && n.push(a);
|
|
1735
1755
|
}
|
|
1736
1756
|
return n;
|
|
1737
|
-
},
|
|
1757
|
+
}, ni = async (e) => {
|
|
1738
1758
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1739
1759
|
return {
|
|
1740
1760
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1756,10 +1776,10 @@ import {
|
|
|
1756
1776
|
})),
|
|
1757
1777
|
segmentLoaderData: o
|
|
1758
1778
|
};
|
|
1759
|
-
},
|
|
1760
|
-
let t =
|
|
1779
|
+
}, ri = (e) => {
|
|
1780
|
+
let t = Qr(e);
|
|
1761
1781
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1762
|
-
},
|
|
1782
|
+
}, ii = [
|
|
1763
1783
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1764
1784
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1765
1785
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1852,7 +1872,7 @@ import {
|
|
|
1852
1872
|
" _vdtErrorStart('Build error')",
|
|
1853
1873
|
" })",
|
|
1854
1874
|
"}"
|
|
1855
|
-
].join("\n"),
|
|
1875
|
+
].join("\n"), ai = (e) => {
|
|
1856
1876
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1857
1877
|
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, "\\$&"));
|
|
1858
1878
|
let a = i.join("/");
|
|
@@ -1861,8 +1881,8 @@ import {
|
|
|
1861
1881
|
paramNames: t,
|
|
1862
1882
|
priority: n
|
|
1863
1883
|
};
|
|
1864
|
-
},
|
|
1865
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1884
|
+
}, oi = (e) => e.map((e) => {
|
|
1885
|
+
let { regex: t, paramNames: n, priority: r } = ai(e.pattern);
|
|
1866
1886
|
return {
|
|
1867
1887
|
pattern: e.pattern,
|
|
1868
1888
|
file: e.file,
|
|
@@ -1871,7 +1891,7 @@ import {
|
|
|
1871
1891
|
paramNames: n,
|
|
1872
1892
|
priority: r
|
|
1873
1893
|
};
|
|
1874
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1894
|
+
}).slice().sort((e, t) => e.priority - t.priority), si = (e, t) => {
|
|
1875
1895
|
for (let n of t) {
|
|
1876
1896
|
let t = n.regex.exec(e);
|
|
1877
1897
|
if (!t) continue;
|
|
@@ -1883,7 +1903,7 @@ import {
|
|
|
1883
1903
|
};
|
|
1884
1904
|
}
|
|
1885
1905
|
return null;
|
|
1886
|
-
},
|
|
1906
|
+
}, ci = async (e, t) => {
|
|
1887
1907
|
let n = e;
|
|
1888
1908
|
for (;;) {
|
|
1889
1909
|
let e = f(n, "node_modules", t);
|
|
@@ -1897,7 +1917,7 @@ import {
|
|
|
1897
1917
|
if (r === n) return null;
|
|
1898
1918
|
n = r;
|
|
1899
1919
|
}
|
|
1900
|
-
},
|
|
1920
|
+
}, li = async (e) => {
|
|
1901
1921
|
try {
|
|
1902
1922
|
let t = await import(g(f(e, "app.config.ts")).href), n = t.default?.port, r = typeof n == "number" ? n : 4e3, i = t.default?.transport?.wsPath, a = typeof i == "string" && i.startsWith("/") ? i : void 0;
|
|
1903
1923
|
return a ? {
|
|
@@ -1906,7 +1926,7 @@ import {
|
|
|
1906
1926
|
} : { port: r };
|
|
1907
1927
|
} catch {}
|
|
1908
1928
|
return { port: 4e3 };
|
|
1909
|
-
},
|
|
1929
|
+
}, ui = (e, t) => ({
|
|
1910
1930
|
name: e,
|
|
1911
1931
|
pkg: t.package,
|
|
1912
1932
|
browserWsUrl: t.url,
|
|
@@ -1914,7 +1934,7 @@ import {
|
|
|
1914
1934
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1915
1935
|
...t.headers ? { headers: t.headers } : {},
|
|
1916
1936
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1917
|
-
}),
|
|
1937
|
+
}), di = (e, t, n) => {
|
|
1918
1938
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1919
1939
|
return {
|
|
1920
1940
|
name: e,
|
|
@@ -1926,7 +1946,7 @@ import {
|
|
|
1926
1946
|
...t.headers ? { headers: t.headers } : {},
|
|
1927
1947
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1928
1948
|
};
|
|
1929
|
-
},
|
|
1949
|
+
}, fi = (e) => {
|
|
1930
1950
|
let t = /* @__PURE__ */ new Map();
|
|
1931
1951
|
for (let n of e) {
|
|
1932
1952
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1934,43 +1954,43 @@ import {
|
|
|
1934
1954
|
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>.`);
|
|
1935
1955
|
t.set(n.browserWsUrl, n.name);
|
|
1936
1956
|
}
|
|
1937
|
-
},
|
|
1957
|
+
}, pi = async (e, t) => {
|
|
1938
1958
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1939
1959
|
for (let [t, i] of n) {
|
|
1940
1960
|
if (i.url) {
|
|
1941
|
-
r.push(
|
|
1961
|
+
r.push(ui(t, i));
|
|
1942
1962
|
continue;
|
|
1943
1963
|
}
|
|
1944
|
-
let n = await
|
|
1964
|
+
let n = await ci(e, i.package);
|
|
1945
1965
|
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.`);
|
|
1946
|
-
r.push(
|
|
1966
|
+
r.push(di(t, i, await li(n)));
|
|
1947
1967
|
}
|
|
1948
|
-
return
|
|
1949
|
-
},
|
|
1968
|
+
return fi(r), r;
|
|
1969
|
+
}, mi = (e) => {
|
|
1950
1970
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1951
1971
|
let t = new URL(e);
|
|
1952
1972
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1953
1973
|
} catch {
|
|
1954
1974
|
return;
|
|
1955
1975
|
}
|
|
1956
|
-
},
|
|
1976
|
+
}, hi = (e) => `VOLTRO_API_ORIGIN_${e.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, gi = (e) => process.env[hi(e)] ?? process.env.VOLTRO_API_ORIGIN, _i = (e, t) => {
|
|
1957
1977
|
if (!e) return;
|
|
1958
|
-
let n =
|
|
1978
|
+
let n = gi(e.name) ?? e.serverOrigin;
|
|
1959
1979
|
if (n) {
|
|
1960
|
-
let e =
|
|
1980
|
+
let e = mi(n);
|
|
1961
1981
|
if (e) return e;
|
|
1962
1982
|
}
|
|
1963
1983
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1964
|
-
let t =
|
|
1984
|
+
let t = mi(e.proxyTarget);
|
|
1965
1985
|
if (t) return t;
|
|
1966
1986
|
}
|
|
1967
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1968
|
-
},
|
|
1987
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return mi(e.browserWsUrl);
|
|
1988
|
+
}, vi = (e, t, n) => {
|
|
1969
1989
|
if (!e) {
|
|
1970
1990
|
if (n?.apiName === void 0) return;
|
|
1971
1991
|
let e = n.apiName;
|
|
1972
1992
|
return async () => {
|
|
1973
|
-
throw Error(`[loader.query] api '${e}' has no server-side origin for SSR. In a split web/api deployment the web pod reaches the api by internal DNS, not the browser's relative wsPath — set ${
|
|
1993
|
+
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 ${hi(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.`);
|
|
1974
1994
|
};
|
|
1975
1995
|
}
|
|
1976
1996
|
return async (r, i) => {
|
|
@@ -1992,7 +2012,7 @@ import {
|
|
|
1992
2012
|
});
|
|
1993
2013
|
} catch (t) {
|
|
1994
2014
|
let i = t?.cause?.code ?? String(t?.message ?? t);
|
|
1995
|
-
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${
|
|
2015
|
+
throw Error(`[loader.query] ${r}: could not reach the api at ${e}/rpc (${i}). ${n?.apiName ? `Set ${hi(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 });
|
|
1996
2016
|
}
|
|
1997
2017
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
1998
2018
|
let s = await o.json();
|
|
@@ -2011,7 +2031,7 @@ import {
|
|
|
2011
2031
|
if (u) return l;
|
|
2012
2032
|
};
|
|
2013
2033
|
}, $ = async (e, t, n, r = {}) => {
|
|
2014
|
-
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await
|
|
2034
|
+
let i = t.title ?? t.name ?? "app", a = t.theme === "dark" ? " class=\"dark\"" : t.theme === "light" ? " class=\"light\"" : "", o = O(f(e, "node_modules", "@voltro", "devtools", "package.json")) || await Vr() !== null, s = t.theme === "system" ? [
|
|
2015
2035
|
" <script>",
|
|
2016
2036
|
" (function () {",
|
|
2017
2037
|
" var root = document.documentElement",
|
|
@@ -2050,7 +2070,7 @@ import {
|
|
|
2050
2070
|
"</html>",
|
|
2051
2071
|
""
|
|
2052
2072
|
].join("\n"), l = f(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: p } = await Q(l);
|
|
2053
|
-
await
|
|
2073
|
+
await Un(l, u);
|
|
2054
2074
|
for (let e of p) X.warn(`src/pages/${e.dir || "."}/ contains ${e.files.join(", ")} but no page.tsx at or below it — ${e.files.length > 1 ? "those files are" : "that file is"} inert. A layout/error/loading/not-found file only applies to routes in its own directory tree; if this is an ordinary component, rename it so it does not read as a route boundary.`);
|
|
2055
2075
|
let m = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppGroup`, h = (e) => `${e.replace(/[^a-zA-Z0-9]/g, "_")}AppDescriptors`, g = n.map((e) => `import { appGroup as ${m(e.name)}, appDescriptors as ${h(e.name)} } from '${e.pkg}/rpcGroup'`);
|
|
2056
2076
|
n.some((e) => e.hasAuthHeaders) && (g.push("import __voltroAppConfig from '../app.config'"), g.push("const __voltroAuthHeaders = (__voltroAppConfig as { readonly apis?: Record<string, { readonly authHeaders?: () => Record<string, string> | Promise<Record<string, string>> }> }).apis"));
|
|
@@ -2065,13 +2085,13 @@ import {
|
|
|
2065
2085
|
e.hasLayout && e.hasLayoutLoader ? n.push(`import * as ${Z(e.dir, "Layout")}Mod from '${t}/layout.tsx'`) : e.hasLayout && n.push(`import ${Z(e.dir, "Layout")} from '${t}/layout.tsx'`), e.hasError && n.push(`import ${Z(e.dir, "Error")} from '${t}/error.tsx'`), e.hasPending && n.push(`import ${Z(e.dir, "Pending")} from '${t}/loading.tsx'`), e.hasNotFound && n.push(`import ${Z(e.dir, "NotFound")} from '${t}/not-found.tsx'`);
|
|
2066
2086
|
}
|
|
2067
2087
|
let r = u.map((e) => {
|
|
2068
|
-
let t =
|
|
2088
|
+
let t = ti(d, e.dirChain).map((e) => {
|
|
2069
2089
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2070
2090
|
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(", ")} }`;
|
|
2071
2091
|
}).join(",\n");
|
|
2072
2092
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2073
2093
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2074
|
-
let t =
|
|
2094
|
+
let t = ri(e.chain), n = ti(d, e.chain).map((e) => {
|
|
2075
2095
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2076
2096
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2077
2097
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2310,14 +2330,14 @@ import {
|
|
|
2310
2330
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2311
2331
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2312
2332
|
"",
|
|
2313
|
-
...
|
|
2333
|
+
...Kr(t),
|
|
2314
2334
|
"import { mount } from '@voltro/web'",
|
|
2315
2335
|
...g,
|
|
2316
2336
|
"import { App } from './app'",
|
|
2317
2337
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2318
|
-
...
|
|
2319
|
-
...
|
|
2320
|
-
...
|
|
2338
|
+
...Wr(t),
|
|
2339
|
+
...Hr(t, o),
|
|
2340
|
+
...Gr(t),
|
|
2321
2341
|
"",
|
|
2322
2342
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2323
2343
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2334,10 +2354,10 @@ import {
|
|
|
2334
2354
|
" apis: {",
|
|
2335
2355
|
..._,
|
|
2336
2356
|
" },",
|
|
2337
|
-
...
|
|
2357
|
+
...Ur(t, o),
|
|
2338
2358
|
"})",
|
|
2339
2359
|
"",
|
|
2340
|
-
|
|
2360
|
+
ii
|
|
2341
2361
|
].join("\n");
|
|
2342
2362
|
} else v = "", y = "", b = [
|
|
2343
2363
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2345,22 +2365,22 @@ import {
|
|
|
2345
2365
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2346
2366
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2347
2367
|
"",
|
|
2348
|
-
...
|
|
2368
|
+
...Kr(t),
|
|
2349
2369
|
"import { mount } from '@voltro/web'",
|
|
2350
2370
|
...g,
|
|
2351
2371
|
"import App from '../src/App'",
|
|
2352
|
-
...
|
|
2353
|
-
...
|
|
2354
|
-
...
|
|
2372
|
+
...Wr(t),
|
|
2373
|
+
...Hr(t, o),
|
|
2374
|
+
...Gr(t),
|
|
2355
2375
|
"",
|
|
2356
2376
|
"mount(App, {",
|
|
2357
2377
|
" apis: {",
|
|
2358
2378
|
..._,
|
|
2359
2379
|
" },",
|
|
2360
|
-
...
|
|
2380
|
+
...Ur(t, o),
|
|
2361
2381
|
"})",
|
|
2362
2382
|
"",
|
|
2363
|
-
|
|
2383
|
+
ii
|
|
2364
2384
|
].join("\n");
|
|
2365
2385
|
let x = f(e, ".framework");
|
|
2366
2386
|
await j.mkdir(x, { recursive: !0 }), t.env ? await tt(x, r) : await j.rm(f(x, "env.public.ts"), { force: !0 }), await j.writeFile(f(x, "index.html"), c, "utf8"), await j.writeFile(f(x, "main.tsx"), b, "utf8"), v ? (await j.writeFile(f(x, "app.tsx"), v, "utf8"), await j.writeFile(f(x, "routeTable.ts"), y, "utf8")) : (await j.rm(f(x, "app.tsx"), { force: !0 }), await j.rm(f(x, "routeTable.ts"), { force: !0 }));
|
|
@@ -2377,7 +2397,7 @@ import {
|
|
|
2377
2397
|
X.warn(`could not add ${E.join(", ")} to ${S} — add it by hand so the generated directory stays out of git. The build is unaffected.`, { reason: e?.message ?? String(e) });
|
|
2378
2398
|
}
|
|
2379
2399
|
}
|
|
2380
|
-
},
|
|
2400
|
+
}, yi = async (e, t) => {
|
|
2381
2401
|
try {
|
|
2382
2402
|
let n = f(u(e), "project.json");
|
|
2383
2403
|
if (!O(n)) return;
|
|
@@ -2390,16 +2410,16 @@ import {
|
|
|
2390
2410
|
projectJson: n
|
|
2391
2411
|
});
|
|
2392
2412
|
} catch {}
|
|
2393
|
-
},
|
|
2394
|
-
let t =
|
|
2413
|
+
}, bi = (e) => f(e, ".framework", "dist", "server", "appConfig.js"), xi = async (e) => {
|
|
2414
|
+
let t = bi(e), n = O(t) ? t : f(e, "app.config.ts");
|
|
2395
2415
|
try {
|
|
2396
2416
|
let e = (await import(g(n).href)).default;
|
|
2397
2417
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2398
2418
|
} catch {
|
|
2399
2419
|
return null;
|
|
2400
2420
|
}
|
|
2401
|
-
},
|
|
2402
|
-
let t = await
|
|
2421
|
+
}, Si = async (e) => {
|
|
2422
|
+
let t = await xi(e);
|
|
2403
2423
|
if (!t) return {
|
|
2404
2424
|
ran: !1,
|
|
2405
2425
|
exitCode: 0
|
|
@@ -2407,7 +2427,7 @@ import {
|
|
|
2407
2427
|
gn();
|
|
2408
2428
|
let n = Rt();
|
|
2409
2429
|
Jt(n), X.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2410
|
-
let u = await
|
|
2430
|
+
let u = await pi(e, t);
|
|
2411
2431
|
for (let e of u) X.info("api wired", {
|
|
2412
2432
|
name: e.name,
|
|
2413
2433
|
pkg: e.pkg,
|
|
@@ -2431,8 +2451,8 @@ import {
|
|
|
2431
2451
|
".framework/main.tsx",
|
|
2432
2452
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2433
2453
|
] });
|
|
2434
|
-
let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : t.port ?? 5173, _ = t.name ?? "unnamed", v =
|
|
2435
|
-
await
|
|
2454
|
+
let g = process.env.VOLTRO_IS_DASHBOARD === "1" && process.env.VOLTRO_DASHBOARD_PORT ? Number(process.env.VOLTRO_DASHBOARD_PORT) : t.port ?? 5173, _ = t.name ?? "unnamed", v = nr("web", _, g), y = lr(_);
|
|
2455
|
+
await er({
|
|
2436
2456
|
id: v,
|
|
2437
2457
|
name: _,
|
|
2438
2458
|
kind: "web",
|
|
@@ -2440,7 +2460,7 @@ import {
|
|
|
2440
2460
|
pid: process.pid,
|
|
2441
2461
|
status: "booting",
|
|
2442
2462
|
logFile: y.path
|
|
2443
|
-
}).catch(() => {}), await
|
|
2463
|
+
}).catch(() => {}), await yi(e, g);
|
|
2444
2464
|
let { pages: b, dirs: x } = await Q(f(e, "src", "pages")), S = x.map((e) => ({
|
|
2445
2465
|
dir: e.dir,
|
|
2446
2466
|
hasLayout: e.hasLayout,
|
|
@@ -2476,7 +2496,7 @@ import {
|
|
|
2476
2496
|
...r.devDependencies
|
|
2477
2497
|
});
|
|
2478
2498
|
await Promise.all(i.map(async (n) => {
|
|
2479
|
-
let r = await
|
|
2499
|
+
let r = await ci(e, n);
|
|
2480
2500
|
if (!r) return;
|
|
2481
2501
|
let i = f(r, "src");
|
|
2482
2502
|
try {
|
|
@@ -2582,7 +2602,7 @@ import {
|
|
|
2582
2602
|
}
|
|
2583
2603
|
try {
|
|
2584
2604
|
let n = Date.now();
|
|
2585
|
-
await $(e, r, await
|
|
2605
|
+
await $(e, r, await pi(e, r)), re = r, t.ws && t.ws.send({
|
|
2586
2606
|
type: "full-reload",
|
|
2587
2607
|
path: "*"
|
|
2588
2608
|
}), X.info("app.config.ts soft-regen", {
|
|
@@ -2622,7 +2642,7 @@ import {
|
|
|
2622
2642
|
let n = /* @__PURE__ */ new Map();
|
|
2623
2643
|
for (let r of u) {
|
|
2624
2644
|
if (!r.proxyTarget) continue;
|
|
2625
|
-
let i = await
|
|
2645
|
+
let i = await ci(e, r.pkg);
|
|
2626
2646
|
if (!i) continue;
|
|
2627
2647
|
let a = f(i, "rpcGroup.generated.ts");
|
|
2628
2648
|
try {
|
|
@@ -2905,7 +2925,7 @@ import {
|
|
|
2905
2925
|
kind: "web",
|
|
2906
2926
|
meta: {
|
|
2907
2927
|
name: t.name ?? "(unnamed)",
|
|
2908
|
-
voltroVersion:
|
|
2928
|
+
voltroVersion: Br,
|
|
2909
2929
|
port: g,
|
|
2910
2930
|
mode: "dev",
|
|
2911
2931
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -2940,14 +2960,14 @@ import {
|
|
|
2940
2960
|
e.middlewares.use(async (e, t, n) => {
|
|
2941
2961
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
2942
2962
|
try {
|
|
2943
|
-
let e = await
|
|
2963
|
+
let e = await $n();
|
|
2944
2964
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
2945
2965
|
} catch (e) {
|
|
2946
2966
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
2947
2967
|
}
|
|
2948
2968
|
});
|
|
2949
2969
|
}
|
|
2950
|
-
} : null, pe =
|
|
2970
|
+
} : null, pe = oi(b), me = /* @__PURE__ */ new Set(), he = wt(), ge = Et({
|
|
2951
2971
|
limit: he,
|
|
2952
2972
|
onColdStart: (e) => X.debug("ssr cold-compile start", { id: e }),
|
|
2953
2973
|
onColdEnd: (e) => X.debug("ssr cold-compile end", { id: e })
|
|
@@ -2961,7 +2981,7 @@ import {
|
|
|
2961
2981
|
if (r.method !== "GET" && r.method !== "HEAD") return a();
|
|
2962
2982
|
let o = r.url ?? "/", s = o.indexOf("?"), c = (s === -1 ? o : o.slice(0, s)) || "/";
|
|
2963
2983
|
if (c.startsWith("/@") || c.startsWith("/node_modules/") || c.startsWith("/.framework/") || c.startsWith("/_voltro/") || c === "/main.tsx" || c === "/index.html" || c === "/sw.js" || c === "/favicon.ico" || c === "/robots.txt" || /\.[a-z0-9]+$/i.test(c)) return a();
|
|
2964
|
-
let l =
|
|
2984
|
+
let l = si(c, pe);
|
|
2965
2985
|
if (!l) return a();
|
|
2966
2986
|
let d = !me.has(l.route.pattern), p = Date.now();
|
|
2967
2987
|
d && X.info(`ssr compiling ${l.route.pattern}`, {
|
|
@@ -2983,15 +3003,15 @@ import {
|
|
|
2983
3003
|
}
|
|
2984
3004
|
};
|
|
2985
3005
|
try {
|
|
2986
|
-
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ = Fn(s, f("src", "pages", l.route.file)), v =
|
|
3006
|
+
let s = await h("loadPage", async () => await n(f(e, "src", "pages", l.route.file))), _ = Fn(s, f("src", "pages", l.route.file)), v = ti(x, l.route.dirChain), y = _ === "spa" && v.some((e) => e.hasLayout);
|
|
2987
3007
|
if (_ !== "ssr" && _ !== "isr" && !y) return a();
|
|
2988
3008
|
let b = {};
|
|
2989
3009
|
for (let [e, t] of Object.entries(r.headers ?? {})) typeof t == "string" ? b[e] = t : Array.isArray(t) && (b[e] = t.join(", "));
|
|
2990
|
-
let S =
|
|
3010
|
+
let S = vi(_i(u[0], { allowDevProxy: !0 }), b.cookie, { apiName: u[0]?.name }), C = new AbortController(), w = () => C.abort();
|
|
2991
3011
|
i.once("close", w);
|
|
2992
3012
|
let T = null, E = [], D = {};
|
|
2993
3013
|
try {
|
|
2994
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () =>
|
|
3014
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () => ni({
|
|
2995
3015
|
entries: v,
|
|
2996
3016
|
loadLayout: (t) => n(f(e, "src", "pages", t.dir, "layout.tsx")),
|
|
2997
3017
|
loadError: (t) => n(f(e, "src", "pages", t.dir, "error.tsx")),
|
|
@@ -3028,7 +3048,7 @@ import {
|
|
|
3028
3048
|
cookies: O.parseCookieHeader(b.cookie),
|
|
3029
3049
|
headers: b,
|
|
3030
3050
|
url: o
|
|
3031
|
-
}, j = s.interactive ?? "full", M = y ?
|
|
3051
|
+
}, j = s.interactive ?? "full", M = y ? Dr({
|
|
3032
3052
|
helpers: O,
|
|
3033
3053
|
page: `src/pages/${l.route.file}`,
|
|
3034
3054
|
interactive: j,
|
|
@@ -3040,7 +3060,7 @@ import {
|
|
|
3040
3060
|
segmentLoaderData: D,
|
|
3041
3061
|
requestContext: A
|
|
3042
3062
|
}
|
|
3043
|
-
}) : null, N = y ? null :
|
|
3063
|
+
}) : null, N = y ? null : Er({
|
|
3044
3064
|
helpers: O,
|
|
3045
3065
|
page: `src/pages/${l.route.file}`,
|
|
3046
3066
|
pathname: c,
|
|
@@ -3064,16 +3084,16 @@ import {
|
|
|
3064
3084
|
});
|
|
3065
3085
|
let ee = await h("readShell", be), F = await h("transformShell", () => t.transformIndexHtml(o, ee)), te = P.map((e) => `<link rel="stylesheet" href="${e}?direct" />`).join("\n "), I = A.cookies["voltro:locale"] ?? "en", L = Date.now();
|
|
3066
3086
|
if (M) {
|
|
3067
|
-
let e = (e) =>
|
|
3087
|
+
let e = (e) => kr({
|
|
3068
3088
|
helpers: O,
|
|
3069
3089
|
prepared: M,
|
|
3070
3090
|
meta: e,
|
|
3071
3091
|
interactive: j,
|
|
3072
3092
|
extra: [te]
|
|
3073
3093
|
});
|
|
3074
|
-
if (M.hasDeferred)
|
|
3094
|
+
if (M.hasDeferred) Rr({
|
|
3075
3095
|
res: i,
|
|
3076
|
-
shell:
|
|
3096
|
+
shell: Ir({
|
|
3077
3097
|
shell: F,
|
|
3078
3098
|
inlineModuleScriptsAsync: !0
|
|
3079
3099
|
}),
|
|
@@ -3095,7 +3115,7 @@ import {
|
|
|
3095
3115
|
}
|
|
3096
3116
|
});
|
|
3097
3117
|
else {
|
|
3098
|
-
let t =
|
|
3118
|
+
let t = Or({
|
|
3099
3119
|
helpers: O,
|
|
3100
3120
|
prepared: M
|
|
3101
3121
|
}), n = F.replace("<div id=\"root\"></div>", `<div id="root">${t.body}</div>`).replace("</head>", ` ${e(t.meta)}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${I}"`);
|
|
@@ -3116,9 +3136,9 @@ import {
|
|
|
3116
3136
|
segmentLoaderData: N.segmentLoaderData,
|
|
3117
3137
|
requestContext: A
|
|
3118
3138
|
};
|
|
3119
|
-
if (_ === "ssr" && j === "full")
|
|
3139
|
+
if (_ === "ssr" && j === "full") Rr({
|
|
3120
3140
|
res: i,
|
|
3121
|
-
shell:
|
|
3141
|
+
shell: Ir({
|
|
3122
3142
|
shell: F,
|
|
3123
3143
|
inlineModuleScriptsAsync: !0
|
|
3124
3144
|
}),
|
|
@@ -3160,7 +3180,7 @@ import {
|
|
|
3160
3180
|
phases: m
|
|
3161
3181
|
});
|
|
3162
3182
|
} catch (e) {
|
|
3163
|
-
if (
|
|
3183
|
+
if (Tr(e)) {
|
|
3164
3184
|
X.error("ssr-dev render refused", {
|
|
3165
3185
|
pathname: c,
|
|
3166
3186
|
pattern: l.route.pattern
|
|
@@ -3174,11 +3194,11 @@ import {
|
|
|
3174
3194
|
}
|
|
3175
3195
|
});
|
|
3176
3196
|
}
|
|
3177
|
-
}, B = Date.now(), Se = w.version ?? "?", V = await
|
|
3197
|
+
}, B = Date.now(), Se = w.version ?? "?", V = await Vr(), Ce = f(e, "node_modules", "@voltro", "ui-shadcn"), H = O(f(Ce, "package.json")) ? Ce : null, we = [], Te = await (async () => {
|
|
3178
3198
|
let t = [];
|
|
3179
3199
|
for (let n of u) {
|
|
3180
3200
|
if (!n.proxyTarget) continue;
|
|
3181
|
-
let r = await
|
|
3201
|
+
let r = await ci(e, n.pkg);
|
|
3182
3202
|
if (r) try {
|
|
3183
3203
|
t.push(await j.readFile(f(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3184
3204
|
} catch {}
|
|
@@ -3253,12 +3273,12 @@ import {
|
|
|
3253
3273
|
host: !0,
|
|
3254
3274
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3255
3275
|
proxy: z,
|
|
3256
|
-
fs: { allow: [e, ...
|
|
3276
|
+
fs: { allow: [e, ...qr(e)] }
|
|
3257
3277
|
},
|
|
3258
3278
|
appType: "spa",
|
|
3259
3279
|
cacheDir: f(k, ".vite"),
|
|
3260
3280
|
publicDir: f(e, "public")
|
|
3261
|
-
})).listen(),
|
|
3281
|
+
})).listen(), zr.info(`v${Se} ready in ${Date.now() - B}ms`, {
|
|
3262
3282
|
version: Se,
|
|
3263
3283
|
bootMs: Date.now() - B
|
|
3264
3284
|
}), X.info(`listening on http://localhost:${g}`, {
|
|
@@ -3270,7 +3290,7 @@ import {
|
|
|
3270
3290
|
target: e.proxyTarget
|
|
3271
3291
|
}), X.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3272
3292
|
try {
|
|
3273
|
-
await
|
|
3293
|
+
await er({
|
|
3274
3294
|
id: v,
|
|
3275
3295
|
name: _,
|
|
3276
3296
|
kind: "web",
|
|
@@ -3279,13 +3299,13 @@ import {
|
|
|
3279
3299
|
status: "live",
|
|
3280
3300
|
logFile: y.path
|
|
3281
3301
|
});
|
|
3282
|
-
let t =
|
|
3302
|
+
let t = mr(e);
|
|
3283
3303
|
if (t) {
|
|
3284
|
-
let e = await
|
|
3304
|
+
let e = await Cr({ dashboardAppPath: t });
|
|
3285
3305
|
e.status === "launched" ? X.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && X.debug(`dashboard already running on :${e.port}`, { port: e.port });
|
|
3286
3306
|
}
|
|
3287
3307
|
setInterval(() => {
|
|
3288
|
-
|
|
3308
|
+
er({
|
|
3289
3309
|
id: v,
|
|
3290
3310
|
name: _,
|
|
3291
3311
|
kind: "web",
|
|
@@ -3296,7 +3316,7 @@ import {
|
|
|
3296
3316
|
}).catch(() => {});
|
|
3297
3317
|
}, 1e4).unref();
|
|
3298
3318
|
let n = () => {
|
|
3299
|
-
|
|
3319
|
+
tr(v), y.dispose();
|
|
3300
3320
|
};
|
|
3301
3321
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3302
3322
|
} catch (e) {
|
|
@@ -3308,16 +3328,16 @@ import {
|
|
|
3308
3328
|
url: `http://localhost:${g}`,
|
|
3309
3329
|
bootMs: Date.now() - B
|
|
3310
3330
|
}), new Promise(() => {});
|
|
3311
|
-
},
|
|
3331
|
+
}, Ci = async (e) => {
|
|
3312
3332
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3313
|
-
let t = await
|
|
3333
|
+
let t = await xi(e);
|
|
3314
3334
|
if (!t) return {
|
|
3315
3335
|
ran: !1,
|
|
3316
3336
|
exitCode: 0
|
|
3317
3337
|
};
|
|
3318
3338
|
let n = Date.now(), r = X.child("serve");
|
|
3319
3339
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3320
|
-
let i = await
|
|
3340
|
+
let i = await pi(e, t);
|
|
3321
3341
|
for (let e of i) r.info("api wired", {
|
|
3322
3342
|
name: e.name,
|
|
3323
3343
|
pkg: e.pkg
|
|
@@ -3339,7 +3359,7 @@ import {
|
|
|
3339
3359
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3340
3360
|
build: {
|
|
3341
3361
|
outDir: "dist",
|
|
3342
|
-
rollupOptions: { output: { manualChunks:
|
|
3362
|
+
rollupOptions: { output: { manualChunks: Yr } }
|
|
3343
3363
|
},
|
|
3344
3364
|
publicDir: f(e, "public")
|
|
3345
3365
|
});
|
|
@@ -3359,14 +3379,14 @@ import {
|
|
|
3359
3379
|
extras: d,
|
|
3360
3380
|
bootMs: Date.now() - n
|
|
3361
3381
|
}), new Promise(() => {});
|
|
3362
|
-
},
|
|
3382
|
+
}, wi = 5e3, Ti = 6e4, Ei = (e, t) => {
|
|
3363
3383
|
if (e.length === 0) return 0;
|
|
3364
3384
|
if (e.length === 1) return e[0];
|
|
3365
3385
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3366
3386
|
if (r === i) return e[r];
|
|
3367
3387
|
let a = n - r;
|
|
3368
3388
|
return e[r] * (1 - a) + e[i] * a;
|
|
3369
|
-
},
|
|
3389
|
+
}, Di = (e) => {
|
|
3370
3390
|
if (e.length === 0) return {
|
|
3371
3391
|
p50: 0,
|
|
3372
3392
|
p95: 0,
|
|
@@ -3378,15 +3398,15 @@ import {
|
|
|
3378
3398
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3379
3399
|
for (let e of t) n += e;
|
|
3380
3400
|
return {
|
|
3381
|
-
p50:
|
|
3382
|
-
p95:
|
|
3383
|
-
p99:
|
|
3401
|
+
p50: Ei(t, .5),
|
|
3402
|
+
p95: Ei(t, .95),
|
|
3403
|
+
p99: Ei(t, .99),
|
|
3384
3404
|
mean: n / t.length,
|
|
3385
3405
|
min: t[0],
|
|
3386
3406
|
max: t[t.length - 1]
|
|
3387
3407
|
};
|
|
3388
|
-
},
|
|
3389
|
-
let t = e.maxSamples ??
|
|
3408
|
+
}, Oi = (e = {}) => {
|
|
3409
|
+
let t = e.maxSamples ?? wi, n = e.defaultWindowMs ?? Ti, r = [];
|
|
3390
3410
|
return {
|
|
3391
3411
|
record(e) {
|
|
3392
3412
|
R(e), r.push({
|
|
@@ -3415,7 +3435,7 @@ import {
|
|
|
3415
3435
|
tag: e.tag,
|
|
3416
3436
|
count: e.samples.length,
|
|
3417
3437
|
errorCount: n,
|
|
3418
|
-
latencyMs:
|
|
3438
|
+
latencyMs: Di(t)
|
|
3419
3439
|
});
|
|
3420
3440
|
}
|
|
3421
3441
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3428,4 +3448,4 @@ import {
|
|
|
3428
3448
|
};
|
|
3429
3449
|
};
|
|
3430
3450
|
//#endregion
|
|
3431
|
-
export {
|
|
3451
|
+
export { ht as $, tr as A, bn as B, Cr as C, ur as D, lr as E, In as F, Jt as G, cn as H, jn as I, Rt as J, Kt as K, Nn as L, Rn as M, Bn as N, nr as O, An as P, wt as Q, Fn as R, pr as S, cr as T, rn as U, pn as V, tn as W, It as X, Bt as Y, Et as Z, Er as _, Ce as _t, ni as a, ot as at, kr as b, pi as c, at as ct, Yr as d, $e as dt, pt as et, Q as f, Ye as ft, Tr as g, V as gt, Rr as h, Ge as ht, vi as i, lt as it, er as j, $n as k, Si as l, nt as lt, Ir as m, We as mt, Xr as n, st as nt, ti as o, G as ot, $ as p, qe as pt, zt as q, _i as r, ct as rt, xi as s, it as st, Oi as t, ft as tt, Ci as u, et as ut, Dr as v, mr as w, hr as x, Or as y, yn as z };
|