Repository navigation
Commit cc5e7af
committed
refactor(@angular/build): extract shared breadth-first initial file analysis
Previously, both `BundlerContext` and `optimizeChunks` maintained separate implementations for
discovering transitive initial files and calculating their import depths from the esbuild
metafile. Both implementations used a depth-first stack traversal via `Array.prototype.pop()`,
which visited deeper branches in reverse import order and failed to propagate updated minimum
depths to the transitive dependencies of already-visited chunks in diamond dependency graphs.
This commit extracts a shared `findTransitiveInitialFiles` helper that uses a breadth-first
queue traversal over direct static imports. Processing chunks in breadth-first order guarantees
that each file is discovered at its true shortest import depth on first visit, preserves the
natural declaration order of imports at each depth level, and eliminates the duplicated
metafile traversal logic across initial bundling and chunk optimization.1 parent 0fd4404 commit cc5e7af
4 files changed
Lines changed: 355 additions & 84 deletions
File tree
- packages/angular/build/src
- builders/application
- tools/esbuild
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | 169 | | |
185 | 170 | | |
186 | 171 | | |
| |||
369 | 354 | | |
370 | 355 | | |
371 | 356 | | |
372 | | - | |
373 | 357 | | |
374 | 358 | | |
375 | 359 | | |
376 | 360 | | |
377 | 361 | | |
378 | | - | |
379 | | - | |
380 | 362 | | |
381 | 363 | | |
382 | 364 | | |
| |||
392 | 374 | | |
393 | 375 | | |
394 | 376 | | |
395 | | - | |
396 | 377 | | |
397 | 378 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
| 379 | + | |
| 380 | + | |
402 | 381 | | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | 382 | | |
407 | 383 | | |
408 | 384 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
430 | 388 | | |
431 | 389 | | |
432 | 390 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
363 | 364 | | |
364 | 365 | | |
365 | 366 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
| 367 | + | |
401 | 368 | | |
402 | 369 | | |
403 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 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 | + | |
21 | 69 | | |
22 | 70 | | |
23 | 71 | | |
| |||
0 commit comments