angular-cn/packages/compiler-cli/test
Alex Rickabaugh ecffc3557f perf(compiler-cli): perform template type-checking incrementally (#36211)
This optimization builds on a lot of prior work to finally make type-
checking of templates incremental.

Incrementality requires two main components:
- the ability to reuse work from a prior compilation.
- the ability to know when changes in the current program invalidate that
  prior work.

Prior to this commit, on every type-checking pass the compiler would
generate new .ngtypecheck files for each original input file in the program.

1. (Build #1 main program): empty .ngtypecheck files generated for each
   original input file.

2. (Build #1 type-check program): .ngtypecheck contents overridden for those
   which have corresponding components that need type-checked.

3. (Build #2 main program): throw away old .ngtypecheck files and generate
   new empty ones.

4. (Build #2 type-check program): same as step 2.

With this commit, the `IncrementalDriver` now tracks template type-checking
_metadata_ for each input file. The metadata contains information about
source mappings for generated type-checking code, as well as some
diagnostics which were discovered at type-check analysis time. The actual
type-checking code is stored in the TypeScript AST for type-checking files,
which is now re-used between programs as follows:

1. (Build #1 main program): empty .ngtypecheck files generated for each
   original input file.

2. (Build #1 type-check program): .ngtypecheck contents overridden for those
   which have corresponding components that need type-checked, and the
   metadata registered in the `IncrementalDriver`.

3. (Build #2 main program): The `TypeCheckShimGenerator` now reuses _all_
   .ngtypecheck `ts.SourceFile` shims from build #1's type-check program in
   the construction of build #2's main program. Some of the contents of
   these files might be stale (if a component's template changed, for
   example), but wholesale reuse here prevents unnecessary changes in the
   contents of the program at this point and makes TypeScript's job a lot
   easier.

4. (Build #2 type-check program): For those input files which have not
   "logically changed" (meaning components within are semantically the same
   as they were before), the compiler will re-use the type-check file
   metadata from build #1, and _not_ generate a new .ngtypecheck shim.
   For components which have logically changed or where the previous
   .ngtypecheck contents cannot otherwise be reused, code generation happens
   as before.

PR Close #36211
2020-05-05 18:40:42 -07:00
..
compliance fix(compiler): normalize line endings in ICU expansions (#36741) 2020-04-28 12:22:40 -07:00
diagnostics style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
helpers style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
metadata style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
ngtsc perf(compiler-cli): perform template type-checking incrementally (#36211) 2020-05-05 18:40:42 -07:00
transformers style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -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
extract_i18n_spec.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
mocks.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
ngc_spec.ts fix(zone.js): add issue numbers of `@types/jasmine` to the test cases (#34625) 2020-04-08 12:10:34 -07:00
perform_compile_spec.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
perform_watch_spec.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
test_support.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00
typescript_support_spec.ts style(compiler-cli): reformat of codebase with new clang-format version (#36520) 2020-04-08 14:51:08 -07:00