@absolutejs/absolute 0.19.0-beta.680 → 0.19.0-beta.682

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
@@ -2577,12 +2577,11 @@ var padLine = (value, width) => {
2577
2577
  }
2578
2578
  return `${value}${" ".repeat(width - plainLength)}`;
2579
2579
  };
2580
- var replaceRightEdge = (value, width, marker) => {
2580
+ var appendRightEdge = (value, width, marker) => {
2581
2581
  if (width <= 0) {
2582
2582
  return "";
2583
2583
  }
2584
- const padded = padLine(truncateText(value, width), width);
2585
- return `${padded.slice(0, Math.max(0, width - 1))}${marker}`;
2584
+ return `${padLine(value, Math.max(0, width - 1))}${marker}`;
2586
2585
  };
2587
2586
  var wrapText = (value, width) => {
2588
2587
  if (width <= 0) {
@@ -2793,10 +2792,11 @@ var createWorkspaceTui = ({
2793
2792
  const footerLines = 3;
2794
2793
  const fixedHeight = rows.length + footerLines;
2795
2794
  const logHeight = Math.max(height - fixedHeight, 3);
2795
+ const logWidth = Math.max(width - 1, 1);
2796
2796
  const contentLines = helpVisible ? helpLines : logEntries.flatMap((entry) => {
2797
2797
  const prefixPlain = `${entry.timestamp} [${entry.source}] `;
2798
2798
  const prefixColor = `${colors.dim}${entry.timestamp}${colors.reset} ${getSourceColor(entry.source)}[${entry.source}]${colors.reset} `;
2799
- const wrapped = wrapText(entry.message, Math.max(width - prefixPlain.length, 12));
2799
+ const wrapped = wrapText(entry.message, Math.max(logWidth - prefixPlain.length, 12));
2800
2800
  return wrapped.map((line, index) => {
2801
2801
  if (index === 0) {
2802
2802
  return `${prefixColor}${getLogColor(entry.level)}${line}${colors.reset}`;
@@ -2828,11 +2828,11 @@ var createWorkspaceTui = ({
2828
2828
  };
2829
2829
  for (let index = 0;index < visibleContent.length; index++) {
2830
2830
  const marker = getScrollbarMarker(index);
2831
- rows.push(marker ? replaceRightEdge(visibleContent[index] ?? "", width, marker) : padLine(visibleContent[index] ?? "", width));
2831
+ rows.push(marker ? appendRightEdge(visibleContent[index] ?? "", width, marker) : padLine(visibleContent[index] ?? "", width));
2832
2832
  }
2833
2833
  for (let index = visibleContent.length;index < logHeight; index++) {
2834
2834
  const marker = getScrollbarMarker(index);
2835
- rows.push(marker ? replaceRightEdge("", width, marker) : " ".repeat(width));
2835
+ rows.push(marker ? appendRightEdge("", width, marker) : " ".repeat(width));
2836
2836
  }
2837
2837
  rows.push(divider);
2838
2838
  const logState = !helpVisible && logScrollOffset > 0 ? `logs scrolled back ${logScrollOffset} line${logScrollOffset === 1 ? "" : "s"} \xB7 End for latest` : "live logs";
@@ -3320,6 +3320,51 @@ var waitForReady = async (service) => {
3320
3320
  }
3321
3321
  throw new Error(resolved.type === "http" ? `service did not become ready within ${resolved.timeoutMs}ms (${resolved.url})` : resolved.type === "tcp" ? `service did not become ready within ${resolved.timeoutMs}ms (tcp://${resolved.host}:${resolved.port})` : `service did not become ready within ${resolved.timeoutMs}ms (${resolved.command.join(" ")})`);
3322
3322
  };
3323
+ var resolveShutdownHook = (shutdown) => {
3324
+ if (!shutdown) {
3325
+ return null;
3326
+ }
3327
+ if (Array.isArray(shutdown)) {
3328
+ return {
3329
+ command: shutdown,
3330
+ timeoutMs: 1e4
3331
+ };
3332
+ }
3333
+ return {
3334
+ command: shutdown.command,
3335
+ timeoutMs: shutdown.timeoutMs ?? 1e4
3336
+ };
3337
+ };
3338
+ var runShutdownHook = async (service, onLog) => {
3339
+ const hook = resolveShutdownHook(service.service.shutdown);
3340
+ if (!hook) {
3341
+ return;
3342
+ }
3343
+ onLog("workspace", `Running ${service.name} shutdown hook...`, "info");
3344
+ const processHandle = Bun.spawn(hook.command, {
3345
+ cwd: service.cwd,
3346
+ env: service.env,
3347
+ stderr: "pipe",
3348
+ stdin: "ignore",
3349
+ stdout: "pipe"
3350
+ });
3351
+ pipeProcessLogs(service.name, processHandle, onLog);
3352
+ const timeout = setTimeout(() => {
3353
+ try {
3354
+ processHandle.kill();
3355
+ } catch {}
3356
+ }, hook.timeoutMs);
3357
+ try {
3358
+ const exitCode = await processHandle.exited;
3359
+ if (exitCode === 0) {
3360
+ onLog("workspace", `${service.name} shutdown hook finished.`, "success");
3361
+ return;
3362
+ }
3363
+ onLog("workspace", `${service.name} shutdown hook exited with code ${exitCode || 1}.`, "warn");
3364
+ } finally {
3365
+ clearTimeout(timeout);
3366
+ }
3367
+ };
3323
3368
  var topologicallySortServices = (services) => {
3324
3369
  const ordered = [];
3325
3370
  const visiting = new Set;
@@ -3496,6 +3541,14 @@ var workspace = async (subcommand, options) => {
3496
3541
  } catch {}
3497
3542
  }
3498
3543
  await Promise.all(snapshot.map((service) => service.process.exited));
3544
+ for (const service of snapshot.reverse()) {
3545
+ try {
3546
+ await runShutdownHook(service.resolved, tui.addLog);
3547
+ } catch (error) {
3548
+ const message = error instanceof Error ? error.message : String(error);
3549
+ tui.addLog("workspace", `${service.name} shutdown hook failed: ${message}`, "warn");
3550
+ }
3551
+ }
3499
3552
  };
3500
3553
  const printFailureSummary = (exitCode) => {
3501
3554
  const servicesSnapshot = tui.getServiceSnapshot();
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("/home/alexkahn/abs/absolutejs/node_modules/typescript/lib/typescript.js");
174826
+ const tsPath = __require.resolve("typescript");
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=A7EC3AF25BF78DB864756E2164756E21
189000
+ //# debugId=34F91B1BAA5BDB1464756E2164756E21
189001
189001
  //# sourceMappingURL=index.js.map