@flowscripter/dynamic-cli-framework 5.4.10 → 5.4.11
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../../../../src/service/printer/terminal/Progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../../../../src/service/printer/terminal/Progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAU1D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAkBxE,MAAM,CAAC,OAAO,OAAO,QAAQ;;IAe3B,YAAmB,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAGpD;IAEM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA4BjF;IA4BM,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAyBrE;IAEY,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe/C;IAEY,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAKpC;IAEY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAqBlC;IAEM,MAAM,IAAI,IAAI,CAapB;IAgKD,IAAI,aAAa,CAAC,KAAK,EAAE,MAAM,EAE9B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,aAAa,CAAC,KAAK,EAAE,aAAa,EAErC;CAmDF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Weight given to each new rate sample in the exponential moving average - time constant is
|
|
2
2
|
// roughly 1/RATE_SMOOTHING_FACTOR * 100ms (the render interval).
|
|
3
3
|
const RATE_SMOOTHING_FACTOR = 0.3;
|
|
4
|
+
// A rate this close to zero (units/s) produces a meaningless (and, past a certain point,
|
|
5
|
+
// non-finite) "time remaining" estimate - treat it the same as no rate at all.
|
|
6
|
+
const MAX_REMAINING_MILLIS = 999 * 24 * 60 * 60 * 1000;
|
|
4
7
|
export { ProgressStyle } from "@flowscripter/dynamic-cli-framework-api";
|
|
5
8
|
import { ProgressStyle } from "@flowscripter/dynamic-cli-framework-api";
|
|
6
9
|
const STYLE_CHARS = {
|
|
@@ -187,9 +190,14 @@ export default class Progress {
|
|
|
187
190
|
Bun.stripANSI(taken).length;
|
|
188
191
|
}
|
|
189
192
|
else {
|
|
190
|
-
const
|
|
193
|
+
const remainingMillis = bar.rate === undefined || bar.rate === 0
|
|
194
|
+
? undefined
|
|
195
|
+
: ((bar.total - bar.current) / bar.rate) * 1000;
|
|
196
|
+
const remaining = remainingMillis === undefined ||
|
|
197
|
+
!Number.isFinite(remainingMillis) ||
|
|
198
|
+
remainingMillis > MAX_REMAINING_MILLIS
|
|
191
199
|
? "-"
|
|
192
|
-
: this.#formatTime(
|
|
200
|
+
: this.#formatTime(remainingMillis);
|
|
193
201
|
const currentString = bar.current + "";
|
|
194
202
|
const totalString = bar.total + "";
|
|
195
203
|
suffix += `${this.#styler.colorText(currentString, this.#valColor)}${this.#styler.colorText("/", this.#labColor)}${this.#styler.colorText(totalString, this.#valColor)}${this.#styler.colorText(bar.units + ", rate:", this.#labColor)} ${rate}${this.#styler.colorText(bar.units + "/s, time remaining:", this.#labColor)} ${remaining}`;
|
package/package.json
CHANGED
|
@@ -5,6 +5,10 @@ import type Terminal from "../../../terminal/Terminal.ts";
|
|
|
5
5
|
// roughly 1/RATE_SMOOTHING_FACTOR * 100ms (the render interval).
|
|
6
6
|
const RATE_SMOOTHING_FACTOR = 0.3;
|
|
7
7
|
|
|
8
|
+
// A rate this close to zero (units/s) produces a meaningless (and, past a certain point,
|
|
9
|
+
// non-finite) "time remaining" estimate - treat it the same as no rate at all.
|
|
10
|
+
const MAX_REMAINING_MILLIS = 999 * 24 * 60 * 60 * 1000;
|
|
11
|
+
|
|
8
12
|
export { ProgressStyle } from "@flowscripter/dynamic-cli-framework-api";
|
|
9
13
|
import { ProgressStyle } from "@flowscripter/dynamic-cli-framework-api";
|
|
10
14
|
|
|
@@ -255,10 +259,16 @@ export default class Progress {
|
|
|
255
259
|
1 +
|
|
256
260
|
Bun.stripANSI(taken).length;
|
|
257
261
|
} else {
|
|
258
|
-
const
|
|
262
|
+
const remainingMillis =
|
|
259
263
|
bar.rate === undefined || bar.rate === 0
|
|
264
|
+
? undefined
|
|
265
|
+
: ((bar.total - bar.current) / bar.rate) * 1000;
|
|
266
|
+
const remaining =
|
|
267
|
+
remainingMillis === undefined ||
|
|
268
|
+
!Number.isFinite(remainingMillis) ||
|
|
269
|
+
remainingMillis > MAX_REMAINING_MILLIS
|
|
260
270
|
? "-"
|
|
261
|
-
: this.#formatTime(
|
|
271
|
+
: this.#formatTime(remainingMillis);
|
|
262
272
|
const currentString = bar.current + "";
|
|
263
273
|
const totalString = bar.total + "";
|
|
264
274
|
suffix += `${this.#styler.colorText(currentString, this.#valColor)}${this.#styler.colorText(
|