@rs-x/compiler 2.0.0-next.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,138 @@
1
+ import ts from 'typescript';
2
+ import { JsEspreeExpressionParser } from '@rs-x/expression-parser';
3
+
4
+ interface IGeneratedAotCompiledExpressionsModule {
5
+ readonly code: string;
6
+ readonly expressions: readonly string[];
7
+ readonly skippedExpressions: readonly string[];
8
+ }
9
+ interface IAotCompiledExpressionGenerationOptions {
10
+ readonly includeResolvedEvaluator?: boolean;
11
+ }
12
+ interface IGeneratedAotParsedExpressionCacheModule {
13
+ readonly code: string;
14
+ readonly expressions: readonly string[];
15
+ readonly skippedExpressions: readonly string[];
16
+ }
17
+ interface IGeneratedAotLazyExpressionPreloadManifestModule {
18
+ readonly code: string;
19
+ readonly expressions: readonly string[];
20
+ }
21
+ declare function generateAotCompiledExpressionsModule(program: ts.Program, options?: IAotCompiledExpressionGenerationOptions): IGeneratedAotCompiledExpressionsModule;
22
+ declare function generateAotParsedExpressionCacheModule(program: ts.Program): IGeneratedAotParsedExpressionCacheModule;
23
+ declare function generateAotLazyExpressionPreloadManifestModule(program: ts.Program): IGeneratedAotLazyExpressionPreloadManifestModule;
24
+
25
+ type ExpressionEntryPointKind = 'rsx' | 'factory-create';
26
+ interface IExpressionSiteDetection {
27
+ readonly kind: ExpressionEntryPointKind;
28
+ readonly expression: string;
29
+ readonly preparse: boolean;
30
+ readonly lazy: boolean;
31
+ readonly compiled: boolean;
32
+ readonly expressionLiteral: ts.StringLiteralLike;
33
+ readonly callExpression: ts.CallExpression;
34
+ readonly sourceFile: ts.SourceFile;
35
+ }
36
+ declare function detectExpressionSites(program: ts.Program): IExpressionSiteDetection[];
37
+ declare function detectExpressionSitesInSourceFile(sourceFile: ts.SourceFile, checker: ts.TypeChecker): IExpressionSiteDetection[];
38
+
39
+ type CompilerDiagnosticCategory = 'semantic' | 'syntax' | 'unsupported';
40
+ interface ICompilerDiagnostic {
41
+ readonly category: CompilerDiagnosticCategory;
42
+ readonly message: string;
43
+ readonly token?: string;
44
+ }
45
+ declare function parseExpressionDiagnostic(expression: string): ICompilerDiagnostic | null;
46
+ declare function classifyParserError(expression: string, parserMessage: string): ICompilerDiagnostic;
47
+
48
+ interface IValidatedExpressionSite extends IExpressionSiteDetection {
49
+ readonly diagnostics: readonly ICompilerDiagnostic[];
50
+ }
51
+ declare const supportedDateProperties: Set<string>;
52
+ declare function validateExpressionSites(program: ts.Program): IValidatedExpressionSite[];
53
+ declare function validateExpressionSite(site: IExpressionSiteDetection, checker: ts.TypeChecker, parser?: JsEspreeExpressionParser): IValidatedExpressionSite;
54
+ declare function isDateLikeType(type: ts.Type, checker: ts.TypeChecker): boolean;
55
+
56
+ interface ICompilerScaffold {
57
+ readonly phase: 0;
58
+ readonly scope: 'project-setup';
59
+ readonly packageName: '@rs-x/compiler';
60
+ }
61
+ declare function createCompilerScaffold(): ICompilerScaffold;
62
+
63
+ interface IDiagnosticsScaffold {
64
+ readonly folder: 'diagnostics';
65
+ readonly categories: readonly ['syntax', 'semantic', 'unsupported'];
66
+ }
67
+ declare function createDiagnosticsScaffold(): IDiagnosticsScaffold;
68
+
69
+ type RsxTokenKind = 'identifier' | 'keyword' | 'number' | 'operator' | 'punctuation' | 'string';
70
+ interface IRsxToken {
71
+ start: number;
72
+ end: number;
73
+ kind: RsxTokenKind;
74
+ }
75
+ interface IRsxExpressionLiteralRange {
76
+ start: number;
77
+ end: number;
78
+ expression: string;
79
+ }
80
+ declare function tokenizeRsxExpression(text: string): IRsxToken[];
81
+ declare function findRsxExpressionLiteralRanges(sourceText: string): IRsxExpressionLiteralRange[];
82
+
83
+ interface IRsxExpressionRegion {
84
+ readonly expression: string;
85
+ readonly start: number;
86
+ readonly end: number;
87
+ }
88
+ interface IRsxCompletionItem {
89
+ readonly name: string;
90
+ readonly kind: 'property' | 'method' | 'constructor';
91
+ }
92
+ interface IRsxDiagnostic {
93
+ readonly category: CompilerDiagnosticCategory;
94
+ readonly message: string;
95
+ readonly start: number;
96
+ readonly end: number;
97
+ }
98
+ interface IRsxHoverInfo {
99
+ readonly text: string;
100
+ readonly start: number;
101
+ readonly end: number;
102
+ }
103
+ interface IRsxSignatureParameter {
104
+ readonly name: string;
105
+ readonly typeText: string;
106
+ readonly isOptional: boolean;
107
+ readonly isRest: boolean;
108
+ }
109
+ interface IRsxSignatureHelpItem {
110
+ readonly parameters: readonly IRsxSignatureParameter[];
111
+ readonly returnTypeText: string;
112
+ }
113
+ interface IRsxSignatureHelp {
114
+ readonly items: readonly IRsxSignatureHelpItem[];
115
+ readonly argumentIndex: number;
116
+ readonly argumentCount: number;
117
+ readonly applicableStart: number;
118
+ readonly applicableEnd: number;
119
+ }
120
+ declare function findRsxExpressionRegionAtPosition(program: ts.Program, fileName: string, position: number): IRsxExpressionRegion | null;
121
+ declare function getRsxCompletionsAtPosition(program: ts.Program, fileName: string, position: number): IRsxCompletionItem[];
122
+ declare function getRsxDiagnosticsForFile(program: ts.Program, fileName: string): IRsxDiagnostic[];
123
+ declare function getRsxHoverAtPosition(program: ts.Program, fileName: string, position: number): IRsxHoverInfo | null;
124
+ declare function getRsxSignatureHelpAtPosition(program: ts.Program, fileName: string, position: number): IRsxSignatureHelp | null;
125
+
126
+ interface ILanguageServiceScaffold {
127
+ readonly folder: 'language-service';
128
+ readonly supportsIntelliSense: true;
129
+ }
130
+ declare function createLanguageServiceScaffold(): ILanguageServiceScaffold;
131
+
132
+ interface ITransformerScaffold {
133
+ readonly folder: 'transformer';
134
+ readonly enabled: false;
135
+ }
136
+ declare function createTransformerScaffold(): ITransformerScaffold;
137
+
138
+ export { type CompilerDiagnosticCategory, type ExpressionEntryPointKind, type IAotCompiledExpressionGenerationOptions, type ICompilerDiagnostic, type ICompilerScaffold, type IDiagnosticsScaffold, type IExpressionSiteDetection, type IGeneratedAotCompiledExpressionsModule, type IGeneratedAotLazyExpressionPreloadManifestModule, type IGeneratedAotParsedExpressionCacheModule, type ILanguageServiceScaffold, type IRsxCompletionItem, type IRsxDiagnostic, type IRsxExpressionLiteralRange, type IRsxExpressionRegion, type IRsxHoverInfo, type IRsxSignatureHelp, type IRsxSignatureHelpItem, type IRsxSignatureParameter, type IRsxToken, type ITransformerScaffold, type IValidatedExpressionSite, type RsxTokenKind, classifyParserError, createCompilerScaffold, createDiagnosticsScaffold, createLanguageServiceScaffold, createTransformerScaffold, detectExpressionSites, detectExpressionSitesInSourceFile, findRsxExpressionLiteralRanges, findRsxExpressionRegionAtPosition, generateAotCompiledExpressionsModule, generateAotLazyExpressionPreloadManifestModule, generateAotParsedExpressionCacheModule, getRsxCompletionsAtPosition, getRsxDiagnosticsForFile, getRsxHoverAtPosition, getRsxSignatureHelpAtPosition, isDateLikeType, parseExpressionDiagnostic, supportedDateProperties, tokenizeRsxExpression, validateExpressionSite, validateExpressionSites };
@@ -0,0 +1,138 @@
1
+ import ts from 'typescript';
2
+ import { JsEspreeExpressionParser } from '@rs-x/expression-parser';
3
+
4
+ interface IGeneratedAotCompiledExpressionsModule {
5
+ readonly code: string;
6
+ readonly expressions: readonly string[];
7
+ readonly skippedExpressions: readonly string[];
8
+ }
9
+ interface IAotCompiledExpressionGenerationOptions {
10
+ readonly includeResolvedEvaluator?: boolean;
11
+ }
12
+ interface IGeneratedAotParsedExpressionCacheModule {
13
+ readonly code: string;
14
+ readonly expressions: readonly string[];
15
+ readonly skippedExpressions: readonly string[];
16
+ }
17
+ interface IGeneratedAotLazyExpressionPreloadManifestModule {
18
+ readonly code: string;
19
+ readonly expressions: readonly string[];
20
+ }
21
+ declare function generateAotCompiledExpressionsModule(program: ts.Program, options?: IAotCompiledExpressionGenerationOptions): IGeneratedAotCompiledExpressionsModule;
22
+ declare function generateAotParsedExpressionCacheModule(program: ts.Program): IGeneratedAotParsedExpressionCacheModule;
23
+ declare function generateAotLazyExpressionPreloadManifestModule(program: ts.Program): IGeneratedAotLazyExpressionPreloadManifestModule;
24
+
25
+ type ExpressionEntryPointKind = 'rsx' | 'factory-create';
26
+ interface IExpressionSiteDetection {
27
+ readonly kind: ExpressionEntryPointKind;
28
+ readonly expression: string;
29
+ readonly preparse: boolean;
30
+ readonly lazy: boolean;
31
+ readonly compiled: boolean;
32
+ readonly expressionLiteral: ts.StringLiteralLike;
33
+ readonly callExpression: ts.CallExpression;
34
+ readonly sourceFile: ts.SourceFile;
35
+ }
36
+ declare function detectExpressionSites(program: ts.Program): IExpressionSiteDetection[];
37
+ declare function detectExpressionSitesInSourceFile(sourceFile: ts.SourceFile, checker: ts.TypeChecker): IExpressionSiteDetection[];
38
+
39
+ type CompilerDiagnosticCategory = 'semantic' | 'syntax' | 'unsupported';
40
+ interface ICompilerDiagnostic {
41
+ readonly category: CompilerDiagnosticCategory;
42
+ readonly message: string;
43
+ readonly token?: string;
44
+ }
45
+ declare function parseExpressionDiagnostic(expression: string): ICompilerDiagnostic | null;
46
+ declare function classifyParserError(expression: string, parserMessage: string): ICompilerDiagnostic;
47
+
48
+ interface IValidatedExpressionSite extends IExpressionSiteDetection {
49
+ readonly diagnostics: readonly ICompilerDiagnostic[];
50
+ }
51
+ declare const supportedDateProperties: Set<string>;
52
+ declare function validateExpressionSites(program: ts.Program): IValidatedExpressionSite[];
53
+ declare function validateExpressionSite(site: IExpressionSiteDetection, checker: ts.TypeChecker, parser?: JsEspreeExpressionParser): IValidatedExpressionSite;
54
+ declare function isDateLikeType(type: ts.Type, checker: ts.TypeChecker): boolean;
55
+
56
+ interface ICompilerScaffold {
57
+ readonly phase: 0;
58
+ readonly scope: 'project-setup';
59
+ readonly packageName: '@rs-x/compiler';
60
+ }
61
+ declare function createCompilerScaffold(): ICompilerScaffold;
62
+
63
+ interface IDiagnosticsScaffold {
64
+ readonly folder: 'diagnostics';
65
+ readonly categories: readonly ['syntax', 'semantic', 'unsupported'];
66
+ }
67
+ declare function createDiagnosticsScaffold(): IDiagnosticsScaffold;
68
+
69
+ type RsxTokenKind = 'identifier' | 'keyword' | 'number' | 'operator' | 'punctuation' | 'string';
70
+ interface IRsxToken {
71
+ start: number;
72
+ end: number;
73
+ kind: RsxTokenKind;
74
+ }
75
+ interface IRsxExpressionLiteralRange {
76
+ start: number;
77
+ end: number;
78
+ expression: string;
79
+ }
80
+ declare function tokenizeRsxExpression(text: string): IRsxToken[];
81
+ declare function findRsxExpressionLiteralRanges(sourceText: string): IRsxExpressionLiteralRange[];
82
+
83
+ interface IRsxExpressionRegion {
84
+ readonly expression: string;
85
+ readonly start: number;
86
+ readonly end: number;
87
+ }
88
+ interface IRsxCompletionItem {
89
+ readonly name: string;
90
+ readonly kind: 'property' | 'method' | 'constructor';
91
+ }
92
+ interface IRsxDiagnostic {
93
+ readonly category: CompilerDiagnosticCategory;
94
+ readonly message: string;
95
+ readonly start: number;
96
+ readonly end: number;
97
+ }
98
+ interface IRsxHoverInfo {
99
+ readonly text: string;
100
+ readonly start: number;
101
+ readonly end: number;
102
+ }
103
+ interface IRsxSignatureParameter {
104
+ readonly name: string;
105
+ readonly typeText: string;
106
+ readonly isOptional: boolean;
107
+ readonly isRest: boolean;
108
+ }
109
+ interface IRsxSignatureHelpItem {
110
+ readonly parameters: readonly IRsxSignatureParameter[];
111
+ readonly returnTypeText: string;
112
+ }
113
+ interface IRsxSignatureHelp {
114
+ readonly items: readonly IRsxSignatureHelpItem[];
115
+ readonly argumentIndex: number;
116
+ readonly argumentCount: number;
117
+ readonly applicableStart: number;
118
+ readonly applicableEnd: number;
119
+ }
120
+ declare function findRsxExpressionRegionAtPosition(program: ts.Program, fileName: string, position: number): IRsxExpressionRegion | null;
121
+ declare function getRsxCompletionsAtPosition(program: ts.Program, fileName: string, position: number): IRsxCompletionItem[];
122
+ declare function getRsxDiagnosticsForFile(program: ts.Program, fileName: string): IRsxDiagnostic[];
123
+ declare function getRsxHoverAtPosition(program: ts.Program, fileName: string, position: number): IRsxHoverInfo | null;
124
+ declare function getRsxSignatureHelpAtPosition(program: ts.Program, fileName: string, position: number): IRsxSignatureHelp | null;
125
+
126
+ interface ILanguageServiceScaffold {
127
+ readonly folder: 'language-service';
128
+ readonly supportsIntelliSense: true;
129
+ }
130
+ declare function createLanguageServiceScaffold(): ILanguageServiceScaffold;
131
+
132
+ interface ITransformerScaffold {
133
+ readonly folder: 'transformer';
134
+ readonly enabled: false;
135
+ }
136
+ declare function createTransformerScaffold(): ITransformerScaffold;
137
+
138
+ export { type CompilerDiagnosticCategory, type ExpressionEntryPointKind, type IAotCompiledExpressionGenerationOptions, type ICompilerDiagnostic, type ICompilerScaffold, type IDiagnosticsScaffold, type IExpressionSiteDetection, type IGeneratedAotCompiledExpressionsModule, type IGeneratedAotLazyExpressionPreloadManifestModule, type IGeneratedAotParsedExpressionCacheModule, type ILanguageServiceScaffold, type IRsxCompletionItem, type IRsxDiagnostic, type IRsxExpressionLiteralRange, type IRsxExpressionRegion, type IRsxHoverInfo, type IRsxSignatureHelp, type IRsxSignatureHelpItem, type IRsxSignatureParameter, type IRsxToken, type ITransformerScaffold, type IValidatedExpressionSite, type RsxTokenKind, classifyParserError, createCompilerScaffold, createDiagnosticsScaffold, createLanguageServiceScaffold, createTransformerScaffold, detectExpressionSites, detectExpressionSitesInSourceFile, findRsxExpressionLiteralRanges, findRsxExpressionRegionAtPosition, generateAotCompiledExpressionsModule, generateAotLazyExpressionPreloadManifestModule, generateAotParsedExpressionCacheModule, getRsxCompletionsAtPosition, getRsxDiagnosticsForFile, getRsxHoverAtPosition, getRsxSignatureHelpAtPosition, isDateLikeType, parseExpressionDiagnostic, supportedDateProperties, tokenizeRsxExpression, validateExpressionSite, validateExpressionSites };