UNPKG

rasengan

Version:

The modern React Framework

32 lines (31 loc) 1.19 kB
type StackFrame = { file: string; line: number; column: number; }; /** * Parse an error stack trace and extract the first meaningful user frame. * Handles Chrome/V8 and Firefox stack trace formats. * Skips the "Error:" header line. * * @param stack - The full error.stack string * @returns The first parsed StackFrame, or null if none found */ export declare function parseStackFrame(stack: string): StackFrame | null; /** * Fetch the source file from the Vite dev server (using ?raw to get original * source) and return a snippet of lines surrounding the error line. * * @param file - File path (absolute, e.g. /src/app/page.tsx) * @param errorLine - 1-indexed line number where the error occurred * @param contextLines - Number of lines to show above and below the error * @returns An object with the snippet string, the 0-indexed error line * position within the snippet, and the total file line count, * or null on failure */ export declare function fetchSourceSnippet(file: string, errorLine: number, contextLines?: number): Promise<{ snippet: string; errorLineIndex: number; totalLines: number; } | null>; export {};