@visulima/pail 2.1.27 → 2.1.29
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/CHANGELOG.md +22 -0
- package/dist/index.browser.cjs +1 -19
- package/dist/index.browser.mjs +1 -14
- package/dist/index.server.cjs +5 -442
- package/dist/index.server.mjs +5 -437
- package/dist/packem_shared/CallerProcessor-DJnmMPMj.cjs +1 -0
- package/dist/packem_shared/CallerProcessor-mNkBei3j.mjs +1 -0
- package/dist/packem_shared/JsonFileReporter-BnxuhH4o.cjs +2 -0
- package/dist/packem_shared/JsonFileReporter-Og8hyKfg.mjs +4 -0
- package/dist/packem_shared/JsonReporter-BdExg5gk.mjs +1 -0
- package/dist/packem_shared/JsonReporter-CjvkrXUp.cjs +1 -0
- package/dist/packem_shared/JsonReporter-DRGJgjAO.mjs +2 -0
- package/dist/packem_shared/JsonReporter-DuF0Ho5i.cjs +2 -0
- package/dist/packem_shared/MessageFormatterProcessor-BjBZzL2D.mjs +1 -0
- package/dist/packem_shared/MessageFormatterProcessor-CCRIUIdT.cjs +1 -0
- package/dist/packem_shared/PrettyReporter-BRFlkORc.mjs +5 -0
- package/dist/packem_shared/PrettyReporter-BuKPqA5T.cjs +5 -0
- package/dist/packem_shared/PrettyReporter-DDsX0vlT.mjs +13 -0
- package/dist/packem_shared/PrettyReporter-Dx1OfdGj.cjs +13 -0
- package/dist/packem_shared/RedactProcessor-BBJysXaX.cjs +1 -0
- package/dist/packem_shared/RedactProcessor-CxKTN42V.mjs +3 -0
- package/dist/packem_shared/SimpleReporter-BV0taliz.mjs +11 -0
- package/dist/packem_shared/SimpleReporter-YuzZZabX.cjs +11 -0
- package/dist/packem_shared/abstract-json-reporter-Z6bVrpPK.cjs +1 -0
- package/dist/packem_shared/abstract-json-reporter-tFmKAzRZ.mjs +1 -0
- package/dist/packem_shared/abstract-pretty-reporter-C2vDqWAQ.cjs +1 -0
- package/dist/packem_shared/abstract-pretty-reporter-CRcf4WZd.mjs +1 -0
- package/dist/packem_shared/constants-BFrKdBPm.cjs +1 -0
- package/dist/packem_shared/constants-BMS51p6Y.mjs +1 -0
- package/dist/packem_shared/format-label-CKRxcWAQ.cjs +8 -0
- package/dist/packem_shared/format-label-D2xt_3df.mjs +8 -0
- package/dist/packem_shared/get-longest-label-7LkwzzHo.cjs +1 -0
- package/dist/packem_shared/get-longest-label-B0NrI-o2.mjs +1 -0
- package/dist/packem_shared/pail.browser-DC6QwLTj.cjs +1 -0
- package/dist/packem_shared/pail.browser-DkNIDzgk.mjs +1 -0
- package/dist/packem_shared/write-console-log-3G15muTS.cjs +1 -0
- package/dist/packem_shared/write-console-log-BP95fgQZ.mjs +1 -0
- package/dist/packem_shared/write-stream-CD8XFv1L.mjs +1 -0
- package/dist/packem_shared/write-stream-Dl-usQqh.cjs +1 -0
- package/dist/processor.browser.cjs +1 -11
- package/dist/processor.browser.mjs +1 -2
- package/dist/processor.server.cjs +1 -13
- package/dist/processor.server.mjs +1 -3
- package/dist/reporter.browser.cjs +1 -11
- package/dist/reporter.browser.mjs +1 -2
- package/dist/reporter.server.cjs +1 -15
- package/dist/reporter.server.mjs +1 -4
- package/package.json +2 -2
- package/dist/packem_shared/CallerProcessor-CNhuyGAa.mjs +0 -58
- package/dist/packem_shared/CallerProcessor-DJ5euiUK.cjs +0 -60
- package/dist/packem_shared/JsonFileReporter-BazAMbEI.mjs +0 -133
- package/dist/packem_shared/JsonFileReporter-PNmBNTr1.cjs +0 -135
- package/dist/packem_shared/JsonReporter-CKWF4Ibl.mjs +0 -20
- package/dist/packem_shared/JsonReporter-CcOVaf3A.cjs +0 -34
- package/dist/packem_shared/JsonReporter-Cg5R1FXn.cjs +0 -22
- package/dist/packem_shared/JsonReporter-DFFyVZyh.mjs +0 -32
- package/dist/packem_shared/MessageFormatterProcessor-Cd4HntPG.mjs +0 -53
- package/dist/packem_shared/MessageFormatterProcessor-t4t6CpzV.cjs +0 -55
- package/dist/packem_shared/PrettyReporter-3oMWkX6j.cjs +0 -200
- package/dist/packem_shared/PrettyReporter-Bx3QLZrW.mjs +0 -162
- package/dist/packem_shared/PrettyReporter-C2hjNe-y.mjs +0 -192
- package/dist/packem_shared/PrettyReporter-mFCjMb0i.cjs +0 -168
- package/dist/packem_shared/RedactProcessor-CfNkF2lC.mjs +0 -26
- package/dist/packem_shared/RedactProcessor-DWE5iqAQ.cjs +0 -26
- package/dist/packem_shared/SimpleReporter-CXXqr1h3.cjs +0 -186
- package/dist/packem_shared/SimpleReporter-TOcMSqJb.mjs +0 -178
- package/dist/packem_shared/abstract-json-reporter-okwLqT9k.cjs +0 -57
- package/dist/packem_shared/abstract-json-reporter-sxnmNIlg.mjs +0 -55
- package/dist/packem_shared/abstract-pretty-reporter-BR_6_JVa.cjs +0 -49
- package/dist/packem_shared/abstract-pretty-reporter-izJgxoMv.mjs +0 -46
- package/dist/packem_shared/constants-BYYZ5WNW.mjs +0 -114
- package/dist/packem_shared/constants-DHfYGxxG.cjs +0 -118
- package/dist/packem_shared/format-label-DYEhjrTZ.cjs +0 -621
- package/dist/packem_shared/format-label-Uj-cxY3j.mjs +0 -609
- package/dist/packem_shared/get-longest-label-CM8kLFWH.mjs +0 -11
- package/dist/packem_shared/get-longest-label-CQ7lRhgD.cjs +0 -13
- package/dist/packem_shared/pail.browser-Bp1fz428.mjs +0 -384
- package/dist/packem_shared/pail.browser-O53Q_cus.cjs +0 -387
- package/dist/packem_shared/write-console-log-Cu0-IDN-.cjs +0 -18
- package/dist/packem_shared/write-console-log-Tptfzg9D.mjs +0 -16
- package/dist/packem_shared/write-stream-BBAF33Zm.mjs +0 -8
- package/dist/packem_shared/write-stream-CkNf2Ju8.cjs +0 -10
package/dist/index.server.mjs
CHANGED
|
@@ -1,437 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { E as EMPTY_SYMBOL } from './packem_shared/constants-BYYZ5WNW.mjs';
|
|
7
|
-
import { w as writeStream } from './packem_shared/write-stream-BBAF33Zm.mjs';
|
|
8
|
-
import MessageFormatterProcessor from './packem_shared/MessageFormatterProcessor-Cd4HntPG.mjs';
|
|
9
|
-
import { PrettyReporter } from './packem_shared/PrettyReporter-C2hjNe-y.mjs';
|
|
10
|
-
|
|
11
|
-
var __defProp$5 = Object.defineProperty;
|
|
12
|
-
var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
13
|
-
class InteractiveManager {
|
|
14
|
-
static {
|
|
15
|
-
__name$5(this, "InteractiveManager");
|
|
16
|
-
}
|
|
17
|
-
#stream;
|
|
18
|
-
#isActive = false;
|
|
19
|
-
#isSuspended = false;
|
|
20
|
-
#lastLength = 0;
|
|
21
|
-
#outside = 0;
|
|
22
|
-
constructor(stdout, stderr) {
|
|
23
|
-
this.#stream = {
|
|
24
|
-
stderr,
|
|
25
|
-
stdout
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Last printed rows count
|
|
30
|
-
*/
|
|
31
|
-
get lastLength() {
|
|
32
|
-
return this.#lastLength;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Rows count outside editable area
|
|
36
|
-
*/
|
|
37
|
-
get outside() {
|
|
38
|
-
return this.#outside;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Hook activity status
|
|
42
|
-
*/
|
|
43
|
-
get isHooked() {
|
|
44
|
-
return this.#isActive;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Suspend status for active hooks
|
|
48
|
-
*/
|
|
49
|
-
get isSuspended() {
|
|
50
|
-
return this.#isSuspended;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Removes from the bottom of output up the specified count of lines
|
|
54
|
-
*
|
|
55
|
-
* @param stream - Stream to remove lines from
|
|
56
|
-
* @param count - lines count to remove
|
|
57
|
-
*/
|
|
58
|
-
erase(stream, count = this.#lastLength) {
|
|
59
|
-
if (this.#stream[stream] === void 0) {
|
|
60
|
-
throw new TypeError(`Stream "${stream}" is not available`);
|
|
61
|
-
}
|
|
62
|
-
this.#stream[stream].erase(count);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Hook stdout and stderr streams
|
|
66
|
-
* @returns Success status
|
|
67
|
-
*/
|
|
68
|
-
hook() {
|
|
69
|
-
if (!this.#isActive) {
|
|
70
|
-
Object.values(this.#stream).forEach((hook) => hook.active());
|
|
71
|
-
this._clear(true);
|
|
72
|
-
}
|
|
73
|
-
return this.#isActive;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Resume suspend hooks
|
|
77
|
-
*
|
|
78
|
-
* @param stream - Stream to resume
|
|
79
|
-
* @param eraseRowCount - erase output rows count
|
|
80
|
-
*/
|
|
81
|
-
resume(stream, eraseRowCount) {
|
|
82
|
-
if (this.#isSuspended) {
|
|
83
|
-
this.#isSuspended = false;
|
|
84
|
-
if (eraseRowCount) {
|
|
85
|
-
this.erase(stream, eraseRowCount);
|
|
86
|
-
}
|
|
87
|
-
this.#lastLength = 0;
|
|
88
|
-
Object.values(this.#stream).forEach((hook) => hook.active());
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Suspend active hooks for external output
|
|
93
|
-
*
|
|
94
|
-
* @param stream - Stream to suspend
|
|
95
|
-
* @param erase - erase output
|
|
96
|
-
*/
|
|
97
|
-
suspend(stream, erase = true) {
|
|
98
|
-
if (!this.#isSuspended) {
|
|
99
|
-
this.#isSuspended = true;
|
|
100
|
-
if (erase) {
|
|
101
|
-
this.erase(stream);
|
|
102
|
-
}
|
|
103
|
-
Object.values(this.#stream).forEach((hook) => hook.renew());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Unhooks both stdout and stderr streams and print their story of logs
|
|
108
|
-
*
|
|
109
|
-
* @param separateHistory - If `true`, will add an empty line to the history output for individual recorded lines and console logs
|
|
110
|
-
*
|
|
111
|
-
* @returns Success status
|
|
112
|
-
*/
|
|
113
|
-
unhook(separateHistory = true) {
|
|
114
|
-
if (this.#isActive) {
|
|
115
|
-
Object.values(this.#stream).forEach((hook) => hook.inactive(separateHistory));
|
|
116
|
-
this._clear();
|
|
117
|
-
}
|
|
118
|
-
return !this.#isActive;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Update output
|
|
122
|
-
*
|
|
123
|
-
* @param stream - Stream to write to
|
|
124
|
-
* @param rows - Text lines to write to standard output
|
|
125
|
-
* @param from - Index of the line starting from which the contents of the terminal are being overwritten
|
|
126
|
-
*/
|
|
127
|
-
update(stream, rows, from = 0) {
|
|
128
|
-
if (rows.length > 0) {
|
|
129
|
-
if (this.#stream[stream] === void 0) {
|
|
130
|
-
throw new TypeError(`Stream "${stream}" is not available`);
|
|
131
|
-
}
|
|
132
|
-
const hook = this.#stream[stream];
|
|
133
|
-
const { columns: width, rows: height } = terminalSize();
|
|
134
|
-
const position = from > height ? height - 1 : Math.max(0, Math.min(height - 1, from));
|
|
135
|
-
const actualLength = this.lastLength - position;
|
|
136
|
-
const outside = Math.max(actualLength - height, this.outside);
|
|
137
|
-
let output = rows.reduce(
|
|
138
|
-
(accumulator, row) => [
|
|
139
|
-
...accumulator,
|
|
140
|
-
wrapAnsi(row, width, {
|
|
141
|
-
hard: true,
|
|
142
|
-
trim: false,
|
|
143
|
-
wordWrap: true
|
|
144
|
-
})
|
|
145
|
-
],
|
|
146
|
-
[]
|
|
147
|
-
);
|
|
148
|
-
if (height <= actualLength) {
|
|
149
|
-
hook.erase(height);
|
|
150
|
-
if (position < outside) {
|
|
151
|
-
output = output.slice(outside - position + 1);
|
|
152
|
-
}
|
|
153
|
-
} else if (actualLength) {
|
|
154
|
-
hook.erase(actualLength);
|
|
155
|
-
}
|
|
156
|
-
hook.write(output.join("\n") + "\n");
|
|
157
|
-
this.#lastLength = outside ? outside + output.length + 1 : output.length;
|
|
158
|
-
this.#outside = Math.max(this.lastLength - height, this.outside);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
_clear(status = false) {
|
|
162
|
-
this.#isActive = status;
|
|
163
|
-
this.#lastLength = 0;
|
|
164
|
-
this.#outside = 0;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
var __defProp$4 = Object.defineProperty;
|
|
169
|
-
var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
|
|
170
|
-
const ESC = "\x1B[";
|
|
171
|
-
const eraseScreen = ESC + "2J";
|
|
172
|
-
const eraseLine = ESC + "2K";
|
|
173
|
-
const cursorLeft = ESC + "G";
|
|
174
|
-
const cursorUp = /* @__PURE__ */ __name$4((count = 1) => ESC + count + "A", "cursorUp");
|
|
175
|
-
const clearTerminal = process.platform === "win32" ? `${eraseScreen}${ESC}0f` : (
|
|
176
|
-
// 1. Erases the screen (Only done in case `2` is not supported)
|
|
177
|
-
// 2. Erases the whole screen including scrollback buffer
|
|
178
|
-
// 3. Moves cursor to the top-left position
|
|
179
|
-
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
180
|
-
`${eraseScreen}${ESC}3J${ESC}H`
|
|
181
|
-
);
|
|
182
|
-
const cursorHide = ESC + "?25l";
|
|
183
|
-
const cursorShow = ESC + "?25h";
|
|
184
|
-
const eraseLines = /* @__PURE__ */ __name$4((count) => {
|
|
185
|
-
let clear = "";
|
|
186
|
-
for (let index = 0; index < count; index++) {
|
|
187
|
-
clear += eraseLine + (index < count - 1 ? cursorUp() : "");
|
|
188
|
-
}
|
|
189
|
-
if (count) {
|
|
190
|
-
clear += cursorLeft;
|
|
191
|
-
}
|
|
192
|
-
return clear;
|
|
193
|
-
}, "eraseLines");
|
|
194
|
-
|
|
195
|
-
var __defProp$3 = Object.defineProperty;
|
|
196
|
-
var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
|
|
197
|
-
class InteractiveStreamHook {
|
|
198
|
-
static {
|
|
199
|
-
__name$3(this, "InteractiveStreamHook");
|
|
200
|
-
}
|
|
201
|
-
static DRAIN = true;
|
|
202
|
-
#decoder = new StringDecoder();
|
|
203
|
-
#history = [];
|
|
204
|
-
#method;
|
|
205
|
-
#stream;
|
|
206
|
-
constructor(stream) {
|
|
207
|
-
this.#method = stream.write;
|
|
208
|
-
this.#stream = stream;
|
|
209
|
-
}
|
|
210
|
-
active() {
|
|
211
|
-
this.write(cursorHide);
|
|
212
|
-
this.#stream.write = (data, ...arguments_) => {
|
|
213
|
-
const callback = arguments_.at(-1);
|
|
214
|
-
this.#history.push(
|
|
215
|
-
this.#decoder.write(
|
|
216
|
-
typeof data === "string" ? Buffer.from(data, typeof arguments_[0] === "string" ? arguments_[0] : void 0) : Buffer.from(data)
|
|
217
|
-
)
|
|
218
|
-
);
|
|
219
|
-
if (typeof callback === "function") {
|
|
220
|
-
callback();
|
|
221
|
-
}
|
|
222
|
-
return InteractiveStreamHook.DRAIN;
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
erase(count) {
|
|
226
|
-
if (count > 0) {
|
|
227
|
-
this.write(eraseLines(count + 1));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
inactive(separateHistory = false) {
|
|
231
|
-
if (this.#history.length > 0) {
|
|
232
|
-
if (separateHistory) {
|
|
233
|
-
this.write("\n");
|
|
234
|
-
}
|
|
235
|
-
this.#history.forEach((element) => {
|
|
236
|
-
this.write(element);
|
|
237
|
-
});
|
|
238
|
-
this.#history = [];
|
|
239
|
-
}
|
|
240
|
-
this.renew();
|
|
241
|
-
}
|
|
242
|
-
renew() {
|
|
243
|
-
this.#stream.write = this.#method;
|
|
244
|
-
this.write(cursorShow);
|
|
245
|
-
}
|
|
246
|
-
write(message) {
|
|
247
|
-
this.#method.apply(this.#stream, [message]);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
var __defProp$2 = Object.defineProperty;
|
|
252
|
-
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
253
|
-
class RawReporter {
|
|
254
|
-
static {
|
|
255
|
-
__name$2(this, "RawReporter");
|
|
256
|
-
}
|
|
257
|
-
#stdout;
|
|
258
|
-
#stderr;
|
|
259
|
-
#interactiveManager;
|
|
260
|
-
#interactive = false;
|
|
261
|
-
#inspectOptions;
|
|
262
|
-
constructor(inspectOptions = {}) {
|
|
263
|
-
this.#stdout = stdout;
|
|
264
|
-
this.#stderr = stderr;
|
|
265
|
-
this.#inspectOptions = inspectOptions;
|
|
266
|
-
}
|
|
267
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
268
|
-
setStdout(stdout_) {
|
|
269
|
-
this.#stdout = stdout_;
|
|
270
|
-
}
|
|
271
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
272
|
-
setStderr(stderr_) {
|
|
273
|
-
this.#stderr = stderr_;
|
|
274
|
-
}
|
|
275
|
-
setInteractiveManager(manager) {
|
|
276
|
-
this.#interactiveManager = manager;
|
|
277
|
-
}
|
|
278
|
-
setIsInteractive(interactive) {
|
|
279
|
-
this.#interactive = interactive;
|
|
280
|
-
}
|
|
281
|
-
log(meta) {
|
|
282
|
-
const { context, groups, message, type } = meta;
|
|
283
|
-
const items = [];
|
|
284
|
-
if (message !== EMPTY_SYMBOL) {
|
|
285
|
-
const formattedMessage = typeof message === "string" ? message : inspect(message, this.#inspectOptions);
|
|
286
|
-
items.push(formattedMessage);
|
|
287
|
-
}
|
|
288
|
-
if (context) {
|
|
289
|
-
items.push(
|
|
290
|
-
...context.map((value) => {
|
|
291
|
-
if (typeof value === "object") {
|
|
292
|
-
return " " + inspect(value, this.#inspectOptions);
|
|
293
|
-
}
|
|
294
|
-
return " " + value;
|
|
295
|
-
})
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
const streamType = ["error", "trace", "warn"].includes(type.level) ? "stderr" : "stdout";
|
|
299
|
-
const stream = streamType === "stderr" ? this.#stderr : this.#stdout;
|
|
300
|
-
const groupSpaces = groups.map(() => " ").join("");
|
|
301
|
-
if (this.#interactive && this.#interactiveManager !== void 0 && stream.isTTY) {
|
|
302
|
-
this.#interactiveManager.update(streamType, (groupSpaces + items.join("")).split("\n"), 0);
|
|
303
|
-
} else {
|
|
304
|
-
writeStream(groupSpaces + items.join(""), stream);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
var __defProp$1 = Object.defineProperty;
|
|
310
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
311
|
-
class PailServerImpl extends PailBrowserImpl {
|
|
312
|
-
constructor(options) {
|
|
313
|
-
const { interactive, rawReporter, reporters, stderr, stdout, ...rest } = options;
|
|
314
|
-
super(rest);
|
|
315
|
-
this.options = options;
|
|
316
|
-
this.interactive = interactive ?? false;
|
|
317
|
-
this.stdout = stdout;
|
|
318
|
-
this.stderr = stderr;
|
|
319
|
-
if (this.interactive) {
|
|
320
|
-
this.interactiveManager = new InteractiveManager(new InteractiveStreamHook(this.stdout), new InteractiveStreamHook(this.stderr));
|
|
321
|
-
}
|
|
322
|
-
if (Array.isArray(reporters)) {
|
|
323
|
-
this.registerReporters(reporters);
|
|
324
|
-
}
|
|
325
|
-
this.rawReporter = this.extendReporter(options.rawReporter ?? new RawReporter());
|
|
326
|
-
}
|
|
327
|
-
static {
|
|
328
|
-
__name$1(this, "PailServerImpl");
|
|
329
|
-
}
|
|
330
|
-
stdout;
|
|
331
|
-
stderr;
|
|
332
|
-
interactiveManager;
|
|
333
|
-
interactive;
|
|
334
|
-
// @ts-expect-error - this returns a different type
|
|
335
|
-
scope(...name) {
|
|
336
|
-
if (name.length === 0) {
|
|
337
|
-
throw new Error("No scope name was defined.");
|
|
338
|
-
}
|
|
339
|
-
this.scopeName = name.flat();
|
|
340
|
-
return this;
|
|
341
|
-
}
|
|
342
|
-
getInteractiveManager() {
|
|
343
|
-
return this.interactiveManager;
|
|
344
|
-
}
|
|
345
|
-
wrapStd() {
|
|
346
|
-
this._wrapStream(this.stdout, "log");
|
|
347
|
-
this._wrapStream(this.stderr, "log");
|
|
348
|
-
}
|
|
349
|
-
restoreStd() {
|
|
350
|
-
this._restoreStream(this.stdout);
|
|
351
|
-
this._restoreStream(this.stderr);
|
|
352
|
-
}
|
|
353
|
-
wrapAll() {
|
|
354
|
-
this.wrapConsole();
|
|
355
|
-
this.wrapStd();
|
|
356
|
-
}
|
|
357
|
-
restoreAll() {
|
|
358
|
-
this.restoreConsole();
|
|
359
|
-
this.restoreStd();
|
|
360
|
-
}
|
|
361
|
-
clear() {
|
|
362
|
-
this.stdout.write(clearTerminal);
|
|
363
|
-
this.stderr.write(clearTerminal);
|
|
364
|
-
}
|
|
365
|
-
extendReporter(reporter) {
|
|
366
|
-
if (typeof reporter.setStdout === "function") {
|
|
367
|
-
reporter.setStdout(this.stdout);
|
|
368
|
-
}
|
|
369
|
-
if (typeof reporter.setStderr === "function") {
|
|
370
|
-
reporter.setStderr(this.stderr);
|
|
371
|
-
}
|
|
372
|
-
if (typeof reporter.setLoggerTypes === "function") {
|
|
373
|
-
reporter.setLoggerTypes(this.types);
|
|
374
|
-
}
|
|
375
|
-
if (typeof reporter.setStringify === "function") {
|
|
376
|
-
reporter.setStringify(this.stringify);
|
|
377
|
-
}
|
|
378
|
-
if (typeof reporter.setIsInteractive === "function") {
|
|
379
|
-
reporter.setIsInteractive(this.interactive);
|
|
380
|
-
}
|
|
381
|
-
if (this.interactive && typeof reporter.setInteractiveManager === "function") {
|
|
382
|
-
reporter.setInteractiveManager(this.interactiveManager);
|
|
383
|
-
}
|
|
384
|
-
return reporter;
|
|
385
|
-
}
|
|
386
|
-
_wrapStream(stream, type) {
|
|
387
|
-
if (!stream) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
if (!stream.__write) {
|
|
391
|
-
stream.__write = stream.write;
|
|
392
|
-
}
|
|
393
|
-
stream.write = (data) => {
|
|
394
|
-
this[type](String(data).trim());
|
|
395
|
-
};
|
|
396
|
-
}
|
|
397
|
-
// eslint-disable-next-line class-methods-use-this
|
|
398
|
-
_restoreStream(stream) {
|
|
399
|
-
if (!stream) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (stream.__write) {
|
|
403
|
-
stream.write = stream.__write;
|
|
404
|
-
delete stream.__write;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
const PailServer = PailServerImpl;
|
|
409
|
-
|
|
410
|
-
var __defProp = Object.defineProperty;
|
|
411
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
412
|
-
const _getDefaultLogLevel = /* @__PURE__ */ __name(() => {
|
|
413
|
-
if (env.NODE_ENV === "debug" || env.DEBUG !== void 0) {
|
|
414
|
-
return "debug";
|
|
415
|
-
}
|
|
416
|
-
if (env.NODE_ENV === "test") {
|
|
417
|
-
return "warning";
|
|
418
|
-
}
|
|
419
|
-
return "informational";
|
|
420
|
-
}, "_getDefaultLogLevel");
|
|
421
|
-
const createPail = /* @__PURE__ */ __name((options) => {
|
|
422
|
-
let logLevel = _getDefaultLogLevel();
|
|
423
|
-
if (env.PAIL_LOG_LEVEL !== void 0) {
|
|
424
|
-
logLevel = env.PAIL_LOG_LEVEL;
|
|
425
|
-
}
|
|
426
|
-
return new PailServer({
|
|
427
|
-
logLevel,
|
|
428
|
-
processors: [new MessageFormatterProcessor()],
|
|
429
|
-
reporters: [new PrettyReporter()],
|
|
430
|
-
stderr,
|
|
431
|
-
stdout,
|
|
432
|
-
...options
|
|
433
|
-
});
|
|
434
|
-
}, "createPail");
|
|
435
|
-
const pail = createPail();
|
|
436
|
-
|
|
437
|
-
export { createPail, pail };
|
|
1
|
+
var L=Object.defineProperty;var n=(r,t)=>L(r,"name",{value:t,configurable:!0});import{stdout as m,stderr as y,env as f}from"node:process";import{O as I,T as $}from"./packem_shared/format-label-D2xt_3df.mjs";import{StringDecoder as O}from"node:string_decoder";import{a as j}from"./packem_shared/pail.browser-DkNIDzgk.mjs";import{inspect as v}from"@visulima/inspector";import{E as M}from"./packem_shared/constants-BMS51p6Y.mjs";import{n as P}from"./packem_shared/write-stream-CD8XFv1L.mjs";import R from"./packem_shared/MessageFormatterProcessor-BjBZzL2D.mjs";import{PrettyReporter as x}from"./packem_shared/PrettyReporter-DDsX0vlT.mjs";var A=Object.defineProperty,T=n((r,t)=>A(r,"name",{value:t,configurable:!0}),"l$1");let N=class{static{n(this,"v")}static{T(this,"InteractiveManager")}#t;#e=!1;#r=!1;#s=0;#i=0;constructor(t,e){this.#t={stderr:e,stdout:t}}get lastLength(){return this.#s}get outside(){return this.#i}get isHooked(){return this.#e}get isSuspended(){return this.#r}erase(t,e=this.#s){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);this.#t[t].erase(e)}hook(){return this.#e||(Object.values(this.#t).forEach(t=>t.active()),this._clear(!0)),this.#e}resume(t,e){this.#r&&(this.#r=!1,e&&this.erase(t,e),this.#s=0,Object.values(this.#t).forEach(s=>s.active()))}suspend(t,e=!0){this.#r||(this.#r=!0,e&&this.erase(t),Object.values(this.#t).forEach(s=>s.renew()))}unhook(t=!0){return this.#e&&(Object.values(this.#t).forEach(e=>e.inactive(t)),this._clear()),!this.#e}update(t,e,s=0){if(e.length>0){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);const a=this.#t[t],{columns:p,rows:i}=I(),c=s>i?i-1:Math.max(0,Math.min(i-1,s)),u=this.lastLength-c,l=Math.max(u-i,this.outside);let o=e.reduce((b,E)=>[...b,$(E,p,{hard:!0,trim:!1,wordWrap:!0})],[]);i<=u?(a.erase(i),c<l&&(o=o.slice(l-c+1))):u&&a.erase(u),a.write(o.join(`
|
|
2
|
+
`)+`
|
|
3
|
+
`),this.#s=l?l+o.length+1:o.length,this.#i=Math.max(this.lastLength-i,this.outside)}}_clear(t=!1){this.#e=t,this.#s=0,this.#i=0}};var D=Object.defineProperty,S=n((r,t)=>D(r,"name",{value:t,configurable:!0}),"n$1");const h="\x1B[",w=h+"2J",B=h+"2K",k=h+"G",G=S((r=1)=>h+r+"A","cursorUp"),g=process.platform==="win32"?`${w}${h}0f`:`${w}${h}3J${h}H`,H=h+"?25l",V=h+"?25h",Y=S(r=>{let t="";for(let e=0;e<r;e++)t+=B+(e<r-1?G():"");return r&&(t+=k),t},"eraseLines");var C=Object.defineProperty,J=n((r,t)=>C(r,"name",{value:t,configurable:!0}),"s$1");class d{static{n(this,"t")}static{J(this,"InteractiveStreamHook")}static DRAIN=!0;#t=new O;#e=[];#r;#s;constructor(t){this.#r=t.write,this.#s=t}active(){this.write(H),this.#s.write=(t,...e)=>{const s=e.at(-1);return this.#e.push(this.#t.write(typeof t=="string"?Buffer.from(t,typeof e[0]=="string"?e[0]:void 0):Buffer.from(t))),typeof s=="function"&&s(),d.DRAIN}}erase(t){t>0&&this.write(Y(t+1))}inactive(t=!1){this.#e.length>0&&(t&&this.write(`
|
|
4
|
+
`),this.#e.forEach(e=>{this.write(e)}),this.#e=[]),this.renew()}renew(){this.#s.write=this.#r,this.write(V)}write(t){this.#r.apply(this.#s,[t])}}var U=Object.defineProperty,K=n((r,t)=>U(r,"name",{value:t,configurable:!0}),"c");let W=class{static{n(this,"v")}static{K(this,"RawReporter")}#t;#e;#r;#s=!1;#i;constructor(t={}){this.#t=m,this.#e=y,this.#i=t}setStdout(t){this.#t=t}setStderr(t){this.#e=t}setInteractiveManager(t){this.#r=t}setIsInteractive(t){this.#s=t}log(t){const{context:e,groups:s,message:a,type:p}=t,i=[];if(a!==M){const o=typeof a=="string"?a:v(a,this.#i);i.push(o)}e&&i.push(...e.map(o=>typeof o=="object"?" "+v(o,this.#i):" "+o));const c=["error","trace","warn"].includes(p.level)?"stderr":"stdout",u=c==="stderr"?this.#e:this.#t,l=s.map(()=>" ").join("");this.#s&&this.#r!==void 0&&u.isTTY?this.#r.update(c,(l+i.join("")).split(`
|
|
5
|
+
`),0):P(l+i.join(""),u)}};var q=Object.defineProperty,z=n((r,t)=>q(r,"name",{value:t,configurable:!0}),"a$1");class F extends j{static{n(this,"v")}constructor(t){const{interactive:e,rawReporter:s,reporters:a,stderr:p,stdout:i,...c}=t;super(c),this.options=t,this.interactive=e??!1,this.stdout=i,this.stderr=p,this.interactive&&(this.interactiveManager=new N(new d(this.stdout),new d(this.stderr))),Array.isArray(a)&&this.registerReporters(a),this.rawReporter=this.extendReporter(t.rawReporter??new W)}static{z(this,"PailServerImpl")}stdout;stderr;interactiveManager;interactive;scope(...t){if(t.length===0)throw new Error("No scope name was defined.");return this.scopeName=t.flat(),this}getInteractiveManager(){return this.interactiveManager}wrapStd(){this._wrapStream(this.stdout,"log"),this._wrapStream(this.stderr,"log")}restoreStd(){this._restoreStream(this.stdout),this._restoreStream(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(g),this.stderr.write(g)}extendReporter(t){return typeof t.setStdout=="function"&&t.setStdout(this.stdout),typeof t.setStderr=="function"&&t.setStderr(this.stderr),typeof t.setLoggerTypes=="function"&&t.setLoggerTypes(this.types),typeof t.setStringify=="function"&&t.setStringify(this.stringify),typeof t.setIsInteractive=="function"&&t.setIsInteractive(this.interactive),this.interactive&&typeof t.setInteractiveManager=="function"&&t.setInteractiveManager(this.interactiveManager),t}_wrapStream(t,e){t&&(t.__write||(t.__write=t.write),t.write=s=>{this[e](String(s).trim())})}_restoreStream(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}}const Q=F;var X=Object.defineProperty,_=n((r,t)=>X(r,"name",{value:t,configurable:!0}),"o");const Z=_(()=>f.NODE_ENV==="debug"||f.DEBUG!==void 0?"debug":f.NODE_ENV==="test"?"warning":"informational","_getDefaultLogLevel"),tt=_(r=>{let t=Z();return f.PAIL_LOG_LEVEL!==void 0&&(t=f.PAIL_LOG_LEVEL),new Q({logLevel:t,processors:[new R],reporters:[new x],stderr:y,stdout:m,...r})},"createPail"),ft=tt();export{tt as createPail,ft as pail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var n=(a,e)=>u(a,"name",{value:e,configurable:!0});var m=Object.defineProperty,c=n((a,e)=>m(a,"name",{value:e,configurable:!0}),"u");const o=c(()=>{const a=Error.prepareStackTrace;try{let e=[];Error.prepareStackTrace=(i,r)=>{const t=r.slice(1);return e=t,t};const l=e.reduce((i,r)=>(r.isNative()||r.getFileName()?.includes("pail/dist")||i.push({columnNumber:r.getColumnNumber(),fileName:r.getFileName(),lineNumber:r.getLineNumber()}),i),[])[0];return l?{columnNumber:l.columnNumber??void 0,fileName:l.fileName,lineNumber:l.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=a}},"getCallerFilename");var s=Object.defineProperty,N=n((a,e)=>s(a,"name",{value:e,configurable:!0}),"r");class b{static{n(this,"a")}static{N(this,"CallerProcessor")}process(e){const{columnNumber:l,fileName:i,lineNumber:r}=o();return e.file={column:l,line:r,name:i},e}}module.exports=b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var n=(a,e)=>u(a,"name",{value:e,configurable:!0});var m=Object.defineProperty,c=n((a,e)=>m(a,"name",{value:e,configurable:!0}),"u");const o=c(()=>{const a=Error.prepareStackTrace;try{let e=[];Error.prepareStackTrace=(i,r)=>{const t=r.slice(1);return e=t,t};const l=e.reduce((i,r)=>(r.isNative()||r.getFileName()?.includes("pail/dist")||i.push({columnNumber:r.getColumnNumber(),fileName:r.getFileName(),lineNumber:r.getLineNumber()}),i),[])[0];return l?{columnNumber:l.columnNumber??void 0,fileName:l.fileName,lineNumber:l.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=a}},"getCallerFilename");var s=Object.defineProperty,N=n((a,e)=>s(a,"name",{value:e,configurable:!0}),"r");class f{static{n(this,"a")}static{N(this,"CallerProcessor")}process(e){const{columnNumber:l,fileName:i,lineNumber:r}=o();return e.file={column:l,line:r,name:i},e}}export{f as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var s=(e,t)=>n(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./abstract-json-reporter-Z6bVrpPK.cjs");var h=Object.defineProperty,l=s((e,t)=>h(e,"name",{value:t,configurable:!0}),"e");class c{static{s(this,"n")}static{l(this,"SafeStreamHandler")}#t=!0;#e;#r;constructor(t,r){this.#e=t,this.#r=r}write(t){this.writeStream(t)}end(...t){this.#e.end(...t)}get isReady(){return this.#t}writeStream(t){if(!this.#t){console.warn("Stream busy: "+this.#r+'. Write will be dropped: "'+t+'"');return}this.#t=!1,this.#e.on("error",r=>{throw r}),this.#e.on("drain",()=>{this.#t=!0}),this.#e.on("finish",()=>{this.#t=!0}),this.#t=this.#e.write(t,()=>{})}}var u=Object.defineProperty,d=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"r$1");class m{static{s(this,"o")}static{d(this,"RotatingFileStream")}#t;#e;#r;#s;#i;constructor(t,r=!1,i={}){if(this.#t=t,this.#e=r,this.#s=i,!this.#e){try{this.#i=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}this.#r=this.#i(this.#t,i)}}write(t){let r=this.#r;this.#e&&(r=this.#i(this.#t,this.#s));const i=new c(r,this.#t);i.write(t),this.#e&&i.end()}end(){this.#r!==void 0&&this.#r.end()}}var f=Object.defineProperty,p=s((e,t)=>f(e,"name",{value:t,configurable:!0}),"r");class w extends o.A{static{s(this,"JsonFileReporter")}static{p(this,"JsonFileReporter")}stream;constructor(t){super();const{filePath:r,writeImmediately:i=!1,...a}=t;this.stream=new m(r,i,{compress:"gzip",interval:"1d",size:"10M",...a})}_log(t){this.stream.write(t+`
|
|
2
|
+
`)}}exports.JsonFileReporter=w;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var h=Object.defineProperty;var s=(e,t)=>h(e,"name",{value:t,configurable:!0});import{A as n}from"./abstract-json-reporter-tFmKAzRZ.mjs";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
var o=Object.defineProperty,c=s((e,t)=>o(e,"name",{value:t,configurable:!0}),"e");class l{static{s(this,"n")}static{c(this,"SafeStreamHandler")}#t=!0;#e;#r;constructor(t,r){this.#e=t,this.#r=r}write(t){this.writeStream(t)}end(...t){this.#e.end(...t)}get isReady(){return this.#t}writeStream(t){if(!this.#t){console.warn("Stream busy: "+this.#r+'. Write will be dropped: "'+t+'"');return}this.#t=!1,this.#e.on("error",r=>{throw r}),this.#e.on("drain",()=>{this.#t=!0}),this.#e.on("finish",()=>{this.#t=!0}),this.#t=this.#e.write(t,()=>{})}}var u=Object.defineProperty,m=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"r$1");class d{static{s(this,"o")}static{m(this,"RotatingFileStream")}#t;#e;#r;#s;#i;constructor(t,r=!1,i={}){if(this.#t=t,this.#e=r,this.#s=i,!this.#e){try{this.#i=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}this.#r=this.#i(this.#t,i)}}write(t){let r=this.#r;this.#e&&(r=this.#i(this.#t,this.#s));const i=new l(r,this.#t);i.write(t),this.#e&&i.end()}end(){this.#r!==void 0&&this.#r.end()}}var f=Object.defineProperty,p=s((e,t)=>f(e,"name",{value:t,configurable:!0}),"r");class v extends n{static{s(this,"JsonFileReporter")}static{p(this,"JsonFileReporter")}stream;constructor(t){super();const{filePath:r,writeImmediately:i=!1,...a}=t;this.stream=new d(r,i,{compress:"gzip",interval:"1d",size:"10M",...a})}_log(t){this.stream.write(t+`
|
|
4
|
+
`)}}export{v as JsonFileReporter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var t=(e,r)=>s(e,"name",{value:r,configurable:!0});import{t as a}from"./write-console-log-BP95fgQZ.mjs";import{A as p}from"./abstract-json-reporter-tFmKAzRZ.mjs";var c=Object.defineProperty,n=t((e,r)=>c(e,"name",{value:r,configurable:!0}),"e");class l extends p{static{t(this,"p")}static{n(this,"JsonReporter")}constructor(r={}){super(r)}_log(r,o){a(o)(r)}}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});const a=require("./write-console-log-3G15muTS.cjs"),c=require("./abstract-json-reporter-Z6bVrpPK.cjs");var n=Object.defineProperty,i=t((r,e)=>n(r,"name",{value:e,configurable:!0}),"e");class u extends c.A{static{t(this,"p")}static{i(this,"JsonReporter")}constructor(e={}){super(e)}_log(e,s){a.t(s)(e)}}module.exports=u;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i=Object.defineProperty;var s=(r,t)=>i(r,"name",{value:t,configurable:!0});import{stdout as a,stderr as n}from"node:process";import{n as c}from"./write-stream-CD8XFv1L.mjs";import{A as d}from"./abstract-json-reporter-tFmKAzRZ.mjs";var u=Object.defineProperty,p=s((r,t)=>u(r,"name",{value:t,configurable:!0}),"e");class b extends d{static{s(this,"d")}static{p(this,"JsonReporter")}#t;#r;constructor(t={}){super(t),this.#t=a,this.#r=n}setStdout(t){this.#t=t}setStderr(t){this.#r=t}_log(t,e){const o=["error","warn"].includes(e)?this.#r:this.#t;c(t+`
|
|
2
|
+
`,o)}}export{b as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=Object.defineProperty;var e=(r,t)=>n(r,"name",{value:t,configurable:!0});const s=require("node:process"),u=require("./write-stream-Dl-usQqh.cjs"),a=require("./abstract-json-reporter-Z6bVrpPK.cjs");var c=Object.defineProperty,d=e((r,t)=>c(r,"name",{value:t,configurable:!0}),"e");class h extends a.A{static{e(this,"d")}static{d(this,"JsonReporter")}#t;#r;constructor(t={}){super(t),this.#t=s.stdout,this.#r=s.stderr}setStdout(t){this.#t=t}setStderr(t){this.#r=t}_log(t,i){const o=["error","warn"].includes(i)?this.#r:this.#t;u.n(t+`
|
|
2
|
+
`,o)}}module.exports=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var a=(o,t)=>n(o,"name",{value:t,configurable:!0});import{build as c}from"@visulima/fmt";var u=Object.defineProperty,f=a((o,t)=>u(o,"name",{value:t,configurable:!0}),"o");class g{static{a(this,"p")}static{f(this,"MessageFormatterProcessor")}#t;#e;constructor(t={}){this.#e=t.formatters}setStringify(t){this.#t=t}process(t){const e=c({formatters:this.#e,stringify:f(r=>{const s=this.#t(r);return s===void 0?(console.warn("Unable to stringify value of type "+typeof r,r),"undefined"):s},"stringify")});return t.message!==void 0&&(t.message=this._format(e,t.message,t.context??[])),t}_format(t,e,r=[]){if(typeof e=="string")return t(e,r);if(typeof e=="object"&&e!==null)for(const s in e){const i=e[s];(typeof i=="string"||Array.isArray(i)||typeof i=="object")&&(e[s]=this._format(t,i,r))}return e}}export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var n=(o,t)=>a(o,"name",{value:t,configurable:!0});const c=require("@visulima/fmt");var u=Object.defineProperty,f=n((o,t)=>u(o,"name",{value:t,configurable:!0}),"o");class y{static{n(this,"p")}static{f(this,"MessageFormatterProcessor")}#t;#e;constructor(t={}){this.#e=t.formatters}setStringify(t){this.#t=t}process(t){const e=c.build({formatters:this.#e,stringify:f(s=>{const r=this.#t(s);return r===void 0?(console.warn("Unable to stringify value of type "+typeof s,s),"undefined"):r},"stringify")});return t.message!==void 0&&(t.message=this._format(e,t.message,t.context??[])),t}_format(t,e,s=[]){if(typeof e=="string")return t(e,s);if(typeof e=="object"&&e!==null)for(const r in e){const i=e[r];(typeof i=="string"||Array.isArray(i)||typeof i=="object")&&(e[r]=this._format(t,i,s))}return e}}module.exports=y;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var S=Object.defineProperty;var b=(h,i)=>S(h,"name",{value:i,configurable:!0});import Y,{grey as o,white as M,underline as _,bold as $}from"@visulima/colorize/browser";import{format as r}from"@visulima/fmt";import{E}from"./constants-BMS51p6Y.mjs";import{A as O,s as k}from"./abstract-pretty-reporter-CRcf4WZd.mjs";import{s as B}from"./get-longest-label-B0NrI-o2.mjs";import{t as C}from"./write-console-log-BP95fgQZ.mjs";var D=Object.defineProperty,F=b((h,i)=>D(h,"name",{value:i,configurable:!0}),"A");class K extends O{static{b(this,"Y")}static{F(this,"PrettyReporter")}constructor(i={}){super({uppercase:{label:!0,...i.uppercase},...i})}log(i){const t=typeof window<"u"&&typeof window.document<"u",x=C(i.type.level),{badge:A,context:w,date:u,error:v,groups:f,label:g,message:P,prefix:y,repeated:a,scope:n,suffix:m,type:R}=i,{color:T}=this._loggerTypes[R.name],L=T?Y[T]:M,s=[];if(t&&f.length>0){const e=f.map(()=>" ").join(""),l=o("["+f.at(-1)+"]");s.push(r(e+l[0],l.slice(1)))}if(u){const e=o(this._styles.dateFormatter(typeof u=="string"?new Date(u):u));t?s.push(r(e[0],e.slice(1))):s.push([e[0]+" ",...e.slice(1)])}if(A){const e=L(A);t?s.push(r(e[0],e.slice(1))):s.push([e[0]+" ",...e.slice(1)])}else{const e=k(this._loggerTypes);if(e.length>0){const l=o(".".repeat(e.length));t?s.push(r(l[0]+" ",l.slice(1))):s.push([l[0]+" ",...l.slice(1)])}}const j=B(this._loggerTypes);let d;if(a){const e=M("["+a+"x]");d=t?r(e[0],e.slice(1)):[e[0],...e.slice(1)]}if(g){const e=L(this._formatLabel(g));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)]),d&&s.push(d);let l=j.length-g.length;if(a?l-=String(a).length+3:l+=1,l>0){const p=o(".".repeat(l));t?s.push(r(p[0],p.slice(1))):s.push([" "+p[0],...p.slice(1)])}}else{const e=o(".".repeat(j.length+1));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(Array.isArray(n)&&n.length>0){const e=o("["+n.join(" > ")+"]");t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(y){const e=o((Array.isArray(n)&&n.length>0?". ":" ")+"["+(this._styles.underline.prefix?_(y):y)+"] ");t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(P!==E&&s.push(P),w&&s.push(...w),v&&s.push(v,`
|
|
2
|
+
|
|
3
|
+
`),m){const e=o(this._styles.underline.suffix?_(m):m);t?s.push(r(`
|
|
4
|
+
`+e[0],e.slice(1))):s.push([`
|
|
5
|
+
`+e[0],...e.slice(1)])}if(t)x(...s);else{let e="";const l=[],p=[];for(const c of s)Array.isArray(c)&&c.length>1&&c[0].includes("%c")?(e+=c[0],l.push(...c.slice(1))):p.push(c);x(e+"%c",...l,"",...p)}}_formatLabel(i){let t=this._styles.uppercase.label?i.toUpperCase():i;return t=this._styles.underline.label?_(t):t,this._styles.bold.label&&(t=$(t)),t}}export{K as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var T=Object.defineProperty;var f=(n,i)=>T(n,"name",{value:i,configurable:!0});const l=require("@visulima/colorize/browser"),o=require("@visulima/fmt"),C=require("./constants-BFrKdBPm.cjs"),P=require("./abstract-pretty-reporter-C2vDqWAQ.cjs"),D=require("./get-longest-label-7LkwzzHo.cjs"),S=require("./write-console-log-3G15muTS.cjs"),k=f(n=>n&&typeof n=="object"&&"default"in n?n.default:n,"_interopDefaultCompat"),E=k(l);var F=Object.defineProperty,M=f((n,i)=>F(n,"name",{value:i,configurable:!0}),"A");class O extends P.A{static{f(this,"Y")}static{M(this,"PrettyReporter")}constructor(i={}){super({uppercase:{label:!0,...i.uppercase},...i})}log(i){const t=typeof window<"u"&&typeof window.document<"u",_=S.t(i.type.level),{badge:x,context:w,date:p,error:A,groups:g,label:y,message:q,prefix:d,repeated:h,scope:a,suffix:m,type:R}=i,{color:L}=this._loggerTypes[R.name],v=L?E[L]:l.white,s=[];if(t&&g.length>0){const e=g.map(()=>" ").join(""),r=l.grey("["+g.at(-1)+"]");s.push(o.format(e+r[0],r.slice(1)))}if(p){const e=l.grey(this._styles.dateFormatter(typeof p=="string"?new Date(p):p));t?s.push(o.format(e[0],e.slice(1))):s.push([e[0]+" ",...e.slice(1)])}if(x){const e=v(x);t?s.push(o.format(e[0],e.slice(1))):s.push([e[0]+" ",...e.slice(1)])}else{const e=P.s(this._loggerTypes);if(e.length>0){const r=l.grey(".".repeat(e.length));t?s.push(o.format(r[0]+" ",r.slice(1))):s.push([r[0]+" ",...r.slice(1)])}}const j=D.s(this._loggerTypes);let b;if(h){const e=l.white("["+h+"x]");b=t?o.format(e[0],e.slice(1)):[e[0],...e.slice(1)]}if(y){const e=v(this._formatLabel(y));t?s.push(o.format(e[0],e.slice(1))):s.push([e[0],...e.slice(1)]),b&&s.push(b);let r=j.length-y.length;if(h?r-=String(h).length+3:r+=1,r>0){const c=l.grey(".".repeat(r));t?s.push(o.format(c[0],c.slice(1))):s.push([" "+c[0],...c.slice(1)])}}else{const e=l.grey(".".repeat(j.length+1));t?s.push(o.format(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(Array.isArray(a)&&a.length>0){const e=l.grey("["+a.join(" > ")+"]");t?s.push(o.format(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(d){const e=l.grey((Array.isArray(a)&&a.length>0?". ":" ")+"["+(this._styles.underline.prefix?l.underline(d):d)+"] ");t?s.push(o.format(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(q!==C.E&&s.push(q),w&&s.push(...w),A&&s.push(A,`
|
|
2
|
+
|
|
3
|
+
`),m){const e=l.grey(this._styles.underline.suffix?l.underline(m):m);t?s.push(o.format(`
|
|
4
|
+
`+e[0],e.slice(1))):s.push([`
|
|
5
|
+
`+e[0],...e.slice(1)])}if(t)_(...s);else{let e="";const r=[],c=[];for(const u of s)Array.isArray(u)&&u.length>1&&u[0].includes("%c")?(e+=u[0],r.push(...u.slice(1))):c.push(u);_(e+"%c",...r,"",...c)}}_formatLabel(i){let t=this._styles.uppercase.label?i.toUpperCase():i;return t=this._styles.underline.label?l.underline(t):t,this._styles.bold.label&&(t=l.bold(t)),t}}module.exports=O;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var R=Object.defineProperty;var x=(p,e)=>R(p,"name",{value:e,configurable:!0});import{stdout as B,stderr as F}from"node:process";import V,{red as E,greenBright as Y,cyan as D,green as G,grey as s,white as W,bgGrey as q,underline as k}from"@visulima/colorize";import{renderError as b}from"@visulima/error/error";import{inspect as L}from"@visulima/inspector";import{u as z,O as H,n as J,m as w,T as K}from"./format-label-D2xt_3df.mjs";import{E as N}from"./constants-BMS51p6Y.mjs";import{A as Q,s as U}from"./abstract-pretty-reporter-CRcf4WZd.mjs";import{s as X}from"./get-longest-label-B0NrI-o2.mjs";import{n as Z}from"./write-stream-CD8XFv1L.mjs";var ee=Object.defineProperty,O=x((p,e)=>ee(p,"name",{value:e,configurable:!0}),"S");const T=O(p=>!/[\\/]pail[\\/]dist/.test(p),"pailFileFilter");class ue extends Q{static{x(this,"PrettyReporter")}static{O(this,"PrettyReporter")}#t;#r;#s;#o=!1;#i;#e;constructor(e={}){const{error:n,inspect:i,...o}=e;super({uppercase:{label:!0,...o.uppercase},...o}),this.#i={...z,...i},this.#e={...n,color:{fileLine:G,hint:D,marker:E,message:E,method:Y,title:E}},this.#t=B,this.#r=F}setStdout(e){this.#t=e}setStderr(e){this.#r=e}setInteractiveManager(e){this.#s=e}setIsInteractive(e){this.#o=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:n}=H();let i=n;typeof this._styles.messageLength=="number"&&(i=this._styles.messageLength);const{badge:o,context:j,date:u,error:v,file:c,groups:g,label:m,message:f,prefix:d,repeated:A,scope:l,suffix:y,traceError:M,type:C}=e,{color:S}=this._loggerTypes[C.name],P=S?V[S]:W,h=g.map(()=>" ").join(""),t=[];if(g.length>0&&t.push(h+s("["+g.at(-1)+"]")+" "),u&&t.push(s(this._styles.dateFormatter(typeof u=="string"?new Date(u):u))+" "),o)t.push(P(o));else{const r=U(this._loggerTypes);r.length>0&&t.push(s(".".repeat(r.length))+" ")}const $=X(this._loggerTypes);m?t.push(P(J(m,this._styles))+" ",s(".".repeat($.length-w(m)))):t.push(s(".".repeat($.length+2))),A&&t.push(q.white("["+A+"x]")+" "),Array.isArray(l)&&l.length>0&&t.push(" "+s("["+l.join(" > ")+"]")+" "),d&&t.push(s((Array.isArray(l)&&l.length>0?". ":" ")+"["+(this._styles.underline.prefix?k(d):d)+"]")+" ");const _=w(t.join(" "));if(c){const r=c.name+(c.line?":"+c.line:""),a=w(r);a+_+2>i?t.push(s(" "+r)):t.push(s(".".repeat(i-_-a-2)+" "+r))}else t.push(s(".".repeat(i-_-1)));if(t.length>0&&t.push(`
|
|
2
|
+
|
|
3
|
+
`),f!==N){const r=typeof f=="string"?f:L(f,this.#i);t.push(h+K(r,i-3,{hard:!0,trim:!1,wordWrap:!0}))}if(j){let r=!1;t.push(...j.map(a=>{if(a instanceof Error)return r=!0,`
|
|
4
|
+
|
|
5
|
+
`+b(a,{...this.#e,filterStacktrace:T,prefix:h});if(typeof a=="object")return" "+L(a,this.#i);const I=(r?`
|
|
6
|
+
|
|
7
|
+
`:" ")+a;return r=!1,I}))}return v&&t.push(b(v,{...this.#e,filterStacktrace:T,prefix:h})),M&&t.push(`
|
|
8
|
+
|
|
9
|
+
`+b(M,{...this.#e,filterStacktrace:T,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:h})),y&&t.push(`
|
|
10
|
+
`,h+s(this._styles.underline.suffix?k(y):y)),t.join("")+`
|
|
11
|
+
`}_log(e,n){const i=["error","trace","warn"].includes(n)?"stderr":"stdout",o=i==="stderr"?this.#r:this.#t;this.#o&&this.#s!==void 0&&o.isTTY?this.#s.update(i,e.split(`
|
|
12
|
+
`),0):Z(e+`
|
|
13
|
+
`,o)}}export{ue as PrettyReporter};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";var O=Object.defineProperty;var f=(s,r)=>O(s,"name",{value:r,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("node:process"),e=require("@visulima/colorize"),x=require("@visulima/error/error"),A=require("@visulima/inspector"),u=require("./format-label-CKRxcWAQ.cjs"),B=require("./constants-BFrKdBPm.cjs"),k=require("./abstract-pretty-reporter-C2vDqWAQ.cjs"),F=require("./get-longest-label-7LkwzzHo.cjs"),V=require("./write-stream-Dl-usQqh.cjs"),D=f(s=>s&&typeof s=="object"&&"default"in s?s.default:s,"_interopDefaultCompat"),G=D(e);var W=Object.defineProperty,C=f((s,r)=>W(s,"name",{value:r,configurable:!0}),"S");const j=C(s=>!/[\\/]pail[\\/]dist/.test(s),"pailFileFilter");class Y extends k.A{static{f(this,"PrettyReporter")}static{C(this,"PrettyReporter")}#r;#t;#s;#o=!1;#i;#e;constructor(r={}){const{error:h,inspect:o,...a}=r;super({uppercase:{label:!0,...a.uppercase},...a}),this.#i={...u.u,...o},this.#e={...h,color:{fileLine:e.green,hint:e.cyan,marker:e.red,message:e.red,method:e.greenBright,title:e.red}},this.#r=P.stdout,this.#t=P.stderr}setStdout(r){this.#r=r}setStderr(r){this.#t=r}setInteractiveManager(r){this.#s=r}setIsInteractive(r){this.#o=r}log(r){this._log(this._formatMessage(r),r.type.level)}_formatMessage(r){const{columns:h}=u.O();let o=h;typeof this._styles.messageLength=="number"&&(o=this._styles.messageLength);const{badge:a,context:q,date:g,error:v,file:c,groups:y,label:m,message:d,prefix:_,repeated:w,scope:p,suffix:b,traceError:S,type:R}=r,{color:T}=this._loggerTypes[R.name],L=T?G[T]:e.white,l=y.map(()=>" ").join(""),t=[];if(y.length>0&&t.push(l+e.grey("["+y.at(-1)+"]")+" "),g&&t.push(e.grey(this._styles.dateFormatter(typeof g=="string"?new Date(g):g))+" "),a)t.push(L(a));else{const i=k.s(this._loggerTypes);i.length>0&&t.push(e.grey(".".repeat(i.length))+" ")}const M=F.s(this._loggerTypes);m?t.push(L(u.n(m,this._styles))+" ",e.grey(".".repeat(M.length-u.m(m)))):t.push(e.grey(".".repeat(M.length+2))),w&&t.push(e.bgGrey.white("["+w+"x]")+" "),Array.isArray(p)&&p.length>0&&t.push(" "+e.grey("["+p.join(" > ")+"]")+" "),_&&t.push(e.grey((Array.isArray(p)&&p.length>0?". ":" ")+"["+(this._styles.underline.prefix?e.underline(_):_)+"]")+" ");const E=u.m(t.join(" "));if(c){const i=c.name+(c.line?":"+c.line:""),n=u.m(i);n+E+2>o?t.push(e.grey(" "+i)):t.push(e.grey(".".repeat(o-E-n-2)+" "+i))}else t.push(e.grey(".".repeat(o-E-1)));if(t.length>0&&t.push(`
|
|
2
|
+
|
|
3
|
+
`),d!==B.E){const i=typeof d=="string"?d:A.inspect(d,this.#i);t.push(l+u.T(i,o-3,{hard:!0,trim:!1,wordWrap:!0}))}if(q){let i=!1;t.push(...q.map(n=>{if(n instanceof Error)return i=!0,`
|
|
4
|
+
|
|
5
|
+
`+x.renderError(n,{...this.#e,filterStacktrace:j,prefix:l});if(typeof n=="object")return" "+A.inspect(n,this.#i);const I=(i?`
|
|
6
|
+
|
|
7
|
+
`:" ")+n;return i=!1,I}))}return v&&t.push(x.renderError(v,{...this.#e,filterStacktrace:j,prefix:l})),S&&t.push(`
|
|
8
|
+
|
|
9
|
+
`+x.renderError(S,{...this.#e,filterStacktrace:j,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:l})),b&&t.push(`
|
|
10
|
+
`,l+e.grey(this._styles.underline.suffix?e.underline(b):b)),t.join("")+`
|
|
11
|
+
`}_log(r,h){const o=["error","trace","warn"].includes(h)?"stderr":"stdout",a=o==="stderr"?this.#t:this.#r;this.#o&&this.#s!==void 0&&a.isTTY?this.#s.update(o,r.split(`
|
|
12
|
+
`),0):V.n(r+`
|
|
13
|
+
`,a)}}exports.PrettyReporter=Y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var e=(t,r)=>o(t,"name",{value:r,configurable:!0});var n=Object.defineProperty,u=e((t,r)=>n(t,"name",{value:r,configurable:!0}),"r");class h{static{e(this,"n")}static{u(this,"RedactProcessor")}#r;constructor(r,s){try{const{redact:a,standardRules:c}=require("@visulima/redact");this.#r=i=>a(i,r||c,s)}catch{throw new Error("The '@visulima/redact' package is missing. Make sure to install the '@visulima/redact' package.")}}process(r){return r.message=this.#r(r.message),r.context=this.#r(r.context),r.error=this.#r(r.error),r}}module.exports=h;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
var o=Object.defineProperty;var e=(t,r)=>o(t,"name",{value:r,configurable:!0});var n=Object.defineProperty,u=e((t,r)=>n(t,"name",{value:r,configurable:!0}),"r");class l{static{e(this,"n")}static{u(this,"RedactProcessor")}#r;constructor(r,s){try{const{redact:a,standardRules:c}=require("@visulima/redact");this.#r=i=>a(i,r||c,s)}catch{throw new Error("The '@visulima/redact' package is missing. Make sure to install the '@visulima/redact' package.")}}process(r){return r.message=this.#r(r.message),r.context=this.#r(r.context),r.error=this.#r(r.error),r}}export{l as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var F=Object.defineProperty;var _=(a,e)=>F(a,"name",{value:e,configurable:!0});import{stdout as P,stderr as V}from"node:process";import Y,{red as x,greenBright as W,cyan as z,green as D,grey as o,bold as k,white as G,bgGrey as q,underline as C}from"@visulima/colorize";import{renderError as b}from"@visulima/error";import{inspect as L}from"@visulima/inspector";import{u as H,O as J,n as K,m as A,T as N}from"./format-label-D2xt_3df.mjs";import{E as Q}from"./constants-BMS51p6Y.mjs";import{A as U,s as X}from"./abstract-pretty-reporter-CRcf4WZd.mjs";import{s as Z}from"./get-longest-label-B0NrI-o2.mjs";import{n as ee}from"./write-stream-CD8XFv1L.mjs";var te=Object.defineProperty,I=_((a,e)=>te(a,"name",{value:e,configurable:!0}),"L");const E=I(a=>!/[\\/]pail[\\/]dist/.test(a),"pailFileFilter");class fe extends U{static{_(this,"SimpleReporter")}static{I(this,"SimpleReporter")}#t;#r;#s;#o=!1;#i;#e;constructor(e={}){const{error:h,inspect:i,...s}=e;super({uppercase:{label:!0,...s.uppercase},...s}),this.#i={...H,indent:void 0,...i},this.#e={...h,color:{fileLine:D,hint:z,marker:x,message:x,method:W,title:x}},this.#t=P,this.#r=V}setStdout(e){this.#t=e}setStderr(e){this.#r=e}setInteractiveManager(e){this.#s=e}setIsInteractive(e){this.#o=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:h}=J();let i=h;typeof this._styles.messageLength=="number"&&(i=this._styles.messageLength);const{badge:s,context:v,date:l,error:w,file:u,groups:c,label:m,message:f,prefix:d,repeated:S,scope:g,suffix:y,traceError:j,type:O}=e,{color:M}=this._loggerTypes[O.name],T=M?Y[M]:G,n=c.map(()=>" ").join(""),t=[];if(c.length>0&&t.push(n+o("["+c.at(-1)+"]")+" "),l&&t.push(o(this._styles.dateFormatter(typeof l=="string"?new Date(l):l))+" "),s)t.push(k(T(s)));else{const r=X(this._loggerTypes);r.length>0&&t.push(o(" ".repeat(r.length)))}const $=Z(this._loggerTypes);m?t.push(k(T(K(m,this._styles)))+" "," ".repeat($.length-A(m))):t.push(" ".repeat($.length+1)),S&&t.push(q.white("["+S+"x]")+" "),Array.isArray(g)&&g.length>0&&t.push(o("["+g.join(" > ")+"]")+" "),d&&t.push(o("["+(this._styles.underline.prefix?C(d):d)+"]")+" ");const R=A(t.join(""));if(f!==Q){const r=typeof f=="string"?f:L(f,this.#i);t.push(n+N(r,i-3,{hard:!0,trim:!1,wordWrap:!0}))}if(v){let r=!1;t.push(...v.map(p=>{if(p instanceof Error)return r=!0,`
|
|
2
|
+
|
|
3
|
+
`+b(p,{...this.#e,filterStacktrace:E,prefix:n});if(typeof p=="object")return" "+L(p,this.#i);const B=(r?`
|
|
4
|
+
|
|
5
|
+
`:" ")+p;return r=!1,B}))}if(w&&t.push(b(w,{...this.#e,filterStacktrace:E,prefix:n})),j&&t.push(`
|
|
6
|
+
|
|
7
|
+
`+b(j,{...this.#e,filterStacktrace:E,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:n})),y&&t.push(" "+n+o(this._styles.underline.suffix?C(y):y)),u){const r=u.name+(u.line?":"+u.line:"");t.push(`
|
|
8
|
+
`,o("Caller: ")," ".repeat(R-8),r,`
|
|
9
|
+
`)}return t.join("")}_log(e,h){const i=["error","trace","warn"].includes(h)?"stderr":"stdout",s=i==="stderr"?this.#r:this.#t;this.#o&&this.#s!==void 0&&s.isTTY?this.#s.update(i,e.split(`
|
|
10
|
+
`),0):ee(e+`
|
|
11
|
+
`,s)}}export{fe as SimpleReporter};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var g=(s,e)=>B(s,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("node:process"),r=require("@visulima/colorize"),v=require("@visulima/error"),C=require("@visulima/inspector"),l=require("./format-label-CKRxcWAQ.cjs"),F=require("./constants-BFrKdBPm.cjs"),k=require("./abstract-pretty-reporter-C2vDqWAQ.cjs"),P=require("./get-longest-label-7LkwzzHo.cjs"),V=require("./write-stream-Dl-usQqh.cjs"),D=g(s=>s&&typeof s=="object"&&"default"in s?s.default:s,"_interopDefaultCompat"),W=D(r);var z=Object.defineProperty,R=g((s,e)=>z(s,"name",{value:e,configurable:!0}),"L");const x=R(s=>!/[\\/]pail[\\/]dist/.test(s),"pailFileFilter");class G extends k.A{static{g(this,"SimpleReporter")}static{R(this,"SimpleReporter")}#r;#t;#s;#o=!1;#i;#e;constructor(e={}){const{error:u,inspect:n,...o}=e;super({uppercase:{label:!0,...o.uppercase},...o}),this.#i={...l.u,indent:void 0,...n},this.#e={...u,color:{fileLine:r.green,hint:r.cyan,marker:r.red,message:r.red,method:r.greenBright,title:r.red}},this.#r=T.stdout,this.#t=T.stderr}setStdout(e){this.#r=e}setStderr(e){this.#t=e}setInteractiveManager(e){this.#s=e}setIsInteractive(e){this.#o=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:u}=l.O();let n=u;typeof this._styles.messageLength=="number"&&(n=this._styles.messageLength);const{badge:o,context:E,date:p,error:S,file:c,groups:f,label:y,message:d,prefix:m,repeated:j,scope:_,suffix:b,traceError:q,type:I}=e,{color:w}=this._loggerTypes[I.name],L=w?W[w]:r.white,a=f.map(()=>" ").join(""),t=[];if(f.length>0&&t.push(a+r.grey("["+f.at(-1)+"]")+" "),p&&t.push(r.grey(this._styles.dateFormatter(typeof p=="string"?new Date(p):p))+" "),o)t.push(r.bold(L(o)));else{const i=k.s(this._loggerTypes);i.length>0&&t.push(r.grey(" ".repeat(i.length)))}const M=P.s(this._loggerTypes);y?t.push(r.bold(L(l.n(y,this._styles)))+" "," ".repeat(M.length-l.m(y))):t.push(" ".repeat(M.length+1)),j&&t.push(r.bgGrey.white("["+j+"x]")+" "),Array.isArray(_)&&_.length>0&&t.push(r.grey("["+_.join(" > ")+"]")+" "),m&&t.push(r.grey("["+(this._styles.underline.prefix?r.underline(m):m)+"]")+" ");const O=l.m(t.join(""));if(d!==F.E){const i=typeof d=="string"?d:C.inspect(d,this.#i);t.push(a+l.T(i,n-3,{hard:!0,trim:!1,wordWrap:!0}))}if(E){let i=!1;t.push(...E.map(h=>{if(h instanceof Error)return i=!0,`
|
|
2
|
+
|
|
3
|
+
`+v.renderError(h,{...this.#e,filterStacktrace:x,prefix:a});if(typeof h=="object")return" "+C.inspect(h,this.#i);const A=(i?`
|
|
4
|
+
|
|
5
|
+
`:" ")+h;return i=!1,A}))}if(S&&t.push(v.renderError(S,{...this.#e,filterStacktrace:x,prefix:a})),q&&t.push(`
|
|
6
|
+
|
|
7
|
+
`+v.renderError(q,{...this.#e,filterStacktrace:x,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:a})),b&&t.push(" "+a+r.grey(this._styles.underline.suffix?r.underline(b):b)),c){const i=c.name+(c.line?":"+c.line:"");t.push(`
|
|
8
|
+
`,r.grey("Caller: ")," ".repeat(O-8),i,`
|
|
9
|
+
`)}return t.join("")}_log(e,u){const n=["error","trace","warn"].includes(u)?"stderr":"stdout",o=n==="stderr"?this.#t:this.#r;this.#o&&this.#s!==void 0&&o.isTTY?this.#s.update(n,e.split(`
|
|
10
|
+
`),0):V.n(e+`
|
|
11
|
+
`,o)}}exports.SimpleReporter=G;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var n=(s,r)=>u(s,"name",{value:r,configurable:!0});const f=require("@visulima/error/error"),g=require("./constants-BFrKdBPm.cjs");var h=Object.defineProperty,m=n((s,r)=>h(s,"name",{value:r,configurable:!0}),"p");class b{static{n(this,"AbstractJsonReporter")}static{m(this,"AbstractJsonReporter")}stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:a,error:l,file:t,message:c,type:p,...e}=r;if(e.label&&(e.label=e.label.trim()),t&&(e.file=t.name+":"+t.line+(t.column?":"+t.column:"")),c===g.E?e.message=void 0:e.message=c,l&&(e.error=f.serializeError(l,this.errorOptions)),a){const i=[];for(const o of a)o!==g.E&&(o instanceof Error?i.push(f.serializeError(o,this.errorOptions)):i.push(o));e.context=i}this._log(this.stringify(e),p.level)}}exports.A=b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var n=(o,r)=>g(o,"name",{value:r,configurable:!0});import{serializeError as f}from"@visulima/error/error";import{E as p}from"./constants-BMS51p6Y.mjs";var h=Object.defineProperty,u=n((o,r)=>h(o,"name",{value:r,configurable:!0}),"p");class v{static{n(this,"AbstractJsonReporter")}static{u(this,"AbstractJsonReporter")}stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:a,error:l,file:t,message:c,type:m,...e}=r;if(e.label&&(e.label=e.label.trim()),t&&(e.file=t.name+":"+t.line+(t.column?":"+t.column:"")),c===p?e.message=void 0:e.message=c,l&&(e.error=f(l,this.errorOptions)),a){const i=[];for(const s of a)s!==p&&(s instanceof Error?i.push(f(s,this.errorOptions)):i.push(s));e.context=i}this._log(this.stringify(e),m.level)}}export{v as A};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var s=(t,e)=>o(t,"name",{value:e,configurable:!0});const n=require("./constants-BFrKdBPm.cjs");var g=Object.defineProperty,c=s((t,e)=>g(t,"name",{value:e,configurable:!0}),"r$1");const i=c(t=>{const e=Object.keys(t).map(r=>t[r].badge??"");return e.length===0?"":e.reduce((r,a)=>r.length>a.length?r:a)},"getLongestBadge");var u=Object.defineProperty,l=s((t,e)=>u(t,"name",{value:e,configurable:!0}),"o");const p=l(t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,"0")).join(":"),"dateFormatter");class f{static{s(this,"AbstractPrettyReporter")}static{l(this,"AbstractPrettyReporter")}_styles;_loggerTypes;constructor(e){this._styles={bold:{label:!1},dateFormatter:p,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this._loggerTypes=n.L}setLoggerTypes(e){this._loggerTypes=e}}exports.A=f;exports.s=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var s=(t,e)=>o(t,"name",{value:e,configurable:!0});import{L as g}from"./constants-BMS51p6Y.mjs";var n=Object.defineProperty,c=s((t,e)=>n(t,"name",{value:e,configurable:!0}),"r$1");const b=c(t=>{const e=Object.keys(t).map(r=>t[r].badge??"");return e.length===0?"":e.reduce((r,a)=>r.length>a.length?r:a)},"getLongestBadge");var i=Object.defineProperty,l=s((t,e)=>i(t,"name",{value:e,configurable:!0}),"o");const p=l(t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,"0")).join(":"),"dateFormatter");class d{static{s(this,"AbstractPrettyReporter")}static{l(this,"AbstractPrettyReporter")}_styles;_loggerTypes;constructor(e){this._styles={bold:{label:!1},dateFormatter:p,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this._loggerTypes=g}setLoggerTypes(e){this._loggerTypes=e}}export{d as A,b as s};
|