/** * Source Maps Handler * * P1 - Source map parsing and error mapping * * Supports: * - Source map detection * - Source map parsing * - Error stack trace mapping * - Original source location resolution * - Source content retrieval * * @see https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map */ export interface SourceMapLocation { /** Generated file line number (1-based) */ generatedLine: number; /** Generated file column number (1-based) */ generatedColumn: number; /** Original source file */ originalSource: string | null; /** Original file line number */ originalLine: number | null; /** Original file column number */ originalColumn: number | null; /** Function name */ name: string | null; } export interface SourceMapInfo { /** Source map URL */ url: string; /** Source map content (base64 or external) */ content: string | null; /** Number of sources in the map */ sourceCount: number; /** Source file names */ sources: string[]; /** Source root */ sourceRoot: string; /** Has mappings */ hasMappings: boolean; /** Source map format version */ version: number; /** Whether source map is valid */ valid: boolean; } export interface MappedError { /** Original error */ original: Error; /** Mapped stack trace */ mappedStack: Array<{ filename: string; line: number; column: number; function: string | null; originalFilename: string | null; originalLine: number | null; originalColumn: number | null; }>; /** Source map was used */ sourceMapUsed: boolean; } export interface SourceMapResult { /** Source maps found */ sourceMaps: Map; /** Files with source maps */ filesWithSourceMaps: string[]; /** Files without source maps */ filesWithoutSourceMaps: string[]; /** Coverage percentage */ sourceMapCoverage: number; } /** * Source Maps Handler class */ export declare class SourceMapsHandler { private page; private sourceMapsCache; constructor(page: any); /** * Get all source map URLs from the page */ getSourceMapURLs(): Promise>; /** * Fetch and parse a source map */ fetchSourceMap(sourceMapUrl: string): Promise; /** * Get all source maps from the page */ getAllSourceMaps(): Promise; /** * Map an error stack trace using source maps */ mapError(error: Error): Promise; /** * Map a generated location to original location */ mapLocation(filename: string, line: number, column: number): Promise; /** * Get original source content from source map */ getOriginalSource(sourceMapUrl: string, sourceIndex: number): Promise; /** * Check if source maps are enabled for a file */ hasSourceMap(filename: string): Promise; /** * Inject source map helper into the page */ injectSourceMapHelper(): Promise; /** * Validate source map quality */ validateSourceMaps(): Promise<{ total: number; valid: number; invalid: number; missing: number; hasNames: number; hasSourceContent: number; avgSourceCount: number; }>; /** * Get source map statistics */ getStatistics(): Promise<{ sourceMapCoverage: number; totalFiles: number; filesWithSourceMaps: number; avgMappingsPerFile: number; avgSourcesPerFile: number; recommendation: string; }>; /** * Clear source map cache */ clearCache(): void; } /** * Factory function to create Source Maps Handler */ export declare function createSourceMapsHandler(page: any): SourceMapsHandler; export default SourceMapsHandler;