cleanup a bit, think toward the future

This commit is contained in:
Wesley Wigham 2015-10-21 15:37:58 -07:00
parent 37bc2773a3
commit 3f52686974
2 changed files with 22 additions and 11 deletions

View file

@ -739,14 +739,15 @@ namespace ts {
if ((!root) && (compilerOptions.out || compilerOptions.outFile)) {
let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier);
if (moduleSymbol && moduleSymbol.valueDeclaration &&
moduleSymbol.valueDeclaration.kind === SyntaxKind.SourceFile &&
!isDeclarationFile(<SourceFile>moduleSymbol.valueDeclaration)) {
let nonRelativeModuleName = getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName);
write("\"");
write(nonRelativeModuleName);
write("\"");
return;
if (moduleSymbol) {
let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile;
if (moduleDeclaration && !isDeclarationFile(moduleDeclaration)) {
let nonRelativeModuleName = getExternalModuleNameFromPath(host, moduleDeclaration.fileName);
write("\"");
write(nonRelativeModuleName);
write("\"");
return;
}
}
}

View file

@ -6766,7 +6766,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
}
if (resolvePath) {
text = `"${lookupSpecifierName(externalImports[i])}"`;
let name = lookupSpecifierName(externalImports[i]);
if (name) {
text = `"${name}"`;
}
}
write(text);
}
@ -6791,7 +6794,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
specifier = (declaration as ImportDeclaration|ExportDeclaration).moduleSpecifier;
}
let moduleSymbol = resolver.getSymbolAtLocation(specifier);
return getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName);
let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile;
if (!moduleDeclaration || isDeclarationFile(moduleDeclaration)) {
return;
}
return getExternalModuleNameFromPath(host, moduleDeclaration.fileName);
}
interface AMDDependencyNames {
@ -6825,7 +6832,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let externalModuleName = getExternalModuleNameText(importNode);
if (resolvePath) {
externalModuleName = `"${lookupSpecifierName(importNode)}"`;
let name = lookupSpecifierName(importNode);
if (name) {
externalModuleName = `"${name}"`;
}
}
// Find the name of the module alias, if there is one