@remotex-labs/xmap 3.0.0 → 3.0.2
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.
- package/dist/cjs/formatter.component.js +3 -3
- package/dist/cjs/formatter.component.js.map +3 -3
- package/dist/cjs/highlighter.component.js.map +3 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/parser.component.js +1 -1
- package/dist/cjs/parser.component.js.map +4 -4
- package/dist/esm/formatter.component.js +3 -3
- package/dist/esm/formatter.component.js.map +3 -3
- package/dist/esm/highlighter.component.js.map +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/parser.component.js +2 -2
- package/dist/esm/parser.component.js.map +3 -3
- package/dist/formatter.component.d.ts +258 -0
- package/dist/{components/highlighter.component.d.ts → highlighter.component.d.ts} +94 -11
- package/dist/index.d.ts +866 -3
- package/dist/{components/parser.component.d.ts → parser.component.d.ts} +58 -14
- package/package.json +32 -32
- package/dist/components/base64.component.d.ts +0 -70
- package/dist/components/formatter.component.d.ts +0 -68
- package/dist/components/interfaces/formatter-component.interface.d.ts +0 -60
- package/dist/components/interfaces/highlighter-component.interface.d.ts +0 -94
- package/dist/components/interfaces/parse-component.interface.d.ts +0 -52
- package/dist/providers/interfaces/mapping-provider.interface.d.ts +0 -141
- package/dist/providers/mapping.provider.d.ts +0 -317
- package/dist/services/interfaces/source-service.interface.d.ts +0 -139
- package/dist/services/source.service.d.ts +0 -216
|
@@ -1,17 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Interface representing a stack frame in a stack trace.
|
|
3
|
+
*
|
|
4
|
+
* This structure provides detailed information about the location
|
|
5
|
+
* of a specific frame in the stack trace, primarily used in error debugging and stack analysis.
|
|
6
|
+
* It optionally includes information about the line, column, file, function name, and other details
|
|
7
|
+
* about the origin of the code.
|
|
8
|
+
*
|
|
9
|
+
* Properties:
|
|
10
|
+
* - source: The source code relevant to the stack frame.
|
|
11
|
+
* - line: An optional line number in the code associated with this frame.
|
|
12
|
+
* - column: An optional column number in the line associated with this frame.
|
|
13
|
+
* - fileName: The name of the file associated with the frame, if available.
|
|
14
|
+
* - functionName: The name of the function where the stack frame is located, if available.
|
|
15
|
+
* - eval: Indicates if the stack frame originates from an evaluated script.
|
|
16
|
+
* - async: Indicates if the stack frame is part of an asynchronous operation.
|
|
17
|
+
* - native: Indicates if the stack frame is part of native code execution.
|
|
18
|
+
* - constructor: Indicates if the frame is related to an object constructor invocation.
|
|
19
|
+
* - evalOrigin: Optional information about the origin of the code if it resulted from an eval execution,
|
|
20
|
+
* including line number, column number, file name, and function name.
|
|
21
|
+
*
|
|
22
|
+
* @since 3.0.0
|
|
3
23
|
*/
|
|
4
|
-
export
|
|
24
|
+
export interface StackFrame {
|
|
25
|
+
source: string;
|
|
26
|
+
line?: number;
|
|
27
|
+
column?: number;
|
|
28
|
+
fileName?: string;
|
|
29
|
+
functionName?: string;
|
|
30
|
+
eval: boolean;
|
|
31
|
+
async: boolean;
|
|
32
|
+
native: boolean;
|
|
33
|
+
constructor: boolean;
|
|
34
|
+
evalOrigin?: {
|
|
35
|
+
line?: number;
|
|
36
|
+
column?: number;
|
|
37
|
+
fileName?: string;
|
|
38
|
+
functionName?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
5
41
|
/**
|
|
6
|
-
*
|
|
42
|
+
* Represents a fully parsed error stack trace with structured information
|
|
43
|
+
*
|
|
44
|
+
* @see StackFrame
|
|
45
|
+
* @since 2.1.0
|
|
7
46
|
*/
|
|
8
|
-
|
|
47
|
+
export interface ParsedStackTrace {
|
|
48
|
+
name: string;
|
|
49
|
+
message: string;
|
|
50
|
+
stack: StackFrame[];
|
|
51
|
+
rawStack: string;
|
|
52
|
+
}
|
|
9
53
|
/**
|
|
10
54
|
* Enumeration of JavaScript engines that can be detected from stack traces
|
|
11
55
|
*
|
|
12
56
|
* @since 2.1.0
|
|
13
57
|
*/
|
|
14
|
-
export
|
|
58
|
+
export const enum JSEngines {
|
|
15
59
|
V8 = 0,
|
|
16
60
|
SPIDERMONKEY = 1,
|
|
17
61
|
JAVASCRIPT_CORE = 2,
|
|
@@ -33,7 +77,7 @@ export declare const enum JSEngines {
|
|
|
33
77
|
*
|
|
34
78
|
* @since 2.1.0
|
|
35
79
|
*/
|
|
36
|
-
export
|
|
80
|
+
export function detectJSEngine(stack: string): JSEngines;
|
|
37
81
|
/**
|
|
38
82
|
* Normalizes file paths from various formats to a standard format
|
|
39
83
|
*
|
|
@@ -58,7 +102,7 @@ export declare function detectJSEngine(stack: string): JSEngines;
|
|
|
58
102
|
*
|
|
59
103
|
* @since 2.1.0
|
|
60
104
|
*/
|
|
61
|
-
export
|
|
105
|
+
export function normalizePath(filePath: string): string;
|
|
62
106
|
/**
|
|
63
107
|
* Creates a default stack frame object with initial values
|
|
64
108
|
*
|
|
@@ -70,7 +114,7 @@ export declare function normalizePath(filePath: string): string;
|
|
|
70
114
|
*
|
|
71
115
|
* @since 2.1.0
|
|
72
116
|
*/
|
|
73
|
-
export
|
|
117
|
+
export function createDefaultFrame(source: string): StackFrame;
|
|
74
118
|
/**
|
|
75
119
|
* Safely parses a string value to an integer, handling undefined and null cases
|
|
76
120
|
*
|
|
@@ -86,7 +130,7 @@ export declare function createDefaultFrame(source: string): StackFrame;
|
|
|
86
130
|
*
|
|
87
131
|
* @since 2.1.0
|
|
88
132
|
*/
|
|
89
|
-
export
|
|
133
|
+
export function safeParseInt(value: string | undefined | null): number | undefined;
|
|
90
134
|
/**
|
|
91
135
|
* Parses a V8 JavaScript engine stack trace line into a structured StackFrame object
|
|
92
136
|
*
|
|
@@ -113,7 +157,7 @@ export declare function safeParseInt(value: string | undefined | null): number |
|
|
|
113
157
|
*
|
|
114
158
|
* @since 2.1.0
|
|
115
159
|
*/
|
|
116
|
-
export
|
|
160
|
+
export function parseV8StackLine(line: string): StackFrame;
|
|
117
161
|
/**
|
|
118
162
|
* Parses a SpiderMonkey JavaScript engine stack trace line into a structured StackFrame object
|
|
119
163
|
*
|
|
@@ -138,7 +182,7 @@ export declare function parseV8StackLine(line: string): StackFrame;
|
|
|
138
182
|
*
|
|
139
183
|
* @since 2.1.0
|
|
140
184
|
*/
|
|
141
|
-
export
|
|
185
|
+
export function parseSpiderMonkeyStackLine(line: string): StackFrame;
|
|
142
186
|
/**
|
|
143
187
|
* Parses a JavaScriptCore engine stack trace line into a structured StackFrame object
|
|
144
188
|
*
|
|
@@ -163,7 +207,7 @@ export declare function parseSpiderMonkeyStackLine(line: string): StackFrame;
|
|
|
163
207
|
*
|
|
164
208
|
* @since 2.1.0
|
|
165
209
|
*/
|
|
166
|
-
export
|
|
210
|
+
export function parseJavaScriptCoreStackLine(line: string): StackFrame;
|
|
167
211
|
/**
|
|
168
212
|
* Parses a stack trace line based on the detected JavaScript engine
|
|
169
213
|
*
|
|
@@ -188,7 +232,7 @@ export declare function parseJavaScriptCoreStackLine(line: string): StackFrame;
|
|
|
188
232
|
*
|
|
189
233
|
* @since 2.1.0
|
|
190
234
|
*/
|
|
191
|
-
export
|
|
235
|
+
export function parseStackLine(line: string, engine: JSEngines): StackFrame;
|
|
192
236
|
/**
|
|
193
237
|
* Parses a complete error stack trace into a structured format
|
|
194
238
|
*
|
|
@@ -219,4 +263,4 @@ export declare function parseStackLine(line: string, engine: JSEngines): StackFr
|
|
|
219
263
|
*
|
|
220
264
|
* @since 2.1.0
|
|
221
265
|
*/
|
|
222
|
-
export
|
|
266
|
+
export function parseErrorStack(error: Error | string): ParsedStackTrace;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
7
7
|
"author": "Garefild",
|
|
8
|
-
"version": "3.0.
|
|
8
|
+
"version": "3.0.2",
|
|
9
9
|
"license": "Mozilla Public License Version 2.0",
|
|
10
10
|
"description": "A library with a sourcemap parser and TypeScript code formatter for the CLI",
|
|
11
11
|
"homepage": "https://github.com/remotex-lab/xMap",
|
|
@@ -34,44 +34,44 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18"
|
|
36
36
|
},
|
|
37
|
+
"typesVersions": {
|
|
38
|
+
"*": {
|
|
39
|
+
"*": [
|
|
40
|
+
"./dist/*"
|
|
41
|
+
],
|
|
42
|
+
"parser.component": [
|
|
43
|
+
"./dist/parser.component.d.ts"
|
|
44
|
+
],
|
|
45
|
+
"formatter.component": [
|
|
46
|
+
"./dist/formatter.component.d.ts"
|
|
47
|
+
],
|
|
48
|
+
"highlighter.component": [
|
|
49
|
+
"./dist/highlighter.component.d.ts"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
37
53
|
"exports": {
|
|
38
|
-
"./package.json": "./package.json",
|
|
39
54
|
".": {
|
|
40
55
|
"types": "./dist/index.d.ts",
|
|
41
|
-
"import":
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
"require": {
|
|
45
|
-
"default": "./dist/cjs/index.js"
|
|
46
|
-
}
|
|
56
|
+
"import": "./dist/esm/index.js",
|
|
57
|
+
"require": "./dist/cjs/index.js"
|
|
47
58
|
},
|
|
48
59
|
"./parser.component": {
|
|
49
|
-
"types": "./dist/
|
|
50
|
-
"import":
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
"require": {
|
|
54
|
-
"default": "./dist/cjs/parser.component.js"
|
|
55
|
-
}
|
|
60
|
+
"types": "./dist/parser.component.d.ts",
|
|
61
|
+
"import": "./dist/esm/parser.component.js",
|
|
62
|
+
"require": "./dist/cjs/parser.component.js"
|
|
56
63
|
},
|
|
57
64
|
"./formatter.component": {
|
|
58
|
-
"types": "./dist/
|
|
59
|
-
"import":
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
"require": {
|
|
63
|
-
"default": "./dist/cjs/formatter.component.js"
|
|
64
|
-
}
|
|
65
|
+
"types": "./dist/formatter.component.d.ts",
|
|
66
|
+
"import": "./dist/esm/formatter.component.js",
|
|
67
|
+
"require": "./dist/cjs/formatter.component.js"
|
|
65
68
|
},
|
|
66
69
|
"./highlighter.component": {
|
|
67
|
-
"types": "./dist/
|
|
68
|
-
"import":
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"default": "./dist/cjs/highlighter.component.js"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
70
|
+
"types": "./dist/highlighter.component.d.ts",
|
|
71
|
+
"import": "./dist/esm/highlighter.component.js",
|
|
72
|
+
"require": "./dist/cjs/highlighter.component.js"
|
|
73
|
+
},
|
|
74
|
+
"./package.json": "./package.json"
|
|
75
75
|
},
|
|
76
76
|
"files": [
|
|
77
77
|
"dist",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"jest": "^29.7.0",
|
|
93
|
-
"eslint": "^9.
|
|
93
|
+
"eslint": "^9.23.0",
|
|
94
94
|
"typescript-eslint": "^8.27.0",
|
|
95
95
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
96
96
|
"@swc/jest": "^0.2.37",
|
|
97
97
|
"@types/jest": "^29.5.14",
|
|
98
98
|
"@types/node": "^22.13.11",
|
|
99
|
-
"@remotex-labs/xbuild": "^1.5.
|
|
99
|
+
"@remotex-labs/xbuild": "^1.5.5"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"typescript": "^5.8.2"
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encodes a given number using Variable-Length Quantity (VLQ) encoding. Negative numbers are encoded by
|
|
3
|
-
* converting to a non-negative representation and the continuation bit is used to indicate if more bytes follow.
|
|
4
|
-
*
|
|
5
|
-
* @param value - The number to be encoded
|
|
6
|
-
* @returns The VLQ encoded string represented as Base64 characters
|
|
7
|
-
*
|
|
8
|
-
* @throws Error - If the value cannot be properly encoded
|
|
9
|
-
*
|
|
10
|
-
* @remarks The encoding process shifts the value left by 1 bit to accommodate a sign bit in the least significant position.
|
|
11
|
-
* Negative values have their sign bit set to 1, while positive values have it set to 0.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* // Encoding a positive number
|
|
16
|
-
* const encoded = encodeVLQ(25); // Returns "Y"
|
|
17
|
-
*
|
|
18
|
-
* // Encoding a negative number
|
|
19
|
-
* const encodedNegative = encodeVLQ(-25); // Returns "Z"
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @see decodeVLQ - For the corresponding decode function
|
|
23
|
-
*
|
|
24
|
-
* @since 1.0.0
|
|
25
|
-
*/
|
|
26
|
-
export declare function encodeVLQ(value: number): string;
|
|
27
|
-
/**
|
|
28
|
-
* Encodes an array of numbers using VLQ encoding by individually encoding each number and concatenating the results.
|
|
29
|
-
*
|
|
30
|
-
* @param values - The array of numbers to be encoded
|
|
31
|
-
* @returns The concatenated VLQ encoded string
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* // Encoding multiple values
|
|
36
|
-
* const encoded = encodeArrayVLQ([1, 0, -5]); // Returns "CAAK"
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @see encodeVLQ - The underlying function used to encode each number
|
|
40
|
-
*
|
|
41
|
-
* @since 1.0.0
|
|
42
|
-
*/
|
|
43
|
-
export declare function encodeArrayVLQ(values: number[]): string;
|
|
44
|
-
/**
|
|
45
|
-
* Decodes a VLQ encoded string back into an array of numbers by processing Base64 characters and continuation bits.
|
|
46
|
-
*
|
|
47
|
-
* @param data - The VLQ encoded string
|
|
48
|
-
* @returns The array of decoded numbers
|
|
49
|
-
*
|
|
50
|
-
* @throws Error - If the string contains invalid Base64 characters
|
|
51
|
-
*
|
|
52
|
-
* @remarks The decoding process examines each Base64 character,
|
|
53
|
-
* checking for continuation bits and progressively building up numeric values.
|
|
54
|
-
* The sign bit is extracted from the least significant position
|
|
55
|
-
* to determine if the original number was negative.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* // Decoding a simple VLQ string
|
|
60
|
-
* const decoded = decodeVLQ("Y"); // Returns [25]
|
|
61
|
-
*
|
|
62
|
-
* // Decoding multiple values
|
|
63
|
-
* const multiDecoded = decodeVLQ("CAAK"); // Returns [1, 0, -5]
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @see encodeVLQ - For the corresponding encode function
|
|
67
|
-
*
|
|
68
|
-
* @since 1.0.0
|
|
69
|
-
*/
|
|
70
|
-
export declare function decodeVLQ(data: string): number[];
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Export interfaces
|
|
3
|
-
*/
|
|
4
|
-
export type { AnsiOptionInterface, FormatCodeInterface } from "./interfaces/formatter-component.interface";
|
|
5
|
-
/**
|
|
6
|
-
* Import will remove at compile time
|
|
7
|
-
*/
|
|
8
|
-
import type { PositionWithCodeInterface } from "../services/interfaces/source-service.interface";
|
|
9
|
-
import type { AnsiOptionInterface, FormatCodeInterface } from "./interfaces/formatter-component.interface";
|
|
10
|
-
/**
|
|
11
|
-
* Formats a code snippet with optional line padding and custom actions
|
|
12
|
-
*
|
|
13
|
-
* @param code - The source code | stack to be formatted
|
|
14
|
-
* @param options - Configuration options for formatting the code
|
|
15
|
-
* @returns A formatted string of the code snippet with applied padding and custom actions
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* This function takes a code string and an options object to format the code snippet.
|
|
19
|
-
* It applies padding to line numbers and can trigger custom actions for specific lines.
|
|
20
|
-
* Options include padding (default 10), startLine (default 0), and custom actions for specific lines.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* const formattedCode = formatCode(code, {
|
|
25
|
-
* padding: 8,
|
|
26
|
-
* startLine: 5,
|
|
27
|
-
* action: {
|
|
28
|
-
* triggerLine: 7,
|
|
29
|
-
* callback: (lineString, padding, lineNumber) => {
|
|
30
|
-
* return `Custom formatting for line ${lineNumber}: ${lineString}`;
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* });
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @since 1.0.0
|
|
37
|
-
*/
|
|
38
|
-
export declare function formatCode(code: string, options?: FormatCodeInterface): string;
|
|
39
|
-
/**
|
|
40
|
-
* Formats a code snippet around an error location with special highlighting
|
|
41
|
-
*
|
|
42
|
-
* @param sourcePosition - An object containing information about the source code and error location
|
|
43
|
-
* @param ansiOption - Optional configuration for ANSI color codes
|
|
44
|
-
* @returns A formatted string representing the relevant code snippet with error highlighting
|
|
45
|
-
*
|
|
46
|
-
* @throws Error - If the provided sourcePosition object has invalid line or column numbers
|
|
47
|
-
*
|
|
48
|
-
* @remarks
|
|
49
|
-
* This function takes a sourcePosition object with code content and error location information,
|
|
50
|
-
* then uses formatCode to format and highlight the relevant code snippet around the error.
|
|
51
|
-
* The sourcePosition object should contain code (string), line (number), column (number),
|
|
52
|
-
* and optional startLine (number, defaults to 1).
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* const formattedErrorCode = formatErrorCode({
|
|
57
|
-
* code: "const x = 1;\nconst y = x.undefined;\n",
|
|
58
|
-
* line: 2,
|
|
59
|
-
* column: 15,
|
|
60
|
-
* startLine: 1
|
|
61
|
-
* });
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @see formatCode - The underlying function used for basic code formatting
|
|
65
|
-
*
|
|
66
|
-
* @since 1.0.0
|
|
67
|
-
*/
|
|
68
|
-
export declare function formatErrorCode(sourcePosition: PositionWithCodeInterface, ansiOption?: AnsiOptionInterface): string;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A callback function for formatting code lines
|
|
3
|
-
*
|
|
4
|
-
* @param lineString - The content of the line to be formatted
|
|
5
|
-
* @param padding - The amount of padding to be applied to the line
|
|
6
|
-
* @param line - The line number of the line to be formatted
|
|
7
|
-
* @returns Formatted line string
|
|
8
|
-
*
|
|
9
|
-
* @since 1.0.0
|
|
10
|
-
*/
|
|
11
|
-
export type FormatCodeCallbackType = (lineString: string, padding: number, line: number) => string;
|
|
12
|
-
/**
|
|
13
|
-
* Configuration options for formatting code
|
|
14
|
-
*
|
|
15
|
-
* @since 1.0.0
|
|
16
|
-
*/
|
|
17
|
-
export interface FormatCodeInterface {
|
|
18
|
-
/**
|
|
19
|
-
* The amount of padding to be applied to each line
|
|
20
|
-
* @since 1.0.0
|
|
21
|
-
*/
|
|
22
|
-
padding?: number;
|
|
23
|
-
/**
|
|
24
|
-
* The starting line number for formatting
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
*/
|
|
27
|
-
startLine?: number;
|
|
28
|
-
/**
|
|
29
|
-
* An optional action object specifying a line where a callback function should be triggered.
|
|
30
|
-
* @since 1.0.0
|
|
31
|
-
*/
|
|
32
|
-
action?: {
|
|
33
|
-
/**
|
|
34
|
-
* The line number at which the callback function should be triggered.
|
|
35
|
-
* @since 1.0.0
|
|
36
|
-
*/
|
|
37
|
-
triggerLine: number;
|
|
38
|
-
/**
|
|
39
|
-
* The callback function to be executed when the trigger line is encountered.
|
|
40
|
-
* @since 1.0.0
|
|
41
|
-
*/
|
|
42
|
-
callback: FormatCodeCallbackType;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Configuration for ANSI color styling of error pointers
|
|
47
|
-
* @since 1.0.0
|
|
48
|
-
*/
|
|
49
|
-
export interface AnsiOptionInterface {
|
|
50
|
-
/**
|
|
51
|
-
* ANSI color code to apply to the error pointer
|
|
52
|
-
* @since 1.0.0
|
|
53
|
-
*/
|
|
54
|
-
color: string;
|
|
55
|
-
/**
|
|
56
|
-
* ANSI reset code to restore default styling after the error pointer
|
|
57
|
-
* @since 1.0.0
|
|
58
|
-
*/
|
|
59
|
-
reset: string;
|
|
60
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the color scheme for syntax highlighting different code elements.
|
|
3
|
-
*
|
|
4
|
-
* @interface HighlightSchemeInterface
|
|
5
|
-
*
|
|
6
|
-
* @property enumColor - Color code for enum declarations and references
|
|
7
|
-
* @property typeColor - Color code for type annotations and primitive types
|
|
8
|
-
* @property classColor - Color code for class declarations and references
|
|
9
|
-
* @property stringColor - Color code for string literals and template strings
|
|
10
|
-
* @property keywordColor - Color code for language keywords
|
|
11
|
-
* @property commentColor - Color code for comments (single-line and multi-line)
|
|
12
|
-
* @property functionColor - Color code for function declarations and calls
|
|
13
|
-
* @property variableColor - Color code for variable declarations and references
|
|
14
|
-
* @property interfaceColor - Color code for interface declarations and references
|
|
15
|
-
* @property parameterColor - Color code for function and method parameters
|
|
16
|
-
* @property getAccessorColor - Color code for getter accessor methods
|
|
17
|
-
* @property numericLiteralColor - Color code for numeric literals
|
|
18
|
-
* @property methodSignatureColor - Color code for method signatures in interfaces
|
|
19
|
-
* @property regularExpressionColor - Color code for regular expression literals
|
|
20
|
-
* @property propertyAssignmentColor - Color code for property assignments in object literals
|
|
21
|
-
* @property propertyAccessExpressionColor - Color code for property access expressions
|
|
22
|
-
* @property expressionWithTypeArgumentsColor - Color code for type arguments in expressions
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const darkTheme: HighlightSchemeInterface = {
|
|
27
|
-
* enumColor: Colors.cyan,
|
|
28
|
-
* typeColor: Colors.blue,
|
|
29
|
-
* classColor: Colors.yellow,
|
|
30
|
-
* // ...other color definitions
|
|
31
|
-
* };
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @since 1.0.0
|
|
35
|
-
*/
|
|
36
|
-
export interface HighlightSchemeInterface {
|
|
37
|
-
enumColor: string;
|
|
38
|
-
typeColor: string;
|
|
39
|
-
classColor: string;
|
|
40
|
-
stringColor: string;
|
|
41
|
-
keywordColor: string;
|
|
42
|
-
commentColor: string;
|
|
43
|
-
functionColor: string;
|
|
44
|
-
variableColor: string;
|
|
45
|
-
interfaceColor: string;
|
|
46
|
-
parameterColor: string;
|
|
47
|
-
getAccessorColor: string;
|
|
48
|
-
numericLiteralColor: string;
|
|
49
|
-
methodSignatureColor: string;
|
|
50
|
-
regularExpressionColor: string;
|
|
51
|
-
propertyAssignmentColor: string;
|
|
52
|
-
propertyAccessExpressionColor: string;
|
|
53
|
-
expressionWithTypeArgumentsColor: string;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Represents a segment of source code to be highlighted with specific styling.
|
|
57
|
-
*
|
|
58
|
-
* @interface HighlightNodeSegmentInterface
|
|
59
|
-
*
|
|
60
|
-
* @property start - The starting character position of the segment in the source text
|
|
61
|
-
* @property end - The ending character position of the segment in the source text
|
|
62
|
-
* @property color - The color or style code to apply to this segment
|
|
63
|
-
* @property reset - The reset code that returns formatting to normal after this segment
|
|
64
|
-
*
|
|
65
|
-
* @remarks
|
|
66
|
-
* Segments are the fundamental units of the highlighting system.
|
|
67
|
-
* Each segment represents a portion of text that should receive specific styling.
|
|
68
|
-
* When the source code is processed for display,
|
|
69
|
-
* these segments are used to insert the appropriate color/style codes at the correct positions.
|
|
70
|
-
*
|
|
71
|
-
* The highlighter maintains a collection of these segments and applies them
|
|
72
|
-
* in position order to create the complete highlighted output.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* const keywordSegment: HighlightNodeSegmentInterface = {
|
|
77
|
-
* start: 0,
|
|
78
|
-
* end: 6,
|
|
79
|
-
* color: '\x1b[34m', // Blue for the keyword "import"
|
|
80
|
-
* reset: '\x1b[0m' // Reset to default
|
|
81
|
-
* };
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @see HighlightSchemeInterface
|
|
85
|
-
* @see addSegment
|
|
86
|
-
*
|
|
87
|
-
* @since 1.0.0
|
|
88
|
-
*/
|
|
89
|
-
export interface HighlightNodeSegmentInterface {
|
|
90
|
-
end: number;
|
|
91
|
-
start: number;
|
|
92
|
-
color: string;
|
|
93
|
-
reset: string;
|
|
94
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interface representing a stack frame in a stack trace.
|
|
3
|
-
*
|
|
4
|
-
* This structure provides detailed information about the location
|
|
5
|
-
* of a specific frame in the stack trace, primarily used in error debugging and stack analysis.
|
|
6
|
-
* It optionally includes information about the line, column, file, function name, and other details
|
|
7
|
-
* about the origin of the code.
|
|
8
|
-
*
|
|
9
|
-
* Properties:
|
|
10
|
-
* - source: The source code relevant to the stack frame.
|
|
11
|
-
* - line: An optional line number in the code associated with this frame.
|
|
12
|
-
* - column: An optional column number in the line associated with this frame.
|
|
13
|
-
* - fileName: The name of the file associated with the frame, if available.
|
|
14
|
-
* - functionName: The name of the function where the stack frame is located, if available.
|
|
15
|
-
* - eval: Indicates if the stack frame originates from an evaluated script.
|
|
16
|
-
* - async: Indicates if the stack frame is part of an asynchronous operation.
|
|
17
|
-
* - native: Indicates if the stack frame is part of native code execution.
|
|
18
|
-
* - constructor: Indicates if the frame is related to an object constructor invocation.
|
|
19
|
-
* - evalOrigin: Optional information about the origin of the code if it resulted from an eval execution,
|
|
20
|
-
* including line number, column number, file name, and function name.
|
|
21
|
-
*
|
|
22
|
-
* @since 3.0.0
|
|
23
|
-
*/
|
|
24
|
-
export interface StackFrame {
|
|
25
|
-
source: string;
|
|
26
|
-
line?: number;
|
|
27
|
-
column?: number;
|
|
28
|
-
fileName?: string;
|
|
29
|
-
functionName?: string;
|
|
30
|
-
eval: boolean;
|
|
31
|
-
async: boolean;
|
|
32
|
-
native: boolean;
|
|
33
|
-
constructor: boolean;
|
|
34
|
-
evalOrigin?: {
|
|
35
|
-
line?: number;
|
|
36
|
-
column?: number;
|
|
37
|
-
fileName?: string;
|
|
38
|
-
functionName?: string;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Represents a fully parsed error stack trace with structured information
|
|
43
|
-
*
|
|
44
|
-
* @see StackFrame
|
|
45
|
-
* @since 2.1.0
|
|
46
|
-
*/
|
|
47
|
-
export interface ParsedStackTrace {
|
|
48
|
-
name: string;
|
|
49
|
-
message: string;
|
|
50
|
-
stack: StackFrame[];
|
|
51
|
-
rawStack: string;
|
|
52
|
-
}
|