perf(core): add option to remove blank text nodes from compiled templates (#18823)

PR Close #18823
This commit is contained in:
Pawel Kozlowski
2017-07-28 15:58:28 +02:00
committed by Miško Hevery
parent 7ec28fe9af
commit b8b551cf2b
29 changed files with 536 additions and 48 deletions

View File

@ -104,6 +104,7 @@ export class CodeGenerator {
locale: cliOptions.locale, missingTranslation,
enableLegacyTemplate: options.enableLegacyTemplate !== false,
enableSummariesForJit: options.enableSummariesForJit !== false,
preserveWhitespaces: options.preserveWhitespaces,
});
return new CodeGenerator(options, program, tsCompilerHost, aotCompiler, ngCompilerHost);
}

View File

@ -91,6 +91,10 @@ export interface CompilerOptions extends ts.CompilerOptions {
// Whether to enable support for <template> and the template attribute (true by default)
enableLegacyTemplate?: boolean;
// Whether to remove blank text nodes from compiled templates. It is `true` by default
// in Angular 4 and will be re-visited post Angular 5.
preserveWhitespaces?: boolean;
}
export interface ModuleFilenameResolver {

View File

@ -388,4 +388,4 @@ function createProgramWithStubsHost(
fileExists = (fileName: string) =>
this.generatedFiles.has(fileName) || originalHost.fileExists(fileName);
};
}
}