diff --git a/BlazorWasmPreRendering.Build.Test/ProgramE2ETest.cs b/BlazorWasmPreRendering.Build.Test/ProgramE2ETest.cs index 03b3f8c..ede0e46 100644 --- a/BlazorWasmPreRendering.Build.Test/ProgramE2ETest.cs +++ b/BlazorWasmPreRendering.Build.Test/ProgramE2ETest.cs @@ -354,11 +354,40 @@ public async Task Publish_Test() serviceWorkerAssetsJs = Regex.Replace(serviceWorkerAssetsJs, ";\\s*$", ""); var assetsManifestFile = JsonSerializer.Deserialize(serviceWorkerAssetsJs); var assetManifestEntry = assetsManifestFile?.assets?.First(a => a.url == "index.html"); - assetManifestEntry.IsNotNull(); - assetManifestEntry!.hash.Is(hash); + assetManifestEntry.IsNotNull().hash.Is(hash); } } + [Test] + public async Task Publish_with_Compression_Test() + { + // Given + using var sampleAppWorkDir = SampleSite.CreateSampleAppsWorkDir(); + var projectDir = Path.Combine(sampleAppWorkDir, "BlazorWasmApp0"); + + // When + var dotnetCLI = await Start("dotnet", "publish -c:Release -o:bin/publish", projectDir).WaitForExitAsync(); + dotnetCLI.ExitCode.Is(0, message: dotnetCLI.Output); + + // Then + + // Validate prerendered contents. + var wwwrootDir = Path.Combine(projectDir, "bin", "publish", "wwwroot"); + ValidatePrerenderedContentsOfApp0(wwwrootDir); + + // Validate PWA assets manifest. + var indexHtmlBytes = File.ReadAllBytes(Path.Combine(wwwrootDir, "index.html")); + using var sha256 = SHA256.Create(); + var hash = "sha256-" + Convert.ToBase64String(sha256.ComputeHash(indexHtmlBytes)); + + var serviceWorkerAssetsJs = File.ReadAllText(Path.Combine(wwwrootDir, "my-assets.js")); + serviceWorkerAssetsJs = Regex.Replace(serviceWorkerAssetsJs, @"^self\.assetsManifest\s*=\s*", ""); + serviceWorkerAssetsJs = Regex.Replace(serviceWorkerAssetsJs, ";\\s*$", ""); + var assetsManifestFile = JsonSerializer.Deserialize(serviceWorkerAssetsJs); + var assetManifestEntry = assetsManifestFile?.assets?.First(a => a.url == "index.html"); + assetManifestEntry.IsNotNull().hash.Is(hash); + } + [Test, Platform("Win")] public async Task Publish_by_native_msbuild_Test() { diff --git a/BlazorWasmPreRendering.Build/build/BlazorWasmPreRendering.Build.props b/BlazorWasmPreRendering.Build/build/BlazorWasmPreRendering.Build.props index 398af77..1f12eec 100644 --- a/BlazorWasmPreRendering.Build/build/BlazorWasmPreRendering.Build.props +++ b/BlazorWasmPreRendering.Build/build/BlazorWasmPreRendering.Build.props @@ -2,5 +2,6 @@ $(BeforePublishSPAforGHPages);BlazorWasmPrerendering + $(BeforeBlazorWasmBrotliLoader);BlazorWasmPrerendering diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index e318198..adb6270 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,3 +1,6 @@ +v.4.0.1 +- Improve: Make it work correctly even when used with gBlazorWasmBrotliLoader.Buildh NuGet package. + v.4.0.0 - This is the first official - not a preview - release. - Breaking Change: Drop the support for .NET 5. diff --git a/SampleApps/BlazorWasmAVP/BlazorWasmAVP.csproj b/SampleApps/BlazorWasmAVP/BlazorWasmAVP.csproj index ce1146d..03ab3d2 100644 --- a/SampleApps/BlazorWasmAVP/BlazorWasmAVP.csproj +++ b/SampleApps/BlazorWasmAVP/BlazorWasmAVP.csproj @@ -18,7 +18,7 @@ - + \ No newline at end of file diff --git a/SampleApps/BlazorWasmApp0/BlazorWasmApp0.csproj b/SampleApps/BlazorWasmApp0/BlazorWasmApp0.csproj index 45fd261..b32adcf 100644 --- a/SampleApps/BlazorWasmApp0/BlazorWasmApp0.csproj +++ b/SampleApps/BlazorWasmApp0/BlazorWasmApp0.csproj @@ -9,7 +9,8 @@ - + + diff --git a/SampleApps/BlazorWasmApp1/BlazorWasmApp1.csproj b/SampleApps/BlazorWasmApp1/BlazorWasmApp1.csproj index eca9801..5d2dc07 100644 --- a/SampleApps/BlazorWasmApp1/BlazorWasmApp1.csproj +++ b/SampleApps/BlazorWasmApp1/BlazorWasmApp1.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/SampleApps/BlazorWasmApp2/Client/BlazorWasmApp2.Client.csproj b/SampleApps/BlazorWasmApp2/Client/BlazorWasmApp2.Client.csproj index dccead9..790dafc 100644 --- a/SampleApps/BlazorWasmApp2/Client/BlazorWasmApp2.Client.csproj +++ b/SampleApps/BlazorWasmApp2/Client/BlazorWasmApp2.Client.csproj @@ -1,4 +1,4 @@ - + net6.0 diff --git a/SampleApps/SAMPLE-APPS-README.md b/SampleApps/SAMPLE-APPS-README.md index c55fa6d..2f58c4c 100644 --- a/SampleApps/SAMPLE-APPS-README.md +++ b/SampleApps/SAMPLE-APPS-README.md @@ -10,6 +10,7 @@ |PWA | ✅ Yes | - | - |Has easter-egg | - | ✅ Yes | - |Deploy to GitHub Pages| - | ✅ Yes | - +|Brotli Loader | ✅ Yes | - | - |Has AngleSharp dependency| ✅Yes | - | - |Localization | ✅ Yes | - | - |Lazy Load Assembly | ✅ Yes | ✅ Yes | - diff --git a/VersionInfo.props b/VersionInfo.props index a5b8a30..5f6bd64 100644 --- a/VersionInfo.props +++ b/VersionInfo.props @@ -1,6 +1,6 @@ - 4.0.0 + 4.0.1-preview.1 J.Sakamoto Copyright © 2021-2024 J.Sakamoto, Mozilla Public License 2.0 When you publish your Blazor Wasm app, this package pre-renders and saves the app as static HTML files in your public folder.