UNPKG

astx

Version:

super powerful structural search and replace for JavaScript and TypeScript to automate your refactoring

46 lines (45 loc) 1.35 kB
import { NodePath } from '../types'; interface BabelCodeFrameOptions { /** Syntax highlight the code as JavaScript for terminals. default: false */ highlightCode?: boolean | undefined; /** The number of lines to show above the error. default: 2 */ linesAbove?: number | undefined; /** The number of lines to show below the error. default: 3 */ linesBelow?: number | undefined; /** * Forcibly syntax highlight the code as JavaScript (for non-terminals); * overrides highlightCode. * default: false */ forceColor?: boolean | undefined; } export interface SourceLocation { start: { line: number; column: number; }; end?: { line: number; column: number; }; } export default class CodeFrameError extends Error { filename: string | undefined; source: string | undefined; path: NodePath | undefined; loc: SourceLocation | undefined; constructor(message: string, { filename, source, path, loc, }: { filename?: string; source?: string; path?: NodePath; loc?: SourceLocation; }); static rethrow(error: Error, { filename, source }: { filename?: string; source?: string; }): void; format(options: BabelCodeFrameOptions & { stack?: boolean; }): string; } export {};