@remotex-labs/xmap 2.0.4 → 3.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.
- package/README.md +23 -27
- package/dist/cjs/formatter.component.js +5 -0
- package/dist/cjs/formatter.component.js.map +8 -0
- package/dist/cjs/highlighter.component.js +2 -0
- package/dist/cjs/highlighter.component.js.map +8 -0
- package/dist/cjs/index.js +3 -7
- package/dist/cjs/index.js.map +5 -5
- package/dist/cjs/parser.component.js +3 -0
- package/dist/cjs/parser.component.js.map +8 -0
- package/dist/components/base64.component.d.ts +58 -14
- package/dist/components/formatter.component.d.ts +37 -35
- package/dist/components/highlighter.component.d.ts +228 -74
- package/dist/components/interfaces/{formatter.interface.d.ts → formatter-component.interface.d.ts} +27 -9
- package/dist/components/interfaces/highlighter-component.interface.d.ts +94 -0
- package/dist/components/interfaces/parse-component.interface.d.ts +52 -0
- package/dist/components/parser.component.d.ts +216 -5
- package/dist/esm/formatter.component.js +5 -0
- package/dist/esm/formatter.component.js.map +8 -0
- package/dist/esm/highlighter.component.js +2 -0
- package/dist/esm/highlighter.component.js.map +8 -0
- package/dist/esm/index.js +3 -7
- package/dist/esm/index.js.map +5 -5
- package/dist/esm/parser.component.js +3 -0
- package/dist/esm/parser.component.js.map +8 -0
- package/dist/index.d.ts +3 -9
- package/dist/providers/interfaces/mapping-provider.interface.d.ts +141 -0
- package/dist/providers/mapping.provider.d.ts +258 -174
- package/dist/services/interfaces/source-service.interface.d.ts +139 -0
- package/dist/services/source.service.d.ts +96 -97
- package/package.json +37 -11
- package/dist/components/interfaces/highlighter.interface.d.ts +0 -48
- package/dist/components/interfaces/parse.interface.d.ts +0 -31
- package/dist/providers/interfaces/mapping.interface.d.ts +0 -52
- package/dist/services/interfaces/source.interface.d.ts +0 -53
|
@@ -1,217 +1,216 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Import will remove at compile time
|
|
3
3
|
*/
|
|
4
|
-
import type { PositionInterface, SourceMapInterface, SourceOptionsInterface, PositionWithCodeInterface, PositionWithContentInterface } from "./interfaces/source.interface";
|
|
4
|
+
import type { PositionInterface, SourceMapInterface, SourceOptionsInterface, PositionWithCodeInterface, PositionWithContentInterface } from "./interfaces/source-service.interface";
|
|
5
5
|
/**
|
|
6
6
|
* Imports
|
|
7
7
|
*/
|
|
8
8
|
import { MappingProvider } from "../providers/mapping.provider";
|
|
9
|
-
import { Bias } from "../providers/interfaces/mapping.interface";
|
|
9
|
+
import { Bias } from "../providers/interfaces/mapping-provider.interface";
|
|
10
10
|
/**
|
|
11
|
-
* A service for validating and processing source maps
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* A service for validating and processing source maps that provides functionality for parsing,
|
|
12
|
+
* position mapping, concatenation, and code snippet extraction.
|
|
13
|
+
*
|
|
14
|
+
* @param source - Source map data (SourceService, SourceMapInterface object, or JSON string)
|
|
15
|
+
* @param file - Optional file name for the generated bundle
|
|
16
|
+
* @returns A new SourceService instance
|
|
15
17
|
*
|
|
16
18
|
* @example
|
|
17
19
|
* ```ts
|
|
18
20
|
* const sourceMapJSON = '{"version": 3, "file": "bundle.js", "sources": ["foo.ts"], "names": [], "mappings": "AAAA"}';
|
|
19
21
|
* const sourceService = new SourceService(sourceMapJSON);
|
|
20
|
-
*
|
|
21
|
-
* console.log(sourceService.file); // Outputs: 'bundle.js'
|
|
22
|
+
* console.log(sourceService.file); // 'bundle.js'
|
|
22
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @since 1.0.0
|
|
23
26
|
*/
|
|
24
27
|
export declare class SourceService {
|
|
25
28
|
/**
|
|
26
|
-
* The name of the generated file
|
|
29
|
+
* The name of the generated file this source map applies to.
|
|
27
30
|
*
|
|
28
|
-
* @
|
|
29
|
-
* ```ts
|
|
30
|
-
* console.log(sourceService.file); // 'bundle.js'
|
|
31
|
-
* ```
|
|
31
|
+
* @since 1.0.0
|
|
32
32
|
*/
|
|
33
33
|
readonly file: string | null;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Provider for accessing and manipulating the base64 VLQ-encoded mappings.
|
|
36
|
+
*
|
|
37
|
+
* @since 1.0.0
|
|
36
38
|
*/
|
|
37
39
|
readonly mappings: MappingProvider;
|
|
38
40
|
/**
|
|
39
|
-
* The root URL for
|
|
41
|
+
* The root URL for resolving relative paths in the source files.
|
|
42
|
+
* @since 1.0.0
|
|
40
43
|
*/
|
|
41
44
|
readonly sourceRoot: string | null;
|
|
42
45
|
/**
|
|
43
|
-
*
|
|
46
|
+
* List of symbol names referenced by the mappings.
|
|
47
|
+
* @since 1.0.0
|
|
44
48
|
*/
|
|
45
49
|
readonly names: Array<string>;
|
|
46
50
|
/**
|
|
47
|
-
*
|
|
51
|
+
* Array of source file paths.
|
|
52
|
+
* @since 1.0.0
|
|
48
53
|
*/
|
|
49
54
|
readonly sources: Array<string>;
|
|
50
55
|
/**
|
|
51
|
-
*
|
|
56
|
+
* Array of source file contents.
|
|
57
|
+
* @since 1.0.0
|
|
52
58
|
*/
|
|
53
59
|
readonly sourcesContent: Array<string>;
|
|
54
60
|
/**
|
|
55
|
-
* Creates a new
|
|
61
|
+
* Creates a new SourceService instance.
|
|
56
62
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* It validates the source map and populates its properties such as `file`, `sources`, and `mappings`.
|
|
63
|
+
* @param source - Source map data (SourceService, SourceMapInterface object, or JSON string)
|
|
64
|
+
* @param file - Optional file name for the generated bundle
|
|
60
65
|
*
|
|
61
|
-
* @
|
|
62
|
-
* - An object conforming to the `SourceMapInterface`.
|
|
63
|
-
* - A JSON string representing the source map.
|
|
64
|
-
* - A `SourceService` instance to copy the properties.
|
|
65
|
-
* @param file - (Optional) A string representing the file name of the generated bundle.
|
|
66
|
-
* Defaults to `null`. It will overwrite any existing `file` property in the source map.
|
|
67
|
-
* @throws {Error} - If the source map does not contain required properties or has an invalid format.
|
|
66
|
+
* @throws Error - When a source map has an invalid format or missing required properties
|
|
68
67
|
*
|
|
69
|
-
* @
|
|
70
|
-
* ```ts
|
|
71
|
-
* const sourceMapJSON = '{"version": 3, "file": "bundle.js", "sources": ["foo.ts"], "names": [], "mappings": "AAAA"}';
|
|
72
|
-
* const sourceService = new SourceService(sourceMapJSON);
|
|
73
|
-
* ```
|
|
68
|
+
* @since 1.0.0
|
|
74
69
|
*/
|
|
75
70
|
constructor(source: SourceService);
|
|
76
71
|
constructor(source: SourceMapInterface | string, file?: string | null);
|
|
77
72
|
/**
|
|
78
|
-
* Converts the
|
|
73
|
+
* Converts the source map data to a plain object.
|
|
79
74
|
*
|
|
80
|
-
* @returns
|
|
75
|
+
* @returns A SourceMapInterface object representing the current state
|
|
81
76
|
*
|
|
82
77
|
* @example
|
|
83
78
|
* ```ts
|
|
84
79
|
* const mapObject = sourceService.getMapObject();
|
|
85
80
|
* console.log(mapObject.file); // 'bundle.js'
|
|
86
81
|
* ```
|
|
82
|
+
*
|
|
83
|
+
* @since 1.0.0
|
|
87
84
|
*/
|
|
88
85
|
getMapObject(): SourceMapInterface;
|
|
89
86
|
/**
|
|
90
|
-
* Concatenates
|
|
91
|
-
*
|
|
92
|
-
* This method merges additional source maps into the current source map,
|
|
93
|
-
* updating the `mappings`, `names`, `sources`, and `sourcesContent` arrays.
|
|
87
|
+
* Concatenates additional source maps into the current instance.
|
|
94
88
|
*
|
|
95
|
-
* @param maps -
|
|
96
|
-
* @throws { Error } If no source maps are provided for concatenation.
|
|
89
|
+
* @param maps - Source maps to concatenate with the current map
|
|
97
90
|
*
|
|
98
91
|
* @example
|
|
99
92
|
* ```ts
|
|
100
93
|
* sourceService.concat(anotherSourceMap);
|
|
101
94
|
* console.log(sourceService.sources); // Updated source paths
|
|
102
95
|
* ```
|
|
96
|
+
*
|
|
97
|
+
* @throws Error - When no maps are provided
|
|
98
|
+
*
|
|
99
|
+
* @since 1.0.0
|
|
103
100
|
*/
|
|
104
101
|
concat(...maps: Array<SourceMapInterface | SourceService>): void;
|
|
105
102
|
/**
|
|
106
|
-
* Creates a new instance
|
|
103
|
+
* Creates a new SourceService instance with concatenated source maps.
|
|
107
104
|
*
|
|
108
|
-
* @param maps -
|
|
109
|
-
* @returns
|
|
110
|
-
* @throws { Error } If no source maps are provided.
|
|
105
|
+
* @param maps - Source maps to concatenate with a copy of the current map
|
|
106
|
+
* @returns A new SourceService instance with the combined maps
|
|
111
107
|
*
|
|
112
108
|
* @example
|
|
113
109
|
* ```ts
|
|
114
110
|
* const newService = sourceService.concatNewMap(anotherSourceMap);
|
|
115
|
-
* console.log(newService.
|
|
111
|
+
* console.log(newService.sources); // Combined sources array
|
|
116
112
|
* ```
|
|
113
|
+
*
|
|
114
|
+
* @throws Error - When no maps are provided
|
|
115
|
+
*
|
|
116
|
+
* @since 1.0.0
|
|
117
117
|
*/
|
|
118
118
|
concatNewMap(...maps: Array<SourceMapInterface | SourceService>): SourceService;
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
120
|
+
* Finds position in generated code based on original source position.
|
|
121
121
|
*
|
|
122
|
-
* @param line -
|
|
123
|
-
* @param column -
|
|
124
|
-
* @param sourceIndex -
|
|
125
|
-
* @param bias -
|
|
126
|
-
* @returns
|
|
122
|
+
* @param line - Line number in the original source
|
|
123
|
+
* @param column - Column number in the original source
|
|
124
|
+
* @param sourceIndex - Index or file path of the original source
|
|
125
|
+
* @param bias - Position matching strategy (default: Bias.BOUND)
|
|
126
|
+
* @returns Position information or null if not found
|
|
127
127
|
*
|
|
128
128
|
* @example
|
|
129
129
|
* ```ts
|
|
130
130
|
* const position = sourceService.getPositionByOriginal(1, 10, 'foo.ts');
|
|
131
|
-
* console.log(position?.
|
|
131
|
+
* console.log(position?.generatedLine); // Line in generated code
|
|
132
132
|
* ```
|
|
133
|
+
*
|
|
134
|
+
* @since 1.0.0
|
|
133
135
|
*/
|
|
134
136
|
getPositionByOriginal(line: number, column: number, sourceIndex: number | string, bias?: Bias): PositionInterface | null;
|
|
135
137
|
/**
|
|
136
|
-
*
|
|
137
|
-
* in the generated code.
|
|
138
|
+
* Finds position in an original source based on generated code position.
|
|
138
139
|
*
|
|
139
|
-
* @param line - Line number in the generated code
|
|
140
|
-
* @param column - Column number in the generated code
|
|
141
|
-
* @param bias -
|
|
142
|
-
* @returns
|
|
140
|
+
* @param line - Line number in the generated code
|
|
141
|
+
* @param column - Column number in the generated code
|
|
142
|
+
* @param bias - Position matching strategy (default: Bias.BOUND)
|
|
143
|
+
* @returns Position information or null if not found
|
|
143
144
|
*
|
|
144
145
|
* @example
|
|
145
146
|
* ```ts
|
|
146
147
|
* const position = sourceService.getPosition(2, 15);
|
|
147
|
-
* console.log(position?.source); //
|
|
148
|
+
* console.log(position?.source); // Original source file
|
|
148
149
|
* ```
|
|
150
|
+
*
|
|
151
|
+
* @since 1.0.0
|
|
149
152
|
*/
|
|
150
153
|
getPosition(line: number, column: number, bias?: Bias): PositionInterface | null;
|
|
151
154
|
/**
|
|
152
|
-
* Retrieves
|
|
155
|
+
* Retrieves position with source content for a location in generated code.
|
|
153
156
|
*
|
|
154
|
-
* @param line - Line number in the generated code
|
|
155
|
-
* @param column - Column number in the generated code
|
|
156
|
-
* @param bias -
|
|
157
|
-
* @returns
|
|
157
|
+
* @param line - Line number in the generated code
|
|
158
|
+
* @param column - Column number in the generated code
|
|
159
|
+
* @param bias - Position matching strategy (default: Bias.BOUND)
|
|
160
|
+
* @returns Position with content information or null if not found
|
|
158
161
|
*
|
|
159
162
|
* @example
|
|
160
163
|
* ```ts
|
|
161
|
-
* const
|
|
162
|
-
* console.log(
|
|
164
|
+
* const posWithContent = sourceService.getPositionWithContent(3, 5);
|
|
165
|
+
* console.log(posWithContent?.sourcesContent); // Original source content
|
|
163
166
|
* ```
|
|
167
|
+
*
|
|
168
|
+
* @since 1.0.0
|
|
164
169
|
*/
|
|
165
170
|
getPositionWithContent(line: number, column: number, bias?: Bias): PositionWithContentInterface | null;
|
|
166
171
|
/**
|
|
167
|
-
* Retrieves
|
|
168
|
-
* generated code position, with additional lines of code around the matching line.
|
|
172
|
+
* Retrieves position with a code snippet from the original source.
|
|
169
173
|
*
|
|
170
|
-
* @param line - Line number in the generated code
|
|
171
|
-
* @param column - Column number in the generated code
|
|
172
|
-
* @param bias -
|
|
173
|
-
* @param options -
|
|
174
|
-
* @returns
|
|
174
|
+
* @param line - Line number in the generated code
|
|
175
|
+
* @param column - Column number in the generated code
|
|
176
|
+
* @param bias - Position matching strategy (default: Bias.BOUND)
|
|
177
|
+
* @param options - Configuration for the amount of surrounding lines
|
|
178
|
+
* @returns Position with code snippet or null if not found
|
|
175
179
|
*
|
|
176
180
|
* @example
|
|
177
181
|
* ```ts
|
|
178
|
-
* const
|
|
179
|
-
*
|
|
182
|
+
* const posWithCode = sourceService.getPositionWithCode(4, 8, Bias.BOUND, {
|
|
183
|
+
* linesBefore: 2,
|
|
184
|
+
* linesAfter: 2
|
|
185
|
+
* });
|
|
186
|
+
* console.log(posWithCode?.code); // Code snippet with context
|
|
180
187
|
* ```
|
|
188
|
+
*
|
|
189
|
+
* @since 1.0.0
|
|
181
190
|
*/
|
|
182
191
|
getPositionWithCode(line: number, column: number, bias?: Bias, options?: SourceOptionsInterface): PositionWithCodeInterface | null;
|
|
183
192
|
/**
|
|
184
|
-
*
|
|
193
|
+
* Serializes the source map to a JSON string.
|
|
185
194
|
*
|
|
186
|
-
* @returns
|
|
195
|
+
* @returns JSON string representation of the source map
|
|
187
196
|
*
|
|
188
197
|
* @example
|
|
189
198
|
* ```ts
|
|
190
|
-
*
|
|
199
|
+
* const jsonString = sourceService.toString();
|
|
200
|
+
* console.log(jsonString); // '{"version":3,"file":"bundle.js",...}'
|
|
191
201
|
* ```
|
|
202
|
+
*
|
|
203
|
+
* @since 1.0.0
|
|
192
204
|
*/
|
|
193
205
|
toString(): string;
|
|
194
206
|
/**
|
|
195
|
-
* Validates
|
|
207
|
+
* Validates a source map object has all required properties.
|
|
196
208
|
*
|
|
197
|
-
*
|
|
198
|
-
* It throws an error if any required keys are missing.
|
|
209
|
+
* @param input - Source map object to validate
|
|
199
210
|
*
|
|
200
|
-
* @
|
|
201
|
-
* @param input - The source map object to be validated.
|
|
202
|
-
* @throws Error If any required key is missing from the source map.
|
|
211
|
+
* @throws Error - When required properties are missing
|
|
203
212
|
*
|
|
204
|
-
* @
|
|
205
|
-
* ```ts
|
|
206
|
-
* const sourceMap = {
|
|
207
|
-
* version: 3,
|
|
208
|
-
* file: 'example.js',
|
|
209
|
-
* names: ['src', 'maps', 'example', 'function', 'line', 'column'],
|
|
210
|
-
* sources: ['source1.js', 'source2.js'],
|
|
211
|
-
* mappings: 'AAAA,SAASA,CAAC,CAAC,CAAC;AAAA,CAAC,CAAC;AAAC,CAAC',
|
|
212
|
-
* };
|
|
213
|
-
* sourceService['validateSource'](sourceMap); // Throws if invalid
|
|
214
|
-
* ```
|
|
213
|
+
* @since 1.0.0
|
|
215
214
|
*/
|
|
216
215
|
private validateSourceMap;
|
|
217
216
|
}
|
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": "
|
|
8
|
+
"version": "3.0.0",
|
|
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",
|
|
@@ -37,14 +37,40 @@
|
|
|
37
37
|
"exports": {
|
|
38
38
|
"./package.json": "./package.json",
|
|
39
39
|
".": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
40
41
|
"import": {
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
42
42
|
"default": "./dist/esm/index.js"
|
|
43
43
|
},
|
|
44
44
|
"require": {
|
|
45
|
-
"types": "./dist/index.d.ts",
|
|
46
45
|
"default": "./dist/cjs/index.js"
|
|
47
46
|
}
|
|
47
|
+
},
|
|
48
|
+
"./parser.component": {
|
|
49
|
+
"types": "./dist/components/parser.component.d.ts",
|
|
50
|
+
"import": {
|
|
51
|
+
"default": "./dist/esm/parser.component.js"
|
|
52
|
+
},
|
|
53
|
+
"require": {
|
|
54
|
+
"default": "./dist/cjs/parser.component.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"./formatter.component": {
|
|
58
|
+
"types": "./dist/components/formatter.component.d.ts",
|
|
59
|
+
"import": {
|
|
60
|
+
"default": "./dist/esm/formatter.component.js"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"default": "./dist/cjs/formatter.component.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"./highlighter.component": {
|
|
67
|
+
"types": "./dist/components/highlighter.component.d.ts",
|
|
68
|
+
"import": {
|
|
69
|
+
"default": "./dist/esm/highlighter.component.js"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"default": "./dist/cjs/highlighter.component.js"
|
|
73
|
+
}
|
|
48
74
|
}
|
|
49
75
|
},
|
|
50
76
|
"files": [
|
|
@@ -64,15 +90,15 @@
|
|
|
64
90
|
},
|
|
65
91
|
"devDependencies": {
|
|
66
92
|
"jest": "^29.7.0",
|
|
67
|
-
"eslint": "^9.
|
|
68
|
-
"typescript-eslint": "^8.
|
|
69
|
-
"eslint-plugin-
|
|
70
|
-
"@swc/jest": "^0.2.
|
|
71
|
-
"@types/jest": "^29.5.
|
|
72
|
-
"@types/node": "^22.
|
|
73
|
-
"@remotex-labs/xbuild": "^1.3
|
|
93
|
+
"eslint": "^9.22.0",
|
|
94
|
+
"typescript-eslint": "^8.27.0",
|
|
95
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
96
|
+
"@swc/jest": "^0.2.37",
|
|
97
|
+
"@types/jest": "^29.5.14",
|
|
98
|
+
"@types/node": "^22.13.11",
|
|
99
|
+
"@remotex-labs/xbuild": "^1.5.3"
|
|
74
100
|
},
|
|
75
101
|
"dependencies": {
|
|
76
|
-
"typescript": "^5.
|
|
102
|
+
"typescript": "^5.8.2"
|
|
77
103
|
}
|
|
78
104
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HighlightSchemeInterface defines the structure for a color style schema
|
|
3
|
-
* used in semantic highlighting.
|
|
4
|
-
* This interface ensures that the highlighting styles are consistent and easily configurable.
|
|
5
|
-
*/
|
|
6
|
-
export interface HighlightSchemeInterface {
|
|
7
|
-
enumColor: string;
|
|
8
|
-
typeColor: string;
|
|
9
|
-
classColor: string;
|
|
10
|
-
stringColor: string;
|
|
11
|
-
keywordColor: string;
|
|
12
|
-
commentColor: string;
|
|
13
|
-
functionColor: string;
|
|
14
|
-
variableColor: string;
|
|
15
|
-
interfaceColor: string;
|
|
16
|
-
parameterColor: string;
|
|
17
|
-
getAccessorColor: string;
|
|
18
|
-
numericLiteralColor: string;
|
|
19
|
-
methodSignatureColor: string;
|
|
20
|
-
regularExpressionColor: string;
|
|
21
|
-
propertyAssignmentColor: string;
|
|
22
|
-
propertyAccessExpressionColor: string;
|
|
23
|
-
expressionWithTypeArgumentsColor: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Represents a segment of a code string that needs to be highlighted.
|
|
27
|
-
*
|
|
28
|
-
* @interface
|
|
29
|
-
*
|
|
30
|
-
* @property start - The starting index of the segment in the code string.
|
|
31
|
-
* @property end - The ending index of the segment in the code string.
|
|
32
|
-
* @property color - The color code to apply to the segment.
|
|
33
|
-
* @property reset - The color reset code to apply after the segment.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* const segment: HighlightNodeSegment = {
|
|
37
|
-
* start: 0,
|
|
38
|
-
* end: 10,
|
|
39
|
-
* color: '\x1b[31m', // Red
|
|
40
|
-
* reset: '\x1b[0m' // Reset
|
|
41
|
-
* };
|
|
42
|
-
*/
|
|
43
|
-
export interface HighlightNodeSegmentInterface {
|
|
44
|
-
end: number;
|
|
45
|
-
start: number;
|
|
46
|
-
color: string;
|
|
47
|
-
reset: string;
|
|
48
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents an entry in the stack trace.
|
|
3
|
-
*/
|
|
4
|
-
export interface StackInterface {
|
|
5
|
-
/**
|
|
6
|
-
* The function or method where the error occurred.
|
|
7
|
-
*/
|
|
8
|
-
at: string;
|
|
9
|
-
/**
|
|
10
|
-
* The file path where the error occurred.
|
|
11
|
-
*/
|
|
12
|
-
file: string;
|
|
13
|
-
/**
|
|
14
|
-
* The line number where the error occurred.
|
|
15
|
-
*/
|
|
16
|
-
line: number;
|
|
17
|
-
/**
|
|
18
|
-
* The column number where the error occurred.
|
|
19
|
-
*/
|
|
20
|
-
column: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Represents a detailed entry in the stack trace, which may include an executor stack entry.
|
|
24
|
-
*/
|
|
25
|
-
export interface StackEntryInterface extends StackInterface {
|
|
26
|
-
/**
|
|
27
|
-
* The executor information if the error occurred within an eval function.
|
|
28
|
-
* This will be `null` if the error did not occur within an eval function.
|
|
29
|
-
*/
|
|
30
|
-
executor?: StackInterface | null;
|
|
31
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a mapping segment that corresponds to a position in the source map.
|
|
3
|
-
*
|
|
4
|
-
* @property line - The original line number in the source file.
|
|
5
|
-
* @property column - The original column number in the source file.
|
|
6
|
-
* @property nameIndex - The index of the symbol name in the source map, or `null` if there is no associated name.
|
|
7
|
-
* @property sourceIndex - The index of the source file in the source map.
|
|
8
|
-
* @property generatedLine - The line number in the generated code.
|
|
9
|
-
* @property generatedColumn - The column number in the generated code.
|
|
10
|
-
*/
|
|
11
|
-
export interface SegmentInterface {
|
|
12
|
-
line: number;
|
|
13
|
-
column: number;
|
|
14
|
-
nameIndex: number | null;
|
|
15
|
-
sourceIndex: number;
|
|
16
|
-
generatedLine: number;
|
|
17
|
-
generatedColumn: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Extends the `SegmentInterface` to represent an offset segment used during mapping calculations.
|
|
21
|
-
* The main difference is that `nameIndex` is always a number.
|
|
22
|
-
*
|
|
23
|
-
* @augments { SegmentInterface }
|
|
24
|
-
* @property nameIndex - The index of the symbol name in the source map (cannot be null in this context).
|
|
25
|
-
*/
|
|
26
|
-
export interface SegmentOffsetInterface extends SegmentInterface {
|
|
27
|
-
nameIndex: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents the bias used when searching for segments in the source map.
|
|
31
|
-
* This enum is useful for determining the preferred matching behavior
|
|
32
|
-
* when the exact line and column cannot be found.
|
|
33
|
-
*
|
|
34
|
-
* @property BOUND - No preference for column matching; returns the first match found.
|
|
35
|
-
* @property LOWER_BOUND - Prefer the closest mapping with a lower column value.
|
|
36
|
-
* @property UPPER_BOUND - Prefer the closest mapping with a higher column value.
|
|
37
|
-
*/
|
|
38
|
-
export declare const enum Bias {
|
|
39
|
-
BOUND = 0,
|
|
40
|
-
LOWER_BOUND = 1,
|
|
41
|
-
UPPER_BOUND = 2
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* A type alias for a frame in the source map, representing an array of segments.
|
|
45
|
-
* Each frame consists of multiple mapping segments for a given line in the generated code.
|
|
46
|
-
*/
|
|
47
|
-
export type FrameType = Array<SegmentInterface>;
|
|
48
|
-
/**
|
|
49
|
-
* A type alias for the source map, where each entry represents a frame of mappings.
|
|
50
|
-
* A frame can either be an array of segments (frame) or `null` if the line has no mappings (represented by a semicolon in the mapping string).
|
|
51
|
-
*/
|
|
52
|
-
export type MapType = Array<null | FrameType>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a source map structure used for mapping code within a file
|
|
3
|
-
* to its original source. Source maps are essential for debugging minified
|
|
4
|
-
* or transpiled code, as they allow developers to trace back to the
|
|
5
|
-
* original source files and understand the context of the code execution.
|
|
6
|
-
*
|
|
7
|
-
* @interface SourceMapInterface
|
|
8
|
-
* @property file - The generated file's name that the source map is associated with.
|
|
9
|
-
* This property is optional and may be null if not specified.
|
|
10
|
-
* @property names - An array of variable/function names that are present in the original source.
|
|
11
|
-
* These names help in mapping the original code context during debugging.
|
|
12
|
-
* @property version - The version of the source map specification.
|
|
13
|
-
* This should be set to `3` for the standard source map version.
|
|
14
|
-
* @property sources - An array of URLs or paths to the original source files.
|
|
15
|
-
* These sources are used to locate the original code that corresponds to the generated code.
|
|
16
|
-
* @property mappings - A VLQ (Variable-Length Quantity) encoded string that describes how to map the
|
|
17
|
-
* generated code back to the original source code. This property is crucial for the correct functioning of the source map.
|
|
18
|
-
* @property sourceRoot - An optional root URL for the sources.
|
|
19
|
-
* It can be used to specify a base path for resolving the sources, which may be null if not applicable.
|
|
20
|
-
* @property sourcesContent - An optional array containing the content of the original source files.
|
|
21
|
-
* This property can be useful when the original files are not available at runtime.
|
|
22
|
-
*/
|
|
23
|
-
export interface SourceMapInterface {
|
|
24
|
-
file?: string | null;
|
|
25
|
-
names: Array<string>;
|
|
26
|
-
version: number;
|
|
27
|
-
sources: Array<string>;
|
|
28
|
-
mappings: string;
|
|
29
|
-
sourceRoot?: string | null;
|
|
30
|
-
sourcesContent?: Array<string>;
|
|
31
|
-
}
|
|
32
|
-
export interface PositionInterface {
|
|
33
|
-
name: string | null;
|
|
34
|
-
line: number;
|
|
35
|
-
column: number;
|
|
36
|
-
source: string;
|
|
37
|
-
sourceRoot: string | null;
|
|
38
|
-
sourceIndex: number;
|
|
39
|
-
generatedLine: number;
|
|
40
|
-
generatedColumn: number;
|
|
41
|
-
}
|
|
42
|
-
export interface PositionWithContentInterface extends PositionInterface {
|
|
43
|
-
sourcesContent: string;
|
|
44
|
-
}
|
|
45
|
-
export interface PositionWithCodeInterface extends PositionInterface {
|
|
46
|
-
code: string;
|
|
47
|
-
endLine: number;
|
|
48
|
-
startLine: number;
|
|
49
|
-
}
|
|
50
|
-
export interface SourceOptionsInterface {
|
|
51
|
-
linesAfter?: number;
|
|
52
|
-
linesBefore?: number;
|
|
53
|
-
}
|