refactor(compiler-cli): support extracting the mesage bundle without writing a file (#13580)
This commit is contained in:
parent
6b65fc1286
commit
e49c7fae22
|
@ -31,10 +31,7 @@ export class Extractor {
|
||||||
// Checks the format and returns the extension
|
// Checks the format and returns the extension
|
||||||
const ext = this.getExtension(formatName);
|
const ext = this.getExtension(formatName);
|
||||||
|
|
||||||
const files = this.program.getSourceFiles().map(
|
const promiseBundle = this.extractBundle();
|
||||||
sf => this.ngCompilerHost.getCanonicalFileName(sf.fileName));
|
|
||||||
|
|
||||||
const promiseBundle = this.ngExtractor.extract(files);
|
|
||||||
|
|
||||||
return promiseBundle.then(bundle => {
|
return promiseBundle.then(bundle => {
|
||||||
const content = this.serialize(bundle, ext);
|
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 {
|
serialize(bundle: compiler.MessageBundle, ext: string): string {
|
||||||
let serializer: compiler.Serializer;
|
let serializer: compiler.Serializer;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue