error-less 1.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts","../src/parser.ts","../src/reader.ts","../src/source-map.ts","../src/renderer.ts","../src/interceptor.ts","../src/index.ts"],"names":["relative","fs","path2","path3","path4"],"mappings":";;;;;AA2IO,IAAM,aAAA,GAA2C;AAAA,EACtD,kBAAA,EAAoB,CAAA;AAAA,EACpB,iBAAA,EAAmB,CAAA;AAAA,EACnB,gBAAA,EAAkB,IAAA;AAAA,EAClB,iBAAA,EAAmB,IAAA;AAAA,EACnB,aAAa,MAAM,IAAA;AAAA,EACnB,aAAA,EAAe,KAAA;AAAA,EACf,MAAA,EAAQ;AACV;AC1IA,IAAM,iBAAA,GAAoB;AAAA,EACxB,QAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA;AACF,CAAA;AAGA,SAAS,eAAe,QAAA,EAA2B;AACjD,EAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AAGtB,EAAA,IAAI,QAAA,KAAa,UAAU,OAAO,IAAA;AAGlC,EAAA,KAAA,MAAW,WAAW,iBAAA,EAAmB;AACvC,IAAA,IAAI,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA,EAAG,OAAO,IAAA;AAAA,EACrC;AAGA,EAAA,IAAI,SAAS,QAAA,CAAS,WAAW,KAAK,QAAA,CAAS,QAAA,CAAS,YAAY,CAAA,EAAG;AACrE,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;AAGA,SAAS,kBAAkB,QAAA,EAA2B;AACpD,EAAA,IAAI,CAAC,UAAU,OAAO,KAAA;AACtB,EAAA,MAAM,UAAA,GAAa,QAAA,CAAS,OAAA,CAAQ,KAAA,EAAO,GAAG,CAAA;AAC9C,E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AAK,GAAG,KAAK,CAAA;AACvB,IAAA,OAAO,EAAA;AAAA,EACT,CAAA;AAGA,EAAA,KAAA,CAAM,kBAAkB,KAAK,CAAA;AAE7B,EAAA,KAAA,CAAM,KAAA;AAEN,EAAA,KAAA,CAAM,iBAAA,GAAoB,WAAA;AAE1B,EAAA,OAAO,gBAAgB,SAAkC,CAAA;AAC3D;;;AC7KA,IAAO,WAAA,GAAQ","file":"index.mjs","sourcesContent":["/**\n * Type definitions for V8 CallSite API\n * These are the methods available on the structured stack trace objects\n * Compatible with NodeJS.CallSite\n */\nexport interface CallSite {\n /** Returns the value of `this` */\n getThis(): unknown;\n\n /** Returns the type of `this` as a string */\n getTypeName(): string | null;\n\n /** Returns the current function */\n getFunction(): Function | undefined;\n\n /** Returns the name of the function, typically its `name` property */\n getFunctionName(): string | null;\n\n /** Returns the name of the property of `this` or one of its prototypes that holds the current function */\n getMethodName(): string | null;\n\n /** Returns the name of the script if this function was defined in a script */\n getFileName(): string | null;\n\n /** Returns the current line number if this function was defined in a script */\n getLineNumber(): number | null;\n\n /** Returns the current column number if this function was defined in a script */\n getColumnNumber(): number | null;\n\n /** Returns a string representing the location where eval was called if this function was created using eval */\n getEvalOrigin(): string | undefined;\n\n /** Returns true if this is a top-level invocation */\n isToplevel(): boolean;\n\n /** Returns true if this call takes place in code defined by eval */\n isEval(): boolean;\n\n /** Returns true if this call is in native V8 code */\n isNative(): boolean;\n\n /** Returns true if this is a constructor call */\n isConstructor(): boolean;\n\n /** Returns true if this call is async */\n isAsync(): boolean;\n\n /** Returns true if this is a Promise.all() call */\n isPromiseAll(): boolean;\n\n /** Returns the index of the promise element that was followed */\n getPromiseIndex(): number | null;\n\n /** Returns the script name or source URL */\n getScriptNameOrSourceURL(): string | undefined;\n}\n\n/**\n * Parsed frame information extracted from CallSite\n */\nexport interface ParsedFrame {\n /** Absolute file path */\n filePath: string;\n /** Line number (1-indexed) */\n lineNumber: number;\n /** Column number (1-indexed) */\n columnNumber: number;\n /** Function name if available */\n functionName: string | null;\n /** Method name if available */\n methodName: string | null;\n /** Type name (class name) if available */\n typeName: string | null;\n /** Whether this is native code */\n isNative: boolean;\n /** Whether this is from node_modules */\n isNodeModules: boolean;\n /** Whether this is internal Node.js code */\n isInternal: boolean;\n /** Whether this is user code */\n isUserCode: boolean;\n /** Original CallSite for advanced usage */\n callSite: CallSite;\n}\n\n/**\n * Source code context around the error\n */\nexport interface CodeContext {\n /** Lines of code with their line numbers */\n lines: Array<{\n lineNumber: number;\n content: string;\n isErrorLine: boolean;\n }>;\n /** The column number on the error line */\n errorColumn: number;\n /** The content of the error line */\n errorLineContent: string;\n}\n\n/**\n * Source map mapping result\n */\nexport interface SourceMapResult {\n /** Original source file path */\n source: string;\n /** Original line number */\n line: number;\n /** Original column number */\n column: number;\n /** Original source content if embedded */\n sourceContent?: string | undefined;\n}\n\n/**\n * Configuration options for error-less\n */\nexport interface ErrorLessConfig {\n /** Number of context lines before the error line (default: 2) */\n contextLinesBefore?: number;\n /** Number of context lines after the error line (default: 2) */\n contextLinesAfter?: number;\n /** Whether to show source maps (default: true) */\n enableSourceMaps?: boolean;\n /** Whether to filter out node_modules frames (default: true) */\n filterNodeModules?: boolean;\n /** Custom filter for frames */\n frameFilter?: (frame: ParsedFrame) => boolean;\n /** Whether to show the full stack trace after the code frame (default: false) */\n showFullStack?: boolean;\n /** Whether colors are enabled (auto-detected, but can be forced) */\n colors?: boolean;\n}\n\n/**\n * Global configuration state\n */\nexport const defaultConfig: Required<ErrorLessConfig> = {\n contextLinesBefore: 2,\n contextLinesAfter: 2,\n enableSourceMaps: true,\n filterNodeModules: true,\n frameFilter: () => true,\n showFullStack: false,\n colors: true,\n};\n","/**\n * Stack Trace Parser\n * Extracts structured information from V8 CallSite objects\n */\n\nimport * as path from 'node:path';\nimport type { CallSite, ParsedFrame } from './types.js';\n\n/** Patterns that indicate internal Node.js frames */\nconst INTERNAL_PATTERNS = [\n /^node:/,\n /^internal\\//,\n /^events\\.js$/,\n /^_stream_/,\n /^stream\\.js$/,\n /^module\\.js$/,\n /^loader\\.js$/,\n /^vm\\.js$/,\n];\n\n/** Check if a file path is internal Node.js code */\nfunction isInternalPath(filePath: string): boolean {\n if (!filePath) return true;\n\n // Native code\n if (filePath === 'native') return true;\n\n // Node internal modules\n for (const pattern of INTERNAL_PATTERNS) {\n if (pattern.test(filePath)) return true;\n }\n\n // Check for internal/ prefix in the path\n if (filePath.includes('internal/') || filePath.includes('internal\\\\')) {\n return true;\n }\n\n return false;\n}\n\n/** Check if a file path is in node_modules */\nfunction isNodeModulesPath(filePath: string): boolean {\n if (!filePath) return false;\n const normalized = filePath.replace(/\\\\/g, '/');\n return normalized.includes('/node_modules/') || normalized.includes('\\\\node_modules\\\\');\n}\n\n/** Get a display-friendly function name */\nfunction getDisplayFunctionName(callSite: CallSite): string | null {\n const functionName = callSite.getFunctionName();\n const methodName = callSite.getMethodName();\n const typeName = callSite.getTypeName();\n\n if (functionName) {\n if (typeName && functionName !== typeName) {\n return `${typeName}.${functionName}`;\n }\n return functionName;\n }\n\n if (methodName) {\n if (typeName) {\n return `${typeName}.${methodName}`;\n }\n return methodName;\n }\n\n if (typeName) {\n return `${typeName}.<anonymous>`;\n }\n\n return null;\n}\n\n/**\n * Parse a single CallSite into a structured frame\n */\nexport function parseCallSite(callSite: CallSite): ParsedFrame | null {\n try {\n let fileName = callSite.getFileName() ?? callSite.getScriptNameOrSourceURL();\n const lineNumber = callSite.getLineNumber();\n const columnNumber = callSite.getColumnNumber();\n const isNative = callSite.isNative();\n\n // Skip frames without file info (unless native)\n if (!fileName && !isNative) {\n return null;\n }\n\n // Handle file:// URLs (common on Windows and in ESM)\n if (fileName?.startsWith('file:')) {\n try {\n fileName = new URL(fileName).pathname;\n // On Windows, remove leading slash from /C:/path\n if (process.platform === 'win32' && /^\\/[A-Z]:/.test(fileName)) {\n fileName = fileName.slice(1);\n }\n } catch {\n // Keep original if URL parsing fails\n }\n }\n\n // Resolve to absolute path if possible\n let filePath = fileName ?? 'native';\n if (fileName && !path.isAbsolute(fileName) && !fileName.startsWith('node:')) {\n try {\n filePath = path.resolve(process.cwd(), fileName);\n } catch {\n filePath = fileName;\n }\n }\n\n const isInternal = isInternalPath(filePath);\n const isNodeModules = isNodeModulesPath(filePath);\n const isUserCode = !isInternal && !isNodeModules && !isNative;\n\n return {\n filePath,\n lineNumber: lineNumber ?? 0,\n columnNumber: columnNumber ?? 0,\n functionName: callSite.getFunctionName(),\n methodName: callSite.getMethodName(),\n typeName: callSite.getTypeName(),\n isNative,\n isNodeModules,\n isInternal,\n isUserCode,\n callSite,\n };\n } catch {\n // If parsing fails, skip this frame\n return null;\n }\n}\n\n/**\n * Parse the entire structured stack trace\n */\nexport function parseStackTrace(structuredStack: CallSite[]): ParsedFrame[] {\n const frames: ParsedFrame[] = [];\n\n for (const callSite of structuredStack) {\n const parsed = parseCallSite(callSite);\n if (parsed) {\n frames.push(parsed);\n }\n }\n\n return frames;\n}\n\n/**\n * Find the first user code frame (the most relevant error location)\n */\nexport function findUserCodeFrame(frames: ParsedFrame[]): ParsedFrame | null {\n // First, try to find direct user code\n for (const frame of frames) {\n if (frame.isUserCode && frame.lineNumber > 0) {\n return frame;\n }\n }\n\n // If no user code, find the first non-internal frame\n for (const frame of frames) {\n if (!frame.isInternal && !frame.isNative && frame.lineNumber > 0) {\n return frame;\n }\n }\n\n // Last resort: return the first frame with a line number\n for (const frame of frames) {\n if (frame.lineNumber > 0) {\n return frame;\n }\n }\n\n return null;\n}\n\n/**\n * Format a frame as a standard stack trace line\n */\nexport function formatFrameAsStackLine(frame: ParsedFrame): string {\n const funcName = getDisplayFunctionName(frame.callSite) ?? '<anonymous>';\n const location = frame.isNative\n ? 'native'\n : `${frame.filePath}:${frame.lineNumber}:${frame.columnNumber}`;\n\n return ` at ${funcName} (${location})`;\n}\n\n/**\n * Get relative path from current working directory\n */\nexport function getRelativePath(absolutePath: string): string {\n try {\n const cwd = process.cwd();\n if (absolutePath.startsWith(cwd)) {\n const relative = path.relative(cwd, absolutePath);\n // Prefer ./ prefix for clarity\n if (!relative.startsWith('.')) {\n return './' + relative.replace(/\\\\/g, '/');\n }\n return relative.replace(/\\\\/g, '/');\n }\n } catch {\n // Fall through to return original\n }\n return absolutePath.replace(/\\\\/g, '/');\n}\n","/**\n * Context Engine - Source File Reader\n * Reads source files and extracts code context around error locations\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { CodeContext, ParsedFrame, SourceMapResult } from './types.js';\n\n/** Cache for file contents to avoid re-reading */\nconst fileCache = new Map<string, string[]>();\n\n/** Maximum file size to read (10MB) */\nconst MAX_FILE_SIZE = 10 * 1024 * 1024;\n\n/** Maximum lines to cache per file */\nconst MAX_CACHED_FILES = 50;\n\n/**\n * Clear the file cache (useful for long-running processes)\n */\nexport function clearFileCache(): void {\n fileCache.clear();\n}\n\n/**\n * Read a file and return its lines\n */\nfunction readFileLines(filePath: string): string[] | null {\n // Check cache first\n const cached = fileCache.get(filePath);\n if (cached) {\n return cached;\n }\n\n try {\n // Check if file exists and is readable\n const stats = fs.statSync(filePath);\n\n // Skip files that are too large\n if (stats.size > MAX_FILE_SIZE) {\n return null;\n }\n\n const content = fs.readFileSync(filePath, 'utf-8');\n const lines = content.split(/\\r?\\n/);\n\n // Cache management: remove oldest entries if cache is full\n if (fileCache.size >= MAX_CACHED_FILES) {\n const firstKey = fileCache.keys().next().value;\n if (firstKey) {\n fileCache.delete(firstKey);\n }\n }\n\n fileCache.set(filePath, lines);\n return lines;\n } catch {\n // File doesn't exist or can't be read\n return null;\n }\n}\n\n/**\n * Extract code context around a specific line\n */\nexport function getCodeContext(\n filePath: string,\n lineNumber: number,\n columnNumber: number,\n linesBefore = 2,\n linesAfter = 2\n): CodeContext | null {\n const lines = readFileLines(filePath);\n\n if (!lines || lines.length === 0) {\n return null;\n }\n\n // Line numbers are 1-indexed\n const errorLineIndex = lineNumber - 1;\n\n // Validate line number\n if (errorLineIndex < 0 || errorLineIndex >= lines.length) {\n return null;\n }\n\n // Calculate the range of lines to extract\n const startIndex = Math.max(0, errorLineIndex - linesBefore);\n const endIndex = Math.min(lines.length - 1, errorLineIndex + linesAfter);\n\n const contextLines: CodeContext['lines'] = [];\n\n for (let i = startIndex; i <= endIndex; i++) {\n contextLines.push({\n lineNumber: i + 1, // Convert back to 1-indexed\n content: lines[i] ?? '',\n isErrorLine: i === errorLineIndex,\n });\n }\n\n const errorLineContent = lines[errorLineIndex] ?? '';\n\n return {\n lines: contextLines,\n errorColumn: columnNumber,\n errorLineContent,\n };\n}\n\n/**\n * Try to read source content from an embedded source map\n */\nexport function getSourceContentFromMap(\n sourceContent: string | undefined,\n lineNumber: number,\n columnNumber: number,\n linesBefore = 2,\n linesAfter = 2\n): CodeContext | null {\n if (!sourceContent) {\n return null;\n }\n\n const lines = sourceContent.split(/\\r?\\n/);\n const errorLineIndex = lineNumber - 1;\n\n if (errorLineIndex < 0 || errorLineIndex >= lines.length) {\n return null;\n }\n\n const startIndex = Math.max(0, errorLineIndex - linesBefore);\n const endIndex = Math.min(lines.length - 1, errorLineIndex + linesAfter);\n\n const contextLines: CodeContext['lines'] = [];\n\n for (let i = startIndex; i <= endIndex; i++) {\n contextLines.push({\n lineNumber: i + 1,\n content: lines[i] ?? '',\n isErrorLine: i === errorLineIndex,\n });\n }\n\n return {\n lines: contextLines,\n errorColumn: columnNumber,\n errorLineContent: lines[errorLineIndex] ?? '',\n };\n}\n\n/**\n * Get code context for a parsed frame, with source map support\n */\nexport function getContextForFrame(\n frame: ParsedFrame,\n sourceMapResult: SourceMapResult | null,\n linesBefore = 2,\n linesAfter = 2\n): CodeContext | null {\n // If we have source map data with embedded content, use that\n if (sourceMapResult?.sourceContent) {\n const context = getSourceContentFromMap(\n sourceMapResult.sourceContent,\n sourceMapResult.line,\n sourceMapResult.column,\n linesBefore,\n linesAfter\n );\n if (context) {\n return context;\n }\n }\n\n // If we have a mapped source path, try to read it\n if (sourceMapResult?.source) {\n // Try to resolve the source path relative to the compiled file\n const compiledDir = path.dirname(frame.filePath);\n const sourcePath = path.resolve(compiledDir, sourceMapResult.source);\n\n const context = getCodeContext(\n sourcePath,\n sourceMapResult.line,\n sourceMapResult.column,\n linesBefore,\n linesAfter\n );\n if (context) {\n return context;\n }\n\n // Try absolute path if provided\n if (path.isAbsolute(sourceMapResult.source)) {\n const absContext = getCodeContext(\n sourceMapResult.source,\n sourceMapResult.line,\n sourceMapResult.column,\n linesBefore,\n linesAfter\n );\n if (absContext) {\n return absContext;\n }\n }\n }\n\n // Fall back to the compiled file\n return getCodeContext(\n frame.filePath,\n frame.lineNumber,\n frame.columnNumber,\n linesBefore,\n linesAfter\n );\n}\n\n/**\n * Check if a file exists synchronously\n */\nexport function fileExists(filePath: string): boolean {\n try {\n fs.accessSync(filePath, fs.constants.R_OK);\n return true;\n } catch {\n return false;\n }\n}\n","/**\n * Source Map Support\n * Resolves compiled code locations back to original source files\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { ParsedFrame, SourceMapResult } from './types.js';\n\n/** Raw source map data structure */\ninterface RawSourceMap {\n version: number;\n sources: string[];\n sourcesContent?: (string | null)[];\n mappings: string;\n names?: string[];\n file?: string;\n sourceRoot?: string;\n}\n\n/** VLQ character map for decoding */\nconst VLQ_BASE64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nconst VLQ_BASE64_DECODE: Record<string, number> = {};\nfor (let i = 0; i < VLQ_BASE64.length; i++) {\n VLQ_BASE64_DECODE[VLQ_BASE64[i]!] = i;\n}\n\n/** Cached source map data */\nconst sourceMapCache = new Map<string, RawSourceMap | null>();\n\n/**\n * Decode a VLQ segment from a source map\n */\nfunction decodeVLQ(encoded: string): number[] {\n const result: number[] = [];\n let shift = 0;\n let value = 0;\n\n for (const char of encoded) {\n const digit = VLQ_BASE64_DECODE[char];\n if (digit === undefined) continue;\n\n const cont = (digit & 32) !== 0;\n const digitValue = digit & 31;\n value += digitValue << shift;\n\n if (cont) {\n shift += 5;\n } else {\n const shouldNegate = (value & 1) !== 0;\n value >>= 1;\n result.push(shouldNegate ? -value : value);\n value = 0;\n shift = 0;\n }\n }\n\n return result;\n}\n\n/**\n * Parse source map mappings to find original position\n */\nfunction findOriginalPosition(\n map: RawSourceMap,\n generatedLine: number,\n generatedColumn: number\n): { sourceIndex: number; line: number; column: number } | null {\n const mappingLines = map.mappings.split(';');\n\n let sourceIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n\n let bestMatch: { sourceIndex: number; line: number; column: number } | null = null;\n let bestColumn = -1;\n\n for (let lineIndex = 0; lineIndex < mappingLines.length; lineIndex++) {\n const line = mappingLines[lineIndex];\n if (!line) continue;\n\n const segments = line.split(',');\n let generatedCol = 0;\n\n for (const segment of segments) {\n const decoded = decodeVLQ(segment);\n if (decoded.length === 0) continue;\n\n generatedCol += decoded[0] ?? 0;\n\n if (decoded.length >= 4) {\n sourceIndex += decoded[1] ?? 0;\n sourceLine += decoded[2] ?? 0;\n sourceColumn += decoded[3] ?? 0;\n }\n\n // Check if this is the line we're looking for\n if (lineIndex + 1 === generatedLine) {\n // Find the best column match (closest but not exceeding)\n if (generatedCol <= generatedColumn && generatedCol > bestColumn) {\n bestMatch = {\n sourceIndex,\n line: sourceLine + 1, // Convert to 1-indexed\n column: sourceColumn + 1, // Convert to 1-indexed\n };\n bestColumn = generatedCol;\n }\n }\n }\n }\n\n return bestMatch;\n}\n\n/**\n * Read source map from file\n */\nfunction readSourceMap(mapPath: string): RawSourceMap | null {\n try {\n const content = fs.readFileSync(mapPath, 'utf-8');\n return JSON.parse(content) as RawSourceMap;\n } catch {\n return null;\n }\n}\n\n/**\n * Extract inline source map from file content\n */\nfunction extractInlineSourceMap(filePath: string): RawSourceMap | null {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n\n // Look for inline source map comment\n // //# sourceMappingURL=data:application/json;base64,...\n const inlineMatch = content.match(\n /\\/\\/[#@]\\s*sourceMappingURL=data:application\\/json;(?:charset=utf-8;)?base64,([A-Za-z0-9+/=]+)\\s*$/m\n );\n\n if (inlineMatch?.[1]) {\n const decoded = Buffer.from(inlineMatch[1], 'base64').toString('utf-8');\n return JSON.parse(decoded) as RawSourceMap;\n }\n\n return null;\n } catch {\n return null;\n }\n}\n\n/**\n * Find external source map file\n */\nfunction findExternalSourceMap(filePath: string): string | null {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n\n // Look for external source map reference\n // //# sourceMappingURL=file.js.map\n const externalMatch = content.match(\n /\\/\\/[#@]\\s*sourceMappingURL=(?!data:)([^\\s'\"]+)\\s*$/m\n );\n\n if (externalMatch?.[1]) {\n const mapPath = path.resolve(path.dirname(filePath), externalMatch[1]);\n if (fs.existsSync(mapPath)) {\n return mapPath;\n }\n }\n\n // Try common conventions\n const conventions = [\n `${filePath}.map`,\n filePath.replace(/\\.js$/, '.js.map'),\n filePath.replace(/\\.mjs$/, '.mjs.map'),\n filePath.replace(/\\.cjs$/, '.cjs.map'),\n ];\n\n for (const mapPath of conventions) {\n if (fs.existsSync(mapPath)) {\n return mapPath;\n }\n }\n\n return null;\n } catch {\n return null;\n }\n}\n\n/**\n * Get source map data for a file\n */\nfunction getSourceMapData(filePath: string): RawSourceMap | null {\n // Check cache\n if (sourceMapCache.has(filePath)) {\n return sourceMapCache.get(filePath) ?? null;\n }\n\n // Try inline source map first\n let sourceMapData = extractInlineSourceMap(filePath);\n\n // Try external source map\n if (!sourceMapData) {\n const mapPath = findExternalSourceMap(filePath);\n if (mapPath) {\n sourceMapData = readSourceMap(mapPath);\n }\n }\n\n sourceMapCache.set(filePath, sourceMapData);\n return sourceMapData;\n}\n\n/**\n * Resolve a frame location through source maps\n */\nexport function resolveSourceMap(frame: ParsedFrame): SourceMapResult | null {\n try {\n const map = getSourceMapData(frame.filePath);\n if (!map) {\n return null;\n }\n\n const position = findOriginalPosition(\n map,\n frame.lineNumber,\n frame.columnNumber - 1 // Convert to 0-indexed for mapping\n );\n\n if (!position) {\n return null;\n }\n\n const source = map.sources[position.sourceIndex];\n if (!source) {\n return null;\n }\n\n // Get source content if available\n let sourceContent: string | undefined;\n if (map.sourcesContent?.[position.sourceIndex]) {\n sourceContent = map.sourcesContent[position.sourceIndex] ?? undefined;\n }\n\n return {\n source,\n line: position.line,\n column: position.column,\n sourceContent,\n };\n } catch {\n return null;\n }\n}\n\n/**\n * Clear the source map cache\n */\nexport function clearSourceMapCache(): void {\n sourceMapCache.clear();\n}\n\n/**\n * Preload source-map module (no-op in built-in implementation)\n */\nexport async function preloadSourceMapModule(): Promise<boolean> {\n return true;\n}\n","/**\n * Renderer - Beautiful Terminal Error Output\n * Creates Rust-style error displays with code frames and syntax highlighting\n */\n\nimport * as path from 'node:path';\nimport pc from 'picocolors';\nimport type { CodeContext, ErrorLessConfig, ParsedFrame, SourceMapResult } from './types.js';\nimport { defaultConfig } from './types.js';\nimport { getRelativePath, formatFrameAsStackLine } from './parser.js';\n\n/** Box drawing characters for the frame */\nconst BOX = {\n topLeft: '\\u256d',\n topRight: '\\u256e',\n bottomLeft: '\\u2570',\n bottomRight: '\\u256f',\n horizontal: '\\u2500',\n vertical: '\\u2502',\n verticalRight: '\\u251c',\n arrow: '\\u2192',\n pointer: '^',\n lineMarker: '>',\n} as const;\n\n/** Error type colors */\nconst ERROR_COLORS: Record<string, (s: string) => string> = {\n ReferenceError: pc.red,\n TypeError: pc.red,\n SyntaxError: pc.magenta,\n RangeError: pc.yellow,\n EvalError: pc.red,\n URIError: pc.cyan,\n Error: pc.red,\n default: pc.red,\n};\n\n/**\n * Get the appropriate color function for an error type\n */\nfunction getErrorColor(errorName: string): (s: string) => string {\n return ERROR_COLORS[errorName] ?? ERROR_COLORS['default'] ?? pc.red;\n}\n\n/**\n * Pad a number to a specific width\n */\nfunction padNumber(num: number, width: number): string {\n return String(num).padStart(width, ' ');\n}\n\n/**\n * Calculate the visual width of a string (accounting for tabs)\n */\nfunction visualWidth(str: string, tabWidth = 4): number {\n let width = 0;\n for (const char of str) {\n if (char === '\\t') {\n width += tabWidth - (width % tabWidth);\n } else {\n width += 1;\n }\n }\n return width;\n}\n\n/**\n * Expand tabs to spaces for consistent alignment\n */\nfunction expandTabs(str: string, tabWidth = 4): string {\n let result = '';\n let column = 0;\n\n for (const char of str) {\n if (char === '\\t') {\n const spaces = tabWidth - (column % tabWidth);\n result += ' '.repeat(spaces);\n column += spaces;\n } else {\n result += char;\n column += 1;\n }\n }\n\n return result;\n}\n\n/**\n * Basic syntax highlighting for common patterns\n */\nfunction highlightSyntax(line: string, _isErrorLine: boolean): string {\n if (!line.trim()) {\n return line;\n }\n\n let result = line;\n\n // Don't over-highlight, keep it subtle\n // Highlight strings\n result = result.replace(\n /([\"'`])(?:(?!\\1)[^\\\\]|\\\\.)*\\1/g,\n (match) => pc.green(match)\n );\n\n // Highlight numbers (but not in already colored strings)\n result = result.replace(\n /\\b(\\d+(?:\\.\\d+)?)\\b/g,\n (match) => pc.yellow(match)\n );\n\n // Highlight keywords\n const keywords = /\\b(const|let|var|function|class|if|else|for|while|return|throw|new|async|await|import|export|from|try|catch|finally|default|switch|case|break|continue|typeof|instanceof|in|of|null|undefined|true|false|this|super)\\b/g;\n result = result.replace(keywords, (match) => pc.blue(match));\n\n // Highlight comments\n result = result.replace(\n /(\\/\\/.*$|\\/\\*[\\s\\S]*?\\*\\/)/gm,\n (match) => pc.dim(match)\n );\n\n return result;\n}\n\n/**\n * Render the code frame\n */\nfunction renderCodeFrame(\n context: CodeContext,\n _config: Required<ErrorLessConfig>\n): string[] {\n const lines: string[] = [];\n const { lines: codeLines, errorColumn } = context;\n\n // Calculate line number width\n const maxLineNumber = Math.max(...codeLines.map((l) => l.lineNumber));\n const lineNumWidth = String(maxLineNumber).length;\n\n // Gutter width: \" 123 | \"\n const gutterWidth = lineNumWidth + 3;\n\n for (const codeLine of codeLines) {\n const expandedContent = expandTabs(codeLine.content);\n const lineNumStr = padNumber(codeLine.lineNumber, lineNumWidth);\n\n if (codeLine.isErrorLine) {\n // Error line with marker\n const marker = pc.red(pc.bold(BOX.lineMarker));\n const lineNum = pc.red(pc.bold(lineNumStr));\n const separator = pc.red(pc.bold(BOX.vertical));\n const highlighted = highlightSyntax(expandedContent, true);\n\n lines.push(` ${marker} ${lineNum} ${separator} ${highlighted}`);\n\n // Pointer line\n if (errorColumn > 0) {\n // Calculate visual position considering tabs\n const beforeColumn = codeLine.content.slice(0, errorColumn - 1);\n const visualColumn = visualWidth(beforeColumn);\n\n const padding = ' '.repeat(gutterWidth + visualColumn + 1);\n const pointer = pc.red(pc.bold(BOX.pointer.repeat(Math.min(3, Math.max(1, codeLine.content.length - errorColumn + 1)))));\n\n lines.push(`${padding}${pointer}`);\n }\n } else {\n // Context line\n const lineNum = pc.dim(lineNumStr);\n const separator = pc.dim(BOX.vertical);\n const highlighted = highlightSyntax(expandedContent, false);\n\n lines.push(` ${lineNum} ${separator} ${highlighted}`);\n }\n }\n\n return lines;\n}\n\n/**\n * Render a compact stack trace\n */\nfunction renderStackTrace(\n frames: ParsedFrame[],\n topFrame: ParsedFrame | null,\n maxFrames = 5\n): string[] {\n const lines: string[] = [];\n let shown = 0;\n let hidden = 0;\n\n for (const frame of frames) {\n if (frame === topFrame) {\n continue; // Already shown in the code frame\n }\n\n if (shown >= maxFrames) {\n hidden++;\n continue;\n }\n\n lines.push(pc.dim(formatFrameAsStackLine(frame)));\n shown++;\n }\n\n if (hidden > 0) {\n lines.push(pc.dim(` ... ${hidden} more frame${hidden > 1 ? 's' : ''}`));\n }\n\n return lines;\n}\n\n/**\n * Format the error header\n */\nfunction renderHeader(\n error: Error,\n filePath: string | null,\n lineNumber: number | null,\n columnNumber: number | null,\n sourceMapResult: SourceMapResult | null\n): string[] {\n const lines: string[] = [];\n const errorColor = getErrorColor(error.name);\n\n // Error type and message\n const errorType = pc.bold(errorColor(error.name));\n const errorMessage = pc.white(error.message);\n\n lines.push('');\n lines.push(`${errorType}: ${errorMessage}`);\n\n // Location info\n if (filePath) {\n const displayPath = sourceMapResult?.source\n ? getRelativePath(path.resolve(path.dirname(filePath), sourceMapResult.source))\n : getRelativePath(filePath);\n\n const line = sourceMapResult?.line ?? lineNumber ?? 0;\n const column = sourceMapResult?.column ?? columnNumber ?? 0;\n\n const location = `${displayPath}:${line}:${column}`;\n lines.push(` ${pc.dim(BOX.arrow)} ${pc.cyan(location)}`);\n }\n\n lines.push('');\n\n return lines;\n}\n\n/**\n * Render a tip or helpful message\n */\nfunction renderTip(error: Error): string[] {\n const tips: Record<string, string> = {\n ReferenceError: 'Check that the variable is defined and in scope',\n TypeError: 'Verify the value type matches what the operation expects',\n SyntaxError: 'Look for missing brackets, commas, or typos',\n RangeError: 'Check array indices and numeric boundaries',\n };\n\n const tip = tips[error.name];\n if (tip) {\n return [\n '',\n pc.dim(` ${pc.yellow('tip')}: ${tip}`),\n ];\n }\n\n return [];\n}\n\n/**\n * Main render function - creates the complete error display\n */\nexport function renderError(\n error: Error,\n topFrame: ParsedFrame | null,\n codeContext: CodeContext | null,\n allFrames: ParsedFrame[],\n sourceMapResult: SourceMapResult | null,\n config: Required<ErrorLessConfig> = defaultConfig\n): string {\n const output: string[] = [];\n\n // Header with error type, message, and location\n output.push(...renderHeader(\n error,\n topFrame?.filePath ?? null,\n topFrame?.lineNumber ?? null,\n topFrame?.columnNumber ?? null,\n sourceMapResult\n ));\n\n // Code frame\n if (codeContext && codeContext.lines.length > 0) {\n output.push(...renderCodeFrame(codeContext, config));\n }\n\n // Optional: show tip\n output.push(...renderTip(error));\n\n // Optional: show condensed stack trace\n if (config.showFullStack && allFrames.length > 0) {\n output.push('');\n output.push(pc.dim(' Stack trace:'));\n output.push(...renderStackTrace(allFrames, topFrame));\n }\n\n output.push('');\n\n return output.join('\\n');\n}\n\n/**\n * Render a minimal error when we can't get context\n */\nexport function renderMinimalError(error: Error, frames: ParsedFrame[]): string {\n const output: string[] = [];\n const errorColor = getErrorColor(error.name);\n\n output.push('');\n output.push(`${pc.bold(errorColor(error.name))}: ${pc.white(error.message)}`);\n output.push('');\n\n // Show a few stack frames\n const framesToShow = frames.slice(0, 5);\n for (const frame of framesToShow) {\n output.push(pc.dim(formatFrameAsStackLine(frame)));\n }\n\n if (frames.length > 5) {\n output.push(pc.dim(` ... ${frames.length - 5} more frames`));\n }\n\n output.push('');\n\n return output.join('\\n');\n}\n\n/**\n * Format an error for use in try/catch blocks\n * Returns a string that can be logged\n */\nexport function formatErrorString(error: Error): string {\n // This will trigger our prepareStackTrace if installed\n return error.stack ?? String(error);\n}\n","/**\n * Stack Trace Interceptor\n * Hooks into V8's Error.prepareStackTrace to provide beautiful error output\n */\n\nimport type { CallSite, ErrorLessConfig, ParsedFrame, SourceMapResult } from './types.js';\nimport { defaultConfig } from './types.js';\nimport { parseStackTrace, findUserCodeFrame } from './parser.js';\nimport { getContextForFrame } from './reader.js';\nimport { resolveSourceMap } from './source-map.js';\nimport { renderError, renderMinimalError } from './renderer.js';\n\n/** Store the original prepareStackTrace function */\nlet originalPrepareStackTrace: typeof Error.prepareStackTrace | undefined;\n\n/** Track if we're installed */\nlet isInstalled = false;\n\n/** Current configuration */\nlet currentConfig: Required<ErrorLessConfig> = { ...defaultConfig };\n\n/** Prevent recursive calls during stack trace generation */\nlet isProcessing = false;\n\n/**\n * Custom prepareStackTrace implementation\n */\nfunction customPrepareStackTrace(error: Error, structuredStack: CallSite[]): string {\n // Prevent recursion\n if (isProcessing) {\n return formatFallbackStack(error, structuredStack);\n }\n\n isProcessing = true;\n\n try {\n return generateBeautifulStack(error, structuredStack);\n } catch {\n // If anything goes wrong, fall back to standard formatting\n return formatFallbackStack(error, structuredStack);\n } finally {\n isProcessing = false;\n }\n}\n\n/**\n * Generate the beautiful stack trace\n */\nfunction generateBeautifulStack(error: Error, structuredStack: CallSite[]): string {\n // Parse all frames\n const allFrames = parseStackTrace(structuredStack);\n\n if (allFrames.length === 0) {\n return formatFallbackStack(error, structuredStack);\n }\n\n // Filter frames based on config\n let frames = allFrames;\n if (currentConfig.filterNodeModules) {\n const userFrames = frames.filter((f) => f.isUserCode);\n if (userFrames.length > 0) {\n // Keep user frames, but also keep some context\n frames = allFrames.filter((f) => f.isUserCode || !f.isNodeModules);\n }\n }\n\n // Apply custom filter\n frames = frames.filter(currentConfig.frameFilter);\n\n // Find the top user code frame\n const topFrame = findUserCodeFrame(frames.length > 0 ? frames : allFrames);\n\n if (!topFrame) {\n return renderMinimalError(error, allFrames);\n }\n\n // Try to resolve source maps\n let sourceMapResult: SourceMapResult | null = null;\n if (currentConfig.enableSourceMaps) {\n sourceMapResult = resolveSourceMap(topFrame);\n }\n\n // Get code context\n const codeContext = getContextForFrame(\n topFrame,\n sourceMapResult,\n currentConfig.contextLinesBefore,\n currentConfig.contextLinesAfter\n );\n\n if (!codeContext) {\n return renderMinimalError(error, allFrames);\n }\n\n // Render the beautiful error\n return renderError(\n error,\n topFrame,\n codeContext,\n allFrames,\n sourceMapResult,\n currentConfig\n );\n}\n\n/**\n * Format a fallback stack trace (standard Node.js format)\n */\nfunction formatFallbackStack(error: Error, structuredStack: CallSite[]): string {\n const lines: string[] = [];\n lines.push(`${error.name}: ${error.message}`);\n\n for (const callSite of structuredStack) {\n try {\n const fileName = callSite.getFileName() ?? callSite.getScriptNameOrSourceURL() ?? '<anonymous>';\n const lineNumber = callSite.getLineNumber() ?? 0;\n const columnNumber = callSite.getColumnNumber() ?? 0;\n const functionName = callSite.getFunctionName() ?? '<anonymous>';\n\n if (callSite.isNative()) {\n lines.push(` at ${functionName} (native)`);\n } else {\n lines.push(` at ${functionName} (${fileName}:${lineNumber}:${columnNumber})`);\n }\n } catch {\n lines.push(' at <unknown>');\n }\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Install the custom stack trace handler\n */\nexport function install(config: ErrorLessConfig = {}): void {\n if (isInstalled) {\n // Update config if already installed\n currentConfig = { ...defaultConfig, ...config };\n return;\n }\n\n // Store original\n originalPrepareStackTrace = Error.prepareStackTrace;\n\n // Install our handler\n Error.prepareStackTrace = customPrepareStackTrace as typeof Error.prepareStackTrace;\n\n // Merge config\n currentConfig = { ...defaultConfig, ...config };\n\n isInstalled = true;\n}\n\n/**\n * Uninstall the custom stack trace handler\n */\nexport function uninstall(): void {\n if (!isInstalled) {\n return;\n }\n\n // Restore original\n // @ts-expect-error - Error.prepareStackTrace can be undefined in V8\n Error.prepareStackTrace = originalPrepareStackTrace;\n originalPrepareStackTrace = undefined;\n\n isInstalled = false;\n}\n\n/**\n * Check if error-less is currently installed\n */\nexport function isEnabled(): boolean {\n return isInstalled;\n}\n\n/**\n * Update configuration without reinstalling\n */\nexport function configure(config: Partial<ErrorLessConfig>): void {\n currentConfig = { ...currentConfig, ...config };\n}\n\n/**\n * Get current configuration\n */\nexport function getConfig(): Readonly<Required<ErrorLessConfig>> {\n return { ...currentConfig };\n}\n\n/**\n * Manually format an error with the beautiful stack trace\n * Useful for try/catch blocks where you want consistent formatting\n */\nexport function formatError(error: Error): string {\n if (!isInstalled) {\n // Temporarily install to format this error\n const wasInstalled = isInstalled;\n if (!wasInstalled) {\n install();\n }\n\n try {\n // Accessing .stack triggers prepareStackTrace\n return error.stack ?? String(error);\n } finally {\n if (!wasInstalled) {\n uninstall();\n }\n }\n }\n\n // Already installed, just access stack\n return error.stack ?? String(error);\n}\n\n/**\n * Create a formatted error string from any thrown value\n */\nexport function formatThrown(thrown: unknown): string {\n if (thrown instanceof Error) {\n return formatError(thrown);\n }\n\n // Wrap non-Error throws\n const wrapped = new Error(String(thrown));\n wrapped.name = 'UnknownError';\n return formatError(wrapped);\n}\n\n/**\n * Get the parsed frames for an error (for advanced usage)\n */\nexport function getErrorFrames(error: Error): ParsedFrame[] {\n // Create a temporary error to get structured stack\n const tempStack: NodeJS.CallSite[] = [];\n\n const originalPST = Error.prepareStackTrace;\n Error.prepareStackTrace = (_, stack) => {\n tempStack.push(...stack);\n return '';\n };\n\n // Capture stack\n Error.captureStackTrace(error);\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n error.stack; // Trigger prepareStackTrace\n\n Error.prepareStackTrace = originalPST;\n\n return parseStackTrace(tempStack as unknown as CallSite[]);\n}\n","/**\n * error-less\n * Beautiful, Rust-style error reporting for Node.js\n *\n * @example\n * // Auto-install with zero config\n * import 'error-less/register';\n *\n * @example\n * // Manual installation with options\n * import { install } from 'error-less';\n * install({ showFullStack: true });\n *\n * @example\n * // Format errors in try/catch\n * import { formatError } from 'error-less';\n * try {\n * riskyOperation();\n * } catch (error) {\n * console.error(formatError(error));\n * }\n */\n\n// Re-export types\nexport type {\n CallSite,\n ParsedFrame,\n CodeContext,\n SourceMapResult,\n ErrorLessConfig,\n} from './types.js';\n\nexport { defaultConfig } from './types.js';\n\n// Re-export interceptor functions\nexport {\n install,\n uninstall,\n isEnabled,\n configure,\n getConfig,\n formatError,\n formatThrown,\n getErrorFrames,\n} from './interceptor.js';\n\n// Re-export parser utilities\nexport {\n parseCallSite,\n parseStackTrace,\n findUserCodeFrame,\n formatFrameAsStackLine,\n getRelativePath,\n} from './parser.js';\n\n// Re-export reader utilities\nexport {\n getCodeContext,\n getContextForFrame,\n clearFileCache,\n fileExists,\n} from './reader.js';\n\n// Re-export source map utilities\nexport {\n resolveSourceMap,\n clearSourceMapCache,\n preloadSourceMapModule,\n} from './source-map.js';\n\n// Re-export renderer\nexport {\n renderError,\n renderMinimalError,\n formatErrorString,\n} from './renderer.js';\n\n// Default export for convenience\nimport { install } from './interceptor.js';\nexport default install;\n"]}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Type definitions for V8 CallSite API
3
+ * These are the methods available on the structured stack trace objects
4
+ * Compatible with NodeJS.CallSite
5
+ */
6
+ interface CallSite {
7
+ /** Returns the value of `this` */
8
+ getThis(): unknown;
9
+ /** Returns the type of `this` as a string */
10
+ getTypeName(): string | null;
11
+ /** Returns the current function */
12
+ getFunction(): Function | undefined;
13
+ /** Returns the name of the function, typically its `name` property */
14
+ getFunctionName(): string | null;
15
+ /** Returns the name of the property of `this` or one of its prototypes that holds the current function */
16
+ getMethodName(): string | null;
17
+ /** Returns the name of the script if this function was defined in a script */
18
+ getFileName(): string | null;
19
+ /** Returns the current line number if this function was defined in a script */
20
+ getLineNumber(): number | null;
21
+ /** Returns the current column number if this function was defined in a script */
22
+ getColumnNumber(): number | null;
23
+ /** Returns a string representing the location where eval was called if this function was created using eval */
24
+ getEvalOrigin(): string | undefined;
25
+ /** Returns true if this is a top-level invocation */
26
+ isToplevel(): boolean;
27
+ /** Returns true if this call takes place in code defined by eval */
28
+ isEval(): boolean;
29
+ /** Returns true if this call is in native V8 code */
30
+ isNative(): boolean;
31
+ /** Returns true if this is a constructor call */
32
+ isConstructor(): boolean;
33
+ /** Returns true if this call is async */
34
+ isAsync(): boolean;
35
+ /** Returns true if this is a Promise.all() call */
36
+ isPromiseAll(): boolean;
37
+ /** Returns the index of the promise element that was followed */
38
+ getPromiseIndex(): number | null;
39
+ /** Returns the script name or source URL */
40
+ getScriptNameOrSourceURL(): string | undefined;
41
+ }
42
+ /**
43
+ * Parsed frame information extracted from CallSite
44
+ */
45
+ interface ParsedFrame {
46
+ /** Absolute file path */
47
+ filePath: string;
48
+ /** Line number (1-indexed) */
49
+ lineNumber: number;
50
+ /** Column number (1-indexed) */
51
+ columnNumber: number;
52
+ /** Function name if available */
53
+ functionName: string | null;
54
+ /** Method name if available */
55
+ methodName: string | null;
56
+ /** Type name (class name) if available */
57
+ typeName: string | null;
58
+ /** Whether this is native code */
59
+ isNative: boolean;
60
+ /** Whether this is from node_modules */
61
+ isNodeModules: boolean;
62
+ /** Whether this is internal Node.js code */
63
+ isInternal: boolean;
64
+ /** Whether this is user code */
65
+ isUserCode: boolean;
66
+ /** Original CallSite for advanced usage */
67
+ callSite: CallSite;
68
+ }
69
+ /**
70
+ * Source code context around the error
71
+ */
72
+ interface CodeContext {
73
+ /** Lines of code with their line numbers */
74
+ lines: Array<{
75
+ lineNumber: number;
76
+ content: string;
77
+ isErrorLine: boolean;
78
+ }>;
79
+ /** The column number on the error line */
80
+ errorColumn: number;
81
+ /** The content of the error line */
82
+ errorLineContent: string;
83
+ }
84
+ /**
85
+ * Source map mapping result
86
+ */
87
+ interface SourceMapResult {
88
+ /** Original source file path */
89
+ source: string;
90
+ /** Original line number */
91
+ line: number;
92
+ /** Original column number */
93
+ column: number;
94
+ /** Original source content if embedded */
95
+ sourceContent?: string | undefined;
96
+ }
97
+ /**
98
+ * Configuration options for error-less
99
+ */
100
+ interface ErrorLessConfig {
101
+ /** Number of context lines before the error line (default: 2) */
102
+ contextLinesBefore?: number;
103
+ /** Number of context lines after the error line (default: 2) */
104
+ contextLinesAfter?: number;
105
+ /** Whether to show source maps (default: true) */
106
+ enableSourceMaps?: boolean;
107
+ /** Whether to filter out node_modules frames (default: true) */
108
+ filterNodeModules?: boolean;
109
+ /** Custom filter for frames */
110
+ frameFilter?: (frame: ParsedFrame) => boolean;
111
+ /** Whether to show the full stack trace after the code frame (default: false) */
112
+ showFullStack?: boolean;
113
+ /** Whether colors are enabled (auto-detected, but can be forced) */
114
+ colors?: boolean;
115
+ }
116
+ /**
117
+ * Global configuration state
118
+ */
119
+ declare const defaultConfig: Required<ErrorLessConfig>;
120
+
121
+ /**
122
+ * Stack Trace Interceptor
123
+ * Hooks into V8's Error.prepareStackTrace to provide beautiful error output
124
+ */
125
+
126
+ /**
127
+ * Install the custom stack trace handler
128
+ */
129
+ declare function install(config?: ErrorLessConfig): void;
130
+ /**
131
+ * Uninstall the custom stack trace handler
132
+ */
133
+ declare function uninstall(): void;
134
+ /**
135
+ * Check if error-less is currently installed
136
+ */
137
+ declare function isEnabled(): boolean;
138
+ /**
139
+ * Update configuration without reinstalling
140
+ */
141
+ declare function configure(config: Partial<ErrorLessConfig>): void;
142
+ /**
143
+ * Get current configuration
144
+ */
145
+ declare function getConfig(): Readonly<Required<ErrorLessConfig>>;
146
+ /**
147
+ * Manually format an error with the beautiful stack trace
148
+ * Useful for try/catch blocks where you want consistent formatting
149
+ */
150
+ declare function formatError(error: Error): string;
151
+ /**
152
+ * Create a formatted error string from any thrown value
153
+ */
154
+ declare function formatThrown(thrown: unknown): string;
155
+ /**
156
+ * Get the parsed frames for an error (for advanced usage)
157
+ */
158
+ declare function getErrorFrames(error: Error): ParsedFrame[];
159
+
160
+ export { type CallSite as C, type ErrorLessConfig as E, type ParsedFrame as P, type SourceMapResult as S, type CodeContext as a, formatThrown as b, configure as c, defaultConfig as d, getErrorFrames as e, formatError as f, getConfig as g, isEnabled as h, install as i, uninstall as u };
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Type definitions for V8 CallSite API
3
+ * These are the methods available on the structured stack trace objects
4
+ * Compatible with NodeJS.CallSite
5
+ */
6
+ interface CallSite {
7
+ /** Returns the value of `this` */
8
+ getThis(): unknown;
9
+ /** Returns the type of `this` as a string */
10
+ getTypeName(): string | null;
11
+ /** Returns the current function */
12
+ getFunction(): Function | undefined;
13
+ /** Returns the name of the function, typically its `name` property */
14
+ getFunctionName(): string | null;
15
+ /** Returns the name of the property of `this` or one of its prototypes that holds the current function */
16
+ getMethodName(): string | null;
17
+ /** Returns the name of the script if this function was defined in a script */
18
+ getFileName(): string | null;
19
+ /** Returns the current line number if this function was defined in a script */
20
+ getLineNumber(): number | null;
21
+ /** Returns the current column number if this function was defined in a script */
22
+ getColumnNumber(): number | null;
23
+ /** Returns a string representing the location where eval was called if this function was created using eval */
24
+ getEvalOrigin(): string | undefined;
25
+ /** Returns true if this is a top-level invocation */
26
+ isToplevel(): boolean;
27
+ /** Returns true if this call takes place in code defined by eval */
28
+ isEval(): boolean;
29
+ /** Returns true if this call is in native V8 code */
30
+ isNative(): boolean;
31
+ /** Returns true if this is a constructor call */
32
+ isConstructor(): boolean;
33
+ /** Returns true if this call is async */
34
+ isAsync(): boolean;
35
+ /** Returns true if this is a Promise.all() call */
36
+ isPromiseAll(): boolean;
37
+ /** Returns the index of the promise element that was followed */
38
+ getPromiseIndex(): number | null;
39
+ /** Returns the script name or source URL */
40
+ getScriptNameOrSourceURL(): string | undefined;
41
+ }
42
+ /**
43
+ * Parsed frame information extracted from CallSite
44
+ */
45
+ interface ParsedFrame {
46
+ /** Absolute file path */
47
+ filePath: string;
48
+ /** Line number (1-indexed) */
49
+ lineNumber: number;
50
+ /** Column number (1-indexed) */
51
+ columnNumber: number;
52
+ /** Function name if available */
53
+ functionName: string | null;
54
+ /** Method name if available */
55
+ methodName: string | null;
56
+ /** Type name (class name) if available */
57
+ typeName: string | null;
58
+ /** Whether this is native code */
59
+ isNative: boolean;
60
+ /** Whether this is from node_modules */
61
+ isNodeModules: boolean;
62
+ /** Whether this is internal Node.js code */
63
+ isInternal: boolean;
64
+ /** Whether this is user code */
65
+ isUserCode: boolean;
66
+ /** Original CallSite for advanced usage */
67
+ callSite: CallSite;
68
+ }
69
+ /**
70
+ * Source code context around the error
71
+ */
72
+ interface CodeContext {
73
+ /** Lines of code with their line numbers */
74
+ lines: Array<{
75
+ lineNumber: number;
76
+ content: string;
77
+ isErrorLine: boolean;
78
+ }>;
79
+ /** The column number on the error line */
80
+ errorColumn: number;
81
+ /** The content of the error line */
82
+ errorLineContent: string;
83
+ }
84
+ /**
85
+ * Source map mapping result
86
+ */
87
+ interface SourceMapResult {
88
+ /** Original source file path */
89
+ source: string;
90
+ /** Original line number */
91
+ line: number;
92
+ /** Original column number */
93
+ column: number;
94
+ /** Original source content if embedded */
95
+ sourceContent?: string | undefined;
96
+ }
97
+ /**
98
+ * Configuration options for error-less
99
+ */
100
+ interface ErrorLessConfig {
101
+ /** Number of context lines before the error line (default: 2) */
102
+ contextLinesBefore?: number;
103
+ /** Number of context lines after the error line (default: 2) */
104
+ contextLinesAfter?: number;
105
+ /** Whether to show source maps (default: true) */
106
+ enableSourceMaps?: boolean;
107
+ /** Whether to filter out node_modules frames (default: true) */
108
+ filterNodeModules?: boolean;
109
+ /** Custom filter for frames */
110
+ frameFilter?: (frame: ParsedFrame) => boolean;
111
+ /** Whether to show the full stack trace after the code frame (default: false) */
112
+ showFullStack?: boolean;
113
+ /** Whether colors are enabled (auto-detected, but can be forced) */
114
+ colors?: boolean;
115
+ }
116
+ /**
117
+ * Global configuration state
118
+ */
119
+ declare const defaultConfig: Required<ErrorLessConfig>;
120
+
121
+ /**
122
+ * Stack Trace Interceptor
123
+ * Hooks into V8's Error.prepareStackTrace to provide beautiful error output
124
+ */
125
+
126
+ /**
127
+ * Install the custom stack trace handler
128
+ */
129
+ declare function install(config?: ErrorLessConfig): void;
130
+ /**
131
+ * Uninstall the custom stack trace handler
132
+ */
133
+ declare function uninstall(): void;
134
+ /**
135
+ * Check if error-less is currently installed
136
+ */
137
+ declare function isEnabled(): boolean;
138
+ /**
139
+ * Update configuration without reinstalling
140
+ */
141
+ declare function configure(config: Partial<ErrorLessConfig>): void;
142
+ /**
143
+ * Get current configuration
144
+ */
145
+ declare function getConfig(): Readonly<Required<ErrorLessConfig>>;
146
+ /**
147
+ * Manually format an error with the beautiful stack trace
148
+ * Useful for try/catch blocks where you want consistent formatting
149
+ */
150
+ declare function formatError(error: Error): string;
151
+ /**
152
+ * Create a formatted error string from any thrown value
153
+ */
154
+ declare function formatThrown(thrown: unknown): string;
155
+ /**
156
+ * Get the parsed frames for an error (for advanced usage)
157
+ */
158
+ declare function getErrorFrames(error: Error): ParsedFrame[];
159
+
160
+ export { type CallSite as C, type ErrorLessConfig as E, type ParsedFrame as P, type SourceMapResult as S, type CodeContext as a, formatThrown as b, configure as c, defaultConfig as d, getErrorFrames as e, formatError as f, getConfig as g, isEnabled as h, install as i, uninstall as u };
@@ -0,0 +1 @@
1
+ export { i as install } from './register-BG47xgjJ.mjs';
@@ -0,0 +1 @@
1
+ export { i as install } from './register-BG47xgjJ.js';