@visulima/pail 3.2.2 → 4.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/LICENSE.md +434 -6
  3. package/README.md +355 -24
  4. package/dist/error.d.ts +104 -0
  5. package/dist/error.js +76 -0
  6. package/dist/index.browser.d.ts +3 -1
  7. package/dist/index.browser.js +1490 -3
  8. package/dist/index.server.d.ts +3 -1
  9. package/dist/index.server.js +2668 -14
  10. package/dist/interactive/index.js +2 -2
  11. package/dist/middleware/elysia.d.ts +71 -0
  12. package/dist/middleware/elysia.js +70 -0
  13. package/dist/middleware/express.d.ts +86 -0
  14. package/dist/middleware/express.js +29 -0
  15. package/dist/middleware/fastify.d.ts +81 -0
  16. package/dist/middleware/fastify.js +46 -0
  17. package/dist/middleware/hono.d.ts +85 -0
  18. package/dist/middleware/hono.js +33 -0
  19. package/dist/middleware/next/handler.d.ts +36 -0
  20. package/dist/middleware/next/handler.js +53 -0
  21. package/dist/middleware/next/middleware.d.ts +59 -0
  22. package/dist/middleware/next/storage.d.ts +14 -0
  23. package/dist/middleware/shared/create-middleware-logger.d.ts +82 -0
  24. package/dist/middleware/shared/headers.d.ts +14 -0
  25. package/dist/middleware/shared/routes.d.ts +30 -0
  26. package/dist/middleware/shared/storage.d.ts +29 -0
  27. package/dist/middleware/sveltekit.d.ts +123 -0
  28. package/dist/middleware/sveltekit.js +43 -0
  29. package/dist/object-tree.d.ts +2 -2
  30. package/dist/object-tree.js +7 -7
  31. package/dist/packem_shared/{AbstractJsonReporter-intFdT_A.js → AbstractJsonReporter-CjtVgHbU.js} +112 -28
  32. package/dist/packem_shared/AbstractJsonReporter-DlugSJpY.js +288 -0
  33. package/dist/packem_shared/{InteractiveManager-CZ85hGNW.js → InteractiveManager-CowYA3Hx.js} +17 -11
  34. package/dist/packem_shared/{interactive-stream-hook-DG4BtN12.js → InteractiveStreamHook-BypRlYTX.js} +3 -11
  35. package/dist/packem_shared/{JsonReporter-C0AXk99i.js → JsonReporter-BgPvIyC2.js} +2 -2
  36. package/dist/packem_shared/{JsonReporter-DcM2LBX9.js → JsonReporter-Dbw82ewj.js} +2 -2
  37. package/dist/packem_shared/{PrettyReporter-CuLLKr6-.js → PrettyReporter-C2dCzIaf.js} +54 -8
  38. package/dist/packem_shared/{format-label-Btft2KGP.js → PrettyReporter-gMqa7j_m.js} +372 -78
  39. package/dist/packem_shared/Spinner-Cokext9b.js +2183 -0
  40. package/dist/packem_shared/abstract-pretty-reporter-szQO-IgK.js +2635 -0
  41. package/dist/packem_shared/constants-B1RjD_ps.js +99 -0
  42. package/dist/packem_shared/{constants-DfDr4MHC.js → constants-omsTHUWB.js} +1 -1
  43. package/dist/packem_shared/createPailError-B_sgL0nF.js +76 -0
  44. package/dist/packem_shared/getBarChar-D7JfmdTr.js +459 -0
  45. package/dist/packem_shared/headers-BxHWM6KI.js +127 -0
  46. package/dist/packem_shared/{index-DqKWykfa.js → index-BEfVUy9P.js} +174 -64
  47. package/dist/packem_shared/{index-BomQ3E6J.js → index-Bx3-C0j9.js} +29 -21
  48. package/dist/packem_shared/pailMiddleware-Ci88geIF.js +24 -0
  49. package/dist/packem_shared/storage-D0vqz8OX.js +36 -0
  50. package/dist/packem_shared/{InteractiveStreamHook-DiSubbJ1.js → useLogger-D0rU3lcX.js} +13 -1
  51. package/dist/packem_shared/{write-console-log-based-on-level-DBmRYXpj.js → write-console-log-based-on-level-ree2lDPw.js} +5 -4
  52. package/dist/packem_shared/{write-stream-BG8fhcs3.js → write-stream-BuFtjATz.js} +1 -1
  53. package/dist/pail.browser.d.ts +1 -1
  54. package/dist/processor/environment-processor.d.ts +124 -0
  55. package/dist/processor/environment-processor.js +82 -0
  56. package/dist/processor/message-formatter-processor.d.ts +2 -2
  57. package/dist/processor/message-formatter-processor.js +654 -6
  58. package/dist/processor/opentelemetry-processor.js +4 -4
  59. package/dist/processor/redact-processor.d.ts +1 -1
  60. package/dist/processor/redact-processor.js +2 -1
  61. package/dist/processor/sampling-processor.d.ts +111 -0
  62. package/dist/processor/sampling-processor.js +59 -0
  63. package/dist/progress-bar.d.ts +10 -1
  64. package/dist/progress-bar.js +75 -20
  65. package/dist/reporter/file/json-file-reporter.js +1 -1
  66. package/dist/reporter/http/abstract-http-reporter.js +23 -26
  67. package/dist/reporter/http/http-reporter.edge-light.js +134 -53
  68. package/dist/reporter/json/abstract-json-reporter.d.ts +1 -1
  69. package/dist/reporter/json/index.browser.js +2 -2
  70. package/dist/reporter/json/index.js +2 -2
  71. package/dist/reporter/pretty/index.browser.js +1 -1
  72. package/dist/reporter/pretty/index.js +1 -1
  73. package/dist/reporter/simple/simple-reporter.server.js +8 -12
  74. package/dist/spinner.js +37 -4
  75. package/dist/types.d.ts +4 -4
  76. package/dist/wide-event.d.ts +300 -0
  77. package/dist/wide-event.js +283 -0
  78. package/package.json +73 -8
  79. package/dist/packem_shared/PrettyReporter-BFWaYP_J.js +0 -222
  80. package/dist/packem_shared/abstract-pretty-reporter-DMPDCslJ.js +0 -50
  81. package/dist/packem_shared/get-longest-label-C9PWeyKq.js +0 -9
  82. package/dist/packem_shared/pail.browser-CPjQrsyy.js +0 -1427
