File tree 1 file changed +18
-5
lines changed
1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -274,13 +274,26 @@ module ts {
274
274
} ) ;
275
275
}
276
276
277
+ function getImportedModuleName ( node : Node ) : StringLiteralExpression {
278
+ if ( node . kind === SyntaxKind . ImportDeclaration ) {
279
+ return ( < ImportDeclaration > node ) . moduleSpecifier ;
280
+ }
281
+ if ( node . kind === SyntaxKind . ImportEqualsDeclaration ) {
282
+ var reference = ( < ImportEqualsDeclaration > node ) . moduleReference ;
283
+ if ( reference . kind === SyntaxKind . ExternalModuleReference ) {
284
+ var expr = ( < ExternalModuleReference > reference ) . expression ;
285
+ if ( expr && expr . kind === SyntaxKind . StringLiteral ) {
286
+ return < StringLiteralExpression > expr ;
287
+ }
288
+ }
289
+ }
290
+ }
291
+
277
292
function processImportedModules ( file : SourceFile , basePath : string ) {
278
293
forEach ( file . statements , node => {
279
- if ( isExternalModuleImportEqualsDeclaration ( node ) &&
280
- getExternalModuleImportEqualsDeclarationExpression ( node ) . kind === SyntaxKind . StringLiteral ) {
281
-
282
- var nameLiteral = < LiteralExpression > getExternalModuleImportEqualsDeclarationExpression ( node ) ;
283
- var moduleName = nameLiteral . text ;
294
+ if ( node . kind === SyntaxKind . ImportDeclaration || node . kind === SyntaxKind . ImportEqualsDeclaration ) {
295
+ var nameLiteral = getImportedModuleName ( node ) ;
296
+ var moduleName = nameLiteral && nameLiteral . text ;
284
297
if ( moduleName ) {
285
298
var searchPath = basePath ;
286
299
while ( true ) {
You can’t perform that action at this time.
0 commit comments