fix(compiler-cli): merge @fileoverview comments. (#20870)
Previously, this code would unconditionally add a @fileoverview comment to generated files, and only if the contained any code at all. However often existing fileoverview comments should be copied from the file the generated file was originally based off of. This allows users to e.g. include Closure Compiler directives in their original `component.ts` file, which will then automaticallly also apply to code generated from it. This special cases `@license` comments, as Closure disregards directives in comments containing `@license`. PR Close #20870
This commit is contained in:

committed by
Jason Aden

parent
add3589451
commit
8c52088346
@ -437,7 +437,8 @@ describe('ng program', () => {
|
||||
sf => sf.fileName === path.join(testSupport.basePath, checks.originalFileName)))
|
||||
.toBe(true);
|
||||
if (checks.shouldBeEmpty) {
|
||||
expect(writeData !.data).toBe('');
|
||||
// The file should only contain comments (the preamble comment added by ngc).
|
||||
expect(writeData !.data).toMatch(/^(\s*\/\*([^*]|\*[^/])*\*\/\s*)?$/);
|
||||
} else {
|
||||
expect(writeData !.data).not.toBe('');
|
||||
}
|
||||
|
Reference in New Issue
Block a user