@voltro/cli 0.19.0 → 0.20.1
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 +224 -0
- package/dist/apiBuild-C9aHz4Yh.js +2 -0
- package/dist/{apiBuild-CY5pEwwq.js → apiBuild-qZBEu59d.js} +2 -2
- package/dist/bin.js +41 -9
- package/dist/{commands-BvvoQL0v.js → commands-CA7jwejs.js} +1930 -1770
- package/dist/dbCommand-DA_RFj5K.js +2 -0
- package/dist/{dbCommand-DJSxnjPt.js → dbCommand-DFw2UoC-.js} +24 -24
- package/dist/{dev-C_E1XxNF.js → dev-2AvdzDg2.js} +1 -1
- package/dist/{dev-B6rfgKfo.js → dev-OHLsAq4K.js} +1488 -1462
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-D1DmLeJs.js → inspectMetrics-DvPNXmGA.js} +208 -179
- package/dist/{serveCommand-vPF5ucXC.js → serveCommand-BKqTKWTX.js} +341 -341
- package/dist/serveEntry.js +2 -2
- package/dist/{start-Clvz4IJb.js → start-CXQ7WL1W.js} +376 -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/cli.md +33 -0
- package/templates/agent-docs/database/migrations.md +35 -2
- package/templates/agent-docs/database/misc.md +16 -0
- package/templates/agent-docs/database/seedsdialects.md +25 -0
- package/templates/agent-docs/database/transactions.md +15 -0
- package/templates/agent-docs/routing.md +13 -0
- package/templates/agent-docs/whats-new.md +78 -94
- 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
- package/dist/dbCommand-C3R5LrBZ.js +0 -2
|
@@ -623,10 +623,15 @@ __installPublicEnv(publicEnvValues)
|
|
|
623
623
|
if (o) return o;
|
|
624
624
|
let s = t.withPermit(async () => {
|
|
625
625
|
e.onColdStart?.(i);
|
|
626
|
+
let t = performance.now(), n = !0;
|
|
626
627
|
try {
|
|
627
|
-
|
|
628
|
+
let e = await a();
|
|
629
|
+
return n = !1, e;
|
|
628
630
|
} finally {
|
|
629
|
-
e.onColdEnd?.(i
|
|
631
|
+
e.onColdEnd?.(i, {
|
|
632
|
+
durationMs: Math.round(performance.now() - t),
|
|
633
|
+
failed: n
|
|
634
|
+
});
|
|
630
635
|
}
|
|
631
636
|
}).then((e) => (r.add(i), e)).finally(() => {
|
|
632
637
|
n.delete(i);
|
|
@@ -1230,7 +1235,27 @@ import {
|
|
|
1230
1235
|
hasLoader: typeof e.loader == "function",
|
|
1231
1236
|
hasMeta: e.meta != null,
|
|
1232
1237
|
hasGetStaticPaths: typeof e.getStaticPaths == "function"
|
|
1233
|
-
}), Ln = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Rn = (e) => Ln.exec(e)?.[1] ?? null, zn = /export\s
|
|
1238
|
+
}), Ln = /export\s+const\s+renderMode\s*(?::[^=]+)?=\s*['"]([^'"]*)['"]/, Rn = (e) => Ln.exec(e)?.[1] ?? null, zn = /export\s*\{([^}]*)\}\s*from\s*['"]([^'"]+)['"]/g, Bn = (e) => {
|
|
1239
|
+
zn.lastIndex = 0;
|
|
1240
|
+
let t;
|
|
1241
|
+
for (; (t = zn.exec(e)) !== null;) {
|
|
1242
|
+
let e = t[2];
|
|
1243
|
+
if (e.startsWith(".")) for (let n of t[1].split(",")) {
|
|
1244
|
+
let t = n.lastIndexOf(" as ");
|
|
1245
|
+
if ((t === -1 ? n : n.slice(t + 4)).trim() === "renderMode") return e;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
return null;
|
|
1249
|
+
}, Vn = /export\s*\{([^}]*)\}/g, Hn = (e) => {
|
|
1250
|
+
if (/export\s+default\b/.test(e)) return !0;
|
|
1251
|
+
Vn.lastIndex = 0;
|
|
1252
|
+
let t;
|
|
1253
|
+
for (; (t = Vn.exec(e)) !== null;) for (let e of t[1].split(",")) {
|
|
1254
|
+
let t = e.lastIndexOf(" as ");
|
|
1255
|
+
if ((t === -1 ? e : e.slice(t + 4)).trim() === "default") return !0;
|
|
1256
|
+
}
|
|
1257
|
+
return !1;
|
|
1258
|
+
}, Un = async (e, t) => {
|
|
1234
1259
|
let n = (await Promise.all(t.map(async (t) => {
|
|
1235
1260
|
let n;
|
|
1236
1261
|
try {
|
|
@@ -1239,17 +1264,17 @@ import {
|
|
|
1239
1264
|
return null;
|
|
1240
1265
|
}
|
|
1241
1266
|
let r = Rn(n);
|
|
1242
|
-
return r !== null && !jn(r) ? Nn(f("src", "pages", t.file), r) :
|
|
1267
|
+
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
1268
|
}))).filter((e) => e !== null);
|
|
1244
1269
|
if (n.length !== 0) throw Error(n.join("\n\n"));
|
|
1245
|
-
},
|
|
1270
|
+
}, Wn = f(ie(), ".voltro"), Gn = f(Wn, "runtime-registry.json"), Kn = 3e4, qn = () => {
|
|
1246
1271
|
let e = Math.random().toString(36).slice(2, 10);
|
|
1247
|
-
return `${
|
|
1248
|
-
},
|
|
1249
|
-
await j.mkdir(
|
|
1250
|
-
},
|
|
1272
|
+
return `${Gn}.${process.pid}.${Date.now()}.${e}.tmp`;
|
|
1273
|
+
}, Jn = async () => {
|
|
1274
|
+
await j.mkdir(Wn, { recursive: !0 });
|
|
1275
|
+
}, Yn = async () => {
|
|
1251
1276
|
try {
|
|
1252
|
-
let e = await j.readFile(
|
|
1277
|
+
let e = await j.readFile(Gn, "utf8"), t = JSON.parse(e);
|
|
1253
1278
|
return t.version !== 1 || !Array.isArray(t.apps) ? {
|
|
1254
1279
|
version: 1,
|
|
1255
1280
|
apps: []
|
|
@@ -1260,34 +1285,34 @@ import {
|
|
|
1260
1285
|
apps: []
|
|
1261
1286
|
};
|
|
1262
1287
|
}
|
|
1263
|
-
},
|
|
1264
|
-
await
|
|
1265
|
-
let t =
|
|
1288
|
+
}, Xn = async (e) => {
|
|
1289
|
+
await Jn();
|
|
1290
|
+
let t = qn();
|
|
1266
1291
|
try {
|
|
1267
1292
|
await j.writeFile(t, JSON.stringify(e, null, 2), {
|
|
1268
1293
|
encoding: "utf8",
|
|
1269
1294
|
mode: 384
|
|
1270
|
-
}), await j.rename(t,
|
|
1295
|
+
}), await j.rename(t, Gn), await j.chmod(Gn, 384).catch(() => {});
|
|
1271
1296
|
} catch (e) {
|
|
1272
1297
|
try {
|
|
1273
1298
|
await j.unlink(t);
|
|
1274
1299
|
} catch {}
|
|
1275
1300
|
throw e;
|
|
1276
1301
|
}
|
|
1277
|
-
},
|
|
1302
|
+
}, Zn = (e) => {
|
|
1278
1303
|
try {
|
|
1279
1304
|
return process.kill(e, 0), !0;
|
|
1280
1305
|
} catch {
|
|
1281
1306
|
return !1;
|
|
1282
1307
|
}
|
|
1283
|
-
},
|
|
1308
|
+
}, Qn = (e) => {
|
|
1284
1309
|
let t = Date.now();
|
|
1285
|
-
return e.filter((e) =>
|
|
1286
|
-
},
|
|
1287
|
-
let e = await
|
|
1310
|
+
return e.filter((e) => Zn(e.pid) ? t - new Date(e.heartbeatAt).getTime() < Kn : !1);
|
|
1311
|
+
}, $n = async () => {
|
|
1312
|
+
let e = await Yn(), t = Qn(e.apps);
|
|
1288
1313
|
if (t.length === e.apps.length) return e;
|
|
1289
1314
|
try {
|
|
1290
|
-
await
|
|
1315
|
+
await Xn({
|
|
1291
1316
|
version: 1,
|
|
1292
1317
|
apps: t
|
|
1293
1318
|
});
|
|
@@ -1296,33 +1321,33 @@ import {
|
|
|
1296
1321
|
version: 1,
|
|
1297
1322
|
apps: t
|
|
1298
1323
|
};
|
|
1299
|
-
},
|
|
1300
|
-
let t = await
|
|
1324
|
+
}, er = async (e) => {
|
|
1325
|
+
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
1326
|
...e,
|
|
1302
1327
|
...i !== void 0 && i !== "" ? { inspectToken: i } : {},
|
|
1303
1328
|
registeredAt: r >= 0 ? t.apps[r].registeredAt : n,
|
|
1304
1329
|
heartbeatAt: n
|
|
1305
1330
|
};
|
|
1306
|
-
await
|
|
1331
|
+
await Xn({
|
|
1307
1332
|
version: 1,
|
|
1308
1333
|
apps: r >= 0 ? t.apps.map((e, t) => t === r ? a : e) : [...t.apps, a]
|
|
1309
1334
|
});
|
|
1310
|
-
},
|
|
1335
|
+
}, tr = async (e) => {
|
|
1311
1336
|
try {
|
|
1312
|
-
let t = await
|
|
1337
|
+
let t = await Yn(), n = t.apps.filter((t) => t.id !== e);
|
|
1313
1338
|
if (n.length === t.apps.length) return;
|
|
1314
|
-
await
|
|
1339
|
+
await Xn({
|
|
1315
1340
|
version: 1,
|
|
1316
1341
|
apps: n
|
|
1317
1342
|
});
|
|
1318
1343
|
} catch {}
|
|
1319
|
-
},
|
|
1344
|
+
}, nr = (e, t, n) => `${e}:${t}:${n}`, J = f(ie(), ".voltro", "logs"), rr = () => {
|
|
1320
1345
|
let e = Number(process.env.VOLTRO_LOG_FILE_TTL_MS);
|
|
1321
1346
|
return Number.isFinite(e) && e > 0 ? e : 3600 * 1e3;
|
|
1322
|
-
},
|
|
1323
|
-
if (
|
|
1324
|
-
|
|
1325
|
-
let e = Date.now() -
|
|
1347
|
+
}, ir = !1, ar = () => {
|
|
1348
|
+
if (ir) return;
|
|
1349
|
+
ir = !0;
|
|
1350
|
+
let e = Date.now() - rr(), t = [];
|
|
1326
1351
|
try {
|
|
1327
1352
|
t = N(J);
|
|
1328
1353
|
} catch {
|
|
@@ -1335,8 +1360,8 @@ import {
|
|
|
1335
1360
|
P(t).mtimeMs < e && ee(t);
|
|
1336
1361
|
} catch {}
|
|
1337
1362
|
}
|
|
1338
|
-
},
|
|
1339
|
-
let t =
|
|
1363
|
+
}, or = (e) => e.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80), sr = (e, t) => f(J, `${or(e)}-${t}.log`), cr = (e) => {
|
|
1364
|
+
let t = or(e), n = [];
|
|
1340
1365
|
try {
|
|
1341
1366
|
n = N(J);
|
|
1342
1367
|
} catch {
|
|
@@ -1353,12 +1378,12 @@ import {
|
|
|
1353
1378
|
} catch {}
|
|
1354
1379
|
}
|
|
1355
1380
|
return i;
|
|
1356
|
-
},
|
|
1381
|
+
}, lr = (e) => {
|
|
1357
1382
|
try {
|
|
1358
1383
|
k(J, { recursive: !0 });
|
|
1359
1384
|
} catch {}
|
|
1360
|
-
|
|
1361
|
-
let t =
|
|
1385
|
+
ar();
|
|
1386
|
+
let t = sr(e, process.pid), n = A(t, "w"), r = (e) => {
|
|
1362
1387
|
let t = {
|
|
1363
1388
|
ts: e.ts.getTime(),
|
|
1364
1389
|
level: e.level,
|
|
@@ -1399,7 +1424,7 @@ import {
|
|
|
1399
1424
|
a(), o(), process.off("exit", o), process.off("uncaughtException", s), process.off("unhandledRejection", s);
|
|
1400
1425
|
}
|
|
1401
1426
|
};
|
|
1402
|
-
},
|
|
1427
|
+
}, ur = async (e, t) => {
|
|
1403
1428
|
let n;
|
|
1404
1429
|
try {
|
|
1405
1430
|
n = await j.readFile(e, "utf8");
|
|
@@ -1413,11 +1438,11 @@ import {
|
|
|
1413
1438
|
i.push(t);
|
|
1414
1439
|
} catch {}
|
|
1415
1440
|
return t?.max !== void 0 && i.length > t.max ? i.slice(i.length - t.max) : i;
|
|
1416
|
-
},
|
|
1441
|
+
}, dr = T({ scope: "voltro:dashboard" }), fr = re(import.meta.url), pr = 5179, mr = (e) => {
|
|
1417
1442
|
let t = process.env.VOLTRO_DASHBOARD_PATH;
|
|
1418
1443
|
if (t && O(f(m(t), "app.config.ts"))) return m(t);
|
|
1419
1444
|
try {
|
|
1420
|
-
let e = u(
|
|
1445
|
+
let e = u(fr.resolve("@voltro/dashboard/package.json"));
|
|
1421
1446
|
if (O(f(e, "app.config.ts"))) return e;
|
|
1422
1447
|
} catch {}
|
|
1423
1448
|
let n = f("voltro-devtools", "apps", "dashboard"), r = m(e);
|
|
@@ -1429,7 +1454,7 @@ import {
|
|
|
1429
1454
|
r = t;
|
|
1430
1455
|
}
|
|
1431
1456
|
return null;
|
|
1432
|
-
},
|
|
1457
|
+
}, hr = "VOLTRO_IS_DASHBOARD", gr = (e, t = "127.0.0.1", n = 250) => new Promise((r) => {
|
|
1433
1458
|
let i = ye({
|
|
1434
1459
|
port: e,
|
|
1435
1460
|
host: t
|
|
@@ -1437,7 +1462,7 @@ import {
|
|
|
1437
1462
|
a || (a = !0, i.destroy(), r(e));
|
|
1438
1463
|
};
|
|
1439
1464
|
i.once("connect", () => o(!0)), i.once("error", () => o(!1)), setTimeout(() => o(!1), n);
|
|
1440
|
-
}),
|
|
1465
|
+
}), _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
1466
|
try {
|
|
1442
1467
|
await j.mkdir(u(Y), { recursive: !0 });
|
|
1443
1468
|
let e = await j.open(Y, "wx");
|
|
@@ -1445,37 +1470,37 @@ import {
|
|
|
1445
1470
|
} catch {
|
|
1446
1471
|
try {
|
|
1447
1472
|
let e = await j.stat(Y);
|
|
1448
|
-
if (Date.now() - e.mtimeMs >
|
|
1473
|
+
if (Date.now() - e.mtimeMs > br) return await j.unlink(Y).catch(() => void 0), xr();
|
|
1449
1474
|
} catch {}
|
|
1450
1475
|
return !1;
|
|
1451
1476
|
}
|
|
1452
|
-
},
|
|
1477
|
+
}, Sr = async () => {
|
|
1453
1478
|
try {
|
|
1454
1479
|
await j.unlink(Y);
|
|
1455
1480
|
} catch {}
|
|
1456
|
-
},
|
|
1481
|
+
}, Cr = async (e) => {
|
|
1457
1482
|
let t = e.port ?? 5179;
|
|
1458
|
-
if (
|
|
1483
|
+
if (_r()) return {
|
|
1459
1484
|
status: "skipped",
|
|
1460
1485
|
reason: "disabled by flag/env",
|
|
1461
1486
|
port: t
|
|
1462
1487
|
};
|
|
1463
|
-
if (
|
|
1488
|
+
if (vr()) return {
|
|
1464
1489
|
status: "skipped",
|
|
1465
1490
|
reason: "this process IS the dashboard",
|
|
1466
1491
|
port: t
|
|
1467
1492
|
};
|
|
1468
|
-
if (!
|
|
1493
|
+
if (!yr()) return {
|
|
1469
1494
|
status: "skipped",
|
|
1470
1495
|
reason: "stdout is not a TTY (CI/smoke)",
|
|
1471
1496
|
port: t
|
|
1472
1497
|
};
|
|
1473
|
-
if (!await
|
|
1498
|
+
if (!await xr()) return {
|
|
1474
1499
|
status: "skipped",
|
|
1475
1500
|
reason: "another voltro process is currently launching the dashboard",
|
|
1476
1501
|
port: t
|
|
1477
1502
|
};
|
|
1478
|
-
if (await
|
|
1503
|
+
if (await gr(t)) return await Sr(), {
|
|
1479
1504
|
status: "already-running",
|
|
1480
1505
|
port: t
|
|
1481
1506
|
};
|
|
@@ -1492,7 +1517,7 @@ import {
|
|
|
1492
1517
|
stdio: "ignore",
|
|
1493
1518
|
env: {
|
|
1494
1519
|
...process.env,
|
|
1495
|
-
[
|
|
1520
|
+
[hr]: "1",
|
|
1496
1521
|
VOLTRO_DASHBOARD_PORT: String(t)
|
|
1497
1522
|
}
|
|
1498
1523
|
});
|
|
@@ -1500,22 +1525,22 @@ import {
|
|
|
1500
1525
|
if (a.exitCode === null && a.signalCode === null) try {
|
|
1501
1526
|
a.kill("SIGTERM");
|
|
1502
1527
|
} catch {}
|
|
1503
|
-
}),
|
|
1528
|
+
}), dr.info(`auto-launching dashboard at http://localhost:${t}`, {
|
|
1504
1529
|
port: t,
|
|
1505
1530
|
mode: i,
|
|
1506
1531
|
prebuilt: r
|
|
1507
|
-
}), r ||
|
|
1508
|
-
|
|
1532
|
+
}), 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(() => {
|
|
1533
|
+
Sr();
|
|
1509
1534
|
}, 4e3).unref(), {
|
|
1510
1535
|
status: "launched",
|
|
1511
1536
|
port: t
|
|
1512
1537
|
};
|
|
1513
|
-
},
|
|
1538
|
+
}, wr = class extends Error {
|
|
1514
1539
|
_voltroDeferral = !0;
|
|
1515
1540
|
constructor(e) {
|
|
1516
1541
|
super(e), this.name = "DeferralNotSupportedError";
|
|
1517
1542
|
}
|
|
1518
|
-
},
|
|
1543
|
+
}, Tr = (e) => typeof e == "object" && !!e && e._voltroDeferral === !0, Er = (e) => {
|
|
1519
1544
|
let { helpers: t } = e, n = t.prepareDeferredLoaderData(e.loaderData, "page"), r = {}, i = {}, a = {};
|
|
1520
1545
|
for (let [n, o] of Object.entries(e.segmentLoaderData)) {
|
|
1521
1546
|
let e = Number(n), s = t.prepareDeferredLoaderData(o, e);
|
|
@@ -1530,7 +1555,7 @@ import {
|
|
|
1530
1555
|
...e.layoutShell ? { layoutShell: e.layoutShell } : {}
|
|
1531
1556
|
});
|
|
1532
1557
|
} catch (e) {
|
|
1533
|
-
throw new
|
|
1558
|
+
throw new wr(e instanceof Error ? e.message : String(e));
|
|
1534
1559
|
}
|
|
1535
1560
|
return {
|
|
1536
1561
|
loaderData: n.renderData,
|
|
@@ -1546,8 +1571,8 @@ import {
|
|
|
1546
1571
|
...Object.keys(a).length > 0 ? { deferredSegmentIds: a } : {}
|
|
1547
1572
|
}
|
|
1548
1573
|
};
|
|
1549
|
-
},
|
|
1550
|
-
let { helpers: t, renderInput: n } = e, r =
|
|
1574
|
+
}, Dr = (e) => {
|
|
1575
|
+
let { helpers: t, renderInput: n } = e, r = Er({
|
|
1551
1576
|
helpers: t,
|
|
1552
1577
|
page: e.page,
|
|
1553
1578
|
pathname: n.pathname,
|
|
@@ -1568,37 +1593,37 @@ import {
|
|
|
1568
1593
|
stateScript: t.renderRouterStateScript(r.stateInput),
|
|
1569
1594
|
hasDeferred: r.hasDeferred
|
|
1570
1595
|
};
|
|
1571
|
-
},
|
|
1596
|
+
}, Or = (e) => {
|
|
1572
1597
|
let { html: t, meta: n } = e.helpers.renderPageToHtml(e.prepared.renderInput);
|
|
1573
1598
|
return {
|
|
1574
1599
|
body: t,
|
|
1575
1600
|
meta: n
|
|
1576
1601
|
};
|
|
1577
|
-
},
|
|
1602
|
+
}, kr = (e) => [
|
|
1578
1603
|
...e.extra ?? [],
|
|
1579
1604
|
e.helpers.renderMetaToHtml(e.meta),
|
|
1580
1605
|
`<meta name="voltro-interactive" content="${e.interactive}" />`,
|
|
1581
1606
|
...e.prepared.hasDeferred ? [e.helpers.renderDeferredRegistryScript()] : [],
|
|
1582
1607
|
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 =
|
|
1608
|
+
].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) => {
|
|
1609
|
+
let t = e.keepScriptInHead ?? ((e) => e.startsWith("/@")), n = [], r = e.shell.replace(Nr, (e) => {
|
|
1610
|
+
let r = Pr.exec(e)?.[1];
|
|
1586
1611
|
return r === void 0 || t(r) ? e : (n.push(r), "");
|
|
1587
1612
|
});
|
|
1588
|
-
e.inlineModuleScriptsAsync && (r = r.replace(
|
|
1589
|
-
let i = r.indexOf(
|
|
1590
|
-
if (i === -1) throw Error(`[voltro] the generated shell has no \`${
|
|
1613
|
+
e.inlineModuleScriptsAsync && (r = r.replace(Fr, "<script async$1>"));
|
|
1614
|
+
let i = r.indexOf(Ar);
|
|
1615
|
+
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
1616
|
return {
|
|
1592
|
-
head: `${r.slice(0, i)}${
|
|
1593
|
-
tail: `${
|
|
1617
|
+
head: `${r.slice(0, i)}${jr}`,
|
|
1618
|
+
tail: `${Mr}${r.slice(i + 21)}`,
|
|
1594
1619
|
bootstrapModules: n
|
|
1595
1620
|
};
|
|
1596
|
-
},
|
|
1621
|
+
}, Lr = (e) => e.head.replace("</head>", ` ${e.headInjection}\n </head>`).replace(/<html(\s+lang="[^"]*")?/i, `<html lang="${e.htmlLang}"`), Rr = (e) => {
|
|
1597
1622
|
let { res: t, shell: n, htmlLang: r, headInjection: i } = e, a = null, o = !1, s = !1, c = () => {
|
|
1598
1623
|
if (s || !o || a === null) return;
|
|
1599
1624
|
s = !0, t.statusCode = e.statusCode ?? 200;
|
|
1600
1625
|
for (let [n, r] of Object.entries(e.headers ?? {})) t.setHeader(n, r);
|
|
1601
|
-
t.flushHeaders?.(), t.write(
|
|
1626
|
+
t.flushHeaders?.(), t.write(Lr({
|
|
1602
1627
|
head: n.head,
|
|
1603
1628
|
headInjection: i(a.meta),
|
|
1604
1629
|
htmlLang: r
|
|
@@ -1628,14 +1653,14 @@ import {
|
|
|
1628
1653
|
return;
|
|
1629
1654
|
}
|
|
1630
1655
|
c();
|
|
1631
|
-
}, X = T({ scope: "voltro:dev:web" }),
|
|
1656
|
+
}, X = T({ scope: "voltro:dev:web" }), zr = T({ scope: "vite" }), Br = await (async () => {
|
|
1632
1657
|
try {
|
|
1633
1658
|
let e = f(u(h(import.meta.url)), "..", "package.json"), t = await j.readFile(e, "utf8");
|
|
1634
1659
|
return JSON.parse(t).version ?? "0.0.0";
|
|
1635
1660
|
} catch {
|
|
1636
1661
|
return "0.0.0";
|
|
1637
1662
|
}
|
|
1638
|
-
})(),
|
|
1663
|
+
})(), Vr = async () => {
|
|
1639
1664
|
try {
|
|
1640
1665
|
let e = u(h(import.meta.url)), t = m(e, "..", "..", "devtools");
|
|
1641
1666
|
if (O(f(t, "package.json"))) return t;
|
|
@@ -1644,7 +1669,7 @@ import {
|
|
|
1644
1669
|
} catch {
|
|
1645
1670
|
return null;
|
|
1646
1671
|
}
|
|
1647
|
-
},
|
|
1672
|
+
}, Hr = (e, t) => e.disableDevtools || !t ? [] : [
|
|
1648
1673
|
"",
|
|
1649
1674
|
"// Dev-only in-page devtools overlay. The `import.meta.env.DEV` guard is a",
|
|
1650
1675
|
"// compile-time constant, so prod builds strip this whole `if` block — the",
|
|
@@ -1654,12 +1679,12 @@ import {
|
|
|
1654
1679
|
" await import('@voltro/devtools/styles.css')",
|
|
1655
1680
|
" Devtools = (await import('@voltro/devtools')).VoltroDevtools",
|
|
1656
1681
|
"}"
|
|
1657
|
-
],
|
|
1682
|
+
], Ur = (e, t) => e.disableDevtools || !t ? [] : [" ...(Devtools ? { Devtools } : {}),"], Wr = (e) => e.sentry ? ["import { initSentryBrowser } from '@voltro/plugin-sentry/web'"] : [], Gr = (e) => e.sentry ? [
|
|
1658
1683
|
"",
|
|
1659
1684
|
"// Browser-side Sentry (frontend half of the deep integration). Errors +",
|
|
1660
1685
|
"// browser rpc spans flow to Sentry, sharing the server transactions' trace.",
|
|
1661
1686
|
`await initSentryBrowser(${JSON.stringify(e.sentry)})`
|
|
1662
|
-
] : [],
|
|
1687
|
+
] : [], Kr = (e) => e.env ? ["import './env.public'"] : [], qr = (e) => {
|
|
1663
1688
|
let t = [], n = m(e);
|
|
1664
1689
|
for (;;) {
|
|
1665
1690
|
O(f(n, "pnpm-workspace.yaml")) && t.push(n);
|
|
@@ -1668,14 +1693,14 @@ import {
|
|
|
1668
1693
|
n = e;
|
|
1669
1694
|
}
|
|
1670
1695
|
return t;
|
|
1671
|
-
},
|
|
1696
|
+
}, Jr = yn, Yr = (e) => {
|
|
1672
1697
|
if (/\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//.test(e)) return "react";
|
|
1673
1698
|
let t = /\/([^/]+)\.island\.tsx?$/.exec(e);
|
|
1674
1699
|
if (t) return `island-${t[1]}`;
|
|
1675
|
-
},
|
|
1676
|
-
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !
|
|
1700
|
+
}, 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) => {
|
|
1701
|
+
let n = e.replace(t, "").split("/").filter(Boolean).filter((e) => !Zr(e));
|
|
1677
1702
|
return n.length === 0 ? "/" : "/" + n.join("/");
|
|
1678
|
-
},
|
|
1703
|
+
}, 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
1704
|
let r = [], i = [], a = async (n, o) => {
|
|
1680
1705
|
let s = [];
|
|
1681
1706
|
try {
|
|
@@ -1683,17 +1708,17 @@ import {
|
|
|
1683
1708
|
} catch {
|
|
1684
1709
|
return;
|
|
1685
1710
|
}
|
|
1686
|
-
let c = s.filter((e) => e.isDirectory()).map((e) => e.name).sort(), l = s.filter((e) => e.isFile() && e.name.endsWith(".tsx") && !
|
|
1711
|
+
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
1712
|
if (l.some((t) => e.has(t))) {
|
|
1688
1713
|
let t = u.has("layout.tsx"), r = !1;
|
|
1689
1714
|
if (t) try {
|
|
1690
1715
|
let e = await j.readFile(f(n, "layout.tsx"), "utf8");
|
|
1691
|
-
r =
|
|
1716
|
+
r = Xr.test(e);
|
|
1692
1717
|
} catch {}
|
|
1693
1718
|
i.push({
|
|
1694
1719
|
dir: d,
|
|
1695
1720
|
chain: o,
|
|
1696
|
-
contributesToUrl: o.length === 0 || !
|
|
1721
|
+
contributesToUrl: o.length === 0 || !Zr(o[o.length - 1]),
|
|
1697
1722
|
hasLayout: t,
|
|
1698
1723
|
hasLayoutLoader: r,
|
|
1699
1724
|
hasError: u.has("error.tsx"),
|
|
@@ -1707,8 +1732,8 @@ import {
|
|
|
1707
1732
|
let n = d ? `${d}/${e}` : e;
|
|
1708
1733
|
r.push({
|
|
1709
1734
|
file: n,
|
|
1710
|
-
pattern:
|
|
1711
|
-
ident:
|
|
1735
|
+
pattern: $r(n),
|
|
1736
|
+
ident: ei(n),
|
|
1712
1737
|
dirChain: o
|
|
1713
1738
|
});
|
|
1714
1739
|
}
|
|
@@ -1727,14 +1752,14 @@ import {
|
|
|
1727
1752
|
dirs: s,
|
|
1728
1753
|
orphanedSpecials: c
|
|
1729
1754
|
};
|
|
1730
|
-
},
|
|
1755
|
+
}, ti = (e, t) => {
|
|
1731
1756
|
let n = [];
|
|
1732
1757
|
for (let r = 0; r <= t.length; r++) {
|
|
1733
1758
|
let i = t.slice(0, r).join("/"), a = e.find((e) => e.dir === i);
|
|
1734
1759
|
a && n.push(a);
|
|
1735
1760
|
}
|
|
1736
1761
|
return n;
|
|
1737
|
-
},
|
|
1762
|
+
}, ni = async (e) => {
|
|
1738
1763
|
let { entries: t, loadLayout: n, loadError: r, loadPending: i, ctx: a } = e, o = {};
|
|
1739
1764
|
return {
|
|
1740
1765
|
chain: await Promise.all(t.map(async (e, t) => {
|
|
@@ -1756,10 +1781,10 @@ import {
|
|
|
1756
1781
|
})),
|
|
1757
1782
|
segmentLoaderData: o
|
|
1758
1783
|
};
|
|
1759
|
-
},
|
|
1760
|
-
let t =
|
|
1784
|
+
}, ri = (e) => {
|
|
1785
|
+
let t = Qr(e);
|
|
1761
1786
|
return t.length === 0 ? "" : "/" + t.join("/");
|
|
1762
|
-
},
|
|
1787
|
+
}, ii = [
|
|
1763
1788
|
"// Hot-reload bridge: keep SSR-injected <link rel=\"stylesheet\"> tags",
|
|
1764
1789
|
"// in sync with Vite's CSS HMR. Without this, edits to .css files",
|
|
1765
1790
|
"// only update the JS-injected <style> overlay; the underlying <link>",
|
|
@@ -1852,7 +1877,7 @@ import {
|
|
|
1852
1877
|
" _vdtErrorStart('Build error')",
|
|
1853
1878
|
" })",
|
|
1854
1879
|
"}"
|
|
1855
|
-
].join("\n"),
|
|
1880
|
+
].join("\n"), ai = (e) => {
|
|
1856
1881
|
let t = [], n = 0, r = e.split("/").filter(Boolean), i = [];
|
|
1857
1882
|
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
1883
|
let a = i.join("/");
|
|
@@ -1861,8 +1886,8 @@ import {
|
|
|
1861
1886
|
paramNames: t,
|
|
1862
1887
|
priority: n
|
|
1863
1888
|
};
|
|
1864
|
-
},
|
|
1865
|
-
let { regex: t, paramNames: n, priority: r } =
|
|
1889
|
+
}, oi = (e) => e.map((e) => {
|
|
1890
|
+
let { regex: t, paramNames: n, priority: r } = ai(e.pattern);
|
|
1866
1891
|
return {
|
|
1867
1892
|
pattern: e.pattern,
|
|
1868
1893
|
file: e.file,
|
|
@@ -1871,7 +1896,7 @@ import {
|
|
|
1871
1896
|
paramNames: n,
|
|
1872
1897
|
priority: r
|
|
1873
1898
|
};
|
|
1874
|
-
}).slice().sort((e, t) => e.priority - t.priority),
|
|
1899
|
+
}).slice().sort((e, t) => e.priority - t.priority), si = (e, t) => {
|
|
1875
1900
|
for (let n of t) {
|
|
1876
1901
|
let t = n.regex.exec(e);
|
|
1877
1902
|
if (!t) continue;
|
|
@@ -1883,7 +1908,7 @@ import {
|
|
|
1883
1908
|
};
|
|
1884
1909
|
}
|
|
1885
1910
|
return null;
|
|
1886
|
-
},
|
|
1911
|
+
}, ci = async (e, t) => {
|
|
1887
1912
|
let n = e;
|
|
1888
1913
|
for (;;) {
|
|
1889
1914
|
let e = f(n, "node_modules", t);
|
|
@@ -1897,7 +1922,7 @@ import {
|
|
|
1897
1922
|
if (r === n) return null;
|
|
1898
1923
|
n = r;
|
|
1899
1924
|
}
|
|
1900
|
-
},
|
|
1925
|
+
}, li = async (e) => {
|
|
1901
1926
|
try {
|
|
1902
1927
|
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
1928
|
return a ? {
|
|
@@ -1906,7 +1931,7 @@ import {
|
|
|
1906
1931
|
} : { port: r };
|
|
1907
1932
|
} catch {}
|
|
1908
1933
|
return { port: 4e3 };
|
|
1909
|
-
},
|
|
1934
|
+
}, ui = (e, t) => ({
|
|
1910
1935
|
name: e,
|
|
1911
1936
|
pkg: t.package,
|
|
1912
1937
|
browserWsUrl: t.url,
|
|
@@ -1914,7 +1939,7 @@ import {
|
|
|
1914
1939
|
...t.serverUrl ? { serverOrigin: t.serverUrl } : {},
|
|
1915
1940
|
...t.headers ? { headers: t.headers } : {},
|
|
1916
1941
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1917
|
-
}),
|
|
1942
|
+
}), di = (e, t, n) => {
|
|
1918
1943
|
let r = t.transport?.wsPath ?? n.wsPath;
|
|
1919
1944
|
return {
|
|
1920
1945
|
name: e,
|
|
@@ -1926,7 +1951,7 @@ import {
|
|
|
1926
1951
|
...t.headers ? { headers: t.headers } : {},
|
|
1927
1952
|
...t.authHeaders ? { hasAuthHeaders: !0 } : {}
|
|
1928
1953
|
};
|
|
1929
|
-
},
|
|
1954
|
+
}, fi = (e) => {
|
|
1930
1955
|
let t = /* @__PURE__ */ new Map();
|
|
1931
1956
|
for (let n of e) {
|
|
1932
1957
|
if (n.proxyTarget === void 0) continue;
|
|
@@ -1934,43 +1959,43 @@ import {
|
|
|
1934
1959
|
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
1960
|
t.set(n.browserWsUrl, n.name);
|
|
1936
1961
|
}
|
|
1937
|
-
},
|
|
1962
|
+
}, pi = async (e, t) => {
|
|
1938
1963
|
let n = Object.entries(t.apis ?? {}), r = [];
|
|
1939
1964
|
for (let [t, i] of n) {
|
|
1940
1965
|
if (i.url) {
|
|
1941
|
-
r.push(
|
|
1966
|
+
r.push(ui(t, i));
|
|
1942
1967
|
continue;
|
|
1943
1968
|
}
|
|
1944
|
-
let n = await
|
|
1969
|
+
let n = await ci(e, i.package);
|
|
1945
1970
|
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(
|
|
1971
|
+
r.push(di(t, i, await li(n)));
|
|
1947
1972
|
}
|
|
1948
|
-
return
|
|
1949
|
-
},
|
|
1973
|
+
return fi(r), r;
|
|
1974
|
+
}, mi = (e) => {
|
|
1950
1975
|
if (!(!/^wss?:\/\//.test(e) && !/^https?:\/\//.test(e))) try {
|
|
1951
1976
|
let t = new URL(e);
|
|
1952
1977
|
return t.protocol = t.protocol === "wss:" || t.protocol === "https:" ? "https:" : "http:", `${t.protocol}//${t.host}`;
|
|
1953
1978
|
} catch {
|
|
1954
1979
|
return;
|
|
1955
1980
|
}
|
|
1956
|
-
},
|
|
1981
|
+
}, 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
1982
|
if (!e) return;
|
|
1958
|
-
let n =
|
|
1983
|
+
let n = gi(e.name) ?? e.serverOrigin;
|
|
1959
1984
|
if (n) {
|
|
1960
|
-
let e =
|
|
1985
|
+
let e = mi(n);
|
|
1961
1986
|
if (e) return e;
|
|
1962
1987
|
}
|
|
1963
1988
|
if (t?.allowDevProxy && e.proxyTarget) {
|
|
1964
|
-
let t =
|
|
1989
|
+
let t = mi(e.proxyTarget);
|
|
1965
1990
|
if (t) return t;
|
|
1966
1991
|
}
|
|
1967
|
-
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return
|
|
1968
|
-
},
|
|
1992
|
+
if (!e.proxyTarget && /^wss?:\/\//.test(e.browserWsUrl)) return mi(e.browserWsUrl);
|
|
1993
|
+
}, vi = (e, t, n) => {
|
|
1969
1994
|
if (!e) {
|
|
1970
1995
|
if (n?.apiName === void 0) return;
|
|
1971
1996
|
let e = n.apiName;
|
|
1972
1997
|
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 ${
|
|
1998
|
+
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
1999
|
};
|
|
1975
2000
|
}
|
|
1976
2001
|
return async (r, i) => {
|
|
@@ -1992,7 +2017,7 @@ import {
|
|
|
1992
2017
|
});
|
|
1993
2018
|
} catch (t) {
|
|
1994
2019
|
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 ${
|
|
2020
|
+
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
2021
|
}
|
|
1997
2022
|
if (!o.ok) throw Error(`[loader.query] ${r}: HTTP ${o.status} ${await o.text()}`);
|
|
1998
2023
|
let s = await o.json();
|
|
@@ -2011,7 +2036,7 @@ import {
|
|
|
2011
2036
|
if (u) return l;
|
|
2012
2037
|
};
|
|
2013
2038
|
}, $ = 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
|
|
2039
|
+
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
2040
|
" <script>",
|
|
2016
2041
|
" (function () {",
|
|
2017
2042
|
" var root = document.documentElement",
|
|
@@ -2050,7 +2075,7 @@ import {
|
|
|
2050
2075
|
"</html>",
|
|
2051
2076
|
""
|
|
2052
2077
|
].join("\n"), l = f(e, "src", "pages"), { pages: u, dirs: d, orphanedSpecials: p } = await Q(l);
|
|
2053
|
-
await
|
|
2078
|
+
await Un(l, u);
|
|
2054
2079
|
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
2080
|
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
2081
|
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 +2090,13 @@ import {
|
|
|
2065
2090
|
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
2091
|
}
|
|
2067
2092
|
let r = u.map((e) => {
|
|
2068
|
-
let t =
|
|
2093
|
+
let t = ti(d, e.dirChain).map((e) => {
|
|
2069
2094
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2070
2095
|
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
2096
|
}).join(",\n");
|
|
2072
2097
|
return ` makePageRoute(${JSON.stringify(e.pattern)}, ${t.length > 0 ? `[\n${t},\n ]` : "undefined"}),`;
|
|
2073
2098
|
}), i = d.filter((e) => e.hasNotFound).map((e) => {
|
|
2074
|
-
let t =
|
|
2099
|
+
let t = ri(e.chain), n = ti(d, e.chain).map((e) => {
|
|
2075
2100
|
let t = [`id: ${JSON.stringify(e.dir || "/")}`], n = JSON.stringify(e.dir);
|
|
2076
2101
|
return e.hasLayout && t.push(`Layout: refs.layouts[${n}]`), e.hasError && t.push(`Error: refs.errors[${n}]`), ` { ${t.join(", ")} }`;
|
|
2077
2102
|
}).join(",\n"), r = n.length > 0 ? `\n chain: [\n${n},\n ],` : "";
|
|
@@ -2310,14 +2335,14 @@ import {
|
|
|
2310
2335
|
"// resolved apis map. Side-effect only — no local component definitions —",
|
|
2311
2336
|
"// so downstream invalidations (user page edits) terminate at app.tsx.",
|
|
2312
2337
|
"",
|
|
2313
|
-
...
|
|
2338
|
+
...Kr(t),
|
|
2314
2339
|
"import { mount } from '@voltro/web'",
|
|
2315
2340
|
...g,
|
|
2316
2341
|
"import { App } from './app'",
|
|
2317
2342
|
"import { preloadCurrentRoute } from './routeTable'",
|
|
2318
|
-
...
|
|
2319
|
-
...
|
|
2320
|
-
...
|
|
2343
|
+
...Wr(t),
|
|
2344
|
+
...Hr(t, o),
|
|
2345
|
+
...Gr(t),
|
|
2321
2346
|
"",
|
|
2322
2347
|
"// Preload the current route's page chunk BEFORE hydration so the first",
|
|
2323
2348
|
"// client render matches the SSG/SSR-prerendered HTML. Without it, a lazy",
|
|
@@ -2334,10 +2359,10 @@ import {
|
|
|
2334
2359
|
" apis: {",
|
|
2335
2360
|
..._,
|
|
2336
2361
|
" },",
|
|
2337
|
-
...
|
|
2362
|
+
...Ur(t, o),
|
|
2338
2363
|
"})",
|
|
2339
2364
|
"",
|
|
2340
|
-
|
|
2365
|
+
ii
|
|
2341
2366
|
].join("\n");
|
|
2342
2367
|
} else v = "", y = "", b = [
|
|
2343
2368
|
"// GENERATED BY `voltro dev` — do not edit; will be overwritten on next boot.",
|
|
@@ -2345,22 +2370,22 @@ import {
|
|
|
2345
2370
|
"// and calls mount(). Side-effect only, no component definitions, so the",
|
|
2346
2371
|
"// user's component file remains the Fast Refresh boundary.",
|
|
2347
2372
|
"",
|
|
2348
|
-
...
|
|
2373
|
+
...Kr(t),
|
|
2349
2374
|
"import { mount } from '@voltro/web'",
|
|
2350
2375
|
...g,
|
|
2351
2376
|
"import App from '../src/App'",
|
|
2352
|
-
...
|
|
2353
|
-
...
|
|
2354
|
-
...
|
|
2377
|
+
...Wr(t),
|
|
2378
|
+
...Hr(t, o),
|
|
2379
|
+
...Gr(t),
|
|
2355
2380
|
"",
|
|
2356
2381
|
"mount(App, {",
|
|
2357
2382
|
" apis: {",
|
|
2358
2383
|
..._,
|
|
2359
2384
|
" },",
|
|
2360
|
-
...
|
|
2385
|
+
...Ur(t, o),
|
|
2361
2386
|
"})",
|
|
2362
2387
|
"",
|
|
2363
|
-
|
|
2388
|
+
ii
|
|
2364
2389
|
].join("\n");
|
|
2365
2390
|
let x = f(e, ".framework");
|
|
2366
2391
|
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 +2402,7 @@ import {
|
|
|
2377
2402
|
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
2403
|
}
|
|
2379
2404
|
}
|
|
2380
|
-
},
|
|
2405
|
+
}, yi = async (e, t) => {
|
|
2381
2406
|
try {
|
|
2382
2407
|
let n = f(u(e), "project.json");
|
|
2383
2408
|
if (!O(n)) return;
|
|
@@ -2390,16 +2415,16 @@ import {
|
|
|
2390
2415
|
projectJson: n
|
|
2391
2416
|
});
|
|
2392
2417
|
} catch {}
|
|
2393
|
-
},
|
|
2394
|
-
let t =
|
|
2418
|
+
}, bi = (e) => f(e, ".framework", "dist", "server", "appConfig.js"), xi = async (e) => {
|
|
2419
|
+
let t = bi(e), n = O(t) ? t : f(e, "app.config.ts");
|
|
2395
2420
|
try {
|
|
2396
2421
|
let e = (await import(g(n).href)).default;
|
|
2397
2422
|
return typeof e == "object" && e && "type" in e && e.type === "web" ? e : null;
|
|
2398
2423
|
} catch {
|
|
2399
2424
|
return null;
|
|
2400
2425
|
}
|
|
2401
|
-
},
|
|
2402
|
-
let t = await
|
|
2426
|
+
}, Si = async (e) => {
|
|
2427
|
+
let t = await xi(e);
|
|
2403
2428
|
if (!t) return {
|
|
2404
2429
|
ran: !1,
|
|
2405
2430
|
exitCode: 0
|
|
@@ -2407,7 +2432,7 @@ import {
|
|
|
2407
2432
|
gn();
|
|
2408
2433
|
let n = Rt();
|
|
2409
2434
|
Jt(n), X.info("booting voltro dev (web)", { app: t.name ?? "(unnamed)" });
|
|
2410
|
-
let u = await
|
|
2435
|
+
let u = await pi(e, t);
|
|
2411
2436
|
for (let e of u) X.info("api wired", {
|
|
2412
2437
|
name: e.name,
|
|
2413
2438
|
pkg: e.pkg,
|
|
@@ -2431,8 +2456,8 @@ import {
|
|
|
2431
2456
|
".framework/main.tsx",
|
|
2432
2457
|
...t.env ? [".framework/env.public.ts"] : []
|
|
2433
2458
|
] });
|
|
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
|
|
2459
|
+
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(_);
|
|
2460
|
+
await er({
|
|
2436
2461
|
id: v,
|
|
2437
2462
|
name: _,
|
|
2438
2463
|
kind: "web",
|
|
@@ -2440,7 +2465,7 @@ import {
|
|
|
2440
2465
|
pid: process.pid,
|
|
2441
2466
|
status: "booting",
|
|
2442
2467
|
logFile: y.path
|
|
2443
|
-
}).catch(() => {}), await
|
|
2468
|
+
}).catch(() => {}), await yi(e, g);
|
|
2444
2469
|
let { pages: b, dirs: x } = await Q(f(e, "src", "pages")), S = x.map((e) => ({
|
|
2445
2470
|
dir: e.dir,
|
|
2446
2471
|
hasLayout: e.hasLayout,
|
|
@@ -2476,7 +2501,7 @@ import {
|
|
|
2476
2501
|
...r.devDependencies
|
|
2477
2502
|
});
|
|
2478
2503
|
await Promise.all(i.map(async (n) => {
|
|
2479
|
-
let r = await
|
|
2504
|
+
let r = await ci(e, n);
|
|
2480
2505
|
if (!r) return;
|
|
2481
2506
|
let i = f(r, "src");
|
|
2482
2507
|
try {
|
|
@@ -2582,7 +2607,7 @@ import {
|
|
|
2582
2607
|
}
|
|
2583
2608
|
try {
|
|
2584
2609
|
let n = Date.now();
|
|
2585
|
-
await $(e, r, await
|
|
2610
|
+
await $(e, r, await pi(e, r)), re = r, t.ws && t.ws.send({
|
|
2586
2611
|
type: "full-reload",
|
|
2587
2612
|
path: "*"
|
|
2588
2613
|
}), X.info("app.config.ts soft-regen", {
|
|
@@ -2622,7 +2647,7 @@ import {
|
|
|
2622
2647
|
let n = /* @__PURE__ */ new Map();
|
|
2623
2648
|
for (let r of u) {
|
|
2624
2649
|
if (!r.proxyTarget) continue;
|
|
2625
|
-
let i = await
|
|
2650
|
+
let i = await ci(e, r.pkg);
|
|
2626
2651
|
if (!i) continue;
|
|
2627
2652
|
let a = f(i, "rpcGroup.generated.ts");
|
|
2628
2653
|
try {
|
|
@@ -2905,7 +2930,7 @@ import {
|
|
|
2905
2930
|
kind: "web",
|
|
2906
2931
|
meta: {
|
|
2907
2932
|
name: t.name ?? "(unnamed)",
|
|
2908
|
-
voltroVersion:
|
|
2933
|
+
voltroVersion: Br,
|
|
2909
2934
|
port: g,
|
|
2910
2935
|
mode: "dev",
|
|
2911
2936
|
apis: Object.entries(t.apis ?? {}).map(([e, t]) => {
|
|
@@ -2940,17 +2965,21 @@ import {
|
|
|
2940
2965
|
e.middlewares.use(async (e, t, n) => {
|
|
2941
2966
|
if (!(e.url ?? "").startsWith("/api/dashboard/registry")) return n();
|
|
2942
2967
|
try {
|
|
2943
|
-
let e = await
|
|
2968
|
+
let e = await $n();
|
|
2944
2969
|
t.statusCode = 200, t.setHeader("content-type", "application/json; charset=utf-8"), t.end(JSON.stringify(e));
|
|
2945
2970
|
} catch (e) {
|
|
2946
2971
|
t.statusCode = 500, t.setHeader("content-type", "text/plain"), t.end(`registry read error: ${e.message}`);
|
|
2947
2972
|
}
|
|
2948
2973
|
});
|
|
2949
2974
|
}
|
|
2950
|
-
} : null, pe =
|
|
2975
|
+
} : null, pe = oi(b), me = /* @__PURE__ */ new Set(), he = wt(), ge = Et({
|
|
2951
2976
|
limit: he,
|
|
2952
2977
|
onColdStart: (e) => X.debug("ssr cold-compile start", { id: e }),
|
|
2953
|
-
onColdEnd: (e) => X.debug(
|
|
2978
|
+
onColdEnd: (e, { durationMs: t, failed: n }) => X.debug(`ssr cold-compile ${n ? "FAILED" : "end"} ${t}ms`, {
|
|
2979
|
+
id: e,
|
|
2980
|
+
ms: t,
|
|
2981
|
+
...n ? { failed: !0 } : {}
|
|
2982
|
+
})
|
|
2954
2983
|
});
|
|
2955
2984
|
X.debug(`ssr cold-compile concurrency ${he}`, { concurrency: he });
|
|
2956
2985
|
let ye = null, be = async () => (ye === null && (ye = await j.readFile(f(e, ".framework", "index.html"), "utf8")), ye), xe = {
|
|
@@ -2961,7 +2990,7 @@ import {
|
|
|
2961
2990
|
if (r.method !== "GET" && r.method !== "HEAD") return a();
|
|
2962
2991
|
let o = r.url ?? "/", s = o.indexOf("?"), c = (s === -1 ? o : o.slice(0, s)) || "/";
|
|
2963
2992
|
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 =
|
|
2993
|
+
let l = si(c, pe);
|
|
2965
2994
|
if (!l) return a();
|
|
2966
2995
|
let d = !me.has(l.route.pattern), p = Date.now();
|
|
2967
2996
|
d && X.info(`ssr compiling ${l.route.pattern}`, {
|
|
@@ -2983,15 +3012,15 @@ import {
|
|
|
2983
3012
|
}
|
|
2984
3013
|
};
|
|
2985
3014
|
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 =
|
|
3015
|
+
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
3016
|
if (_ !== "ssr" && _ !== "isr" && !y) return a();
|
|
2988
3017
|
let b = {};
|
|
2989
3018
|
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 =
|
|
3019
|
+
let S = vi(_i(u[0], { allowDevProxy: !0 }), b.cookie, { apiName: u[0]?.name }), C = new AbortController(), w = () => C.abort();
|
|
2991
3020
|
i.once("close", w);
|
|
2992
3021
|
let T = null, E = [], D = {};
|
|
2993
3022
|
try {
|
|
2994
|
-
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () =>
|
|
3023
|
+
(await n("@voltro/web/ssr")).beginStoreSeeds(), {chain: E, segmentLoaderData: D} = await h("loadChain", () => ni({
|
|
2995
3024
|
entries: v,
|
|
2996
3025
|
loadLayout: (t) => n(f(e, "src", "pages", t.dir, "layout.tsx")),
|
|
2997
3026
|
loadError: (t) => n(f(e, "src", "pages", t.dir, "error.tsx")),
|
|
@@ -3028,7 +3057,7 @@ import {
|
|
|
3028
3057
|
cookies: O.parseCookieHeader(b.cookie),
|
|
3029
3058
|
headers: b,
|
|
3030
3059
|
url: o
|
|
3031
|
-
}, j = s.interactive ?? "full", M = y ?
|
|
3060
|
+
}, j = s.interactive ?? "full", M = y ? Dr({
|
|
3032
3061
|
helpers: O,
|
|
3033
3062
|
page: `src/pages/${l.route.file}`,
|
|
3034
3063
|
interactive: j,
|
|
@@ -3040,7 +3069,7 @@ import {
|
|
|
3040
3069
|
segmentLoaderData: D,
|
|
3041
3070
|
requestContext: A
|
|
3042
3071
|
}
|
|
3043
|
-
}) : null, N = y ? null :
|
|
3072
|
+
}) : null, N = y ? null : Er({
|
|
3044
3073
|
helpers: O,
|
|
3045
3074
|
page: `src/pages/${l.route.file}`,
|
|
3046
3075
|
pathname: c,
|
|
@@ -3064,16 +3093,16 @@ import {
|
|
|
3064
3093
|
});
|
|
3065
3094
|
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
3095
|
if (M) {
|
|
3067
|
-
let e = (e) =>
|
|
3096
|
+
let e = (e) => kr({
|
|
3068
3097
|
helpers: O,
|
|
3069
3098
|
prepared: M,
|
|
3070
3099
|
meta: e,
|
|
3071
3100
|
interactive: j,
|
|
3072
3101
|
extra: [te]
|
|
3073
3102
|
});
|
|
3074
|
-
if (M.hasDeferred)
|
|
3103
|
+
if (M.hasDeferred) Rr({
|
|
3075
3104
|
res: i,
|
|
3076
|
-
shell:
|
|
3105
|
+
shell: Ir({
|
|
3077
3106
|
shell: F,
|
|
3078
3107
|
inlineModuleScriptsAsync: !0
|
|
3079
3108
|
}),
|
|
@@ -3095,7 +3124,7 @@ import {
|
|
|
3095
3124
|
}
|
|
3096
3125
|
});
|
|
3097
3126
|
else {
|
|
3098
|
-
let t =
|
|
3127
|
+
let t = Or({
|
|
3099
3128
|
helpers: O,
|
|
3100
3129
|
prepared: M
|
|
3101
3130
|
}), 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 +3145,9 @@ import {
|
|
|
3116
3145
|
segmentLoaderData: N.segmentLoaderData,
|
|
3117
3146
|
requestContext: A
|
|
3118
3147
|
};
|
|
3119
|
-
if (_ === "ssr" && j === "full")
|
|
3148
|
+
if (_ === "ssr" && j === "full") Rr({
|
|
3120
3149
|
res: i,
|
|
3121
|
-
shell:
|
|
3150
|
+
shell: Ir({
|
|
3122
3151
|
shell: F,
|
|
3123
3152
|
inlineModuleScriptsAsync: !0
|
|
3124
3153
|
}),
|
|
@@ -3160,7 +3189,7 @@ import {
|
|
|
3160
3189
|
phases: m
|
|
3161
3190
|
});
|
|
3162
3191
|
} catch (e) {
|
|
3163
|
-
if (
|
|
3192
|
+
if (Tr(e)) {
|
|
3164
3193
|
X.error("ssr-dev render refused", {
|
|
3165
3194
|
pathname: c,
|
|
3166
3195
|
pattern: l.route.pattern
|
|
@@ -3174,11 +3203,11 @@ import {
|
|
|
3174
3203
|
}
|
|
3175
3204
|
});
|
|
3176
3205
|
}
|
|
3177
|
-
}, B = Date.now(), Se = w.version ?? "?", V = await
|
|
3206
|
+
}, 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
3207
|
let t = [];
|
|
3179
3208
|
for (let n of u) {
|
|
3180
3209
|
if (!n.proxyTarget) continue;
|
|
3181
|
-
let r = await
|
|
3210
|
+
let r = await ci(e, n.pkg);
|
|
3182
3211
|
if (r) try {
|
|
3183
3212
|
t.push(await j.readFile(f(r, "rpcGroup.generated.ts"), "utf8"));
|
|
3184
3213
|
} catch {}
|
|
@@ -3253,12 +3282,12 @@ import {
|
|
|
3253
3282
|
host: !0,
|
|
3254
3283
|
allowedHosts: t.allowedHosts === !0 || [...t.allowedHosts ?? []],
|
|
3255
3284
|
proxy: z,
|
|
3256
|
-
fs: { allow: [e, ...
|
|
3285
|
+
fs: { allow: [e, ...qr(e)] }
|
|
3257
3286
|
},
|
|
3258
3287
|
appType: "spa",
|
|
3259
3288
|
cacheDir: f(k, ".vite"),
|
|
3260
3289
|
publicDir: f(e, "public")
|
|
3261
|
-
})).listen(),
|
|
3290
|
+
})).listen(), zr.info(`v${Se} ready in ${Date.now() - B}ms`, {
|
|
3262
3291
|
version: Se,
|
|
3263
3292
|
bootMs: Date.now() - B
|
|
3264
3293
|
}), X.info(`listening on http://localhost:${g}`, {
|
|
@@ -3270,7 +3299,7 @@ import {
|
|
|
3270
3299
|
target: e.proxyTarget
|
|
3271
3300
|
}), X.info(`proxy /_voltro/api/${e.name} → ${e.proxyTarget.replace(/^ws/, "http")}/_voltro/inspect`, { api: e.name }));
|
|
3272
3301
|
try {
|
|
3273
|
-
await
|
|
3302
|
+
await er({
|
|
3274
3303
|
id: v,
|
|
3275
3304
|
name: _,
|
|
3276
3305
|
kind: "web",
|
|
@@ -3279,13 +3308,13 @@ import {
|
|
|
3279
3308
|
status: "live",
|
|
3280
3309
|
logFile: y.path
|
|
3281
3310
|
});
|
|
3282
|
-
let t =
|
|
3311
|
+
let t = mr(e);
|
|
3283
3312
|
if (t) {
|
|
3284
|
-
let e = await
|
|
3313
|
+
let e = await Cr({ dashboardAppPath: t });
|
|
3285
3314
|
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
3315
|
}
|
|
3287
3316
|
setInterval(() => {
|
|
3288
|
-
|
|
3317
|
+
er({
|
|
3289
3318
|
id: v,
|
|
3290
3319
|
name: _,
|
|
3291
3320
|
kind: "web",
|
|
@@ -3296,7 +3325,7 @@ import {
|
|
|
3296
3325
|
}).catch(() => {});
|
|
3297
3326
|
}, 1e4).unref();
|
|
3298
3327
|
let n = () => {
|
|
3299
|
-
|
|
3328
|
+
tr(v), y.dispose();
|
|
3300
3329
|
};
|
|
3301
3330
|
process.on("SIGINT", n), process.on("SIGTERM", n);
|
|
3302
3331
|
} catch (e) {
|
|
@@ -3308,16 +3337,16 @@ import {
|
|
|
3308
3337
|
url: `http://localhost:${g}`,
|
|
3309
3338
|
bootMs: Date.now() - B
|
|
3310
3339
|
}), new Promise(() => {});
|
|
3311
|
-
},
|
|
3340
|
+
}, Ci = async (e) => {
|
|
3312
3341
|
process.env.NODE_ENV || (process.env.NODE_ENV = "production");
|
|
3313
|
-
let t = await
|
|
3342
|
+
let t = await xi(e);
|
|
3314
3343
|
if (!t) return {
|
|
3315
3344
|
ran: !1,
|
|
3316
3345
|
exitCode: 0
|
|
3317
3346
|
};
|
|
3318
3347
|
let n = Date.now(), r = X.child("serve");
|
|
3319
3348
|
r.info("booting voltro serve (preview)", { app: t.name ?? "(unnamed)" });
|
|
3320
|
-
let i = await
|
|
3349
|
+
let i = await pi(e, t);
|
|
3321
3350
|
for (let e of i) r.info("api wired", {
|
|
3322
3351
|
name: e.name,
|
|
3323
3352
|
pkg: e.pkg
|
|
@@ -3339,7 +3368,7 @@ import {
|
|
|
3339
3368
|
resolve: { dedupe: ["react", "react-dom"] },
|
|
3340
3369
|
build: {
|
|
3341
3370
|
outDir: "dist",
|
|
3342
|
-
rollupOptions: { output: { manualChunks:
|
|
3371
|
+
rollupOptions: { output: { manualChunks: Yr } }
|
|
3343
3372
|
},
|
|
3344
3373
|
publicDir: f(e, "public")
|
|
3345
3374
|
});
|
|
@@ -3359,14 +3388,14 @@ import {
|
|
|
3359
3388
|
extras: d,
|
|
3360
3389
|
bootMs: Date.now() - n
|
|
3361
3390
|
}), new Promise(() => {});
|
|
3362
|
-
},
|
|
3391
|
+
}, wi = 5e3, Ti = 6e4, Ei = (e, t) => {
|
|
3363
3392
|
if (e.length === 0) return 0;
|
|
3364
3393
|
if (e.length === 1) return e[0];
|
|
3365
3394
|
let n = t * (e.length - 1), r = Math.floor(n), i = Math.ceil(n);
|
|
3366
3395
|
if (r === i) return e[r];
|
|
3367
3396
|
let a = n - r;
|
|
3368
3397
|
return e[r] * (1 - a) + e[i] * a;
|
|
3369
|
-
},
|
|
3398
|
+
}, Di = (e) => {
|
|
3370
3399
|
if (e.length === 0) return {
|
|
3371
3400
|
p50: 0,
|
|
3372
3401
|
p95: 0,
|
|
@@ -3378,15 +3407,15 @@ import {
|
|
|
3378
3407
|
let t = e.slice().sort((e, t) => e - t), n = 0;
|
|
3379
3408
|
for (let e of t) n += e;
|
|
3380
3409
|
return {
|
|
3381
|
-
p50:
|
|
3382
|
-
p95:
|
|
3383
|
-
p99:
|
|
3410
|
+
p50: Ei(t, .5),
|
|
3411
|
+
p95: Ei(t, .95),
|
|
3412
|
+
p99: Ei(t, .99),
|
|
3384
3413
|
mean: n / t.length,
|
|
3385
3414
|
min: t[0],
|
|
3386
3415
|
max: t[t.length - 1]
|
|
3387
3416
|
};
|
|
3388
|
-
},
|
|
3389
|
-
let t = e.maxSamples ??
|
|
3417
|
+
}, Oi = (e = {}) => {
|
|
3418
|
+
let t = e.maxSamples ?? wi, n = e.defaultWindowMs ?? Ti, r = [];
|
|
3390
3419
|
return {
|
|
3391
3420
|
record(e) {
|
|
3392
3421
|
R(e), r.push({
|
|
@@ -3415,7 +3444,7 @@ import {
|
|
|
3415
3444
|
tag: e.tag,
|
|
3416
3445
|
count: e.samples.length,
|
|
3417
3446
|
errorCount: n,
|
|
3418
|
-
latencyMs:
|
|
3447
|
+
latencyMs: Di(t)
|
|
3419
3448
|
});
|
|
3420
3449
|
}
|
|
3421
3450
|
return c.sort((e, t) => t.count - e.count), {
|
|
@@ -3428,4 +3457,4 @@ import {
|
|
|
3428
3457
|
};
|
|
3429
3458
|
};
|
|
3430
3459
|
//#endregion
|
|
3431
|
-
export {
|
|
3460
|
+
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 };
|