@flint.fyi/typescript-language 0.19.0 → 0.20.1

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 { AnyOptionalSchema, CharacterReportRange, FileAboutData, InferredOutputObject, Language, LanguageFile, LanguageFileDefinition, LanguageReport, LanguageReports, NormalizedReportRangeObject, RuleRuntime, SourceFileWithLineMapAndFileName, WithExitKeys } from "@flint.fyi/core";
6
4
  //#endregion
7
5
  //#region src/convertTypeScriptDiagnosticToLanguageReport.d.ts
8
6
  interface TSDiagnostic extends TSDiagnosticRelatedInformation {
@@ -2312,409 +2310,20 @@ interface CheckerOverrides {
2312
2310
  //#endregion
2313
2311
  //#region src/language.d.ts
2314
2312
  interface TypeScriptFileServices {
2315
- program: ts.Program;
2313
+ program: Program;
2316
2314
  sourceFile: SourceFile;
2317
2315
  typeChecker: Checker;
2318
2316
  }
2319
- declare const NodeSyntaxKinds: typeof ts.SyntaxKind;
2320
- type VolarCreateFile = (data: FileAboutData, program: ts.Program, sourceFile: SourceFile) => VolarLanguageFileDefinition;
2321
- type VolarLanguageFileDefinition = LanguageFileDefinition<object> & {
2317
+ declare const NodeSyntaxKinds: typeof SyntaxKind;
2318
+ type VolarCreateFile = (data: FileAboutData, program: Program, sourceFile: SourceFile) => VolarLanguageFileDefinition;
2319
+ type VolarLanguageFileDefinition = LanguageFileDefinition<TypeScriptFileServices> & {
2322
2320
  __volarServices: {
2323
2321
  getLanguageReports(): LanguageReports;
2324
2322
  runVisitors(file: LanguageFile<TypeScriptFileServices>, options: InferredOutputObject<AnyOptionalSchema | undefined>, runtime: RuleRuntime<TypeScriptNodeVisitors, TypeScriptFileServices>): void;
2325
2323
  };
2326
2324
  };
2327
2325
  declare function setVolarCreateFile(create: VolarCreateFile): void;
2328
- declare const typescriptLanguage: import("@flint.fyi/core").Language<{
2329
- AnyKeyword: AnyKeyword;
2330
- ArrayBindingPattern: ArrayBindingPattern;
2331
- ArrayLiteralExpression: ArrayLiteralExpression;
2332
- ArrayType: ArrayTypeNode;
2333
- ArrowFunction: ArrowFunction;
2334
- AsExpression: AsExpression;
2335
- AwaitExpression: AwaitExpression;
2336
- BigIntKeyword: BigIntKeyword;
2337
- BigIntLiteral: BigIntLiteral;
2338
- BinaryExpression: BinaryExpression;
2339
- BindingElement: BindingElement;
2340
- Block: Block;
2341
- BooleanKeyword: BooleanKeyword;
2342
- BreakStatement: BreakStatement;
2343
- CallExpression: CallExpression;
2344
- CallSignature: CallSignatureDeclaration;
2345
- CaseBlock: CaseBlock;
2346
- CaseClause: CaseClause;
2347
- CatchClause: CatchClause;
2348
- ClassDeclaration: ClassDeclaration;
2349
- ClassExpression: ClassExpression;
2350
- ClassStaticBlockDeclaration: ClassStaticBlockDeclaration;
2351
- CommaListExpression: CommaListExpression;
2352
- ComputedPropertyName: ComputedPropertyName;
2353
- ConditionalExpression: ConditionalExpression;
2354
- ConditionalType: ConditionalTypeNode;
2355
- Constructor: ConstructorDeclaration;
2356
- ConstructorType: ConstructorTypeNode;
2357
- ConstructSignature: ConstructSignatureDeclaration;
2358
- ContinueStatement: ContinueStatement;
2359
- DebuggerStatement: DebuggerStatement;
2360
- Decorator: Decorator;
2361
- DefaultClause: DefaultClause;
2362
- DeleteExpression: DeleteExpression;
2363
- DoStatement: DoStatement;
2364
- ElementAccessExpression: ElementAccessExpression;
2365
- EmptyStatement: EmptyStatement;
2366
- EnumDeclaration: EnumDeclaration;
2367
- EnumMember: EnumMember;
2368
- ExportAssignment: ExportAssignment;
2369
- ExportDeclaration: ExportDeclaration;
2370
- ExportSpecifier: ExportSpecifier;
2371
- ExpressionStatement: ExpressionStatement;
2372
- ExpressionWithTypeArguments: ExpressionWithTypeArguments;
2373
- ExternalModuleReference: ExternalModuleReference;
2374
- FalseKeyword: FalseLiteral;
2375
- ForInStatement: ForInStatement;
2376
- ForOfStatement: ForOfStatement;
2377
- ForStatement: ForStatement;
2378
- FunctionDeclaration: FunctionDeclaration;
2379
- FunctionExpression: FunctionExpression;
2380
- FunctionType: FunctionTypeNode;
2381
- GetAccessor: GetAccessorDeclaration;
2382
- HeritageClause: HeritageClause;
2383
- Identifier: Identifier;
2384
- IfStatement: IfStatement;
2385
- ImportAttribute: ImportAttribute;
2386
- ImportAttributes: ImportAttributes;
2387
- ImportClause: ImportClause;
2388
- ImportDeclaration: ImportDeclaration;
2389
- ImportEqualsDeclaration: ImportEqualsDeclaration;
2390
- ImportKeyword: ImportExpression;
2391
- ImportSpecifier: ImportSpecifier;
2392
- ImportType: ImportTypeNode;
2393
- IndexedAccessType: IndexedAccessTypeNode;
2394
- IndexSignature: IndexSignatureDeclaration;
2395
- InferType: InferTypeNode;
2396
- InterfaceDeclaration: InterfaceDeclaration;
2397
- IntersectionType: IntersectionTypeNode;
2398
- IntrinsicKeyword: IntrinsicKeyword;
2399
- JSDocAllType: JSDocAllType;
2400
- JSDocFunctionType: JSDocFunctionType;
2401
- JSDocLink: JSDocLink;
2402
- JSDocLinkCode: JSDocLinkCode;
2403
- JSDocLinkPlain: JSDocLinkPlain;
2404
- JSDocMemberName: JSDocMemberName;
2405
- JSDocNamepathType: JSDocNamepathType;
2406
- JSDocNonNullableType: JSDocNonNullableType;
2407
- JSDocNullableType: JSDocNullableType;
2408
- JSDocOptionalType: JSDocOptionalType;
2409
- JSDocParameterTag: JSDocParameterTag;
2410
- JSDocPropertyTag: JSDocPropertyTag;
2411
- JSDocReturnTag: JSDocReturnTag;
2412
- JSDocSignature: JSDocSignature;
2413
- JSDocTemplateTag: JSDocTemplateTag;
2414
- JSDocText: JSDocText;
2415
- JSDocTypeExpression: JSDocTypeExpression;
2416
- JSDocTypeLiteral: JSDocTypeLiteral;
2417
- JSDocUnknownType: JSDocUnknownType;
2418
- JSDocVariadicType: JSDocVariadicType;
2419
- JsxAttribute: JsxAttribute;
2420
- JsxAttributes: JsxAttributes;
2421
- JsxClosingElement: JsxClosingElement;
2422
- JsxClosingFragment: JsxClosingFragment;
2423
- JsxElement: JsxElement;
2424
- JsxExpression: JsxExpression;
2425
- JsxFragment: JsxFragment;
2426
- JsxNamespacedName: JsxNamespacedName;
2427
- JsxOpeningElement: JsxOpeningElement;
2428
- JsxOpeningFragment: JsxOpeningFragment;
2429
- JsxSelfClosingElement: JsxSelfClosingElement;
2430
- JsxSpreadAttribute: JsxSpreadAttribute;
2431
- JsxText: JsxText;
2432
- LabeledStatement: LabeledStatement;
2433
- LiteralType: LiteralTypeNode;
2434
- MappedType: MappedTypeNode;
2435
- MetaProperty: MetaProperty;
2436
- MethodDeclaration: MethodDeclaration;
2437
- MethodSignature: MethodSignature;
2438
- MissingDeclaration: MissingDeclaration;
2439
- ModuleBlock: ModuleBlock;
2440
- ModuleDeclaration: ModuleDeclaration;
2441
- NamedExports: NamedExports;
2442
- NamedImports: NamedImports;
2443
- NamedTupleMember: NamedTupleMember;
2444
- NamespaceExport: NamespaceExport;
2445
- NamespaceExportDeclaration: NamespaceExportDeclaration;
2446
- NamespaceImport: NamespaceImport;
2447
- NeverKeyword: NeverKeyword;
2448
- NewExpression: NewExpression;
2449
- NonNullExpression: NonNullExpression;
2450
- NoSubstitutionTemplateLiteral: NoSubstitutionTemplateLiteral;
2451
- NotEmittedStatement: NotEmittedStatement;
2452
- NotEmittedTypeElement: NotEmittedTypeElement;
2453
- NullKeyword: NullLiteral;
2454
- NumberKeyword: NumberKeyword;
2455
- NumericLiteral: NumericLiteral;
2456
- ObjectBindingPattern: ObjectBindingPattern;
2457
- ObjectKeyword: ObjectKeyword;
2458
- ObjectLiteralExpression: ObjectLiteralExpression;
2459
- OmittedExpression: OmittedExpression;
2460
- OptionalType: OptionalTypeNode;
2461
- Parameter: ParameterDeclaration;
2462
- ParenthesizedExpression: ParenthesizedExpression;
2463
- ParenthesizedType: ParenthesizedTypeNode;
2464
- PartiallyEmittedExpression: PartiallyEmittedExpression;
2465
- PostfixUnaryExpression: PostfixUnaryExpression;
2466
- PrefixUnaryExpression: PrefixUnaryExpression;
2467
- PrivateIdentifier: PrivateIdentifier;
2468
- PropertyAccessExpression: PropertyAccessExpression;
2469
- PropertyAssignment: PropertyAssignment;
2470
- PropertyDeclaration: PropertyDeclaration;
2471
- PropertySignature: PropertySignature;
2472
- QualifiedName: QualifiedName;
2473
- RegularExpressionLiteral: RegularExpressionLiteral;
2474
- RestType: RestTypeNode;
2475
- ReturnStatement: ReturnStatement;
2476
- SatisfiesExpression: SatisfiesExpression;
2477
- SemicolonClassElement: SemicolonClassElement;
2478
- SetAccessor: SetAccessorDeclaration;
2479
- ShorthandPropertyAssignment: ShorthandPropertyAssignment;
2480
- SourceFile: SourceFile;
2481
- SpreadAssignment: SpreadAssignment;
2482
- SpreadElement: SpreadElement;
2483
- StringKeyword: StringKeyword;
2484
- StringLiteral: StringLiteral;
2485
- SuperKeyword: SuperExpression;
2486
- SwitchStatement: SwitchStatement;
2487
- SymbolKeyword: SymbolKeyword;
2488
- SyntheticExpression: SyntheticExpression;
2489
- TaggedTemplateExpression: TaggedTemplateExpression;
2490
- TemplateExpression: TemplateExpression;
2491
- TemplateHead: TemplateHead;
2492
- TemplateLiteralType: TemplateLiteralTypeNode;
2493
- TemplateLiteralTypeSpan: TemplateLiteralTypeSpan;
2494
- TemplateMiddle: TemplateMiddle;
2495
- TemplateSpan: TemplateSpan;
2496
- TemplateTail: TemplateTail;
2497
- ThisKeyword: ThisExpression;
2498
- ThisType: ThisTypeNode;
2499
- ThrowStatement: ThrowStatement;
2500
- TrueKeyword: TrueLiteral;
2501
- TryStatement: TryStatement;
2502
- TupleType: TupleTypeNode;
2503
- TypeAliasDeclaration: TypeAliasDeclaration;
2504
- TypeAssertionExpression: TypeAssertion;
2505
- TypeLiteral: TypeLiteralNode;
2506
- TypeOfExpression: TypeOfExpression;
2507
- TypeOperator: TypeOperatorNode;
2508
- TypeParameter: TypeParameterDeclaration;
2509
- TypePredicate: TypePredicateNode;
2510
- TypeQuery: TypeQueryNode;
2511
- TypeReference: TypeReferenceNode;
2512
- UndefinedKeyword: UndefinedKeyword;
2513
- UnionType: UnionTypeNode;
2514
- UnknownKeyword: UnknownKeyword;
2515
- VariableDeclaration: VariableDeclaration;
2516
- VariableDeclarationList: VariableDeclarationList;
2517
- VariableStatement: VariableStatement;
2518
- VoidExpression: VoidExpression;
2519
- VoidKeyword: VoidKeyword;
2520
- WhileStatement: WhileStatement;
2521
- WithStatement: WithStatement;
2522
- 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>;
2326
+ declare const typescriptLanguage: Language<TypeScriptNodeVisitors, TypeScriptFileServices>;
2718
2327
  declare function throwUnknownLanguageExtension(filename: string): never;
2719
2328
  //#endregion
2720
2329
  //#region src/scope/types.d.ts
@@ -2770,7 +2379,7 @@ declare function declarationIncludesGlobal(declaration: Declaration, program: Pr
2770
2379
  declare const forEachChild: <T>(node: AnyNode, cbNode: (node: AnyNode) => T | undefined, cbNodes?: (nodes: ts.NodeArray<AnyNode>) => T | undefined) => T | undefined;
2771
2380
  //#endregion
2772
2381
  //#region src/utils/getDeclarationsIfGlobal.d.ts
2773
- declare function getDeclarationsIfGlobal(node: Expression, typeChecker: Checker, program: Program): import("typescript").Declaration[] | undefined;
2382
+ declare function getDeclarationsIfGlobal(node: Expression, typeChecker: Checker, program: Program): Declaration[] | undefined;
2774
2383
  //#endregion
2775
2384
  //#region src/utils/getModifyingReferences.d.ts
2776
2385
  /**
@@ -2828,12 +2437,14 @@ declare function isGlobalVariable(node: Expression, typeChecker: Checker, progra
2828
2437
  declare function isInlineArrayCreation(node: ts.Expression): boolean;
2829
2438
  //#endregion
2830
2439
  //#region src/utils/isStaticString.d.ts
2831
- declare function isStaticString(node: Expression): node is NoSubstitutionTemplateLiteral | StringLiteral;
2440
+ type StaticString = NoSubstitutionTemplateLiteral | StringLiteral;
2441
+ declare function isStaticString(node: Expression): node is StaticString;
2832
2442
  //#endregion
2833
2443
  //#region src/utils/isStringRawNoSubstitution.d.ts
2834
- declare function isStringRawNoSubstitution(node: Expression): node is TaggedTemplateExpression & {
2444
+ interface StringRawNoSubstitution extends TaggedTemplateExpression {
2835
2445
  template: NoSubstitutionTemplateLiteral;
2836
- };
2446
+ }
2447
+ declare function isStringRawNoSubstitution(node: Expression): node is StringRawNoSubstitution;
2837
2448
  //#endregion
2838
2449
  //#region src/utils/unwrapParenthesizedNode.d.ts
2839
2450
  declare function unwrapParenthesizedNode(node: AnyNode): AnyNode;
@@ -2841,4 +2452,4 @@ declare function unwrapParenthesizedNode(node: AnyNode): AnyNode;
2841
2452
  //#region src/utils/unwrapParentParenthesizedExpressions.d.ts
2842
2453
  declare function unwrapParentParenthesizedExpressions(node: BinaryExpression | ParenthesizedExpression): LeftHandSideExpressionParent;
2843
2454
  //#endregion
2844
- 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 StaticValue, 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 };
2455
+ 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 };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import ts, { SyntaxKind, isClassDeclaration, isFunctionDeclaration, isIdentifier, isInterfaceDeclaration, isPropertySignature, isVariableDeclaration } from "typescript";
1
+ import ts, { SyntaxKind, getPreEmitDiagnostics, isClassDeclaration, isFunctionDeclaration, isIdentifier, isInterfaceDeclaration, isPropertySignature, isVariableDeclaration } from "typescript";
2
2
  import { DirectivesCollector, commonlyIgnoredPaths, createLanguage, getColumnAndLineOfPosition, getPositionOfColumnAndLine } 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";
@@ -180,7 +180,8 @@ function computeNextCodeLine(sourceFile, directiveLine) {
180
180
  function extendRangeToNextCodeLine(sourceFile, range) {
181
181
  const codeLine = computeNextCodeLine(sourceFile, range.begin.line);
182
182
  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;
183
+ const lineStarts = sourceFile.getLineStarts();
184
+ const endPosition = nullThrows(lineStarts[codeLine], "Code line start is expected to be present by the computed code line") - 1;
184
185
  const { character, line } = sourceFile.getLineAndCharacterOfPosition(endPosition);
185
186
  return {
186
187
  ...range,
@@ -202,7 +203,7 @@ function getTSNodeRange(node, sourceFile) {
202
203
  //#endregion
203
204
  //#region package.json
204
205
  var name = "@flint.fyi/typescript-language";
205
- var version = "0.19.0";
206
+ var version = "0.20.1";
206
207
  //#endregion
207
208
  //#region src/createTypeScriptServerHost.ts
208
209
  function serverHostMethodNotImplemented(methodName) {
@@ -231,6 +232,9 @@ function createTypeScriptServerHost(host) {
231
232
  fileExists(filePath) {
232
233
  return host.fileTypeSync(resolve(host.getCurrentDirectory(), filePath)) === "file";
233
234
  },
235
+ getCurrentDirectory() {
236
+ return host.getCurrentDirectory();
237
+ },
234
238
  readDirectory(directoryPath, extensions, exclude, include, depth) {
235
239
  const originalCwd = process.cwd.bind(process);
236
240
  process.cwd = () => host.getCurrentDirectory();
@@ -279,9 +283,7 @@ function createTypeScriptServerHost(host) {
279
283
  case "created":
280
284
  eventKind = ts.FileWatcherEventKind.Created;
281
285
  break;
282
- case "deleted":
283
- eventKind = ts.FileWatcherEventKind.Deleted;
284
- break;
286
+ case "deleted": eventKind = ts.FileWatcherEventKind.Deleted;
285
287
  }
286
288
  callback(filePath, eventKind);
287
289
  }, { ignoredPaths: commonlyIgnoredPaths });
@@ -348,11 +350,12 @@ function collectReferencedFilePaths(program, sourceFile) {
348
350
  const modulePaths = /* @__PURE__ */ new Set();
349
351
  function resolveModulePath(moduleSpecifier) {
350
352
  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);
353
+ if (resolved.resolvedModule?.isExternalLibraryImport === false) return path$1.relative(program.getCurrentDirectory(), resolved.resolvedModule.resolvedFileName);
352
354
  }
353
355
  function visit(node) {
354
356
  let path;
355
357
  if (isImportDeclaration(node)) path = node.moduleSpecifier.text;
358
+ else if (isExportDeclaration(node)) path = node.moduleSpecifier.text;
356
359
  else if (isImportCall(node)) path = node.arguments[0].text;
357
360
  else if (isAwaitImportCall(node)) path = node.expression.arguments[0].text;
358
361
  else if (isImportTypeNode(node)) path = node.argument.literal.text;
@@ -366,6 +369,9 @@ function collectReferencedFilePaths(program, sourceFile) {
366
369
  function isAwaitImportCall(node) {
367
370
  return ts.isAwaitExpression(node) && isImportCall(node.expression);
368
371
  }
372
+ function isExportDeclaration(node) {
373
+ return ts.isExportDeclaration(node) && node.moduleSpecifier != null && ts.isStringLiteral(node.moduleSpecifier);
374
+ }
369
375
  function isImportCall(node) {
370
376
  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"));
371
377
  }
@@ -507,7 +513,8 @@ const typescriptLanguage = createLanguage({
507
513
  service.openClientFile(data.filePathAbsolute);
508
514
  log("Retrieving client services:", data.filePathAbsolute);
509
515
  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}`);
516
+ const defaultProject = nullThrows(service.getDefaultProjectForFile(scriptInfo.fileName, true), `Could not find default project for file: ${data.filePathAbsolute}`);
517
+ const program = nullThrows(defaultProject.getLanguageService(true).getProgram(), `Could not retrieve program for file: ${data.filePathAbsolute}`);
511
518
  const sourceFile = nullThrows(program.getSourceFile(data.filePathAbsolute), `Could not retrieve source file for: ${data.filePathAbsolute}`);
512
519
  const fileExtension = path.extname(data.filePathAbsolute);
513
520
  if (typeScriptCoreSupportedExtensions.has(fileExtension)) return {
@@ -536,7 +543,7 @@ const typescriptLanguage = createLanguage({
536
543
  getFileCacheImpacts: getTypeScriptFileCacheImpacts,
537
544
  getLanguageReports(file) {
538
545
  if ("__volarServices" in file) return file.__volarServices.getLanguageReports();
539
- return ts.getPreEmitDiagnostics(file.services.program, file.services.sourceFile).map(convertTypeScriptDiagnosticToLanguageReport);
546
+ return getPreEmitDiagnostics(file.services.program, file.services.sourceFile).map(convertTypeScriptDiagnosticToLanguageReport);
540
547
  },
541
548
  orderFilePaths: orderTypeScriptFilePaths,
542
549
  runFileVisitors(file, options, runtime) {
@@ -838,7 +845,6 @@ function createScopeManager(sourceFile) {
838
845
  return;
839
846
  }
840
847
  addBindingName(getVariableDeclarationScope(node, nodeScope), node.name, node, "variable");
841
- break;
842
848
  }
843
849
  forEachChild(node, (child) => {
844
850
  collectDeclarations(child, nodeScope);
@@ -886,6 +892,7 @@ function createRuleTesterTSConfig(defaultCompilerOptions) {
886
892
  return {
887
893
  "tsconfig.base.json": JSON.stringify({ compilerOptions: {
888
894
  lib: ["esnext"],
895
+ moduleDetection: "force",
889
896
  moduleResolution: "bundler",
890
897
  strict: true,
891
898
  target: "esnext",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flint.fyi/typescript-language",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "description": "[Experimental] TypeScript language for Flint.",
5
5
  "homepage": "https://flint.fyi",
6
6
  "repository": {
@@ -22,22 +22,22 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
+ "@flint.fyi/core": "^0.26.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/utils": "^0.15.0",
32
- "@flint.fyi/core": "^0.24.0"
32
+ "typescript": "^5.9.0 || ^6.0.0"
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.22.14",
37
+ "vitest": "4.1.11"
38
38
  },
39
39
  "engines": {
40
- "node": ">=24.0.0"
40
+ "node": ">=26.1.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"