@visulima/pail 4.0.0-alpha.11 → 4.0.0-alpha.12

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 (78) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.md +152 -894
  3. package/dist/error.d.ts +95 -96
  4. package/dist/index.browser.d.ts +557 -47
  5. package/dist/index.browser.js +1 -1
  6. package/dist/index.server.d.ts +722 -61
  7. package/dist/index.server.js +5 -4
  8. package/dist/middleware/elysia.d.ts +65 -63
  9. package/dist/middleware/express.d.ts +73 -71
  10. package/dist/middleware/fastify.d.ts +69 -67
  11. package/dist/middleware/hono.d.ts +74 -72
  12. package/dist/middleware/next/handler.d.ts +101 -34
  13. package/dist/middleware/sveltekit.d.ts +100 -98
  14. package/dist/object-tree.d.ts +67 -70
  15. package/dist/packem_shared/{PrettyReporter-BtTr13Ha.js → PrettyReporter-CIbrmjUV.js} +1 -1
  16. package/dist/packem_shared/{PrettyReporter-BCvyNzXO.js → PrettyReporter-CNJEO9g7.js} +11 -8
  17. package/dist/packem_shared/abstract-json-reporter.d-BAgznjyU.d.ts +61 -0
  18. package/dist/packem_shared/{abstract-pretty-reporter-CXAKYCb8.js → abstract-pretty-reporter-CkqCt5hg.js} +4 -2
  19. package/dist/packem_shared/create-middleware-logger.d-DheMh8q4.d.ts +47 -0
  20. package/dist/packem_shared/{index-Bx3-C0j9.js → index-6cG1Kp0t.js} +2 -2
  21. package/dist/packem_shared/types.d-BeLumqgD.d.ts +246 -0
  22. package/dist/packem_shared/types.d-C51XNfQz.d.ts +194 -0
  23. package/dist/packem_shared/types.d-CM5ie2qm.d.ts +236 -0
  24. package/dist/packem_shared/wide-event.d-B-t8ZnhI.d.ts +704 -0
  25. package/dist/processor/caller/caller-processor.d.ts +49 -47
  26. package/dist/processor/environment-processor.d.ts +113 -113
  27. package/dist/processor/environment-processor.js +3 -10
  28. package/dist/processor/message-formatter-processor.d.ts +51 -49
  29. package/dist/processor/message-formatter-processor.js +2 -2
  30. package/dist/processor/opentelemetry-processor.d.ts +69 -66
  31. package/dist/processor/redact-processor.d.ts +60 -41
  32. package/dist/processor/sampling-processor.d.ts +102 -101
  33. package/dist/reporter/file/json-file-reporter.d.ts +91 -42
  34. package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
  35. package/dist/reporter/http/http-reporter.d.ts +40 -36
  36. package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
  37. package/dist/reporter/json/index.browser.d.ts +99 -3
  38. package/dist/reporter/json/index.d.ts +51 -3
  39. package/dist/reporter/pretty/index.browser.d.ts +106 -2
  40. package/dist/reporter/pretty/index.browser.js +1 -1
  41. package/dist/reporter/pretty/index.d.ts +219 -2
  42. package/dist/reporter/pretty/index.js +1 -1
  43. package/dist/reporter/simple/simple-reporter.server.d.ts +168 -18
  44. package/dist/reporter/simple/simple-reporter.server.js +3 -2
  45. package/dist/wide-event.d.ts +5 -300
  46. package/package.json +6 -7
  47. package/dist/constants.d.ts +0 -37
  48. package/dist/middleware/next/middleware.d.ts +0 -59
  49. package/dist/middleware/next/storage.d.ts +0 -14
  50. package/dist/middleware/shared/create-middleware-logger.d.ts +0 -82
  51. package/dist/middleware/shared/headers.d.ts +0 -14
  52. package/dist/middleware/shared/routes.d.ts +0 -30
  53. package/dist/middleware/shared/storage.d.ts +0 -29
  54. package/dist/pail.browser.d.ts +0 -412
  55. package/dist/pail.server.d.ts +0 -158
  56. package/dist/processor/caller/get-caller-filename.d.ts +0 -23
  57. package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
  58. package/dist/reporter/http/utils/compression.d.ts +0 -7
  59. package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
  60. package/dist/reporter/http/utils/retry.d.ts +0 -27
  61. package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
  62. package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
  63. package/dist/reporter/json/json-reporter.server.d.ts +0 -50
  64. package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
  65. package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
  66. package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
  67. package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
  68. package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
  69. package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
  70. package/dist/reporter/utils/format-label.d.ts +0 -3
  71. package/dist/types.d.ts +0 -241
  72. package/dist/utils/arrayify.d.ts +0 -2
  73. package/dist/utils/get-longest-badge.d.ts +0 -4
  74. package/dist/utils/get-longest-label.d.ts +0 -4
  75. package/dist/utils/merge-types.d.ts +0 -4
  76. package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
  77. package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
  78. package/dist/utils/write-stream.d.ts +0 -2
