@remotex-labs/xmap 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/formatter.component.js +3 -3
- package/dist/cjs/formatter.component.js.map +3 -3
- package/dist/cjs/highlighter.component.js.map +3 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/parser.component.js +1 -1
- package/dist/cjs/parser.component.js.map +4 -4
- package/dist/esm/formatter.component.js +3 -3
- package/dist/esm/formatter.component.js.map +3 -3
- package/dist/esm/highlighter.component.js.map +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/parser.component.js +2 -2
- package/dist/esm/parser.component.js.map +3 -3
- package/dist/formatter.component.d.ts +258 -0
- package/dist/{components/highlighter.component.d.ts → highlighter.component.d.ts} +94 -11
- package/dist/index.d.ts +866 -3
- package/dist/{components/parser.component.d.ts → parser.component.d.ts} +58 -14
- package/package.json +32 -32
- package/dist/components/base64.component.d.ts +0 -70
- package/dist/components/formatter.component.d.ts +0 -68
- package/dist/components/interfaces/formatter-component.interface.d.ts +0 -60
- package/dist/components/interfaces/highlighter-component.interface.d.ts +0 -94
- package/dist/components/interfaces/parse-component.interface.d.ts +0 -52
- package/dist/providers/interfaces/mapping-provider.interface.d.ts +0 -141
- package/dist/providers/mapping.provider.d.ts +0 -317
- package/dist/services/interfaces/source-service.interface.d.ts +0 -139
- package/dist/services/source.service.d.ts +0 -216
|
@@ -1,15 +1,98 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
3
|
+
* Defines the color scheme for syntax highlighting different code elements.
|
|
4
|
+
*
|
|
5
|
+
* @interface HighlightSchemeInterface
|
|
6
|
+
*
|
|
7
|
+
* @property enumColor - Color code for enum declarations and references
|
|
8
|
+
* @property typeColor - Color code for type annotations and primitive types
|
|
9
|
+
* @property classColor - Color code for class declarations and references
|
|
10
|
+
* @property stringColor - Color code for string literals and template strings
|
|
11
|
+
* @property keywordColor - Color code for language keywords
|
|
12
|
+
* @property commentColor - Color code for comments (single-line and multi-line)
|
|
13
|
+
* @property functionColor - Color code for function declarations and calls
|
|
14
|
+
* @property variableColor - Color code for variable declarations and references
|
|
15
|
+
* @property interfaceColor - Color code for interface declarations and references
|
|
16
|
+
* @property parameterColor - Color code for function and method parameters
|
|
17
|
+
* @property getAccessorColor - Color code for getter accessor methods
|
|
18
|
+
* @property numericLiteralColor - Color code for numeric literals
|
|
19
|
+
* @property methodSignatureColor - Color code for method signatures in interfaces
|
|
20
|
+
* @property regularExpressionColor - Color code for regular expression literals
|
|
21
|
+
* @property propertyAssignmentColor - Color code for property assignments in object literals
|
|
22
|
+
* @property propertyAccessExpressionColor - Color code for property access expressions
|
|
23
|
+
* @property expressionWithTypeArgumentsColor - Color code for type arguments in expressions
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const darkTheme: HighlightSchemeInterface = {
|
|
28
|
+
* enumColor: Colors.cyan,
|
|
29
|
+
* typeColor: Colors.blue,
|
|
30
|
+
* classColor: Colors.yellow,
|
|
31
|
+
* // ...other color definitions
|
|
32
|
+
* };
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @since 1.0.0
|
|
7
36
|
*/
|
|
8
|
-
|
|
37
|
+
export interface HighlightSchemeInterface {
|
|
38
|
+
enumColor: string;
|
|
39
|
+
typeColor: string;
|
|
40
|
+
classColor: string;
|
|
41
|
+
stringColor: string;
|
|
42
|
+
keywordColor: string;
|
|
43
|
+
commentColor: string;
|
|
44
|
+
functionColor: string;
|
|
45
|
+
variableColor: string;
|
|
46
|
+
interfaceColor: string;
|
|
47
|
+
parameterColor: string;
|
|
48
|
+
getAccessorColor: string;
|
|
49
|
+
numericLiteralColor: string;
|
|
50
|
+
methodSignatureColor: string;
|
|
51
|
+
regularExpressionColor: string;
|
|
52
|
+
propertyAssignmentColor: string;
|
|
53
|
+
propertyAccessExpressionColor: string;
|
|
54
|
+
expressionWithTypeArgumentsColor: string;
|
|
55
|
+
}
|
|
9
56
|
/**
|
|
10
|
-
*
|
|
57
|
+
* Represents a segment of source code to be highlighted with specific styling.
|
|
58
|
+
*
|
|
59
|
+
* @interface HighlightNodeSegmentInterface
|
|
60
|
+
*
|
|
61
|
+
* @property start - The starting character position of the segment in the source text
|
|
62
|
+
* @property end - The ending character position of the segment in the source text
|
|
63
|
+
* @property color - The color or style code to apply to this segment
|
|
64
|
+
* @property reset - The reset code that returns formatting to normal after this segment
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Segments are the fundamental units of the highlighting system.
|
|
68
|
+
* Each segment represents a portion of text that should receive specific styling.
|
|
69
|
+
* When the source code is processed for display,
|
|
70
|
+
* these segments are used to insert the appropriate color/style codes at the correct positions.
|
|
71
|
+
*
|
|
72
|
+
* The highlighter maintains a collection of these segments and applies them
|
|
73
|
+
* in position order to create the complete highlighted output.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const keywordSegment: HighlightNodeSegmentInterface = {
|
|
78
|
+
* start: 0,
|
|
79
|
+
* end: 6,
|
|
80
|
+
* color: '\x1b[34m', // Blue for the keyword "import"
|
|
81
|
+
* reset: '\x1b[0m' // Reset to default
|
|
82
|
+
* };
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @see HighlightSchemeInterface
|
|
86
|
+
* @see addSegment
|
|
87
|
+
*
|
|
88
|
+
* @since 1.0.0
|
|
11
89
|
*/
|
|
12
|
-
|
|
90
|
+
export interface HighlightNodeSegmentInterface {
|
|
91
|
+
end: number;
|
|
92
|
+
start: number;
|
|
93
|
+
color: string;
|
|
94
|
+
reset: string;
|
|
95
|
+
}
|
|
13
96
|
/**
|
|
14
97
|
* An enum containing ANSI escape sequences for various colors
|
|
15
98
|
*
|
|
@@ -24,7 +107,7 @@ import * as ts from 'typescript';
|
|
|
24
107
|
*
|
|
25
108
|
* @since 1.0.0
|
|
26
109
|
*/
|
|
27
|
-
export
|
|
110
|
+
export const enum Colors {
|
|
28
111
|
reset = "\u001B[0m",
|
|
29
112
|
gray = "\u001B[38;5;243m",
|
|
30
113
|
darkGray = "\u001B[38;5;238m",
|
|
@@ -56,7 +139,7 @@ export declare const enum Colors {
|
|
|
56
139
|
*
|
|
57
140
|
* @since 1.0.0
|
|
58
141
|
*/
|
|
59
|
-
export
|
|
142
|
+
export class CodeHighlighter {
|
|
60
143
|
private sourceFile;
|
|
61
144
|
private code;
|
|
62
145
|
private schema;
|
|
@@ -337,4 +420,4 @@ export declare class CodeHighlighter {
|
|
|
337
420
|
*
|
|
338
421
|
* @since 1.0.0
|
|
339
422
|
*/
|
|
340
|
-
export
|
|
423
|
+
export function highlightCode(code: string, schema?: Partial<HighlightSchemeInterface>): string;
|