Commit fdcc98c
perf(@angular/build): skip semantic affected-file walk when type checking is disabled
When type checking is disabled (`NG_BUILD_TYPE_CHECK=0`), the AOT build still
ran a full semantic type-check as a side effect of computing the affected-files
set, then discarded the result.
`useTypeChecking` already suppresses the *consumption* of semantic diagnostics
via the compiler-plugin `diagnoseFiles` mask, but the *production* -- the
`findAffectedFiles` -> `getSemanticDiagnosticsOfNextAffectedFile` walk -- was
never gated, so disabling type checking still paid for a full semantic pass
whose results were never read.
The affected set has three consumers: Angular template diagnostics (behind the
`semantic` flag, already suppressed when type checking is off), the
single-file vs whole-program diagnostics optimization (also diagnostics only),
and the emit gate in `emitAffectedFiles()`. The emit gate only matters in the
slow TypeScript emit path where cross-file types can change a file's JS; in the
isolatedModules fast path emit is per-file/type-erased, so an empty set is safe.
Gate the walk so it only runs when type checking is on OR the slow emit path is
used, and skip it in the (type-check-off + fast-path) combination.
(cherry picked from commit 2462709)1 parent 19cda74 commit fdcc98cCopy full SHA for fdcc98c
2 files changed
+110-3Lines changed: 110 additions & 3 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/angular/build/src/tools/angular/compilation
- tests/e2e/tests/build
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/angular/build/src/tools/angular/compilation/aot-compilation.ts
Copy file name to clipboardExpand all lines: packages/angular/build/src/tools/angular/compilation/aot-compilation.ts+14-3Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
10 | 10 | |
11 | 11 | |
12 | 12 | |
| 13 | + |
13 | 14 | |
14 | 15 | |
15 | 16 | |
| ||
175 | 176 | |
176 | 177 | |
177 | 178 | |
178 | | - |
179 | | - |
180 | | - |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
181 | 192 | |
182 | 193 | |
183 | 194 | |
|
Collapse file
tests/e2e/tests/build/type-check-disabled-emit.ts
Copy file name to clipboard+96Lines changed: 96 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
0 commit comments