@@ -36,7 +36,7 @@ const ErrorProto = Object.create(
36
36
  {},
37
37
  {
38
38
  cause: {
39
- enumerable: true,
39
+ enumerable: false,
40
40
  value: void 0,
41
41
  writable: true
42
42
  },
@@ -46,62 +46,89 @@ const ErrorProto = Object.create(
46
46
  writable: true
47
47
  },
48
48
  errors: {
49
- enumerable: true,
49
+ enumerable: false,
50
50
  value: void 0,
51
51
  writable: true
52
52
  },
53
53
  message: {
54
- enumerable: true,
54
+ enumerable: false,
55
55
  value: void 0,
56
56
  writable: true
57
57
  },
58
58
  name: {
59
- enumerable: true,
59
+ enumerable: false,
60
60
  value: void 0,
61
61
  writable: true
62
62
  },
63
63
  stack: {
64
- enumerable: true,
64
+ enumerable: false,
65
65
  value: void 0,
66
66
  writable: true
67
67
  }
68
68
  }
69
69
  );
70
70
  const toJsonWasCalled = /* @__PURE__ */ new WeakSet();
71
+ const makePropertiesEnumerable = (object) => {
72
+ const props = Object.getOwnPropertyNames(object);
73
+ for (const prop of props) {
74
+ const descriptor = Object.getOwnPropertyDescriptor(object, prop);
75
+ if (descriptor) {
76
+ if (!descriptor.enumerable) {
77
+ Object.defineProperty(object, prop, {
78
+ ...descriptor,
79
+ enumerable: true
80
+ });
81
+ }
82
+ if (descriptor.value && typeof descriptor.value === "object" && !Array.isArray(descriptor.value) && (Object.getPrototypeOf(descriptor.value) === Object.prototype || Object.getPrototypeOf(descriptor.value) === null)) {
83
+ makePropertiesEnumerable(descriptor.value);
84
+ }
85
+ }
86
+ }
87
+ };
71
88
  const toJSON = (from) => {
72
89
  toJsonWasCalled.add(from);
73
90
  const json = from.toJSON();
74
91
  toJsonWasCalled.delete(from);
92
+ if (
93
+ // Only make properties enumerable if the object is extensible
94
+ // Non-extensible objects (like when toJSON returns 'this') should preserve original enumerability
95
+ Object.isExtensible(json)
96
+ ) {
97
+ makePropertiesEnumerable(json);
98
+ }
75
99
  return json;
76
100
  };
