Repository navigation
refactor(@angular/build): unify and deduplicate emitFilesToDisk across builders - #34326
Open
alan-agius4 wants to merge 3 commits into
Open
alan-agius4 wants to merge 3 commits into
alan-agius4 wants to merge 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.