cloggi 1.0.8 → 1.0.10
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/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,9 +6,10 @@ class ClogBuilder {
|
|
|
6
6
|
this._modifiers = [];
|
|
7
7
|
this._timed = false;
|
|
8
8
|
this._overwrite = false;
|
|
9
|
-
this.
|
|
9
|
+
this._lastOverwriteLines = 0;
|
|
10
10
|
}
|
|
11
11
|
_print(text) {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
const str = typeof text === 'object'
|
|
13
14
|
? prettyjson.render(text)
|
|
14
15
|
: typeof text === 'number'
|
|
@@ -17,16 +18,17 @@ class ClogBuilder {
|
|
|
17
18
|
const output = `${this._timed ? `[${new Date().toTimeString().slice(0, 8)}]${typeof text === 'object' ? '\n' : ' - '}` : ''}${str}`;
|
|
18
19
|
const formats = [this._color, ...this._modifiers];
|
|
19
20
|
const styled = st(formats, output, { validateStream: false });
|
|
20
|
-
if (this.
|
|
21
|
-
|
|
21
|
+
if (this._lastOverwriteLines > 0) {
|
|
22
|
+
const up = '\x1B[1A\x1B[2K'.repeat(this._lastOverwriteLines - 1);
|
|
23
|
+
process.stdout.write(up + '\r\x1B[2K');
|
|
22
24
|
}
|
|
23
25
|
if (this._overwrite) {
|
|
24
26
|
process.stdout.write(styled);
|
|
25
|
-
this.
|
|
27
|
+
this._lastOverwriteLines = ((_b = (_a = output.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + 1;
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
30
|
console.log(styled);
|
|
29
|
-
this.
|
|
31
|
+
this._lastOverwriteLines = 0;
|
|
30
32
|
}
|
|
31
33
|
this._color = 'white';
|
|
32
34
|
this._modifiers = [];
|