From 42f67ad8f97e82761cbbd85dba5f2d708d6a7c37 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 22 Jul 2026 09:18:13 +0200 Subject: [PATCH 1/3] Publish JS/CSS source maps in Release builds Release bundles already advertise sourceMappingURL, but maps were only embedded in Debug, so production tooling hit 404s (elastic/docs-builder#3689). Co-Authored-By: Claude Sonnet 4.6 (1M context) Co-authored-by: Cursor --- .../Elastic.Documentation.Site.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj index 5a9d1c2ae4..13b300e131 100644 --- a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj +++ b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj @@ -103,9 +103,9 @@ - + - + From 6f9593e33d88794cd8d4887ec4065a231f208eb4 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Mon, 21 Sep 2026 11:09:50 +0200 Subject: [PATCH 2/3] Delete stale hashed maps on every frontend rebuild Parcel does not empty distDir. Cleanup now runs inside NpmRunBuild so stale hashed maps cannot accumulate into the embedded AOT binary. Co-Authored-By: Cursor Grok 4.6 Co-authored-by: Cursor --- .../Elastic.Documentation.Site.csproj | 24 ++++------ .../EmbeddedStaticAssetTests.cs | 46 +++++++++++++++++++ 2 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs diff --git a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj index 13b300e131..3bedcf6e84 100644 --- a/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj +++ b/src/Elastic.Documentation.Site/Elastic.Documentation.Site.csproj @@ -76,6 +76,16 @@ Inputs="@(NpmBuildInputFiles)" Outputs="_static/.build-stamp;_static/main.js;_static/styles.css"> + + + + + + + + - - - - - - - - - - - diff --git a/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs b/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs new file mode 100644 index 0000000000..35697b1bd4 --- /dev/null +++ b/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs @@ -0,0 +1,46 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information + +using AwesomeAssertions; +using Elastic.Documentation.Configuration; +using Elastic.Documentation.Site.FileProviders; + +namespace Elastic.Markdown.Tests; + +public class EmbeddedStaticAssetTests +{ + private static readonly string[] ResourceNames = + typeof(EmbeddedOrPhysicalFileProvider).Assembly.GetManifestResourceNames(); + + [Fact] + public void EmbedGeneratedAssets_includes_source_maps_unconditionally() + { + var mapEmbeds = File.ReadAllLines(SiteCsprojPath()) + .Where(static line => line.Contains("EmbeddedResource", StringComparison.Ordinal) + && (line.Contains("*.js.map", StringComparison.Ordinal) || line.Contains("*.css.map", StringComparison.Ordinal))) + .ToArray(); + + mapEmbeds.Should().HaveCount(2); + mapEmbeds.Should().NotContain(static line => line.Contains("Condition", StringComparison.Ordinal)); + } + + [Fact] + public void NpmRunBuild_deletes_hashed_source_maps_before_parcel() + { + var csproj = File.ReadAllText(SiteCsprojPath()); + csproj.Should().Contain("""Include="_static/*.????????*.js.map" """); + csproj.Should().Contain("""Include="_static/*.????????*.css.map" """); + csproj.Should().NotContain("CleanOldHashedAssets"); + } + + [Fact] + public void Site_assembly_embeds_js_and_css_source_maps() + { + ResourceNames.Should().Contain(static n => n.EndsWith(".js.map", StringComparison.Ordinal)); + ResourceNames.Should().Contain(static n => n.EndsWith(".css.map", StringComparison.Ordinal)); + } + + private static string SiteCsprojPath() => + Path.Combine(Paths.WorkingDirectoryRoot.FullName, "src", "Elastic.Documentation.Site", "Elastic.Documentation.Site.csproj"); +} From 0e288407a62b6bf30b034f8548deb07abbbeaab5 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Mon, 21 Sep 2026 11:21:20 +0200 Subject: [PATCH 3/3] Format EmbeddedStaticAssetTests after curb rewrite Co-Authored-By: Cursor Grok 4.6 Co-authored-by: Cursor --- .../EmbeddedStaticAssetTests.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs b/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs index 35697b1bd4..987719c8ba 100644 --- a/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs +++ b/tests/Elastic.Markdown.Tests/EmbeddedStaticAssetTests.cs @@ -10,15 +10,17 @@ namespace Elastic.Markdown.Tests; public class EmbeddedStaticAssetTests { - private static readonly string[] ResourceNames = - typeof(EmbeddedOrPhysicalFileProvider).Assembly.GetManifestResourceNames(); + private static readonly string[] ResourceNames = typeof(EmbeddedOrPhysicalFileProvider).Assembly.GetManifestResourceNames(); [Fact] public void EmbedGeneratedAssets_includes_source_maps_unconditionally() { - var mapEmbeds = File.ReadAllLines(SiteCsprojPath()) - .Where(static line => line.Contains("EmbeddedResource", StringComparison.Ordinal) - && (line.Contains("*.js.map", StringComparison.Ordinal) || line.Contains("*.css.map", StringComparison.Ordinal))) + var mapEmbeds = File + .ReadAllLines(SiteCsprojPath()) + .Where( + static line => line.Contains("EmbeddedResource", StringComparison.Ordinal) && + (line.Contains("*.js.map", StringComparison.Ordinal) || line.Contains("*.css.map", StringComparison.Ordinal)) + ) .ToArray(); mapEmbeds.Should().HaveCount(2);