angular-cn/packages/compiler-cli/test/transformers
JoostK 75afd80ae8 refactor(compiler): add `@nocollapse` annotation using a synthetic comment (#35932)
In Ivy, Angular decorators are compiled into static fields that are
inserted into a class declaration in a TypeScript transform. When
targeting Closure compiler such fields need to be annotated with
`@nocollapse` to prevent them from being lifted from a static field into
a variable, as that would prevent the Ivy runtime from being able to
find the compiled definitions.

Previously, there was a bug in TypeScript where synthetic comments added
in a transform would not be emitted at all, so as a workaround a global
regex-replace was done in the emit's `writeFile` callback that would add
the `@nocollapse` annotation to all static Ivy definition fields. This
approach is no longer possible when ngtsc is running as TypeScript
plugin, as a plugin cannot control emit behavior.

The workaround is no longer necessary, as synthetic comments are now
properly emitted, likely as of
https://github.com/microsoft/TypeScript/pull/22141 which has been
released with TypeScript 2.8.

This change is required for running ngtsc as TypeScript plugin in
Bazel's `ts_library` rule, to move away from the custom `ngc_wrapped`
approach.

Resolves FW-1952

PR Close #35932
2020-04-01 15:37:06 -07:00
..
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
compiler_host_spec.ts build: add moduleName to ngFactory sourcefiles (#29385) 2019-03-19 01:10:49 -04:00
inline_resources_spec.ts fix(compiler-cli): enableResourceInlining handles both styles and styleUrls (#22688) 2018-03-11 22:14:32 -07:00
lower_expressions_spec.ts feat(ivy): @NgModule -> ngInjectorDef compilation (#22458) 2018-03-16 12:57:11 -07:00
metadata_reader_spec.ts refactor(compiler): remove old ngtools api and add listLazyRoutes to new api (#19836) 2017-10-23 18:46:04 -04:00
node_emitter_spec.ts refactor(compiler): add `@nocollapse` annotation using a synthetic comment (#35932) 2020-04-01 15:37:06 -07:00
program_spec.ts fix(compiler): switch to modern diagnostic formatting (#34234) 2019-12-09 11:37:49 -08:00
r3_metadata_transform_spec.ts feat(compiler-cli): reflect static methods added to classes in metadata (#21926) 2018-02-01 08:30:58 -08:00
r3_transform_spec.ts refactor(compiler): add `@nocollapse` annotation using a synthetic comment (#35932) 2020-04-01 15:37:06 -07:00