Commit e62fb35
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 #613341 parent 68d774f commit e62fb35
37 files changed
Lines changed: 754 additions & 101 deletions
File tree
- goldens/public-api/compiler-cli
- packages
- compiler-cli
- src/ngtsc
- annotations
- component
- src
- test
- directive
- src
- test
- ng_module
- src
- test
- core
- api/src
- src
- transform
- src
- test
- test
- compliance
- declaration-only
- test_cases
- r3_compiler_compliance
- class_metadata
- components_and_directives
- standalone
- value_composition
- ng_modules
- r3_view_compiler_i18n
- es5_support
- line_ending_normalization
- localize_legacy_message_ids
- ng-container_ng-template
- r3_view_compiler_input_outputs
- r3_view_compiler_styling
- component_styles
- invalid
- signal_inputs
- source_mapping
- external_templates
- inline_templates
- test_helpers
- ngtsc
- core/schematics/migrations/signal-migration/src/input_detection
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| |||
488 | 489 | | |
489 | 490 | | |
490 | 491 | | |
| 492 | + | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| 213 | + | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| |||
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
| 202 | + | |
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
| |||
394 | 397 | | |
395 | 398 | | |
396 | 399 | | |
| 400 | + | |
397 | 401 | | |
398 | 402 | | |
399 | 403 | | |
| |||
965 | 969 | | |
966 | 970 | | |
967 | 971 | | |
| 972 | + | |
968 | 973 | | |
969 | 974 | | |
970 | 975 | | |
| |||
1030 | 1035 | | |
1031 | 1036 | | |
1032 | 1037 | | |
| 1038 | + | |
1033 | 1039 | | |
1034 | 1040 | | |
1035 | 1041 | | |
| |||
1080 | 1086 | | |
1081 | 1087 | | |
1082 | 1088 | | |
| 1089 | + | |
1083 | 1090 | | |
1084 | 1091 | | |
1085 | 1092 | | |
| |||
1156 | 1163 | | |
1157 | 1164 | | |
1158 | 1165 | | |
| 1166 | + | |
1159 | 1167 | | |
1160 | 1168 | | |
1161 | 1169 | | |
| |||
1192 | 1200 | | |
1193 | 1201 | | |
1194 | 1202 | | |
| 1203 | + | |
1195 | 1204 | | |
1196 | 1205 | | |
1197 | 1206 | | |
| |||
1206 | 1215 | | |
1207 | 1216 | | |
1208 | 1217 | | |
| 1218 | + | |
1209 | 1219 | | |
1210 | 1220 | | |
1211 | 1221 | | |
| |||
1252 | 1262 | | |
1253 | 1263 | | |
1254 | 1264 | | |
| 1265 | + | |
1255 | 1266 | | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1256 | 1283 | | |
1257 | 1284 | | |
1258 | 1285 | | |
| |||
1708 | 1735 | | |
1709 | 1736 | | |
1710 | 1737 | | |
| 1738 | + | |
1711 | 1739 | | |
1712 | 1740 | | |
1713 | 1741 | | |
| |||
1759 | 1787 | | |
1760 | 1788 | | |
1761 | 1789 | | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
1762 | 1798 | | |
1763 | 1799 | | |
1764 | 1800 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
Lines changed: 21 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
| |||
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
| 358 | + | |
| 359 | + | |
357 | 360 | | |
358 | 361 | | |
359 | 362 | | |
| |||
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
370 | | - | |
| 373 | + | |
371 | 374 | | |
372 | 375 | | |
373 | 376 | | |
| |||
403 | 406 | | |
404 | 407 | | |
405 | 408 | | |
406 | | - | |
| 409 | + | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
| |||
438 | 441 | | |
439 | 442 | | |
440 | 443 | | |
441 | | - | |
| 444 | + | |
442 | 445 | | |
443 | 446 | | |
444 | 447 | | |
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
449 | | - | |
| 452 | + | |
450 | 453 | | |
451 | 454 | | |
452 | 455 | | |
| |||
546 | 549 | | |
547 | 550 | | |
548 | 551 | | |
549 | | - | |
| 552 | + | |
550 | 553 | | |
551 | 554 | | |
552 | 555 | | |
| |||
602 | 605 | | |
603 | 606 | | |
604 | 607 | | |
605 | | - | |
| 608 | + | |
606 | 609 | | |
607 | 610 | | |
608 | 611 | | |
| |||
650 | 653 | | |
651 | 654 | | |
652 | 655 | | |
653 | | - | |
| 656 | + | |
654 | 657 | | |
655 | 658 | | |
656 | 659 | | |
| |||
1170 | 1173 | | |
1171 | 1174 | | |
1172 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
1173 | 1187 | | |
1174 | 1188 | | |
1175 | 1189 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
345 | 359 | | |
346 | 360 | | |
347 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
396 | 397 | | |
397 | 398 | | |
398 | 399 | | |
| |||
466 | 467 | | |
467 | 468 | | |
468 | 469 | | |
| 470 | + | |
| 471 | + | |
469 | 472 | | |
470 | 473 | | |
471 | 474 | | |
| |||
826 | 829 | | |
827 | 830 | | |
828 | 831 | | |
| 832 | + | |
829 | 833 | | |
830 | 834 | | |
831 | 835 | | |
| |||
869 | 873 | | |
870 | 874 | | |
871 | 875 | | |
872 | | - | |
| 876 | + | |
873 | 877 | | |
874 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
875 | 885 | | |
876 | 886 | | |
877 | 887 | | |
| |||
1286 | 1296 | | |
1287 | 1297 | | |
1288 | 1298 | | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
1289 | 1302 | | |
1290 | 1303 | | |
1291 | 1304 | | |
| |||
1513 | 1526 | | |
1514 | 1527 | | |
1515 | 1528 | | |
| 1529 | + | |
1516 | 1530 | | |
1517 | 1531 | | |
1518 | 1532 | | |
| |||
1541 | 1555 | | |
1542 | 1556 | | |
1543 | 1557 | | |
| 1558 | + | |
1544 | 1559 | | |
1545 | 1560 | | |
1546 | 1561 | | |
| |||
1588 | 1603 | | |
1589 | 1604 | | |
1590 | 1605 | | |
| 1606 | + | |
1591 | 1607 | | |
1592 | 1608 | | |
1593 | 1609 | | |
| |||
1601 | 1617 | | |
1602 | 1618 | | |
1603 | 1619 | | |
| 1620 | + | |
1604 | 1621 | | |
1605 | 1622 | | |
1606 | 1623 | | |
| |||
0 commit comments