Repository navigation
refactor(@angular/build): unify and deduplicate emitFilesToDisk across builders - #34326
alan-agius4 merged 3 commits into
Conversation
…s builders
Relocate emitFilesToDisk into src/utils/emit-files-to-disk.ts and unify the file emission descriptor shape across the application and library builders around origin ('memory' | 'disk') and source.
Update emitFilesToDisk to manage per-invocation parent directory creation internally with bounded concurrency, allowing application/index.ts, library/pipeline/build-action.ts, and utils/test-files.ts to share the same helper. This also removes the cross-rebuild directoryExists cache from the library builder's SingleBuildState so deleted output subdirectories are properly recreated during watch mode rebuilds.
There was a problem hiding this comment.
Code Review
This pull request refactors file emission to disk by consolidating the logic into a shared emitFilesToDisk utility and updating various builders to use it. It also renames inputPath to source in disk file interfaces and adds corresponding tests. The review feedback highlights two key issues in the new utility: first, fs.promises.cp does not support the mode option, rendering the COPYFILE_FICLONE flag a silent no-op, so copyFile should be used instead; second, using a Set to track directory existence under concurrent execution introduces a race condition, which can be resolved by caching directory creation promises in a Map.
…k across builders
…k across builders
|
This PR was merged into the repository. The changes were merged into the following branches:
|
Relocate
emitFilesToDiskintosrc/utils/emit-files-to-disk.tsand unify the file emission descriptor shape across the application and library builders aroundorigin('memory' | 'disk') andsource.Update
emitFilesToDiskto manage per-invocation parent directory creation internally with bounded concurrency, allowingapplication/index.ts,library/pipeline/build-action.ts, andutils/test-files.tsto share the same helper. This also removes the cross-rebuilddirectoryExistscache from the library builder'sSingleBuildStateso deleted output subdirectories are properly recreated during watch mode rebuilds.