@visulima/pail 4.0.2 → 4.1.0

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 (83) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE.md +346 -0
  3. package/README.md +17 -0
  4. package/dist/error.d.ts +69 -69
  5. package/dist/index.browser.d.ts +446 -445
  6. package/dist/index.browser.js +17 -17
  7. package/dist/index.server.d.ts +582 -582
  8. package/dist/index.server.js +27 -27
  9. package/dist/middleware/elysia.d.ts +44 -42
  10. package/dist/middleware/elysia.js +1 -1
  11. package/dist/middleware/express.d.ts +58 -59
  12. package/dist/middleware/express.js +1 -1
  13. package/dist/middleware/fastify.d.ts +55 -56
  14. package/dist/middleware/fastify.js +1 -1
  15. package/dist/middleware/hono.d.ts +56 -57
  16. package/dist/middleware/hono.js +1 -1
  17. package/dist/middleware/next/handler.d.ts +67 -68
  18. package/dist/middleware/next/handler.js +1 -1
  19. package/dist/middleware/sveltekit.d.ts +72 -73
  20. package/dist/middleware/sveltekit.js +1 -1
  21. package/dist/object-tree.d.ts +44 -44
  22. package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +1 -0
  23. package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +1 -0
  24. package/dist/packem_shared/JsonReporter-9IcELa1m.js +2 -0
  25. package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +1 -0
  26. package/dist/packem_shared/{PrettyReporter-DsHfKOU7.js → PrettyReporter-BUWNEg3_.js} +1 -1
  27. package/dist/packem_shared/{PrettyReporter-CcDdPQSt.js → PrettyReporter-DbgD89ck.js} +56 -30
  28. package/dist/packem_shared/abstract-json-reporter.d-B6NoO-hG.d.ts +61 -0
  29. package/dist/packem_shared/{abstract-pretty-reporter-DrLBJ6ds.js → abstract-pretty-reporter-CyfTvmKf.js} +41 -39
  30. package/dist/packem_shared/create-middleware-logger.d-BRkkBMlk.d.ts +47 -0
  31. package/dist/packem_shared/headers-DI58djdG.js +1 -0
  32. package/dist/packem_shared/index-CbkPnylC.js +1 -0
  33. package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +1 -0
  34. package/dist/packem_shared/storage-DVcJumyk.js +1 -0
  35. package/dist/packem_shared/types.d-4ge_rME4.d.ts +246 -0
  36. package/dist/packem_shared/{types.d-Cz9S7jZh.d.ts → types.d-BW8kAXUv.d.ts} +95 -95
  37. package/dist/packem_shared/types.d-DGHeA2iJ.d.ts +194 -0
  38. package/dist/packem_shared/useLogger-7p55yvvc.js +1 -0
  39. package/dist/packem_shared/wide-event.d-BMLastMR.d.ts +716 -0
  40. package/dist/packem_shared/write-stream-ytl_vhg_.js +1 -0
  41. package/dist/processor/caller/caller-processor.d.ts +32 -33
  42. package/dist/processor/environment-processor.d.ts +83 -84
  43. package/dist/processor/message-formatter-processor.d.ts +40 -45
  44. package/dist/processor/message-formatter-processor.js +1 -1
  45. package/dist/processor/opentelemetry-processor.d.ts +51 -52
  46. package/dist/processor/redact-processor.d.ts +57 -65
  47. package/dist/processor/sampling-processor.d.ts +90 -91
  48. package/dist/reporter/file/json-file-reporter.d.ts +77 -78
  49. package/dist/reporter/file/json-file-reporter.js +1 -1
  50. package/dist/reporter/http/abstract-http-reporter.d.ts +125 -121
  51. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  52. package/dist/reporter/http/http-reporter.d.ts +33 -34
  53. package/dist/reporter/http/http-reporter.edge-light.d.ts +235 -230
  54. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  55. package/dist/reporter/json/index.browser.d.ts +62 -61
  56. package/dist/reporter/json/index.browser.js +1 -1
  57. package/dist/reporter/json/index.d.ts +36 -37
  58. package/dist/reporter/json/index.js +1 -1
  59. package/dist/reporter/pretty/index.browser.d.ts +57 -56
  60. package/dist/reporter/pretty/index.browser.js +1 -1
  61. package/dist/reporter/pretty/index.d.ts +133 -133
  62. package/dist/reporter/pretty/index.js +1 -1
  63. package/dist/reporter/simple/simple-reporter.server.d.ts +91 -90
  64. package/dist/reporter/simple/simple-reporter.server.js +7 -7
  65. package/dist/wide-event.d.ts +2 -3
  66. package/dist/wide-event.js +1 -1
  67. package/package.json +58 -37
  68. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +0 -1
  69. package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +0 -1
  70. package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +0 -2
  71. package/dist/packem_shared/JsonReporter-bmem9lcg.js +0 -1
  72. package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +0 -62
  73. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +0 -25
  74. package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +0 -47
  75. package/dist/packem_shared/headers-DH0H2s8W.js +0 -1
  76. package/dist/packem_shared/index-Q1764hvO.js +0 -1
  77. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +0 -1
  78. package/dist/packem_shared/storage-DaXAlpiO.js +0 -1
  79. package/dist/packem_shared/types.d-bWnqHJKL.d.ts +0 -211
  80. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +0 -229
  81. package/dist/packem_shared/useLogger-DB34CuU5.js +0 -1
  82. package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +0 -717
  83. package/dist/packem_shared/write-stream-C7jxLxIT.js +0 -1
