@proteinjs/reflection-build 1.0.3 → 1.0.5
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/CHANGELOG.md +16 -0
- package/dist/modules/typescript-parser/.appveyor.yml +22 -0
- package/dist/modules/typescript-parser/DeclarationIndex.d.ts +217 -0
- package/dist/modules/typescript-parser/DeclarationIndex.js +441 -0
- package/dist/modules/typescript-parser/LICENSE +21 -0
- package/dist/modules/typescript-parser/Node.d.ts +23 -0
- package/dist/modules/typescript-parser/Node.js +2 -0
- package/dist/modules/typescript-parser/README.md +51 -0
- package/dist/modules/typescript-parser/SymbolSpecifier.d.ts +22 -0
- package/dist/modules/typescript-parser/SymbolSpecifier.js +28 -0
- package/dist/modules/typescript-parser/TypescriptParser.d.ts +68 -0
- package/dist/modules/typescript-parser/TypescriptParser.js +191 -0
- package/dist/modules/typescript-parser/clonable/Clonable.d.ts +17 -0
- package/dist/modules/typescript-parser/clonable/Clonable.js +2 -0
- package/dist/modules/typescript-parser/code-generators/TypescriptCodeGenerator.d.ts +39 -0
- package/dist/modules/typescript-parser/code-generators/TypescriptCodeGenerator.js +66 -0
- package/dist/modules/typescript-parser/code-generators/TypescriptGenerationOptions.d.ts +69 -0
- package/dist/modules/typescript-parser/code-generators/TypescriptGenerationOptions.js +9 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/accessorDeclaration.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/accessorDeclaration.js +34 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/externalModuleImport.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/externalModuleImport.js +15 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/methodDeclaration.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/methodDeclaration.js +23 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/namedImport.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/namedImport.js +94 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/namespaceImport.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/namespaceImport.js +15 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/parameterDeclaration.d.ts +9 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/parameterDeclaration.js +14 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/propertyDeclaration.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/propertyDeclaration.js +18 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/stringImport.d.ts +11 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/stringImport.js +15 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/symbolSpecifier.d.ts +9 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/symbolSpecifier.js +14 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/variableDeclaration.d.ts +9 -0
- package/dist/modules/typescript-parser/code-generators/typescript-generators/variableDeclaration.js +14 -0
- package/dist/modules/typescript-parser/declarations/AccessorDeclaration.d.ts +40 -0
- package/dist/modules/typescript-parser/declarations/AccessorDeclaration.js +45 -0
- package/dist/modules/typescript-parser/declarations/ClassDeclaration.d.ts +34 -0
- package/dist/modules/typescript-parser/declarations/ClassDeclaration.js +26 -0
- package/dist/modules/typescript-parser/declarations/ConstructorDeclaration.d.ts +18 -0
- package/dist/modules/typescript-parser/declarations/ConstructorDeclaration.js +20 -0
- package/dist/modules/typescript-parser/declarations/Declaration.d.ts +215 -0
- package/dist/modules/typescript-parser/declarations/Declaration.js +2 -0
- package/dist/modules/typescript-parser/declarations/DeclarationInfo.d.ts +13 -0
- package/dist/modules/typescript-parser/declarations/DeclarationInfo.js +17 -0
- package/dist/modules/typescript-parser/declarations/DeclarationVisibility.d.ts +18 -0
- package/dist/modules/typescript-parser/declarations/DeclarationVisibility.js +22 -0
- package/dist/modules/typescript-parser/declarations/DefaultDeclaration.d.ts +21 -0
- package/dist/modules/typescript-parser/declarations/DefaultDeclaration.js +28 -0
- package/dist/modules/typescript-parser/declarations/EnumDeclaration.d.ts +16 -0
- package/dist/modules/typescript-parser/declarations/EnumDeclaration.js +20 -0
- package/dist/modules/typescript-parser/declarations/FunctionDeclaration.d.ts +23 -0
- package/dist/modules/typescript-parser/declarations/FunctionDeclaration.js +25 -0
- package/dist/modules/typescript-parser/declarations/InterfaceDeclaration.d.ts +27 -0
- package/dist/modules/typescript-parser/declarations/InterfaceDeclaration.js +24 -0
- package/dist/modules/typescript-parser/declarations/MethodDeclaration.d.ts +28 -0
- package/dist/modules/typescript-parser/declarations/MethodDeclaration.js +29 -0
- package/dist/modules/typescript-parser/declarations/ModuleDeclaration.d.ts +15 -0
- package/dist/modules/typescript-parser/declarations/ModuleDeclaration.js +19 -0
- package/dist/modules/typescript-parser/declarations/ParameterDeclaration.d.ts +33 -0
- package/dist/modules/typescript-parser/declarations/ParameterDeclaration.js +54 -0
- package/dist/modules/typescript-parser/declarations/PropertyDeclaration.d.ts +20 -0
- package/dist/modules/typescript-parser/declarations/PropertyDeclaration.js +23 -0
- package/dist/modules/typescript-parser/declarations/TypeAliasDeclaration.d.ts +19 -0
- package/dist/modules/typescript-parser/declarations/TypeAliasDeclaration.js +22 -0
- package/dist/modules/typescript-parser/declarations/VariableDeclaration.d.ts +19 -0
- package/dist/modules/typescript-parser/declarations/VariableDeclaration.js +22 -0
- package/dist/modules/typescript-parser/declarations/index.d.ts +16 -0
- package/dist/modules/typescript-parser/declarations/index.js +19 -0
- package/dist/modules/typescript-parser/errors/NotGeneratableYetError.d.ts +11 -0
- package/dist/modules/typescript-parser/errors/NotGeneratableYetError.js +17 -0
- package/dist/modules/typescript-parser/exports/AllExport.d.ts +14 -0
- package/dist/modules/typescript-parser/exports/AllExport.js +18 -0
- package/dist/modules/typescript-parser/exports/AssignedExport.d.ts +26 -0
- package/dist/modules/typescript-parser/exports/AssignedExport.js +38 -0
- package/dist/modules/typescript-parser/exports/Export.d.ts +10 -0
- package/dist/modules/typescript-parser/exports/Export.js +2 -0
- package/dist/modules/typescript-parser/exports/NamedExport.d.ts +16 -0
- package/dist/modules/typescript-parser/exports/NamedExport.js +18 -0
- package/dist/modules/typescript-parser/exports/index.d.ts +4 -0
- package/dist/modules/typescript-parser/exports/index.js +7 -0
- package/dist/modules/typescript-parser/imports/ExternalModuleImport.d.ts +25 -0
- package/dist/modules/typescript-parser/imports/ExternalModuleImport.js +33 -0
- package/dist/modules/typescript-parser/imports/Import.d.ts +43 -0
- package/dist/modules/typescript-parser/imports/Import.js +2 -0
- package/dist/modules/typescript-parser/imports/NamedImport.d.ts +29 -0
- package/dist/modules/typescript-parser/imports/NamedImport.js +38 -0
- package/dist/modules/typescript-parser/imports/NamespaceImport.d.ts +24 -0
- package/dist/modules/typescript-parser/imports/NamespaceImport.js +32 -0
- package/dist/modules/typescript-parser/imports/StringImport.d.ts +23 -0
- package/dist/modules/typescript-parser/imports/StringImport.js +31 -0
- package/dist/modules/typescript-parser/imports/index.d.ts +5 -0
- package/dist/modules/typescript-parser/imports/index.js +8 -0
- package/dist/modules/typescript-parser/index.d.ts +12 -0
- package/dist/modules/typescript-parser/index.js +14 -0
- package/dist/modules/typescript-parser/node-parser/changes/parseType.d.ts +14 -0
- package/dist/modules/typescript-parser/node-parser/changes/parseType.js +35 -0
- package/dist/modules/typescript-parser/node-parser/class-parser.d.ts +30 -0
- package/dist/modules/typescript-parser/node-parser/class-parser.js +143 -0
- package/dist/modules/typescript-parser/node-parser/enum-parser.d.ts +10 -0
- package/dist/modules/typescript-parser/node-parser/enum-parser.js +18 -0
- package/dist/modules/typescript-parser/node-parser/export-parser.d.ts +10 -0
- package/dist/modules/typescript-parser/node-parser/export-parser.js +58 -0
- package/dist/modules/typescript-parser/node-parser/function-parser.d.ts +33 -0
- package/dist/modules/typescript-parser/node-parser/function-parser.js +101 -0
- package/dist/modules/typescript-parser/node-parser/identifier-parser.d.ts +10 -0
- package/dist/modules/typescript-parser/node-parser/identifier-parser.js +81 -0
- package/dist/modules/typescript-parser/node-parser/import-parser.d.ts +10 -0
- package/dist/modules/typescript-parser/node-parser/import-parser.js +54 -0
- package/dist/modules/typescript-parser/node-parser/index.d.ts +0 -0
- package/dist/modules/typescript-parser/node-parser/index.js +11 -0
- package/dist/modules/typescript-parser/node-parser/interface-parser.d.ts +11 -0
- package/dist/modules/typescript-parser/node-parser/interface-parser.js +57 -0
- package/dist/modules/typescript-parser/node-parser/module-parser.d.ts +12 -0
- package/dist/modules/typescript-parser/node-parser/module-parser.js +23 -0
- package/dist/modules/typescript-parser/node-parser/parse-utilities.d.ts +55 -0
- package/dist/modules/typescript-parser/node-parser/parse-utilities.js +96 -0
- package/dist/modules/typescript-parser/node-parser/traverse-ast.d.ts +1 -0
- package/dist/modules/typescript-parser/node-parser/traverse-ast.js +14 -0
- package/dist/modules/typescript-parser/node-parser/type-alias-parser.d.ts +10 -0
- package/dist/modules/typescript-parser/node-parser/type-alias-parser.js +20 -0
- package/dist/modules/typescript-parser/node-parser/variable-parser.d.ts +11 -0
- package/dist/modules/typescript-parser/node-parser/variable-parser.js +30 -0
- package/dist/modules/typescript-parser/package-lock.json +16793 -0
- package/dist/modules/typescript-parser/package.json +55 -0
- package/dist/modules/typescript-parser/resources/File.d.ts +45 -0
- package/dist/modules/typescript-parser/resources/File.js +58 -0
- package/dist/modules/typescript-parser/resources/Module.d.ts +35 -0
- package/dist/modules/typescript-parser/resources/Module.js +50 -0
- package/dist/modules/typescript-parser/resources/Namespace.d.ts +35 -0
- package/dist/modules/typescript-parser/resources/Namespace.js +50 -0
- package/dist/modules/typescript-parser/resources/Resource.d.ts +64 -0
- package/dist/modules/typescript-parser/resources/Resource.js +2 -0
- package/dist/modules/typescript-parser/resources/index.d.ts +4 -0
- package/dist/modules/typescript-parser/resources/index.js +7 -0
- package/dist/modules/typescript-parser/type-guards/TypescriptGuards.d.ts +153 -0
- package/dist/modules/typescript-parser/type-guards/TypescriptGuards.js +213 -0
- package/dist/modules/typescript-parser/type-guards/TypescriptHeroGuards.d.ts +26 -0
- package/dist/modules/typescript-parser/type-guards/TypescriptHeroGuards.js +36 -0
- package/dist/modules/typescript-parser/utilities/PathHelpers.d.ts +22 -0
- package/dist/modules/typescript-parser/utilities/PathHelpers.js +42 -0
- package/dist/modules/typescript-parser/utilities/StringTemplate.d.ts +9 -0
- package/dist/modules/typescript-parser/utilities/StringTemplate.js +21 -0
- package/dist/src/runBuild.js +0 -0
- package/dist/src/runWatch.js +0 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.5](https://github.com/proteinjs/reflection/compare/@proteinjs/reflection-build@1.0.4...@proteinjs/reflection-build@1.0.5) (2024-04-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @proteinjs/reflection-build
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.4](https://github.com/proteinjs/reflection/compare/@proteinjs/reflection-build@1.0.3...@proteinjs/reflection-build@1.0.4) (2024-04-17)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @proteinjs/reflection-build
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.0.3](https://github.com/proteinjs/reflection/compare/@proteinjs/reflection-build@1.0.2...@proteinjs/reflection-build@1.0.3) (2024-04-17)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @proteinjs/reflection-build
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
version: "{build} - {branch}"
|
|
2
|
+
skip_tags: true
|
|
3
|
+
skip_branch_with_pr: true
|
|
4
|
+
|
|
5
|
+
matrix:
|
|
6
|
+
fast_finish: true
|
|
7
|
+
|
|
8
|
+
environment:
|
|
9
|
+
matrix:
|
|
10
|
+
- nodejs_version: "10"
|
|
11
|
+
|
|
12
|
+
install:
|
|
13
|
+
- ps: Install-Product node $env:nodejs_version
|
|
14
|
+
- npm install
|
|
15
|
+
|
|
16
|
+
test_script:
|
|
17
|
+
- npm test
|
|
18
|
+
- npm install -g codecov
|
|
19
|
+
- codecov
|
|
20
|
+
- npm run build
|
|
21
|
+
|
|
22
|
+
build: off
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { DeclarationInfo } from './declarations/DeclarationInfo';
|
|
2
|
+
import { TypescriptParser } from './TypescriptParser';
|
|
3
|
+
/**
|
|
4
|
+
* IndexDelta type, is calculated by the declaration index to give an overview, what has changed in the index.
|
|
5
|
+
* Returns a list of deleted declarations, newly added declarations (with the corresponding infos) and
|
|
6
|
+
* which declarations have been updated (with all declarations under that name).
|
|
7
|
+
*/
|
|
8
|
+
export declare type IndexDelta = {
|
|
9
|
+
added: {
|
|
10
|
+
[declaration: string]: DeclarationInfo[];
|
|
11
|
+
};
|
|
12
|
+
updated: {
|
|
13
|
+
[declaration: string]: DeclarationInfo[];
|
|
14
|
+
};
|
|
15
|
+
deleted: string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Interface for file changes. Contains lists of file uri's to the specific action.
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @interface FileChanges
|
|
22
|
+
*/
|
|
23
|
+
export interface FileChanges {
|
|
24
|
+
created: string[];
|
|
25
|
+
updated: string[];
|
|
26
|
+
deleted: string[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Global index of declarations. Contains declarations and origins.
|
|
30
|
+
* Provides reverse index for search and declaration info for imports.
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
* @class DeclarationIndex
|
|
34
|
+
*/
|
|
35
|
+
export declare class DeclarationIndex {
|
|
36
|
+
private parser;
|
|
37
|
+
private rootPath;
|
|
38
|
+
private building;
|
|
39
|
+
/**
|
|
40
|
+
* Hash of parsed resources. Contains all parsed files / namespaces / declarations
|
|
41
|
+
* of the current workspace.
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
* @type {Resources}
|
|
45
|
+
* @memberof DeclarationIndex
|
|
46
|
+
*/
|
|
47
|
+
private parsedResources;
|
|
48
|
+
/**
|
|
49
|
+
* Declaration index. Reverse index from a name to many declarations assotiated to the name.
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
* @type {({ [declaration: string]: DeclarationInfo[] } | undefined)}
|
|
53
|
+
* @memberof DeclarationIndex
|
|
54
|
+
*/
|
|
55
|
+
private _index;
|
|
56
|
+
/**
|
|
57
|
+
* Indicator if the first index was loaded and calculated or not.
|
|
58
|
+
*
|
|
59
|
+
* @readonly
|
|
60
|
+
* @type {boolean}
|
|
61
|
+
* @memberof DeclarationIndex
|
|
62
|
+
*/
|
|
63
|
+
get indexReady(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Reverse index of the declarations.
|
|
66
|
+
*
|
|
67
|
+
* @readonly
|
|
68
|
+
* @type {({ [declaration: string]: DeclarationInfo[] } | undefined)}
|
|
69
|
+
* @memberof DeclarationIndex
|
|
70
|
+
*/
|
|
71
|
+
get index(): {
|
|
72
|
+
[declaration: string]: DeclarationInfo[];
|
|
73
|
+
} | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* List of all declaration information. Contains the typescript declaration and the
|
|
76
|
+
* "from" information (from where the symbol is imported).
|
|
77
|
+
*
|
|
78
|
+
* @readonly
|
|
79
|
+
* @type {DeclarationInfo[]}
|
|
80
|
+
* @memberof DeclarationIndex
|
|
81
|
+
*/
|
|
82
|
+
get declarationInfos(): DeclarationInfo[];
|
|
83
|
+
constructor(parser: TypescriptParser, rootPath: string);
|
|
84
|
+
/**
|
|
85
|
+
* Calculates the differences between two indices. Calculates removed, added and updated declarations.
|
|
86
|
+
* The updated declarations are calculated and all declarations that the new index contains are inserted in the list.
|
|
87
|
+
*
|
|
88
|
+
* @static
|
|
89
|
+
* @param {{ [declaration: string]: DeclarationInfo[] }} oldIndex
|
|
90
|
+
* @param {{ [declaration: string]: DeclarationInfo[] }} newIndex
|
|
91
|
+
* @returns {IndexDelta}
|
|
92
|
+
* @memberof DeclarationIndex
|
|
93
|
+
*/
|
|
94
|
+
static calculateIndexDelta(oldIndex: {
|
|
95
|
+
[declaration: string]: DeclarationInfo[];
|
|
96
|
+
}, newIndex: {
|
|
97
|
+
[declaration: string]: DeclarationInfo[];
|
|
98
|
+
}): IndexDelta;
|
|
99
|
+
/**
|
|
100
|
+
* Resets the whole index. Does delete everything. Period.
|
|
101
|
+
* Is useful for unit testing or similar things.
|
|
102
|
+
*
|
|
103
|
+
* @memberof DeclarationIndex
|
|
104
|
+
*/
|
|
105
|
+
reset(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Tells the index to build a new index.
|
|
108
|
+
* Can be canceled with a cancellationToken.
|
|
109
|
+
*
|
|
110
|
+
* @param {string[]} filePathes
|
|
111
|
+
* @returns {Promise<void>}
|
|
112
|
+
*
|
|
113
|
+
* @memberof DeclarationIndex
|
|
114
|
+
*/
|
|
115
|
+
buildIndex(filePathes: string[]): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Is called when file events happen. Does reindex for the changed files and creates a new index.
|
|
118
|
+
* Returns the differences for the new index.
|
|
119
|
+
*
|
|
120
|
+
* @param {FileEvent[]} changes
|
|
121
|
+
* @returns {Promise<IndexDelta>}
|
|
122
|
+
*
|
|
123
|
+
* @memberof DeclarationIndex
|
|
124
|
+
*/
|
|
125
|
+
reindexForChanges(changes: FileChanges): Promise<IndexDelta>;
|
|
126
|
+
/**
|
|
127
|
+
* Returns a list of files that export a certain resource (declaration).
|
|
128
|
+
*
|
|
129
|
+
* @private
|
|
130
|
+
* @param {string} resourceToCheck
|
|
131
|
+
* @returns {string[]}
|
|
132
|
+
*
|
|
133
|
+
* @memberof DeclarationIndex
|
|
134
|
+
*/
|
|
135
|
+
private getExportedResources;
|
|
136
|
+
/**
|
|
137
|
+
* Checks if a file does export another resource.
|
|
138
|
+
* (i.e. export ... from ...)
|
|
139
|
+
*
|
|
140
|
+
* @private
|
|
141
|
+
* @param {File} resource The file that is checked
|
|
142
|
+
* @param {string} resourcePath The resource that is searched for
|
|
143
|
+
* @returns {boolean}
|
|
144
|
+
*
|
|
145
|
+
* @memberof DeclarationIndex
|
|
146
|
+
*/
|
|
147
|
+
private doesExportResource;
|
|
148
|
+
/**
|
|
149
|
+
* Does parse the resources (symbols and declarations) of a given file.
|
|
150
|
+
* Can be cancelled with the token.
|
|
151
|
+
*
|
|
152
|
+
* @private
|
|
153
|
+
* @param {File[]} [files=[]]
|
|
154
|
+
* @returns {Promise<Resources>}
|
|
155
|
+
*
|
|
156
|
+
* @memberof DeclarationIndex
|
|
157
|
+
*/
|
|
158
|
+
private parseResources;
|
|
159
|
+
/**
|
|
160
|
+
* Creates a reverse index out of the give resources.
|
|
161
|
+
* Can be cancelled with the token.
|
|
162
|
+
*
|
|
163
|
+
* @private
|
|
164
|
+
* @param {Resources} resources
|
|
165
|
+
* @returns {Promise<ResourceIndex>}
|
|
166
|
+
*
|
|
167
|
+
* @memberof DeclarationIndex
|
|
168
|
+
*/
|
|
169
|
+
private createIndex;
|
|
170
|
+
/**
|
|
171
|
+
* Process all exports of a the parsed resources. Does move the declarations accordingly to their
|
|
172
|
+
* export nature.
|
|
173
|
+
*
|
|
174
|
+
* @private
|
|
175
|
+
* @param {Resources} parsedResources
|
|
176
|
+
* @param {Resource} resource
|
|
177
|
+
* @param {Resource[]} [processedResources=[]]
|
|
178
|
+
* @returns {void}
|
|
179
|
+
*
|
|
180
|
+
* @memberof DeclarationIndex
|
|
181
|
+
*/
|
|
182
|
+
private processResourceExports;
|
|
183
|
+
/**
|
|
184
|
+
* Processes an all export, does move the declarations accordingly.
|
|
185
|
+
* (i.e. export * from './myFile')
|
|
186
|
+
*
|
|
187
|
+
* @private
|
|
188
|
+
* @param {Resource} exportingLib
|
|
189
|
+
* @param {Resource} exportedLib
|
|
190
|
+
*
|
|
191
|
+
* @memberof DeclarationIndex
|
|
192
|
+
*/
|
|
193
|
+
private processAllFromExport;
|
|
194
|
+
/**
|
|
195
|
+
* Processes a named export, does move the declarations accordingly.
|
|
196
|
+
* (i.e. export {MyClass} from './myFile')
|
|
197
|
+
*
|
|
198
|
+
* @private
|
|
199
|
+
* @param {NamedExport} tsExport
|
|
200
|
+
* @param {Resource} exportingLib
|
|
201
|
+
* @param {Resource} exportedLib
|
|
202
|
+
*
|
|
203
|
+
* @memberof DeclarationIndex
|
|
204
|
+
*/
|
|
205
|
+
private processNamedFromExport;
|
|
206
|
+
/**
|
|
207
|
+
* Processes an assigned export, does move the declarations accordingly.
|
|
208
|
+
* (i.e. export = namespaceName)
|
|
209
|
+
*
|
|
210
|
+
* @private
|
|
211
|
+
* @param {AssignedExport} tsExport
|
|
212
|
+
* @param {Resource} exportingLib
|
|
213
|
+
*
|
|
214
|
+
* @memberof DeclarationIndex
|
|
215
|
+
*/
|
|
216
|
+
private processAssignedExport;
|
|
217
|
+
}
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeclarationIndex = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const DeclarationInfo_1 = require("./declarations/DeclarationInfo");
|
|
8
|
+
const ModuleDeclaration_1 = require("./declarations/ModuleDeclaration");
|
|
9
|
+
const AllExport_1 = require("./exports/AllExport");
|
|
10
|
+
const AssignedExport_1 = require("./exports/AssignedExport");
|
|
11
|
+
const NamedExport_1 = require("./exports/NamedExport");
|
|
12
|
+
const File_1 = require("./resources/File");
|
|
13
|
+
const Module_1 = require("./resources/Module");
|
|
14
|
+
const Namespace_1 = require("./resources/Namespace");
|
|
15
|
+
const TypescriptHeroGuards_1 = require("./type-guards/TypescriptHeroGuards");
|
|
16
|
+
const PathHelpers_1 = require("./utilities/PathHelpers");
|
|
17
|
+
/**
|
|
18
|
+
* Returns the name of the node folder. Is used as the library name for indexing.
|
|
19
|
+
* (e.g. ./node_modules/webpack returns webpack)
|
|
20
|
+
*
|
|
21
|
+
* @param {string} path
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
function getNodeLibraryName(path) {
|
|
25
|
+
const dirs = path.split(/\/|\\/);
|
|
26
|
+
const nodeIndex = dirs.indexOf('node_modules');
|
|
27
|
+
return PathHelpers_1.normalizeFilename(dirs.slice(nodeIndex + 1).join('/'))
|
|
28
|
+
.replace(new RegExp(`/(index|${dirs[nodeIndex + 1]}|${dirs[dirs.length - 2]})$`), '');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Global index of declarations. Contains declarations and origins.
|
|
32
|
+
* Provides reverse index for search and declaration info for imports.
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @class DeclarationIndex
|
|
36
|
+
*/
|
|
37
|
+
class DeclarationIndex {
|
|
38
|
+
constructor(parser, rootPath) {
|
|
39
|
+
this.parser = parser;
|
|
40
|
+
this.rootPath = rootPath;
|
|
41
|
+
this.building = false;
|
|
42
|
+
/**
|
|
43
|
+
* Hash of parsed resources. Contains all parsed files / namespaces / declarations
|
|
44
|
+
* of the current workspace.
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
* @type {Resources}
|
|
48
|
+
* @memberof DeclarationIndex
|
|
49
|
+
*/
|
|
50
|
+
this.parsedResources = Object.create(null);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Indicator if the first index was loaded and calculated or not.
|
|
54
|
+
*
|
|
55
|
+
* @readonly
|
|
56
|
+
* @type {boolean}
|
|
57
|
+
* @memberof DeclarationIndex
|
|
58
|
+
*/
|
|
59
|
+
get indexReady() {
|
|
60
|
+
return this._index !== undefined; // && this._indexWithBarrels !== undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Reverse index of the declarations.
|
|
64
|
+
*
|
|
65
|
+
* @readonly
|
|
66
|
+
* @type {({ [declaration: string]: DeclarationInfo[] } | undefined)}
|
|
67
|
+
* @memberof DeclarationIndex
|
|
68
|
+
*/
|
|
69
|
+
get index() {
|
|
70
|
+
return this._index;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* List of all declaration information. Contains the typescript declaration and the
|
|
74
|
+
* "from" information (from where the symbol is imported).
|
|
75
|
+
*
|
|
76
|
+
* @readonly
|
|
77
|
+
* @type {DeclarationInfo[]}
|
|
78
|
+
* @memberof DeclarationIndex
|
|
79
|
+
*/
|
|
80
|
+
get declarationInfos() {
|
|
81
|
+
return Object
|
|
82
|
+
.keys(this.index)
|
|
83
|
+
.sort()
|
|
84
|
+
.reduce((all, key) => all.concat(this.index[key]), []);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Calculates the differences between two indices. Calculates removed, added and updated declarations.
|
|
88
|
+
* The updated declarations are calculated and all declarations that the new index contains are inserted in the list.
|
|
89
|
+
*
|
|
90
|
+
* @static
|
|
91
|
+
* @param {{ [declaration: string]: DeclarationInfo[] }} oldIndex
|
|
92
|
+
* @param {{ [declaration: string]: DeclarationInfo[] }} newIndex
|
|
93
|
+
* @returns {IndexDelta}
|
|
94
|
+
* @memberof DeclarationIndex
|
|
95
|
+
*/
|
|
96
|
+
static calculateIndexDelta(oldIndex, newIndex) {
|
|
97
|
+
const oldKeys = Object.keys(oldIndex);
|
|
98
|
+
const newKeys = Object.keys(newIndex);
|
|
99
|
+
return {
|
|
100
|
+
added: lodash_1.difference(newKeys, oldKeys).reduce((obj, currentKey) => {
|
|
101
|
+
obj[currentKey] = newIndex[currentKey];
|
|
102
|
+
return obj;
|
|
103
|
+
}, {}),
|
|
104
|
+
updated: lodash_1.intersection(oldKeys, newKeys).reduce((obj, currentKey) => {
|
|
105
|
+
const old = oldIndex[currentKey];
|
|
106
|
+
const neu = newIndex[currentKey];
|
|
107
|
+
if (lodash_1.differenceWith(neu, old, lodash_1.isEqual).length > 0 || lodash_1.differenceWith(old, neu, lodash_1.isEqual).length > 0) {
|
|
108
|
+
obj[currentKey] = neu;
|
|
109
|
+
}
|
|
110
|
+
return obj;
|
|
111
|
+
}, {}),
|
|
112
|
+
deleted: lodash_1.difference(oldKeys, newKeys),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resets the whole index. Does delete everything. Period.
|
|
117
|
+
* Is useful for unit testing or similar things.
|
|
118
|
+
*
|
|
119
|
+
* @memberof DeclarationIndex
|
|
120
|
+
*/
|
|
121
|
+
reset() {
|
|
122
|
+
this.parsedResources = Object.create(null);
|
|
123
|
+
this._index = undefined;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Tells the index to build a new index.
|
|
127
|
+
* Can be canceled with a cancellationToken.
|
|
128
|
+
*
|
|
129
|
+
* @param {string[]} filePathes
|
|
130
|
+
* @returns {Promise<void>}
|
|
131
|
+
*
|
|
132
|
+
* @memberof DeclarationIndex
|
|
133
|
+
*/
|
|
134
|
+
buildIndex(filePathes) {
|
|
135
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
if (this.building) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
this.building = true;
|
|
141
|
+
const parsed = yield this.parser.parseFiles(filePathes, this.rootPath);
|
|
142
|
+
this.parsedResources = yield this.parseResources(parsed);
|
|
143
|
+
this._index = yield this.createIndex(this.parsedResources);
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
throw e;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
this.building = false;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Is called when file events happen. Does reindex for the changed files and creates a new index.
|
|
155
|
+
* Returns the differences for the new index.
|
|
156
|
+
*
|
|
157
|
+
* @param {FileEvent[]} changes
|
|
158
|
+
* @returns {Promise<IndexDelta>}
|
|
159
|
+
*
|
|
160
|
+
* @memberof DeclarationIndex
|
|
161
|
+
*/
|
|
162
|
+
reindexForChanges(changes) {
|
|
163
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const rebuildResources = [];
|
|
165
|
+
const removeResources = [];
|
|
166
|
+
const rebuildFiles = [];
|
|
167
|
+
for (const change of changes.deleted) {
|
|
168
|
+
const filePath = PathHelpers_1.normalizePathUri(change);
|
|
169
|
+
const resource = '/' + PathHelpers_1.normalizeFilename(path_1.relative(this.rootPath, filePath));
|
|
170
|
+
if (removeResources.indexOf(resource) < 0) {
|
|
171
|
+
removeResources.push(resource);
|
|
172
|
+
}
|
|
173
|
+
for (const file of this.getExportedResources(resource)) {
|
|
174
|
+
if (rebuildFiles.indexOf(file) < 0) {
|
|
175
|
+
rebuildFiles.push(file);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
for (const change of (changes.created || []).concat(changes.updated)) {
|
|
180
|
+
const filePath = PathHelpers_1.normalizePathUri(change);
|
|
181
|
+
const resource = '/' + PathHelpers_1.normalizeFilename(path_1.relative(this.rootPath, filePath));
|
|
182
|
+
if (rebuildResources.indexOf(resource) < 0) {
|
|
183
|
+
rebuildResources.push(resource);
|
|
184
|
+
}
|
|
185
|
+
if (rebuildFiles.indexOf(filePath) < 0) {
|
|
186
|
+
rebuildFiles.push(filePath);
|
|
187
|
+
}
|
|
188
|
+
for (const file of this.getExportedResources(resource)) {
|
|
189
|
+
if (rebuildFiles.indexOf(file) < 0) {
|
|
190
|
+
rebuildFiles.push(file);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const resources = yield this.parseResources(yield this.parser.parseFiles(rebuildFiles, this.rootPath));
|
|
195
|
+
for (const del of removeResources) {
|
|
196
|
+
delete this.parsedResources[del];
|
|
197
|
+
}
|
|
198
|
+
for (const key of Object.keys(resources)) {
|
|
199
|
+
this.parsedResources[key] = resources[key];
|
|
200
|
+
}
|
|
201
|
+
const old = this._index || {};
|
|
202
|
+
this._index = yield this.createIndex(this.parsedResources);
|
|
203
|
+
return DeclarationIndex.calculateIndexDelta(old, this._index);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Returns a list of files that export a certain resource (declaration).
|
|
208
|
+
*
|
|
209
|
+
* @private
|
|
210
|
+
* @param {string} resourceToCheck
|
|
211
|
+
* @returns {string[]}
|
|
212
|
+
*
|
|
213
|
+
* @memberof DeclarationIndex
|
|
214
|
+
*/
|
|
215
|
+
getExportedResources(resourceToCheck) {
|
|
216
|
+
const resources = [];
|
|
217
|
+
Object
|
|
218
|
+
.keys(this.parsedResources)
|
|
219
|
+
.forEach((key) => {
|
|
220
|
+
const resource = this.parsedResources[key];
|
|
221
|
+
if (resource instanceof File_1.File && this.doesExportResource(resource, resourceToCheck)) {
|
|
222
|
+
resources.push(resource.filePath);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return resources;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Checks if a file does export another resource.
|
|
229
|
+
* (i.e. export ... from ...)
|
|
230
|
+
*
|
|
231
|
+
* @private
|
|
232
|
+
* @param {File} resource The file that is checked
|
|
233
|
+
* @param {string} resourcePath The resource that is searched for
|
|
234
|
+
* @returns {boolean}
|
|
235
|
+
*
|
|
236
|
+
* @memberof DeclarationIndex
|
|
237
|
+
*/
|
|
238
|
+
doesExportResource(resource, resourcePath) {
|
|
239
|
+
let exportsResource = false;
|
|
240
|
+
for (const ex of resource.exports) {
|
|
241
|
+
if (exportsResource) {
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
if (ex instanceof AllExport_1.AllExport || ex instanceof NamedExport_1.NamedExport) {
|
|
245
|
+
const exported = '/' + PathHelpers_1.toPosix(path_1.relative(this.rootPath, path_1.normalize(path_1.join(resource.parsedPath.dir, ex.from))));
|
|
246
|
+
exportsResource = exported === resourcePath;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return exportsResource;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Does parse the resources (symbols and declarations) of a given file.
|
|
253
|
+
* Can be cancelled with the token.
|
|
254
|
+
*
|
|
255
|
+
* @private
|
|
256
|
+
* @param {File[]} [files=[]]
|
|
257
|
+
* @returns {Promise<Resources>}
|
|
258
|
+
*
|
|
259
|
+
* @memberof DeclarationIndex
|
|
260
|
+
*/
|
|
261
|
+
parseResources(files = []) {
|
|
262
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
const parsedResources = Object.create(null);
|
|
264
|
+
for (const file of files) {
|
|
265
|
+
if (file.filePath.indexOf('typings') > -1 || file.filePath.indexOf('node_modules/@types') > -1) {
|
|
266
|
+
for (const resource of file.resources) {
|
|
267
|
+
parsedResources[resource.identifier] = resource;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (file.filePath.indexOf('node_modules') > -1) {
|
|
271
|
+
const libname = getNodeLibraryName(file.filePath);
|
|
272
|
+
parsedResources[libname] = file;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
parsedResources[file.identifier] = file;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const key of Object.keys(parsedResources).sort((k1, k2) => k2.length - k1.length)) {
|
|
279
|
+
const resource = parsedResources[key];
|
|
280
|
+
resource.declarations = resource.declarations.filter(o => TypescriptHeroGuards_1.isExportableDeclaration(o) && o.isExported);
|
|
281
|
+
this.processResourceExports(parsedResources, resource);
|
|
282
|
+
}
|
|
283
|
+
return parsedResources;
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Creates a reverse index out of the give resources.
|
|
288
|
+
* Can be cancelled with the token.
|
|
289
|
+
*
|
|
290
|
+
* @private
|
|
291
|
+
* @param {Resources} resources
|
|
292
|
+
* @returns {Promise<ResourceIndex>}
|
|
293
|
+
*
|
|
294
|
+
* @memberof DeclarationIndex
|
|
295
|
+
*/
|
|
296
|
+
createIndex(resources) {
|
|
297
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
298
|
+
// Use an empty object without a prototype, so that "toString" (for example) can be indexed
|
|
299
|
+
// Thanks to @gund in https://github.com/buehler/typescript-hero/issues/79
|
|
300
|
+
const index = Object.create(null);
|
|
301
|
+
for (const key of Object.keys(resources)) {
|
|
302
|
+
const resource = resources[key];
|
|
303
|
+
if (resource instanceof Namespace_1.Namespace || resource instanceof Module_1.Module) {
|
|
304
|
+
if (!index[resource.name]) {
|
|
305
|
+
index[resource.name] = [];
|
|
306
|
+
}
|
|
307
|
+
index[resource.name].push(new DeclarationInfo_1.DeclarationInfo(new ModuleDeclaration_1.ModuleDeclaration(resource.getNamespaceAlias(), resource.start, resource.end), resource.name));
|
|
308
|
+
}
|
|
309
|
+
for (const declaration of resource.declarations) {
|
|
310
|
+
if (!index[declaration.name]) {
|
|
311
|
+
index[declaration.name] = [];
|
|
312
|
+
}
|
|
313
|
+
const from = key.replace(/\/index$/, '') || '/';
|
|
314
|
+
if (!index[declaration.name].some(o => o.declaration.constructor === declaration.constructor && o.from === from)) {
|
|
315
|
+
index[declaration.name].push(new DeclarationInfo_1.DeclarationInfo(declaration, from));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return index;
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Process all exports of a the parsed resources. Does move the declarations accordingly to their
|
|
324
|
+
* export nature.
|
|
325
|
+
*
|
|
326
|
+
* @private
|
|
327
|
+
* @param {Resources} parsedResources
|
|
328
|
+
* @param {Resource} resource
|
|
329
|
+
* @param {Resource[]} [processedResources=[]]
|
|
330
|
+
* @returns {void}
|
|
331
|
+
*
|
|
332
|
+
* @memberof DeclarationIndex
|
|
333
|
+
*/
|
|
334
|
+
processResourceExports(parsedResources, resource, processedResources = []) {
|
|
335
|
+
if (processedResources.indexOf(resource) >= 0 || resource.exports.length === 0) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
processedResources.push(resource);
|
|
339
|
+
for (const ex of resource.exports) {
|
|
340
|
+
if (resource instanceof File_1.File && (ex instanceof NamedExport_1.NamedExport || ex instanceof AllExport_1.AllExport)) {
|
|
341
|
+
if (!ex.from) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
let sourceLib = path_1.resolve(resource.parsedPath.dir, ex.from);
|
|
345
|
+
if (sourceLib.indexOf('node_modules') > -1) {
|
|
346
|
+
sourceLib = getNodeLibraryName(sourceLib);
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
sourceLib = '/' + PathHelpers_1.normalizeFilename(path_1.relative(this.rootPath, sourceLib));
|
|
350
|
+
}
|
|
351
|
+
if (!parsedResources[sourceLib]) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const exportedLib = parsedResources[sourceLib];
|
|
355
|
+
this.processResourceExports(parsedResources, exportedLib, processedResources);
|
|
356
|
+
if (ex instanceof AllExport_1.AllExport) {
|
|
357
|
+
this.processAllFromExport(resource, exportedLib);
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
this.processNamedFromExport(ex, resource, exportedLib);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
if (ex instanceof AssignedExport_1.AssignedExport) {
|
|
365
|
+
for (const lib of ex.exported.filter(o => !TypescriptHeroGuards_1.isExportableDeclaration(o))) {
|
|
366
|
+
this.processResourceExports(parsedResources, lib, processedResources);
|
|
367
|
+
}
|
|
368
|
+
this.processAssignedExport(ex, resource);
|
|
369
|
+
}
|
|
370
|
+
else if (ex instanceof NamedExport_1.NamedExport && ex.from && parsedResources[ex.from]) {
|
|
371
|
+
this.processResourceExports(parsedResources, parsedResources[ex.from], processedResources);
|
|
372
|
+
this.processNamedFromExport(ex, resource, parsedResources[ex.from]);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Processes an all export, does move the declarations accordingly.
|
|
379
|
+
* (i.e. export * from './myFile')
|
|
380
|
+
*
|
|
381
|
+
* @private
|
|
382
|
+
* @param {Resource} exportingLib
|
|
383
|
+
* @param {Resource} exportedLib
|
|
384
|
+
*
|
|
385
|
+
* @memberof DeclarationIndex
|
|
386
|
+
*/
|
|
387
|
+
processAllFromExport(exportingLib, exportedLib) {
|
|
388
|
+
exportingLib.declarations.push(...exportedLib.declarations);
|
|
389
|
+
exportedLib.declarations = [];
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Processes a named export, does move the declarations accordingly.
|
|
393
|
+
* (i.e. export {MyClass} from './myFile')
|
|
394
|
+
*
|
|
395
|
+
* @private
|
|
396
|
+
* @param {NamedExport} tsExport
|
|
397
|
+
* @param {Resource} exportingLib
|
|
398
|
+
* @param {Resource} exportedLib
|
|
399
|
+
*
|
|
400
|
+
* @memberof DeclarationIndex
|
|
401
|
+
*/
|
|
402
|
+
processNamedFromExport(tsExport, exportingLib, exportedLib) {
|
|
403
|
+
exportedLib.declarations
|
|
404
|
+
.forEach((o) => {
|
|
405
|
+
if (!tsExport.specifiers) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const ex = tsExport.specifiers.find(s => s.specifier === o.name);
|
|
409
|
+
if (!ex) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
exportedLib.declarations.splice(exportedLib.declarations.indexOf(o), 1);
|
|
413
|
+
if (ex.alias) {
|
|
414
|
+
o.name = ex.alias;
|
|
415
|
+
}
|
|
416
|
+
exportingLib.declarations.push(o);
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Processes an assigned export, does move the declarations accordingly.
|
|
421
|
+
* (i.e. export = namespaceName)
|
|
422
|
+
*
|
|
423
|
+
* @private
|
|
424
|
+
* @param {AssignedExport} tsExport
|
|
425
|
+
* @param {Resource} exportingLib
|
|
426
|
+
*
|
|
427
|
+
* @memberof DeclarationIndex
|
|
428
|
+
*/
|
|
429
|
+
processAssignedExport(tsExport, exportingLib) {
|
|
430
|
+
tsExport.exported.forEach((exported) => {
|
|
431
|
+
if (TypescriptHeroGuards_1.isExportableDeclaration(exported)) {
|
|
432
|
+
exportingLib.declarations.push(exported);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
exportingLib.declarations.push(...exported.declarations.filter(o => TypescriptHeroGuards_1.isExportableDeclaration(o) && o.isExported));
|
|
436
|
+
exported.declarations = [];
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
exports.DeclarationIndex = DeclarationIndex;
|