Skip to content

[watch] Static web asset abstraction#55188

Merged
tmat merged 4 commits into
dotnet:release/10.0.4xxfrom
tmat:StaticWebAssetAbstraction
Jul 10, 2026
Merged

[watch] Static web asset abstraction#55188
tmat merged 4 commits into
dotnet:release/10.0.4xxfrom
tmat:StaticWebAssetAbstraction

Conversation

@tmat

@tmat tmat commented Jul 7, 2026

Copy link
Copy Markdown
Member

Add StaticWebAssetUpdateBuilder to HotReload.Client package so that we can reuse the logic of updating static web assets across all clients.

Fix a couple of issues:

  • Align case sensitivity of string comparisons in StaticWebAsset helpers with ASP.NET tasks
  • Avoid sending static web asset updates to running projects that are not web apps yet reference projects that have static web assets (e.g. Aspire host).

@tmat tmat changed the title Static web asset abstraction [watch] Static web asset abstraction Jul 9, 2026
@tmat tmat force-pushed the StaticWebAssetAbstraction branch from fa4130e to 398b830 Compare July 10, 2026 00:29
@tmat tmat force-pushed the StaticWebAssetAbstraction branch from 420b65b to cfeb364 Compare July 10, 2026 19:47
@tmat tmat marked this pull request as ready for review July 10, 2026 19:47
@tmat tmat requested a review from a team as a code owner July 10, 2026 19:47
Copilot AI review requested due to automatic review settings July 10, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors dotnet-watch static web asset hot reload to use a shared abstraction (StaticWebAssetUpdateBuilder) and centralizes static asset manifest filtering logic, with new unit tests covering scoped CSS and asset-path behaviors.

Changes:

  • Introduces StaticWebAssetUpdateBuilder and moves static asset update graph-walking logic into a reusable component.
  • Adds StaticWebAssetsManifest.GetFilesToWatch() and updates evaluation to use it (including filtering rules).
  • Adds new unit tests for static web asset path helpers and multi-project update scenarios.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Microsoft.DotNet.HotReload.Client.Tests/StaticWebAssetUpdateBuilderTests.cs New tests covering update propagation across project graphs and scoped CSS bundle regeneration scenarios.
test/Microsoft.DotNet.HotReload.Client.Tests/StaticWebAssetTests.cs New tests for StaticWebAsset helper methods (scoped CSS, bundles, compression, relative URL generation).
src/Dotnet.Watch/Watch/UI/IReporter.cs Switches predefined test messages to use LogEvents entries for static web asset warnings.
src/Dotnet.Watch/Watch/HotReload/ProjectUpdatesBuilder.StaticWebAssets.cs Extracts static asset update handling into a new partial file using StaticWebAssetUpdateBuilder.
src/Dotnet.Watch/Watch/HotReload/ProjectUpdatesBuilder.cs Makes ProjectUpdatesBuilder partial and removes the inlined static asset update implementation.
src/Dotnet.Watch/Watch/Build/ProjectGraphUtilities.cs Adjusts assembly name helper to extend ProjectInstance and adds ProjectInstanceId helpers.
src/Dotnet.Watch/Watch/Build/LoadedProjectGraph.cs Adds a GetProjectNode(ProjectInstanceId) helper for retrieving graph nodes by project+TFM.
src/Dotnet.Watch/Watch/Build/EvaluationResult.cs Uses StaticWebAssetsManifest.GetFilesToWatch() when adding watched static asset files.
src/Dotnet.Watch/HotReloadClient/Web/StaticWebAssetUpdateBuilder.cs Adds the new abstraction for building per-application static asset updates + scoped CSS regeneration tracking.
src/Dotnet.Watch/HotReloadClient/Web/StaticWebAssetsManifest.cs Adds GetFilesToWatch() to encapsulate filtering of manifest entries.
src/Dotnet.Watch/HotReloadClient/Web/StaticWebAsset.cs Updates helper methods for case-insensitive extensions, adds OS-specific path comparison, and adds _content/ URL detection.
src/Dotnet.Watch/HotReloadClient/ProjectInstanceId.cs Moves ProjectInstanceId into the HotReload namespace and enables nullable.
src/Dotnet.Watch/HotReloadClient/Logging/LogEvents.cs Adds new log events for missing static web asset manifest and scoped CSS bundle file.

Comment thread src/Dotnet.Watch/HotReloadClient/Web/StaticWebAssetsManifest.cs
Comment thread src/Dotnet.Watch/HotReloadClient/Web/StaticWebAssetUpdateBuilder.cs
Comment thread src/Dotnet.Watch/HotReloadClient/Web/StaticWebAsset.cs
@tmat tmat force-pushed the StaticWebAssetAbstraction branch from cfeb364 to 49ebfc8 Compare July 10, 2026 19:56
@tmat tmat merged commit c4620b6 into dotnet:release/10.0.4xx Jul 10, 2026
28 checks passed
@tmat tmat deleted the StaticWebAssetAbstraction branch July 10, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants