angular/packages/compiler-cli/test/ngtsc
Jonathan Meier e62fb359d6 feat(compiler-cli): add experimental support for fast type declaration emission (#61334)
In declaration-only emission mode, the compiler extracts the type
declarations (.d.ts) files without full type-checking, which is possible
with sufficient type annotations on exports that can be ensured by the
`isolatedDeclarations` TS compiler option.

This allows us to decouple type declaration emission from the actual
full compilation doing the type-checking, thereby removing the
edge between dependent TS files in the build action graph. In other
words, the compilation of a TS file no longer indirectly depends on the
compilation of all the TS files it imports through its dependency on
their type declarations, because the type declarations themselves no
longer depend on the compilation of their associated TS file.

Without the coupling between type declaration emission and compilation,
compilation time of a TS project is no longer bound dependent on the
depth of the TS dependency tree as we can now build the entire project
with just two entirely parallel phases: 1) emit the type declarations of
all TS files in parallel and 2) compile all TS files in parallel.

Since the Angular compiler adds static metadata fields to components,
directives, modules, pipes and services based on their respective class
annotations, it needs to actively partake in the type declaration
emission in order to provide the types for these static fields in the
declaration.

In this change, we add experimental support for a declaration-only
emission mode based on the local compilation mode, which already
operates without type-checking and access to external type information,
i.e. the same environment as is required for declaration-only emisssion.

Apart from the same restrictions applied in local compilation mode,
there are a few more restrictions imposed on code being compatible with
this initial and experimental implementation:

* No support for `@NgModule`s using external references.
* No support for `hostDirectives` in `@Component`s and `@Directive`s
  using external references
* No support for `@Input` annotations with `transform`.

PR Close #61334
2025-05-14 14:07:37 -07:00
..
doc_extraction refactor(compiler-cli): Extract type predicates from type guards. (#60934) 2025-04-23 09:56:44 +02:00
attach_source_location_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
authoring_diagnostics_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
authoring_inputs_spec.ts refactor(compiler-cli): move two-way binding fix behind flag (#59002) 2024-12-05 16:11:02 -08:00
authoring_models_spec.ts refactor(compiler-cli): move two-way binding fix behind flag (#59002) 2024-12-05 16:11:02 -08:00
authoring_outputs_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
authoring_queries_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
BUILD.bazel test: replace fake_core with real @angular/core output (#54650) 2024-03-06 12:34:38 +01:00
component_indexing_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
declaration_only_emission_spec.ts feat(compiler-cli): add experimental support for fast type declaration emission (#61334) 2025-05-14 14:07:37 -07:00
defer_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
env.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
extended_template_diagnostics_spec.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
hmr_spec.ts fix(compiler-cli): ensure HMR works with different output module type (#60797) 2025-04-09 11:42:55 -07:00
host_bindings_type_check_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
host_directives_spec.ts refactor(compiler): update compliance tests. (#58238) 2024-10-24 12:44:12 -07:00
imports_spec.ts fix(compiler-cli): support relative imports to symbols outside rootDir (#60555) 2025-03-26 20:45:55 -07:00
incremental_error_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
incremental_semantic_changes_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
incremental_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
incremental_typecheck_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
local_compilation_spec.ts refactor(compiler): update compliance tests. (#58238) 2024-10-24 12:44:12 -07:00
ls_typecheck_helpers_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
monorepo_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
ngtsc_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
scope_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
selectorless_spec.ts fix(compiler-cli): typo in NG2026 message (#61325) 2025-05-14 08:56:09 -07:00
sourcemap_utils.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
standalone_spec.ts refactor(compiler-cli): Migrate manually ngtsc tests to standalone by default (#58160) 2024-10-14 14:58:58 +00:00
template_mapping_spec.ts refactor(compiler): remove empty empty string suffix from interpolation instructions (#60066) 2025-03-10 16:31:34 -07:00
template_typecheck_spec.ts feat(compiler): support the in keyword in Binary expression (#58432) 2025-04-22 21:44:12 +02:00
util.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00
xi18n_spec.ts refactor(compiler-cli): convert scripts within packages/compiler-cli to relative imports (#60625) 2025-04-01 11:57:53 +00:00