77
101
  const serializeValue = (value, seen, depth, options) => {
78
102
  if (value && value instanceof Uint8Array && value.constructor.name === "Buffer") {
79
103
  return "[object Buffer]";
80
104
  }
81
- if (value !== null && typeof value === "object" && typeof value.pipe === "function") {
105
+ if (value !== null && typeof value === "object" && "pipe" in value && typeof value.pipe === "function") {
82
106
  return "[object Stream]";
83
107
  }
84
108
  if (value instanceof Error) {
85
- if (seen.includes(value)) {
109
+ if (seen.has(value)) {
86
110
  return "[Circular]";
87
111
  }
88
112
  depth += 1;
89
113
  return _serialize(value, options, seen, depth);
90
114
  }
91
- if (options.useToJSON && typeof value.toJSON === "function") {
115
+ if (options.useToJSON && value !== null && typeof value === "object" && "toJSON" in value && typeof value.toJSON === "function") {
92
116
  return value.toJSON();
93
117
  }
94
- if (typeof value === "object" && value instanceof Date) {
118
+ if (value instanceof Date) {
95
119
  return value.toISOString();
96
120
  }
97
121
  if (typeof value === "function") {
98
122
  return `[Function: ${value.name || "anonymous"}]`;
99
123
  }
124
+ if (typeof value === "bigint") {
125
+ return `${String(value)}n`;
126
+ }
100
127
  if (isPlainObject(value)) {
101
- depth += 1;
102
- if (options.maxDepth && depth >= options.maxDepth) {
128
+ if (options.maxDepth !== void 0 && options.maxDepth !== Number.POSITIVE_INFINITY && depth + 1 >= options.maxDepth) {
103
129
  return {};
104
130
  }
131
+ depth += 1;
105
132
  const plainObject = {};
106
133
  for (const key in value) {
107
134
  plainObject[key] = serializeValue(value[key], seen, depth, options);
@@ -115,7 +142,7 @@ const serializeValue = (value, seen, depth, options) => {
115
142
  }
116
143
  };
117
144
  const _serialize = (error, options, seen, depth) => {
118
- seen.push(error);
145
+ seen.add(error);
119
146
  if (options.maxDepth === 0) {
120
147
  return {};
121
148
  }
@@ -123,31 +150,88 @@ const _serialize = (error, options, seen, depth) => {
123
150
  return toJSON(error);
124
151
  }
125
152
  const protoError = Object.create(ErrorProto);
126
- protoError.name = Object.prototype.toString.call(error.constructor) === "[object Function]" ? error.constructor.name : error.name;
127
- protoError.message = error.message;
128
- protoError.stack = error.stack;
153
+ Object.defineProperty(protoError, "name", {
154
+ configurable: true,
155
+ enumerable: true,
156
+ value: Object.prototype.toString.call(error.constructor) === "[object Function]" ? error.constructor.name : error.name,
157
+ writable: true
158
+ });
159
+ Object.defineProperty(protoError, "message", {
160
+ configurable: true,
161
+ enumerable: true,
162
+ value: error.message,
163
+ writable: true
164
+ });
165
+ Object.defineProperty(protoError, "stack", {
166
+ configurable: true,
167
+ enumerable: true,
168
+ value: error.stack,
169
+ writable: true
170
+ });
129
171
  if (Array.isArray(error.errors)) {
130
172
  const aggregateErrors = [];
131
173
  for (const aggregateError of error.errors) {
132
174
  if (!(aggregateError instanceof Error)) {
133
175
  throw new TypeError("All errors in the 'errors' property must be instances of Error");
134
176
  }
135
- if (seen.includes(aggregateError)) {
136
- protoError.errors = [];
177
+ if (seen.has(aggregateError)) {
178
+ Object.defineProperty(protoError, "errors", {
179
+ configurable: true,
180
+ enumerable: true,
181
+ value: [],
182
+ writable: true
183
+ });
137
184
  return protoError;
138
185
  }
139
186
  aggregateErrors.push(_serialize(aggregateError, options, seen, depth));
140
187
  }
141
- protoError.errors = aggregateErrors;
188
+ Object.defineProperty(protoError, "errors", {
189
+ configurable: true,
190
+ enumerable: true,
191
+ value: aggregateErrors,
192
+ writable: true
193
+ });
142
194
  }
143
- if (error.cause instanceof Error && !seen.includes(error.cause)) {
144
- protoError.cause = _serialize(error.cause, options, seen, depth);
195
+ const causeValue = error.cause;
196
+ if (causeValue !== void 0 && causeValue !== null) {
197
+ if (causeValue instanceof Error) {
198
+ if (seen.has(causeValue)) {
199
+ Object.defineProperty(protoError, "cause", {
200
+ configurable: true,
201
+ enumerable: true,
202
+ value: "[Circular]",
203
+ writable: true
204
+ });
205
+ } else {
206
+ Object.defineProperty(protoError, "cause", {
207
+ configurable: true,
208
+ enumerable: true,
209
+ value: _serialize(causeValue, options, seen, depth),
210
+ writable: true
211
+ });
212
+ }
213
+ } else {
214
+ const serializedCause = serializeValue(causeValue, seen, depth, options);
215
+ Object.defineProperty(protoError, "cause", {
216
+ configurable: true,
217
+ enumerable: true,
218
+ value: serializedCause,
219
+ writable: true
220
+ });
221
+ }
145
222
  }
146
223
  for (const key in error) {
147
- if (protoError[key] === void 0) {
148
- const value = error[key];
149
- protoError[key] = serializeValue(value, seen, depth, options);
224
+ if (key === "name" || key === "message" || key === "stack" || key === "cause" || key === "errors") {
225
+ continue;
150
226
  }
227
+ const value = error[key];
228
+ const serializedValue = serializeValue(value, seen, depth, options);
229
+ Object.defineProperty(protoError, key, {
230
+ configurable: true,
231
+ enumerable: true,
232
+ value: serializedValue,
233
+ writable: true
234
+ });
151
235
  }
152
236
  if (Array.isArray(options.exclude) && options.exclude.length > 0) {
153
237
  for (const key of options.exclude) {
@@ -166,11 +250,11 @@ const serialize = (error, options = {}) => _serialize(
166
250
  maxDepth: options.maxDepth ?? Number.POSITIVE_INFINITY,
167
251
  useToJSON: options.useToJSON ?? false
168
252
  },
169
- [],
253
+ /* @__PURE__ */ new Set(),
170
254
  0
171
255
  );
172
256
 
173
- const EMPTY_SYMBOL = Symbol("EMPTY");
257
+ const EMPTY_SYMBOL = /* @__PURE__ */ Symbol("EMPTY");
174
258
 
175
259
  class AbstractJsonReporter {
176
260
  /** Custom stringify function for object serialization */
@@ -188,7 +272,6 @@ class AbstractJsonReporter {
188
272
  * Sets a custom stringify function for object serialization.
189
273
  * @param function_ The stringify function to use for serialization
190
274
  */
191
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
192
275
  setStringify(function_) {
193
276
  this.stringify = function_;
194
277
  }
@@ -199,7 +282,7 @@ class AbstractJsonReporter {
199
282
  rest.label = rest.label.trim();
200
283
  }
201
284
  if (file) {
202
- rest.file = `${file.name}:${file.line}${file.column ? `:${file.column}` : ""}`;
285
+ rest.file = `${file.name ?? ""}:${String(file.line)}${file.column ? `:${String(file.column)}` : ""}`;
203
286
  }
204
287
  if (message === EMPTY_SYMBOL) {
205
288
  rest.message = void 0;
@@ -211,7 +294,8 @@ class AbstractJsonReporter {
211
294
  }
212
295
  if (context) {
213
296
  const newContext = [];
214
- for (const item of context) {
297
+ for (let i = 0; i < context.length; i += 1) {
298
+ const item = context[i];
215
299
  if (item === EMPTY_SYMBOL) {
216
300
  continue;
217
301
  }
@@ -235,24 +319,25 @@ const compressData = async (data) => {
235
319
  const reader = stream.readable.getReader();
236
320
  const encoder = new TextEncoder();
237
321
  const chunks = [];
238
- writer.write(encoder.encode(data));
239
- writer.close();
322
+ await writer.write(encoder.encode(data));
323
+ await writer.close();
240
324
  let done = false;
241
325
  while (!done) {
242
- const result2 = await reader.read();
243
- done = result2.done ?? false;
244
- if (result2.value) {
245
- chunks.push(result2.value);
326
+ const result = await reader.read();
327
+ done = result.done;
328
+ if (result.value) {
329
+ chunks.push(result.value);
246
330
  }
247
331
  }
248
332
  const totalLength = chunks.reduce((accumulator, chunk) => accumulator + chunk.length, 0);
249
- const result = new Uint8Array(totalLength);
333
+ const resultBuffer = new Uint8Array(totalLength);
250
334
  let offset = 0;
251
- for (const chunk of chunks) {
252
- result.set(chunk, offset);
335
+ for (let i = 0; i < chunks.length; i += 1) {
336
+ const chunk = chunks[i];
337
+ resultBuffer.set(chunk, offset);
253
338
  offset += chunk.length;
254
339
  }
255
- return result;
340
+ return resultBuffer;
256
341
  }
257
342
  return gzipSync(data);
258
343
  };
@@ -327,7 +412,7 @@ const processResponse = async (response, url, method, headers, body, onDebugRequ
327
412
  return false;
328
413
  }
329
414
  if (response.status < 500 && response.status !== 429) {
330
- const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
415
+ const error = new Error(`HTTP ${String(response.status)}: ${response.statusText}`);
331
416
  if (onError) {
332
417
  onError(error);
333
418
  }
@@ -387,7 +472,7 @@ const sendWithRetry = async (url, method, headers, body, maxRetries, retryDelay,
387
472
  continue;
388
473
  }
389
474
  if (!response.ok) {
390
- const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
475
+ const error = new Error(`HTTP ${String(response.status)}: ${response.statusText}`);
391
476
  if (onError) {
392
477
  onError(error);
393
478
  }
@@ -500,7 +585,7 @@ class AbstractHttpReporter extends AbstractJsonReporter {
500
585
  const logEntrySize = this.edgeCompat || typeof TextEncoder === "undefined" ? Buffer.byteLength(payload, "utf8") : new TextEncoder().encode(payload).length;
501
586
  if (logEntrySize > this.maxLogSize) {
502
587
  const error = new LogSizeError(
503
- `Log entry exceeds maximum size of ${this.maxLogSize} bytes. Size: ${logEntrySize} bytes`,
588
+ `Log entry exceeds maximum size of ${String(this.maxLogSize)} bytes. Size: ${String(logEntrySize)} bytes`,
504
589
  { data: payloadTemplate.data, logLevel: logLevelString, message: messageString },
505
590
  logEntrySize,
506
591
  this.maxLogSize
@@ -532,17 +617,15 @@ class AbstractHttpReporter extends AbstractJsonReporter {
532
617
  const payloadSizeWithEntry = this.currentBatchSize + logEntrySize + this.batchSendDelimiter.length;
533
618
  const payloadSizeThreshold = this.maxPayloadSize * 0.9;
534
619
  if (payloadSizeWithEntry > payloadSizeThreshold && this.batchQueue.length > 0) {
535
- this.processBatch();
620
+ void this.processBatch();
536
621
  }
537
622
  this.batchQueue.push(payload);
538
623
  this.currentBatchSize += logEntrySize + this.batchSendDelimiter.length;
539
- if (!this.batchTimeout) {
540
- this.batchTimeout = setTimeout(() => {
541
- this.processBatch();
542
- }, this.batchSendTimeout);
543
- }
624
+ this.batchTimeout ??= setTimeout(() => {
625
+ void this.processBatch();
626
+ }, this.batchSendTimeout);
544
627
  if (this.batchQueue.length >= this.batchSize) {
545
- this.processBatch();
628
+ void this.processBatch();
546
629
  }
547
630
  }
548
631
  /**
@@ -573,7 +656,7 @@ class AbstractHttpReporter extends AbstractJsonReporter {
573
656
  } finally {
574
657
  this.isProcessingBatch = false;
575
658
  if (this.batchQueue.length > 0) {
576
- this.processBatch();
659
+ void this.processBatch();
577
660
  }
578
661
  }
579
662
  }
@@ -606,9 +689,7 @@ class AbstractHttpReporter extends AbstractJsonReporter {
606
689
  */
607
690
  async sendPayload(payload, contentType) {
608
691
  const headers = typeof this.headers === "function" ? this.headers() : { ...this.headers };
609
- if (!headers["content-type"]) {
610
- headers["content-type"] = contentType ?? this.contentType;
611
- }
692
+ headers["content-type"] ??= contentType ?? this.contentType;
612
693
  let finalPayload = payload;
613
694
  if (this.compression && !this.edgeCompat) {
614
695
  try {
@@ -616,7 +697,7 @@ class AbstractHttpReporter extends AbstractJsonReporter {
616
697
  headers["content-encoding"] = "gzip";
617
698
  } catch (error) {
618
699
  if (this.onError) {
619
- this.onError(new Error(`Compression failed: ${error}`));
700
+ this.onError(new Error(`Compression failed: ${String(error)}`));
620
701
  }
621
702
  }
622
703
  }
@@ -45,7 +45,7 @@ export declare abstract class AbstractJsonReporter<L extends string = string> im
45
45
  * Sets a custom stringify function for object serialization.
46
46
  * @param function_ The stringify function to use for serialization
47
47
  */
48
- setStringify(function_: any): void;
48
+ setStringify(function_: typeof stringify): void;
49
49
  log(meta: ReadonlyMeta<L>): void;
50
50
  /**
51
51
  * Template method for outputting the JSON log message.
@@ -1,2 +1,2 @@
1
- export { AbstractJsonReporter } from '../../packem_shared/AbstractJsonReporter-intFdT_A.js';
2
- export { default as JsonReporter } from '../../packem_shared/JsonReporter-DcM2LBX9.js';
1
+ export { AbstractJsonReporter } from '../../packem_shared/AbstractJsonReporter-DlugSJpY.js';
2
+ export { default as JsonReporter } from '../../packem_shared/JsonReporter-Dbw82ewj.js';
@@ -1,2 +1,2 @@
1
- export { AbstractJsonReporter } from '../../packem_shared/AbstractJsonReporter-intFdT_A.js';
2
- export { default as JsonReporter } from '../../packem_shared/JsonReporter-C0AXk99i.js';
1
+ export { AbstractJsonReporter } from '../../packem_shared/AbstractJsonReporter-CjtVgHbU.js';
2
+ export { default as JsonReporter } from '../../packem_shared/JsonReporter-BgPvIyC2.js';
@@ -1 +1 @@
1
- export { default as PrettyReporter } from '../../packem_shared/PrettyReporter-CuLLKr6-.js';
1
+ export { default as PrettyReporter } from '../../packem_shared/PrettyReporter-C2dCzIaf.js';
@@ -1 +1 @@
1
- export { PrettyReporter } from '../../packem_shared/PrettyReporter-BFWaYP_J.js';
1
+ export { PrettyReporter } from '../../packem_shared/PrettyReporter-gMqa7j_m.js';
@@ -8,15 +8,11 @@ const {
8
8
  stdout,
9
9
  stderr
10
10
  } = __cjs_getProcess;
11
- import colorize, { red, greenBright, cyan, green, grey, bold, white, bgGrey, underline } from '@visulima/colorize';
12
- import { d as defaultInspectorConfig, f as formatLabel, i as inspect, r as renderError } from '../../packem_shared/format-label-Btft2KGP.js';
13
- import { t as terminalSize, g as getStringWidth, w as wordWrap, W as WrapMode } from '../../packem_shared/index-DqKWykfa.js';
14
- import { E as EMPTY_SYMBOL } from '../../packem_shared/constants-DfDr4MHC.js';
15
- import { A as AbstractPrettyReporter, g as getLongestBadge } from '../../packem_shared/abstract-pretty-reporter-DMPDCslJ.js';
16
- import { g as getLongestLabel } from '../../packem_shared/get-longest-label-C9PWeyKq.js';
17
- import { w as writeStream } from '../../packem_shared/write-stream-BG8fhcs3.js';
11
+ import colorize, { red, greenBright, cyan, green, grey, bold, bgGrey, underline, white } from '@visulima/colorize';
12
+ import { A as AbstractPrettyReporter, d as defaultInspectorConfig, b as writeStream, t as terminalSize, c as getLongestBadge, g as getLongestLabel, e as getStringWidth, f as formatLabel, a as EMPTY_SYMBOL, i as inspect, w as wordWrap, r as renderError, W as WrapMode } from '../../packem_shared/abstract-pretty-reporter-szQO-IgK.js';
18
13
 
19
- const pailFileFilter = (line) => !/[\\/]pail[\\/]dist/.test(line);
14
+ const PAIL_DIST_REGEX = /[\\/]pail[\\/]dist/;
15
+ const pailFileFilter = (line) => !PAIL_DIST_REGEX.test(line);
20
16
  class SimpleReporter extends AbstractPrettyReporter {
21
17
  #stdout;
22
18
  #stderr;
@@ -85,7 +81,7 @@ class SimpleReporter extends AbstractPrettyReporter {
85
81
  const groupSpaces = groups.map(() => " ").join("");
86
82
  const items = [];
87
83
  if (groups.length > 0) {
88
- items.push(`${groupSpaces + grey(`[${groups.at(-1)}]`)} `);
84
+ items.push(`${groupSpaces + grey(`[${groups.at(-1) ?? ""}]`)} `);
89
85
  }
90
86
  if (date) {
91
87
  items.push(`${grey(this.styles.dateFormatter(typeof date === "string" ? new Date(date) : date))} `);
@@ -108,7 +104,7 @@ class SimpleReporter extends AbstractPrettyReporter {
108
104
  items.push(" ".repeat(longestWidth + 1));
109
105
  }
110
106
  if (repeated) {
111
- items.push(`${bgGrey.white(`[${repeated}x]`)} `);
107
+ items.push(`${bgGrey.white(`[${String(repeated)}x]`)} `);
112
108
  }
113
109
  if (Array.isArray(scope) && scope.length > 0) {
114
110
  items.push(`${grey(`[${scope.join(" > ")}]`)} `);
@@ -144,7 +140,7 @@ ${renderError(value, {
144
140
  if (typeof value === "object") {
145
141
  return ` ${inspect(value, this.#inspectOptions)}`;
146
142
  }
147
- const newValue = (hasError ? "\n\n" : " ") + value;
143
+ const newValue = (hasError ? "\n\n" : " ") + String(value);
148
144
  hasError = false;
149
145
  return newValue;
150
146
  })
@@ -178,7 +174,7 @@ ${renderError(traceError, {
178
174
  items.push(` ${groupSpaces}${grey(this.styles.underline.suffix ? underline(suffix) : suffix)}`);
179
175
  }
180
176
  if (file) {
181
- const fileMessage = file.name + (file.line ? `:${file.line}` : "");
177
+ const fileMessage = (file.name ?? "") + (file.line ? `:${String(file.line)}` : "");
182
178
  const callerPad = Math.max(0, titleSize - getStringWidth("Caller: "));
183
179
  items.push("\n", grey("Caller: "), " ".repeat(callerPad), fileMessage, "\n");
184
180
  }
package/dist/spinner.js CHANGED
@@ -1663,6 +1663,38 @@ var dwarfFortress = {
1663
1663
  " ██████£££ "
1664
1664
  ]
1665
1665
  };
1666
+ var fish = {
1667
+ interval: 80,
1668
+ frames: [
1669
+ "~~~~~~~~~~~~~~~~~~~~",
1670
+ "> ~~~~~~~~~~~~~~~~~~",
1671
+ "º> ~~~~~~~~~~~~~~~~~",
1672
+ "(º> ~~~~~~~~~~~~~~~~",
1673
+ "((º> ~~~~~~~~~~~~~~~",
1674
+ "<((º> ~~~~~~~~~~~~~~",
1675
+ "><((º> ~~~~~~~~~~~~~",
1676
+ " ><((º> ~~~~~~~~~~~~",
1677
+ "~ ><((º> ~~~~~~~~~~~",
1678
+ "~~ <>((º> ~~~~~~~~~~",
1679
+ "~~~ ><((º> ~~~~~~~~~",
1680
+ "~~~~ <>((º> ~~~~~~~~",
1681
+ "~~~~~ ><((º> ~~~~~~~",
1682
+ "~~~~~~ <>((º> ~~~~~~",
1683
+ "~~~~~~~ ><((º> ~~~~~",
1684
+ "~~~~~~~~ <>((º> ~~~~",
1685
+ "~~~~~~~~~ ><((º> ~~~",
1686
+ "~~~~~~~~~~ <>((º> ~~",
1687
+ "~~~~~~~~~~~ ><((º> ~",
1688
+ "~~~~~~~~~~~~ <>((º> ",
1689
+ "~~~~~~~~~~~~~ ><((º>",
1690
+ "~~~~~~~~~~~~~~ <>((º",
1691
+ "~~~~~~~~~~~~~~~ ><((",
1692
+ "~~~~~~~~~~~~~~~~ <>(",
1693
+ "~~~~~~~~~~~~~~~~~ ><",
1694
+ "~~~~~~~~~~~~~~~~~~ <",
1695
+ "~~~~~~~~~~~~~~~~~~~~"
1696
+ ]
1697
+ };
1666
1698
  const spinners = {
1667
1699
  dots: dots,
1668
1700
  dots2: dots2,
@@ -1752,7 +1784,8 @@ const spinners = {
1752
1784
  orangeBluePulse: orangeBluePulse,
1753
1785
  timeTravel: timeTravel,
1754
1786
  aesthetic: aesthetic,
1755
- dwarfFortress: dwarfFortress
1787
+ dwarfFortress: dwarfFortress,
1788
+ fish: fish
1756
1789
  };
1757
1790
 
1758
1791
  const DEFAULT_ICONS = {
@@ -1904,7 +1937,7 @@ class Spinner {
1904
1937
  if (options?.prefixText) {
1905
1938
  this.#prefixText = options.prefixText;
1906
1939
  }
1907
- const manager = this.#multiSpinner || this.#interactiveManager;
1940
+ const manager = this.#multiSpinner ?? this.#interactiveManager;
1908
1941
  if (manager) {
1909
1942
  if (this.#multiSpinner) {
1910
1943
  manager.renderAll();
@@ -2041,7 +2074,7 @@ class Spinner {
2041
2074
  output = `${output} ${text}`;
2042
2075
  }
2043
2076
  this.#finalOutput = output;
2044
- const manager = this.#multiSpinner || this.#interactiveManager;
2077
+ const manager = this.#multiSpinner ?? this.#interactiveManager;
2045
2078
  if (manager) {
2046
2079
  if (this.#multiSpinner) {
2047
2080
  this.#multiSpinner.renderAll();
@@ -2079,7 +2112,7 @@ class MultiSpinner {
2079
2112
  * @returns A new Spinner instance
2080
2113
  */
2081
2114
  create(text, options = {}) {
2082
- const id = `spinner_${this.#nextSpinnerId++}`;
2115
+ const id = `spinner_${String(this.#nextSpinnerId++)}`;
2083
2116
  const spinner = new Spinner({ ...this.#options, ...options });
2084
2117
  spinner.setMultiSpinner(this);
2085
2118
  this.#spinners.set(id, spinner);
package/dist/types.d.ts CHANGED
@@ -43,7 +43,7 @@ export interface Meta<L> extends VisulimaPail.CustomMeta<L> {
43
43
  label: string | undefined;
44
44
  message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
45
45
  prefix: string | undefined;
46
- repeated?: number | undefined;
46
+ repeated?: number;
47
47
  scope: string[] | undefined;
48
48
  suffix: string | undefined;
49
49
  traceError: Error | undefined;
@@ -88,7 +88,7 @@ export interface LoggerFunction {
88
88
  */
89
89
  export interface LoggerConfiguration<L extends string> {
90
90
  badge?: string;
91
- color?: AnsiColors | undefined;
91
+ color?: AnsiColors;
92
92
  label: string;
93
93
  logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
94
94
  }
@@ -158,7 +158,7 @@ export interface LoggerTypesAwareReporter<T extends string, L extends string> ex
158
158
  */
159
159
  export interface StringifyAwareReporter<L extends string> extends Reporter<L> {
160
160
  /** Set the stringify function for object serialization */
161
- setStringify: (stringify: typeof JSON.stringify) => void;
161
+ setStringify: (stringify: any) => void;
162
162
  }
163
163
  /**
164
164
  * Interactive Stream Reporter Interface.
@@ -217,7 +217,7 @@ export interface ServerConstructorOptions<T extends string, L extends string> ex
217
217
  stdout: NodeJS.WriteStream;
218
218
  }
219
219
  export type Message = {
220
- context?: any[] | undefined;
220
+ context?: any[];
221
221
  message: any;
222
222
  prefix?: string;
223
223
  suffix?: string;