angular-cn/packages/compiler-cli/ngcc/test
JoostK 5e5be43acd refactor(ivy): ngcc - categorize the various decorate calls upfront (#31614)
Any decorator information present in TypeScript is emitted into the
generated JavaScript sources by means of `__decorate` call. This call
contains both the decorators as they existed in the original source
code, together with calls to `tslib` helpers that convey additional
information on e.g. type information and parameter decorators. These
different kinds of decorator calls were not previously distinguished on
their own, but instead all treated as `Decorator` by themselves. The
"decorators" that were actually `tslib` helper calls were conveniently
filtered out because they were not imported from `@angular/core`, a
characteristic that ngcc uses to drop certain decorators.

Note that this posed an inconsistency in ngcc when it processes
`@angular/core`'s UMD bundle, as the `tslib` helper functions have been
inlined in said bundle. Because of the inlining, the `tslib` helpers
appear to be from `@angular/core`, so ngcc would fail to drop those
apparent "decorators". This inconsistency does not currently cause any
issues, as ngtsc is specifically looking for decorators based on  their
name and any remaining decorators are simply ignored.

This commit rewrites the decorator analysis of a class to occur all in a
single phase, instead of all throughout the `ReflectionHost`. This
allows to categorize the various decorate calls in a single sweep,
instead of constantly needing to filter out undesired decorate calls on
the go. As an added benefit, the computed decorator information is now
cached per class, such that subsequent reflection queries that need
decorator information can reuse the cached info.

PR Close #31614
2019-07-29 16:10:57 -07:00
..
analysis feat(ivy): ngcc - support ngcc "migrations" (#31544) 2019-07-23 21:11:40 -07:00
dependencies fix(ivy): ngcc - resolve `main` property paths correctly (#31509) 2019-07-12 11:37:35 -04:00
entry_point_finder fix(ivy): ngcc - handle pathMappings to files rather then directories (#30525) 2019-07-09 09:40:46 -07:00
helpers refactor(ivy): ngcc - categorize the various decorate calls upfront (#31614) 2019-07-29 16:10:57 -07:00
host refactor(ivy): ngcc - categorize the various decorate calls upfront (#31614) 2019-07-29 16:10:57 -07:00
integration feat(ivy): customize ngcc via configuration files (#30591) 2019-06-26 08:00:02 -07:00
logging feat(compiler-cli): ngcc - make logging more configurable (#29591) 2019-04-01 11:53:28 -07:00
migrations feat(ivy): ngcc - implement `UndecoratedParentMigration` (#31544) 2019-07-23 21:11:40 -07:00
packages fix(ivy): ngcc - resolve `main` property paths correctly (#31509) 2019-07-12 11:37:35 -04:00
rendering perf(ivy): avoid extra parameter in query instructions (#31667) 2019-07-24 14:37:51 -07:00
writing refactor(ivy): ngcc - pass whole entry-point object to `makeEntryPointBundle()` (#30591) 2019-06-26 08:00:03 -07:00
BUILD.bazel feat(ivy): ngcc - support ngcc "migrations" (#31544) 2019-07-23 21:11:40 -07:00
utils_spec.ts refactor(ivy): ngcc - implement new module resolver (#29643) 2019-04-29 12:37:21 -07:00