@@ -1,36 +1,103 @@
1
- import type { PailMiddlewareOptions } from "../shared/create-middleware-logger.d.ts";
1
+ import { P as PailMiddlewareOptions } from "../../packem_shared/create-middleware-logger.d-DheMh8q4.js";
2
+ import { W as WideEvent } from "../../packem_shared/wide-event.d-B-t8ZnhI.js";
3
+ import 'node:async_hooks';
4
+ import "../../packem_shared/types.d-BeLumqgD.js";
5
+ import '@visulima/colorize';
6
+ import '@visulima/interactive-manager';
7
+ import 'safe-stable-stringify';
8
+ /**
9
+ * Minimal type definitions to avoid requiring next as a dependency.
10
+ */
11
+ interface NextRequest {
12
+ headers: Headers;
13
+ nextUrl: {
14
+ pathname: string;
15
+ };
16
+ }
17
+ interface NextResponse {
18
+ headers: Headers;
19
+ }
20
+ interface NextResponseConstructor {
21
+ next: (options?: {
22
+ request?: {
23
+ headers?: Headers;
24
+ };
25
+ }) => NextResponse;
26
+ }
27
+ /**
28
+ * Options for the Next.js pail middleware.
29
+ */
30
+ interface PailNextMiddlewareOptions {
31
+ /**
32
+ * Glob patterns for paths to exclude from logging.
33
+ * Excluded paths won't get request IDs or timing headers.
34
+ * @example ["/_next/**", "/favicon.ico"]
35
+ */
36
+ exclude?: string[];
37
+ /**
38
+ * Glob patterns for paths to include in logging.
39
+ * If not set, all non-excluded paths are included.
40
+ */
41
+ include?: string[];
42
+ }
43
+ /**
44
+ * Create a Next.js edge middleware that sets `x-request-id` and `x-pail-start`
45
+ * headers on the request for downstream use by `withPail()`.
46
+ *
47
+ * This middleware runs at the edge and prepares request metadata.
48
+ * The actual wide event logging happens in `withPail()`.
49
+ * @param NextResponseClass The NextResponse class from "next/server.js"
50
+ * @param options Middleware configuration
51
+ * @returns A middleware function
52
+ * @example
53
+ * ```typescript
54
+ * // middleware.ts
55
+ * import { NextResponse } from "next/server.js";
56
+ * import { pailMiddleware } from "@visulima/pail/middleware/next";
57
+ *
58
+ * const middleware = pailMiddleware(NextResponse, {
59
+ * exclude: ["/_next/**", "/favicon.ico"],
60
+ * });
61
+ *
62
+ * export default middleware;
63
+ * ```
64
+ */
65
+ declare const pailMiddleware: (NextResponseClass: NextResponseConstructor, options?: PailNextMiddlewareOptions) => (request: NextRequest) => NextResponse;
66
+ /**
67
+ * Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
68
+ * Must be called within a `withPail()` wrapped handler or server action.
69
+ * @returns The request-scoped WideEvent logger
70
+ * @throws Error if called outside of a withPail context
71
+ */
72
+ declare const useLogger: () => WideEvent;
2
73
  type NextPailOptions<T extends string = string> = PailMiddlewareOptions<T>;
