Repository navigation
Conversation
clydin
marked this pull request as ready for review
October 21, 2026 18:33
There was a problem hiding this comment.
Code Review
This pull request enhances the Angular library builder's asset tracking and emission logic, particularly in watch mode. It ensures that higher-priority assets are not overwritten by lower-priority ones, restores lower-priority fallback assets when overriding assets are deleted, and correctly handles directory-to-file replacements. Feedback on these changes highlights a potential performance bottleneck in BuilderState where a nested loop introduces an O(N * M) complexity during asset emission; maintaining a reverse mapping of output paths to their emitting sources is recommended to achieve O(1) eviction.
…ed ignores in watch mode
Previously in library watch mode, ignore patterns containing glob characters that did not
end with `*` (such as `**/<dir>` or `{a,b}`) were not expanded with `/**` because
`normalizeGlobPattern` checked `picomatch.scan(result).isGlob`. Update
`normalizeGlobPattern` to append `/**` whenever the stripped pattern does not end with
`*`, matching `tinyglobby` directory expansion semantics.
In `collectAssetsToEmit`, incremental watch builds previously only deduplicated colliding
output paths among files present in the current `modifiedFiles` set. Modifying a
lower-priority asset could therefore overwrite an existing higher-priority asset on disk,
and deleting a higher-priority asset did not restore an existing lower-priority fallback
asset. Resolve candidate sources across all asset matchers, evict overridden asset
sources in `BuilderState.recordEmittedOutputs`, and re-emit lower-priority fallback
assets when an overriding asset is deleted. Also preserve cached `statSync` results
during deleted-directory checks so a newly created file replacing a directory at the same
path is still matched and emitted.
clydin
force-pushed
the
fix/library-assets-followup
branch
from
October 21, 2026 18:45
69749ae to
0174a19
Compare
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.
Previously in library watch mode, ignore patterns containing glob characters that did not end with
*(such as**/<dir>or{a,b}) were not expanded with/**becausenormalizeGlobPatterncheckedpicomatch.scan(result).isGlob. UpdatenormalizeGlobPatternto append/**whenever the stripped pattern does not end with*, matchingtinyglobbydirectory expansion semantics.In
collectAssetsToEmit, incremental watch builds previously only deduplicated colliding output paths among files present in the currentmodifiedFilesset. Modifying a lower-priority asset could therefore overwrite an existing higher-priority asset on disk, and deleting a higher-priority asset did not restore an existing lower-priority fallback asset. Resolve candidate sources across all asset matchers, evict overridden asset sources inBuilderState.recordEmittedOutputs, and re-emit lower-priority fallback assets when an overriding asset is deleted. Also preserve cachedstatSyncresults during deleted-directory checks so a newly created file replacing a directory at the same path is still matched and emitted.