Skip to content

refactor(@angular/build): simplify watch-mode asset precedence and ignore normalization - #34475

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:refactor/library-assets-watch-cleanup
Oct 22, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:refactor/library-assets-watch-cleanup

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Follow-up to #34470:

  • Rely on in-memory emittedAssets state when checking whether a modified asset is shadowed by a higher-priority matcher in watch mode, avoiding redundant statSync/lstatSync calls on every incremental build.
  • Use recorded emittedAssets output paths directly when restoring lower-priority fallback assets after a higher-priority asset is deleted.
  • Track emitted asset sources by output path in BuilderState (#emittedAssetSources) for O(1) eviction when an asset is overridden.
  • Expand wildcard-suffixed ignore patterns in normalizeGlobPattern so both direct files and files under matching directories are ignored in watch mode.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the asset tracking and resolution logic in the Angular library builder. It introduces a map to track emitted asset sources, simplifies the priority-based asset resolution and fallback restoration logic in collectAssetsToEmit, and improves glob pattern normalization to support wildcard patterns. Unit tests have been updated to verify these changes. There are no review comments, so I have no feedback to provide.

@alan-agius4
alan-agius4 force-pushed the refactor/library-assets-watch-cleanup branch from 6ffc63c to 32806e0 Compare October 22, 2026 08:01
…nore normalization

Simplify incremental asset precedence checks in `collectAssetsToEmit` by relying on in-memory `emittedAssets` state rather than redundant filesystem `statSync` calls, and index emitted asset sources by output path in `BuilderState` for O(1) eviction. Also expand wildcard-suffixed ignore patterns so both direct files and nested directory contents are ignored in watch mode.
@alan-agius4
alan-agius4 force-pushed the refactor/library-assets-watch-cleanup branch from 32806e0 to 52521c7 Compare October 22, 2026 08:02
@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 22, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 22, 2026 08:03
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 22, 2026
@alan-agius4
alan-agius4 merged commit d2acc66 into angular:main Oct 22, 2026
43 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4
alan-agius4 deleted the refactor/library-assets-watch-cleanup branch October 22, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants