refactor(compiler): Reintroduce ReflectorHost and move Extractor into @angular/compiler

This commit is contained in:
Tobias Bosch
2016-11-18 08:40:41 -08:00
committed by Chuck Jazdzewski
parent 3c06a5dc25
commit 2a5bd2f345
9 changed files with 173 additions and 130 deletions

View File

@ -24,17 +24,7 @@ import {Extractor} from './extractor';
function extract(
ngOptions: tsc.AngularCompilerOptions, cliOptions: tsc.I18nExtractionCliOptions,
program: ts.Program, host: ts.CompilerHost) {
const resourceLoader: compiler.ResourceLoader = {
get: (s: string) => {
if (!host.fileExists(s)) {
// TODO: We should really have a test for error cases like this!
throw new Error(`Compilation failed. Resource file not found: ${s}`);
}
return Promise.resolve(host.readFile(s));
}
};
const extractor =
Extractor.create(ngOptions, cliOptions.i18nFormat, program, host, resourceLoader);
const extractor = Extractor.create(ngOptions, cliOptions.i18nFormat, program, host);
const bundlePromise: Promise<compiler.MessageBundle> = extractor.extract();