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)) { if ((!root) && (compilerOptions.out || compilerOptions.outFile)) {
let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier); let moduleSymbol = resolver.getSymbolAtLocation(moduleSpecifier);
if (moduleSymbol && moduleSymbol.valueDeclaration && if (moduleSymbol) {
moduleSymbol.valueDeclaration.kind === SyntaxKind.SourceFile && let moduleDeclaration = getDeclarationOfKind(moduleSymbol, SyntaxKind.SourceFile) as SourceFile;
!isDeclarationFile(<SourceFile>moduleSymbol.valueDeclaration)) { if (moduleDeclaration && !isDeclarationFile(moduleDeclaration)) {
let nonRelativeModuleName = getExternalModuleNameFromPath(host, (moduleSymbol.valueDeclaration as SourceFile).fileName); let nonRelativeModuleName = getExternalModuleNameFromPath(host, moduleDeclaration.fileName);
write("\""); write("\"");
write(nonRelativeModuleName); write(nonRelativeModuleName);
write("\""); write("\"");
return; return;
}
} }
} }

View file

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