standard-log-color 12.1.2 → 13.0.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.
- package/README.md +6 -6
- package/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/cjs/ansi/ansiFormatter.d.ts +7 -4
- package/cjs/ansi/ansiFormatter.d.ts.map +1 -1
- package/cjs/ansi/ansiFormatter.js +158 -89
- package/cjs/ansi/ansiFormatter.js.map +1 -1
- package/cjs/ansi/constants.d.ts +17 -14
- package/cjs/ansi/constants.d.ts.map +1 -1
- package/cjs/ansi/constants.js +28 -15
- package/cjs/ansi/constants.js.map +1 -1
- package/cjs/ansi/index.d.ts +4 -4
- package/cjs/ansi/index.js +18 -20
- package/cjs/ansi/wrapAnsi.d.ts +4 -1
- package/cjs/ansi/wrapAnsi.d.ts.map +1 -1
- package/cjs/ansi/wrapAnsi.js +5 -4
- package/cjs/ansi/wrapAnsi.js.map +1 -1
- package/cjs/createColorLogReporter.browser.d.ts +5 -2
- package/cjs/createColorLogReporter.browser.d.ts.map +1 -1
- package/cjs/createColorLogReporter.browser.js +12 -41
- package/cjs/createColorLogReporter.browser.js.map +1 -1
- package/cjs/createColorLogReporter.d.ts +5 -2
- package/cjs/createColorLogReporter.d.ts.map +1 -1
- package/cjs/createColorLogReporter.js +8 -7
- package/cjs/createColorLogReporter.js.map +1 -1
- package/cjs/css/colors.d.ts +5 -2
- package/cjs/css/colors.d.ts.map +1 -1
- package/cjs/css/colors.js +78 -13
- package/cjs/css/colors.js.map +1 -1
- package/cjs/css/cssFormatter.d.ts +6 -3
- package/cjs/css/cssFormatter.d.ts.map +1 -1
- package/cjs/css/cssFormatter.js +77 -86
- package/cjs/css/cssFormatter.js.map +1 -1
- package/cjs/css/index.d.ts +2 -2
- package/cjs/css/index.js +3 -18
- package/cjs/index.d.ts +9 -5
- package/cjs/index.js +22 -20
- package/cjs/supportColor.d.ts +23 -20
- package/cjs/supportColor.d.ts.map +1 -1
- package/cjs/supportColor.js +42 -41
- package/cjs/supportColor.js.map +1 -1
- package/cjs/types.d.ts +32 -29
- package/cjs/types.d.ts.map +1 -1
- package/cjs/types.js +0 -3
- package/dist/standard-log-color.esm.js +786 -1
- package/dist/standard-log-color.esm.js.map +1 -1
- package/dist/standard-log-color.iife.js +806 -0
- package/dist/standard-log-color.iife.js.map +1 -0
- package/esm/ansi/ansiFormatter.d.ts +7 -4
- package/esm/ansi/ansiFormatter.d.ts.map +1 -1
- package/esm/ansi/ansiFormatter.js +155 -73
- package/esm/ansi/ansiFormatter.js.map +1 -1
- package/esm/ansi/constants.d.ts +17 -14
- package/esm/ansi/constants.d.ts.map +1 -1
- package/esm/ansi/constants.js +16 -12
- package/esm/ansi/constants.js.map +1 -1
- package/esm/ansi/index.d.ts +4 -4
- package/esm/ansi/index.js +4 -4
- package/esm/ansi/wrapAnsi.d.ts +4 -1
- package/esm/ansi/wrapAnsi.d.ts.map +1 -1
- package/esm/ansi/wrapAnsi.js +6 -2
- package/esm/ansi/wrapAnsi.js.map +1 -1
- package/esm/createColorLogReporter.browser.d.ts +5 -2
- package/esm/createColorLogReporter.browser.d.ts.map +1 -1
- package/esm/createColorLogReporter.browser.js +12 -35
- package/esm/createColorLogReporter.browser.js.map +1 -1
- package/esm/createColorLogReporter.d.ts +5 -2
- package/esm/createColorLogReporter.d.ts.map +1 -1
- package/esm/createColorLogReporter.js +9 -5
- package/esm/createColorLogReporter.js.map +1 -1
- package/esm/css/colors.d.ts +5 -2
- package/esm/css/colors.d.ts.map +1 -1
- package/esm/css/colors.js +77 -10
- package/esm/css/colors.js.map +1 -1
- package/esm/css/cssFormatter.d.ts +6 -3
- package/esm/css/cssFormatter.d.ts.map +1 -1
- package/esm/css/cssFormatter.js +76 -74
- package/esm/css/cssFormatter.js.map +1 -1
- package/esm/css/index.d.ts +2 -2
- package/esm/css/index.js +2 -2
- package/esm/index.d.ts +9 -5
- package/esm/index.js +6 -4
- package/esm/supportColor.d.ts +23 -20
- package/esm/supportColor.d.ts.map +1 -1
- package/esm/supportColor.js +39 -35
- package/esm/supportColor.js.map +1 -1
- package/esm/types.d.ts +32 -29
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js +0 -1
- package/package.json +20 -67
- package/ts/ansi/ansiFormatter.ts +3 -3
- package/ts/createColorLogReporter.browser.ts +5 -5
- package/ts/css/colors.ts +1 -1
- package/ts/css/cssFormatter.ts +5 -5
- package/ts/types.ts +8 -8
- package/cjs/ansi/index.d.ts.map +0 -1
- package/cjs/ansi/index.js.map +0 -1
- package/cjs/css/index.d.ts.map +0 -1
- package/cjs/css/index.js.map +0 -1
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/types.js.map +0 -1
- package/dist/standard-log-color.es5.js +0 -2
- package/dist/standard-log-color.es5.js.gz +0 -0
- package/dist/standard-log-color.es5.js.map +0 -1
- package/dist/standard-log-color.es5.js.map.gz +0 -0
- package/dist/standard-log-color.esm.js.gz +0 -0
- package/dist/standard-log-color.esm.js.map.gz +0 -0
- package/dist/standard-log-color.nodenext.js +0 -2
- package/dist/standard-log-color.nodenext.js.gz +0 -0
- package/dist/standard-log-color.nodenext.js.map +0 -1
- package/dist/standard-log-color.nodenext.js.map.gz +0 -0
- package/esm/ansi/index.d.ts.map +0 -1
- package/esm/ansi/index.js.map +0 -1
- package/esm/css/index.d.ts.map +0 -1
- package/esm/css/index.js.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -69,15 +69,15 @@ createCssLogFormatter({ timestamp: 'iso' })
|
|
|
69
69
|
createCssLogFormatter({ timestamp: 'elapsed' })
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
[codecov-image]: https://codecov.io/gh/
|
|
73
|
-
[codecov-url]: https://codecov.io/gh/
|
|
72
|
+
[codecov-image]: https://codecov.io/gh/cyberuni/standard-log/branch/main/graph/badge.svg
|
|
73
|
+
[codecov-url]: https://codecov.io/gh/cyberuni/standard-log
|
|
74
74
|
[downloads-image]: https://img.shields.io/npm/dm/standard-log-color.svg?style=flat
|
|
75
75
|
[downloads-url]: https://npmjs.org/package/standard-log-color
|
|
76
|
-
[github-action-url]: https://github.com/
|
|
77
|
-
[github-nodejs]: https://github.com/
|
|
76
|
+
[github-action-url]: https://github.com/cyberuni/standard-log/actions
|
|
77
|
+
[github-nodejs]: https://github.com/cyberuni/standard-log/actions/workflows/release.yml/badge.svg
|
|
78
78
|
[npm-image]: https://img.shields.io/npm/v/standard-log-color.svg?style=flat
|
|
79
79
|
[npm-url]: https://www.npmjs.com/package/standard-log-color
|
|
80
80
|
[vscode-image]: https://img.shields.io/badge/vscode-ready-green.svg
|
|
81
81
|
[vscode-url]: https://code.visualstudio.com/
|
|
82
|
-
[rendering-example]: https://github.com/
|
|
83
|
-
[standard-log]: https://github.com/
|
|
82
|
+
[rendering-example]: https://github.com/cyberuni/standard-log/tree/main/images/color-log.png
|
|
83
|
+
[standard-log]: https://github.com/cyberuni/standard-log
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { LogEntry, TimestampFormat } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { LogEntry, TimestampFormat } from "standard-log";
|
|
2
|
+
//#region ts/ansi/ansiFormatter.d.ts
|
|
3
|
+
type AnsiFormatterOptions = {
|
|
4
|
+
timestamp: TimestampFormat;
|
|
4
5
|
};
|
|
5
|
-
|
|
6
|
+
declare function createAnsiFormatter(options?: AnsiFormatterOptions): (entry: LogEntry) => any[];
|
|
7
|
+
//#endregion
|
|
8
|
+
export { AnsiFormatterOptions, createAnsiFormatter };
|
|
6
9
|
//# sourceMappingURL=ansiFormatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansiFormatter.d.ts","
|
|
1
|
+
{"version":3,"file":"ansiFormatter.d.ts","names":[],"sources":["../../ts/ansi/ansiFormatter.ts"],"mappings":";;KAkBY;EACX,WAAW;;iBAGI,oBAAoB,UAAS,wBAA4C,OAGnD"}
|
|
@@ -1,108 +1,177 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var standard_log_1 = require("standard-log");
|
|
14
|
-
var supportColor_js_1 = require("../supportColor.js");
|
|
15
|
-
var constants_js_1 = require("./constants.js");
|
|
16
|
-
var wrapAnsi_js_1 = require("./wrapAnsi.js");
|
|
17
|
-
function createAnsiFormatter(options) {
|
|
18
|
-
if (options === void 0) { options = { timestamp: 'none' }; }
|
|
19
|
-
var timestampFormatter = (0, standard_log_1.createTimestampFormatter)(options.timestamp);
|
|
20
|
-
return function ansiFormatter(entry) {
|
|
21
|
-
var consoleMethod = (0, standard_log_1.toConsoleMethod)(entry.level);
|
|
22
|
-
var id = formatID(consoleMethod, entry.id);
|
|
23
|
-
var args = formatArgs(timestampFormatter, consoleMethod, entry);
|
|
24
|
-
return __spreadArray([id], args, true);
|
|
25
|
-
};
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_supportColor = require("../supportColor.js");
|
|
3
|
+
require("./constants.js");
|
|
4
|
+
const require_ansi_wrapAnsi = require("./wrapAnsi.js");
|
|
5
|
+
let standard_log = require("standard-log");
|
|
6
|
+
//#region ts/ansi/ansiFormatter.ts
|
|
7
|
+
function createAnsiFormatter(options = { timestamp: "none" }) {
|
|
8
|
+
const timestampFormatter = (0, standard_log.createTimestampFormatter)(options.timestamp);
|
|
9
|
+
return function ansiFormatter(entry) {
|
|
10
|
+
const consoleMethod = (0, standard_log.toConsoleMethod)(entry.level);
|
|
11
|
+
return [formatID(consoleMethod, entry.id), ...formatArgs(timestampFormatter, consoleMethod, entry)];
|
|
12
|
+
};
|
|
26
13
|
}
|
|
27
|
-
exports.createAnsiFormatter = createAnsiFormatter;
|
|
28
14
|
function formatArgs(timestampFormatter, method, entry) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
? [constants_js_1.ANSI_RED + constants_js_1.ANSI_FOREGROUND]
|
|
35
|
-
: method === 'warn'
|
|
36
|
-
? [constants_js_1.ANSI_YELLOW + constants_js_1.ANSI_FOREGROUND]
|
|
37
|
-
: undefined;
|
|
38
|
-
return textCodes ? args.map(function (x) { return (0, wrapAnsi_js_1.wrapAnsi)(x, textCodes); }) : args;
|
|
15
|
+
const args = [...entry.args];
|
|
16
|
+
const timestamp = timestampFormatter(entry.timestamp);
|
|
17
|
+
if (timestamp !== void 0) args.push(timestamp);
|
|
18
|
+
const textCodes = method === "error" ? [31] : method === "warn" ? [33] : void 0;
|
|
19
|
+
return textCodes ? args.map((x) => require_ansi_wrapAnsi.wrapAnsi(x, textCodes)) : args;
|
|
39
20
|
}
|
|
40
21
|
function formatID(method, id) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return toIDFormatter(colorLevel)(id);
|
|
22
|
+
const colorLevels = require_supportColor.supportColor();
|
|
23
|
+
return toIDFormatter(method === "error" ? colorLevels.stderr : colorLevels.stdout)(id);
|
|
44
24
|
}
|
|
45
25
|
function toIDFormatter(colorLevel) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return ansiIDFormatter;
|
|
54
|
-
case supportColor_js_1.ColorLevels.TRUE:
|
|
55
|
-
return truecolorIDFormatter;
|
|
56
|
-
}
|
|
26
|
+
// istanbul ignore next
|
|
27
|
+
switch (colorLevel) {
|
|
28
|
+
case 0: return (id) => id;
|
|
29
|
+
case 1: return basicIDFormatter;
|
|
30
|
+
case 2: return ansiIDFormatter;
|
|
31
|
+
case 3: return truecolorIDFormatter;
|
|
32
|
+
}
|
|
57
33
|
}
|
|
58
34
|
function basicIDFormatter(id) {
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
const codes = getAnsiColor(id);
|
|
36
|
+
return require_ansi_wrapAnsi.wrapAnsi(` ${id} `, codes);
|
|
61
37
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
38
|
+
const ansiColors = {
|
|
39
|
+
counter: 0,
|
|
40
|
+
list: [
|
|
41
|
+
[37, 41],
|
|
42
|
+
[30, 42],
|
|
43
|
+
[30, 43],
|
|
44
|
+
[37, 44],
|
|
45
|
+
[37, 45],
|
|
46
|
+
[30, 46],
|
|
47
|
+
[37, 40],
|
|
48
|
+
[
|
|
49
|
+
37,
|
|
50
|
+
41,
|
|
51
|
+
1
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
30,
|
|
55
|
+
42,
|
|
56
|
+
1
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
30,
|
|
60
|
+
43,
|
|
61
|
+
1
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
37,
|
|
65
|
+
44,
|
|
66
|
+
1
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
37,
|
|
70
|
+
45,
|
|
71
|
+
1
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
30,
|
|
75
|
+
46,
|
|
76
|
+
1
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
37,
|
|
80
|
+
40,
|
|
81
|
+
1
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
37,
|
|
85
|
+
41,
|
|
86
|
+
4
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
30,
|
|
90
|
+
42,
|
|
91
|
+
4
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
30,
|
|
95
|
+
43,
|
|
96
|
+
4
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
37,
|
|
100
|
+
44,
|
|
101
|
+
4
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
37,
|
|
105
|
+
45,
|
|
106
|
+
4
|
|
107
|
+
],
|
|
108
|
+
[
|
|
109
|
+
30,
|
|
110
|
+
46,
|
|
111
|
+
4
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
37,
|
|
115
|
+
40,
|
|
116
|
+
4
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
37,
|
|
120
|
+
41,
|
|
121
|
+
1,
|
|
122
|
+
4
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
30,
|
|
126
|
+
42,
|
|
127
|
+
1,
|
|
128
|
+
4
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
30,
|
|
132
|
+
43,
|
|
133
|
+
1,
|
|
134
|
+
4
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
37,
|
|
138
|
+
44,
|
|
139
|
+
1,
|
|
140
|
+
4
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
37,
|
|
144
|
+
45,
|
|
145
|
+
1,
|
|
146
|
+
4
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
30,
|
|
150
|
+
46,
|
|
151
|
+
1,
|
|
152
|
+
4
|
|
153
|
+
],
|
|
154
|
+
[
|
|
155
|
+
37,
|
|
156
|
+
40,
|
|
157
|
+
1,
|
|
158
|
+
4
|
|
159
|
+
]
|
|
160
|
+
]
|
|
94
161
|
};
|
|
95
|
-
|
|
162
|
+
const ansiColorMap = Object.create(null);
|
|
96
163
|
function getAnsiColor(id) {
|
|
97
|
-
|
|
98
|
-
ansiColorMap[id] || ansiColors.list[ansiColors.counter++ % ansiColors.list.length]);
|
|
164
|
+
return ansiColorMap[id] = ansiColorMap[id] || ansiColors.list[ansiColors.counter++ % ansiColors.list.length];
|
|
99
165
|
}
|
|
100
166
|
// istanbul ignore next
|
|
101
167
|
function ansiIDFormatter(id) {
|
|
102
|
-
|
|
168
|
+
return basicIDFormatter(id);
|
|
103
169
|
}
|
|
104
170
|
// istanbul ignore next
|
|
105
171
|
function truecolorIDFormatter(id) {
|
|
106
|
-
|
|
172
|
+
return basicIDFormatter(id);
|
|
107
173
|
}
|
|
174
|
+
//#endregion
|
|
175
|
+
exports.createAnsiFormatter = createAnsiFormatter;
|
|
176
|
+
|
|
108
177
|
//# sourceMappingURL=ansiFormatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansiFormatter.js","
|
|
1
|
+
{"version":3,"file":"ansiFormatter.js","names":["createTimestampFormatter","toConsoleMethod","wrapAnsi","supportColor"],"sources":["../../ts/ansi/ansiFormatter.ts"],"sourcesContent":["import { createTimestampFormatter, type LogEntry, type TimestampFormat, toConsoleMethod } from 'standard-log'\nimport { ColorLevels, supportColor } from '../supportColor.js'\nimport {\n\tANSI_BACKGROUND,\n\tANSI_BLACK,\n\tANSI_BLUE,\n\tANSI_BRIGHT,\n\tANSI_CYAN,\n\tANSI_FOREGROUND,\n\tANSI_GREEN,\n\tANSI_MAGENTA,\n\tANSI_RED,\n\tANSI_UNDERSCORE,\n\tANSI_WHITE,\n\tANSI_YELLOW\n} from './constants.js'\nimport { wrapAnsi } from './wrapAnsi.js'\n\nexport type AnsiFormatterOptions = {\n\ttimestamp: TimestampFormat\n}\n\nexport function createAnsiFormatter(options: AnsiFormatterOptions = { timestamp: 'none' }) {\n\tconst timestampFormatter = createTimestampFormatter(options.timestamp)\n\n\treturn function ansiFormatter(entry: LogEntry) {\n\t\tconst consoleMethod = toConsoleMethod(entry.level)\n\t\tconst id = formatID(consoleMethod, entry.id)\n\t\tconst args = formatArgs(timestampFormatter, consoleMethod, entry)\n\t\treturn [id, ...args]\n\t}\n}\n\nfunction formatArgs(\n\ttimestampFormatter: (timestamp: Date) => string | undefined,\n\tmethod: 'error' | 'warn' | 'info' | 'debug',\n\tentry: Pick<LogEntry, 'args' | 'timestamp'>\n) {\n\tconst args = [...entry.args]\n\tconst timestamp = timestampFormatter(entry.timestamp)\n\tif (timestamp !== undefined) args.push(timestamp)\n\tconst textCodes =\n\t\tmethod === 'error'\n\t\t\t? [ANSI_RED + ANSI_FOREGROUND]\n\t\t\t: method === 'warn'\n\t\t\t\t? [ANSI_YELLOW + ANSI_FOREGROUND]\n\t\t\t\t: undefined\n\n\treturn textCodes ? args.map(x => wrapAnsi(x, textCodes)) : args\n}\n\nfunction formatID(method: 'error' | 'warn' | 'info' | 'debug', id: string) {\n\tconst colorLevels = supportColor()\n\tconst colorLevel = method === 'error' ? colorLevels.stderr : colorLevels.stdout\n\treturn toIDFormatter(colorLevel)(id)\n}\n\nfunction toIDFormatter(colorLevel: ColorLevels) {\n\t// istanbul ignore next\n\tswitch (colorLevel) {\n\t\tcase ColorLevels.DISABLED:\n\t\t\treturn (id: string) => id\n\t\tcase ColorLevels.BASIC:\n\t\t\treturn basicIDFormatter\n\t\tcase ColorLevels.ANSI:\n\t\t\treturn ansiIDFormatter\n\t\tcase ColorLevels.TRUE:\n\t\t\treturn truecolorIDFormatter\n\t}\n}\n\nfunction basicIDFormatter(id: string) {\n\tconst codes = getAnsiColor(id)\n\treturn wrapAnsi(` ${id} `, codes)\n}\n\nconst ansiColors: {\n\tcounter: number\n\tlist: Array<number[]>\n} = {\n\tcounter: 0,\n\tlist: [\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_RED + ANSI_BACKGROUND],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_GREEN + ANSI_BACKGROUND],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_YELLOW + ANSI_BACKGROUND],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLUE + ANSI_BACKGROUND],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_MAGENTA + ANSI_BACKGROUND],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_CYAN + ANSI_BACKGROUND],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLACK + ANSI_BACKGROUND],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_RED + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_GREEN + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_YELLOW + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLUE + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_MAGENTA + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_CYAN + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLACK + ANSI_BACKGROUND, ANSI_BRIGHT],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_RED + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_GREEN + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_YELLOW + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLUE + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_MAGENTA + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_CYAN + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLACK + ANSI_BACKGROUND, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_RED + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_GREEN + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_YELLOW + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLUE + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_MAGENTA + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_BLACK + ANSI_FOREGROUND, ANSI_CYAN + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE],\n\t\t[ANSI_WHITE + ANSI_FOREGROUND, ANSI_BLACK + ANSI_BACKGROUND, ANSI_BRIGHT, ANSI_UNDERSCORE]\n\t]\n}\nconst ansiColorMap: Record<string, number[]> = Object.create(null)\n\nfunction getAnsiColor(id: string) {\n\treturn (ansiColorMap[id] =\n\t\tansiColorMap[id] || ansiColors.list[ansiColors.counter++ % ansiColors.list.length])\n}\n\n// istanbul ignore next\nfunction ansiIDFormatter(id: string) {\n\treturn basicIDFormatter(id)\n}\n\n// istanbul ignore next\nfunction truecolorIDFormatter(id: string) {\n\treturn basicIDFormatter(id)\n}\n"],"mappings":";;;;;;AAsBA,SAAgB,oBAAoB,UAAgC,EAAE,WAAW,OAAO,GAAG;CAC1F,MAAM,sBAAA,GAAqBA,aAAAA,yBAAAA,CAAyB,QAAQ,SAAS;CAErE,OAAO,SAAS,cAAc,OAAiB;EAC9C,MAAM,iBAAA,GAAgBC,aAAAA,gBAAAA,CAAgB,MAAM,KAAK;EAGjD,OAAO,CAFI,SAAS,eAAe,MAAM,EAEhC,GAAG,GADC,WAAW,oBAAoB,eAAe,KACzC,CAAC;CACpB;AACD;AAEA,SAAS,WACR,oBACA,QACA,OACC;CACD,MAAM,OAAO,CAAC,GAAG,MAAM,IAAI;CAC3B,MAAM,YAAY,mBAAmB,MAAM,SAAS;CACpD,IAAI,cAAc,KAAA,GAAW,KAAK,KAAK,SAAS;CAChD,MAAM,YACL,WAAW,UACR,CAAA,EAA2B,IAC3B,WAAW,SACV,CAAA,EAA8B,IAC9B,KAAA;CAEL,OAAO,YAAY,KAAK,KAAI,MAAKC,sBAAAA,SAAS,GAAG,SAAS,CAAC,IAAI;AAC5D;AAEA,SAAS,SAAS,QAA6C,IAAY;CAC1E,MAAM,cAAcC,qBAAAA,aAAa;CAEjC,OAAO,cADY,WAAW,UAAU,YAAY,SAAS,YAAY,MAC1C,CAAC,CAAC,EAAE;AACpC;AAEA,SAAS,cAAc,YAAyB;;CAE/C,QAAQ,YAAR;EACC,KAAA,GACC,QAAQ,OAAe;EACxB,KAAA,GACC,OAAO;EACR,KAAA,GACC,OAAO;EACR,KAAA,GACC,OAAO;CACT;AACD;AAEA,SAAS,iBAAiB,IAAY;CACrC,MAAM,QAAQ,aAAa,EAAE;CAC7B,OAAOD,sBAAAA,SAAS,IAAI,GAAG,IAAI,KAAK;AACjC;AAEA,MAAM,aAGF;CACH,SAAS;CACT,MAAM;EACL,CAAA,IAAA,EAAyD;EACzD,CAAA,IAAA,EAA2D;EAC3D,CAAA,IAAA,EAA4D;EAC5D,CAAA,IAAA,EAA0D;EAC1D,CAAA,IAAA,EAA6D;EAC7D,CAAA,IAAA,EAA0D;EAC1D,CAAA,IAAA,EAA2D;EAC3D;;;;EAAsE;EACtE;;;;EAAwE;EACxE;;;;EAAyE;EACzE;;;;EAAuE;EACvE;;;;EAA0E;EAC1E;;;;EAAuE;EACvE;;;;EAAwE;EACxE;;;;EAA0E;EAC1E;;;;EAA4E;EAC5E;;;;EAA6E;EAC7E;;;;EAA2E;EAC3E;;;;EAA8E;EAC9E;;;;EAA2E;EAC3E;;;;EAA4E;EAC5E;;;;;EAAuF;EACvF;;;;;EAAyF;EACzF;;;;;EAA0F;EAC1F;;;;;EAAwF;EACxF;;;;;EAA2F;EAC3F;;;;;EAAwF;EACxF;;;;;EAAyF;CAC1F;AACD;AACA,MAAM,eAAyC,OAAO,OAAO,IAAI;AAEjE,SAAS,aAAa,IAAY;CACjC,OAAQ,aAAa,MACpB,aAAa,OAAO,WAAW,KAAK,WAAW,YAAY,WAAW,KAAK;AAC7E;;AAGA,SAAS,gBAAgB,IAAY;CACpC,OAAO,iBAAiB,EAAE;AAC3B;;AAGA,SAAS,qBAAqB,IAAY;CACzC,OAAO,iBAAiB,EAAE;AAC3B"}
|
package/cjs/ansi/constants.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
//#region ts/ansi/constants.d.ts
|
|
2
|
+
type AnsiColor = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
3
|
+
declare const ANSI_BLACK = 0;
|
|
4
|
+
declare const ANSI_RED = 1;
|
|
5
|
+
declare const ANSI_GREEN = 2;
|
|
6
|
+
declare const ANSI_YELLOW = 3;
|
|
7
|
+
declare const ANSI_BLUE = 4;
|
|
8
|
+
declare const ANSI_MAGENTA = 5;
|
|
9
|
+
declare const ANSI_CYAN = 6;
|
|
10
|
+
declare const ANSI_WHITE = 7;
|
|
11
|
+
type AnsiStyle = 1 | 4;
|
|
12
|
+
declare const ANSI_BRIGHT = 1;
|
|
13
|
+
declare const ANSI_UNDERSCORE = 4;
|
|
14
|
+
declare const ANSI_FOREGROUND = 30;
|
|
15
|
+
declare const ANSI_BACKGROUND = 40;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { ANSI_BACKGROUND, ANSI_BLACK, ANSI_BLUE, ANSI_BRIGHT, ANSI_CYAN, ANSI_FOREGROUND, ANSI_GREEN, ANSI_MAGENTA, ANSI_RED, ANSI_UNDERSCORE, ANSI_WHITE, ANSI_YELLOW, AnsiColor, AnsiStyle };
|
|
15
18
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../ts/ansi/constants.ts"],"mappings":";KAAY;cACC;cACA;cACA;cACA;cACA;cACA;cACA;cACA;KAED;cACC;cACA;cAEA;cACA"}
|
package/cjs/ansi/constants.js
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region ts/ansi/constants.ts
|
|
3
|
+
const ANSI_BLACK = 0;
|
|
4
|
+
const ANSI_RED = 1;
|
|
5
|
+
const ANSI_GREEN = 2;
|
|
6
|
+
const ANSI_YELLOW = 3;
|
|
7
|
+
const ANSI_BLUE = 4;
|
|
8
|
+
const ANSI_MAGENTA = 5;
|
|
9
|
+
const ANSI_CYAN = 6;
|
|
10
|
+
const ANSI_WHITE = 7;
|
|
11
|
+
const ANSI_BRIGHT = 1;
|
|
12
|
+
const ANSI_UNDERSCORE = 4;
|
|
13
|
+
const ANSI_FOREGROUND = 30;
|
|
14
|
+
const ANSI_BACKGROUND = 40;
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.ANSI_BACKGROUND = ANSI_BACKGROUND;
|
|
17
|
+
exports.ANSI_BLACK = ANSI_BLACK;
|
|
18
|
+
exports.ANSI_BLUE = ANSI_BLUE;
|
|
19
|
+
exports.ANSI_BRIGHT = ANSI_BRIGHT;
|
|
20
|
+
exports.ANSI_CYAN = ANSI_CYAN;
|
|
21
|
+
exports.ANSI_FOREGROUND = ANSI_FOREGROUND;
|
|
22
|
+
exports.ANSI_GREEN = ANSI_GREEN;
|
|
23
|
+
exports.ANSI_MAGENTA = ANSI_MAGENTA;
|
|
24
|
+
exports.ANSI_RED = ANSI_RED;
|
|
25
|
+
exports.ANSI_UNDERSCORE = ANSI_UNDERSCORE;
|
|
26
|
+
exports.ANSI_WHITE = ANSI_WHITE;
|
|
27
|
+
exports.ANSI_YELLOW = ANSI_YELLOW;
|
|
28
|
+
|
|
16
29
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../ts/ansi/constants.ts"],"sourcesContent":["export type AnsiColor = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7\nexport const ANSI_BLACK = 0\nexport const ANSI_RED = 1\nexport const ANSI_GREEN = 2\nexport const ANSI_YELLOW = 3\nexport const ANSI_BLUE = 4\nexport const ANSI_MAGENTA = 5\nexport const ANSI_CYAN = 6\nexport const ANSI_WHITE = 7\n\nexport type AnsiStyle = 1 | 4\nexport const ANSI_BRIGHT = 1\nexport const ANSI_UNDERSCORE = 4\n\nexport const ANSI_FOREGROUND = 30\nexport const ANSI_BACKGROUND = 40\n"],"mappings":";;AACA,MAAa,aAAa;AAC1B,MAAa,WAAW;AACxB,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,YAAY;AACzB,MAAa,eAAe;AAC5B,MAAa,YAAY;AACzB,MAAa,aAAa;AAG1B,MAAa,cAAc;AAC3B,MAAa,kBAAkB;AAE/B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB"}
|
package/cjs/ansi/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { AnsiFormatterOptions, createAnsiFormatter } from "./ansiFormatter.js";
|
|
2
|
+
import { ANSI_BACKGROUND, ANSI_BLACK, ANSI_BLUE, ANSI_BRIGHT, ANSI_CYAN, ANSI_FOREGROUND, ANSI_GREEN, ANSI_MAGENTA, ANSI_RED, ANSI_UNDERSCORE, ANSI_WHITE, ANSI_YELLOW, AnsiColor, AnsiStyle } from "./constants.js";
|
|
3
|
+
import { wrapAnsi } from "./wrapAnsi.js";
|
|
4
|
+
export { ANSI_BACKGROUND, ANSI_BLACK, ANSI_BLUE, ANSI_BRIGHT, ANSI_CYAN, ANSI_FOREGROUND, ANSI_GREEN, ANSI_MAGENTA, ANSI_RED, ANSI_UNDERSCORE, ANSI_WHITE, ANSI_YELLOW, AnsiColor, AnsiFormatterOptions, AnsiStyle, createAnsiFormatter, wrapAnsi };
|
package/cjs/ansi/index.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
__exportStar(require("./wrapAnsi.js"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_ansi_constants = require("./constants.js");
|
|
3
|
+
const require_ansi_wrapAnsi = require("./wrapAnsi.js");
|
|
4
|
+
const require_ansi_ansiFormatter = require("./ansiFormatter.js");
|
|
5
|
+
exports.ANSI_BACKGROUND = require_ansi_constants.ANSI_BACKGROUND;
|
|
6
|
+
exports.ANSI_BLACK = require_ansi_constants.ANSI_BLACK;
|
|
7
|
+
exports.ANSI_BLUE = require_ansi_constants.ANSI_BLUE;
|
|
8
|
+
exports.ANSI_BRIGHT = require_ansi_constants.ANSI_BRIGHT;
|
|
9
|
+
exports.ANSI_CYAN = require_ansi_constants.ANSI_CYAN;
|
|
10
|
+
exports.ANSI_FOREGROUND = require_ansi_constants.ANSI_FOREGROUND;
|
|
11
|
+
exports.ANSI_GREEN = require_ansi_constants.ANSI_GREEN;
|
|
12
|
+
exports.ANSI_MAGENTA = require_ansi_constants.ANSI_MAGENTA;
|
|
13
|
+
exports.ANSI_RED = require_ansi_constants.ANSI_RED;
|
|
14
|
+
exports.ANSI_UNDERSCORE = require_ansi_constants.ANSI_UNDERSCORE;
|
|
15
|
+
exports.ANSI_WHITE = require_ansi_constants.ANSI_WHITE;
|
|
16
|
+
exports.ANSI_YELLOW = require_ansi_constants.ANSI_YELLOW;
|
|
17
|
+
exports.createAnsiFormatter = require_ansi_ansiFormatter.createAnsiFormatter;
|
|
18
|
+
exports.wrapAnsi = require_ansi_wrapAnsi.wrapAnsi;
|
package/cjs/ansi/wrapAnsi.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapAnsi.d.ts","
|
|
1
|
+
{"version":3,"file":"wrapAnsi.d.ts","names":[],"sources":["../../ts/ansi/wrapAnsi.ts"],"mappings":";iBAAgB,SAAS,cAAc"}
|
package/cjs/ansi/wrapAnsi.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.wrapAnsi = void 0;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region ts/ansi/wrapAnsi.ts
|
|
4
3
|
function wrapAnsi(text, codes) {
|
|
5
|
-
|
|
4
|
+
return `\u001B[${codes.join(";")}m${text}\u001B[0m`;
|
|
6
5
|
}
|
|
6
|
+
//#endregion
|
|
7
7
|
exports.wrapAnsi = wrapAnsi;
|
|
8
|
+
|
|
8
9
|
//# sourceMappingURL=wrapAnsi.js.map
|
package/cjs/ansi/wrapAnsi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapAnsi.js","
|
|
1
|
+
{"version":3,"file":"wrapAnsi.js","names":[],"sources":["../../ts/ansi/wrapAnsi.ts"],"sourcesContent":["export function wrapAnsi(text: string, codes: number[]) {\n\treturn `\\u001B[${codes.join(';')}m${text}\\u001B[0m`\n}\n"],"mappings":";;AAAA,SAAgB,SAAS,MAAc,OAAiB;CACvD,OAAO,UAAU,MAAM,KAAK,GAAG,EAAE,GAAG,KAAK;AAC1C"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { ColorLogReporterOptions } from "./types.js";
|
|
2
|
+
//#region ts/createColorLogReporter.browser.d.ts
|
|
3
|
+
declare function createColorLogReporter(options?: ColorLogReporterOptions): import("standard-log").ConsoleLogReporter;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { createColorLogReporter };
|
|
3
6
|
//# sourceMappingURL=createColorLogReporter.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createColorLogReporter.browser.d.ts","
|
|
1
|
+
{"version":3,"file":"createColorLogReporter.browser.d.ts","names":[],"sources":["../ts/createColorLogReporter.browser.ts"],"mappings":";;iBAKgB,uBAAuB,UAAU,iDAAuB"}
|