@@ -1,6 +1,5 @@
1
- import { LiteralUnion } from 'type-fest';
1
+ import { L as LiteralUnion, D as DefaultLogTypes, d as LoggerTypesConfig, R as ReadonlyMeta, f as LoggerTypesAwareReporter, E as ExtendedRfc5424LogLevels, I as InteractiveStreamReporter } from "../../packem_shared/types.d-4ge_rME4.js";
2
2
  import { InteractiveManager } from '@visulima/interactive-manager';
3
- import { D as DefaultLogTypes, c as LoggerTypesConfig, R as ReadonlyMeta, e as LoggerTypesAwareReporter, E as ExtendedRfc5424LogLevels, I as InteractiveStreamReporter } from "../../packem_shared/types.d-bWnqHJKL.js";
4
3
  import '@visulima/colorize';
5
4
  type ColorizeMethod = (value: string) => string;
6
5
  type CodeFrameOptions = {
@@ -18,18 +17,18 @@ type CodeFrameOptions = {
18
17
  tabWidth?: number | false;
19
18
  };
20
19
  /**
21
- * The compiled position of a stack frame handed to a {@link SourceMapResolver}.
22
- */
20
+ * The compiled position of a stack frame handed to a {@link SourceMapResolver}.
21
+ */
23
22
  interface SourceMapLocation {
24
23
  column?: number;
25
24
  file: string;
26
25
  line: number;
27
26
  }
28
27
  /**
29
- * The resolved original position returned by a {@link SourceMapResolver}. Any omitted field falls
30
- * back to the compiled value. `source`, when provided, is used directly as the code-frame content
31
- * (e.g. from an inlined `sourcesContent`) instead of reading the resolved file from disk.
32
- */
28
+ * The resolved original position returned by a {@link SourceMapResolver}. Any omitted field falls
29
+ * back to the compiled value. `source`, when provided, is used directly as the code-frame content
30
+ * (e.g. from an inlined `sourcesContent`) instead of reading the resolved file from disk.
31
+ */
33
32
  interface ResolvedSourceLocation {
34
33
  column?: number;
35
34
  file?: string;
@@ -37,19 +36,19 @@ interface ResolvedSourceLocation {
37
36
  source?: string;
38
37
  }
39
38
  /**
40
- * Pluggable hook that maps a compiled `*.js:line:col` position back to its original source position
41
- * (e.g. TS/JSX). Return `undefined` (or throw) to leave the frame untouched. Synchronous so it can
42
- * be used by the synchronous `renderError`; resolve/inline your maps ahead of time.
43
- */
39
+ * Pluggable hook that maps a compiled `*.js:line:col` position back to its original source position
40
+ * (e.g. TS/JSX). Return `undefined` (or throw) to leave the frame untouched. Synchronous so it can
41
+ * be used by the synchronous `renderError`; resolve/inline your maps ahead of time.
42
+ */
44
43
  type SourceMapResolver = (location: SourceMapLocation) => ResolvedSourceLocation | undefined;
45
44
  type Options$1 = {
46
45
  /**
47
- * Read source files for code frames from anywhere on disk, including absolute paths outside
48
- * `cwd`. Defaults to `false`, in which case only files resolving inside `cwd` are read — this
49
- * prevents local file disclosure when rendering errors whose stack came from untrusted input
50
- * (e.g. a deserialized error). Enable only for trusted, locally-thrown errors.
51
- * @default false
52
- */
46
+ * Read source files for code frames from anywhere on disk, including absolute paths outside
47
+ * `cwd`. Defaults to `false`, in which case only files resolving inside `cwd` are read — this
48
+ * prevents local file disclosure when rendering errors whose stack came from untrusted input
49
+ * (e.g. a deserialized error). Enable only for trusted, locally-thrown errors.
50
+ * @default false
51
+ */
53
52
  allowAllFilePaths: boolean;
54
53
  color: CodeFrameOptions["color"] & {
55
54
  fileLine: ColorizeMethod;
@@ -66,114 +65,115 @@ type Options$1 = {
66
65
  hideErrorErrorsCodeView: boolean;
67
66
  hideErrorTitle: boolean;
68
67
  hideMessage: boolean;
69
- indentation: number | " ";
70
- prefix: string; /** Optional source-map resolver to map compiled frame positions back to original source. */
68
+ indentation: number | "\t";
69
+ prefix: string;
70
+ /** Optional source-map resolver to map compiled frame positions back to original source. */
71
71
  sourceMap?: SourceMapResolver;
72
72
  } & Omit<CodeFrameOptions, "message | prefix">;
73
73
  interface Options {
74
74
  /**
75
- * When `true`, honour custom inspectors: a value's
76
- * `Symbol.for("nodejs.util.inspect.custom")` method (Node only),
77
- * `Symbol.for("chai/inspect")` method, an `.inspect()` method, or a handler
78
- * registered via `registerConstructor` / `registerStringTag`.
79
- * @default true
80
- */
75
+ * When `true`, honour custom inspectors: a value's
76
+ * `Symbol.for("nodejs.util.inspect.custom")` method (Node only),
77
+ * `Symbol.for("chai/inspect")` method, an `.inspect()` method, or a handler
78
+ * registered via `registerConstructor` / `registerStringTag`.
79
+ * @default true
80
+ */
81
81
  customInspect: boolean;
82
82
  /**
83
- * The maximum nesting depth to traverse before collapsing a nested value to
84
- * `[Object]` / `[Array]`. A value `&lt;= 0` disables the limit.
85
- * @default 5
86
- */
83
+ * The maximum nesting depth to traverse before collapsing a nested value to
84
+ * `[Object]` / `[Array]`. A value `&lt;= 0` disables the limit.
85
+ * @default 5
86
+ */
87
87
  depth: number;
88
88
  /**
89
- * Pretty-print with indentation. `"\t"` indents with tabs, a positive integer
90
- * indents with that many spaces, and `undefined` keeps everything on one line.
91
- * @default undefined
92
- */
93
- indent: number | " " | undefined;
89
+ * Pretty-print with indentation. `"\t"` indents with tabs, a positive integer
90
+ * indents with that many spaces, and `undefined` keeps everything on one line.
91
+ * @default undefined
92
+ */
93
+ indent: number | "\t" | undefined;
94
94
  /**
95
- * The maximum number of array / typed-array / iterable elements to render
96
- * before the remainder is replaced with an `… (N more)` marker. Use
97
- * `Number.POSITIVE_INFINITY` to show every element.
98
- * @default Number.POSITIVE_INFINITY
99
- */
95
+ * The maximum number of array / typed-array / iterable elements to render
96
+ * before the remainder is replaced with an `… (N more)` marker. Use
97
+ * `Number.POSITIVE_INFINITY` to show every element.
98
+ * @default Number.POSITIVE_INFINITY
99
+ */
100
100
  maxArrayLength: number;
101
101
  /**
102
- * When `true`, render large numbers and bigints with `_` digit-group
103
- * separators (e.g. `1_000_000`).
104
- * @default true
105
- */
102
+ * When `true`, render large numbers and bigints with `_` digit-group
103
+ * separators (e.g. `1_000_000`).
104
+ * @default true
105
+ */
106
106
  numericSeparator: boolean;
107
107
  /**
108
- * The quote character used when rendering string values and complex object
109
- * keys.
110
- * @default "single"
111
- */
108
+ * The quote character used when rendering string values and complex object
109
+ * keys.
110
+ * @default "single"
111
+ */
112
112
  quoteStyle: "double" | "single";
113
113
  /**
114
- * When `true`, also render non-enumerable own properties of plain objects
115
- * (mirrors `util.inspect`'s `showHidden`).
116
- * @default false
117
- */
114
+ * When `true`, also render non-enumerable own properties of plain objects
115
+ * (mirrors `util.inspect`'s `showHidden`).
116
+ * @default false
117
+ */
118
118
  showHidden: boolean;
119
119
  /**
120
- * Colourize / decorate a rendered fragment. Receives the raw fragment and a
121
- * style hint and must return the (optionally wrapped) string. Defaults to the
122
- * identity function.
123
- */
120
+ * Colourize / decorate a rendered fragment. Receives the raw fragment and a
121
+ * style hint and must return the (optionally wrapped) string. Defaults to the
122
+ * identity function.
123
+ */
124
124
  stylize: (value: string, styleType: LiteralUnion<"bigint" | "boolean" | "date" | "null" | "number" | "regexp" | "special" | "string" | "symbol" | "undefined", string>) => string;
125
125
  /**
126
- * The maximum length (in characters) of a single rendered value before it is
127
- * truncated with an ellipsis. Use `Number.POSITIVE_INFINITY` to disable
128
- * truncation.
129
- * @default Number.POSITIVE_INFINITY
130
- */
126
+ * The maximum length (in characters) of a single rendered value before it is
127
+ * truncated with an ellipsis. Use `Number.POSITIVE_INFINITY` to disable
128
+ * truncation.
129
+ * @default Number.POSITIVE_INFINITY
130
+ */
131
131
  truncate: number;
132
132
  }
133
133
  /**
134
- * Abstract Pretty Reporter.
135
- *
136
- * Base class for pretty-printing reporters that format log messages with colors,
137
- * styles, and structured layout. Provides common functionality for styling options
138
- * and logger type configuration.
139
- * @template T - Custom logger type names
140
- * @template L - Log level types
141
- * @example
142
- * ```typescript
143
- * class CustomPrettyReporter extends AbstractPrettyReporter {
144
- * public log(meta: ReadonlyMeta) {
145
- * const formatted = this.formatMessage(meta);
146
- * console.log(formatted);
147
- * }
148
- * }
149
- * ```
150
- */
134
+ * Abstract Pretty Reporter.
135
+ *
136
+ * Base class for pretty-printing reporters that format log messages with colors,
137
+ * styles, and structured layout. Provides common functionality for styling options
138
+ * and logger type configuration.
139
+ * @template T - Custom logger type names
140
+ * @template L - Log level types
141
+ * @example
142
+ * ```typescript
143
+ * class CustomPrettyReporter extends AbstractPrettyReporter {
144
+ * public log(meta: ReadonlyMeta) {
145
+ * const formatted = this.formatMessage(meta);
146
+ * console.log(formatted);
147
+ * }
148
+ * }
149
+ * ```
150
+ */
151
151
  declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
152
152
  /** Styling options for pretty formatting */
153
153
  protected readonly styles: PrettyStyleOptions;
154
154
  /** Logger type configurations for styling */
155
155
  protected loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
156
156
  /**
157
- * Creates a new AbstractPrettyReporter instance.
158
- * @param options Styling options for pretty formatting
159
- * @protected
160
- */
157
+ * Creates a new AbstractPrettyReporter instance.
158
+ * @param options Styling options for pretty formatting
159
+ * @protected
160
+ */
161
161
  protected constructor(options: Partial<PrettyStyleOptions>);
162
162
  /**
163
- * Sets the logger types configuration for styling.
164
- * @param types Logger type configurations with colors and labels
165
- */
163
+ * Sets the logger types configuration for styling.
164
+ * @param types Logger type configurations with colors and labels
165
+ */
166
166
  setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
167
167
  /**
168
- * Logs a message with pretty formatting.
169
- * @param meta The log metadata to format and output
170
- * @abstract
171
- */
168
+ * Logs a message with pretty formatting.
169
+ * @param meta The log metadata to format and output
170
+ * @abstract
171
+ */
172
172
  abstract log(meta: ReadonlyMeta<L>): void;
173
173
  }
174
174
  /**
175
- * Options for configuring pretty reporter styling.
176
- */
175
+ * Options for configuring pretty reporter styling.
176
+ */
177
177
  type PrettyStyleOptions = {
178
178
  /** Bold styling options */
179
179
  bold: {
@@ -200,8 +200,8 @@ type PrettyStyleOptions = {
200
200
  };
201
201
  };
202
202
  /**
203
- * Options for configuring the Server Pretty Reporter.
204
- */
203
+ * Options for configuring the Server Pretty Reporter.
204
+ */
205
205
  type PrettyReporterOptions = PrettyStyleOptions & {
206
206
  /** Error rendering options */
207
207
  error: Partial<Omit<Options$1, "color" | "prefix" | "indentation">>;
@@ -209,59 +209,59 @@ type PrettyReporterOptions = PrettyStyleOptions & {
209
209
  inspect: Partial<Options>;
210
210
  };
211
211
  /**
212
- * Server Pretty Reporter.
213
- *
214
- * A comprehensive pretty-printing reporter for Node.js server environments that
215
- * formats log messages with colors, structured layout, and advanced features like
216
- * error rendering, object inspection, and interactive terminal support.
217
- * @template T - Custom logger type names
218
- * @template L - Log level types
219
- * @example
220
- * ```typescript
221
- * import { createPail } from "@visulima/pail";
222
- *
223
- * const logger = createPail({
224
- * reporters: [new PrettyReporter({
225
- * bold: { label: true },
226
- * error: { color: { title: 'red' } }
227
- * })]
228
- * });
229
- *
230
- * logger.info("Server started on port 3000");
231
- * logger.error("Database error", dbError);
232
- * ```
233
- */
212
+ * Server Pretty Reporter.
213
+ *
214
+ * A comprehensive pretty-printing reporter for Node.js server environments that
215
+ * formats log messages with colors, structured layout, and advanced features like
216
+ * error rendering, object inspection, and interactive terminal support.
217
+ * @template T - Custom logger type names
218
+ * @template L - Log level types
219
+ * @example
220
+ * ```typescript
221
+ * import { createPail } from "@visulima/pail";
222
+ *
223
+ * const logger = createPail({
224
+ * reporters: [new PrettyReporter({
225
+ * bold: { label: true },
226
+ * error: { color: { title: 'red' } }
227
+ * })]
228
+ * });
229
+ *
230
+ * logger.info("Server started on port 3000");
231
+ * logger.error("Database error", dbError);
232
+ * ```
233
+ */
234
234
  declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
235
235
  #private;
236
236
  /**
237
- * Creates a new Server Pretty Reporter instance.
238
- * @param options Configuration options for styling, error rendering, and object inspection
239
- */
237
+ * Creates a new Server Pretty Reporter instance.
238
+ * @param options Configuration options for styling, error rendering, and object inspection
239
+ */
240
240
  constructor(options?: Partial<PrettyReporterOptions>);
241
241
  /**
242
- * Sets the logger types configuration and refreshes cached badge/label widths.
243
- * @param types Logger type configurations with colors and labels
244
- */
242
+ * Sets the logger types configuration and refreshes cached badge/label widths.
243
+ * @param types Logger type configurations with colors and labels
244
+ */
245
245
  override setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
246
246
  /**
247
- * Sets the stdout stream for the reporter.
248
- * @param stdout_ The writable stream to use for standard output
249
- */
247
+ * Sets the stdout stream for the reporter.
248
+ * @param stdout_ The writable stream to use for standard output
249
+ */
250
250
  setStdout(stdout_: NodeJS.WriteStream): void;
251
251
  /**
252
- * Sets the stderr stream for the reporter.
253
- * @param stderr_ The writable stream to use for error output
254
- */
252
+ * Sets the stderr stream for the reporter.
253
+ * @param stderr_ The writable stream to use for error output
254
+ */
255
255
  setStderr(stderr_: NodeJS.WriteStream): void;
256
256
  /**
257
- * Sets the interactive manager for handling interactive output.
258
- * @param manager The interactive manager instance, or undefined to disable
259
- */
257
+ * Sets the interactive manager for handling interactive output.
258
+ * @param manager The interactive manager instance, or undefined to disable
259
+ */
260
260
  setInteractiveManager(manager?: InteractiveManager): void;
261
261
  /**
262
- * Enables or disables interactive mode.
263
- * @param interactive Whether to enable interactive terminal features
264
- */
262
+ * Enables or disables interactive mode.
263
+ * @param interactive Whether to enable interactive terminal features
264
+ */
265
265
  setIsInteractive(interactive: boolean): void;
266
266
  log(meta: ReadonlyMeta<L>): void;
267
267
  protected _formatMessage(data: ReadonlyMeta<L>): string;
@@ -1 +1 @@
1
- import{PrettyReporter as t}from"../../packem_shared/PrettyReporter-CcDdPQSt.js";export{t as PrettyReporter};
1
+ import{PrettyReporter as t}from"../../packem_shared/PrettyReporter-DbgD89ck.js";export{t as PrettyReporter};
@@ -1,6 +1,6 @@
1
1
  import { LiteralUnion } from 'type-fest';
2
2
  import { InteractiveManager } from '@visulima/interactive-manager';
3
- import { D as DefaultLogTypes, L as LoggerTypesConfig, f as ReadonlyMeta, d as LoggerTypesAwareReporter, I as InteractiveStreamReporter } from "../../packem_shared/types.d-Cz9S7jZh.js";
3
+ import { D as DefaultLogTypes, L as LoggerTypesConfig, f as ReadonlyMeta, d as LoggerTypesAwareReporter, I as InteractiveStreamReporter } from "../../packem_shared/types.d-BW8kAXUv.js";
4
4
  import '@visulima/colorize';
5
5
  type ColorizeMethod = (value: string) => string;
6
6
  type CodeFrameOptions = {
@@ -18,18 +18,18 @@ type CodeFrameOptions = {
18
18
  tabWidth?: number | false;
19
19
  };
20
20
  /**
21
- * The compiled position of a stack frame handed to a {@link SourceMapResolver}.
22
- */
21
+ * The compiled position of a stack frame handed to a {@link SourceMapResolver}.
22
+ */
23
23
  interface SourceMapLocation {
24
24
  column?: number;
25
25
  file: string;
26
26
  line: number;
27
27
  }
28
28
  /**
29
- * The resolved original position returned by a {@link SourceMapResolver}. Any omitted field falls
30
- * back to the compiled value. `source`, when provided, is used directly as the code-frame content
31
- * (e.g. from an inlined `sourcesContent`) instead of reading the resolved file from disk.
32
- */
29
+ * The resolved original position returned by a {@link SourceMapResolver}. Any omitted field falls
30
+ * back to the compiled value. `source`, when provided, is used directly as the code-frame content
31
+ * (e.g. from an inlined `sourcesContent`) instead of reading the resolved file from disk.
32
+ */
33
33
  interface ResolvedSourceLocation {
34
34
  column?: number;
35
35
  file?: string;
@@ -37,19 +37,19 @@ interface ResolvedSourceLocation {
37
37
  source?: string;
38
38
  }
39
39
  /**
40
- * Pluggable hook that maps a compiled `*.js:line:col` position back to its original source position
41
- * (e.g. TS/JSX). Return `undefined` (or throw) to leave the frame untouched. Synchronous so it can
42
- * be used by the synchronous `renderError`; resolve/inline your maps ahead of time.
43
- */
40
+ * Pluggable hook that maps a compiled `*.js:line:col` position back to its original source position
41
+ * (e.g. TS/JSX). Return `undefined` (or throw) to leave the frame untouched. Synchronous so it can
42
+ * be used by the synchronous `renderError`; resolve/inline your maps ahead of time.
43
+ */
44
44
  type SourceMapResolver = (location: SourceMapLocation) => ResolvedSourceLocation | undefined;
45
45
  type Options$1 = {
46
46
  /**
47
- * Read source files for code frames from anywhere on disk, including absolute paths outside
48
- * `cwd`. Defaults to `false`, in which case only files resolving inside `cwd` are read — this
49
- * prevents local file disclosure when rendering errors whose stack came from untrusted input
50
- * (e.g. a deserialized error). Enable only for trusted, locally-thrown errors.
51
- * @default false
52
- */
47
+ * Read source files for code frames from anywhere on disk, including absolute paths outside
48
+ * `cwd`. Defaults to `false`, in which case only files resolving inside `cwd` are read — this
49
+ * prevents local file disclosure when rendering errors whose stack came from untrusted input
50
+ * (e.g. a deserialized error). Enable only for trusted, locally-thrown errors.
51
+ * @default false
52
+ */
53
53
  allowAllFilePaths: boolean;
54
54
  color: CodeFrameOptions["color"] & {
55
55
  fileLine: ColorizeMethod;
@@ -66,114 +66,115 @@ type Options$1 = {
66
66
  hideErrorErrorsCodeView: boolean;
67
67
  hideErrorTitle: boolean;
68
68
  hideMessage: boolean;
69
- indentation: number | " ";
70
- prefix: string; /** Optional source-map resolver to map compiled frame positions back to original source. */
69
+ indentation: number | "\t";
70
+ prefix: string;
71
+ /** Optional source-map resolver to map compiled frame positions back to original source. */
71
72
  sourceMap?: SourceMapResolver;
72
73
  } & Omit<CodeFrameOptions, "message | prefix">;
73
74
  interface Options {
74
75
  /**
75
- * When `true`, honour custom inspectors: a value's
76
- * `Symbol.for("nodejs.util.inspect.custom")` method (Node only),
77
- * `Symbol.for("chai/inspect")` method, an `.inspect()` method, or a handler
78
- * registered via `registerConstructor` / `registerStringTag`.
79
- * @default true
80
- */
76
+ * When `true`, honour custom inspectors: a value's
77
+ * `Symbol.for("nodejs.util.inspect.custom")` method (Node only),
78
+ * `Symbol.for("chai/inspect")` method, an `.inspect()` method, or a handler
79
+ * registered via `registerConstructor` / `registerStringTag`.
80
+ * @default true
81
+ */
81
82
  customInspect: boolean;
82
83
  /**
83
- * The maximum nesting depth to traverse before collapsing a nested value to
84
- * `[Object]` / `[Array]`. A value `&lt;= 0` disables the limit.
85
- * @default 5
86
- */
84
+ * The maximum nesting depth to traverse before collapsing a nested value to
85
+ * `[Object]` / `[Array]`. A value `&lt;= 0` disables the limit.
86
+ * @default 5
87
+ */
87
88
  depth: number;
88
89
  /**
89
- * Pretty-print with indentation. `"\t"` indents with tabs, a positive integer
90
- * indents with that many spaces, and `undefined` keeps everything on one line.
91
- * @default undefined
92
- */
93
- indent: number | " " | undefined;
90
+ * Pretty-print with indentation. `"\t"` indents with tabs, a positive integer
91
+ * indents with that many spaces, and `undefined` keeps everything on one line.
92
+ * @default undefined
93
+ */
94
+ indent: number | "\t" | undefined;
94
95
  /**
95
- * The maximum number of array / typed-array / iterable elements to render
96
- * before the remainder is replaced with an `… (N more)` marker. Use
97
- * `Number.POSITIVE_INFINITY` to show every element.
98
- * @default Number.POSITIVE_INFINITY
99
- */
96
+ * The maximum number of array / typed-array / iterable elements to render
97
+ * before the remainder is replaced with an `… (N more)` marker. Use
98
+ * `Number.POSITIVE_INFINITY` to show every element.
99
+ * @default Number.POSITIVE_INFINITY
100
+ */
100
101
  maxArrayLength: number;
101
102
  /**
102
- * When `true`, render large numbers and bigints with `_` digit-group
103
- * separators (e.g. `1_000_000`).
104
- * @default true
105
- */
103
+ * When `true`, render large numbers and bigints with `_` digit-group
104
+ * separators (e.g. `1_000_000`).
105
+ * @default true
106
+ */
106
107
  numericSeparator: boolean;
107
108
  /**
108
- * The quote character used when rendering string values and complex object
109
- * keys.
110
- * @default "single"
111
- */
109
+ * The quote character used when rendering string values and complex object
110
+ * keys.
111
+ * @default "single"
112
+ */
112
113
  quoteStyle: "double" | "single";
113
114
  /**
114
- * When `true`, also render non-enumerable own properties of plain objects
115
- * (mirrors `util.inspect`'s `showHidden`).
116
- * @default false
117
- */
115
+ * When `true`, also render non-enumerable own properties of plain objects
116
+ * (mirrors `util.inspect`'s `showHidden`).
117
+ * @default false
118
+ */
118
119
  showHidden: boolean;
119
120
  /**
120
- * Colourize / decorate a rendered fragment. Receives the raw fragment and a
121
- * style hint and must return the (optionally wrapped) string. Defaults to the
122
- * identity function.
123
- */
121
+ * Colourize / decorate a rendered fragment. Receives the raw fragment and a
122
+ * style hint and must return the (optionally wrapped) string. Defaults to the
123
+ * identity function.
124
+ */
124
125
  stylize: (value: string, styleType: LiteralUnion<"bigint" | "boolean" | "date" | "null" | "number" | "regexp" | "special" | "string" | "symbol" | "undefined", string>) => string;
125
126
  /**
126
- * The maximum length (in characters) of a single rendered value before it is
127
- * truncated with an ellipsis. Use `Number.POSITIVE_INFINITY` to disable
128
- * truncation.
129
- * @default Number.POSITIVE_INFINITY
130
- */
127
+ * The maximum length (in characters) of a single rendered value before it is
128
+ * truncated with an ellipsis. Use `Number.POSITIVE_INFINITY` to disable
129
+ * truncation.
130
+ * @default Number.POSITIVE_INFINITY
131
+ */
131
132
  truncate: number;
132
133
  }
133
134
  /**
134
- * Abstract Pretty Reporter.
135
- *
136
- * Base class for pretty-printing reporters that format log messages with colors,
137
- * styles, and structured layout. Provides common functionality for styling options
138
- * and logger type configuration.
139
- * @template T - Custom logger type names
140
- * @template L - Log level types
141
- * @example
142
- * ```typescript
143
- * class CustomPrettyReporter extends AbstractPrettyReporter {
144
- * public log(meta: ReadonlyMeta) {
145
- * const formatted = this.formatMessage(meta);
146
- * console.log(formatted);
147
- * }
148
- * }
149
- * ```
150
- */
135
+ * Abstract Pretty Reporter.
136
+ *
137
+ * Base class for pretty-printing reporters that format log messages with colors,
138
+ * styles, and structured layout. Provides common functionality for styling options
139
+ * and logger type configuration.
140
+ * @template T - Custom logger type names
141
+ * @template L - Log level types
142
+ * @example
143
+ * ```typescript
144
+ * class CustomPrettyReporter extends AbstractPrettyReporter {
145
+ * public log(meta: ReadonlyMeta) {
146
+ * const formatted = this.formatMessage(meta);
147
+ * console.log(formatted);
148
+ * }
149
+ * }
150
+ * ```
151
+ */
151
152
  declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
152
153
  /** Styling options for pretty formatting */
153
154
  protected readonly styles: PrettyStyleOptions;
154
155
  /** Logger type configurations for styling */
155
156
  protected loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
156
157
  /**
157
- * Creates a new AbstractPrettyReporter instance.
158
- * @param options Styling options for pretty formatting
159
- * @protected
160
- */
158
+ * Creates a new AbstractPrettyReporter instance.
159
+ * @param options Styling options for pretty formatting
160
+ * @protected
161
+ */
161
162
  protected constructor(options: Partial<PrettyStyleOptions>);
162
163
  /**
163
- * Sets the logger types configuration for styling.
164
- * @param types Logger type configurations with colors and labels
165
- */
164
+ * Sets the logger types configuration for styling.
165
+ * @param types Logger type configurations with colors and labels
166
+ */
166
167
  setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
167
168
  /**
168
- * Logs a message with pretty formatting.
169
- * @param meta The log metadata to format and output
170
- * @abstract
171
- */
169
+ * Logs a message with pretty formatting.
170
+ * @param meta The log metadata to format and output
171
+ * @abstract
172
+ */
172
173
  abstract log(meta: ReadonlyMeta<L>): void;
173
174
  }
174
175
  /**
175
- * Options for configuring pretty reporter styling.
176
- */
176
+ * Options for configuring pretty reporter styling.
177
+ */
177
178
  type PrettyStyleOptions = {
178
179
  /** Bold styling options */
179
180
  bold: {
@@ -1,11 +1,11 @@
1
- import{createRequire as P}from"node:module";import L from"@visulima/colorize";import{A as z,c as B,r as D,b as O,d as F,g as G,e as H,f as c,h as K,a as Q,j as C,V as U,U as $,i as X}from"../../packem_shared/abstract-pretty-reporter-DrLBJ6ds.js";const ie=P(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:W,stderr:Y}=V,{bgGrey:Z,bold:E,cyan:J,green:N,greenBright:ee,grey:h,red:b,underline:I,white:te}=L,se=/[\\/]pail[\\/]dist/,x=T=>!se.test(T);class he extends z{#e;#r;#i;#h=!1;#o;#s;#t;#a=!1;#n="";#p="";constructor(t={}){const{error:o,inspect:n,...i}=t;super({uppercase:{label:!0,...i.uppercase},...i}),this.#o={...B,indent:void 0,...n},this.#s={...o,color:{fileLine:N,hint:J,marker:b,message:b,method:ee,title:b}},this.#e=W,this.#r=Y,this.#l()}setLoggerTypes(t){super.setLoggerTypes(t),this.#l()}setStdout(t){this.#e=t,this.#t=void 0,this.#a=!1}setStderr(t){this.#r=t}setInteractiveManager(t){this.#i=t}setIsInteractive(t){this.#h=t}log(t){const o=this.formatMessage(t),n=t.type.level,i=D(n)?"stderr":"stdout",a=i==="stderr"?this.#r:this.#e;this.#h&&this.#i!==void 0&&a.isTTY?this.#i.update(i,o.split(`
2
- `),0):O(`${o}
3
- `,a)}#l(){this.#n=F(this.loggerTypes),this.#p=G(this.loggerTypes)}#u(){return!this.#a&&typeof this.#e.on=="function"&&(this.#a=!0,this.#e.on("resize",()=>{this.#t=void 0})),this.#t===void 0&&(this.#t=H().columns),this.#t}formatMessage(t){let o=this.#u();typeof this.styles.messageLength=="number"&&(o=this.styles.messageLength);const{badge:n,context:i,date:a,error:S,file:l,groups:f,label:g,message:u,prefix:d,repeated:j,scope:m,suffix:y,traceError:_,type:R}=t,{color:M}=this.loggerTypes[R.name],v=M?L[M]:te,p=f.map(()=>" ").join(""),e=[];if(f.length>0&&e.push(`${p+h(`[${f.at(-1)??""}]`)} `),a&&e.push(`${h(this.styles.dateFormatter(typeof a=="string"?new Date(a):a))} `),n)e.push(E(v(n)));else{const s=this.#n;s.length>0&&e.push(h(" ".repeat(s.length)))}const A=this.#p,w=c(A);if(g){const s=c(g),r=Math.max(0,w-s);e.push(`${E(v(K(g,this.styles)))} `," ".repeat(r))}else e.push(" ".repeat(w+1));j&&e.push(`${Z.white(`[${String(j)}x]`)} `),Array.isArray(m)&&m.length>0&&e.push(`${h(`[${m.join(" > ")}]`)} `),d&&e.push(`${h(`[${this.styles.underline.prefix?I(d):d}]`)} `);const k=c(e.join(""));if(u!==Q){const s=typeof u=="string"?u:C(u,this.#o);e.push(p+U(s,{trim:!1,width:o-3,wrapMode:X.STRICT_WIDTH}))}if(i){let s=!1;e.push(...i.map(r=>{if(r instanceof Error)return s=!0,`
1
+ import{createRequire as re}from"node:module";import I from"@visulima/colorize";import{A as W,c as z,r as B,b as D,d as G,g as O,e as F,f as c,h as H,a as K,Y as C,V as Q,G as $,S as X}from"../../packem_shared/abstract-pretty-reporter-CyfTvmKf.js";const A=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:P,stderr:V}=A,{bgGrey:Z,bold:E,cyan:J,green:N,greenBright:U,grey:h,red:b,underline:R,white:ee}=I,te=/[\\/]pail[\\/]dist/,x=S=>!te.test(S);class ae extends W{#e;#r;#i;#h=!1;#o;#s;#t;#a=!1;#n="";#p="";constructor(t={}){const{error:o,inspect:n,...i}=t;super({uppercase:{label:!0,...i.uppercase},...i}),this.#o={...z,indent:void 0,...n},this.#s={...o,color:{fileLine:N,hint:J,marker:b,message:b,method:U,title:b}},this.#e=P,this.#r=V,this.#l()}setLoggerTypes(t){super.setLoggerTypes(t),this.#l()}setStdout(t){this.#e=t,this.#t=void 0,this.#a=!1}setStderr(t){this.#r=t}setInteractiveManager(t){this.#i=t}setIsInteractive(t){this.#h=t}log(t){const o=this.formatMessage(t),n=t.type.level,i=B(n)?"stderr":"stdout",a=i==="stderr"?this.#r:this.#e;this.#h&&this.#i!==void 0&&a.isTTY?this.#i.update(i,o.split(`
2
+ `),0):D(`${o}
3
+ `,a)}#l(){this.#n=G(this.loggerTypes),this.#p=O(this.loggerTypes)}#u(){return!this.#a&&typeof this.#e.on=="function"&&(this.#a=!0,this.#e.on("resize",()=>{this.#t=void 0})),this.#t===void 0&&(this.#t=F().columns),this.#t}formatMessage(t){let o=this.#u();typeof this.styles.messageLength=="number"&&(o=this.styles.messageLength);const{badge:n,context:i,date:a,error:T,file:l,groups:f,label:g,message:u,prefix:d,repeated:_,scope:m,suffix:y,traceError:j,type:L}=t,{color:M}=this.loggerTypes[L.name],v=M?I[M]:ee,p=f.map(()=>" ").join(""),e=[];if(f.length>0&&e.push(`${p+h(`[${f.at(-1)??""}]`)} `),a&&e.push(`${h(this.styles.dateFormatter(typeof a=="string"?new Date(a):a))} `),n)e.push(E(v(n)));else{const s=this.#n;s.length>0&&e.push(h(" ".repeat(s.length)))}const q=this.#p,w=c(q);if(g){const s=c(g),r=Math.max(0,w-s);e.push(`${E(v(H(g,this.styles)))} `," ".repeat(r))}else e.push(" ".repeat(w+1));_&&e.push(`${Z.white(`[${String(_)}x]`)} `),Array.isArray(m)&&m.length>0&&e.push(`${h(`[${m.join(" > ")}]`)} `),d&&e.push(`${h(`[${this.styles.underline.prefix?R(d):d}]`)} `);const Y=c(e.join(""));if(u!==K){const s=typeof u=="string"?u:C(u,this.#o);e.push(p+Q(s,{trim:!1,width:o-3,wrapMode:X.STRICT_WIDTH}))}if(i){let s=!1;e.push(...i.map(r=>{if(r instanceof Error)return s=!0,`
4
4
 
5
- ${$(r,{...this.#s,filterStacktrace:x,prefix:p})}`;if(typeof r=="object")return` ${C(r,this.#o)}`;const q=(s?`
5
+ ${$(r,{...this.#s,filterStacktrace:x,prefix:p})}`;if(typeof r=="object")return` ${C(r,this.#o)}`;const k=(s?`
6
6
 
7
- `:" ")+String(r);return s=!1,q}))}if(S&&e.push($(S,{...this.#s,filterStacktrace:x,prefix:p})),_&&e.push(`
7
+ `:" ")+String(r);return s=!1,k}))}if(T&&e.push($(T,{...this.#s,filterStacktrace:x,prefix:p})),j&&e.push(`
8
8
 
9
- ${$(_,{...this.#s,filterStacktrace:x,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:p})}`),y&&e.push(` ${p}${h(this.styles.underline.suffix?I(y):y)}`),l){const s=(l.name??"")+(l.line?`:${String(l.line)}`:""),r=Math.max(0,k-c("Caller: "));e.push(`
9
+ ${$(j,{...this.#s,filterStacktrace:x,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:p})}`),y&&e.push(` ${p}${h(this.styles.underline.suffix?R(y):y)}`),l){const s=(l.name??"")+(l.line?`:${String(l.line)}`:""),r=Math.max(0,Y-c("Caller: "));e.push(`
10
10
  `,h("Caller: ")," ".repeat(r),s,`
11
- `)}return e.join("")}}export{he as SimpleReporter};
11
+ `)}return e.join("")}}export{ae as SimpleReporter};