@absolutejs/absolute 0.19.0-beta.677 → 0.19.0-beta.678

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/dist/cli/index.js CHANGED
@@ -1285,8 +1285,12 @@ Found ${errorCount} error${suffix}.`;
1285
1285
  const hasAngular = targets.some((config) => Boolean(config.angularDirectory));
1286
1286
  const hasSvelte = targets.some((config) => Boolean(config.svelteDirectory));
1287
1287
  const hasVue = targets.some((config) => Boolean(config.vueDirectory));
1288
- const svelteDirs = [...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))];
1289
- const angularDirs = [...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))];
1288
+ const svelteDirs = [
1289
+ ...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1290
+ ];
1291
+ const angularDirs = [
1292
+ ...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
1293
+ ];
1290
1294
  const cacheDir = ".absolutejs";
1291
1295
  await mkdir2(cacheDir, { recursive: true });
1292
1296
  const checks = [];
@@ -2846,6 +2850,14 @@ var createWorkspaceTui = ({
2846
2850
  logEntries.length = 0;
2847
2851
  scheduleRender();
2848
2852
  };
2853
+ const getRecentLogs = (limit = 40) => logEntries.slice(Math.max(0, logEntries.length - limit));
2854
+ const getServiceSnapshot = () => [...serviceStates.values()].map((service) => ({
2855
+ detail: service.detail,
2856
+ name: service.name,
2857
+ status: service.status,
2858
+ target: getTargetLabel(service),
2859
+ visibility: service.visibility
2860
+ }));
2849
2861
  const navigateShellHistory = (direction) => {
2850
2862
  if (!shellMode || shellHistory.length === 0) {
2851
2863
  return;
@@ -3010,6 +3022,8 @@ var createWorkspaceTui = ({
3010
3022
  addLog,
3011
3023
  clearLogs,
3012
3024
  dispose,
3025
+ getRecentLogs,
3026
+ getServiceSnapshot,
3013
3027
  setReadyDuration,
3014
3028
  setServiceStatus,
3015
3029
  start: start2
@@ -3388,6 +3402,33 @@ var workspace = async (subcommand, options) => {
3388
3402
  }
3389
3403
  await Promise.all(snapshot.map((service) => service.process.exited));
3390
3404
  };
3405
+ const printFailureSummary = (exitCode) => {
3406
+ const servicesSnapshot = tui.getServiceSnapshot();
3407
+ const recentLogs = tui.getRecentLogs(60);
3408
+ const failedServices = servicesSnapshot.filter((service) => service.status === "error");
3409
+ const relevantLogs = recentLogs.filter((entry) => entry.level === "error" || entry.level === "warn" || entry.source === "workspace" || failedServices.some((service) => service.name === entry.source));
3410
+ const logsToPrint = (relevantLogs.length > 0 ? relevantLogs : recentLogs).slice(-30);
3411
+ const lines = [
3412
+ "",
3413
+ `\x1B[31mABSOLUTEJS WORKSPACE exited with code ${exitCode}\x1B[0m`,
3414
+ "",
3415
+ "Services:",
3416
+ ...servicesSnapshot.map((service) => {
3417
+ const detail = service.detail ? ` \xB7 ${service.detail}` : "";
3418
+ return ` - ${service.name}: ${service.status} \xB7 ${service.target}${detail}`;
3419
+ })
3420
+ ];
3421
+ if (logsToPrint.length > 0) {
3422
+ lines.push("", "Recent logs:");
3423
+ for (const entry of logsToPrint) {
3424
+ lines.push(` ${entry.timestamp} [${entry.source}] ${entry.message}`);
3425
+ }
3426
+ }
3427
+ lines.push("");
3428
+ process.stderr.write(`${lines.join(`
3429
+ `)}
3430
+ `);
3431
+ };
3391
3432
  const sendSignalToService = (processHandle, signal) => {
3392
3433
  try {
3393
3434
  process.kill(-processHandle.pid, signal);
@@ -3402,7 +3443,11 @@ var workspace = async (subcommand, options) => {
3402
3443
  return;
3403
3444
  }
3404
3445
  shuttingDown = true;
3446
+ const shouldPrintFailureSummary = exitCode !== 0;
3405
3447
  tui.dispose();
3448
+ if (shouldPrintFailureSummary) {
3449
+ printFailureSummary(exitCode);
3450
+ }
3406
3451
  if (paused) {
3407
3452
  for (const service of running) {
3408
3453
  sendSignalToService(service.process, "SIGCONT");