refactor(compiler-cli): support extracting the mesage bundle without writing a file (#13580)

This commit is contained in:
Chuck Jazdzewski 2016-12-19 15:28:55 -08:00 committed by GitHub
parent 6b65fc1286
commit e49c7fae22
1 changed files with 8 additions and 4 deletions

View File

@ -31,10 +31,7 @@ export class Extractor {
// Checks the format and returns the extension
const ext = this.getExtension(formatName);
const files = this.program.getSourceFiles().map(
sf => this.ngCompilerHost.getCanonicalFileName(sf.fileName));
const promiseBundle = this.ngExtractor.extract(files);
const promiseBundle = this.extractBundle();
return promiseBundle.then(bundle => {
const content = this.serialize(bundle, ext);
@ -43,6 +40,13 @@ export class Extractor {
});
}
extractBundle(): Promise<compiler.MessageBundle> {
const files = this.program.getSourceFiles().map(
sf => this.ngCompilerHost.getCanonicalFileName(sf.fileName));
return this.ngExtractor.extract(files);
}
serialize(bundle: compiler.MessageBundle, ext: string): string {
let serializer: compiler.Serializer;