@flint.fyi/typescript-language 0.18.3 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib/types/ast.d.ts → dist/index.d.mts} +777 -4
- package/dist/index.mjs +1104 -0
- package/package.json +9 -8
- package/lib/_virtual/_rolldown/runtime.js +0 -13
- package/lib/collectReferencedFilePaths.d.ts +0 -4
- package/lib/collectReferencedFilePaths.js +0 -40
- package/lib/convertTypeScriptDiagnosticToLanguageReport.d.ts +0 -18
- package/lib/convertTypeScriptDiagnosticToLanguageReport.js +0 -114
- package/lib/createTypeScriptServerHost.d.ts +0 -4
- package/lib/createTypeScriptServerHost.js +0 -103
- package/lib/directives/parseDirectivesFromTypeScriptFile.d.ts +0 -13
- package/lib/directives/parseDirectivesFromTypeScriptFile.js +0 -66
- package/lib/getFirstEnumValues.d.ts +0 -36
- package/lib/getFirstEnumValues.js +0 -48
- package/lib/getTSNodeRange.d.ts +0 -9
- package/lib/getTSNodeRange.js +0 -11
- package/lib/getTypeScriptFileCacheImpacts.d.ts +0 -4
- package/lib/getTypeScriptFileCacheImpacts.js +0 -9
- package/lib/index.d.ts +0 -26
- package/lib/index.js +0 -22
- package/lib/language.d.ts +0 -416
- package/lib/language.js +0 -119
- package/lib/nodes.d.ts +0 -204
- package/lib/normalizeRange.d.ts +0 -4
- package/lib/normalizeRange.js +0 -19
- package/lib/orderTypeScriptFilePaths.d.ts +0 -3
- package/lib/orderTypeScriptFilePaths.js +0 -92
- package/lib/package.js +0 -7
- package/lib/scope/identifierReferences.d.ts +0 -4
- package/lib/scope/identifierReferences.js +0 -91
- package/lib/scope/scopeManager.d.ts +0 -15
- package/lib/scope/scopeManager.js +0 -149
- package/lib/scope/scopes.d.ts +0 -8
- package/lib/scope/scopes.js +0 -66
- package/lib/scope/types.d.ts +0 -39
- package/lib/types/checker.d.ts +0 -23
- package/lib/utils/createRuleTesterTSConfig.d.ts +0 -8
- package/lib/utils/createRuleTesterTSConfig.js +0 -18
- package/lib/utils/declarationIncludesGlobal.d.ts +0 -7
- package/lib/utils/declarationIncludesGlobal.js +0 -9
- package/lib/utils/declarationsIncludeGlobal.d.ts +0 -3
- package/lib/utils/declarationsIncludeGlobal.js +0 -9
- package/lib/utils/forEachChild.d.ts +0 -8
- package/lib/utils/forEachChild.js +0 -7
- package/lib/utils/getDeclarationsIfGlobal.d.ts +0 -9
- package/lib/utils/getDeclarationsIfGlobal.js +0 -10
- package/lib/utils/getModifyingReferences.d.ts +0 -11
- package/lib/utils/getModifyingReferences.js +0 -15
- package/lib/utils/hasSameTokens.d.ts +0 -7
- package/lib/utils/hasSameTokens.js +0 -32
- package/lib/utils/isBuiltinArrayMethod.d.ts +0 -14
- package/lib/utils/isBuiltinArrayMethod.js +0 -9
- package/lib/utils/isFunction.d.ts +0 -7
- package/lib/utils/isFunction.js +0 -8
- package/lib/utils/isGlobalDeclaration.d.ts +0 -7
- package/lib/utils/isGlobalDeclaration.js +0 -9
- package/lib/utils/isGlobalDeclarationOfName.d.ts +0 -11
- package/lib/utils/isGlobalDeclarationOfName.js +0 -23
- package/lib/utils/isGlobalVariable.d.ts +0 -13
- package/lib/utils/isGlobalVariable.js +0 -19
- package/lib/utils/isInlineArrayCreation.d.ts +0 -12
- package/lib/utils/isInlineArrayCreation.js +0 -45
- package/lib/utils/isStaticString.d.ts +0 -6
- package/lib/utils/isStaticString.js +0 -9
- package/lib/utils/isStringRawNoSubstitution.d.ts +0 -8
- package/lib/utils/isStringRawNoSubstitution.js +0 -11
- package/lib/utils/unwrapParentParenthesizedExpressions.d.ts +0 -7
- package/lib/utils/unwrapParentParenthesizedExpressions.js +0 -9
- package/lib/utils/unwrapParenthesizedNode.d.ts +0 -7
- package/lib/utils/unwrapParenthesizedNode.js +0 -9
package/lib/language.d.ts
DELETED
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { AnyKeyword, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BigIntKeyword, BigIntLiteral, BinaryExpression, BindingElement, Block, BooleanKeyword, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, CommaListExpression, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, DebuggerStatement, Decorator, DefaultClause, DeleteExpression, DoStatement, ElementAccessExpression, EmptyStatement, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, FalseLiteral, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportExpression, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, IntrinsicKeyword, JSDocAllType, JSDocFunctionType, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocParameterTag, JSDocPropertyTag, JSDocReturnTag, JSDocSignature, JSDocTemplateTag, JSDocText, JSDocTypeExpression, JSDocTypeLiteral, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxText, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignature, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NeverKeyword, NewExpression, NoSubstitutionTemplateLiteral, NonNullExpression, NotEmittedStatement, NotEmittedTypeElement, NullLiteral, NumberKeyword, NumericLiteral, ObjectBindingPattern, ObjectKeyword, ObjectLiteralExpression, OmittedExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignature, QualifiedName, RegularExpressionLiteral, RestTypeNode, ReturnStatement, SatisfiesExpression, SemicolonClassElement, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StringKeyword, StringLiteral, SuperExpression, SwitchStatement, SymbolKeyword, SyntheticExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, ThisExpression, ThisTypeNode, ThrowStatement, TrueLiteral, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UndefinedKeyword, UnionTypeNode, UnknownKeyword, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, VoidKeyword, WhileStatement, WithStatement, YieldExpression } from "./types/ast.js";
|
|
2
|
-
import { TypeScriptNodeVisitors } from "./nodes.js";
|
|
3
|
-
import { Checker } from "./types/checker.js";
|
|
4
|
-
import * as ts$1 from "typescript";
|
|
5
|
-
import * as _flint_fyi_core0 from "@flint.fyi/core";
|
|
6
|
-
import { AnyOptionalSchema, FileAboutData, InferredOutputObject, LanguageFile, LanguageFileDefinition, LanguageReports, RuleRuntime } from "@flint.fyi/core";
|
|
7
|
-
|
|
8
|
-
//#region src/language.d.ts
|
|
9
|
-
interface TypeScriptFileServices {
|
|
10
|
-
program: ts$1.Program;
|
|
11
|
-
sourceFile: SourceFile;
|
|
12
|
-
typeChecker: Checker;
|
|
13
|
-
}
|
|
14
|
-
declare const NodeSyntaxKinds: typeof ts$1.SyntaxKind;
|
|
15
|
-
type VolarCreateFile = (data: FileAboutData, program: ts$1.Program, sourceFile: SourceFile) => VolarLanguageFileDefinition;
|
|
16
|
-
type VolarLanguageFileDefinition = LanguageFileDefinition<object> & {
|
|
17
|
-
__volarServices: {
|
|
18
|
-
getLanguageReports(): LanguageReports;
|
|
19
|
-
runVisitors(file: LanguageFile<TypeScriptFileServices>, options: InferredOutputObject<AnyOptionalSchema | undefined>, runtime: RuleRuntime<TypeScriptNodeVisitors, TypeScriptFileServices>): void;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
declare function setVolarCreateFile(create: VolarCreateFile): void;
|
|
23
|
-
declare const typescriptLanguage: _flint_fyi_core0.Language<{
|
|
24
|
-
AnyKeyword: AnyKeyword;
|
|
25
|
-
ArrayBindingPattern: ArrayBindingPattern;
|
|
26
|
-
ArrayLiteralExpression: ArrayLiteralExpression;
|
|
27
|
-
ArrayType: ArrayTypeNode;
|
|
28
|
-
ArrowFunction: ArrowFunction;
|
|
29
|
-
AsExpression: AsExpression;
|
|
30
|
-
AwaitExpression: AwaitExpression;
|
|
31
|
-
BigIntKeyword: BigIntKeyword;
|
|
32
|
-
BigIntLiteral: BigIntLiteral;
|
|
33
|
-
BinaryExpression: BinaryExpression;
|
|
34
|
-
BindingElement: BindingElement;
|
|
35
|
-
Block: Block;
|
|
36
|
-
BooleanKeyword: BooleanKeyword;
|
|
37
|
-
BreakStatement: BreakStatement;
|
|
38
|
-
CallExpression: CallExpression;
|
|
39
|
-
CallSignature: CallSignatureDeclaration;
|
|
40
|
-
CaseBlock: CaseBlock;
|
|
41
|
-
CaseClause: CaseClause;
|
|
42
|
-
CatchClause: CatchClause;
|
|
43
|
-
ClassDeclaration: ClassDeclaration;
|
|
44
|
-
ClassExpression: ClassExpression;
|
|
45
|
-
ClassStaticBlockDeclaration: ClassStaticBlockDeclaration;
|
|
46
|
-
CommaListExpression: CommaListExpression;
|
|
47
|
-
ComputedPropertyName: ComputedPropertyName;
|
|
48
|
-
ConditionalExpression: ConditionalExpression;
|
|
49
|
-
ConditionalType: ConditionalTypeNode;
|
|
50
|
-
Constructor: ConstructorDeclaration;
|
|
51
|
-
ConstructorType: ConstructorTypeNode;
|
|
52
|
-
ConstructSignature: ConstructSignatureDeclaration;
|
|
53
|
-
ContinueStatement: ContinueStatement;
|
|
54
|
-
DebuggerStatement: DebuggerStatement;
|
|
55
|
-
Decorator: Decorator;
|
|
56
|
-
DefaultClause: DefaultClause;
|
|
57
|
-
DeleteExpression: DeleteExpression;
|
|
58
|
-
DoStatement: DoStatement;
|
|
59
|
-
ElementAccessExpression: ElementAccessExpression;
|
|
60
|
-
EmptyStatement: EmptyStatement;
|
|
61
|
-
EnumDeclaration: EnumDeclaration;
|
|
62
|
-
EnumMember: EnumMember;
|
|
63
|
-
ExportAssignment: ExportAssignment;
|
|
64
|
-
ExportDeclaration: ExportDeclaration;
|
|
65
|
-
ExportSpecifier: ExportSpecifier;
|
|
66
|
-
ExpressionStatement: ExpressionStatement;
|
|
67
|
-
ExpressionWithTypeArguments: ExpressionWithTypeArguments;
|
|
68
|
-
ExternalModuleReference: ExternalModuleReference;
|
|
69
|
-
FalseKeyword: FalseLiteral;
|
|
70
|
-
ForInStatement: ForInStatement;
|
|
71
|
-
ForOfStatement: ForOfStatement;
|
|
72
|
-
ForStatement: ForStatement;
|
|
73
|
-
FunctionDeclaration: FunctionDeclaration;
|
|
74
|
-
FunctionExpression: FunctionExpression;
|
|
75
|
-
FunctionType: FunctionTypeNode;
|
|
76
|
-
GetAccessor: GetAccessorDeclaration;
|
|
77
|
-
HeritageClause: HeritageClause;
|
|
78
|
-
Identifier: Identifier;
|
|
79
|
-
IfStatement: IfStatement;
|
|
80
|
-
ImportAttribute: ImportAttribute;
|
|
81
|
-
ImportAttributes: ImportAttributes;
|
|
82
|
-
ImportClause: ImportClause;
|
|
83
|
-
ImportDeclaration: ImportDeclaration;
|
|
84
|
-
ImportEqualsDeclaration: ImportEqualsDeclaration;
|
|
85
|
-
ImportKeyword: ImportExpression;
|
|
86
|
-
ImportSpecifier: ImportSpecifier;
|
|
87
|
-
ImportType: ImportTypeNode;
|
|
88
|
-
IndexedAccessType: IndexedAccessTypeNode;
|
|
89
|
-
IndexSignature: IndexSignatureDeclaration;
|
|
90
|
-
InferType: InferTypeNode;
|
|
91
|
-
InterfaceDeclaration: InterfaceDeclaration;
|
|
92
|
-
IntersectionType: IntersectionTypeNode;
|
|
93
|
-
IntrinsicKeyword: IntrinsicKeyword;
|
|
94
|
-
JSDocAllType: JSDocAllType;
|
|
95
|
-
JSDocFunctionType: JSDocFunctionType;
|
|
96
|
-
JSDocLink: JSDocLink;
|
|
97
|
-
JSDocLinkCode: JSDocLinkCode;
|
|
98
|
-
JSDocLinkPlain: JSDocLinkPlain;
|
|
99
|
-
JSDocMemberName: JSDocMemberName;
|
|
100
|
-
JSDocNamepathType: JSDocNamepathType;
|
|
101
|
-
JSDocNonNullableType: JSDocNonNullableType;
|
|
102
|
-
JSDocNullableType: JSDocNullableType;
|
|
103
|
-
JSDocOptionalType: JSDocOptionalType;
|
|
104
|
-
JSDocParameterTag: JSDocParameterTag;
|
|
105
|
-
JSDocPropertyTag: JSDocPropertyTag;
|
|
106
|
-
JSDocReturnTag: JSDocReturnTag;
|
|
107
|
-
JSDocSignature: JSDocSignature;
|
|
108
|
-
JSDocTemplateTag: JSDocTemplateTag;
|
|
109
|
-
JSDocText: JSDocText;
|
|
110
|
-
JSDocTypeExpression: JSDocTypeExpression;
|
|
111
|
-
JSDocTypeLiteral: JSDocTypeLiteral;
|
|
112
|
-
JSDocUnknownType: JSDocUnknownType;
|
|
113
|
-
JSDocVariadicType: JSDocVariadicType;
|
|
114
|
-
JsxAttribute: JsxAttribute;
|
|
115
|
-
JsxAttributes: JsxAttributes;
|
|
116
|
-
JsxClosingElement: JsxClosingElement;
|
|
117
|
-
JsxClosingFragment: JsxClosingFragment;
|
|
118
|
-
JsxElement: JsxElement;
|
|
119
|
-
JsxExpression: JsxExpression;
|
|
120
|
-
JsxFragment: JsxFragment;
|
|
121
|
-
JsxNamespacedName: JsxNamespacedName;
|
|
122
|
-
JsxOpeningElement: JsxOpeningElement;
|
|
123
|
-
JsxOpeningFragment: JsxOpeningFragment;
|
|
124
|
-
JsxSelfClosingElement: JsxSelfClosingElement;
|
|
125
|
-
JsxSpreadAttribute: JsxSpreadAttribute;
|
|
126
|
-
JsxText: JsxText;
|
|
127
|
-
LabeledStatement: LabeledStatement;
|
|
128
|
-
LiteralType: LiteralTypeNode;
|
|
129
|
-
MappedType: MappedTypeNode;
|
|
130
|
-
MetaProperty: MetaProperty;
|
|
131
|
-
MethodDeclaration: MethodDeclaration;
|
|
132
|
-
MethodSignature: MethodSignature;
|
|
133
|
-
MissingDeclaration: MissingDeclaration;
|
|
134
|
-
ModuleBlock: ModuleBlock;
|
|
135
|
-
ModuleDeclaration: ModuleDeclaration;
|
|
136
|
-
NamedExports: NamedExports;
|
|
137
|
-
NamedImports: NamedImports;
|
|
138
|
-
NamedTupleMember: NamedTupleMember;
|
|
139
|
-
NamespaceExport: NamespaceExport;
|
|
140
|
-
NamespaceExportDeclaration: NamespaceExportDeclaration;
|
|
141
|
-
NamespaceImport: NamespaceImport;
|
|
142
|
-
NeverKeyword: NeverKeyword;
|
|
143
|
-
NewExpression: NewExpression;
|
|
144
|
-
NonNullExpression: NonNullExpression;
|
|
145
|
-
NoSubstitutionTemplateLiteral: NoSubstitutionTemplateLiteral;
|
|
146
|
-
NotEmittedStatement: NotEmittedStatement;
|
|
147
|
-
NotEmittedTypeElement: NotEmittedTypeElement;
|
|
148
|
-
NullKeyword: NullLiteral;
|
|
149
|
-
NumberKeyword: NumberKeyword;
|
|
150
|
-
NumericLiteral: NumericLiteral;
|
|
151
|
-
ObjectBindingPattern: ObjectBindingPattern;
|
|
152
|
-
ObjectKeyword: ObjectKeyword;
|
|
153
|
-
ObjectLiteralExpression: ObjectLiteralExpression;
|
|
154
|
-
OmittedExpression: OmittedExpression;
|
|
155
|
-
OptionalType: OptionalTypeNode;
|
|
156
|
-
Parameter: ParameterDeclaration;
|
|
157
|
-
ParenthesizedExpression: ParenthesizedExpression;
|
|
158
|
-
ParenthesizedType: ParenthesizedTypeNode;
|
|
159
|
-
PartiallyEmittedExpression: PartiallyEmittedExpression;
|
|
160
|
-
PostfixUnaryExpression: PostfixUnaryExpression;
|
|
161
|
-
PrefixUnaryExpression: PrefixUnaryExpression;
|
|
162
|
-
PrivateIdentifier: PrivateIdentifier;
|
|
163
|
-
PropertyAccessExpression: PropertyAccessExpression;
|
|
164
|
-
PropertyAssignment: PropertyAssignment;
|
|
165
|
-
PropertyDeclaration: PropertyDeclaration;
|
|
166
|
-
PropertySignature: PropertySignature;
|
|
167
|
-
QualifiedName: QualifiedName;
|
|
168
|
-
RegularExpressionLiteral: RegularExpressionLiteral;
|
|
169
|
-
RestType: RestTypeNode;
|
|
170
|
-
ReturnStatement: ReturnStatement;
|
|
171
|
-
SatisfiesExpression: SatisfiesExpression;
|
|
172
|
-
SemicolonClassElement: SemicolonClassElement;
|
|
173
|
-
SetAccessor: SetAccessorDeclaration;
|
|
174
|
-
ShorthandPropertyAssignment: ShorthandPropertyAssignment;
|
|
175
|
-
SourceFile: SourceFile;
|
|
176
|
-
SpreadAssignment: SpreadAssignment;
|
|
177
|
-
SpreadElement: SpreadElement;
|
|
178
|
-
StringKeyword: StringKeyword;
|
|
179
|
-
StringLiteral: StringLiteral;
|
|
180
|
-
SuperKeyword: SuperExpression;
|
|
181
|
-
SwitchStatement: SwitchStatement;
|
|
182
|
-
SymbolKeyword: SymbolKeyword;
|
|
183
|
-
SyntheticExpression: SyntheticExpression;
|
|
184
|
-
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
185
|
-
TemplateExpression: TemplateExpression;
|
|
186
|
-
TemplateHead: TemplateHead;
|
|
187
|
-
TemplateLiteralType: TemplateLiteralTypeNode;
|
|
188
|
-
TemplateLiteralTypeSpan: TemplateLiteralTypeSpan;
|
|
189
|
-
TemplateMiddle: TemplateMiddle;
|
|
190
|
-
TemplateSpan: TemplateSpan;
|
|
191
|
-
TemplateTail: TemplateTail;
|
|
192
|
-
ThisKeyword: ThisExpression;
|
|
193
|
-
ThisType: ThisTypeNode;
|
|
194
|
-
ThrowStatement: ThrowStatement;
|
|
195
|
-
TrueKeyword: TrueLiteral;
|
|
196
|
-
TryStatement: TryStatement;
|
|
197
|
-
TupleType: TupleTypeNode;
|
|
198
|
-
TypeAliasDeclaration: TypeAliasDeclaration;
|
|
199
|
-
TypeAssertionExpression: TypeAssertion;
|
|
200
|
-
TypeLiteral: TypeLiteralNode;
|
|
201
|
-
TypeOfExpression: TypeOfExpression;
|
|
202
|
-
TypeOperator: TypeOperatorNode;
|
|
203
|
-
TypeParameter: TypeParameterDeclaration;
|
|
204
|
-
TypePredicate: TypePredicateNode;
|
|
205
|
-
TypeQuery: TypeQueryNode;
|
|
206
|
-
TypeReference: TypeReferenceNode;
|
|
207
|
-
UndefinedKeyword: UndefinedKeyword;
|
|
208
|
-
UnionType: UnionTypeNode;
|
|
209
|
-
UnknownKeyword: UnknownKeyword;
|
|
210
|
-
VariableDeclaration: VariableDeclaration;
|
|
211
|
-
VariableDeclarationList: VariableDeclarationList;
|
|
212
|
-
VariableStatement: VariableStatement;
|
|
213
|
-
VoidExpression: VoidExpression;
|
|
214
|
-
VoidKeyword: VoidKeyword;
|
|
215
|
-
WhileStatement: WhileStatement;
|
|
216
|
-
WithStatement: WithStatement;
|
|
217
|
-
YieldExpression: YieldExpression;
|
|
218
|
-
"AnyKeyword:exit": AnyKeyword;
|
|
219
|
-
"ArrayBindingPattern:exit": ArrayBindingPattern;
|
|
220
|
-
"ArrayLiteralExpression:exit": ArrayLiteralExpression;
|
|
221
|
-
"ArrayType:exit": ArrayTypeNode;
|
|
222
|
-
"ArrowFunction:exit": ArrowFunction;
|
|
223
|
-
"AsExpression:exit": AsExpression;
|
|
224
|
-
"AwaitExpression:exit": AwaitExpression;
|
|
225
|
-
"BigIntKeyword:exit": BigIntKeyword;
|
|
226
|
-
"BigIntLiteral:exit": BigIntLiteral;
|
|
227
|
-
"BinaryExpression:exit": BinaryExpression;
|
|
228
|
-
"BindingElement:exit": BindingElement;
|
|
229
|
-
"Block:exit": Block;
|
|
230
|
-
"BooleanKeyword:exit": BooleanKeyword;
|
|
231
|
-
"BreakStatement:exit": BreakStatement;
|
|
232
|
-
"CallExpression:exit": CallExpression;
|
|
233
|
-
"CallSignature:exit": CallSignatureDeclaration;
|
|
234
|
-
"CaseBlock:exit": CaseBlock;
|
|
235
|
-
"CaseClause:exit": CaseClause;
|
|
236
|
-
"CatchClause:exit": CatchClause;
|
|
237
|
-
"ClassDeclaration:exit": ClassDeclaration;
|
|
238
|
-
"ClassExpression:exit": ClassExpression;
|
|
239
|
-
"ClassStaticBlockDeclaration:exit": ClassStaticBlockDeclaration;
|
|
240
|
-
"CommaListExpression:exit": CommaListExpression;
|
|
241
|
-
"ComputedPropertyName:exit": ComputedPropertyName;
|
|
242
|
-
"ConditionalExpression:exit": ConditionalExpression;
|
|
243
|
-
"ConditionalType:exit": ConditionalTypeNode;
|
|
244
|
-
"Constructor:exit": ConstructorDeclaration;
|
|
245
|
-
"ConstructorType:exit": ConstructorTypeNode;
|
|
246
|
-
"ConstructSignature:exit": ConstructSignatureDeclaration;
|
|
247
|
-
"ContinueStatement:exit": ContinueStatement;
|
|
248
|
-
"DebuggerStatement:exit": DebuggerStatement;
|
|
249
|
-
"Decorator:exit": Decorator;
|
|
250
|
-
"DefaultClause:exit": DefaultClause;
|
|
251
|
-
"DeleteExpression:exit": DeleteExpression;
|
|
252
|
-
"DoStatement:exit": DoStatement;
|
|
253
|
-
"ElementAccessExpression:exit": ElementAccessExpression;
|
|
254
|
-
"EmptyStatement:exit": EmptyStatement;
|
|
255
|
-
"EnumDeclaration:exit": EnumDeclaration;
|
|
256
|
-
"EnumMember:exit": EnumMember;
|
|
257
|
-
"ExportAssignment:exit": ExportAssignment;
|
|
258
|
-
"ExportDeclaration:exit": ExportDeclaration;
|
|
259
|
-
"ExportSpecifier:exit": ExportSpecifier;
|
|
260
|
-
"ExpressionStatement:exit": ExpressionStatement;
|
|
261
|
-
"ExpressionWithTypeArguments:exit": ExpressionWithTypeArguments;
|
|
262
|
-
"ExternalModuleReference:exit": ExternalModuleReference;
|
|
263
|
-
"FalseKeyword:exit": FalseLiteral;
|
|
264
|
-
"ForInStatement:exit": ForInStatement;
|
|
265
|
-
"ForOfStatement:exit": ForOfStatement;
|
|
266
|
-
"ForStatement:exit": ForStatement;
|
|
267
|
-
"FunctionDeclaration:exit": FunctionDeclaration;
|
|
268
|
-
"FunctionExpression:exit": FunctionExpression;
|
|
269
|
-
"FunctionType:exit": FunctionTypeNode;
|
|
270
|
-
"GetAccessor:exit": GetAccessorDeclaration;
|
|
271
|
-
"HeritageClause:exit": HeritageClause;
|
|
272
|
-
"Identifier:exit": Identifier;
|
|
273
|
-
"IfStatement:exit": IfStatement;
|
|
274
|
-
"ImportAttribute:exit": ImportAttribute;
|
|
275
|
-
"ImportAttributes:exit": ImportAttributes;
|
|
276
|
-
"ImportClause:exit": ImportClause;
|
|
277
|
-
"ImportDeclaration:exit": ImportDeclaration;
|
|
278
|
-
"ImportEqualsDeclaration:exit": ImportEqualsDeclaration;
|
|
279
|
-
"ImportKeyword:exit": ImportExpression;
|
|
280
|
-
"ImportSpecifier:exit": ImportSpecifier;
|
|
281
|
-
"ImportType:exit": ImportTypeNode;
|
|
282
|
-
"IndexedAccessType:exit": IndexedAccessTypeNode;
|
|
283
|
-
"IndexSignature:exit": IndexSignatureDeclaration;
|
|
284
|
-
"InferType:exit": InferTypeNode;
|
|
285
|
-
"InterfaceDeclaration:exit": InterfaceDeclaration;
|
|
286
|
-
"IntersectionType:exit": IntersectionTypeNode;
|
|
287
|
-
"IntrinsicKeyword:exit": IntrinsicKeyword;
|
|
288
|
-
"JSDocAllType:exit": JSDocAllType;
|
|
289
|
-
"JSDocFunctionType:exit": JSDocFunctionType;
|
|
290
|
-
"JSDocLink:exit": JSDocLink;
|
|
291
|
-
"JSDocLinkCode:exit": JSDocLinkCode;
|
|
292
|
-
"JSDocLinkPlain:exit": JSDocLinkPlain;
|
|
293
|
-
"JSDocMemberName:exit": JSDocMemberName;
|
|
294
|
-
"JSDocNamepathType:exit": JSDocNamepathType;
|
|
295
|
-
"JSDocNonNullableType:exit": JSDocNonNullableType;
|
|
296
|
-
"JSDocNullableType:exit": JSDocNullableType;
|
|
297
|
-
"JSDocOptionalType:exit": JSDocOptionalType;
|
|
298
|
-
"JSDocParameterTag:exit": JSDocParameterTag;
|
|
299
|
-
"JSDocPropertyTag:exit": JSDocPropertyTag;
|
|
300
|
-
"JSDocReturnTag:exit": JSDocReturnTag;
|
|
301
|
-
"JSDocSignature:exit": JSDocSignature;
|
|
302
|
-
"JSDocTemplateTag:exit": JSDocTemplateTag;
|
|
303
|
-
"JSDocText:exit": JSDocText;
|
|
304
|
-
"JSDocTypeExpression:exit": JSDocTypeExpression;
|
|
305
|
-
"JSDocTypeLiteral:exit": JSDocTypeLiteral;
|
|
306
|
-
"JSDocUnknownType:exit": JSDocUnknownType;
|
|
307
|
-
"JSDocVariadicType:exit": JSDocVariadicType;
|
|
308
|
-
"JsxAttribute:exit": JsxAttribute;
|
|
309
|
-
"JsxAttributes:exit": JsxAttributes;
|
|
310
|
-
"JsxClosingElement:exit": JsxClosingElement;
|
|
311
|
-
"JsxClosingFragment:exit": JsxClosingFragment;
|
|
312
|
-
"JsxElement:exit": JsxElement;
|
|
313
|
-
"JsxExpression:exit": JsxExpression;
|
|
314
|
-
"JsxFragment:exit": JsxFragment;
|
|
315
|
-
"JsxNamespacedName:exit": JsxNamespacedName;
|
|
316
|
-
"JsxOpeningElement:exit": JsxOpeningElement;
|
|
317
|
-
"JsxOpeningFragment:exit": JsxOpeningFragment;
|
|
318
|
-
"JsxSelfClosingElement:exit": JsxSelfClosingElement;
|
|
319
|
-
"JsxSpreadAttribute:exit": JsxSpreadAttribute;
|
|
320
|
-
"JsxText:exit": JsxText;
|
|
321
|
-
"LabeledStatement:exit": LabeledStatement;
|
|
322
|
-
"LiteralType:exit": LiteralTypeNode;
|
|
323
|
-
"MappedType:exit": MappedTypeNode;
|
|
324
|
-
"MetaProperty:exit": MetaProperty;
|
|
325
|
-
"MethodDeclaration:exit": MethodDeclaration;
|
|
326
|
-
"MethodSignature:exit": MethodSignature;
|
|
327
|
-
"MissingDeclaration:exit": MissingDeclaration;
|
|
328
|
-
"ModuleBlock:exit": ModuleBlock;
|
|
329
|
-
"ModuleDeclaration:exit": ModuleDeclaration;
|
|
330
|
-
"NamedExports:exit": NamedExports;
|
|
331
|
-
"NamedImports:exit": NamedImports;
|
|
332
|
-
"NamedTupleMember:exit": NamedTupleMember;
|
|
333
|
-
"NamespaceExport:exit": NamespaceExport;
|
|
334
|
-
"NamespaceExportDeclaration:exit": NamespaceExportDeclaration;
|
|
335
|
-
"NamespaceImport:exit": NamespaceImport;
|
|
336
|
-
"NeverKeyword:exit": NeverKeyword;
|
|
337
|
-
"NewExpression:exit": NewExpression;
|
|
338
|
-
"NonNullExpression:exit": NonNullExpression;
|
|
339
|
-
"NoSubstitutionTemplateLiteral:exit": NoSubstitutionTemplateLiteral;
|
|
340
|
-
"NotEmittedStatement:exit": NotEmittedStatement;
|
|
341
|
-
"NotEmittedTypeElement:exit": NotEmittedTypeElement;
|
|
342
|
-
"NullKeyword:exit": NullLiteral;
|
|
343
|
-
"NumberKeyword:exit": NumberKeyword;
|
|
344
|
-
"NumericLiteral:exit": NumericLiteral;
|
|
345
|
-
"ObjectBindingPattern:exit": ObjectBindingPattern;
|
|
346
|
-
"ObjectKeyword:exit": ObjectKeyword;
|
|
347
|
-
"ObjectLiteralExpression:exit": ObjectLiteralExpression;
|
|
348
|
-
"OmittedExpression:exit": OmittedExpression;
|
|
349
|
-
"OptionalType:exit": OptionalTypeNode;
|
|
350
|
-
"Parameter:exit": ParameterDeclaration;
|
|
351
|
-
"ParenthesizedExpression:exit": ParenthesizedExpression;
|
|
352
|
-
"ParenthesizedType:exit": ParenthesizedTypeNode;
|
|
353
|
-
"PartiallyEmittedExpression:exit": PartiallyEmittedExpression;
|
|
354
|
-
"PostfixUnaryExpression:exit": PostfixUnaryExpression;
|
|
355
|
-
"PrefixUnaryExpression:exit": PrefixUnaryExpression;
|
|
356
|
-
"PrivateIdentifier:exit": PrivateIdentifier;
|
|
357
|
-
"PropertyAccessExpression:exit": PropertyAccessExpression;
|
|
358
|
-
"PropertyAssignment:exit": PropertyAssignment;
|
|
359
|
-
"PropertyDeclaration:exit": PropertyDeclaration;
|
|
360
|
-
"PropertySignature:exit": PropertySignature;
|
|
361
|
-
"QualifiedName:exit": QualifiedName;
|
|
362
|
-
"RegularExpressionLiteral:exit": RegularExpressionLiteral;
|
|
363
|
-
"RestType:exit": RestTypeNode;
|
|
364
|
-
"ReturnStatement:exit": ReturnStatement;
|
|
365
|
-
"SatisfiesExpression:exit": SatisfiesExpression;
|
|
366
|
-
"SemicolonClassElement:exit": SemicolonClassElement;
|
|
367
|
-
"SetAccessor:exit": SetAccessorDeclaration;
|
|
368
|
-
"ShorthandPropertyAssignment:exit": ShorthandPropertyAssignment;
|
|
369
|
-
"SourceFile:exit": SourceFile;
|
|
370
|
-
"SpreadAssignment:exit": SpreadAssignment;
|
|
371
|
-
"SpreadElement:exit": SpreadElement;
|
|
372
|
-
"StringKeyword:exit": StringKeyword;
|
|
373
|
-
"StringLiteral:exit": StringLiteral;
|
|
374
|
-
"SuperKeyword:exit": SuperExpression;
|
|
375
|
-
"SwitchStatement:exit": SwitchStatement;
|
|
376
|
-
"SymbolKeyword:exit": SymbolKeyword;
|
|
377
|
-
"SyntheticExpression:exit": SyntheticExpression;
|
|
378
|
-
"TaggedTemplateExpression:exit": TaggedTemplateExpression;
|
|
379
|
-
"TemplateExpression:exit": TemplateExpression;
|
|
380
|
-
"TemplateHead:exit": TemplateHead;
|
|
381
|
-
"TemplateLiteralType:exit": TemplateLiteralTypeNode;
|
|
382
|
-
"TemplateLiteralTypeSpan:exit": TemplateLiteralTypeSpan;
|
|
383
|
-
"TemplateMiddle:exit": TemplateMiddle;
|
|
384
|
-
"TemplateSpan:exit": TemplateSpan;
|
|
385
|
-
"TemplateTail:exit": TemplateTail;
|
|
386
|
-
"ThisKeyword:exit": ThisExpression;
|
|
387
|
-
"ThisType:exit": ThisTypeNode;
|
|
388
|
-
"ThrowStatement:exit": ThrowStatement;
|
|
389
|
-
"TrueKeyword:exit": TrueLiteral;
|
|
390
|
-
"TryStatement:exit": TryStatement;
|
|
391
|
-
"TupleType:exit": TupleTypeNode;
|
|
392
|
-
"TypeAliasDeclaration:exit": TypeAliasDeclaration;
|
|
393
|
-
"TypeAssertionExpression:exit": TypeAssertion;
|
|
394
|
-
"TypeLiteral:exit": TypeLiteralNode;
|
|
395
|
-
"TypeOfExpression:exit": TypeOfExpression;
|
|
396
|
-
"TypeOperator:exit": TypeOperatorNode;
|
|
397
|
-
"TypeParameter:exit": TypeParameterDeclaration;
|
|
398
|
-
"TypePredicate:exit": TypePredicateNode;
|
|
399
|
-
"TypeQuery:exit": TypeQueryNode;
|
|
400
|
-
"TypeReference:exit": TypeReferenceNode;
|
|
401
|
-
"UndefinedKeyword:exit": UndefinedKeyword;
|
|
402
|
-
"UnionType:exit": UnionTypeNode;
|
|
403
|
-
"UnknownKeyword:exit": UnknownKeyword;
|
|
404
|
-
"VariableDeclaration:exit": VariableDeclaration;
|
|
405
|
-
"VariableDeclarationList:exit": VariableDeclarationList;
|
|
406
|
-
"VariableStatement:exit": VariableStatement;
|
|
407
|
-
"VoidExpression:exit": VoidExpression;
|
|
408
|
-
"VoidKeyword:exit": VoidKeyword;
|
|
409
|
-
"WhileStatement:exit": WhileStatement;
|
|
410
|
-
"WithStatement:exit": WithStatement;
|
|
411
|
-
"YieldExpression:exit": YieldExpression;
|
|
412
|
-
}, TypeScriptFileServices>;
|
|
413
|
-
declare function throwUnknownLanguageExtension(filename: string): never;
|
|
414
|
-
//#endregion
|
|
415
|
-
export { NodeSyntaxKinds, TypeScriptFileServices, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage };
|
|
416
|
-
//# sourceMappingURL=language.d.ts.map
|
package/lib/language.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { convertTypeScriptDiagnosticToLanguageReport } from "./convertTypeScriptDiagnosticToLanguageReport.js";
|
|
2
|
-
import { parseDirectivesFromTypeScriptFile } from "./directives/parseDirectivesFromTypeScriptFile.js";
|
|
3
|
-
import { name, version } from "./package.js";
|
|
4
|
-
import { createTypeScriptServerHost } from "./createTypeScriptServerHost.js";
|
|
5
|
-
import { getFirstEnumValues } from "./getFirstEnumValues.js";
|
|
6
|
-
import { getTypeScriptFileCacheImpacts } from "./getTypeScriptFileCacheImpacts.js";
|
|
7
|
-
import { orderTypeScriptFilePaths } from "./orderTypeScriptFilePaths.js";
|
|
8
|
-
import * as ts$1 from "typescript";
|
|
9
|
-
import { createLanguage } from "@flint.fyi/core";
|
|
10
|
-
import { assert, nullThrows } from "@flint.fyi/utils";
|
|
11
|
-
import path from "node:path";
|
|
12
|
-
import { createProjectService } from "@typescript-eslint/project-service";
|
|
13
|
-
import { debugForFile } from "debug-for-file";
|
|
14
|
-
//#region src/language.ts
|
|
15
|
-
const log = debugForFile(import.meta.filename);
|
|
16
|
-
const NodeSyntaxKinds = getFirstEnumValues(ts$1.SyntaxKind);
|
|
17
|
-
const stateSymbol = Symbol.for("@flint.fyi/typescript-language/state");
|
|
18
|
-
const globalTyped = globalThis;
|
|
19
|
-
assert(globalTyped[stateSymbol] == null, `Two different versions of ${name} are imported: ${version} and ${globalTyped[stateSymbol]?.packageVersion}`);
|
|
20
|
-
const languageState = globalTyped[stateSymbol] = {
|
|
21
|
-
packageVersion: version,
|
|
22
|
-
volarCreateFile: null
|
|
23
|
-
};
|
|
24
|
-
function setVolarCreateFile(create) {
|
|
25
|
-
assert(languageState.volarCreateFile == null, "setVolarCreateFile is expected to be called only once");
|
|
26
|
-
languageState.volarCreateFile = create;
|
|
27
|
-
}
|
|
28
|
-
const typescriptLanguage = createLanguage({
|
|
29
|
-
about: { name: "TypeScript" },
|
|
30
|
-
createFileFactory: (host) => {
|
|
31
|
-
const { service } = createProjectService({ host: createTypeScriptServerHost(host) });
|
|
32
|
-
function createFile(data) {
|
|
33
|
-
log("Opening client file:", data.filePathAbsolute);
|
|
34
|
-
service.openClientFile(data.filePathAbsolute);
|
|
35
|
-
log("Retrieving client services:", data.filePathAbsolute);
|
|
36
|
-
const scriptInfo = nullThrows(service.getScriptInfo(data.filePathAbsolute), `Could not find script info for file: ${data.filePathAbsolute}`);
|
|
37
|
-
const program = nullThrows(nullThrows(service.getDefaultProjectForFile(scriptInfo.fileName, true), `Could not find default project for file: ${data.filePathAbsolute}`).getLanguageService(true).getProgram(), `Could not retrieve program for file: ${data.filePathAbsolute}`);
|
|
38
|
-
const sourceFile = nullThrows(program.getSourceFile(data.filePathAbsolute), `Could not retrieve source file for: ${data.filePathAbsolute}`);
|
|
39
|
-
const fileExtension = path.extname(data.filePathAbsolute);
|
|
40
|
-
if (typeScriptCoreSupportedExtensions.has(fileExtension)) return {
|
|
41
|
-
...parseDirectivesFromTypeScriptFile(sourceFile),
|
|
42
|
-
about: data,
|
|
43
|
-
language: typescriptLanguage,
|
|
44
|
-
services: {
|
|
45
|
-
program,
|
|
46
|
-
sourceFile,
|
|
47
|
-
typeChecker: program.getTypeChecker()
|
|
48
|
-
},
|
|
49
|
-
[Symbol.dispose]() {
|
|
50
|
-
service.closeClientFile(data.filePathAbsolute);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
if (languageState.volarCreateFile == null) throwUnknownLanguageExtension(data.filePathAbsolute);
|
|
54
|
-
return {
|
|
55
|
-
...languageState.volarCreateFile(data, program, sourceFile),
|
|
56
|
-
[Symbol.dispose]() {
|
|
57
|
-
service.closeClientFile(data.filePathAbsolute);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return { createFile };
|
|
62
|
-
},
|
|
63
|
-
getFileCacheImpacts: getTypeScriptFileCacheImpacts,
|
|
64
|
-
getLanguageReports(file) {
|
|
65
|
-
if ("__volarServices" in file) return file.__volarServices.getLanguageReports();
|
|
66
|
-
return ts$1.getPreEmitDiagnostics(file.services.program, file.services.sourceFile).map(convertTypeScriptDiagnosticToLanguageReport);
|
|
67
|
-
},
|
|
68
|
-
orderFilePaths: orderTypeScriptFilePaths,
|
|
69
|
-
runFileVisitors(file, options, runtime) {
|
|
70
|
-
if (!runtime.visitors) return;
|
|
71
|
-
if ("__volarServices" in file) {
|
|
72
|
-
file.__volarServices.runVisitors(file, options, runtime);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const { visitors } = runtime;
|
|
76
|
-
const visitorServices = {
|
|
77
|
-
options,
|
|
78
|
-
...file.services
|
|
79
|
-
};
|
|
80
|
-
const visit = (node) => {
|
|
81
|
-
const key = NodeSyntaxKinds[node.kind];
|
|
82
|
-
visitors[key]?.(node, visitorServices);
|
|
83
|
-
node.forEachChild(visit);
|
|
84
|
-
visitors[`${key}:exit`]?.(node, visitorServices);
|
|
85
|
-
};
|
|
86
|
-
visit(file.services.sourceFile);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const typeScriptCoreSupportedExtensions = new Set([
|
|
90
|
-
".cjs",
|
|
91
|
-
".cts",
|
|
92
|
-
".d.cts",
|
|
93
|
-
".d.mts",
|
|
94
|
-
".d.ts",
|
|
95
|
-
".js",
|
|
96
|
-
".json",
|
|
97
|
-
".jsx",
|
|
98
|
-
".mjs",
|
|
99
|
-
".mts",
|
|
100
|
-
".ts",
|
|
101
|
-
".tsx"
|
|
102
|
-
]);
|
|
103
|
-
const fileExtToFlintPlugin = {
|
|
104
|
-
".astro": "@flint.fyi/astro",
|
|
105
|
-
".gjs": "@flint.fyi/ember",
|
|
106
|
-
".gts": "@flint.fyi/ember",
|
|
107
|
-
".mdx": "@flint.fyi/mdx",
|
|
108
|
-
".svelte": "@flint.fyi/svelte",
|
|
109
|
-
".vue": "@flint.fyi/vue"
|
|
110
|
-
};
|
|
111
|
-
function throwUnknownLanguageExtension(filename) {
|
|
112
|
-
const pluginName = fileExtToFlintPlugin[path.extname(filename)];
|
|
113
|
-
const message = pluginName ? `Did you install & import ${pluginName}?` : "Unknown extension.";
|
|
114
|
-
throw new Error(`Cannot process ${filename}. ${message}`);
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
export { NodeSyntaxKinds, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage };
|
|
118
|
-
|
|
119
|
-
//# sourceMappingURL=language.js.map
|