File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -274,13 +274,26 @@ module ts {
274274 } ) ;
275275 }
276276
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+
277292 function processImportedModules ( file : SourceFile , basePath : string ) {
278293 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 ;
284297 if ( moduleName ) {
285298 var searchPath = basePath ;
286299 while ( true ) {
You can’t perform that action at this time.
0 commit comments