angular/packages/compiler-cli/src/ngtsc/annotations
Jessica Janiuk d7b94e0072 refactor(core): rename all animations package symbols (#62399)
Renames all animations package references with a "legacy" prefix for later easy cleanup.

PR Close #62399
2025-07-01 13:45:45 +00:00
..
common build: migrate to using new jasmine_test (#62086) 2025-06-18 08:27:26 +02:00
component refactor(core): rename all animations package symbols (#62399) 2025-07-01 13:45:45 +00:00
directive fix(compiler-cli): handle initializer APIs wrapped in type casts (#62203) 2025-06-23 14:26:05 +02:00
ng_module build: migrate to using new jasmine_test (#62086) 2025-06-18 08:27:26 +02:00
src refactor(compiler): account for pipes without names (#61328) 2025-05-19 08:24:06 +00:00
test build: migrate to using new jasmine_test (#62086) 2025-06-18 08:27:26 +02:00
BUILD.bazel build: migrate compiler-cli/src/ngtsc to ts_project (#61181) 2025-05-09 15:59:46 +00:00
index.ts build: properly compile tests in core with Angular compiler (#60268) 2025-03-07 11:00:47 -08:00
README.md refactor(compiler-cli): split the 'annotations' package into sub-packages (#44812) 2022-02-03 08:55:25 -08:00

What is the 'annotations' package?

This package implements compilation of Angular-annotated classes - those with @Component, @NgModule, etc. decorators. (Note that the compiler uses 'decorator' and 'annotation' interchangeably, despite them having slightly different semantics).

The 'transform' package of the compiler provides an abstraction for a DecoratorHandler, which defines how to compile a class decorated with a particular Angular decorator. This package implements a DecoratorHandler for each Angular type. The methods of these DecoratorHandlers then allow the rest of the compiler to process each decorated class through the phases of compilation.

Anatomy of DecoratorHandlers

Each handler implemented here performs some similar operations:

  • It uses the PartialEvaluator to resolve expressions within the decorator metadata or other decorated fields that need to be understood statically.
  • It extracts information from constructors of decorated classes which is required to generate dependency injection instructions.
  • It reports errors when developers have misused or misconfigured the decorators.
  • It populates registries that describe decorated classes to the rest of the compiler.
  • It uses those same registries to understand decorated classes within the context of the compilation (for example, to understand which dependencies are used in a given template).
  • It creates SemanticSymbols which allow for accurate incremental compilation when reacting to input changes.
  • It builds metadata objects for @angular/compiler which describe the decorated classes, which can then perform the actual code generation.

Since there is significant overlap between DecoratorHandler implementations, much of this functionality is implemented in a shared 'common' sub-package.