1 | export interface SourceLocation {
|
2 | start: { line: number; column?: number | undefined };
|
3 | end?: { line: number; column?: number | undefined } | undefined;
|
4 | }
|
5 | export function codeFrameColumns(
|
6 | rawLines: string,
|
7 | location: SourceLocation,
|
8 | options?: BabelCodeFrameOptions,
|
9 | ): string;
|
10 |
|
11 | export interface BabelCodeFrameOptions {
|
12 | /** Syntax highlight the code as JavaScript for terminals. default: false */
|
13 | highlightCode?: boolean | undefined;
|
14 | /** The number of lines to show above the error. default: 2 */
|
15 | linesAbove?: number | undefined;
|
16 | /** The number of lines to show below the error. default: 3 */
|
17 | linesBelow?: number | undefined;
|
18 | /**
|
19 | * Forcibly syntax highlight the code as JavaScript (for non-terminals);
|
20 | * overrides highlightCode.
|
21 | * default: false
|
22 | */
|
23 | forceColor?: boolean | undefined;
|
24 | /**
|
25 | * Pass in a string to be displayed inline (if possible) next to the
|
26 | * highlighted location in the code. If it can't be positioned inline,
|
27 | * it will be placed above the code frame.
|
28 | * default: nothing
|
29 | */
|
30 | message?: string | undefined;
|
31 | }
|
32 |
|
33 | /**
|
34 | * Generate errors that contain a code frame that point to source locations.
|
35 | *
|
36 | * @param rawLines Raw lines to frame
|
37 | * @param lineNumber Line number (1 indexed)
|
38 | * @param colNumber Column number
|
39 | * @param options Additional options
|
40 | *
|
41 | * @returns Framed code
|
42 | */
|
43 | export default function codeFrame(
|
44 | rawLines: string,
|
45 | lineNumber: number,
|
46 | colNumber: number,
|
47 | options?: BabelCodeFrameOptions,
|
48 | ): string;
|