Commit 09d0a11
committed
perf(@angular/build): enable fast-path AST printing with sourcemaps in AotCompilation
Previously, when sourcemaps were enabled, AotCompilation was forced to run the full, slow TypeScript compilation/emit path (`useTypeScriptTranspilation = true`) because the standard `ts.createPrinter().printFile` method does not support generating sourcemaps.
This commit leverages TypeScript's internal `createTextWriter`, `createSourceMapGenerator`, and `printer.writeFile` APIs to generate sourcemaps directly during AST printing.
This allows AotCompilation to use the fast AST transformation and printing path even when sourcemaps are enabled (as long as `isolatedModules` is true), drastically improving rebuild performance for dev server builds.1 parent 41bd100 commit 09d0a11Copy full SHA for 09d0a11
4 files changed
+205-14Lines changed: 205 additions & 14 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/angular/build/src/tools
- angular/compilation
- esbuild/angular
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+35-9Lines changed: 35 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
21 | 21 | |
22 | 22 | |
23 | 23 | |
| 24 | + |
24 | 25 | |
25 | 26 | |
26 | 27 | |
| ||
37 | 38 | |
38 | 39 | |
39 | 40 | |
| 41 | + |
40 | 42 | |
41 | 43 | |
42 | 44 | |
| ||
76 | 78 | |
77 | 79 | |
78 | 80 | |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
79 | 85 | |
80 | 86 | |
81 | 87 | |
| ||
209 | 215 | |
210 | 216 | |
211 | 217 | |
| 218 | + |
212 | 219 | |
213 | 220 | |
214 | 221 | |
| ||
297 | 304 | |
298 | 305 | |
299 | 306 | |
300 | | - |
301 | | - |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
302 | 315 | |
303 | 316 | |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | 317 | |
309 | 318 | |
310 | 319 | |
| ||
401 | 410 | |
402 | 411 | |
403 | 412 | |
404 | | - |
| 413 | + |
405 | 414 | |
406 | 415 | |
407 | 416 | |
408 | 417 | |
409 | | - |
| 418 | + |
410 | 419 | |
411 | | - |
| 420 | + |
| 421 | + |
| 422 | + |
| 423 | + |
| 424 | + |
| 425 | + |
| 426 | + |
| 427 | + |
| 428 | + |
| 429 | + |
| 430 | + |
| 431 | + |
| 432 | + |
| 433 | + |
| 434 | + |
| 435 | + |
| 436 | + |
| 437 | + |
412 | 438 | |
413 | 439 | |
414 | 440 | |
|
Collapse file
packages/angular/build/src/tools/angular/compilation/parallel-worker.ts
Copy file name to clipboardExpand all lines: packages/angular/build/src/tools/angular/compilation/parallel-worker.ts+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
114 | 114 | |
115 | 115 | |
116 | 116 | |
| 117 | + |
| 118 | + |
117 | 119 | |
118 | 120 | |
119 | 121 | |
|
Collapse file
packages/angular/build/src/tools/angular/compilation/typescript-printer.ts
Copy file name to clipboard+161Lines changed: 161 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 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
Collapse file
packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts
Copy file name to clipboardExpand all lines: packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts+7-5Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
318 | 318 | |
319 | 319 | |
320 | 320 | |
321 | | - |
322 | | - |
323 | 321 | |
324 | | - |
325 | | - |
326 | | - |
| 322 | + |
327 | 323 | |
328 | 324 | |
329 | 325 | |
| ||
753 | 749 | |
754 | 750 | |
755 | 751 | |
| 752 | + |
| 753 | + |
| 754 | + |
| 755 | + |
| 756 | + |
| 757 | + |
756 | 758 | |
757 | 759 | |
758 | 760 | |
|
0 commit comments