refactor(@angular/build): encapsulate TypeScript source file AST caching in compilation classes - #33863
refactor(@angular/build): encapsulate TypeScript source file AST caching in compilation classes#33863clydin wants to merge 1 commit into
Conversation
53504a6 to
8685f2c
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the Angular compiler host and compilation classes to manage TypeScript source file caching internally rather than through the shared SourceFileCache class. Specifically, AotCompilation and JitCompilation now maintain their own #sourceFiles maps, and SourceFileCache no longer extends Map. In parallel-worker.ts, the cache is replaced with a module-level modifiedFiles set. The review feedback highlights a critical race condition in parallel-worker.ts where concurrent file updates occurring during the asynchronous initialize function could be lost when modifiedFiles.clear() is called at the end. The reviewer suggests capturing and clearing the modified files synchronously at the start of the initialization process to prevent this data loss.
8685f2c to
940466f
Compare
…ing in compilation classes Move the `ts.SourceFile` AST cache out of `SourceFileCache` and directly into `AotCompilation` and `JitCompilation`. This removes the `Map<string, ts.SourceFile>` inheritance from `SourceFileCache` and removes the `sourceFileCache` property from `AngularHostOptions`, further decoupling the bundler plugin and generic host interfaces from TypeScript AST structures.
940466f to
dcaa1db
Compare
Move the
ts.SourceFileAST cache out ofSourceFileCacheand directly intoAotCompilationandJitCompilation. This removes theMap<string, ts.SourceFile>inheritance fromSourceFileCacheand removes thesourceFileCacheproperty fromAngularHostOptions, further decoupling the bundler plugin and generic host interfaces from TypeScript AST structures.