import type { HTMLDumpConfig } from '@poppinss/dumper/html/types'; import type { ConsoleDumpConfig } from '@poppinss/dumper/console/types'; import type { Application } from '../app.ts'; /** * Dumper exposes the API to dump or die/dump values in your * AdonisJS application. An singleton instance of the Dumper * is shared as a service and may use it follows. * * ```ts * const dumper = container.make('dumper') * * dumper.configureHtmlOutput({ * // parser + html formatter config * }) * * dumper.configureAnsiOutput({ * // parser + console formatter config * }) * * const html = dumper.dumpToHtml(value) * const ansi = dumper.dumpToAnsi(value) * * // Returns style and script tags that must be * // injeted to the head of the HTML document * * const head = dumper.getHeadElements() * ``` */ export declare class Dumper { #private; /** * Creates a new Dumper instance * * @param app - The AdonisJS application instance */ constructor(app: Application); /** * Configure the HTML formatter output options * * @param config - Configuration options for HTML dump formatting * * @example * ```ts * dumper.configureHtmlOutput({ * showHidden: true, * depth: 5, * colors: false * }) * ``` */ configureHtmlOutput(config: HTMLDumpConfig): this; /** * Configure the ANSI formatter output options for console display * * @param config - Configuration options for ANSI console formatting * * @example * ```ts * dumper.configureAnsiOutput({ * showHidden: true, * depth: 3, * collapse: ['Date', 'DateTime'] * }) * ``` */ configureAnsiOutput(config: ConsoleDumpConfig): this; /** * Returns the style and script elements that need to be injected into * the HTML document head for proper dump visualization * * @param cspNonce - Optional Content Security Policy nonce for inline scripts * * @example * ```ts * const headElements = dumper.getHeadElements('abc123') * // Insert into your HTML head section * ``` */ getHeadElements(cspNonce?: string): string; /** * Dump a value to formatted HTML output * * @param value - The value to dump and inspect * @param options - Options for HTML output formatting * @param options.cspNonce - Optional Content Security Policy nonce * @param options.title - Optional title to display in the dump header * @param options.source - Optional source file information for editor links * * @example * ```ts * const htmlOutput = dumper.dumpToHtml(user, { * title: 'User Object', * source: { location: '/app/controllers/user.ts', line: 42 } * }) * ``` */ dumpToHtml(value: unknown, options?: { cspNonce?: string; title?: string; source?: { location: string; line: number; }; }): string; /** * Dump a value to formatted ANSI output for console display * * @param value - The value to dump and inspect * @param options - Options for ANSI output formatting * @param options.title - Optional title to display in the dump header * @param options.source - Optional source file information for editor links * * @example * ```ts * const ansiOutput = dumper.dumpToAnsi(user, { * title: 'User Debug', * source: { location: '/app/controllers/user.ts', line: 42 } * }) * console.log(ansiOutput) * ``` */ dumpToAnsi(value: unknown, options?: { title?: string; source?: { location: string; line: number; }; }): string; /** * Dump values and die. This method dumps the provided value and then * terminates the application. The output format is automatically chosen * based on the execution context. * * - During an HTTP request, HTML output will be sent to the browser * - Otherwise the value will be logged to the console in ANSI format * * @param value - The value to dump before terminating * @param traceSourceIndex - Stack trace index for source location (default: 1) * * @example * ```ts * // This will dump the user object and terminate the application * dumper.dd(user) * * // This will never execute * console.log('This line will not run') * ``` */ dd(value: unknown, traceSourceIndex?: number): void; }