3
74
  /**
4
- * Create a `withPail` wrapper function for Next.js route handlers and server actions.
5
- *
6
- * Wraps handler execution in AsyncLocalStorage so that `useLogger()` works
7
- * anywhere in the async call stack. The wide event is automatically emitted
8
- * when the handler completes or throws.
9
- * @param options Configuration options
10
- * @returns A `withPail` wrapper function
11
- * @example
12
- * ```typescript
13
- * // lib/pail.ts
14
- * import { createPail } from "@visulima/pail";
15
- * import { createWithPail } from "@visulima/pail/middleware/next";
16
- *
17
- * const logger = createPail();
18
- * export const withPail = createWithPail({ pail: logger });
19
- *
20
- * // app/api/users/route.ts
21
- * import { withPail } from "@/lib/pail";
22
- * import { useLogger } from "@visulima/pail/middleware/next";
23
- *
24
- * export const GET = withPail(async (request: Request) => {
25
- * const log = useLogger();
26
- * log.set({ user: { id: 1 } });
27
- * return Response.json({ ok: true });
28
- * });
29
- * ```
30
- */
31
- export declare const createWithPail: <T extends string = string>(options: NextPailOptions<T>) => <TArgs extends unknown[], TReturn>(handler: (...args: TArgs) => Promise<TReturn> | TReturn) => ((...args: TArgs) => Promise<TReturn>);
32
- export type { NextPailOptions };
33
- export type { WideEvent } from "../../wide-event.d.ts";
34
- export type { PailNextMiddlewareOptions } from "./middleware/next/middleware.d.ts";
35
- export { pailMiddleware } from "./middleware/next/middleware.d.ts";
36
- export { useLogger } from "./storage.d.ts";
75
+ * Create a `withPail` wrapper function for Next.js route handlers and server actions.
76
+ *
77
+ * Wraps handler execution in AsyncLocalStorage so that `useLogger()` works
78
+ * anywhere in the async call stack. The wide event is automatically emitted
79
+ * when the handler completes or throws.
80
+ * @param options Configuration options
81
+ * @returns A `withPail` wrapper function
82
+ * @example
83
+ * ```typescript
84
+ * // lib/pail.ts
85
+ * import { createPail } from "@visulima/pail";
86
+ * import { createWithPail } from "@visulima/pail/middleware/next";
87
+ *
88
+ * const logger = createPail();
89
+ * export const withPail = createWithPail({ pail: logger });
90
+ *
91
+ * // app/api/users/route.ts
92
+ * import { withPail } from "@/lib/pail";
93
+ * import { useLogger } from "@visulima/pail/middleware/next";
94
+ *
95
+ * export const GET = withPail(async (request: Request) => {
96
+ * const log = useLogger();
97
+ * log.set({ user: { id: 1 } });
98
+ * return Response.json({ ok: true });
99
+ * });
100
+ * ```
101
+ */
102
+ declare const createWithPail: <T extends string = string>(options: NextPailOptions<T>) => <TArgs extends unknown[], TReturn>(handler: (...args: TArgs) => Promise<TReturn> | TReturn) => (...args: TArgs) => Promise<TReturn>;
103
+ export { type NextPailOptions, type PailNextMiddlewareOptions, type WideEvent, createWithPail, pailMiddleware, useLogger };
@@ -1,123 +1,125 @@
1
- import type { WideEvent } from "../wide-event.d.ts";
2
- import type { PailMiddlewareOptions } from "./shared/create-middleware-logger.d.ts";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-B-t8ZnhI.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-DheMh8q4.js";
3
+ import 'safe-stable-stringify';
4
+ import "../packem_shared/types.d-BeLumqgD.js";
5
+ import '@visulima/colorize';
6
+ import '@visulima/interactive-manager';
3
7
  /**
4
- * A SvelteKit-like event object with access to the pail logger via `locals.log`.
5
- * @example
6
- * ```typescript
7
- * // In a SvelteKit load function or action:
8
- * import type { PailSvelteKitEvent } from "@visulima/pail/middleware/sveltekit";
9
- *
10
- * export const load = async (event: PailSvelteKitEvent) => {
11
- * event.locals.log?.set({ user: { id: 1 } });
12
- * };
13
- * ```
14
- */
8
+ * A SvelteKit-like event object with access to the pail logger via `locals.log`.
9
+ * @example
10
+ * ```typescript
11
+ * // In a SvelteKit load function or action:
12
+ * import type { PailSvelteKitEvent } from "@visulima/pail/middleware/sveltekit";
13
+ *
14
+ * export const load = async (event: PailSvelteKitEvent) => {
15
+ * event.locals.log?.set({ user: { id: 1 } });
16
+ * };
17
+ * ```
18
+ */
15
19
  interface PailSvelteKitEvent {
16
- [key: string]: unknown;
17
- locals: Record<string, unknown> & {
18
- log?: WideEvent;
19
- };
20
- request: Request;
21
- url: URL;
20
+ [key: string]: unknown;
21
+ locals: Record<string, unknown> & {
22
+ log?: WideEvent;
23
+ };
24
+ request: Request;
25
+ url: URL;
22
26
  }
