@@ -20,8 +20,7 @@ export function isTypeDeclaration(fileName: string): boolean {
20
20
}
21
21
22
22
function isImportOrExportDeclaration ( node : ts . Node ) {
23
- return ( ! ! ( < any > node ) . exportClause || ! ! ( < any > node ) . importClause )
24
- && ( < any > node ) . moduleSpecifier ;
23
+ return ! ! ( < any > node ) . moduleSpecifier ;
25
24
}
26
25
27
26
function isImportEqualsDeclaration ( node : ts . Node ) {
@@ -75,21 +74,21 @@ export class FileAnalyzer {
75
74
76
75
findImportDeclarations ( fileName : string ) : ts . ResolvedModule [ ] {
77
76
let sourceFile = this . state . getSourceFile ( fileName ) ;
78
- let isDeclaration = isTypeDeclaration ( fileName ) ;
79
77
80
78
let imports = [ ] ;
81
79
let visit = ( node : ts . Node ) => {
82
- if ( ! isDeclaration && isImportEqualsDeclaration ( node ) ) {
80
+ if ( isImportEqualsDeclaration ( node ) ) {
83
81
// we need this check to ensure that we have an external import
84
82
let importPath = ( < any > node ) . moduleReference . expression . text ;
85
83
imports . push ( importPath ) ;
86
- } else if ( ! isDeclaration && isImportOrExportDeclaration ( node ) ) {
84
+ } else if ( isImportOrExportDeclaration ( node ) ) {
87
85
let importPath = ( < any > node ) . moduleSpecifier . text ;
88
86
imports . push ( importPath ) ;
89
87
}
90
88
} ;
91
89
92
90
imports . push . apply ( imports , sourceFile . referencedFiles . map ( file => file . fileName ) ) ;
91
+
93
92
this . state . ts . forEachChild ( sourceFile , visit ) ;
94
93
95
94
let resolvedImports = imports . map ( ( importPath ) => {
0 commit comments