@niceties/draftlog-appender 1.0.3 → 1.0.7
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.
|
@@ -21,7 +21,7 @@ function createCanvas(spinner, formatter, ident) {
|
|
|
21
21
|
if (!model.items_.length) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
let key = 0;
|
|
24
|
+
let key = 0, dirty = false;
|
|
25
25
|
const stack = [[...model.items_]];
|
|
26
26
|
while (stack.length) {
|
|
27
27
|
const item = stack[stack.length - 1].shift();
|
|
@@ -30,8 +30,14 @@ function createCanvas(spinner, formatter, ident) {
|
|
|
30
30
|
updater = console.draft(' ');
|
|
31
31
|
updaters.push(updater);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (dirty || item.dirty_ || item.status_) {
|
|
34
|
+
const prefix = getMessageFormat(item.status_, model.tick_);
|
|
35
|
+
updater(formatter(item.text_, item.loglevel_, prefix, ident * (stack.length - 1)));
|
|
36
|
+
if (item.dirty_) {
|
|
37
|
+
item.dirty_ = false;
|
|
38
|
+
dirty = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
35
41
|
// iterate
|
|
36
42
|
++key;
|
|
37
43
|
if (item.children_.length) {
|
|
@@ -61,7 +67,7 @@ function createModel(logAboveSpinners) {
|
|
|
61
67
|
const itemById = Object.create(null);
|
|
62
68
|
return [({ message: text, inputId, action, loglevel, ref, parentId }) => {
|
|
63
69
|
// item has status undefined, so it is static by default
|
|
64
|
-
const item = { text_: text, loglevel_: loglevel, ref_: ref, parentId_: parentId, children_: [] };
|
|
70
|
+
const item = { text_: text, loglevel_: loglevel, ref_: ref, parentId_: parentId, children_: [], dirty_: true };
|
|
65
71
|
if (action === 0 /* start */) {
|
|
66
72
|
item.status_ = 1 /* inprogress */;
|
|
67
73
|
}
|
|
@@ -107,6 +113,7 @@ function createModel(logAboveSpinners) {
|
|
|
107
113
|
if (moveIntoParent) {
|
|
108
114
|
model.items_ = model.items_.filter(item => item !== modelItem);
|
|
109
115
|
model.spinning_ -= (modelItem.status_ || 0);
|
|
116
|
+
modelItem.dirty_ = true;
|
|
110
117
|
putIntoChildren(modelItem.parentId_, modelItem);
|
|
111
118
|
}
|
|
112
119
|
}
|
package/dist/core.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function createCanvas(spinner, formatter, ident) {
|
|
|
13
13
|
if (!model.items_.length) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
let key = 0;
|
|
16
|
+
let key = 0, dirty = false;
|
|
17
17
|
const stack = [[...model.items_]];
|
|
18
18
|
while (stack.length) {
|
|
19
19
|
const item = stack[stack.length - 1].shift();
|
|
@@ -22,8 +22,14 @@ function createCanvas(spinner, formatter, ident) {
|
|
|
22
22
|
updater = console.draft(' ');
|
|
23
23
|
updaters.push(updater);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
if (dirty || item.dirty_ || item.status_) {
|
|
26
|
+
const prefix = getMessageFormat(item.status_, model.tick_);
|
|
27
|
+
updater(formatter(item.text_, item.loglevel_, prefix, ident * (stack.length - 1)));
|
|
28
|
+
if (item.dirty_) {
|
|
29
|
+
item.dirty_ = false;
|
|
30
|
+
dirty = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
27
33
|
// iterate
|
|
28
34
|
++key;
|
|
29
35
|
if (item.children_.length) {
|
|
@@ -53,7 +59,7 @@ function createModel(logAboveSpinners) {
|
|
|
53
59
|
const itemById = Object.create(null);
|
|
54
60
|
return [({ message: text, inputId, action, loglevel, ref, parentId }) => {
|
|
55
61
|
// item has status undefined, so it is static by default
|
|
56
|
-
const item = { text_: text, loglevel_: loglevel, ref_: ref, parentId_: parentId, children_: [] };
|
|
62
|
+
const item = { text_: text, loglevel_: loglevel, ref_: ref, parentId_: parentId, children_: [], dirty_: true };
|
|
57
63
|
if (action === 0 /* start */) {
|
|
58
64
|
item.status_ = 1 /* inprogress */;
|
|
59
65
|
}
|
|
@@ -99,6 +105,7 @@ function createModel(logAboveSpinners) {
|
|
|
99
105
|
if (moveIntoParent) {
|
|
100
106
|
model.items_ = model.items_.filter(item => item !== modelItem);
|
|
101
107
|
model.spinning_ -= (modelItem.status_ || 0);
|
|
108
|
+
modelItem.dirty_ = true;
|
|
102
109
|
putIntoChildren(modelItem.parentId_, modelItem);
|
|
103
110
|
}
|
|
104
111
|
}
|
package/dist/details/model.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var core = require('@niceties/logger/core');
|
|
4
4
|
var formatUtils = require('@niceties/logger/format-utils');
|
|
5
5
|
var defaultFormatting = require('@niceties/logger/default-formatting');
|
|
6
|
-
var core$1 = require('./core.
|
|
7
|
-
var spinners = require('./spinners.
|
|
6
|
+
var core$1 = require('./core.cjs');
|
|
7
|
+
var spinners = require('./spinners.cjs');
|
|
8
8
|
require('draftlog');
|
|
9
9
|
|
|
10
10
|
const supportsUnicode = formatUtils.terminalSupportsUnicode();
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.7",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "@niceties/draftlog-appender",
|
|
5
5
|
"author": {
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"require": "./dist/index.
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
13
|
"default": "./dist/index.mjs"
|
|
14
14
|
},
|
|
15
15
|
"./core": {
|
|
16
|
-
"require": "./dist/core.
|
|
16
|
+
"require": "./dist/core.cjs",
|
|
17
17
|
"default": "./dist/core.mjs"
|
|
18
18
|
},
|
|
19
19
|
"./spinners": {
|
|
20
|
-
"require": "./spinners/dist/spinners.
|
|
20
|
+
"require": "./spinners/dist/spinners.cjs",
|
|
21
21
|
"default": "./spinners/dist/spinners.mjs"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"main": "./dist/index.
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
25
|
"module": "./dist/index.mjs",
|
|
26
26
|
"typings": "./dist/index.d.ts",
|
|
27
27
|
"files": [
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"update-monorepo-package-json": "0.1.6"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@niceties/logger": "^1.0.
|
|
77
|
+
"@niceties/logger": "^1.0.4",
|
|
78
78
|
"draftlog": "^1.0.13"
|
|
79
79
|
},
|
|
80
80
|
"readme": "ERROR: No README data found!"
|