1 | import * as ts from 'typescript';
|
2 | import { AstSymbol } from './AstSymbol';
|
3 | import { AstModule, AstModuleExportInfo } from './AstModule';
|
4 | import { IFetchAstSymbolOptions } from './AstSymbolTable';
|
5 | import { AstEntity } from './AstEntity';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export interface IAstSymbolTable {
|
13 | fetchAstSymbol(options: IFetchAstSymbolOptions): AstSymbol | undefined;
|
14 | analyze(astEntity: AstEntity): void;
|
15 | }
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | interface IAstModuleReference {
|
21 | |
22 |
|
23 |
|
24 |
|
25 | moduleSpecifier: string;
|
26 | |
27 |
|
28 |
|
29 |
|
30 | moduleSpecifierSymbol: ts.Symbol;
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export declare class ExportAnalyzer {
|
43 | private readonly _program;
|
44 | private readonly _typeChecker;
|
45 | private readonly _bundledPackageNames;
|
46 | private readonly _astSymbolTable;
|
47 | private readonly _astModulesByModuleSymbol;
|
48 | private readonly _importableAmbientSourceFiles;
|
49 | private readonly _astImportsByKey;
|
50 | private readonly _astNamespaceImportByModule;
|
51 | constructor(program: ts.Program, typeChecker: ts.TypeChecker, bundledPackageNames: ReadonlySet<string>, astSymbolTable: IAstSymbolTable);
|
52 | /**
|
53 | * For a given source file, this analyzes all of its exports and produces an AstModule object.
|
54 | *
|
55 | * @param moduleReference - contextual information about the import statement that took us to this source file.
|
56 | * or `undefined` if this source file is the initial entry point
|
57 | * @param isExternal - whether the given `moduleReference` is external.
|
58 | */
|
59 | fetchAstModuleFromSourceFile(sourceFile: ts.SourceFile, moduleReference: IAstModuleReference | undefined, isExternal: boolean): AstModule;
|
60 | /**
|
61 | * Retrieves the symbol for the module corresponding to the ts.SourceFile that is being imported/exported.
|
62 | *
|
63 | * @remarks
|
64 | * The `module` keyword can be used to declare multiple TypeScript modules inside a single source file.
|
65 | * (This is a deprecated construct and mainly used for typings such as `@types/node`.) In this situation,
|
66 | * `moduleReference` helps us to fish out the correct module symbol.
|
67 | */
|
68 | private _getModuleSymbolFromSourceFile;
|
69 | /**
|
70 | * Implementation of {@link AstSymbolTable.fetchAstModuleExportInfo}.
|
71 | */
|
72 | fetchAstModuleExportInfo(entryPointAstModule: AstModule): AstModuleExportInfo;
|
73 | |
74 |
|
75 |
|
76 |
|
77 | private _isExternalModulePath;
|
78 | |
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | isImportableAmbientSourceFile(sourceFile: ts.SourceFile): boolean;
|
85 | private _collectAllExportsRecursive;
|
86 | |
87 |
|
88 |
|
89 |
|
90 |
|
91 | fetchReferencedAstEntity(symbol: ts.Symbol, referringModuleIsExternal: boolean): AstEntity | undefined;
|
92 | fetchReferencedAstEntityFromImportTypeNode(node: ts.ImportTypeNode, referringModuleIsExternal: boolean): AstEntity | undefined;
|
93 | private _tryMatchExportDeclaration;
|
94 | private _tryMatchImportDeclaration;
|
95 | private static _getIsTypeOnly;
|
96 | private _getExportOfSpecifierAstModule;
|
97 | private _getExportOfAstModule;
|
98 | |
99 |
|
100 |
|
101 | tryGetExportOfAstModule(exportName: string, astModule: AstModule): AstEntity | undefined;
|
102 | private _tryGetExportOfAstModule;
|
103 | private _tryGetExternalModulePath;
|
104 | |
105 |
|
106 |
|
107 |
|
108 | private _fetchSpecifierAstModule;
|
109 | private _fetchAstImport;
|
110 | private _getModuleSpecifier;
|
111 | }
|
112 | export {};
|
113 |
|
\ | No newline at end of file |