angular-docs-cn/packages/compiler-cli/test/transformers
Paul Gschwendtner 66e6b932d8 refactor(compiler-cli): skip class decorators in tooling constructor parameters transform (#37545)
We recently added a transformer to NGC that is responsible for downleveling Angular
decorators and constructor parameter types. The primary goal was to mitigate a
TypeScript limitation/issue that surfaces in Angular projects due to the heavy
reliance on type metadata being captured for DI. Additionally this is a pre-requisite
of making `tsickle` optional in the Angular bazel toolchain.

See: 401ef71ae5 for more context on this.

Another (less important) goal was to make sure that the CLI can re-use
this transformer for its JIT mode compilation. The CLI (as outlined in
the commit mentioned above), already has a transformer for downleveling
constructor parameters. We want to avoid this duplication and exported
the transform through the tooling-private compiler entry-point.

Early experiments in using this transformer over the current one, highlighted
that in JIT, class decorators cannot be downleveled. Angular relies on those
to be invoked immediately for JIT (so that factories etc. are generated upon loading)

The transformer we exposed, always downlevels such class decorators
though, so that would break CLI's JIT mode. We can address the CLI's
needs by adding another flag to skip class decorators. This will allow
us to continue with the goal of de-duplication.

PR Close #37545
2020-06-15 12:47:57 -07:00
..
BUILD.bazel fix(compiler-cli): downlevel angular decorators to static properties (#37382) 2020-06-10 09:24:11 -07:00
compiler_host_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
downlevel_decorators_transform_spec.ts refactor(compiler-cli): skip class decorators in tooling constructor parameters transform (#37545) 2020-06-15 12:47:57 -07:00
inline_resources_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
lower_expressions_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata_reader_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
node_emitter_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
program_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_metadata_transform_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_transform_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00