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

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 = [];
@@ -2516,6 +2520,9 @@ var helpLines = [
2516
2520
  " o Open the first public service",
2517
2521
  " r Restart the workspace",
2518
2522
  " p Pause or resume all services",
2523
+ " \u2191/\u2193 Scroll logs one line",
2524
+ " PgUp/PgDn Scroll logs one page",
2525
+ " Home/End Jump to oldest or latest logs",
2519
2526
  " c Clear the log pane",
2520
2527
  " q Quit",
2521
2528
  " $ Enter shell mode",
@@ -2688,6 +2695,9 @@ var createWorkspaceTui = ({
2688
2695
  let escapeTimer = null;
2689
2696
  let escapeBuffer = "";
2690
2697
  let readyDurationMs = null;
2698
+ let logScrollOffset = 0;
2699
+ let lastLogLineCount = 0;
2700
+ let lastLogViewportHeight = 0;
2691
2701
  const shellHistory = [];
2692
2702
  let shellHistoryIndex = UNFOUND_INDEX;
2693
2703
  const serviceStates = new Map(services.map((service) => [
@@ -2787,7 +2797,16 @@ var createWorkspaceTui = ({
2787
2797
  return `${" ".repeat(prefixPlain.length)}${getLogColor(entry.level)}${line}${colors.reset}`;
2788
2798
  });
2789
2799
  });
2790
- const visibleContent = contentLines.length > logHeight ? contentLines.slice(contentLines.length - logHeight) : contentLines;
2800
+ if (!helpVisible) {
2801
+ lastLogLineCount = contentLines.length;
2802
+ lastLogViewportHeight = logHeight;
2803
+ logScrollOffset = Math.min(logScrollOffset, Math.max(0, contentLines.length - logHeight));
2804
+ }
2805
+ const visibleContent = helpVisible ? contentLines.slice(0, logHeight) : (() => {
2806
+ const end = Math.max(0, contentLines.length - logScrollOffset);
2807
+ const start3 = Math.max(0, end - logHeight);
2808
+ return contentLines.slice(start3, end);
2809
+ })();
2791
2810
  for (const line of visibleContent) {
2792
2811
  rows.push(padLine(line, width));
2793
2812
  }
@@ -2795,7 +2814,8 @@ var createWorkspaceTui = ({
2795
2814
  rows.push(" ".repeat(width));
2796
2815
  }
2797
2816
  rows.push(divider);
2798
- const footerText = helpVisible ? "Esc or h closes help" : "Hotkeys: h help o open r restart p pause c clear logs q quit $ shell";
2817
+ const logState = !helpVisible && logScrollOffset > 0 ? `logs scrolled back ${logScrollOffset} line${logScrollOffset === 1 ? "" : "s"} \xB7 End for latest` : "live logs";
2818
+ const footerText = helpVisible ? "Esc or h closes help" : `Hotkeys: h help \u2191/\u2193 scroll PgUp/PgDn page End latest c clear q quit $ shell \xB7 ${logState}`;
2799
2819
  rows.push(padLine(`${colors.dim}${truncateText(footerText, width)}${colors.reset}`, width));
2800
2820
  const promptLine = shellMode ? `${colors.yellow}$ ${colors.reset}${truncateText(promptBuffer, Math.max(width - 2, 0))}` : `${colors.dim}Press a hotkey or $ for shell mode${colors.reset}`;
2801
2821
  rows.push(padLine(promptLine, width));
@@ -2844,8 +2864,17 @@ var createWorkspaceTui = ({
2844
2864
  };
2845
2865
  const clearLogs = () => {
2846
2866
  logEntries.length = 0;
2867
+ logScrollOffset = 0;
2847
2868
  scheduleRender();
2848
2869
  };
2870
+ const getRecentLogs = (limit = 40) => logEntries.slice(Math.max(0, logEntries.length - limit));
2871
+ const getServiceSnapshot = () => [...serviceStates.values()].map((service) => ({
2872
+ detail: service.detail,
2873
+ name: service.name,
2874
+ status: service.status,
2875
+ target: getTargetLabel(service),
2876
+ visibility: service.visibility
2877
+ }));
2849
2878
  const navigateShellHistory = (direction) => {
2850
2879
  if (!shellMode || shellHistory.length === 0) {
2851
2880
  return;
@@ -2865,6 +2894,27 @@ var createWorkspaceTui = ({
2865
2894
  promptBuffer = shellHistoryIndex === UNFOUND_INDEX ? "" : shellHistory[shellHistory.length - 1 - shellHistoryIndex] ?? "";
2866
2895
  scheduleRender();
2867
2896
  };
2897
+ const scrollLogs = (direction) => {
2898
+ if (helpVisible) {
2899
+ return;
2900
+ }
2901
+ const maxOffset = Math.max(0, lastLogLineCount - lastLogViewportHeight);
2902
+ const pageSize = Math.max(1, lastLogViewportHeight - 1);
2903
+ if (direction === "up") {
2904
+ logScrollOffset = Math.min(maxOffset, logScrollOffset + 1);
2905
+ } else if (direction === "down") {
2906
+ logScrollOffset = Math.max(0, logScrollOffset - 1);
2907
+ } else if (direction === "pageUp") {
2908
+ logScrollOffset = Math.min(maxOffset, logScrollOffset + pageSize);
2909
+ } else if (direction === "pageDown") {
2910
+ logScrollOffset = Math.max(0, logScrollOffset - pageSize);
2911
+ } else if (direction === "home") {
2912
+ logScrollOffset = maxOffset;
2913
+ } else {
2914
+ logScrollOffset = 0;
2915
+ }
2916
+ scheduleRender();
2917
+ };
2868
2918
  const runShortcut = async (action) => {
2869
2919
  if (action === "clear") {
2870
2920
  clearLogs();
@@ -2900,13 +2950,49 @@ var createWorkspaceTui = ({
2900
2950
  if (escapeBuffer === `${ESCAPE}[A`) {
2901
2951
  clearPendingEscape();
2902
2952
  escapeBuffer = "";
2903
- navigateShellHistory("up");
2953
+ if (shellMode) {
2954
+ navigateShellHistory("up");
2955
+ } else {
2956
+ scrollLogs("up");
2957
+ }
2904
2958
  return;
2905
2959
  }
2906
2960
  if (escapeBuffer === `${ESCAPE}[B`) {
2907
2961
  clearPendingEscape();
2908
2962
  escapeBuffer = "";
2909
- navigateShellHistory("down");
2963
+ if (shellMode) {
2964
+ navigateShellHistory("down");
2965
+ } else {
2966
+ scrollLogs("down");
2967
+ }
2968
+ return;
2969
+ }
2970
+ if (escapeBuffer === `${ESCAPE}[5~`) {
2971
+ clearPendingEscape();
2972
+ escapeBuffer = "";
2973
+ scrollLogs("pageUp");
2974
+ return;
2975
+ }
2976
+ if (escapeBuffer === `${ESCAPE}[6~`) {
2977
+ clearPendingEscape();
2978
+ escapeBuffer = "";
2979
+ scrollLogs("pageDown");
2980
+ return;
2981
+ }
2982
+ if (escapeBuffer === `${ESCAPE}[H` || escapeBuffer === `${ESCAPE}[1~`) {
2983
+ clearPendingEscape();
2984
+ escapeBuffer = "";
2985
+ scrollLogs("home");
2986
+ return;
2987
+ }
2988
+ if (escapeBuffer === `${ESCAPE}[F` || escapeBuffer === `${ESCAPE}[4~`) {
2989
+ clearPendingEscape();
2990
+ escapeBuffer = "";
2991
+ scrollLogs("end");
2992
+ return;
2993
+ }
2994
+ if (/^\x1b\[[0-9]*$/.test(escapeBuffer)) {
2995
+ armEscapeTimer();
2910
2996
  return;
2911
2997
  }
2912
2998
  exitEscapeMode();
@@ -3010,6 +3096,8 @@ var createWorkspaceTui = ({
3010
3096
  addLog,
3011
3097
  clearLogs,
3012
3098
  dispose,
3099
+ getRecentLogs,
3100
+ getServiceSnapshot,
3013
3101
  setReadyDuration,
3014
3102
  setServiceStatus,
3015
3103
  start: start2
@@ -3388,6 +3476,33 @@ var workspace = async (subcommand, options) => {
3388
3476
  }
3389
3477
  await Promise.all(snapshot.map((service) => service.process.exited));
3390
3478
  };
3479
+ const printFailureSummary = (exitCode) => {
3480
+ const servicesSnapshot = tui.getServiceSnapshot();
3481
+ const recentLogs = tui.getRecentLogs(60);
3482
+ const failedServices = servicesSnapshot.filter((service) => service.status === "error");
3483
+ const relevantLogs = recentLogs.filter((entry) => entry.level === "error" || entry.level === "warn" || entry.source === "workspace" || failedServices.some((service) => service.name === entry.source));
3484
+ const logsToPrint = (relevantLogs.length > 0 ? relevantLogs : recentLogs).slice(-30);
3485
+ const lines = [
3486
+ "",
3487
+ `\x1B[31mABSOLUTEJS WORKSPACE exited with code ${exitCode}\x1B[0m`,
3488
+ "",
3489
+ "Services:",
3490
+ ...servicesSnapshot.map((service) => {
3491
+ const detail = service.detail ? ` \xB7 ${service.detail}` : "";
3492
+ return ` - ${service.name}: ${service.status} \xB7 ${service.target}${detail}`;
3493
+ })
3494
+ ];
3495
+ if (logsToPrint.length > 0) {
3496
+ lines.push("", "Recent logs:");
3497
+ for (const entry of logsToPrint) {
3498
+ lines.push(` ${entry.timestamp} [${entry.source}] ${entry.message}`);
3499
+ }
3500
+ }
3501
+ lines.push("");
3502
+ process.stderr.write(`${lines.join(`
3503
+ `)}
3504
+ `);
3505
+ };
3391
3506
  const sendSignalToService = (processHandle, signal) => {
3392
3507
  try {
3393
3508
  process.kill(-processHandle.pid, signal);
@@ -3402,7 +3517,11 @@ var workspace = async (subcommand, options) => {
3402
3517
  return;
3403
3518
  }
3404
3519
  shuttingDown = true;
3520
+ const shouldPrintFailureSummary = exitCode !== 0;
3405
3521
  tui.dispose();
3522
+ if (shouldPrintFailureSummary) {
3523
+ printFailureSummary(exitCode);
3524
+ }
3406
3525
  if (paused) {
3407
3526
  for (const service of running) {
3408
3527
  sendSignalToService(service.process, "SIGCONT");
package/dist/index.js CHANGED
@@ -174823,7 +174823,7 @@ ${registrations}
174823
174823
  ({ tsLibDir } = cached);
174824
174824
  cached.lastUsed = Date.now();
174825
174825
  } else {
174826
- const tsPath = __require.resolve("typescript");
174826
+ const tsPath = __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/typescript/lib/typescript.js");
174827
174827
  const tsRootDir = dirname9(tsPath);
174828
174828
  tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve18(tsRootDir, "lib");
174829
174829
  const config = readConfiguration("./tsconfig.json");
@@ -188997,5 +188997,5 @@ export {
188997
188997
  ANGULAR_INIT_TIMEOUT_MS
188998
188998
  };
188999
188999
 
189000
- //# debugId=34F91B1BAA5BDB1464756E2164756E21
189000
+ //# debugId=A7EC3AF25BF78DB864756E2164756E21
189001
189001
  //# sourceMappingURL=index.js.map