UNPKG

instantcode

Version:

AI-powered web inspection tool - Pick elements and get instant AI assistance

73 lines (72 loc) 2.19 kB
/** * Source Map utilities for mapping runtime elements back to source code */ export interface SourceMapPosition { line: number; column: number; source?: string; name?: string; } export interface SourceMapInfo { file: string; line: number; column: number; endLine?: number; endColumn?: number; originalSource?: string; sourcesContent?: string[]; } /** * Basic source map consumer for parsing VLQ-encoded mappings * Note: This is a simplified implementation. For production use, * consider using the 'source-map' library for full compatibility. */ export declare class BasicSourceMapConsumer { private sources; private sourcesContent?; constructor(sourceMap: any); /** * Find original position for generated position * This is a simplified implementation that looks for approximate mappings */ originalPositionFor(line: number, column: number): SourceMapPosition | null; /** * Get source content for a given source file */ sourceContentFor(source: string): string | null; /** * Get all available sources */ getSources(): string[]; } /** * Attempt to find and parse source maps from various sources */ export declare class SourceMapResolver { private sourceMapCache; /** * Try to find source map for a given file URL */ findSourceMapForFile(fileUrl: string): Promise<BasicSourceMapConsumer | null>; /** * Resolve original position from generated position using source maps */ resolvePosition(fileUrl: string, line: number, column: number): Promise<SourceMapPosition | null>; /** * Get enhanced location info by combining runtime data with source maps */ getEnhancedLocationInfo(fileUrl: string, line: number, column: number): Promise<SourceMapInfo | null>; /** * Clear the source map cache */ clearCache(): void; } export declare const sourceMapResolver: SourceMapResolver; /** * Helper function to extract source location from browser stack traces */ export declare function extractLocationFromStackTrace(error: Error): { file: string; line: number; column: number; } | null;