23
27
  /**
24
- * Options passed to SvelteKit's resolve function.
25
- */
28
+ * Options passed to SvelteKit's resolve function.
29
+ */
26
30
  interface PailSvelteKitResolveOptions {
27
- filterSerializedResponseHeaders?: (name: string) => boolean;
28
- preload?: (input: {
29
- type: string;
30
- }) => boolean;
31
- transformPageChunk?: (input: {
32
- html: string;
33
- }) => string;
31
+ filterSerializedResponseHeaders?: (name: string) => boolean;
32
+ preload?: (input: {
33
+ type: string;
34
+ }) => boolean;
35
+ transformPageChunk?: (input: {
36
+ html: string;
37
+ }) => string;
34
38
  }
35
39
  /**
36
- * SvelteKit resolve function type.
37
- */
40
+ * SvelteKit resolve function type.
41
+ */
38
42
  type PailSvelteKitResolve = (event: PailSvelteKitEvent, options?: PailSvelteKitResolveOptions) => Promise<Response>;
39
43
  /**
40
- * Input for the SvelteKit handle hook.
41
- */
44
+ * Input for the SvelteKit handle hook.
45
+ */
42
46
  interface PailSvelteKitHandleInput {
43
- event: PailSvelteKitEvent;
44
- resolve: PailSvelteKitResolve;
47
+ event: PailSvelteKitEvent;
48
+ resolve: PailSvelteKitResolve;
45
49
  }
46
50
  /**
47
- * SvelteKit handle hook function type returned by `pailHandle()`.
48
- */
51
+ * SvelteKit handle hook function type returned by `pailHandle()`.
52
+ */
49
53
  type PailSvelteKitHandle = (input: PailSvelteKitHandleInput) => Promise<Response>;
50
54
  /**
51
- * Input for the SvelteKit handleError hook.
52
- */
55
+ * Input for the SvelteKit handleError hook.
56
+ */
53
57
  interface PailSvelteKitHandleErrorInput {
54
- error: unknown;
55
- event: PailSvelteKitEvent;
56
- message: string;
57
- status: number;
58
+ error: unknown;
59
+ event: PailSvelteKitEvent;
60
+ message: string;
61
+ status: number;
58
62
  }
59
63
  /**
60
- * SvelteKit handleError hook function type returned by `pailHandleError()`.
61
- */
64
+ * SvelteKit handleError hook function type returned by `pailHandleError()`.
65
+ */
62
66
  type PailSvelteKitHandleError = (input: PailSvelteKitHandleErrorInput) => void;
63
67
  /**
64
- * Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
65
- * Must be called within a request handled by the pail SvelteKit handle hook.
66
- * @returns The request-scoped WideEvent logger
67
- * @throws Error if called outside of the hook context
68
- */
68
+ * Retrieve the request-scoped WideEvent logger from AsyncLocalStorage.
69
+ * Must be called within a request handled by the pail SvelteKit handle hook.
70
+ * @returns The request-scoped WideEvent logger
71
+ * @throws Error if called outside of the hook context
72
+ */
69
73
  declare const useLogger: () => WideEvent;
70
74
  type SvelteKitHandleOptions<T extends string = string> = PailMiddlewareOptions<T>;
