refactor(compiler-cli): refactor compiler host parameters (#13147)

This commit is contained in:
Chuck Jazdzewski
2016-12-01 13:24:51 -08:00
committed by Alex Rickabaugh
parent 5908b66ae9
commit 25a6da244c
6 changed files with 56 additions and 35 deletions

View File

@ -25,10 +25,8 @@ const DTS = /\.d\.ts$/;
* loader what to do.
*/
export class PathMappedCompilerHost extends CompilerHost {
constructor(
program: ts.Program, compilerHost: ts.CompilerHost, options: AngularCompilerOptions,
context?: CompilerHostContext) {
super(program, compilerHost, options, context);
constructor(program: ts.Program, options: AngularCompilerOptions, context: CompilerHostContext) {
super(program, options, context);
}
getCanonicalFileName(fileName: string): string {
@ -119,7 +117,7 @@ export class PathMappedCompilerHost extends CompilerHost {
getMetadataFor(filePath: string): ModuleMetadata[] {
for (const root of this.options.rootDirs || []) {
const rootedPath = path.join(root, filePath);
if (!this.compilerHost.fileExists(rootedPath)) {
if (!this.context.fileExists(rootedPath)) {
// If the file doesn't exists then we cannot return metadata for the file.
// This will occur if the user refernced a declared module for which no file
// exists for the module (i.e. jQuery or angularjs).