@flint.fyi/typescript-language 0.20.0 → 0.21.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/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
1
  import * as ts$1 from "typescript";
2
- import ts, { CallLikeExpression, Declaration, Node, Program, Signature, TupleTypeReference, Type, TypeChecker, TypeReference } from "typescript";
3
- import { AnyOptionalSchema, CharacterReportRange, FileAboutData, InferredOutputObject, LanguageFile, LanguageFileDefinition, LanguageReport, LanguageReports, NormalizedReportRangeObject, RuleRuntime, SourceFileWithLineMapAndFileName, WithExitKeys } from "@flint.fyi/core";
4
-
5
- //#region \0rolldown/runtime.js
2
+ import ts, { CallLikeExpression, Declaration, Node, Program, Signature, SyntaxKind, TupleTypeReference, Type, TypeChecker, TypeReference } from "typescript";
3
+ import { CharacterReportRange, FileAboutData, FileVisitorSubscription, FileVisitors, Language, LanguageFileDefinition, LanguageReport, LanguageReports, NormalizedReportRangeObject, SourceFileWithLineMapAndFileName, WithExitKeys } from "@flint.fyi/core";
6
4
  //#endregion
7
5
  //#region src/convertTypeScriptDiagnosticToLanguageReport.d.ts
8
6
  interface TSDiagnostic extends TSDiagnosticRelatedInformation {
@@ -15,7 +13,7 @@ interface TSDiagnosticRelatedInformation {
15
13
  messageText: string | ts.DiagnosticMessageChain;
16
14
  start: number | undefined;
17
15
  }
18
- declare function convertTypeScriptDiagnosticToLanguageReport(diagnostic: TSDiagnostic): LanguageReport;
16
+ export declare function convertTypeScriptDiagnosticToLanguageReport(diagnostic: TSDiagnostic): LanguageReport;
19
17
  declare namespace ast_d_exports {
20
18
  export { AbstractKeyword, AccessorDeclaration, AccessorKeyword, AdditiveOperator, AdditiveOperatorOrHigher, AnyKeyword, AnyNode, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertsKeyword, AssignmentOperator, AssignmentOperatorOrHigher, AsteriskToken, AsyncKeyword, AwaitExpression, AwaitKeyword, BigIntKeyword, BigIntLiteral, BinaryExpression, BinaryOperator, BinaryOperatorToken, BindingElement, BindingName, BindingPattern, BitwiseOperator, BitwiseOperatorOrHigher, Block, BooleanKeyword, BooleanLiteral, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassElement, ClassExpression, ClassStaticBlockDeclaration, ColonToken, CommaListExpression, CompoundAssignmentOperator, ComputedPropertyName, ConciseBody, ConditionalExpression, ConditionalTypeNode, ConstKeyword, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, DebuggerStatement, DeclarationStatement, DeclareKeyword, Decorator, DefaultClause, DefaultKeyword, DeleteExpression, DoStatement, DotDotDotToken, ElementAccessExpression, EmptyStatement, EntityName, EnumDeclaration, EnumMember, EqualityOperator, EqualityOperatorOrHigher, EqualsGreaterThanToken, EqualsToken, ExclamationToken, ExponentiationOperator, ExportAssignment, ExportDeclaration, ExportKeyword, ExportSpecifier, Expression, ExpressionParent, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, FalseLiteral, ForInStatement, ForInitializer, ForOfStatement, ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, FunctionOrConstructorTypeNodeBase, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributeName, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportExpression, ImportPhaseModifierSyntaxKind, ImportSpecifier, ImportTypeNode, InKeyword, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, IntrinsicKeyword, IterationStatement, JSDocAllType, JSDocComment, JSDocFunctionType, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, JSDocNamespaceBody, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocParameterTag, JSDocPropertyLikeTag, JSDocPropertyTag, JSDocReturnTag, JSDocSignature, JSDocTemplateTag, JSDocText, JSDocType, JSDocTypeExpression, JSDocTypeLiteral, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, JsxAttributeName, JsxAttributeValue, JsxAttributes, JsxChild, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxTagNameExpression, JsxTagNamePropertyAccess, JsxText, LabeledStatement, LeftHandSideExpression, LeftHandSideExpressionParent, LiteralExpression, LiteralTypeNode, LogicalOperator, LogicalOperatorOrHigher, MappedTypeNode, MemberExpression, MemberName, MetaProperty, MethodDeclaration, MethodSignature, MinusToken, MissingDeclaration, Modifier, ModifierLike, ModifierParent, ModuleBlock, ModuleBody, ModuleDeclaration, ModuleExportName, ModuleName, ModuleReference, MultiplicativeOperator, MultiplicativeOperatorOrHigher, NamedExportBindings, NamedExports, NamedImportBindings, NamedImports, NamedTupleMember, NamespaceBody, NamespaceDeclaration, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NeverKeyword, NewExpression, NoSubstitutionTemplateLiteral, NodeWithTypeArguments, NonNullExpression, NotEmittedStatement, NotEmittedTypeElement, NullLiteral, NumberKeyword, NumericLiteral, ObjectBindingPattern, ObjectKeyword, ObjectLiteralElementLike, ObjectLiteralExpression, ObjectLiteralExpressionBase, OmittedExpression, OptionalTypeNode, OutKeyword, OverrideKeyword, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, PrefixUnaryExpression, PrefixUnaryOperator, PrimaryExpression, PrivateIdentifier, PrivateKeyword, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, PropertySignature, ProtectedKeyword, PublicKeyword, QualifiedName, QuestionDotToken, QuestionToken, ReadonlyKeyword, RegularExpressionLiteral, RelationalOperator, RelationalOperatorOrHigher, RestTypeNode, ReturnStatement, SatisfiesExpression, SemicolonClassElement, SetAccessorDeclaration, ShiftOperator, ShiftOperatorOrHigher, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, Statement, StatementParent, StaticKeyword, StringKeyword, StringLiteral, SuperExpression, SwitchStatement, SymbolKeyword, SyntheticExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteral, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, ThisExpression, ThisTypeNode, ThrowStatement, TrueLiteral, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeElement, TypeLiteralNode, TypeNode, TypeNodeParent, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnaryExpression, UndefinedKeyword, UnionTypeNode, UnknownKeyword, UpdateExpression, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, VoidKeyword, WhileStatement, WithStatement, YieldExpression };
21
19
  }
@@ -2082,216 +2080,6 @@ type ModifierParent = AccessorDeclaration | ArrowFunction | ClassDeclaration | C
2082
2080
  type StatementParent = Block | CaseOrDefaultClause | IfStatement | IterationStatement | LabeledStatement | ModuleBlock | SourceFile | WithStatement;
2083
2081
  type TypeNodeParent = AccessorDeclaration | ArrayTypeNode | ArrowFunction | AsExpression | CallExpression | CallSignatureDeclaration | ConditionalTypeNode | ConstructorDeclaration | ConstructSignatureDeclaration | FunctionDeclaration | FunctionExpression | FunctionOrConstructorTypeNodeBase | IndexedAccessTypeNode | IndexSignatureDeclaration | IntersectionTypeNode | JSDocFunctionType | JSDocNamepathType | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocTypeExpression | JSDocVariadicType | JsxOpeningElement | JsxSelfClosingElement | MappedTypeNode | MethodDeclaration | MethodSignature | NamedTupleMember | NewExpression | NodeWithTypeArguments | OptionalTypeNode | ParameterDeclaration | ParenthesizedTypeNode | PropertyDeclaration | PropertySignature | RestTypeNode | SatisfiesExpression | TaggedTemplateExpression | TemplateLiteralTypeSpan | TupleTypeNode | TypeAliasDeclaration | TypeAssertion | TypeOperatorNode | TypeParameterDeclaration | TypePredicateNode | UnionTypeNode | VariableDeclaration;
2084
2082
  //#endregion
2085
- //#region src/directives/parseDirectivesFromTypeScriptFile.d.ts
2086
- interface ExtractedDirective {
2087
- range: NormalizedReportRangeObject;
2088
- selection: string;
2089
- type: string;
2090
- }
2091
- declare function extractDirectivesFromTypeScriptFile(sourceFile: SourceFile): ExtractedDirective[];
2092
- //#endregion
2093
- //#region src/getTSNodeRange.d.ts
2094
- declare function getTSNodeRange(node: ts$1.Node, sourceFile: SourceFile): CharacterReportRange;
2095
- //#endregion
2096
- //#region src/nodes.d.ts
2097
- interface TypeScriptNodesByName {
2098
- AnyKeyword: AnyKeyword;
2099
- ArrayBindingPattern: ArrayBindingPattern;
2100
- ArrayLiteralExpression: ArrayLiteralExpression;
2101
- ArrayType: ArrayTypeNode;
2102
- ArrowFunction: ArrowFunction;
2103
- AsExpression: AsExpression;
2104
- AwaitExpression: AwaitExpression;
2105
- BigIntKeyword: BigIntKeyword;
2106
- BigIntLiteral: BigIntLiteral;
2107
- BinaryExpression: BinaryExpression;
2108
- BindingElement: BindingElement;
2109
- Block: Block;
2110
- BooleanKeyword: BooleanKeyword;
2111
- BreakStatement: BreakStatement;
2112
- CallExpression: CallExpression;
2113
- CallSignature: CallSignatureDeclaration;
2114
- CaseBlock: CaseBlock;
2115
- CaseClause: CaseClause;
2116
- CatchClause: CatchClause;
2117
- ClassDeclaration: ClassDeclaration;
2118
- ClassExpression: ClassExpression;
2119
- ClassStaticBlockDeclaration: ClassStaticBlockDeclaration;
2120
- CommaListExpression: CommaListExpression;
2121
- ComputedPropertyName: ComputedPropertyName;
2122
- ConditionalExpression: ConditionalExpression;
2123
- ConditionalType: ConditionalTypeNode;
2124
- Constructor: ConstructorDeclaration;
2125
- ConstructorType: ConstructorTypeNode;
2126
- ConstructSignature: ConstructSignatureDeclaration;
2127
- ContinueStatement: ContinueStatement;
2128
- DebuggerStatement: DebuggerStatement;
2129
- Decorator: Decorator;
2130
- DefaultClause: DefaultClause;
2131
- DeleteExpression: DeleteExpression;
2132
- DoStatement: DoStatement;
2133
- ElementAccessExpression: ElementAccessExpression;
2134
- EmptyStatement: EmptyStatement;
2135
- EnumDeclaration: EnumDeclaration;
2136
- EnumMember: EnumMember;
2137
- ExportAssignment: ExportAssignment;
2138
- ExportDeclaration: ExportDeclaration;
2139
- ExportSpecifier: ExportSpecifier;
2140
- ExpressionStatement: ExpressionStatement;
2141
- ExpressionWithTypeArguments: ExpressionWithTypeArguments;
2142
- ExternalModuleReference: ExternalModuleReference;
2143
- FalseKeyword: FalseLiteral;
2144
- ForInStatement: ForInStatement;
2145
- ForOfStatement: ForOfStatement;
2146
- ForStatement: ForStatement;
2147
- FunctionDeclaration: FunctionDeclaration;
2148
- FunctionExpression: FunctionExpression;
2149
- FunctionType: FunctionTypeNode;
2150
- GetAccessor: GetAccessorDeclaration;
2151
- HeritageClause: HeritageClause;
2152
- Identifier: Identifier;
2153
- IfStatement: IfStatement;
2154
- ImportAttribute: ImportAttribute;
2155
- ImportAttributes: ImportAttributes;
2156
- ImportClause: ImportClause;
2157
- ImportDeclaration: ImportDeclaration;
2158
- ImportEqualsDeclaration: ImportEqualsDeclaration;
2159
- ImportKeyword: ImportExpression;
2160
- ImportSpecifier: ImportSpecifier;
2161
- ImportType: ImportTypeNode;
2162
- IndexedAccessType: IndexedAccessTypeNode;
2163
- IndexSignature: IndexSignatureDeclaration;
2164
- InferType: InferTypeNode;
2165
- InterfaceDeclaration: InterfaceDeclaration;
2166
- IntersectionType: IntersectionTypeNode;
2167
- IntrinsicKeyword: IntrinsicKeyword;
2168
- JSDocAllType: JSDocAllType;
2169
- JSDocFunctionType: JSDocFunctionType;
2170
- JSDocLink: JSDocLink;
2171
- JSDocLinkCode: JSDocLinkCode;
2172
- JSDocLinkPlain: JSDocLinkPlain;
2173
- JSDocMemberName: JSDocMemberName;
2174
- JSDocNamepathType: JSDocNamepathType;
2175
- JSDocNonNullableType: JSDocNonNullableType;
2176
- JSDocNullableType: JSDocNullableType;
2177
- JSDocOptionalType: JSDocOptionalType;
2178
- JSDocParameterTag: JSDocParameterTag;
2179
- JSDocPropertyTag: JSDocPropertyTag;
2180
- JSDocReturnTag: JSDocReturnTag;
2181
- JSDocSignature: JSDocSignature;
2182
- JSDocTemplateTag: JSDocTemplateTag;
2183
- JSDocText: JSDocText;
2184
- JSDocTypeExpression: JSDocTypeExpression;
2185
- JSDocTypeLiteral: JSDocTypeLiteral;
2186
- JSDocUnknownType: JSDocUnknownType;
2187
- JSDocVariadicType: JSDocVariadicType;
2188
- JsxAttribute: JsxAttribute;
2189
- JsxAttributes: JsxAttributes;
2190
- JsxClosingElement: JsxClosingElement;
2191
- JsxClosingFragment: JsxClosingFragment;
2192
- JsxElement: JsxElement;
2193
- JsxExpression: JsxExpression;
2194
- JsxFragment: JsxFragment;
2195
- JsxNamespacedName: JsxNamespacedName;
2196
- JsxOpeningElement: JsxOpeningElement;
2197
- JsxOpeningFragment: JsxOpeningFragment;
2198
- JsxSelfClosingElement: JsxSelfClosingElement;
2199
- JsxSpreadAttribute: JsxSpreadAttribute;
2200
- JsxText: JsxText;
2201
- LabeledStatement: LabeledStatement;
2202
- LiteralType: LiteralTypeNode;
2203
- MappedType: MappedTypeNode;
2204
- MetaProperty: MetaProperty;
2205
- MethodDeclaration: MethodDeclaration;
2206
- MethodSignature: MethodSignature;
2207
- MissingDeclaration: MissingDeclaration;
2208
- ModuleBlock: ModuleBlock;
2209
- ModuleDeclaration: ModuleDeclaration;
2210
- NamedExports: NamedExports;
2211
- NamedImports: NamedImports;
2212
- NamedTupleMember: NamedTupleMember;
2213
- NamespaceExport: NamespaceExport;
2214
- NamespaceExportDeclaration: NamespaceExportDeclaration;
2215
- NamespaceImport: NamespaceImport;
2216
- NeverKeyword: NeverKeyword;
2217
- NewExpression: NewExpression;
2218
- NonNullExpression: NonNullExpression;
2219
- NoSubstitutionTemplateLiteral: NoSubstitutionTemplateLiteral;
2220
- NotEmittedStatement: NotEmittedStatement;
2221
- NotEmittedTypeElement: NotEmittedTypeElement;
2222
- NullKeyword: NullLiteral;
2223
- NumberKeyword: NumberKeyword;
2224
- NumericLiteral: NumericLiteral;
2225
- ObjectBindingPattern: ObjectBindingPattern;
2226
- ObjectKeyword: ObjectKeyword;
2227
- ObjectLiteralExpression: ObjectLiteralExpression;
2228
- OmittedExpression: OmittedExpression;
2229
- OptionalType: OptionalTypeNode;
2230
- Parameter: ParameterDeclaration;
2231
- ParenthesizedExpression: ParenthesizedExpression;
2232
- ParenthesizedType: ParenthesizedTypeNode;
2233
- PartiallyEmittedExpression: PartiallyEmittedExpression;
2234
- PostfixUnaryExpression: PostfixUnaryExpression;
2235
- PrefixUnaryExpression: PrefixUnaryExpression;
2236
- PrivateIdentifier: PrivateIdentifier;
2237
- PropertyAccessExpression: PropertyAccessExpression;
2238
- PropertyAssignment: PropertyAssignment;
2239
- PropertyDeclaration: PropertyDeclaration;
2240
- PropertySignature: PropertySignature;
2241
- QualifiedName: QualifiedName;
2242
- RegularExpressionLiteral: RegularExpressionLiteral;
2243
- RestType: RestTypeNode;
2244
- ReturnStatement: ReturnStatement;
2245
- SatisfiesExpression: SatisfiesExpression;
2246
- SemicolonClassElement: SemicolonClassElement;
2247
- SetAccessor: SetAccessorDeclaration;
2248
- ShorthandPropertyAssignment: ShorthandPropertyAssignment;
2249
- SourceFile: SourceFile;
2250
- SpreadAssignment: SpreadAssignment;
2251
- SpreadElement: SpreadElement;
2252
- StringKeyword: StringKeyword;
2253
- StringLiteral: StringLiteral;
2254
- SuperKeyword: SuperExpression;
2255
- SwitchStatement: SwitchStatement;
2256
- SymbolKeyword: SymbolKeyword;
2257
- SyntheticExpression: SyntheticExpression;
2258
- TaggedTemplateExpression: TaggedTemplateExpression;
2259
- TemplateExpression: TemplateExpression;
2260
- TemplateHead: TemplateHead;
2261
- TemplateLiteralType: TemplateLiteralTypeNode;
2262
- TemplateLiteralTypeSpan: TemplateLiteralTypeSpan;
2263
- TemplateMiddle: TemplateMiddle;
2264
- TemplateSpan: TemplateSpan;
2265
- TemplateTail: TemplateTail;
2266
- ThisKeyword: ThisExpression;
2267
- ThisType: ThisTypeNode;
2268
- ThrowStatement: ThrowStatement;
2269
- TrueKeyword: TrueLiteral;
2270
- TryStatement: TryStatement;
2271
- TupleType: TupleTypeNode;
2272
- TypeAliasDeclaration: TypeAliasDeclaration;
2273
- TypeAssertionExpression: TypeAssertion;
2274
- TypeLiteral: TypeLiteralNode;
2275
- TypeOfExpression: TypeOfExpression;
2276
- TypeOperator: TypeOperatorNode;
2277
- TypeParameter: TypeParameterDeclaration;
2278
- TypePredicate: TypePredicateNode;
2279
- TypeQuery: TypeQueryNode;
2280
- TypeReference: TypeReferenceNode;
2281
- UndefinedKeyword: UndefinedKeyword;
2282
- UnionType: UnionTypeNode;
2283
- UnknownKeyword: UnknownKeyword;
2284
- VariableDeclaration: VariableDeclaration;
2285
- VariableDeclarationList: VariableDeclarationList;
2286
- VariableStatement: VariableStatement;
2287
- VoidExpression: VoidExpression;
2288
- VoidKeyword: VoidKeyword;
2289
- WhileStatement: WhileStatement;
2290
- WithStatement: WithStatement;
2291
- YieldExpression: YieldExpression;
2292
- }
2293
- type TypeScriptNodeVisitors = WithExitKeys<TypeScriptNodesByName>;
2294
- //#endregion
2295
2083
  //#region src/types/checker.d.ts
2296
2084
  type Checker = CheckerOverrides & Omit<TypeChecker, keyof CheckerOverrides>;
2297
2085
  interface CheckerOverrides {
@@ -2310,22 +2098,48 @@ interface CheckerOverrides {
2310
2098
  getContextualTypeForArgumentAtIndex(node: Node, argIndex: number): Type;
2311
2099
  }
2312
2100
  //#endregion
2313
- //#region src/language.d.ts
2101
+ //#region src/types/services.d.ts
2314
2102
  interface TypeScriptFileServices {
2315
- program: ts.Program;
2103
+ program: Program;
2316
2104
  sourceFile: SourceFile;
2317
2105
  typeChecker: Checker;
2318
2106
  }
2319
- declare const NodeSyntaxKinds: typeof ts.SyntaxKind;
2320
- type VolarCreateFile = (data: FileAboutData, program: ts.Program, sourceFile: SourceFile) => VolarLanguageFileDefinition;
2321
- type VolarLanguageFileDefinition = LanguageFileDefinition<object> & {
2322
- __volarServices: {
2323
- getLanguageReports(): LanguageReports;
2324
- runVisitors(file: LanguageFile<TypeScriptFileServices>, options: InferredOutputObject<AnyOptionalSchema | undefined>, runtime: RuleRuntime<TypeScriptNodeVisitors, TypeScriptFileServices>): void;
2325
- };
2326
- };
2327
- declare function setVolarCreateFile(create: VolarCreateFile): void;
2328
- declare const typescriptLanguage: import("@flint.fyi/core").Language<{
2107
+ //#endregion
2108
+ //#region src/createNodeVisitorsForFile.d.ts
2109
+ /**
2110
+ * All visitor subscriptions for a file, along with the callback to run on them.
2111
+ */
2112
+ interface NodeVisitorsForFile {
2113
+ enter: NodeVisitorSubscriptionsByKind | undefined;
2114
+ exit: NodeVisitorSubscriptionsByKind | undefined;
2115
+ visit: (node: Node) => void;
2116
+ }
2117
+ /**
2118
+ * For each node, the visitor subscriptions that will run when that node is visited.
2119
+ */
2120
+ type NodeVisitorSubscriptions = FileVisitorSubscription<Node, TypeScriptFileServices>[];
2121
+ /**
2122
+ * For each node kind that has visitors registered, its associated subscriptions.
2123
+ */
2124
+ type NodeVisitorSubscriptionsByKind = Partial<Record<SyntaxKind, NodeVisitorSubscriptions>>;
2125
+ /**
2126
+ * Given all rule visitors for a file, collects them into a single {@link NodeVisitorsForFile}.
2127
+ */
2128
+ export declare function createNodeVisitorsForFile(fileVisitors: readonly FileVisitors<object, TypeScriptFileServices>[]): NodeVisitorsForFile | undefined;
2129
+ //#endregion
2130
+ //#region src/directives/parseDirectivesFromTypeScriptFile.d.ts
2131
+ interface ExtractedDirective {
2132
+ range: NormalizedReportRangeObject;
2133
+ selection: string;
2134
+ type: string;
2135
+ }
2136
+ export declare function extractDirectivesFromTypeScriptFile(sourceFile: SourceFile): ExtractedDirective[];
2137
+ //#endregion
2138
+ //#region src/getTSNodeRange.d.ts
2139
+ export declare function getTSNodeRange(node: ts$1.Node, sourceFile: SourceFile): CharacterReportRange;
2140
+ //#endregion
2141
+ //#region src/nodes.d.ts
2142
+ interface TypeScriptNodesByName {
2329
2143
  AnyKeyword: AnyKeyword;
2330
2144
  ArrayBindingPattern: ArrayBindingPattern;
2331
2145
  ArrayLiteralExpression: ArrayLiteralExpression;
@@ -2520,202 +2334,23 @@ declare const typescriptLanguage: import("@flint.fyi/core").Language<{
2520
2334
  WhileStatement: WhileStatement;
2521
2335
  WithStatement: WithStatement;
2522
2336
  YieldExpression: YieldExpression;
2523
- "AnyKeyword:exit": AnyKeyword;
2524
- "ArrayBindingPattern:exit": ArrayBindingPattern;
2525
- "ArrayLiteralExpression:exit": ArrayLiteralExpression;
2526
- "ArrayType:exit": ArrayTypeNode;
2527
- "ArrowFunction:exit": ArrowFunction;
2528
- "AsExpression:exit": AsExpression;
2529
- "AwaitExpression:exit": AwaitExpression;
2530
- "BigIntKeyword:exit": BigIntKeyword;
2531
- "BigIntLiteral:exit": BigIntLiteral;
2532
- "BinaryExpression:exit": BinaryExpression;
2533
- "BindingElement:exit": BindingElement;
2534
- "Block:exit": Block;
2535
- "BooleanKeyword:exit": BooleanKeyword;
2536
- "BreakStatement:exit": BreakStatement;
2537
- "CallExpression:exit": CallExpression;
2538
- "CallSignature:exit": CallSignatureDeclaration;
2539
- "CaseBlock:exit": CaseBlock;
2540
- "CaseClause:exit": CaseClause;
2541
- "CatchClause:exit": CatchClause;
2542
- "ClassDeclaration:exit": ClassDeclaration;
2543
- "ClassExpression:exit": ClassExpression;
2544
- "ClassStaticBlockDeclaration:exit": ClassStaticBlockDeclaration;
2545
- "CommaListExpression:exit": CommaListExpression;
2546
- "ComputedPropertyName:exit": ComputedPropertyName;
2547
- "ConditionalExpression:exit": ConditionalExpression;
2548
- "ConditionalType:exit": ConditionalTypeNode;
2549
- "Constructor:exit": ConstructorDeclaration;
2550
- "ConstructorType:exit": ConstructorTypeNode;
2551
- "ConstructSignature:exit": ConstructSignatureDeclaration;
2552
- "ContinueStatement:exit": ContinueStatement;
2553
- "DebuggerStatement:exit": DebuggerStatement;
2554
- "Decorator:exit": Decorator;
2555
- "DefaultClause:exit": DefaultClause;
2556
- "DeleteExpression:exit": DeleteExpression;
2557
- "DoStatement:exit": DoStatement;
2558
- "ElementAccessExpression:exit": ElementAccessExpression;
2559
- "EmptyStatement:exit": EmptyStatement;
2560
- "EnumDeclaration:exit": EnumDeclaration;
2561
- "EnumMember:exit": EnumMember;
2562
- "ExportAssignment:exit": ExportAssignment;
2563
- "ExportDeclaration:exit": ExportDeclaration;
2564
- "ExportSpecifier:exit": ExportSpecifier;
2565
- "ExpressionStatement:exit": ExpressionStatement;
2566
- "ExpressionWithTypeArguments:exit": ExpressionWithTypeArguments;
2567
- "ExternalModuleReference:exit": ExternalModuleReference;
2568
- "FalseKeyword:exit": FalseLiteral;
2569
- "ForInStatement:exit": ForInStatement;
2570
- "ForOfStatement:exit": ForOfStatement;
2571
- "ForStatement:exit": ForStatement;
2572
- "FunctionDeclaration:exit": FunctionDeclaration;
2573
- "FunctionExpression:exit": FunctionExpression;
2574
- "FunctionType:exit": FunctionTypeNode;
2575
- "GetAccessor:exit": GetAccessorDeclaration;
2576
- "HeritageClause:exit": HeritageClause;
2577
- "Identifier:exit": Identifier;
2578
- "IfStatement:exit": IfStatement;
2579
- "ImportAttribute:exit": ImportAttribute;
2580
- "ImportAttributes:exit": ImportAttributes;
2581
- "ImportClause:exit": ImportClause;
2582
- "ImportDeclaration:exit": ImportDeclaration;
2583
- "ImportEqualsDeclaration:exit": ImportEqualsDeclaration;
2584
- "ImportKeyword:exit": ImportExpression;
2585
- "ImportSpecifier:exit": ImportSpecifier;
2586
- "ImportType:exit": ImportTypeNode;
2587
- "IndexedAccessType:exit": IndexedAccessTypeNode;
2588
- "IndexSignature:exit": IndexSignatureDeclaration;
2589
- "InferType:exit": InferTypeNode;
2590
- "InterfaceDeclaration:exit": InterfaceDeclaration;
2591
- "IntersectionType:exit": IntersectionTypeNode;
2592
- "IntrinsicKeyword:exit": IntrinsicKeyword;
2593
- "JSDocAllType:exit": JSDocAllType;
2594
- "JSDocFunctionType:exit": JSDocFunctionType;
2595
- "JSDocLink:exit": JSDocLink;
2596
- "JSDocLinkCode:exit": JSDocLinkCode;
2597
- "JSDocLinkPlain:exit": JSDocLinkPlain;
2598
- "JSDocMemberName:exit": JSDocMemberName;
2599
- "JSDocNamepathType:exit": JSDocNamepathType;
2600
- "JSDocNonNullableType:exit": JSDocNonNullableType;
2601
- "JSDocNullableType:exit": JSDocNullableType;
2602
- "JSDocOptionalType:exit": JSDocOptionalType;
2603
- "JSDocParameterTag:exit": JSDocParameterTag;
2604
- "JSDocPropertyTag:exit": JSDocPropertyTag;
2605
- "JSDocReturnTag:exit": JSDocReturnTag;
2606
- "JSDocSignature:exit": JSDocSignature;
2607
- "JSDocTemplateTag:exit": JSDocTemplateTag;
2608
- "JSDocText:exit": JSDocText;
2609
- "JSDocTypeExpression:exit": JSDocTypeExpression;
2610
- "JSDocTypeLiteral:exit": JSDocTypeLiteral;
2611
- "JSDocUnknownType:exit": JSDocUnknownType;
2612
- "JSDocVariadicType:exit": JSDocVariadicType;
2613
- "JsxAttribute:exit": JsxAttribute;
2614
- "JsxAttributes:exit": JsxAttributes;
2615
- "JsxClosingElement:exit": JsxClosingElement;
2616
- "JsxClosingFragment:exit": JsxClosingFragment;
2617
- "JsxElement:exit": JsxElement;
2618
- "JsxExpression:exit": JsxExpression;
2619
- "JsxFragment:exit": JsxFragment;
2620
- "JsxNamespacedName:exit": JsxNamespacedName;
2621
- "JsxOpeningElement:exit": JsxOpeningElement;
2622
- "JsxOpeningFragment:exit": JsxOpeningFragment;
2623
- "JsxSelfClosingElement:exit": JsxSelfClosingElement;
2624
- "JsxSpreadAttribute:exit": JsxSpreadAttribute;
2625
- "JsxText:exit": JsxText;
2626
- "LabeledStatement:exit": LabeledStatement;
2627
- "LiteralType:exit": LiteralTypeNode;
2628
- "MappedType:exit": MappedTypeNode;
2629
- "MetaProperty:exit": MetaProperty;
2630
- "MethodDeclaration:exit": MethodDeclaration;
2631
- "MethodSignature:exit": MethodSignature;
2632
- "MissingDeclaration:exit": MissingDeclaration;
2633
- "ModuleBlock:exit": ModuleBlock;
2634
- "ModuleDeclaration:exit": ModuleDeclaration;
2635
- "NamedExports:exit": NamedExports;
2636
- "NamedImports:exit": NamedImports;
2637
- "NamedTupleMember:exit": NamedTupleMember;
2638
- "NamespaceExport:exit": NamespaceExport;
2639
- "NamespaceExportDeclaration:exit": NamespaceExportDeclaration;
2640
- "NamespaceImport:exit": NamespaceImport;
2641
- "NeverKeyword:exit": NeverKeyword;
2642
- "NewExpression:exit": NewExpression;
2643
- "NonNullExpression:exit": NonNullExpression;
2644
- "NoSubstitutionTemplateLiteral:exit": NoSubstitutionTemplateLiteral;
2645
- "NotEmittedStatement:exit": NotEmittedStatement;
2646
- "NotEmittedTypeElement:exit": NotEmittedTypeElement;
2647
- "NullKeyword:exit": NullLiteral;
2648
- "NumberKeyword:exit": NumberKeyword;
2649
- "NumericLiteral:exit": NumericLiteral;
2650
- "ObjectBindingPattern:exit": ObjectBindingPattern;
2651
- "ObjectKeyword:exit": ObjectKeyword;
2652
- "ObjectLiteralExpression:exit": ObjectLiteralExpression;
2653
- "OmittedExpression:exit": OmittedExpression;
2654
- "OptionalType:exit": OptionalTypeNode;
2655
- "Parameter:exit": ParameterDeclaration;
2656
- "ParenthesizedExpression:exit": ParenthesizedExpression;
2657
- "ParenthesizedType:exit": ParenthesizedTypeNode;
2658
- "PartiallyEmittedExpression:exit": PartiallyEmittedExpression;
2659
- "PostfixUnaryExpression:exit": PostfixUnaryExpression;
2660
- "PrefixUnaryExpression:exit": PrefixUnaryExpression;
2661
- "PrivateIdentifier:exit": PrivateIdentifier;
2662
- "PropertyAccessExpression:exit": PropertyAccessExpression;
2663
- "PropertyAssignment:exit": PropertyAssignment;
2664
- "PropertyDeclaration:exit": PropertyDeclaration;
2665
- "PropertySignature:exit": PropertySignature;
2666
- "QualifiedName:exit": QualifiedName;
2667
- "RegularExpressionLiteral:exit": RegularExpressionLiteral;
2668
- "RestType:exit": RestTypeNode;
2669
- "ReturnStatement:exit": ReturnStatement;
2670
- "SatisfiesExpression:exit": SatisfiesExpression;
2671
- "SemicolonClassElement:exit": SemicolonClassElement;
2672
- "SetAccessor:exit": SetAccessorDeclaration;
2673
- "ShorthandPropertyAssignment:exit": ShorthandPropertyAssignment;
2674
- "SourceFile:exit": SourceFile;
2675
- "SpreadAssignment:exit": SpreadAssignment;
2676
- "SpreadElement:exit": SpreadElement;
2677
- "StringKeyword:exit": StringKeyword;
2678
- "StringLiteral:exit": StringLiteral;
2679
- "SuperKeyword:exit": SuperExpression;
2680
- "SwitchStatement:exit": SwitchStatement;
2681
- "SymbolKeyword:exit": SymbolKeyword;
2682
- "SyntheticExpression:exit": SyntheticExpression;
2683
- "TaggedTemplateExpression:exit": TaggedTemplateExpression;
2684
- "TemplateExpression:exit": TemplateExpression;
2685
- "TemplateHead:exit": TemplateHead;
2686
- "TemplateLiteralType:exit": TemplateLiteralTypeNode;
2687
- "TemplateLiteralTypeSpan:exit": TemplateLiteralTypeSpan;
2688
- "TemplateMiddle:exit": TemplateMiddle;
2689
- "TemplateSpan:exit": TemplateSpan;
2690
- "TemplateTail:exit": TemplateTail;
2691
- "ThisKeyword:exit": ThisExpression;
2692
- "ThisType:exit": ThisTypeNode;
2693
- "ThrowStatement:exit": ThrowStatement;
2694
- "TrueKeyword:exit": TrueLiteral;
2695
- "TryStatement:exit": TryStatement;
2696
- "TupleType:exit": TupleTypeNode;
2697
- "TypeAliasDeclaration:exit": TypeAliasDeclaration;
2698
- "TypeAssertionExpression:exit": TypeAssertion;
2699
- "TypeLiteral:exit": TypeLiteralNode;
2700
- "TypeOfExpression:exit": TypeOfExpression;
2701
- "TypeOperator:exit": TypeOperatorNode;
2702
- "TypeParameter:exit": TypeParameterDeclaration;
2703
- "TypePredicate:exit": TypePredicateNode;
2704
- "TypeQuery:exit": TypeQueryNode;
2705
- "TypeReference:exit": TypeReferenceNode;
2706
- "UndefinedKeyword:exit": UndefinedKeyword;
2707
- "UnionType:exit": UnionTypeNode;
2708
- "UnknownKeyword:exit": UnknownKeyword;
2709
- "VariableDeclaration:exit": VariableDeclaration;
2710
- "VariableDeclarationList:exit": VariableDeclarationList;
2711
- "VariableStatement:exit": VariableStatement;
2712
- "VoidExpression:exit": VoidExpression;
2713
- "VoidKeyword:exit": VoidKeyword;
2714
- "WhileStatement:exit": WhileStatement;
2715
- "WithStatement:exit": WithStatement;
2716
- "YieldExpression:exit": YieldExpression;
2717
- }, TypeScriptFileServices>;
2718
- declare function throwUnknownLanguageExtension(filename: string): never;
2337
+ }
2338
+ type TypeScriptNodeVisitors = WithExitKeys<TypeScriptNodesByName>;
2339
+ //#endregion
2340
+ //#region src/language.d.ts
2341
+ type VolarCreateFile = (data: FileAboutData, program: Program, sourceFile: SourceFile) => VolarLanguageFileDefinition;
2342
+ type VolarLanguageFileDefinition = LanguageFileDefinition<TypeScriptFileServices> & {
2343
+ __volarServices: {
2344
+ getLanguageReports(): LanguageReports;
2345
+ runVisitors(fileVisitors: readonly FileVisitors<TypeScriptNodeVisitors, TypeScriptFileServices>[]): void;
2346
+ };
2347
+ };
2348
+ export declare function setVolarCreateFile(create: VolarCreateFile): void;
2349
+ export declare const typescriptLanguage: Language<TypeScriptNodeVisitors, TypeScriptFileServices>;
2350
+ export declare function throwUnknownLanguageExtension(filename: string): never;
2351
+ //#endregion
2352
+ //#region src/nodeSyntaxKinds.d.ts
2353
+ export declare const NodeSyntaxKinds: typeof SyntaxKind;
2719
2354
  //#endregion
2720
2355
  //#region src/scope/types.d.ts
2721
2356
  type FunctionWithParameters = ArrowFunction | ConstructorDeclaration | FunctionDeclaration | FunctionExpression | GetAccessorDeclaration | MethodDeclaration | SetAccessorDeclaration;
@@ -2755,40 +2390,40 @@ interface ScopeVariable {
2755
2390
  }
2756
2391
  //#endregion
2757
2392
  //#region src/scope/scopeManager.d.ts
2758
- declare function getScopeManager(sourceFile: SourceFile): ScopeManager;
2393
+ export declare function getScopeManager(sourceFile: SourceFile): ScopeManager;
2759
2394
  //#endregion
2760
2395
  //#region src/utils/createRuleTesterTSConfig.d.ts
2761
- declare function createRuleTesterTSConfig(defaultCompilerOptions?: Record<string, unknown>): {
2396
+ export declare function createRuleTesterTSConfig(defaultCompilerOptions?: Record<string, unknown>): {
2762
2397
  "tsconfig.base.json": string;
2763
2398
  "tsconfig.json": string;
2764
2399
  };
2765
2400
  //#endregion
2766
2401
  //#region src/utils/declarationIncludesGlobal.d.ts
2767
- declare function declarationIncludesGlobal(declaration: Declaration, program: Program): boolean;
2402
+ export declare function declarationIncludesGlobal(declaration: Declaration, program: Program): boolean;
2768
2403
  //#endregion
2769
2404
  //#region src/utils/forEachChild.d.ts
2770
- declare const forEachChild: <T>(node: AnyNode, cbNode: (node: AnyNode) => T | undefined, cbNodes?: (nodes: ts.NodeArray<AnyNode>) => T | undefined) => T | undefined;
2405
+ export declare const forEachChild: <T>(node: AnyNode, cbNode: (node: AnyNode) => T | undefined, cbNodes?: (nodes: ts.NodeArray<AnyNode>) => T | undefined) => T | undefined;
2771
2406
  //#endregion
2772
2407
  //#region src/utils/getDeclarationsIfGlobal.d.ts
2773
- declare function getDeclarationsIfGlobal(node: Expression, typeChecker: Checker, program: Program): Declaration[] | undefined;
2408
+ export declare function getDeclarationsIfGlobal(node: Expression, typeChecker: Checker, program: Program): Declaration[] | undefined;
2774
2409
  //#endregion
2775
2410
  //#region src/utils/getModifyingReferences.d.ts
2776
2411
  /**
2777
2412
  * Gets all references to a variable that modify it (assignments, increments, decrements).
2778
2413
  * @returns An array of identifier nodes that modify the variable.
2779
2414
  */
2780
- declare function getModifyingReferences(identifier: Identifier, sourceFile: SourceFile): Identifier[];
2415
+ export declare function getModifyingReferences(identifier: Identifier, sourceFile: SourceFile): Identifier[];
2781
2416
  //#endregion
2782
2417
  //#region src/utils/getStaticValue.d.ts
2783
2418
  interface StaticValue {
2784
2419
  value: unknown;
2785
2420
  }
2786
- declare function getStaticNumberValue(node: Expression): number | undefined;
2787
- declare function getStaticStringValue(node: Expression): string | undefined;
2788
- declare function getStaticValue(node: Expression): StaticValue | undefined;
2421
+ export declare function getStaticNumberValue(node: Expression): number | undefined;
2422
+ export declare function getStaticStringValue(node: Expression): string | undefined;
2423
+ export declare function getStaticValue(node: Expression): StaticValue | undefined;
2789
2424
  //#endregion
2790
2425
  //#region src/utils/hasSameTokens.d.ts
2791
- declare function hasSameTokens(nodeA: AnyNode, nodeB: AnyNode, sourceFile: SourceFile): boolean;
2426
+ export declare function hasSameTokens(nodeA: AnyNode, nodeB: AnyNode, sourceFile: SourceFile): boolean;
2792
2427
  //#endregion
2793
2428
  //#region src/utils/isBuiltinArrayMethod.d.ts
2794
2429
  type BuiltInArrayMethodNode = CallExpression & {
@@ -2796,19 +2431,19 @@ type BuiltInArrayMethodNode = CallExpression & {
2796
2431
  expression: ts.Expression;
2797
2432
  };
2798
2433
  };
2799
- declare function isBuiltinArrayMethod(name: string, node: CallExpression, typeChecker: Checker): node is BuiltInArrayMethodNode;
2434
+ export declare function isBuiltinArrayMethod(name: string, node: CallExpression, typeChecker: Checker): node is BuiltInArrayMethodNode;
2800
2435
  //#endregion
2801
2436
  //#region src/utils/isFunction.d.ts
2802
- declare function isFunction(node: Expression, typeChecker: Checker): boolean;
2437
+ export declare function isFunction(node: Expression, typeChecker: Checker): boolean;
2803
2438
  //#endregion
2804
2439
  //#region src/utils/isGlobalDeclaration.d.ts
2805
- declare function isGlobalDeclaration(node: Expression, typeChecker: Checker, program: Program): boolean;
2440
+ export declare function isGlobalDeclaration(node: Expression, typeChecker: Checker, program: Program): boolean;
2806
2441
  //#endregion
2807
2442
  //#region src/utils/isGlobalDeclarationOfName.d.ts
2808
2443
  /**
2809
2444
  * TODO: Use a scope analyzer (#400).
2810
2445
  */
2811
- declare function isGlobalDeclarationOfName(node: Node, name: string, typeChecker: Checker, program: Program): boolean;
2446
+ export declare function isGlobalDeclarationOfName(node: Node, name: string, typeChecker: Checker, program: Program): boolean;
2812
2447
  //#endregion
2813
2448
  //#region src/utils/isGlobalVariable.d.ts
2814
2449
  /**
@@ -2817,7 +2452,7 @@ declare function isGlobalDeclarationOfName(node: Node, name: string, typeChecker
2817
2452
  * like undefined which have symbols but no user-defined declarations.
2818
2453
  * TODO: Use a scope manager (#400).
2819
2454
  */
2820
- declare function isGlobalVariable(node: Expression, typeChecker: Checker, program: Program): boolean;
2455
+ export declare function isGlobalVariable(node: Expression, typeChecker: Checker, program: Program): boolean;
2821
2456
  //#endregion
2822
2457
  //#region src/utils/isInlineArrayCreation.d.ts
2823
2458
  /**
@@ -2825,22 +2460,22 @@ declare function isGlobalVariable(node: Expression, typeChecker: Checker, progra
2825
2460
  * These are cases where a new array is created immediately before the method call,
2826
2461
  * so mutating methods like .sort() or .reverse() are safe to use.
2827
2462
  */
2828
- declare function isInlineArrayCreation(node: ts.Expression): boolean;
2463
+ export declare function isInlineArrayCreation(node: Expression): boolean;
2829
2464
  //#endregion
2830
2465
  //#region src/utils/isStaticString.d.ts
2831
2466
  type StaticString = NoSubstitutionTemplateLiteral | StringLiteral;
2832
- declare function isStaticString(node: Expression): node is StaticString;
2467
+ export declare function isStaticString(node: Expression): node is StaticString;
2833
2468
  //#endregion
2834
2469
  //#region src/utils/isStringRawNoSubstitution.d.ts
2835
2470
  interface StringRawNoSubstitution extends TaggedTemplateExpression {
2836
2471
  template: NoSubstitutionTemplateLiteral;
2837
2472
  }
2838
- declare function isStringRawNoSubstitution(node: Expression): node is StringRawNoSubstitution;
2473
+ export declare function isStringRawNoSubstitution(node: Expression): node is StringRawNoSubstitution;
2839
2474
  //#endregion
2840
2475
  //#region src/utils/unwrapParenthesizedNode.d.ts
2841
- declare function unwrapParenthesizedNode(node: AnyNode): AnyNode;
2476
+ export declare function unwrapParenthesizedNode(node: AnyNode): AnyNode;
2842
2477
  //#endregion
2843
2478
  //#region src/utils/unwrapParentParenthesizedExpressions.d.ts
2844
- declare function unwrapParentParenthesizedExpressions(node: BinaryExpression | ParenthesizedExpression): LeftHandSideExpressionParent;
2479
+ export declare function unwrapParentParenthesizedExpressions(node: BinaryExpression | ParenthesizedExpression): LeftHandSideExpressionParent;
2845
2480
  //#endregion
2846
- export { type ast_d_exports as AST, type BuiltInArrayMethodNode, type Checker, type ExtractedDirective, type FunctionWithParameters, NodeSyntaxKinds, type Scope, type ScopeDefinition, type ScopeDefinitionKind, type ScopeManager, type ScopeReference, type ScopeVariable, type StaticString, type StaticValue, type StringRawNoSubstitution, type TSDiagnostic, type TypeScriptFileServices, type TypeScriptNodeVisitors, type TypeScriptNodesByName, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, forEachChild, getDeclarationsIfGlobal, getModifyingReferences, getScopeManager, getStaticNumberValue, getStaticStringValue, getStaticValue, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, isStaticString, isStringRawNoSubstitution, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
2481
+ export type { ast_d_exports as AST, BuiltInArrayMethodNode, Checker, ExtractedDirective, FunctionWithParameters, NodeVisitorSubscriptions, NodeVisitorsForFile, Scope, ScopeDefinition, ScopeDefinitionKind, ScopeManager, ScopeReference, ScopeVariable, StaticString, StaticValue, StringRawNoSubstitution, TSDiagnostic, TypeScriptFileServices, TypeScriptNodeVisitors, TypeScriptNodesByName };
package/dist/index.mjs CHANGED
@@ -1,14 +1,12 @@
1
- import ts, { SyntaxKind, isClassDeclaration, isFunctionDeclaration, isIdentifier, isInterfaceDeclaration, isPropertySignature, isVariableDeclaration } from "typescript";
2
- import { DirectivesCollector, commonlyIgnoredPaths, createLanguage, getColumnAndLineOfPosition, getPositionOfColumnAndLine } from "@flint.fyi/core";
1
+ import ts, { SyntaxKind, getPreEmitDiagnostics } from "typescript";
2
+ import { DirectivesCollector, commonlyIgnoredPaths, createLanguage, getColumnAndLineOfPosition, getPositionOfColumnAndLine, groupFileVisitors, runFileVisitorSubscriptions } from "@flint.fyi/core";
3
3
  import * as tsutils from "ts-api-utils";
4
4
  import { FlintAssertionError, assert, normalizePath, nullThrows, pathKey } from "@flint.fyi/utils";
5
- import * as path$1 from "node:path";
6
- import path from "node:path";
7
5
  import { createProjectService } from "@typescript-eslint/project-service";
8
6
  import { debugForFile } from "debug-for-file";
7
+ import { dirname, extname, relative, resolve } from "pathe";
9
8
  import fs from "node:fs";
10
9
  import timers from "node:timers";
11
- import { dirname, resolve } from "pathe";
12
10
  import { WeakCachedFactory } from "cached-factory";
13
11
  //#region src/convertTypeScriptDiagnosticToLanguageReport.ts
14
12
  function convertTypeScriptDiagnosticToLanguageReport(diagnostic) {
@@ -119,6 +117,102 @@ function formatLocation(file, start) {
119
117
  return output;
120
118
  }
121
119
  //#endregion
120
+ //#region src/getFirstEnumValues.ts
121
+ /**
122
+ * Removes TypeScript enum values that alias earlier values.
123
+ * @param original Any TypeScript enum with numeric values.
124
+ * @returns A version of the enum with only the first occurrence of each value.
125
+ * @example
126
+ * Given the following enum:
127
+ * ```ts
128
+ * enum Example {
129
+ * A = 1,
130
+ * B = 2,
131
+ * C = A
132
+ * }
133
+ * ```
134
+ * Its original value looks like:
135
+ * ```ts
136
+ * {
137
+ * 1: 'C', // <-- Points to 'C', the alias of 'A'
138
+ * 2: 'B',
139
+ * A: 1,
140
+ * B: 2,
141
+ * C: 1,
142
+ * }
143
+ * ```
144
+ * Calling `getFirstEnumValues(Example)` would return:
145
+ * ```ts
146
+ * {
147
+ * 1: 'A', // <-- Corrected to the original 'A'
148
+ * 2: 'B',
149
+ * A: 1,
150
+ * B: 2,
151
+ * C: 1,
152
+ * }
153
+ * ```
154
+ */
155
+ function getFirstEnumValues(original) {
156
+ const result = {};
157
+ for (const key in original) {
158
+ if (typeof original[key] !== "number") continue;
159
+ if (!(key in result)) result[key] = original[key];
160
+ if (!(original[key] in result)) result[original[key]] = key;
161
+ }
162
+ return result;
163
+ }
164
+ //#endregion
165
+ //#region src/nodeSyntaxKinds.ts
166
+ const NodeSyntaxKinds = getFirstEnumValues(SyntaxKind);
167
+ //#endregion
168
+ //#region src/createNodeVisitorsForFile.ts
169
+ /**
170
+ * Given all rule visitors for a file, collects them into a single {@link NodeVisitorsForFile}.
171
+ */
172
+ function createNodeVisitorsForFile(fileVisitors) {
173
+ const grouped = groupFileVisitors(fileVisitors);
174
+ const enter = grouped.enter && createSubscriptionsByKind(grouped.enter);
175
+ const exit = grouped.exit && createSubscriptionsByKind(grouped.exit);
176
+ if (enter) {
177
+ const visit = exit ? (node) => {
178
+ const entering = enter[node.kind];
179
+ if (entering !== void 0) runFileVisitorSubscriptions(entering, node);
180
+ node.forEachChild(visit);
181
+ const exiting = exit[node.kind];
182
+ if (exiting !== void 0) runFileVisitorSubscriptions(exiting, node);
183
+ } : (node) => {
184
+ const entering = enter[node.kind];
185
+ if (entering !== void 0) runFileVisitorSubscriptions(entering, node);
186
+ node.forEachChild(visit);
187
+ };
188
+ return {
189
+ enter,
190
+ exit,
191
+ visit
192
+ };
193
+ }
194
+ if (exit) {
195
+ const visit = (node) => {
196
+ node.forEachChild(visit);
197
+ const exiting = exit[node.kind];
198
+ if (exiting !== void 0) runFileVisitorSubscriptions(exiting, node);
199
+ };
200
+ return {
201
+ enter,
202
+ exit,
203
+ visit
204
+ };
205
+ }
206
+ }
207
+ function createSubscriptionsByKind(group) {
208
+ const byKind = Object.create(null);
209
+ for (const [name, subscriptions] of group) {
210
+ const kind = NodeSyntaxKinds[name];
211
+ if (typeof kind === "number" && NodeSyntaxKinds[kind] === name) byKind[kind] = subscriptions;
212
+ }
213
+ return byKind;
214
+ }
215
+ //#endregion
122
216
  //#region src/normalizeRange.ts
123
217
  function normalizeRange(original, sourceFile) {
124
218
  const onCharacters = isNode(original) ? {
@@ -180,7 +274,8 @@ function computeNextCodeLine(sourceFile, directiveLine) {
180
274
  function extendRangeToNextCodeLine(sourceFile, range) {
181
275
  const codeLine = computeNextCodeLine(sourceFile, range.begin.line);
182
276
  if (codeLine === void 0 || codeLine <= range.end.line + 1) return range;
183
- const endPosition = nullThrows(sourceFile.getLineStarts()[codeLine], "Code line start is expected to be present by the computed code line") - 1;
277
+ const lineStarts = sourceFile.getLineStarts();
278
+ const endPosition = nullThrows(lineStarts[codeLine], "Code line start is expected to be present by the computed code line") - 1;
184
279
  const { character, line } = sourceFile.getLineAndCharacterOfPosition(endPosition);
185
280
  return {
186
281
  ...range,
@@ -202,7 +297,7 @@ function getTSNodeRange(node, sourceFile) {
202
297
  //#endregion
203
298
  //#region package.json
204
299
  var name = "@flint.fyi/typescript-language";
205
- var version = "0.20.0";
300
+ var version = "0.21.0";
206
301
  //#endregion
207
302
  //#region src/createTypeScriptServerHost.ts
208
303
  function serverHostMethodNotImplemented(methodName) {
@@ -231,6 +326,9 @@ function createTypeScriptServerHost(host) {
231
326
  fileExists(filePath) {
232
327
  return host.fileTypeSync(resolve(host.getCurrentDirectory(), filePath)) === "file";
233
328
  },
329
+ getCurrentDirectory() {
330
+ return host.getCurrentDirectory();
331
+ },
234
332
  readDirectory(directoryPath, extensions, exclude, include, depth) {
235
333
  const originalCwd = process.cwd.bind(process);
236
334
  process.cwd = () => host.getCurrentDirectory();
@@ -279,9 +377,7 @@ function createTypeScriptServerHost(host) {
279
377
  case "created":
280
378
  eventKind = ts.FileWatcherEventKind.Created;
281
379
  break;
282
- case "deleted":
283
- eventKind = ts.FileWatcherEventKind.Deleted;
284
- break;
380
+ case "deleted": eventKind = ts.FileWatcherEventKind.Deleted;
285
381
  }
286
382
  callback(filePath, eventKind);
287
383
  }, { ignoredPaths: commonlyIgnoredPaths });
@@ -298,82 +394,44 @@ function createTypeScriptServerHost(host) {
298
394
  };
299
395
  }
300
396
  //#endregion
301
- //#region src/getFirstEnumValues.ts
302
- /**
303
- * Removes TypeScript enum values that alias earlier values.
304
- * @param original Any TypeScript enum with numeric values.
305
- * @returns A version of the enum with only the first occurrence of each value.
306
- * @example
307
- * Given the following enum:
308
- * ```ts
309
- * enum Example {
310
- * A = 1,
311
- * B = 2,
312
- * C = A
313
- * }
314
- * ```
315
- * Its original value looks like:
316
- * ```ts
317
- * {
318
- * 1: 'C', // <-- Points to 'C', the alias of 'A'
319
- * 2: 'B',
320
- * A: 1,
321
- * B: 2,
322
- * C: 1,
323
- * }
324
- * ```
325
- * Calling `getFirstEnumValues(Example)` would return:
326
- * ```ts
327
- * {
328
- * 1: 'A', // <-- Corrected to the original 'A'
329
- * 2: 'B',
330
- * A: 1,
331
- * B: 2,
332
- * C: 1,
333
- * }
334
- * ```
335
- */
336
- function getFirstEnumValues(original) {
337
- const result = {};
338
- for (const key in original) {
339
- if (typeof original[key] !== "number") continue;
340
- if (!(key in result)) result[key] = original[key];
341
- if (!(original[key] in result)) result[original[key]] = key;
342
- }
343
- return result;
344
- }
397
+ //#region src/utils/forEachChild.ts
398
+ const forEachChild = ts.forEachChild;
345
399
  //#endregion
346
400
  //#region src/collectReferencedFilePaths.ts
347
401
  function collectReferencedFilePaths(program, sourceFile) {
348
402
  const modulePaths = /* @__PURE__ */ new Set();
349
403
  function resolveModulePath(moduleSpecifier) {
350
404
  const resolved = ts.resolveModuleName(moduleSpecifier, sourceFile.fileName, program.getCompilerOptions(), ts.sys);
351
- if (resolved.resolvedModule?.isExternalLibraryImport === false) return path$1.relative(process.cwd(), resolved.resolvedModule.resolvedFileName);
405
+ if (resolved.resolvedModule?.isExternalLibraryImport === false) return relative(program.getCurrentDirectory(), resolved.resolvedModule.resolvedFileName);
352
406
  }
353
407
  function visit(node) {
354
408
  let path;
355
409
  if (isImportDeclaration(node)) path = node.moduleSpecifier.text;
410
+ else if (isExportDeclaration(node)) path = node.moduleSpecifier.text;
356
411
  else if (isImportCall(node)) path = node.arguments[0].text;
357
412
  else if (isAwaitImportCall(node)) path = node.expression.arguments[0].text;
358
413
  else if (isImportTypeNode(node)) path = node.argument.literal.text;
359
414
  const resolvedPath = path && resolveModulePath(path);
360
415
  if (resolvedPath) modulePaths.add(resolvedPath);
361
- ts.forEachChild(node, visit);
416
+ forEachChild(node, visit);
362
417
  }
363
418
  visit(sourceFile);
364
419
  return Array.from(modulePaths);
365
420
  }
366
421
  function isAwaitImportCall(node) {
367
- return ts.isAwaitExpression(node) && isImportCall(node.expression);
422
+ return node.kind === SyntaxKind.AwaitExpression && isImportCall(node.expression);
423
+ }
424
+ function isExportDeclaration(node) {
425
+ return node.kind === SyntaxKind.ExportDeclaration && node.moduleSpecifier?.kind === SyntaxKind.StringLiteral;
368
426
  }
369
427
  function isImportCall(node) {
370
- return ts.isCallExpression(node) && tsutils.isImportExpression(node.expression) && !!node.arguments.length && ts.isStringLiteral(nullThrows(node.arguments[0], "First argument is expected to be present by prior length check"));
428
+ return node.kind === SyntaxKind.CallExpression && node.expression.kind === SyntaxKind.ImportKeyword && node.arguments[0]?.kind === SyntaxKind.StringLiteral;
371
429
  }
372
430
  function isImportDeclaration(node) {
373
- return ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier);
431
+ return node.kind === SyntaxKind.ImportDeclaration && node.moduleSpecifier.kind === SyntaxKind.StringLiteral;
374
432
  }
375
433
  function isImportTypeNode(node) {
376
- return ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteral(node.argument.literal);
434
+ return node.kind === SyntaxKind.ImportType && node.argument.kind === SyntaxKind.LiteralType && node.argument.literal.kind === SyntaxKind.StringLiteral;
377
435
  }
378
436
  //#endregion
379
437
  //#region src/utils/containsGlobalDeclarations.ts
@@ -384,7 +442,7 @@ function isImportTypeNode(node) {
384
442
  function containsGlobalDeclarations(sourceFileNode) {
385
443
  const isModule = ts.isExternalModule(sourceFileNode);
386
444
  return sourceFileNode.statements.some((statement) => {
387
- if (ts.isModuleDeclaration(statement) && statement.name.text === "global") return true;
445
+ if (statement.kind === SyntaxKind.ModuleDeclaration && statement.name.text === "global") return true;
388
446
  if (isModule) return false;
389
447
  if (!ts.canHaveModifiers(statement)) return false;
390
448
  return ts.getModifiers(statement)?.some((mod) => mod.kind === SyntaxKind.DeclareKeyword);
@@ -485,8 +543,7 @@ function orderTypeScriptFilePaths(filePaths, host) {
485
543
  }
486
544
  //#endregion
487
545
  //#region src/language.ts
488
- const log = debugForFile(import.meta.filename);
489
- const NodeSyntaxKinds = getFirstEnumValues(SyntaxKind);
546
+ const log = debugForFile(import.meta.url);
490
547
  const stateSymbol = Symbol.for("@flint.fyi/typescript-language/state");
491
548
  const globalTyped = globalThis;
492
549
  assert(globalTyped[stateSymbol] == null, `Two different versions of ${name} are imported: ${version} and ${globalTyped[stateSymbol]?.packageVersion}`);
@@ -507,9 +564,10 @@ const typescriptLanguage = createLanguage({
507
564
  service.openClientFile(data.filePathAbsolute);
508
565
  log("Retrieving client services:", data.filePathAbsolute);
509
566
  const scriptInfo = nullThrows(service.getScriptInfo(data.filePathAbsolute), `Could not find script info for file: ${data.filePathAbsolute}`);
510
- 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}`);
567
+ const defaultProject = nullThrows(service.getDefaultProjectForFile(scriptInfo.fileName, true), `Could not find default project for file: ${data.filePathAbsolute}`);
568
+ const program = nullThrows(defaultProject.getLanguageService(true).getProgram(), `Could not retrieve program for file: ${data.filePathAbsolute}`);
511
569
  const sourceFile = nullThrows(program.getSourceFile(data.filePathAbsolute), `Could not retrieve source file for: ${data.filePathAbsolute}`);
512
- const fileExtension = path.extname(data.filePathAbsolute);
570
+ const fileExtension = extname(data.filePathAbsolute);
513
571
  if (typeScriptCoreSupportedExtensions.has(fileExtension)) return {
514
572
  ...parseDirectivesFromTypeScriptFile(sourceFile),
515
573
  about: data,
@@ -536,27 +594,15 @@ const typescriptLanguage = createLanguage({
536
594
  getFileCacheImpacts: getTypeScriptFileCacheImpacts,
537
595
  getLanguageReports(file) {
538
596
  if ("__volarServices" in file) return file.__volarServices.getLanguageReports();
539
- return ts.getPreEmitDiagnostics(file.services.program, file.services.sourceFile).map(convertTypeScriptDiagnosticToLanguageReport);
597
+ return getPreEmitDiagnostics(file.services.program, file.services.sourceFile).map(convertTypeScriptDiagnosticToLanguageReport);
540
598
  },
541
599
  orderFilePaths: orderTypeScriptFilePaths,
542
- runFileVisitors(file, options, runtime) {
543
- if (!runtime.visitors) return;
600
+ runFileVisitors(file, fileVisitors) {
544
601
  if ("__volarServices" in file) {
545
- file.__volarServices.runVisitors(file, options, runtime);
602
+ file.__volarServices.runVisitors(fileVisitors);
546
603
  return;
547
604
  }
548
- const { visitors } = runtime;
549
- const visitorServices = {
550
- options,
551
- ...file.services
552
- };
553
- const visit = (node) => {
554
- const key = NodeSyntaxKinds[node.kind];
555
- visitors[key]?.(node, visitorServices);
556
- node.forEachChild(visit);
557
- visitors[`${key}:exit`]?.(node, visitorServices);
558
- };
559
- visit(file.services.sourceFile);
605
+ createNodeVisitorsForFile(fileVisitors)?.visit(file.services.sourceFile);
560
606
  }
561
607
  });
562
608
  const typeScriptCoreSupportedExtensions = /* @__PURE__ */ new Set([
@@ -582,14 +628,11 @@ const fileExtToFlintPlugin = {
582
628
  ".vue": "@flint.fyi/vue"
583
629
  };
584
630
  function throwUnknownLanguageExtension(filename) {
585
- const pluginName = fileExtToFlintPlugin[path.extname(filename)];
631
+ const pluginName = fileExtToFlintPlugin[extname(filename)];
586
632
  const message = pluginName ? `Did you install & import ${pluginName}?` : "Unknown extension.";
587
633
  throw new Error(`Cannot process ${filename}. ${message}`);
588
634
  }
589
635
  //#endregion
590
- //#region src/utils/forEachChild.ts
591
- const forEachChild = ts.forEachChild;
592
- //#endregion
593
636
  //#region src/scope/identifierReferences.ts
594
637
  function isNonReferenceIdentifier(identifier) {
595
638
  if (isIdentifierDeclaration(identifier) || isTypeReferenceIdentifier(identifier)) return true;
@@ -838,7 +881,6 @@ function createScopeManager(sourceFile) {
838
881
  return;
839
882
  }
840
883
  addBindingName(getVariableDeclarationScope(node, nodeScope), node.name, node, "variable");
841
- break;
842
884
  }
843
885
  forEachChild(node, (child) => {
844
886
  collectDeclarations(child, nodeScope);
@@ -886,6 +928,7 @@ function createRuleTesterTSConfig(defaultCompilerOptions) {
886
928
  return {
887
929
  "tsconfig.base.json": JSON.stringify({ compilerOptions: {
888
930
  lib: ["esnext"],
931
+ moduleDetection: "force",
889
932
  moduleResolution: "bundler",
890
933
  strict: true,
891
934
  target: "esnext",
@@ -990,7 +1033,7 @@ function hasSameTokens(nodeA, nodeB, sourceFile) {
990
1033
  return queueA.length === queueB.length;
991
1034
  }
992
1035
  function areSameToken(nodeA, nodeB, sourceFile) {
993
- if (ts.isIdentifier(nodeA) || ts.isPrivateIdentifier(nodeA) || ts.isNumericLiteral(nodeA) || ts.isBigIntLiteral(nodeA) || ts.isStringLiteral(nodeA) || ts.isNoSubstitutionTemplateLiteral(nodeA)) return nodeA.text === nodeB.text;
1036
+ if (nodeA.kind === SyntaxKind.Identifier || nodeA.kind === SyntaxKind.PrivateIdentifier || nodeA.kind === SyntaxKind.NumericLiteral || nodeA.kind === SyntaxKind.BigIntLiteral || nodeA.kind === SyntaxKind.StringLiteral || nodeA.kind === SyntaxKind.NoSubstitutionTemplateLiteral) return nodeA.text === nodeB.text;
994
1037
  if (nodeA.kind === SyntaxKind.RegularExpressionLiteral) return sourceFile.text.slice(nodeA.getStart(sourceFile), nodeA.getEnd()) === sourceFile.text.slice(nodeB.getStart(sourceFile), nodeB.getEnd());
995
1038
  return true;
996
1039
  }
@@ -1017,15 +1060,21 @@ function isGlobalDeclaration(node, typeChecker, program) {
1017
1060
  function isGlobalDeclarationOfName(node, name, typeChecker, program) {
1018
1061
  const declarations = typeChecker.getSymbolAtLocation(node)?.getDeclarations();
1019
1062
  if (!declarations) return false;
1020
- return declarations.every((declaration) => {
1021
- if (isVariableDeclaration(declaration) && declaration.initializer && isIdentifier(declaration.initializer)) return isGlobalDeclarationOfName(declaration.initializer, name, typeChecker, program);
1022
- if (isPropertySignature(declaration)) return isGlobalDeclarationOfName(declaration.parent, name, typeChecker, program);
1023
- return isDeclarationOfName(declaration, name) && declarationIncludesGlobal(declaration, program);
1063
+ return declarations.every((tsDeclaration) => {
1064
+ const declaration = tsDeclaration;
1065
+ if (declaration.kind === SyntaxKind.VariableDeclaration && declaration.initializer?.kind === SyntaxKind.Identifier) return isGlobalDeclarationOfName(declaration.initializer, name, typeChecker, program);
1066
+ if (declaration.kind === SyntaxKind.PropertySignature) return isGlobalDeclarationOfName(declaration.parent, name, typeChecker, program);
1067
+ return isDeclarationOfName(declaration, name) && declarationIncludesGlobal(tsDeclaration, program);
1024
1068
  });
1025
1069
  }
1026
1070
  function isDeclarationOfName(node, name) {
1027
- if (isClassDeclaration(node) || isFunctionDeclaration(node) || isInterfaceDeclaration(node) || isVariableDeclaration(node)) return node.name && isIdentifier(node.name) && node.name.text === name;
1028
- return false;
1071
+ switch (node.kind) {
1072
+ case SyntaxKind.ClassDeclaration:
1073
+ case SyntaxKind.FunctionDeclaration:
1074
+ case SyntaxKind.InterfaceDeclaration:
1075
+ case SyntaxKind.VariableDeclaration: return node.name?.kind === SyntaxKind.Identifier && node.name.text === name;
1076
+ default: return false;
1077
+ }
1029
1078
  }
1030
1079
  //#endregion
1031
1080
  //#region src/utils/isGlobalVariable.ts
@@ -1069,18 +1118,18 @@ const objectStaticMethods = /* @__PURE__ */ new Set([
1069
1118
  * so mutating methods like .sort() or .reverse() are safe to use.
1070
1119
  */
1071
1120
  function isInlineArrayCreation(node) {
1072
- if (ts.isArrayLiteralExpression(node)) return true;
1073
- if (ts.isParenthesizedExpression(node)) return isInlineArrayCreation(node.expression);
1074
- if (ts.isCallExpression(node)) {
1075
- if (ts.isPropertyAccessExpression(node.expression)) {
1121
+ if (node.kind === SyntaxKind.ArrayLiteralExpression) return true;
1122
+ if (node.kind === SyntaxKind.ParenthesizedExpression) return isInlineArrayCreation(node.expression);
1123
+ if (node.kind === SyntaxKind.CallExpression) {
1124
+ if (node.expression.kind === SyntaxKind.PropertyAccessExpression) {
1076
1125
  const methodName = node.expression.name.text;
1077
- if (ts.isIdentifier(node.expression.expression) && node.expression.expression.text === "Object" && objectStaticMethods.has(methodName)) return true;
1078
- if (ts.isIdentifier(node.expression.expression) && node.expression.expression.text === "Array" && (methodName === "from" || methodName === "of")) return true;
1126
+ if (node.expression.expression.kind === SyntaxKind.Identifier && node.expression.expression.text === "Object" && objectStaticMethods.has(methodName)) return true;
1127
+ if (node.expression.expression.kind === SyntaxKind.Identifier && node.expression.expression.text === "Array" && (methodName === "from" || methodName === "of")) return true;
1079
1128
  if (methodsReturningNewArray.has(methodName)) return true;
1080
1129
  }
1081
- if (ts.isIdentifier(node.expression) && node.expression.text === "Array" && ts.isNewExpression(node.parent)) return true;
1130
+ if (node.expression.kind === SyntaxKind.Identifier && node.expression.text === "Array" && node.parent.kind === SyntaxKind.NewExpression) return true;
1082
1131
  }
1083
- if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "Array") return true;
1132
+ if (node.kind === SyntaxKind.NewExpression && node.expression.kind === SyntaxKind.Identifier && node.expression.text === "Array") return true;
1084
1133
  return false;
1085
1134
  }
1086
1135
  //#endregion
@@ -1101,4 +1150,4 @@ function unwrapParentParenthesizedExpressions(node) {
1101
1150
  return node.parent.kind === SyntaxKind.ParenthesizedExpression ? unwrapParentParenthesizedExpressions(node.parent) : node.parent;
1102
1151
  }
1103
1152
  //#endregion
1104
- export { NodeSyntaxKinds, convertTypeScriptDiagnosticToLanguageReport, createRuleTesterTSConfig, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, forEachChild, getDeclarationsIfGlobal, getModifyingReferences, getScopeManager, getStaticNumberValue, getStaticStringValue, getStaticValue, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, isStaticString, isStringRawNoSubstitution, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
1153
+ export { NodeSyntaxKinds, convertTypeScriptDiagnosticToLanguageReport, createNodeVisitorsForFile, createRuleTesterTSConfig, declarationIncludesGlobal, extractDirectivesFromTypeScriptFile, forEachChild, getDeclarationsIfGlobal, getModifyingReferences, getScopeManager, getStaticNumberValue, getStaticStringValue, getStaticValue, getTSNodeRange, hasSameTokens, isBuiltinArrayMethod, isFunction, isGlobalDeclaration, isGlobalDeclarationOfName, isGlobalVariable, isInlineArrayCreation, isStaticString, isStringRawNoSubstitution, setVolarCreateFile, throwUnknownLanguageExtension, typescriptLanguage, unwrapParentParenthesizedExpressions, unwrapParenthesizedNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flint.fyi/typescript-language",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "[Experimental] TypeScript language for Flint.",
5
5
  "homepage": "https://flint.fyi",
6
6
  "repository": {
@@ -22,19 +22,19 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
+ "@flint.fyi/core": "^0.27.0",
26
+ "@flint.fyi/utils": "^0.16.0",
25
27
  "@typescript-eslint/project-service": "^8.53.0",
26
28
  "cached-factory": "^0.3.0",
27
29
  "debug-for-file": "^0.4.0",
28
30
  "pathe": "^2.0.3",
29
31
  "ts-api-utils": "^2.4.0",
30
- "typescript": "^5.9.0 || ^6.0.0",
31
- "@flint.fyi/core": "^0.25.0",
32
- "@flint.fyi/utils": "^0.16.0"
32
+ "typescript": "^6.0.3"
33
33
  },
34
34
  "devDependencies": {
35
- "tsdown": "0.22.3",
36
- "vitest": "4.1.0",
37
- "@flint.fyi/build": "^0.1.0"
35
+ "@flint.fyi/build": "^0.1.0",
36
+ "tsdown": "0.23.0",
37
+ "vitest": "5.0.1"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=26.1.0"