Repository navigation
fix(@angular/build): align library watch asset matching with initial build and deduplicate outputs - #34432
Conversation
…build and deduplicate outputs - Respect `asset.followSymlinks` in watch mode by using `lstatSync` when `!asset.followSymlinks` and `statSync` when `asset.followSymlinks` is `true`. - Normalize `asset.glob` and `asset.ignore` patterns in `createAssetMatchers` to match `tinyglobby` semantics (stripping trailing slashes, expanding directory patterns with `/**`, normalizing POSIX paths, skipping empty strings, and passing `windows: false`). - Deduplicate collected and resolved assets by destination `path` so later asset configurations override earlier ones without concurrent `fs.cp` operations to the same output destination. - Queue nested emitted assets for deletion when a deleted parent directory is reported in watch mode.
There was a problem hiding this comment.
Code Review
This pull request enhances asset handling in the Angular library builder by introducing a normalizeGlobPattern utility and updating createAssetMatchers and collectAssetsToEmit to improve support for symlinks and directory deletion tracking in watch mode. Comprehensive unit tests were added to verify these changes. A high-severity issue was identified in the normalizeGlobPattern function, where it incorrectly appends /** to file glob patterns; the reviewer provided a necessary fix using picomatch.isGlob to ensure correct matching behavior.
…nitial build and deduplicate outputs
…nitial build and deduplicate outputs
…nitial build and deduplicate outputs
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Summary
asset.followSymlinksin watch mode (collectAssetsToEmit) by usinglstatSyncwhen!asset.followSymlinksandstatSyncwhenasset.followSymlinksistrue(cachingstatandlstatseparately per file).asset.globandasset.ignoreincreateAssetMatchersto matchtinyglobbysemantics on initial build (filtering empty strings, expanding directory patterns with/**, normalizing viaposix.normalize, and settingwindows: false).path(allowing later asset configurations to override earlier ones) to prevent concurrentfs.cpcalls to the same destination.