numux 1.11.2 → 1.12.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.
Files changed (2) hide show
  1. package/dist/numux.js +44 -5
  2. package/package.json +1 -1
package/dist/numux.js CHANGED
@@ -5,15 +5,29 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -22,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
22
36
  var require_package = __commonJS((exports, module) => {
23
37
  module.exports = {
24
38
  name: "numux",
25
- version: "1.11.2",
39
+ version: "1.12.1",
26
40
  description: "Terminal multiplexer with dependency orchestration",
27
41
  type: "module",
28
42
  license: "MIT",
@@ -1705,11 +1719,13 @@ class ProcessManager {
1705
1719
  const maxRestarts = proc.maxRestarts;
1706
1720
  if (maxRestarts !== undefined && attempt >= maxRestarts) {
1707
1721
  log(`[${name}] Reached maxRestarts limit (${maxRestarts}), not restarting`);
1708
- const encoder2 = new TextEncoder;
1709
- const msg2 = `\r
1722
+ if (maxRestarts > 0) {
1723
+ const encoder2 = new TextEncoder;
1724
+ const msg2 = `\r
1710
1725
  \x1B[31m[numux] reached restart limit (${maxRestarts}), giving up\x1B[0m\r
1711
1726
  `;
1712
- this.emit({ type: "output", name, data: encoder2.encode(msg2) });
1727
+ this.emit({ type: "output", name, data: encoder2.encode(msg2) });
1728
+ }
1713
1729
  return;
1714
1730
  }
1715
1731
  const delay = Math.min(BACKOFF_BASE_MS * 2 ** attempt, BACKOFF_MAX_MS);
@@ -2750,6 +2766,7 @@ class PrefixDisplay {
2750
2766
  killOthers;
2751
2767
  timestamps;
2752
2768
  stopping = false;
2769
+ startTime = 0;
2753
2770
  constructor(manager, config, options = {}) {
2754
2771
  this.manager = manager;
2755
2772
  this.logWriter = options.logWriter;
@@ -2782,6 +2799,7 @@ class PrefixDisplay {
2782
2799
  `);
2783
2800
  this.shutdown();
2784
2801
  });
2802
+ this.startTime = Date.now();
2785
2803
  const cols = process.stdout.columns || 80;
2786
2804
  const rows = process.stdout.rows || 24;
2787
2805
  await this.manager.startAll(cols, rows);
@@ -2865,6 +2883,17 @@ class PrefixDisplay {
2865
2883
  process.exit(code === 0 ? 0 : 1);
2866
2884
  });
2867
2885
  }
2886
+ formatElapsed() {
2887
+ const ms = Date.now() - this.startTime;
2888
+ if (ms < 1000)
2889
+ return `${ms}ms`;
2890
+ const s = ms / 1000;
2891
+ if (s < 60)
2892
+ return `${s.toFixed(1)}s`;
2893
+ const m = Math.floor(s / 60);
2894
+ const rem = s % 60;
2895
+ return `${m}m ${rem.toFixed(0)}s`;
2896
+ }
2868
2897
  printSummary() {
2869
2898
  const states = this.manager.getAllStates();
2870
2899
  const namePad = Math.max(...states.map((s) => s.name.length));
@@ -2883,6 +2912,16 @@ class PrefixDisplay {
2883
2912
  `);
2884
2913
  }
2885
2914
  }
2915
+ const elapsed = this.formatElapsed();
2916
+ if (this.noColor) {
2917
+ process.stdout.write(`
2918
+ Done in ${elapsed}
2919
+ `);
2920
+ } else {
2921
+ process.stdout.write(`
2922
+ ${DIM}Done in ${elapsed}${RESET}
2923
+ `);
2924
+ }
2886
2925
  }
2887
2926
  async shutdown() {
2888
2927
  if (this.stopping)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "numux",
3
- "version": "1.11.2",
3
+ "version": "1.12.1",
4
4
  "description": "Terminal multiplexer with dependency orchestration",
5
5
  "type": "module",
6
6
  "license": "MIT",