@remotex-labs/xmap 1.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.
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Import will remove at compile time
3
+ */
4
+ import type { HighlightSchemeInterface } from './interfaces/highlighter.interface';
5
+ /**
6
+ * Imports
7
+ */
8
+ import * as ts from 'typescript';
9
+ /**
10
+ * An enum containing ANSI escape sequences for various colors.
11
+ *
12
+ * This enum is primarily intended for terminal output and won't work directly in JavaScript for web development.
13
+ * It defines color codes for various colors and a reset code to return to
14
+ * the default text color.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * console.log(`${Colors.red}This the text will be red in the terminal.${Colors.reset}`);
19
+ * ```
20
+ *
21
+ * This functionality is limited to terminal environments.
22
+ * Consider alternative methods
23
+ * for color highlighting in web development contexts, such as CSS classes.
24
+ */
25
+ export declare const enum Colors {
26
+ reset = "\u001B[0m",
27
+ gray = "\u001B[38;5;243m",
28
+ darkGray = "\u001B[38;5;238m",
29
+ lightCoral = "\u001B[38;5;203m",
30
+ lightOrange = "\u001B[38;5;215m",
31
+ oliveGreen = "\u001B[38;5;149m",
32
+ burntOrange = "\u001B[38;5;208m",
33
+ lightGoldenrodYellow = "\u001B[38;5;221m",
34
+ lightYellow = "\u001B[38;5;230m",
35
+ canaryYellow = "\u001B[38;5;227m",
36
+ deepOrange = "\u001B[38;5;166m",
37
+ lightGray = "\u001B[38;5;252m",
38
+ brightPink = "\u001B[38;5;197m"
39
+ }
40
+ /**
41
+ * Class responsible for applying semantic highlighting to a source code string based on a given color scheme.
42
+ *
43
+ * @class
44
+ *
45
+ * @param sourceFile - The TypeScript AST node representing the source file.
46
+ * @param code - The source code string to be highlighted.
47
+ * @param schema - The color scheme used for highlighting different elements in the code.
48
+ *
49
+ * const highlighter = new CodeHighlighter(sourceFile, code, schema);
50
+ */
51
+ export declare class CodeHighlighter {
52
+ private sourceFile;
53
+ private code;
54
+ private schema;
55
+ /**
56
+ * A Map of segments where the key is a combination of start and end positions,
57
+ * and the value is an object containing the color and reset code.
58
+ * This structure ensures unique segments and allows for fast lookups and updates.
59
+ *
60
+ * @example
61
+ * this.segments = new Map([
62
+ * ['0-10', { start: 1, end: 11, color: '\x1b[31m', reset: '\x1b[0m' }],
63
+ * ['11-20', { start: 12, end: 20, color: '\x1b[32m', reset: '\x1b[0m' }]
64
+ * ]);
65
+ */
66
+ private segments;
67
+ /**
68
+ * Creates an instance of the CodeHighlighter class.
69
+ *
70
+ * @param sourceFile - The TypeScript AST node representing the source file.
71
+ * @param code - The source code string to be highlighted.
72
+ * @param schema - The color scheme used for highlighting different elements in the code.
73
+ */
74
+ constructor(sourceFile: ts.Node, code: string, schema: HighlightSchemeInterface);
75
+ /**
76
+ * Parses a TypeScript AST node and processes its comments to identify segments that need highlighting.
77
+ *
78
+ * @param node - The TypeScript AST node to be parsed.
79
+ */
80
+ parseNode(node: ts.Node): void;
81
+ /**
82
+ * Generates a string with highlighted code segments based on the provided color scheme.
83
+ *
84
+ * This method processes the stored segments, applies the appropriate colors to each segment,
85
+ * and returns the resulting highlighted code as a single string.
86
+ *
87
+ * @returns The highlighted code as a string, with ANSI color codes applied to the segments.
88
+ */
89
+ highlight(): string;
90
+ /**
91
+ * Extracts a substring from the code based on the specified start and end positions.
92
+ *
93
+ * This method is used to retrieve the source code segment that corresponds to the
94
+ * given start and end positions. It is primarily used for highlighting specific
95
+ * segments of the code.
96
+ *
97
+ * @param start - The starting index of the segment to be extracted.
98
+ * @param end - The ending index of the segment to be extracted.
99
+ * @returns The extracted substring from the code.
100
+ */
101
+ private getSegmentSource;
102
+ /**
103
+ * Adds a new segment to the list of segments to be highlighted.
104
+ * The segment is defined by its start and end positions, the color to apply, and an optional reset code.
105
+ *
106
+ * @param start - The starting index of the segment in the code string.
107
+ * @param end - The ending index of the segment in the code string.
108
+ * @param color - The color code to apply to the segment.
109
+ * @param reset - The color reset code to apply after the segment, Defaults to the reset code defined in `Colors.reset`.
110
+ */
111
+ private addSegment;
112
+ /**
113
+ * Processes comments within a TypeScript AST node and adds segments for highlighting.
114
+ * Extracts trailing and leading comments from the node and adds them as segments using the color defined in `this.colorSchema.comments`.
115
+ *
116
+ * @param node - The TypeScript AST node whose comments are to be processed.
117
+ */
118
+ private processComments;
119
+ /**
120
+ * Processes the keywords within a TypeScript AST node and adds them as segments for highlighting.
121
+ *
122
+ * This method identifies potential keyword tokens within the provided node and adds them to the
123
+ * list of segments with the color defined in `this.schema.keywordColor`.
124
+ * The method considers the current node, its first token, and its last token to determine if they should be highlighted
125
+ * as keywords.
126
+ *
127
+ * The method checks if the node's kind falls within the range of keyword kinds defined by TypeScript.
128
+ * If the node or any of its tokens are identified as keywords, a segment is added to `this.segments`
129
+ * with the start and end positions of the node and the specified color for keywords.
130
+ *
131
+ * @param node - The TypeScript AST node to be processed for keywords.
132
+ */
133
+ private processKeywords;
134
+ /**
135
+ * Processes identifiers within a TypeScript AST node and adds them as segments for highlighting
136
+ * based on the node's parent type.
137
+ *
138
+ * This method determines the appropriate color for an identifier based on its parent node's kind.
139
+ * If the parent node matches one of the specified kinds, the identifier is highlighted with a cyan color.
140
+ * Supported parent kinds include various declarations, expressions, and signatures.
141
+ *
142
+ * @param node - The TypeScript AST node representing the identifier to be processed.
143
+ */
144
+ private processIdentifier;
145
+ /**
146
+ * Processes a TypeScript template expression and adds segments for highlighting its literal parts.
147
+ *
148
+ * This method adds a segment for the head of the template expression with the color specified in `this.schema.stringColor`.
149
+ * It also processes each template span within the expression, adding
150
+ * segments for each span's literal part.
151
+ *
152
+ * @param templateExpression - The TypeScript template expression to be processed.
153
+ */
154
+ private processTemplateExpression;
155
+ /**
156
+ * Processes a TypeScript AST node and adds segments for highlighting based on the node's kind.
157
+ *
158
+ * This method identifies the kind of the node and determines the appropriate color for highlighting.
159
+ * It handles various node kinds including string literals, regular expressions, template expressions, and identifiers.
160
+ * Specific methods are invoked for more complex node kinds, such as template expressions and identifiers.
161
+ *
162
+ * @param node - The TypeScript AST node to be processed.
163
+ */
164
+ private processNode;
165
+ }
166
+ /**
167
+ * Applies semantic highlighting to the provided code string using the specified color scheme.
168
+ *
169
+ * @param code - The source code to be highlighted.
170
+ * @param schema - An optional partial schema defining the color styles for various code elements.
171
+ * Defaults to an empty object, which means no specific highlighting will be applied.
172
+ *
173
+ * @returns A string with the code elements wrapped in the appropriate color styles as specified by the schema.
174
+ *
175
+ * @example
176
+ * const code = 'const x: number = 42;';
177
+ * const schema = {
178
+ * keywordColor: '\x1b[34m', // Blue
179
+ * stringColor: '\x1b[32m', // Green
180
+ * numberColor: '\x1b[31m', // Red
181
+ * reset: '\x1b[0m' // Reset
182
+ * };
183
+ * const highlightedCode = highlightCode(code, schema);
184
+ * console.log(highlightedCode);
185
+ */
186
+ export declare function highlightCode(code: string, schema?: Partial<HighlightSchemeInterface>): string;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A callback function type used 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 The formatted line string.
8
+ */
9
+ export type FormatCodeCallbackType = (lineString: string, padding: number, line: number) => string;
10
+ /**
11
+ * Configuration options for formatting code.
12
+ */
13
+ export interface FormatCodeInterface {
14
+ /**
15
+ * The amount of padding to be applied to each line. If not specified, defaults to 0.
16
+ */
17
+ padding?: number;
18
+ /**
19
+ * The starting line number for formatting. If not specified, defaults to 1.
20
+ */
21
+ startLine?: number;
22
+ /**
23
+ * An optional action object specifying a line where a callback function should be triggered.
24
+ */
25
+ action?: {
26
+ /**
27
+ * The line number at which the callback function should be triggered.
28
+ */
29
+ triggerLine: number;
30
+ /**
31
+ * The callback function to be executed when the trigger line is encountered.
32
+ */
33
+ callback: FormatCodeCallbackType;
34
+ };
35
+ }
36
+ /**
37
+ * Set color to an error pointer
38
+ */
39
+ export interface AnsiOptionInterface {
40
+ color: string;
41
+ reset: string;
42
+ }
@@ -0,0 +1,48 @@
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
+ }
@@ -0,0 +1,31 @@
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
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Import will remove at compile time
3
+ */
4
+ import type { StackEntryInterface } from './interfaces/parse.interface';
5
+ /**
6
+ * Parses an error stack trace and returns an object with a message and an array of stack entries.
7
+ *
8
+ * @param stackString - The error stack trace.
9
+ * @returns The parsed stack trace object.
10
+ */
11
+ export declare function parseErrorStack(stackString: string): Array<StackEntryInterface>;
@@ -0,0 +1,9 @@
1
+ export type * from './components/interfaces/parse.interface';
2
+ export type * from './components/interfaces/formatter.interface';
3
+ export type * from './components/interfaces/highlighter.interface';
4
+ export type * from './services/interfaces/source.interface';
5
+ export * from './components/parser.component';
6
+ export * from './components/base64.component';
7
+ export * from './components/formatter.component';
8
+ export * from './components/highlighter.component';
9
+ export * from './services/source.service';
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ function w(l){let e=l.split(`
2
+ `).slice(1),n=/^\s*at\s+(.*?)\s+\((.*?):(\d+):(\d+)\)$|^\s*at\s+(.*?):(\d+):(\d+)$/,t=/eval\s+at\s+([^\s(]+).+\((.+):(\d+):(\d+)\),\s(.+)/,r=[];return e.forEach(s=>{let i=s.match(n);if(!i)return;let a=i.slice(1);i[2]||(a=i.slice(4));let[c,m,g,p]=a,h=parseInt(g,10),d=parseInt(p,10);if(s.includes("eval")){let S=m.match(t)?.slice(1);if(S){let[v,L,N,E,K]=S;r.push({at:c,file:K,line:h,column:d,executor:{at:v,file:L,line:parseInt(N,10),column:parseInt(E,10)}});return}}r.push({at:c||"<anonymous>",file:m,line:h,column:d,executor:null})}),r}var x={},y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");y.forEach((l,e)=>{x[l]=e});function A(l){let e=l<0,n="",t=e?(-l<<1)+1:l<<1;do{let r=t&31;t>>>=5,n+=y[r|(t>0?32:0)]}while(t>0);return n}function I(l){return l.map(A).join("")}function C(l){let e=[],n=0,t=0;for(let r=0;r<l.length;r++){let s=x[l[r]];if(s===void 0)throw new Error(`Invalid Base64 character: ${l[r]}`);let i=s&32;if(t+=(s&31)<<n,i)n+=5;else{let a=(t&1)===1,c=t>>1;e.push(a?-c:c),t=n=0}}return e}function M(l,e={}){let n=l.split(`
3
+ `),t=e.padding??10,r=e.startLine??0;return n.map((s,i)=>{let a=i+r+1,m=`${`${a} | `.padStart(t)}${s}`;return e.action&&a===e.action.triggerLine?e.action.callback(m,t,a):m}).join(`
4
+ `)}function $(l,e){let{code:n,line:t,column:r,startLine:s}=l;if(t<s||r<1)throw new Error("Invalid line or column number.");return M(n,{startLine:s,action:{triggerLine:t,callback:(i,a,c)=>{let m="^",g=a-1,p=">";e&&(m=`${e.color}${m}${e.reset}`,g+=e.color.length+e.reset.length,p=`${e.color}>${e.reset}`);let h=" | ".padStart(a)+" ".repeat(r-1)+`${m}`;return i=`${p} ${c} |`.padStart(g)+i.split("|")[1],i+`
5
+ ${h}`}}})}import*as o from"typescript";import{SyntaxKind as u}from"typescript";var O=(d=>(d.reset="\x1B[0m",d.gray="\x1B[38;5;243m",d.darkGray="\x1B[38;5;238m",d.lightCoral="\x1B[38;5;203m",d.lightOrange="\x1B[38;5;215m",d.oliveGreen="\x1B[38;5;149m",d.burntOrange="\x1B[38;5;208m",d.lightGoldenrodYellow="\x1B[38;5;221m",d.lightYellow="\x1B[38;5;230m",d.canaryYellow="\x1B[38;5;227m",d.deepOrange="\x1B[38;5;166m",d.lightGray="\x1B[38;5;252m",d.brightPink="\x1B[38;5;197m",d))(O||{}),T={enumColor:"\x1B[38;5;208m",typeColor:"\x1B[38;5;221m",classColor:"\x1B[38;5;215m",stringColor:"\x1B[38;5;149m",keywordColor:"\x1B[38;5;203m",commentColor:"\x1B[38;5;238m",functionColor:"\x1B[38;5;215m",variableColor:"\x1B[38;5;208m",interfaceColor:"\x1B[38;5;221m",parameterColor:"\x1B[38;5;166m",getAccessorColor:"\x1B[38;5;230m",numericLiteralColor:"\x1B[38;5;252m",methodSignatureColor:"\x1B[38;5;208m",regularExpressionColor:"\x1B[38;5;149m",propertyAssignmentColor:"\x1B[38;5;227m",propertyAccessExpressionColor:"\x1B[38;5;230m",expressionWithTypeArgumentsColor:"\x1B[38;5;215m"},f=class{constructor(e,n,t){this.sourceFile=e;this.code=n;this.schema=t}segments=new Map;parseNode(e){this.processComments(e),this.processKeywords(e),this.processNode(e)}highlight(){let e=0,n,t=[];return Array.from(this.segments.values()).sort((s,i)=>s.start-i.start||s.end-i.end).forEach(s=>{if(n&&s.start<n.end){let i=t.pop();if(!i)return;let a=this.getSegmentSource(s.start,s.end),c=`${s.color}${a}${n.color}`;t.push(i.replace(a,c));return}t.push(this.getSegmentSource(e,s.start)),t.push(`${s.color}${this.getSegmentSource(s.start,s.end)}${s.reset}`),e=s.end,n=s}),t.join("")+this.getSegmentSource(e)}getSegmentSource(e,n){return this.code.slice(e,n)}addSegment(e,n,t,r="\x1B[0m"){let s=`${e}-${n}`;this.segments.set(s,{start:e,end:n,color:t,reset:r})}processComments(e){[...o.getTrailingCommentRanges(this.sourceFile.getFullText(),e.getFullStart())||[],...o.getLeadingCommentRanges(this.sourceFile.getFullText(),e.getFullStart())||[]].forEach(t=>this.addSegment(t.pos,t.end,this.schema.commentColor))}processKeywords(e){if([u.NullKeyword,u.VoidKeyword,u.StringKeyword,u.NumberKeyword,u.BooleanKeyword,u.UndefinedKeyword].includes(e.kind))return this.addSegment(e.getStart(),e.getEnd(),this.schema.typeColor);e&&e.kind>=o.SyntaxKind.FirstKeyword&&e.kind<=o.SyntaxKind.LastKeyword&&this.addSegment(e.getStart(),e.getEnd(),this.schema.keywordColor)}processIdentifier(e){let n=e.getEnd(),t=e.getStart();switch(e.parent.kind){case o.SyntaxKind.EnumMember:return this.addSegment(t,n,this.schema.enumColor);case o.SyntaxKind.CallExpression:case o.SyntaxKind.EnumDeclaration:case o.SyntaxKind.PropertySignature:case o.SyntaxKind.ModuleDeclaration:return this.addSegment(t,n,this.schema.variableColor);case o.SyntaxKind.InterfaceDeclaration:return this.addSegment(t,n,this.schema.interfaceColor);case o.SyntaxKind.GetAccessor:return this.addSegment(t,n,this.schema.getAccessorColor);case o.SyntaxKind.PropertyAssignment:return this.addSegment(t,n,this.schema.propertyAssignmentColor);case o.SyntaxKind.MethodSignature:return this.addSegment(t,n,this.schema.methodSignatureColor);case o.SyntaxKind.MethodDeclaration:case o.SyntaxKind.FunctionDeclaration:return this.addSegment(t,n,this.schema.functionColor);case o.SyntaxKind.ClassDeclaration:return this.addSegment(t,n,this.schema.classColor);case o.SyntaxKind.Parameter:return this.addSegment(t,n,this.schema.parameterColor);case o.SyntaxKind.VariableDeclaration:return this.addSegment(t,n,this.schema.variableColor);case o.SyntaxKind.PropertyDeclaration:return this.addSegment(t,n,this.schema.variableColor);case o.SyntaxKind.PropertyAccessExpression:return e.parent.getChildAt(0).getText()===e.getText()?this.addSegment(t,n,this.schema.variableColor):this.addSegment(t,n,this.schema.propertyAccessExpressionColor);case o.SyntaxKind.ExpressionWithTypeArguments:return this.addSegment(t,n,this.schema.expressionWithTypeArgumentsColor);case o.SyntaxKind.BreakStatement:case o.SyntaxKind.ShorthandPropertyAssignment:case o.SyntaxKind.BindingElement:return this.addSegment(t,n,this.schema.variableColor);case o.SyntaxKind.BinaryExpression:case o.SyntaxKind.SwitchStatement:case o.SyntaxKind.TemplateSpan:return this.addSegment(t,n,this.schema.variableColor);case o.SyntaxKind.TypeReference:case o.SyntaxKind.TypeAliasDeclaration:return this.addSegment(t,n,this.schema.typeColor);case o.SyntaxKind.NewExpression:return this.addSegment(t,n,this.schema.variableColor)}}processTemplateExpression(e){let n=e.head.getStart(),t=e.head.getEnd();this.addSegment(n,t,this.schema.stringColor),e.templateSpans.forEach(r=>{let s=r.literal.getStart(),i=r.literal.getEnd();this.addSegment(s,i,this.schema.stringColor)})}processNode(e){let n=e.getStart(),t=e.getEnd();switch(e.kind){case o.SyntaxKind.TypeParameter:return this.addSegment(n,n+e.name.text.length,this.schema.typeColor);case o.SyntaxKind.TypeReference:return this.addSegment(n,t,this.schema.typeColor);case o.SyntaxKind.StringLiteral:case o.SyntaxKind.NoSubstitutionTemplateLiteral:return this.addSegment(n,t,this.schema.stringColor);case o.SyntaxKind.RegularExpressionLiteral:return this.addSegment(n,t,this.schema.regularExpressionColor);case o.SyntaxKind.TemplateExpression:return this.processTemplateExpression(e);case o.SyntaxKind.Identifier:return this.processIdentifier(e);case o.SyntaxKind.BigIntLiteral:case o.SyntaxKind.NumericLiteral:return this.addSegment(n,t,this.schema.numericLiteralColor)}}};function U(l,e={}){let n=o.createSourceFile("temp.ts",l,o.ScriptTarget.Latest,!0,o.ScriptKind.TS),t=new f(n,l,Object.assign(T,e));function r(s){t.parseNode(s);for(let i=0;i<s.getChildCount();i++)r(s.getChildAt(i))}return o.forEachChild(n,r),t.highlight()}var b=class{names;sources;mappings;sourcesContent;constructor(e){this.validateSourceMap(e),this.names=e.names??[],this.sources=e.sources??[],this.mappings=[],this.sourcesContent=e.sourcesContent??[],this.decodeMappings(e)}getMapObject(){return{version:3,names:this.names,sources:this.sources,mappings:this.encodeMappings(this.mappings),sourcesContent:this.sourcesContent}}getSourcePosition(e,n,t){let r=Object.assign({bias:1,linesAfter:4,linesBefore:3},t),s=this.findMapping(e,n,r.bias);if(!s||isNaN(s.fileIndex))return null;let i=this.sourcesContent[s.fileIndex].split(`
6
+ `),a=(s.sourceLine??1)+r.linesAfter,c=Math.max((s.sourceLine??1)-r.linesBefore,0);return{code:i.slice(c,Math.min(a+1,i.length)).join(`
7
+ `),line:s.sourceLine,column:s.sourceColumn,endLine:a,startLine:c,name:this.names[s.nameIndex??-1]??null,source:this.sources[s.fileIndex]}}getPosition(e,n,t=1){let r=this.findMapping(e,n,t);return r&&{line:r.sourceLine,column:r.sourceColumn,name:this.names[r.nameIndex??-1]??null,source:this.sources[r.fileIndex]}}concat(...e){if(e.length<1)throw new Error("At least one map must be provided for concatenation.");for(let n of e){this.names.push(...n.names),this.sources.push(...n.sources),this.sourcesContent.push(...n.sourcesContent);let t=this.mappings[this.mappings.length-1],r=this.sourcesContent[t.fileIndex].split(`
8
+ `).length;this.decodeMappings(e[0],{nameIndex:this.names.length-1,fileIndex:this.sources.length-1,generatedLine:r<2?2:r})}}toString(){return JSON.stringify(this.getMapObject())}validateSourceMap(e){if(!["version","sources","sourcesContent","mappings","names"].every(t=>t in e))throw new Error("Missing required keys in SourceMap.")}decodeMappings(e,n){let t=Object.assign({fileIndex:0,nameIndex:0,sourceLine:1,sourceColumn:1,generatedLine:1,generatedColumn:1},n);try{for(let[r,s]of e.mappings.split(";").entries()){if(!s)continue;t.generatedColumn=1;let i=s.split(",");for(let a of i){if(a.length<4)continue;let c=C(a);this.decodedSegment(t,c,r+t.generatedLine)}}}catch(r){throw new Error(`Error decoding mappings: ${r.message}`)}}decodedSegment(e,n,t){let[r,s,i,a,c]=n;e.fileIndex+=s,e.nameIndex+=c??0,e.sourceLine+=i,e.sourceColumn+=a,e.generatedColumn+=r,this.mappings.push({nameIndex:c!==void 0?e.nameIndex:null,fileIndex:e.fileIndex,sourceLine:e.sourceLine,sourceColumn:e.sourceColumn,generatedLine:t,generatedColumn:e.generatedColumn})}encodeMappings(e){let n="",t=[],r={fileIndex:0,nameIndex:0,sourceLine:1,sourceColumn:1,generatedLine:1,generatedColumn:1};r.generatedLine=e[0].generatedLine,n+=";".repeat(r.generatedLine-1);for(let s of e)s.generatedLine!==r.generatedLine&&(n+=t.join(","),n+=";".repeat(Math.max(1,s.generatedLine-r.generatedLine)),t=[],r.generatedLine=s.generatedLine,r.generatedColumn=1),this.encodeSegment(s,t,r);return n+t.join(",")+";"}encodeSegment(e,n,t){let r=[],s=e.fileIndex;if(r[1]=0,r[2]=e.sourceLine-t.sourceLine,r[3]=e.sourceColumn-t.sourceColumn,r[0]=e.generatedColumn-t.generatedColumn,s!==t.fileIndex&&(r[1]=s-t.fileIndex,t.fileIndex=s),e.nameIndex){let i=e.nameIndex;r[4]=i-t.nameIndex,t.nameIndex=i}t.sourceLine=e.sourceLine,t.sourceColumn=e.sourceColumn,t.generatedColumn=e.generatedColumn,n.push(I(r))}findMapping(e,n,t=0){let r=0,s=this.mappings.length-1,i=null;for(;r<=s;){let a=Math.floor((r+s)/2),c=this.mappings[a];if(c.generatedLine<e)r=a+1;else if(c.generatedLine>e)s=a-1;else if(c.generatedColumn<n)r=a+1,t===1&&(i=c);else if(c.generatedColumn>n)s=a-1,t===2&&(i=c);else return c}return i&&i.generatedLine===e?i:null}};export{f as CodeHighlighter,O as Colors,b as SourceService,C as decodeVLQ,I as encodeArrayVLQ,A as encodeVLQ,M as formatCode,$ as formatErrorCode,U as highlightCode,w as parseErrorStack};
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/components/parser.component.ts", "../src/components/base64.component.ts", "../src/components/formatter.component.ts", "../src/components/highlighter.component.ts", "../src/services/source.service.ts"],
4
+ "sourcesContent": ["/**\n * Import will remove at compile time\n */\n\nimport type { StackEntryInterface } from '@components/interfaces/parse.interface';\n\n/**\n * Parses an error stack trace and returns an object with a message and an array of stack entries.\n *\n * @param stackString - The error stack trace.\n * @returns The parsed stack trace object.\n */\n\nexport function parseErrorStack(stackString: string): Array<StackEntryInterface> {\n const lines = stackString.split('\\n').slice(1);\n const regex = /^\\s*at\\s+(.*?)\\s+\\((.*?):(\\d+):(\\d+)\\)$|^\\s*at\\s+(.*?):(\\d+):(\\d+)$/;\n const evalRegex = /eval\\s+at\\s+([^\\s(]+).+\\((.+):(\\d+):(\\d+)\\),\\s(.+)/;\n const stack: Array<StackEntryInterface> = [];\n\n lines.forEach((line) => {\n const match = line.match(regex);\n if (!match) return;\n\n let args: Array<string> = match.slice(1);\n if(!match[2]) {\n args = match.slice(4);\n }\n\n const [ at, file, lineNum, colNum ] = args;\n const lineNumber = parseInt(lineNum, 10);\n const columnNumber = parseInt(colNum, 10);\n\n if (line.includes('eval')) {\n const evalMatch = file.match(evalRegex)?.slice(1);\n if (evalMatch) {\n const [ evalAt, evalFile, evalLineNum, evalColNum, evalAnonFile ] = evalMatch;\n stack.push({\n at,\n file: evalAnonFile,\n line: lineNumber,\n column: columnNumber,\n executor: {\n at: evalAt,\n file: evalFile,\n line: parseInt(evalLineNum, 10),\n column: parseInt(evalColNum, 10)\n }\n });\n\n return;\n }\n }\n\n stack.push({\n at: at || '<anonymous>',\n file,\n line: lineNumber,\n column: columnNumber,\n executor: null\n });\n });\n\n return stack;\n}\n", "// Bitmask to extract the lower 5 bits (continuation bit removed) - 0b11111\nconst CONTINUATION_BIT_REMOVE = 0x1F;\n\n// Bitmask to set the continuation bit - 0b100000\nconst CONTINUATION_BIT_POSITION = 0x20;\n\n// Mapping of Base64 characters to their indices\nconst base64Map: { [key: string]: number } = {};\n\n// Array of Base64 characters\nconst base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n// Populate the base64Map with characters and their corresponding indices\nbase64Chars.forEach((char, index) => {\n base64Map[char] = index;\n});\n\n/**\n * Encodes a given number using Variable-Length Quantity (VLQ) encoding.\n * Negative numbers are encoded by converting to a non-negative representation.\n * The continuation bit is used to indicate if more bytes follow.\n *\n * @param value - The number to be encoded.\n * @returns The VLQ encoded string.\n */\n\nexport function encodeVLQ(value: number): string {\n const isNegative = value < 0;\n\n /**\n * Bit Structure Representation:\n *\n * +--------------------------+\n * | C | Value | Sign |\n * +---+---+---+---+---+------+\n * | 1 | 1 | 0 | 0 | 1 | 0 |\n * +---+---+---+---+---+------+\n */\n\n let encoded = '';\n let vlq = isNegative ? ((-value) << 1) + 1 : (value << 1); // Shift left by 1 bit to encode the sign bit\n\n do {\n const digit = vlq & CONTINUATION_BIT_REMOVE; // Extract lower 5 bits\n vlq >>>= 5; // Right shift by 5 bits to process next chunk\n encoded += base64Chars[digit | (vlq > 0 ? CONTINUATION_BIT_POSITION : 0)]; // Combine digit and continuation bit\n } while (vlq > 0);\n\n return encoded;\n}\n\n/**\n * Encodes an array of numbers using VLQ encoding.\n * Each number in the array is individually encoded and the results are concatenated.\n *\n * @param values - The array of numbers to be encoded.\n * @returns The concatenated VLQ encoded string.\n */\n\nexport function encodeArrayVLQ(values: number[]): string {\n return values.map(encodeVLQ).join('');\n}\n\n/**\n * Decodes a VLQ encoded string back into an array of numbers.\n * Each character is decoded using the Base64 map and continuation bits are processed.\n *\n * @param data - The VLQ encoded string.\n * @returns The array of decoded numbers.\n * @throws Error If the string contains invalid Base64 characters.\n */\n\nexport function decodeVLQ(data: string): number[] {\n const result = [];\n let shift = 0;\n let value = 0;\n\n for (let i = 0; i < data.length; i++) {\n const digit = base64Map[data[i]];\n if (digit === undefined) {\n throw new Error(`Invalid Base64 character: ${data[i]}`);\n }\n\n const continuation = digit & CONTINUATION_BIT_POSITION; // Check if continuation bit is set\n value += (digit & CONTINUATION_BIT_REMOVE) << shift; // Add lower 5 bits to value\n if (continuation) {\n shift += 5; // Shift left by 5 for next chunk\n } else {\n const isNegative = (value & 1) === 1; // Check if the number is negative\n const shifted = value >> 1; // Remove the sign bit\n\n result.push(isNegative ? -shifted : shifted); // Convert back to signed integer\n value = shift = 0; // Reset for next number\n }\n }\n\n return result;\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { PositionSourceInterface } from '@services/interfaces/source.interface';\nimport type { AnsiOptionInterface, FormatCodeInterface } from '@components/interfaces/formatter.interface';\n\n/**\n * Formats a code snippet with optional line padding and custom actions.\n *\n * This function takes a code string and an options object to format the code snippet.\n * It applies padding to line numbers and can trigger custom actions for specific lines.\n *\n * @param code - The source code | stack to be formatted.\n * @param options - Configuration options for formatting the code.\n * - `padding` (number, optional): Number of characters for line number padding. Defaults to 10.\n * - `startLine` (number, optional): The starting line number for formatting. Defaults to 1.\n * - `action` (object, optional): Custom actions to apply to specific lines.\n * - `triggerLine` (number): The line number where the action should be triggered.\n * - `callback` (function): A callback function to format the line string when `triggerLine` is matched.\n * The callback receives the formatted line string, the padding value, and the current line number as arguments.\n *\n * @returns A formatted string of the code snippet with applied padding and custom actions.\n *\n * @example\n * ```typescript\n * const formattedCode = formatCode(code, {\n * padding: 8,\n * startLine: 5,\n * action: {\n * triggerLine: 7,\n * callback: (lineString, padding, lineNumber) => {\n * return `Custom formatting for line ${lineNumber}: ${lineString}`;\n * }\n * }\n * });\n * console.log(formattedCode);\n * ```\n */\n\nexport function formatCode(code: string, options: FormatCodeInterface = {}): string {\n const lines = code.split('\\n');\n const padding = options.padding ?? 10;\n const startLine = options.startLine ?? 0;\n\n return lines.map((lineContent, index) => {\n const currentLineNumber = index + startLine + 1;\n const prefix = `${ currentLineNumber} | `;\n const string = `${ prefix.padStart(padding) }${ lineContent }`;\n\n if (options.action && currentLineNumber === options.action.triggerLine) {\n return options.action.callback(string, padding, currentLineNumber);\n }\n\n return string;\n }).join('\\n');\n}\n\n/**\n * Formats a code snippet around an error location with special highlighting.\n *\n * This function takes a `sourcePosition` object containing information about the source code\n * and error location, then uses `formatCode` to format and highlight the relevant code snippet.\n *\n * @param sourcePosition - An object containing information about the source code and error location.\n * - `code` (string): The entire source code content.\n * - `line` (number): The line number where the error occurred (1-based indexing).\n * - `column` (number): The column number within the line where the error occurred (1-based indexing).\n * - `startLine` (number, optional): The starting line number of the code snippet (defaults to 1).\n * @param ansiOption - Optional configuration for ANSI color codes.\n * - `color` (string): The ANSI escape sequence to colorize the error marker and prefix (e.g., `'\\x1b[38;5;160m'`).\n * - `reset` (string): The ANSI escape sequence to reset the color (e.g., `'\\x1b[0m'`).\n *\n * @throws Error - If the provided `sourcePosition` object has invalid line or column numbers,\n * or if the error line is outside the boundaries of the provided code content.\n *\n * @returns A formatted string representing the relevant code snippet around the error location,\n * including special highlighting for the error line and column.\n *\n * @example\n * ```typescript\n * const formattedErrorCode = formatErrorCode(sourcePosition);\n * console.log(formattedErrorCode);\n * ```\n */\n\nexport function formatErrorCode(sourcePosition: PositionSourceInterface, ansiOption?: AnsiOptionInterface): string {\n const { code, line: errorLine, column: errorColumn, startLine } = sourcePosition;\n\n // Validate line and column numbers\n if (errorLine < startLine || errorColumn < 1) {\n throw new Error('Invalid line or column number.');\n }\n\n return formatCode(code, {\n startLine,\n action: {\n triggerLine: errorLine,\n callback: (lineString, padding, line) => {\n let pointer = '^';\n let ansiPadding = padding - 1; // 1 size of the char we added\n let prefixPointer = '>';\n\n if (ansiOption) {\n pointer = `${ ansiOption.color }${ pointer }${ ansiOption.reset }`;\n ansiPadding += (ansiOption.color.length + ansiOption.reset.length);\n prefixPointer = `${ ansiOption.color }>${ ansiOption.reset }`;\n }\n\n const errorMarker = ' | '.padStart(padding) + ' '.repeat(errorColumn - 1) + `${ pointer }`;\n lineString = `${ prefixPointer } ${ line } |`.padStart(ansiPadding) + lineString.split('|')[1];\n\n return lineString + `\\n${ errorMarker }`;\n }\n }\n });\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type { HighlightSchemeInterface, HighlightNodeSegmentInterface } from '@components/interfaces/highlighter.interface';\n\n/**\n * Imports\n */\n\nimport * as ts from 'typescript';\nimport { SyntaxKind } from 'typescript';\n\n/**\n * An enum containing ANSI escape sequences for various colors.\n *\n * This enum is primarily intended for terminal output and won't work directly in JavaScript for web development.\n * It defines color codes for various colors and a reset code to return to\n * the default text color.\n *\n * @example\n * ```typescript\n * console.log(`${Colors.red}This the text will be red in the terminal.${Colors.reset}`);\n * ```\n *\n * This functionality is limited to terminal environments.\n * Consider alternative methods\n * for color highlighting in web development contexts, such as CSS classes.\n */\n\nexport const enum Colors {\n reset = '\\x1b[0m',\n gray = '\\x1b[38;5;243m',\n darkGray = '\\x1b[38;5;238m',\n lightCoral = '\\x1b[38;5;203m',\n lightOrange = '\\x1b[38;5;215m',\n oliveGreen = '\\x1b[38;5;149m',\n burntOrange = '\\x1b[38;5;208m',\n lightGoldenrodYellow = '\\x1b[38;5;221m',\n lightYellow = '\\x1b[38;5;230m',\n canaryYellow = '\\x1b[38;5;227m',\n deepOrange = '\\x1b[38;5;166m',\n lightGray = '\\x1b[38;5;252m',\n brightPink = '\\x1b[38;5;197m'\n}\n\n/**\n * Default color scheme for semantic highlighting.\n * This scheme uses red color for all code elements.\n *\n * @example\n * const scheme = defaultScheme;\n * console.log(scheme.typeColor); // Outputs: the red color code\n */\n\n\nconst defaultScheme: HighlightSchemeInterface = {\n enumColor: Colors.burntOrange,\n typeColor: Colors.lightGoldenrodYellow,\n classColor: Colors.lightOrange,\n stringColor: Colors.oliveGreen,\n keywordColor: Colors.lightCoral,\n commentColor: Colors.darkGray,\n functionColor: Colors.lightOrange,\n variableColor: Colors.burntOrange,\n interfaceColor: Colors.lightGoldenrodYellow,\n parameterColor: Colors.deepOrange,\n getAccessorColor: Colors.lightYellow,\n numericLiteralColor: Colors.lightGray,\n methodSignatureColor: Colors.burntOrange,\n regularExpressionColor: Colors.oliveGreen,\n propertyAssignmentColor: Colors.canaryYellow,\n propertyAccessExpressionColor: Colors.lightYellow,\n expressionWithTypeArgumentsColor: Colors.lightOrange\n};\n\n/**\n * Class responsible for applying semantic highlighting to a source code string based on a given color scheme.\n *\n * @class\n *\n * @param sourceFile - The TypeScript AST node representing the source file.\n * @param code - The source code string to be highlighted.\n * @param schema - The color scheme used for highlighting different elements in the code.\n *\n * const highlighter = new CodeHighlighter(sourceFile, code, schema);\n */\n\nexport class CodeHighlighter {\n\n /**\n * A Map of segments where the key is a combination of start and end positions,\n * and the value is an object containing the color and reset code.\n * This structure ensures unique segments and allows for fast lookups and updates.\n *\n * @example\n * this.segments = new Map([\n * ['0-10', { start: 1, end: 11, color: '\\x1b[31m', reset: '\\x1b[0m' }],\n * ['11-20', { start: 12, end: 20, color: '\\x1b[32m', reset: '\\x1b[0m' }]\n * ]);\n */\n\n private segments: Map<string, HighlightNodeSegmentInterface> = new Map();\n\n /**\n * Creates an instance of the CodeHighlighter class.\n *\n * @param sourceFile - The TypeScript AST node representing the source file.\n * @param code - The source code string to be highlighted.\n * @param schema - The color scheme used for highlighting different elements in the code.\n */\n\n constructor(private sourceFile: ts.Node, private code: string, private schema: HighlightSchemeInterface) {\n }\n\n /**\n * Parses a TypeScript AST node and processes its comments to identify segments that need highlighting.\n *\n * @param node - The TypeScript AST node to be parsed.\n */\n\n parseNode(node: ts.Node): void {\n this.processComments(node);\n this.processKeywords(node);\n this.processNode(node);\n }\n\n /**\n * Generates a string with highlighted code segments based on the provided color scheme.\n *\n * This method processes the stored segments, applies the appropriate colors to each segment,\n * and returns the resulting highlighted code as a single string.\n *\n * @returns The highlighted code as a string, with ANSI color codes applied to the segments.\n */\n\n highlight(): string {\n let previousSegmentEnd = 0;\n let parent: HighlightNodeSegmentInterface | undefined;\n\n const result: Array<string> = [];\n const segments = Array.from(\n this.segments.values()\n ).sort((a, b) => a.start - b.start || a.end - b.end);\n\n segments.forEach((segment) => {\n if (parent && segment.start < parent.end) {\n const lastSegment = result.pop();\n if (!lastSegment) return;\n\n const source = this.getSegmentSource(segment.start, segment.end);\n const combinedSource = `${ segment.color }${ source }${ parent.color }`;\n result.push(lastSegment.replace(source, combinedSource));\n\n return;\n }\n\n result.push(this.getSegmentSource(previousSegmentEnd, segment.start));\n result.push(`${ segment.color }${ this.getSegmentSource(segment.start, segment.end) }${ segment.reset }`);\n previousSegmentEnd = segment.end;\n parent = segment;\n });\n\n return result.join('') + this.getSegmentSource(previousSegmentEnd);\n }\n\n /**\n * Extracts a substring from the code based on the specified start and end positions.\n *\n * This method is used to retrieve the source code segment that corresponds to the\n * given start and end positions. It is primarily used for highlighting specific\n * segments of the code.\n *\n * @param start - The starting index of the segment to be extracted.\n * @param end - The ending index of the segment to be extracted.\n * @returns The extracted substring from the code.\n */\n\n private getSegmentSource(start: number, end?: number): string {\n return this.code.slice(start, end);\n }\n\n /**\n * Adds a new segment to the list of segments to be highlighted.\n * The segment is defined by its start and end positions, the color to apply, and an optional reset code.\n *\n * @param start - The starting index of the segment in the code string.\n * @param end - The ending index of the segment in the code string.\n * @param color - The color code to apply to the segment.\n * @param reset - The color reset code to apply after the segment, Defaults to the reset code defined in `Colors.reset`.\n */\n\n private addSegment(start: number, end: number, color: string, reset: string = Colors.reset) {\n const key = `${ start }-${ end }`;\n this.segments.set(key, { start, end, color, reset });\n }\n\n /**\n * Processes comments within a TypeScript AST node and adds segments for highlighting.\n * Extracts trailing and leading comments from the node and adds them as segments using the color defined in `this.colorSchema.comments`.\n *\n * @param node - The TypeScript AST node whose comments are to be processed.\n */\n\n private processComments(node: ts.Node): void {\n const comments = [\n ...ts.getTrailingCommentRanges(this.sourceFile.getFullText(), node.getFullStart()) || [],\n ...ts.getLeadingCommentRanges(this.sourceFile.getFullText(), node.getFullStart()) || []\n ];\n\n comments.forEach(comment => this.addSegment(comment.pos, comment.end, this.schema.commentColor));\n }\n\n /**\n * Processes the keywords within a TypeScript AST node and adds them as segments for highlighting.\n *\n * This method identifies potential keyword tokens within the provided node and adds them to the\n * list of segments with the color defined in `this.schema.keywordColor`.\n * The method considers the current node, its first token, and its last token to determine if they should be highlighted\n * as keywords.\n *\n * The method checks if the node's kind falls within the range of keyword kinds defined by TypeScript.\n * If the node or any of its tokens are identified as keywords, a segment is added to `this.segments`\n * with the start and end positions of the node and the specified color for keywords.\n *\n * @param node - The TypeScript AST node to be processed for keywords.\n */\n\n private processKeywords(node: ts.Node): void {\n if ([\n SyntaxKind.NullKeyword,\n SyntaxKind.VoidKeyword,\n SyntaxKind.StringKeyword,\n SyntaxKind.NumberKeyword,\n SyntaxKind.BooleanKeyword,\n SyntaxKind.UndefinedKeyword\n ].includes(node.kind)) {\n return this.addSegment(node.getStart(), node.getEnd(), this.schema.typeColor);\n }\n\n if (node && node.kind >= ts.SyntaxKind.FirstKeyword && node.kind <= ts.SyntaxKind.LastKeyword) {\n this.addSegment(node.getStart(), node.getEnd(), this.schema.keywordColor);\n }\n }\n\n /**\n * Processes identifiers within a TypeScript AST node and adds them as segments for highlighting\n * based on the node's parent type.\n *\n * This method determines the appropriate color for an identifier based on its parent node's kind.\n * If the parent node matches one of the specified kinds, the identifier is highlighted with a cyan color.\n * Supported parent kinds include various declarations, expressions, and signatures.\n *\n * @param node - The TypeScript AST node representing the identifier to be processed.\n */\n\n private processIdentifier(node: ts.Node): void {\n const end = node.getEnd();\n const start = node.getStart();\n\n switch (node.parent.kind) {\n case ts.SyntaxKind.EnumMember:\n return this.addSegment(start, end, this.schema.enumColor);\n case ts.SyntaxKind.CallExpression:\n case ts.SyntaxKind.EnumDeclaration:\n case ts.SyntaxKind.PropertySignature:\n case ts.SyntaxKind.ModuleDeclaration:\n return this.addSegment(start, end, this.schema.variableColor);\n case ts.SyntaxKind.InterfaceDeclaration:\n return this.addSegment(start, end, this.schema.interfaceColor);\n case ts.SyntaxKind.GetAccessor:\n return this.addSegment(start, end, this.schema.getAccessorColor);\n case ts.SyntaxKind.PropertyAssignment:\n return this.addSegment(start, end, this.schema.propertyAssignmentColor);\n case ts.SyntaxKind.MethodSignature:\n return this.addSegment(start, end, this.schema.methodSignatureColor);\n case ts.SyntaxKind.MethodDeclaration:\n case ts.SyntaxKind.FunctionDeclaration:\n return this.addSegment(start, end, this.schema.functionColor);\n case ts.SyntaxKind.ClassDeclaration:\n return this.addSegment(start, end, this.schema.classColor);\n case ts.SyntaxKind.Parameter:\n return this.addSegment(start, end, this.schema.parameterColor);\n case ts.SyntaxKind.VariableDeclaration:\n return this.addSegment(start, end, this.schema.variableColor);\n case ts.SyntaxKind.PropertyDeclaration:\n return this.addSegment(start, end, this.schema.variableColor);\n case ts.SyntaxKind.PropertyAccessExpression: {\n if (node.parent.getChildAt(0).getText() === node.getText()) {\n return this.addSegment(start, end, this.schema.variableColor);\n }\n\n return this.addSegment(start, end, this.schema.propertyAccessExpressionColor);\n }\n case ts.SyntaxKind.ExpressionWithTypeArguments:\n return this.addSegment(start, end, this.schema.expressionWithTypeArgumentsColor);\n case ts.SyntaxKind.BreakStatement:\n case ts.SyntaxKind.ShorthandPropertyAssignment:\n case ts.SyntaxKind.BindingElement:\n return this.addSegment(start, end, this.schema.variableColor);\n case ts.SyntaxKind.BinaryExpression:\n case ts.SyntaxKind.SwitchStatement:\n case ts.SyntaxKind.TemplateSpan:\n return this.addSegment(start, end, this.schema.variableColor);\n case ts.SyntaxKind.TypeReference:\n case ts.SyntaxKind.TypeAliasDeclaration:\n return this.addSegment(start, end, this.schema.typeColor);\n case ts.SyntaxKind.NewExpression:\n return this.addSegment(start, end, this.schema.variableColor);\n }\n }\n\n /**\n * Processes a TypeScript template expression and adds segments for highlighting its literal parts.\n *\n * This method adds a segment for the head of the template expression with the color specified in `this.schema.stringColor`.\n * It also processes each template span within the expression, adding\n * segments for each span's literal part.\n *\n * @param templateExpression - The TypeScript template expression to be processed.\n */\n\n private processTemplateExpression(templateExpression: ts.TemplateExpression): void {\n const start = templateExpression.head.getStart();\n const end = templateExpression.head.getEnd();\n this.addSegment(start, end, this.schema.stringColor);\n\n templateExpression.templateSpans.forEach(span => {\n const spanStart = span.literal.getStart();\n const spanEnd = span.literal.getEnd();\n this.addSegment(spanStart, spanEnd, this.schema.stringColor);\n });\n }\n\n /**\n * Processes a TypeScript AST node and adds segments for highlighting based on the node's kind.\n *\n * This method identifies the kind of the node and determines the appropriate color for highlighting.\n * It handles various node kinds including string literals, regular expressions, template expressions, and identifiers.\n * Specific methods are invoked for more complex node kinds, such as template expressions and identifiers.\n *\n * @param node - The TypeScript AST node to be processed.\n */\n\n private processNode(node: ts.Node): void {\n const start = node.getStart();\n const end = node.getEnd();\n\n switch (node.kind) {\n case ts.SyntaxKind.TypeParameter:\n return this.addSegment(start, start + (node as ts.TypeParameterDeclaration).name.text.length, this.schema.typeColor);\n case ts.SyntaxKind.TypeReference:\n return this.addSegment(start, end, this.schema.typeColor);\n case ts.SyntaxKind.StringLiteral:\n case ts.SyntaxKind.NoSubstitutionTemplateLiteral:\n return this.addSegment(start, end, this.schema.stringColor);\n case ts.SyntaxKind.RegularExpressionLiteral:\n return this.addSegment(start, end, this.schema.regularExpressionColor);\n case ts.SyntaxKind.TemplateExpression:\n return this.processTemplateExpression(node as ts.TemplateExpression);\n case ts.SyntaxKind.Identifier:\n return this.processIdentifier(node);\n case ts.SyntaxKind.BigIntLiteral:\n case ts.SyntaxKind.NumericLiteral:\n return this.addSegment(start, end, this.schema.numericLiteralColor);\n }\n }\n}\n\n/**\n * Applies semantic highlighting to the provided code string using the specified color scheme.\n *\n * @param code - The source code to be highlighted.\n * @param schema - An optional partial schema defining the color styles for various code elements.\n * Defaults to an empty object, which means no specific highlighting will be applied.\n *\n * @returns A string with the code elements wrapped in the appropriate color styles as specified by the schema.\n *\n * @example\n * const code = 'const x: number = 42;';\n * const schema = {\n * keywordColor: '\\x1b[34m', // Blue\n * stringColor: '\\x1b[32m', // Green\n * numberColor: '\\x1b[31m', // Red\n * reset: '\\x1b[0m' // Reset\n * };\n * const highlightedCode = highlightCode(code, schema);\n * console.log(highlightedCode);\n */\n\nexport function highlightCode(code: string, schema: Partial<HighlightSchemeInterface> = {}) {\n const sourceFile = ts.createSourceFile('temp.ts', code, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);\n const codeHighlighter = new CodeHighlighter(sourceFile, code, Object.assign(defaultScheme, schema));\n\n function walk(node: ts.Node): void {\n codeHighlighter.parseNode(node);\n\n for (let i = 0; i < node.getChildCount(); i++) {\n walk(node.getChildAt(i));\n }\n } ts.forEachChild(sourceFile, walk);\n\n return codeHighlighter.highlight();\n}\n", "/**\n * Import will remove at compile time\n */\n\nimport type {\n MappingInterface,\n PositionInterface,\n SourceMapInterface,\n ShiftSegmentInterface,\n SourceOptionsInterface,\n PositionSourceInterface,\n ThresholdSegmentInterface\n} from '@services/interfaces/source.interface';\n\n/**\n * Imports\n */\n\nimport { Bias } from '@services/interfaces/source.interface';\nimport { decodeVLQ, encodeArrayVLQ } from '@components/base64.component';\n\n/**\n * A service for validating and processing source maps.\n */\n\nexport class SourceService {\n /**\n * A list of symbol names used by the \u201Cmappings\u201D entry.\n */\n\n private readonly names: Array<string>;\n\n /**\n * An array of source file paths.\n */\n\n private readonly sources: Array<string>;\n\n /**\n * A string of base64 VLQ-encoded mappings.\n */\n\n private readonly mappings: Array<MappingInterface>;\n\n /**\n * An array of source files contents.\n */\n\n private readonly sourcesContent: Array<string>;\n\n /**\n * Creates a new SourceService instance.\n *\n * @param source - The source map object to be validated.\n * @throws Error If any required key is missing from the source map.\n */\n\n constructor(source: SourceMapInterface) {\n this.validateSourceMap(source);\n\n this.names = source.names ?? [];\n this.sources = source.sources ?? [];\n this.mappings = [];\n this.sourcesContent = source.sourcesContent ?? [];\n this.decodeMappings(source);\n }\n\n /**\n * Returns a plain object representation of the source map data.\n *\n * This method creates a new object containing essential source map properties:\n * - `version`: The version of the source map (typically 3).\n * - `names`: An array of function or variable names from the original source code.\n * - `sources`: An array of source file names referenced in the mappings.\n * - `mappings`: A string representation of the encoded source map mappings. (Generated by `encodeMappings`)\n * - `sourcesContent`: An optional array containing the content of the source files. (May not be present in all source maps)\n *\n * @returns A plain object representing the source map data.\n */\n\n getMapObject(): SourceMapInterface {\n return {\n version: 3,\n names: this.names,\n sources: this.sources,\n mappings: this.encodeMappings(this.mappings),\n sourcesContent: this.sourcesContent\n };\n }\n\n /**\n * Retrieves source code information for a given line and column in the generated code.\n *\n * @param line - The line number in the generated code.\n * @param column - The column number in the generated code.\n * @param options - Optional configuration for retrieving source information.\n * linesBefore (default: 3) - Number of lines before the matching source line to include.\n * linesAfter (default: 4) - Number of lines after the matching source line to include.\n * includeSourceContent (default: false) - Flag to include the relevant source code snippet.\n * @returns An object containing source location information (line, column, name, source)\n * or including source code (code) if the includeSourceContent flag is set.\n * Returns null if no matching mapping is found.\n */\n\n getSourcePosition(line: number, column: number, options?: SourceOptionsInterface): PositionSourceInterface | null {\n const settings = Object.assign({\n bias: Bias.LOWER_BOUND,\n linesAfter: 4,\n linesBefore: 3\n }, options);\n\n const map = this.findMapping(line, column, settings.bias);\n if (!map || isNaN(map.fileIndex)) {\n return null;\n }\n\n const code = this.sourcesContent[map.fileIndex].split('\\n');\n const endLine = (map.sourceLine ?? 1) + settings.linesAfter;\n const startLine = Math.max((map.sourceLine ?? 1) - settings.linesBefore, 0);\n const relevantCode = code.slice(startLine, Math.min(endLine + 1, code.length)).join('\\n');\n\n return {\n code: relevantCode,\n line: map.sourceLine,\n column: map.sourceColumn,\n endLine: endLine,\n startLine: startLine,\n name:this.names[map.nameIndex ?? -1] ?? null,\n source: this.sources[map.fileIndex]\n };\n }\n\n /**\n * Retrieves the position information in the original source code for a given line and column in the generated code.\n *\n * @param line - The line number in the generated code.\n * @param column - The column number in the generated code.\n * @param bias - An optional bias value specifying how to handle cases where only the line number matches. Defaults to Bias.LOWER_BOUND.\n * Bias.LOWER_BOUND: If the line number matches but the column is less, return the closest mapping with a lower column.\n * Bias.UPPER_BOUND: If the line number matches but the column is greater, return the closest mapping with a higher column.\n * Bias.BOUND: If the line number matches and the column doesn't, return null (default behavior).\n * @returns A PositionInterface object representing the position in the original source code, or null if no matching position is found.\n */\n\n getPosition(line: number, column: number, bias: Bias = Bias.LOWER_BOUND): PositionInterface | null {\n const map = this.findMapping(line, column, bias);\n if (!map) {\n return map;\n }\n\n return {\n line: map.sourceLine,\n column: map.sourceColumn,\n name: this.names[map.nameIndex ?? -1] ?? null,\n source: this.sources[map.fileIndex]\n };\n }\n\n /**\n * Merges multiple source maps into this source map object.\n * The order of the provided source maps must match the order in which the corresponding source files were concatenated.\n *\n * @param maps - An array of `SourceService` instances representing the source maps to be merged.\n * @throws Error - If no source maps are provided for concatenation.\n */\n\n concat(...maps: Array<SourceMapInterface>): void {\n if (maps.length < 1) {\n throw new Error('At least one map must be provided for concatenation.');\n }\n\n for (const map of maps) {\n this.names.push(...map.names);\n this.sources.push(...map.sources);\n this.sourcesContent.push(...map.sourcesContent);\n\n const lastSegment = this.mappings[this.mappings.length - 1];\n const lines = this.sourcesContent[lastSegment.fileIndex].split('\\n').length;\n\n this.decodeMappings(maps[0], {\n nameIndex: this.names.length - 1,\n fileIndex: this.sources.length - 1,\n generatedLine: lines < 2 ? 2 : lines\n });\n }\n }\n\n /**\n * Converts the source map object to a base64 encoded string representation.\n *\n * This method performs the following steps:\n * 1. Creates a plain object representation of the source map using `getMapObject`.\n * 2. Convert the plain object to a JSON string using `JSON.stringify`.\n * 3. Encodes the JSON string using the `encode` function (assumed to be a base64 encoding function).\n *\n * @returns A string representing the source map.\n */\n\n toString(): string {\n return JSON.stringify(this.getMapObject());\n }\n\n /**\n * Validates the provided source map object.\n *\n * This private method throws an error if any of the required keys are missing from the source map.\n *\n * @private\n * @param input - The source map object to be validated.\n * @throws Error If any required key is missing from the source map.\n */\n\n private validateSourceMap(input: SourceMapInterface): void {\n const requiredKeys: (keyof SourceMapInterface)[] = [ 'version', 'sources', 'sourcesContent', 'mappings', 'names' ];\n if (!requiredKeys.every(key => key in input)) {\n throw new Error('Missing required keys in SourceMap.');\n }\n }\n\n /**\n * Decodes and processes the encoded mappings.\n *\n * @param encodedMappings - The source map object to be decoded.\n * @param thresholdSegment\n */\n\n private decodeMappings(encodedMappings: SourceMapInterface, thresholdSegment?: ThresholdSegmentInterface): void {\n // Note: Line and column numbers in source maps start at 1,\n // unlike arrays which start at 0. Therefore, the initial shift for lines is set to 1.\n const shift = Object.assign({\n fileIndex: 0,\n nameIndex: 0,\n sourceLine: 1,\n sourceColumn: 1,\n generatedLine: 1,\n generatedColumn: 1\n }, thresholdSegment);\n\n try {\n for (const [ generatedLine, stringSegments ] of encodedMappings.mappings.split(';').entries()) {\n if (!stringSegments) continue;\n shift.generatedColumn = 1;\n const segments = stringSegments.split(',');\n\n for (const segment of segments) {\n if (segment.length < 4) continue;\n const decodedSegment = decodeVLQ(segment);\n\n this.decodedSegment(shift, decodedSegment, generatedLine + shift.generatedLine);\n }\n }\n } catch (error) {\n throw new Error(`Error decoding mappings: ${ (<Error>error).message }`);\n }\n }\n\n /**\n * Processes a decoded segment and updates the mappings.\n *\n * @param shift - The current state of the mapping information.\n * @param decodedSegment - The decoded VLQ segment.\n * @param generatedLine - The current line index in the generated code.\n */\n\n private decodedSegment(shift: ShiftSegmentInterface, decodedSegment: Array<number>, generatedLine: number): void {\n const [ generatedColumn, fileIndex, sourceLine, sourceColumn, nameIndex ] = decodedSegment;\n shift.fileIndex += fileIndex;\n shift.nameIndex += nameIndex ?? 0;\n shift.sourceLine += sourceLine;\n shift.sourceColumn += sourceColumn;\n shift.generatedColumn += generatedColumn;\n\n this.mappings.push({\n nameIndex: (nameIndex !== undefined) ? shift.nameIndex : null,\n fileIndex: shift.fileIndex,\n sourceLine: shift.sourceLine,\n sourceColumn: shift.sourceColumn,\n generatedLine: generatedLine,\n generatedColumn: shift.generatedColumn\n });\n }\n\n /**\n * Encodes the mappings into a VLQ string.\n *\n * @param mappings - An array of MappingInterface objects to encode.\n * @returns A VLQ-encoded string representing the mappings.\n */\n\n private encodeMappings(mappings: Array<MappingInterface>): string {\n let resultMapping = '';\n let segments: Array<string> = [];\n\n const shift = {\n fileIndex: 0,\n nameIndex: 0,\n sourceLine: 1,\n sourceColumn: 1,\n generatedLine: 1,\n generatedColumn: 1\n };\n\n shift.generatedLine = mappings[0].generatedLine;\n resultMapping += ';'.repeat(shift.generatedLine - 1);\n\n for (const map of mappings) {\n if (map.generatedLine !== shift.generatedLine) {\n resultMapping += segments.join(',');\n resultMapping += ';'.repeat(Math.max(1, map.generatedLine - shift.generatedLine));\n\n segments = [];\n shift.generatedLine = map.generatedLine;\n shift.generatedColumn = 1;\n }\n\n this.encodeSegment(map, segments, shift);\n }\n\n return resultMapping + segments.join(',') + ';';\n }\n\n /**\n * Encodes a single segment of the mappings.\n *\n * @param map - The MappingInterface object representing a single mapping.\n * @param segments - An array of encoded segments.\n * @param shift - The current state of the mapping information.\n */\n\n private encodeSegment(map: MappingInterface, segments: Array<string>, shift: ShiftSegmentInterface): void {\n const segment: Array<number> = [];\n const sourceIndex = map.fileIndex;\n\n segment[1] = 0;\n segment[2] = map.sourceLine - shift.sourceLine;\n segment[3] = map.sourceColumn - shift.sourceColumn;\n segment[0] = map.generatedColumn - shift.generatedColumn;\n\n if (sourceIndex !== shift.fileIndex) {\n segment[1] = sourceIndex - shift.fileIndex;\n shift.fileIndex = sourceIndex;\n }\n\n if (map.nameIndex) {\n const nameIndex = map.nameIndex;\n segment[4] = nameIndex - shift.nameIndex;\n shift.nameIndex = nameIndex;\n }\n\n shift.sourceLine = map.sourceLine;\n shift.sourceColumn = map.sourceColumn;\n shift.generatedColumn = map.generatedColumn;\n segments.push(encodeArrayVLQ(segment));\n }\n\n /**\n * Performs a binary search on the internal `mappings` array to find a mapping object based on the line and column information.\n * This function utilizes a binary search algorithm to efficiently locate the mapping corresponding to a specific line and column in the generated code.\n *\n * @param targetLine - The line number in the generated code to search for.\n * @param targetColumn - The column number in the generated code to search for.\n * @param bias - An optional bias value specifying how to handle cases where only the line number matches (DEFAULT: Bias.BOUND).\n * Bias.LOWER_BOUND: If the line number matches but the column is less, return the closest mapping with a lower column.\n * Bias.UPPER_BOUND: If the line number matches but the column is greater, return the closest mapping with a higher column.\n * Bias.BOUND: If the line number matches and the column doesn't, return null (default behavior).\n * @returns A MappingInterface object representing the found mapping, or null if no matching mapping is found based on the bias.\n */\n\n private findMapping(targetLine: number, targetColumn: number, bias: Bias = Bias.BOUND): MappingInterface | null {\n let startIndex = 0;\n let endIndex = this.mappings.length - 1;\n let closestMapping: MappingInterface | null = null;\n\n while (startIndex <= endIndex) {\n const middleIndex = Math.floor((startIndex + endIndex) / 2);\n const currentMapping = this.mappings[middleIndex];\n\n if (currentMapping.generatedLine < targetLine) {\n startIndex = middleIndex + 1;\n } else if (currentMapping.generatedLine > targetLine) {\n endIndex = middleIndex - 1;\n } else {\n // The line matches, now we handle the column bias\n if (currentMapping.generatedColumn < targetColumn) {\n startIndex = middleIndex + 1;\n if (bias === Bias.LOWER_BOUND) {\n closestMapping = currentMapping;\n }\n } else if (currentMapping.generatedColumn > targetColumn) {\n endIndex = middleIndex - 1;\n if (bias === Bias.UPPER_BOUND) {\n closestMapping = currentMapping;\n }\n } else {\n return currentMapping;\n }\n }\n }\n\n // If the line doesn't match any mapping, return null\n return closestMapping && closestMapping.generatedLine === targetLine ? closestMapping : null;\n }\n}\n"],
5
+ "mappings": "AAaO,SAASA,EAAgBC,EAAiD,CAC7E,IAAMC,EAAQD,EAAY,MAAM;AAAA,CAAI,EAAE,MAAM,CAAC,EACvCE,EAAQ,sEACRC,EAAY,qDACZC,EAAoC,CAAC,EAE3C,OAAAH,EAAM,QAASI,GAAS,CACpB,IAAMC,EAAQD,EAAK,MAAMH,CAAK,EAC9B,GAAI,CAACI,EAAO,OAEZ,IAAIC,EAAsBD,EAAM,MAAM,CAAC,EACnCA,EAAM,CAAC,IACPC,EAAOD,EAAM,MAAM,CAAC,GAGxB,GAAM,CAAEE,EAAIC,EAAMC,EAASC,CAAO,EAAIJ,EAChCK,EAAa,SAASF,EAAS,EAAE,EACjCG,EAAe,SAASF,EAAQ,EAAE,EAExC,GAAIN,EAAK,SAAS,MAAM,EAAG,CACvB,IAAMS,EAAYL,EAAK,MAAMN,CAAS,GAAG,MAAM,CAAC,EAChD,GAAIW,EAAW,CACX,GAAM,CAAEC,EAAQC,EAAUC,EAAaC,EAAYC,CAAa,EAAIL,EACpEV,EAAM,KAAK,CACP,GAAAI,EACA,KAAMW,EACN,KAAMP,EACN,OAAQC,EACR,SAAU,CACN,GAAIE,EACJ,KAAMC,EACN,KAAM,SAASC,EAAa,EAAE,EAC9B,OAAQ,SAASC,EAAY,EAAE,CACnC,CACJ,CAAC,EAED,MACJ,CACJ,CAEAd,EAAM,KAAK,CACP,GAAII,GAAM,cACV,KAAAC,EACA,KAAMG,EACN,OAAQC,EACR,SAAU,IACd,CAAC,CACL,CAAC,EAEMT,CACX,CCxDA,IAAMgB,EAAuC,CAAC,EAGxCC,EAAc,mEAAmE,MAAM,EAAE,EAG/FA,EAAY,QAAQ,CAACC,EAAMC,IAAU,CACjCH,EAAUE,CAAI,EAAIC,CACtB,CAAC,EAWM,SAASC,EAAUC,EAAuB,CAC7C,IAAMC,EAAaD,EAAQ,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C,EAAaG,EAAc,EACvB9B,IAAS,IACT6B,EAAiBE,WAEdA,EAAe,gBAAkBL,EACxCE,EAAWE,EAAc,EACrB9B,IAAS,IACT6B,EAAiBE,OAGrB,QAAOA,CAGnB,CAGA,OAAOF,GAAkBA,EAAe,gBAAkBJ,EAAaI,EAAiB,IAC5F,CACJ",
6
+ "names": ["parseErrorStack", "stackString", "lines", "regex", "evalRegex", "stack", "line", "match", "args", "at", "file", "lineNum", "colNum", "lineNumber", "columnNumber", "evalMatch", "evalAt", "evalFile", "evalLineNum", "evalColNum", "evalAnonFile", "base64Map", "base64Chars", "char", "index", "encodeVLQ", "value", "isNegative", "encoded", "vlq", "digit", "encodeArrayVLQ", "values", "decodeVLQ", "data", "result", "shift", "i", "continuation", "shifted", "formatCode", "code", "options", "lines", "padding", "startLine", "lineContent", "index", "currentLineNumber", "string", "formatErrorCode", "sourcePosition", "ansiOption", "errorLine", "errorColumn", "lineString", "line", "pointer", "ansiPadding", "prefixPointer", "errorMarker", "ts", "SyntaxKind", "Colors", "defaultScheme", "CodeHighlighter", "sourceFile", "code", "schema", "node", "previousSegmentEnd", "parent", "result", "a", "b", "segment", "lastSegment", "source", "combinedSource", "start", "end", "color", "reset", "key", "comment", "templateExpression", "span", "spanStart", "spanEnd", "highlightCode", "codeHighlighter", "walk", "SourceService", "source", "line", "column", "options", "settings", "map", "code", "endLine", "startLine", "bias", "maps", "lastSegment", "lines", "input", "key", "encodedMappings", "thresholdSegment", "shift", "generatedLine", "stringSegments", "segments", "segment", "decodedSegment", "decodeVLQ", "error", "generatedColumn", "fileIndex", "sourceLine", "sourceColumn", "nameIndex", "mappings", "resultMapping", "sourceIndex", "encodeArrayVLQ", "targetLine", "targetColumn", "startIndex", "endIndex", "closestMapping", "middleIndex", "currentMapping"]
7
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Interface representing a source map object.
3
+ */
4
+ export interface SourceMapInterface {
5
+ /**
6
+ * The version of the source map specification.
7
+ */
8
+ version: number;
9
+ /**
10
+ * The bundle filename
11
+ */
12
+ file?: string;
13
+ /**
14
+ * A string of base64 VLQ-encoded mappings.
15
+ */
16
+ mappings: string;
17
+ /**
18
+ * A list of symbol names used by the “mappings” entry.
19
+ */
20
+ names: Array<string>;
21
+ /**
22
+ * An array of source file paths.
23
+ */
24
+ sources: Array<string>;
25
+ /**
26
+ * An array of contents of the source files.
27
+ */
28
+ sourcesContent: Array<string>;
29
+ }
30
+ /**
31
+ * Interface representing a mapping between generated and original source code.
32
+ */
33
+ export interface MappingInterface {
34
+ /**
35
+ * The index in names array
36
+ */
37
+ nameIndex: number | null;
38
+ /**
39
+ * The file index in sources array
40
+ */
41
+ fileIndex: number;
42
+ /**
43
+ * The line number in the original source code.
44
+ */
45
+ sourceLine: number;
46
+ /**
47
+ * The column number in the original source code.
48
+ */
49
+ sourceColumn: number;
50
+ /**
51
+ * The line number in the generated code.
52
+ */
53
+ generatedLine: number;
54
+ /**
55
+ * The column number in the generated code.
56
+ */
57
+ generatedColumn: number;
58
+ }
59
+ /**
60
+ * Internal interface used to track the current state during decoding and encoding mappings.
61
+ * This interface is not intended for external use.
62
+ */
63
+ export interface ShiftSegmentInterface {
64
+ fileIndex: number;
65
+ nameIndex: number;
66
+ sourceLine: number;
67
+ sourceColumn: number;
68
+ generatedLine: number;
69
+ generatedColumn: number;
70
+ }
71
+ /**
72
+ * Internal interface used to track offsets during source map concatenation.
73
+ * This interface is not intended for external use.
74
+ */
75
+ export interface ThresholdSegmentInterface {
76
+ fileIndex?: number;
77
+ nameIndex?: number;
78
+ generatedLine?: number;
79
+ }
80
+ /**
81
+ * Interface representing a position in the source code.
82
+ */
83
+ export interface PositionInterface {
84
+ line: number;
85
+ column: number;
86
+ name: string | null;
87
+ source: string;
88
+ }
89
+ /**
90
+ * Interface representing a position in the source code with additional context.
91
+ */
92
+ export interface PositionSourceInterface extends PositionInterface {
93
+ code: string;
94
+ endLine: number;
95
+ startLine: number;
96
+ }
97
+ /**
98
+ * Interface representing options for retrieving source positions.
99
+ */
100
+ export interface SourceOptionsInterface {
101
+ bias?: Bias;
102
+ linesAfter?: number;
103
+ linesBefore?: number;
104
+ }
105
+ /**
106
+ * Enumeration representing bias options for searching in mappings.
107
+ */
108
+ export declare const enum Bias {
109
+ BOUND = 0,
110
+ LOWER_BOUND = 1,
111
+ UPPER_BOUND = 2
112
+ }