@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.
Files changed (34) hide show
  1. package/README.md +23 -27
  2. package/dist/cjs/formatter.component.js +5 -0
  3. package/dist/cjs/formatter.component.js.map +8 -0
  4. package/dist/cjs/highlighter.component.js +2 -0
  5. package/dist/cjs/highlighter.component.js.map +8 -0
  6. package/dist/cjs/index.js +3 -7
  7. package/dist/cjs/index.js.map +5 -5
  8. package/dist/cjs/parser.component.js +3 -0
  9. package/dist/cjs/parser.component.js.map +8 -0
  10. package/dist/components/base64.component.d.ts +58 -14
  11. package/dist/components/formatter.component.d.ts +37 -35
  12. package/dist/components/highlighter.component.d.ts +228 -74
  13. package/dist/components/interfaces/{formatter.interface.d.ts → formatter-component.interface.d.ts} +27 -9
  14. package/dist/components/interfaces/highlighter-component.interface.d.ts +94 -0
  15. package/dist/components/interfaces/parse-component.interface.d.ts +52 -0
  16. package/dist/components/parser.component.d.ts +216 -5
  17. package/dist/esm/formatter.component.js +5 -0
  18. package/dist/esm/formatter.component.js.map +8 -0
  19. package/dist/esm/highlighter.component.js +2 -0
  20. package/dist/esm/highlighter.component.js.map +8 -0
  21. package/dist/esm/index.js +3 -7
  22. package/dist/esm/index.js.map +5 -5
  23. package/dist/esm/parser.component.js +3 -0
  24. package/dist/esm/parser.component.js.map +8 -0
  25. package/dist/index.d.ts +3 -9
  26. package/dist/providers/interfaces/mapping-provider.interface.d.ts +141 -0
  27. package/dist/providers/mapping.provider.d.ts +258 -174
  28. package/dist/services/interfaces/source-service.interface.d.ts +139 -0
  29. package/dist/services/source.service.d.ts +96 -97
  30. package/package.json +37 -11
  31. package/dist/components/interfaces/highlighter.interface.d.ts +0 -48
  32. package/dist/components/interfaces/parse.interface.d.ts +0 -31
  33. package/dist/providers/interfaces/mapping.interface.d.ts +0 -52
  34. 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
- * This class allows parsing and manipulation of source maps, providing functionality such as
13
- * retrieving position mappings between original and generated code, concatenating source maps,
14
- * and getting code snippets based on mappings.
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 (bundle) that this source map applies to.
29
+ * The name of the generated file this source map applies to.
27
30
  *
28
- * @example
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
- * A MappingProvider instance of base64 VLQ-encoded mappings.
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 the sources, if present in the source map.
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
- * A list of symbol names used by the mappings” entry.
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
- * An array of source file paths.
51
+ * Array of source file paths.
52
+ * @since 1.0.0
48
53
  */
49
54
  readonly sources: Array<string>;
50
55
  /**
51
- * An array of source files contents.
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 instance of the `SourceService` class.
61
+ * Creates a new SourceService instance.
56
62
  *
57
- * This constructor initializes the class using either a `SourceMapInterface` object,
58
- * a JSON string representing the source map, or an existing `SourceService` instance.
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
- * @param source - Can be one of the following:
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
- * @example
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 current source map data into a plain object format.
73
+ * Converts the source map data to a plain object.
79
74
  *
80
- * @returns The source map json object.
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 one or more source maps to the current source map.
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 - An array of `SourceMapInterface` or `SourceService` instances to be concatenated.
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 of `SourceService` with concatenated source maps.
103
+ * Creates a new SourceService instance with concatenated source maps.
107
104
  *
108
- * @param maps - An array of `SourceMapInterface` or `SourceService` instances to be concatenated.
109
- * @returns { SourceService } A new `SourceService` instance with the concatenated maps.
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.file); // The file from the new source map
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
- * Retrieves the position information based on the original source line and column.
120
+ * Finds position in generated code based on original source position.
121
121
  *
122
- * @param line - The line number in the generated code.
123
- * @param column - The column number in the generated code.
124
- * @param sourceIndex - The index or file path of the original source.
125
- * @param bias - The bias to use when matching positions (`Bias.LOWER_BOUND`, `Bias.UPPER_BOUND`, or `Bias.BOUND`).
126
- * @returns { PositionInterface | null } The corresponding position in the original source, or `null` if not found.
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?.line); // The line number in the original source
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
- * Retrieves the position in the original source code based on a given line and column
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 - The bias to use for matching positions. Defaults to `Bias.BOUND`.
142
- * @returns {PositionInterface | null} The position in the original source, or null if not found.
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); // The original source file
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 the position and original source content for a given position in the generated code.
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 - Bias used for position matching.
157
- * @returns { PositionWithContentInterface | null } The position and its associated content, or `null` if not found.
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 positionWithContent = sourceService.getPositionWithContent(3, 5);
162
- * console.log(positionWithContent?.sourcesContent); // The source code content
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 the position and a code snippet from the original source based on the given
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 - Bias used for position matching.
173
- * @param options - (Optional) Extra options for the amount of surrounding lines to include.
174
- * @returns { PositionWithCodeInterface | null } The position and code snippet.
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 positionWithCode = sourceService.getPositionWithCode(4, 8, Bias.BOUND, { linesBefore: 2, linesAfter: 2 });
179
- * console.log(positionWithCode?.code); // The code snippet from the original source
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
- * Converts the current source map object to a JSON string.
193
+ * Serializes the source map to a JSON string.
185
194
  *
186
- * @returns A stringified version of the source map object.
195
+ * @returns JSON string representation of the source map
187
196
  *
188
197
  * @example
189
198
  * ```ts
190
- * console.log(sourceService.toString()); // JSON string of the source map
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 the provided source map object.
207
+ * Validates a source map object has all required properties.
196
208
  *
197
- * This method checks whether all required keys are present in the source map object.
198
- * It throws an error if any required keys are missing.
209
+ * @param input - Source map object to validate
199
210
  *
200
- * @private
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
- * @example
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": "2.0.4",
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.13.0",
68
- "typescript-eslint": "^8.11.0",
69
- "eslint-plugin-jsdoc": "^50.4.3",
70
- "@swc/jest": "^0.2.36",
71
- "@types/jest": "^29.5.13",
72
- "@types/node": "^22.7.8",
73
- "@remotex-labs/xbuild": "^1.3.1"
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.6.3"
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
- }