@absolutejs/absolute 0.19.0-beta.681 → 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
@@ -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