refactor(compiler): emit OutputAst and not sources (#16832)

This is in preparation for creating typescript nodes
directly from `OutputAst` nodes.
This commit is contained in:
Tobias Bosch
2017-05-17 11:21:08 -07:00
committed by Chuck Jazdzewski
parent 6123b9c0c6
commit de8d7c65f2
8 changed files with 102 additions and 70 deletions

View File

@ -44,8 +44,8 @@ export class CodeGenerator {
generatedModules.forEach(generatedModule => {
const sourceFile = this.program.getSourceFile(generatedModule.srcFileUrl);
const emitPath = this.ngCompilerHost.calculateEmitPath(generatedModule.genFileUrl);
const source = GENERATED_META_FILES.test(emitPath) ? generatedModule.source :
generatedModule.source;
const source =
generatedModule.source || compiler.toTypeScript(generatedModule, PREAMBLE);
this.host.writeFile(emitPath, source, false, () => {}, [sourceFile]);
});
});
@ -91,7 +91,6 @@ export class CodeGenerator {
i18nFormat: cliOptions.i18nFormat,
locale: cliOptions.locale, missingTranslation,
enableLegacyTemplate: options.enableLegacyTemplate !== false,
genFilePreamble: PREAMBLE,
});
return new CodeGenerator(options, program, tsCompilerHost, aotCompiler, ngCompilerHost);
}