71
75
  /**
72
- * Create a SvelteKit `handle` hook that attaches a WideEvent logger to each request.
73
- *
74
- * The logger is available via:
75
- * - `event.locals.log` in server load functions and actions
76
- * - `useLogger()` from anywhere in the async call stack
77
- *
78
- * The wide event is automatically emitted when the response is sent or an error occurs.
79
- * @param options Hook configuration
80
- * @returns SvelteKit handle hook function
81
- * @example
82
- * ```typescript
83
- * // src/hooks.server.ts
84
- * import { createPail } from "@visulima/pail";
85
- * import { pailHandle, pailHandleError } from "@visulima/pail/middleware/sveltekit";
86
- *
87
- * const logger = createPail();
88
- *
89
- * export const handle = pailHandle({ pail: logger });
90
- * export const handleError = pailHandleError();
91
- * ```
92
- */
93
- export declare const pailHandle: <T extends string = string>(options: SvelteKitHandleOptions<T>) => PailSvelteKitHandle;
76
+ * Create a SvelteKit `handle` hook that attaches a WideEvent logger to each request.
77
+ *
78
+ * The logger is available via:
79
+ * - `event.locals.log` in server load functions and actions
80
+ * - `useLogger()` from anywhere in the async call stack
81
+ *
82
+ * The wide event is automatically emitted when the response is sent or an error occurs.
83
+ * @param options Hook configuration
84
+ * @returns SvelteKit handle hook function
85
+ * @example
86
+ * ```typescript
87
+ * // src/hooks.server.ts
88
+ * import { createPail } from "@visulima/pail";
89
+ * import { pailHandle, pailHandleError } from "@visulima/pail/middleware/sveltekit";
90
+ *
91
+ * const logger = createPail();
92
+ *
93
+ * export const handle = pailHandle({ pail: logger });
94
+ * export const handleError = pailHandleError();
95
+ * ```
96
+ */
97
+ declare const pailHandle: <T extends string = string>(options: SvelteKitHandleOptions<T>) => PailSvelteKitHandle;
94
98
  /**
95
- * Create a SvelteKit `handleError` hook that captures errors into the WideEvent logger.
96
- *
97
- * Should be used alongside `pailHandle` to ensure errors are recorded in the wide event.
98
- * @returns SvelteKit handleError hook function
99
- */
100
- export declare const pailHandleError: () => PailSvelteKitHandleError;
99
+ * Create a SvelteKit `handleError` hook that captures errors into the WideEvent logger.
100
+ *
101
+ * Should be used alongside `pailHandle` to ensure errors are recorded in the wide event.
102
+ * @returns SvelteKit handleError hook function
103
+ */
104
+ declare const pailHandleError: () => PailSvelteKitHandleError;
101
105
  /**
102
- * Convenience function that returns both handle and handleError hooks.
103
- * @param options Hook configuration
104
- * @returns Object with `handle` and `handleError` hooks
105
- * @example
106
- * ```typescript
107
- * // src/hooks.server.ts
108
- * import { createPail } from "@visulima/pail";
109
- * import { createPailHooks } from "@visulima/pail/middleware/sveltekit";
110
- *
111
- * const logger = createPail();
112
- * const { handle, handleError } = createPailHooks({ pail: logger });
113
- *
114
- * export { handle, handleError };
115
- * ```
116
- */
117
- export declare const createPailHooks: <T extends string = string>(options: SvelteKitHandleOptions<T>) => {
118
- handle: PailSvelteKitHandle;
119
- handleError: PailSvelteKitHandleError;
106
+ * Convenience function that returns both handle and handleError hooks.
107
+ * @param options Hook configuration
108
+ * @returns Object with `handle` and `handleError` hooks
109
+ * @example
110
+ * ```typescript
111
+ * // src/hooks.server.ts
112
+ * import { createPail } from "@visulima/pail";
113
+ * import { createPailHooks } from "@visulima/pail/middleware/sveltekit";
114
+ *
115
+ * const logger = createPail();
116
+ * const { handle, handleError } = createPailHooks({ pail: logger });
117
+ *
118
+ * export { handle, handleError };
119
+ * ```
120
+ */
121
+ declare const createPailHooks: <T extends string = string>(options: SvelteKitHandleOptions<T>) => {
122
+ handle: PailSvelteKitHandle;
123
+ handleError: PailSvelteKitHandleError;
120
124
  };
121
- export { useLogger };
122
- export type { PailSvelteKitEvent, PailSvelteKitHandle, PailSvelteKitHandleError, PailSvelteKitHandleErrorInput, PailSvelteKitHandleInput, PailSvelteKitResolve, PailSvelteKitResolveOptions, SvelteKitHandleOptions, };
123
- export type { WideEvent } from "../wide-event.d.ts";
125
+ export { type PailSvelteKitEvent, type PailSvelteKitHandle, type PailSvelteKitHandleError, type PailSvelteKitHandleErrorInput, type PailSvelteKitHandleInput, type PailSvelteKitResolve, type PailSvelteKitResolveOptions, type SvelteKitHandleOptions, type WideEvent, createPailHooks, pailHandle, pailHandleError, useLogger };
@@ -1,75 +1,72 @@
1
1
  /**
2
- * Function to render a node value for display
3
- * @param node The node to render
4
- * @returns A string representation or undefined if should not render
5
- */
6
- export type TreeRenderFunction = (node: unknown) => string | undefined;
2
+ * Function to render a node value for display
3
+ * @param node The node to render
4
+ * @returns A string representation or undefined if should not render
5
+ */
6
+ type TreeRenderFunction = (node: unknown) => string | undefined;
7
7
  /**
8
- * Function to sort keys during tree traversal
9
- * @param a First key for comparison
10
- * @param b Second key for comparison
11
- * @returns Negative if a < b, positive if a > b, 0 if equal
12
- */
13
- export type TreeSortFunction = (a: string, b: string) => number;
8
+ * Function to sort keys during tree traversal
9
+ * @param a First key for comparison
10
+ * @param b Second key for comparison
11
+ * @returns Negative if a < b, positive if a > b, 0 if equal
12
+ */
13
+ type TreeSortFunction = (a: string, b: string) => number;
14
14
  /**
15
- * Configuration options for object tree rendering
16
- */
17
- export interface ObjectTreeOptions {
18
- /** Text to display for circular references (default: " (circular ref.)") */
19
- breakCircularWith?: string | null;
20
- /** Whether to return as single string or array of lines (default: true) */
21
- joined?: boolean;
22
- /** Connector for neighbor keys (default: "├─ ") */
23
- keyNeighbour?: string;
24
- /** Connector for non-neighbor keys (default: "└─ ") */
25
- keyNoNeighbour?: string;
26
- /** Function to render node values (default: renders primitives) */
27
- renderFn?: TreeRenderFunction;
28
- /** Separator between key and value (default: ": ") */
29
- separator?: string;
30
- /** Function to sort object keys (default: natural order) */
31
- sortFn?: TreeSortFunction;
32
- /** Spacer for neighbor branches (default: "│ ") */
33
- spacerNeighbour?: string;
34
- /** Spacer for non-neighbor branches (default: " ") */
35
- spacerNoNeighbour?: string;
15
+ * Configuration options for object tree rendering
16
+ */
17
+ interface ObjectTreeOptions {
18
+ /** Text to display for circular references (default: " (circular ref.)") */
19
+ breakCircularWith?: string | null;
20
+ /** Whether to return as single string or array of lines (default: true) */
21
+ joined?: boolean;
22
+ /** Connector for neighbor keys (default: "├─ ") */
23
+ keyNeighbour?: string;
24
+ /** Connector for non-neighbor keys (default: "└─ ") */
25
+ keyNoNeighbour?: string;
26
+ /** Function to render node values (default: renders primitives) */
27
+ renderFn?: TreeRenderFunction;
28
+ /** Separator between key and value (default: ": ") */
29
+ separator?: string;
30
+ /** Function to sort object keys (default: natural order) */
31
+ sortFn?: TreeSortFunction;
32
+ /** Spacer for neighbor branches (default: "│ ") */
33
+ spacerNeighbour?: string;
34
+ /** Spacer for non-neighbor branches (default: " ") */
35
+ spacerNoNeighbour?: string;
36
36
  }
37
37
  /**
38
- * Renders an object as an ASCII tree structure.
39
- * @param tree The object to render as a tree
40
- * @param options Configuration options for tree rendering
41
- * @returns Formatted tree as string or array of lines
42
- * @example
43
- * ```typescript
44
- * const obj = {
45
- * name: "John",
46
- * age: 30,
47
- * address: {
48
- * street: "Main St",
49
- * city: "New York"
50
- * }
51
- * };
52
- *
53
- * // Default output as string
54
- * console.log(renderObjectTree(obj));
55
- *
56
- * // Custom rendering
57
- * console.log(renderObjectTree(obj, {
58
- * sortFn: (a, b) => a.localeCompare(b),
59
- * renderFn: (node) => {
60
- * if (typeof node === 'string') return node.toUpperCase();
61
- * return ['boolean', 'string', 'number'].includes(typeof node)
62
- * ? String(node)
63
- * : undefined;
64
- * }
65
- * }));
66
- *
67
- * // Get as array of lines
68
- * const lines = renderObjectTree(obj, { joined: false });
69
- * ```
70
- */
71
- export declare const renderObjectTree: (tree: Record<string, unknown> | unknown[], options?: ObjectTreeOptions) => string | string[];
72
- /**
73
- * Default export for CommonJS compatibility
74
- */
75
- export default renderObjectTree;
38
+ * Renders an object as an ASCII tree structure.
39
+ * @param tree The object to render as a tree
40
+ * @param options Configuration options for tree rendering
41
+ * @returns Formatted tree as string or array of lines
42
+ * @example
43
+ * ```typescript
44
+ * const obj = {
45
+ * name: "John",
46
+ * age: 30,
47
+ * address: {
48
+ * street: "Main St",
49
+ * city: "New York"
50
+ * }
51
+ * };
52
+ *
53
+ * // Default output as string
54
+ * console.log(renderObjectTree(obj));
55
+ *
56
+ * // Custom rendering
57
+ * console.log(renderObjectTree(obj, {
58
+ * sortFn: (a, b) => a.localeCompare(b),
59
+ * renderFn: (node) => {
60
+ * if (typeof node === 'string') return node.toUpperCase();
61
+ * return ['boolean', 'string', 'number'].includes(typeof node)
62
+ * ? String(node)
63
+ * : undefined;
64
+ * }
65
+ * }));
66
+ *
67
+ * // Get as array of lines
68
+ * const lines = renderObjectTree(obj, { joined: false });
69
+ * ```
70
+ */
71
+ declare const renderObjectTree: (tree: Record<string, unknown> | unknown[], options?: ObjectTreeOptions) => string | string[];
72
+ export { ObjectTreeOptions, TreeRenderFunction, TreeSortFunction, renderObjectTree as default, renderObjectTree };
@@ -1,5 +1,5 @@
1
1
  import colorize, { grey, white, underline, bold } from '@visulima/colorize/browser';
2
- import { f as format, g as getLongestLabel } from './index-Bx3-C0j9.js';
2
+ import { f as format, g as getLongestLabel } from './index-6cG1Kp0t.js';
3
3
  import { L as LOG_TYPES, E as EMPTY_SYMBOL } from './constants-omsTHUWB.js';
4
4
  import { w as writeConsoleLogBasedOnLevel } from './write-console-log-based-on-level-ree2lDPw.js';
5
5
 
@@ -22,7 +22,7 @@ const {
22
22
  stdout,
23
23
  stderr
24
24
  } = process$2;
25
- import colorize, { grey, green, cyan, red, yellow, bold, magenta, underline, greenBright, bgGrey, white } from '@visulima/colorize';
25
+ import colorize from '@visulima/colorize';
26
26
  const {
27
27
  execFileSync
28
28
  } = __cjs_getBuiltinModule("node:child_process");
@@ -2444,6 +2444,7 @@ const getLongestLabel = (types) => {
2444
2444
  return labels.reduce((x, y) => x.length > y.length ? x : y, "");
2445
2445
  };
2446
2446
 
2447
+ const { bold: bold$1, cyan: cyan$1, green: green$1, grey: grey$1, magenta, red: red$1, yellow } = colorize;
2447
2448
  const defaultInspectorConfig = {
2448
2449
  indent: 2,
2449
2450
  quoteStyle: "single",
@@ -2452,13 +2453,13 @@ const defaultInspectorConfig = {
2452
2453
  bigint: yellow,
2453
2454
  boolean: yellow,
2454
2455
  date: magenta,
2455
- null: bold,
2456
+ null: bold$1,
2456
2457
  number: yellow,
2457
- regexp: red,
2458
- special: cyan,
2459
- string: green,
2460
- symbol: green,
2461
- undefined: grey
2458
+ regexp: red$1,
2459
+ special: cyan$1,
2460
+ string: green$1,
2461
+ symbol: green$1,
2462
+ undefined: grey$1
2462
2463
  };
2463
2464
  if (!Object.hasOwn(styles, style)) {
2464
2465
  return string_;
@@ -2467,9 +2468,10 @@ const defaultInspectorConfig = {
2467
2468
  }
2468
2469
  };
2469
2470
 
2471
+ const { bold, underline: underline$1 } = colorize;
2470
2472
  const formatLabel = (label, styles) => {
2471
2473
  let formattedLabel = styles.uppercase.label ? label.toUpperCase() : label;
2472
- formattedLabel = styles.underline.label ? underline(formattedLabel) : formattedLabel;
2474
+ formattedLabel = styles.underline.label ? underline$1(formattedLabel) : formattedLabel;
2473
2475
  if (styles.bold.label) {
2474
2476
  formattedLabel = bold(formattedLabel);
2475
2477
  }
@@ -2515,6 +2517,7 @@ class AbstractPrettyReporter {
2515
2517
  }
2516
2518
  }
2517
2519
 
2520
+ const { bgGrey, cyan, green, greenBright, grey, red, underline, white } = colorize;
2518
2521
  const PAIL_DIST_REGEX = /[\\/]pail[\\/]dist/;
2519
2522
  const pailFileFilter = (line) => !PAIL_DIST_REGEX.test(line);
2520
2523
  class PrettyReporter extends AbstractPrettyReporter {
@@ -0,0 +1,61 @@
1
+ import { stringify } from 'safe-stable-stringify';
2
+ import { R as ReadonlyMeta, E as ExtendedRfc5424LogLevels, L as LiteralUnion, S as StringifyAwareReporter } from "./types.d-BeLumqgD.js";
3
+ /**
4
+ * Options for configuring JSON reporters.
5
+ */
6
+ type AbstractJsonReporterOptions = {
7
+ /** Error serialization options */
8
+ error: Partial<{
9
+ /** Properties to exclude from error serialization */
10
+ exclude?: string[];
11
+ /** Maximum depth for error object serialization */
12
+ maxDepth?: number;
13
+ /** Whether to use toJSON methods during serialization */
14
+ useToJSON?: boolean;
15
+ }>;
16
+ };
17
+ /**
18
+ * Abstract JSON Reporter.
19
+ *
20
+ * Base class for JSON-based reporters that provides common functionality
21
+ * for serializing log metadata to JSON format. Handles error serialization,
22
+ * context processing, and provides a template method for actual output.
23
+ * @template L - The log level type
24
+ * @example
25
+ * ```typescript
26
+ * class CustomJsonReporter extends AbstractJsonReporter {
27
+ * protected _log(message: string): void {
28
+ * console.log(message);
29
+ * }
30
+ * }
31
+ * ```
32
+ */
33
+ declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
34
+ /** Custom stringify function for object serialization */
35
+ protected stringify: typeof stringify | undefined;
36
+ /** Error serialization options */
37
+ protected errorOptions: AbstractJsonReporterOptions["error"];
38
+ /**
39
+ * Creates a new AbstractJsonReporter instance.
40
+ * @param options Configuration options for JSON formatting and error handling
41
+ */
42
+ constructor(options?: Partial<AbstractJsonReporterOptions>);
43
+ /**
44
+ * Sets a custom stringify function for object serialization.
45
+ * @param function_ The stringify function to use for serialization
46
+ */
47
+ setStringify(function_: typeof stringify): void;
48
+ log(meta: ReadonlyMeta<L>): void;
49
+ /**
50
+ * Template method for outputting the JSON log message.
51
+ *
52
+ * Subclasses must implement this method to define how the JSON message
53
+ * is actually written (to console, file, network, etc.).
54
+ * @param message The JSON-formatted log message
55
+ * @param logLevel The log level of the message
56
+ * @protected
57
+ * @abstract
58
+ */
59
+ protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
60
+ }
61
+ export { AbstractJsonReporterOptions as A, AbstractJsonReporter as a };
@@ -26,7 +26,7 @@ const {
26
26
  } = __cjs_getBuiltinModule("node:child_process");
27
27
  const fs = __cjs_getBuiltinModule("node:fs");
28
28
  const tty = __cjs_getBuiltinModule("node:tty");
29
- import { grey, green, cyan, red, yellow, bold, magenta, underline } from '@visulima/colorize';
29
+ import colorize from '@visulima/colorize';
30
30
 
31
31
  const EXTENDED_RFC_5424_LOG_LEVELS = {
32
32
  alert: 7,
@@ -2561,6 +2561,7 @@ const getLongestBadge = (types) => {
2561
2561
  return badges.reduce((x, y) => x.length > y.length ? x : y, "");
2562
2562
  };
2563
2563
 
2564
+ const { bold: bold$1, cyan, green, grey, magenta, red, yellow } = colorize;
2564
2565
  const defaultInspectorConfig = {
2565
2566
  indent: 2,
2566
2567
  quoteStyle: "single",
@@ -2569,7 +2570,7 @@ const defaultInspectorConfig = {
2569
2570
  bigint: yellow,
2570
2571
  boolean: yellow,
2571
2572
  date: magenta,
2572
- null: bold,
2573
+ null: bold$1,
2573
2574
  number: yellow,
2574
2575
  regexp: red,
2575
2576
  special: cyan,
@@ -2584,6 +2585,7 @@ const defaultInspectorConfig = {
2584
2585
  }
2585
2586
  };
2586
2587
 
2588
+ const { bold, underline } = colorize;
2587
2589
  const formatLabel = (label, styles) => {
2588
2590
  let formattedLabel = styles.uppercase.label ? label.toUpperCase() : label;
2589
2591
  formattedLabel = styles.underline.label ? underline(formattedLabel) : formattedLabel;