Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser] loader ES6 module #85730

Merged
merged 30 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cac6aef
wip
pavelsavara May 4, 2023
1251559
wip
pavelsavara May 4, 2023
31abd81
wip
pavelsavara May 4, 2023
5543761
wip
pavelsavara May 4, 2023
b6ad41e
fix dry run and snapshot
pavelsavara May 4, 2023
4192e71
wip
pavelsavara May 4, 2023
aaee77f
fix
pavelsavara May 5, 2023
731dc89
Update Wasm SDK to process new js files. Put fingerprint on runtime a…
maraf May 5, 2023
8e63d87
Fix relative path to js modules
maraf May 5, 2023
00d529e
Merge branch 'main' into browser_loader
pavelsavara May 5, 2023
68f5865
Merge branch 'main' into browser_loader
pavelsavara May 9, 2023
998b9cb
fix merge
pavelsavara May 9, 2023
dcaac7b
use fixed version of chrome
pavelsavara May 9, 2023
fc785ae
fix http on node, fix API propagation on node
pavelsavara May 9, 2023
222c9cd
Merge branch 'main' into browser_loader
pavelsavara May 10, 2023
f22f159
fix
pavelsavara May 10, 2023
45a2cc6
Fix fingerprinting dotnet.js when requested (= .NET 6+7 Blazor)
maraf May 10, 2023
8f1c763
wip
pavelsavara May 10, 2023
57802f4
Merge branch 'browser_loader' of https://github.com/pavelsavara/runti…
pavelsavara May 10, 2023
aa76c0a
fix
pavelsavara May 10, 2023
739057a
fix wbt
pavelsavara May 10, 2023
e4df4aa
Merge branch 'main' into browser_loader
pavelsavara May 11, 2023
b15428b
fix wbt
pavelsavara May 11, 2023
07c8c5c
fix
pavelsavara May 11, 2023
138be65
fix SelfContained
pavelsavara May 11, 2023
71b2e57
Revert "fix SelfContained"
pavelsavara May 11, 2023
27bb9b6
larrys fix
pavelsavara May 11, 2023
e0f3b48
feedback
pavelsavara May 11, 2023
abc07d8
fix
pavelsavara May 11, 2023
00040d3
feedback
pavelsavara May 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@
<LibrariesRuntimeFiles Condition="'$(TargetOS)' == 'browser'"
Include="
$(LibrariesNativeArtifactsPath)dotnet.js;
$(LibrariesNativeArtifactsPath)dotnet.native.js;
$(LibrariesNativeArtifactsPath)dotnet.runtime.js;
$(LibrariesNativeArtifactsPath)dotnet.d.ts;
$(LibrariesNativeArtifactsPath)dotnet-legacy.d.ts;
$(LibrariesNativeArtifactsPath)package.json;
$(LibrariesNativeArtifactsPath)dotnet.wasm;
$(LibrariesNativeArtifactsPath)dotnet.js.symbols;
$(LibrariesNativeArtifactsPath)dotnet.native.wasm;
$(LibrariesNativeArtifactsPath)dotnet.native.js.symbols;
$(LibrariesNativeArtifactsPath)*.dat;"
IsNative="true" />
<!-- for threaded wasm -->
Expand Down
2 changes: 1 addition & 1 deletion eng/testing/tests.browser.targets
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs>
<_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs>
<_XHarnessArgs Condition="('$(WasmEnableThreads)' == 'true' or '$(WasmEnablePerfTracing)' == 'true') and '$(_XHarnessArs.Contains(&quot;--web-server-use-cop&quot;)' != 'true'">$(_XHarnessArgs) --web-server-use-cop</_XHarnessArgs>
<_XHarnessArgs >$(_XHarnessArgs) -s dotnet.js.symbols</_XHarnessArgs>
<_XHarnessArgs >$(_XHarnessArgs) -s dotnet.native.js.symbols</_XHarnessArgs>
<_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbol-patterns wasm-symbol-patterns.txt</_XHarnessArgs>
<_XHarnessArgs Condition="'$(_UseWasmSymbolicator)' == 'true'" >$(_XHarnessArgs) --symbolicator WasmSymbolicator.dll,Microsoft.WebAssembly.Internal.SymbolicatorWrapperForXHarness</_XHarnessArgs>
<_XHarnessArgs Condition="'$(_WasmBrowserPathForTests)' != ''" >$(_XHarnessArgs) &quot;--browser-path=$(_WasmBrowserPathForTests)&quot;</_XHarnessArgs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@
<PlatformManifestFileEntry Include="libmono-wasm-eh-wasm.a" IsNative="true" />
<PlatformManifestFileEntry Include="wasm-bundled-timezones.a" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.worker.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.js.symbols" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.runtime.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.worker.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.js.symbols" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.d.ts" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet-legacy.d.ts" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.wasm" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.native.wasm" IsNative="true" />
<PlatformManifestFileEntry Include="icudt.dat" IsNative="true" />
<PlatformManifestFileEntry Include="icudt_no_CJK.dat" IsNative="true" />
<PlatformManifestFileEntry Include="icudt_CJK.dat" IsNative="true" />
Expand All @@ -250,7 +252,6 @@
<PlatformManifestFileEntry Include="icudt_optimal_no_CJK.dat" IsNative="true" />
<PlatformManifestFileEntry Include="package.json" IsNative="true" />
<PlatformManifestFileEntry Include="pal_random.lib.js" IsNative="true" />
<PlatformManifestFileEntry Include="runtime.es6.iffe.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.es6.pre.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.es6.lib.js" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.es6.extpost.js" IsNative="true" />
Expand All @@ -271,6 +272,7 @@
<PlatformManifestFileEntry Include="driver.h" IsNative="true" />
<PlatformManifestFileEntry Include="stubs.c" IsNative="true" />
<PlatformManifestFileEntry Include="synthetic-pthread.c" IsNative="true" />
<PlatformManifestFileEntry Include="dotnet.wasm" IsNative="true" />
<!-- ICU-specific files -->
<PlatformManifestFileEntry Include="libicudata.a" IsNative="true" />
<PlatformManifestFileEntry Include="libicui18n.a" IsNative="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export async function runSecondRuntimeAndTestStaticState() {
const { dotnet: dotnet2 } = await import('./dotnet.js?2');
const runtime2 = await dotnet2.create();
const { dotnet: dotnet2 } = await import('./dotnet.js?instance=2');
const runtime2 = await dotnet2
.withStartupMemoryCache(false)
.withConfig({
assetUniqueQuery: "?instance=2",
})
.create();

const increment1 = await getIncrementStateFunction(App.runtime);
const increment2 = await getIncrementStateFunction(runtime2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Remove dotnet.js/wasm from runtime pack, in favor of the relinked ones in @(WasmNativeAsset) -->
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)"
Condition="@(WasmNativeAsset->Count()) > 0 and '%(FileName)' == 'dotnet' and ('%(Extension)' == '.wasm' or '%(Extension)' == '.js')" />
Condition="@(WasmNativeAsset->Count()) > 0 and ( '%(FileName)' == 'dotnet' or '%(FileName)' == 'dotnet.native' ) and ('%(Extension)' == '.wasm' or '%(Extension)' == '.js')" />
</ItemGroup>

<ComputeWasmBuildAssets
Expand Down
3 changes: 2 additions & 1 deletion src/mono/sample/wasm/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
$(TargetFileName)
"
Outputs="
bin/$(Configuration)/AppBundle/dotnet.wasm;
bin/$(Configuration)/AppBundle/dotnet.native.wasm;
bin/$(Configuration)/AppBundle/dotnet.native.js;
bin/$(Configuration)/AppBundle/$(_WasmMainJSFileName);
">
<PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/mono/sample/wasm/browser-advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<script type='module' src="./main.js"></script>
<script type='module' src="./dotnet.js"></script>
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.runtime.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.wasm" as="fetch" crossorigin="anonymous">
<!-- users should consider if they optimize for the first load or subsequent load from memory snapshot -->
<link rel="prefetch" href="./icudt.dat" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./managed/System.Private.CoreLib.webcil" as="fetch" crossorigin="anonymous">
Expand Down
4 changes: 3 additions & 1 deletion src/mono/sample/wasm/browser-bench/appstart-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<script type="module" src="./frame-main.js"></script>
<script type='module' src="./dotnet.js"></script>
<link rel="preload" href="./mono-config.json" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.wasm" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.runtime.js" as="fetch" crossorigin="anonymous">
<link rel="prefetch" href="./dotnet.native.wasm" as="fetch" crossorigin="anonymous">
<!-- users should consider if they optimize for the first load or subsequent load from memory snapshot -->
<link rel="prefetch" href="./managed/System.Private.CoreLib.dll" as="fetch" crossorigin="anonymous">
</head>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@


<Target Name="CopyRelinkedPackage" AfterTargets="WasmBuildApp" DependsOnTargets="Build" Inputs="$(WasmAppDir)/dotnet.js;
$(WasmAppDir)/dotnet.wasm;
$(WasmAppDir)/dotnet.runtime.js;
$(WasmAppDir)/dotnet.native.js;
$(WasmAppDir)/dotnet.native.wasm;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet.d.ts;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet-legacy.d.ts;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/package.json;" Outputs="bin/dotnet-runtime/.npm-stamp">
<ItemGroup>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.wasm"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.runtime.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.native.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.native.wasm"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet.d.ts"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet-legacy.d.ts"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/package.json"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
</PropertyGroup>

<Target Name="CopyRelinkedPackage" AfterTargets="WasmBuildApp" DependsOnTargets="Build" Inputs="$(WasmAppDir)/dotnet.js;
$(WasmAppDir)/dotnet.wasm;
$(WasmAppDir)/dotnet.runtime.js;
$(WasmAppDir)/dotnet.native.js;
$(WasmAppDir)/dotnet.native.wasm;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet.d.ts;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet-legacy.d.ts;
$(MicrosoftNetCoreAppRuntimePackNativeDir)/package.json;" Outputs="bin/dotnet-runtime/.npm-stamp">
<ItemGroup>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.wasm"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.runtime.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.native.js"/>
<NpmPackageFiles Include="$(WasmAppDir)/dotnet.native.wasm"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet.d.ts"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/dotnet-legacy.d.ts"/>
<NpmPackageFiles Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)/package.json"/>
Expand Down
6 changes: 3 additions & 3 deletions src/mono/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ The wrapper script used to actually run these tests, accepts:

Exceptions thrown after the runtime starts get symbolicating from js itself. Exceptions before that, like asserts containing native traces get symbolicated by xharness using `src/mono/wasm/symbolicator`.

If you need to symbolicate some traces manually, then you need the corresponding `dotnet.js.symbols` file. Then:
If you need to symbolicate some traces manually, then you need the corresponding `dotnet.native.js.symbols` file. Then:

```console
src/mono/wasm/symbolicator$ dotnet run /path/to/dotnet.js.symbols /path/to/file/with/traces
src/mono/wasm/symbolicator$ dotnet run /path/to/dotnet.native.js.symbols /path/to/file/with/traces
```

When not relinking, or not building with AOT, you can find `dotnet.js.symbols` in the runtime pack.
When not relinking, or not building with AOT, you can find `dotnet.native.js.symbols` in the runtime pack.

## Debugger tests on macOS

Expand Down
4 changes: 2 additions & 2 deletions src/mono/wasm/Wasm.Build.Tests/Blazor/BuildPublishTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public void DefaultTemplate_WithoutWorkload(string config)

// Build
BlazorBuildInternal(id, config, publish: false);
AssertBlazorBootJson(config, isPublish: false);
AssertBlazorBootJson(config, isPublish: false, isNet7AndBelow: false);

// Publish
BlazorBuildInternal(id, config, publish: true);
AssertBlazorBootJson(config, isPublish: true);
AssertBlazorBootJson(config, isPublish: true, isNet7AndBelow: false);
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/Wasm.Build.Tests/Blazor/MiscTests2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void BuildNet50Project(string config, bool aot, bool expectError, string
Assert.Contains("** UsingBrowserRuntimeWorkload: 'false'", result.Output);

string binFrameworkDir = FindBlazorBinFrameworkDir(config, forPublish: true, framework: "net5.0");
AssertBlazorBootJson(config, isPublish: true, binFrameworkDir: binFrameworkDir);
AssertBlazorBootJson(config, isPublish: true, isNet7AndBelow: true, binFrameworkDir: binFrameworkDir);
// dotnet.wasm here would be from 5.0 nuget like:
// /Users/radical/.nuget/packages/microsoft.netcore.app.runtime.browser-wasm/5.0.9/runtimes/browser-wasm/native/dotnet.wasm
}
Expand Down
52 changes: 27 additions & 25 deletions src/mono/wasm/Wasm.Build.Tests/BuildTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -621,22 +621,22 @@ protected void AssertDotNetNativeFiles(NativeFilesType type, string config, bool
_ => throw new ArgumentOutOfRangeException(nameof(type))
};

AssertSameFile(Path.Combine(srcDir, "dotnet.wasm"), Path.Combine(binFrameworkDir, "dotnet.wasm"), label);
AssertSameFile(Path.Combine(srcDir, "dotnet.native.wasm"), Path.Combine(binFrameworkDir, "dotnet.native.wasm"), label);

// find dotnet*js
string? dotnetJsPath = Directory.EnumerateFiles(binFrameworkDir)
.Where(p => Path.GetFileName(p).StartsWith("dotnet.", StringComparison.OrdinalIgnoreCase) &&
.Where(p => Path.GetFileName(p).StartsWith("dotnet.native", StringComparison.OrdinalIgnoreCase) &&
Path.GetFileName(p).EndsWith(".js", StringComparison.OrdinalIgnoreCase))
.SingleOrDefault();

Assert.True(!string.IsNullOrEmpty(dotnetJsPath), $"[{label}] Expected to find dotnet*js in {binFrameworkDir}");
AssertSameFile(Path.Combine(srcDir, "dotnet.js"), dotnetJsPath!, label);
Assert.True(!string.IsNullOrEmpty(dotnetJsPath), $"[{label}] Expected to find dotnet.native*js in {binFrameworkDir}");
AssertSameFile(Path.Combine(srcDir, "dotnet.native.js"), dotnetJsPath!, label);

if (type != NativeFilesType.FromRuntimePack)
{
// check that the files are *not* from runtime pack
AssertNotSameFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.wasm"), Path.Combine(binFrameworkDir, "dotnet.wasm"), label);
AssertNotSameFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.js"), dotnetJsPath!, label);
AssertNotSameFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.wasm"), Path.Combine(binFrameworkDir, "dotnet.native.wasm"), label);
AssertNotSameFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.js"), dotnetJsPath!, label);
}
}

Expand Down Expand Up @@ -667,9 +667,11 @@ protected static void AssertBasicAppBundle(string bundleDir,
var filesToExist = new List<string>()
{
mainJS,
"dotnet.wasm",
"dotnet.native.wasm",
"mono-config.json",
"dotnet.js"
"dotnet.js",
"dotnet.native.js",
"dotnet.runtime.js"
};

if (isBrowserProject)
Expand Down Expand Up @@ -751,20 +753,20 @@ void AssertIcuAssets()

protected static void AssertDotNetWasmJs(string bundleDir, bool fromRuntimePack, string targetFramework)
{
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.wasm"),
Path.Combine(bundleDir, "dotnet.wasm"),
"Expected dotnet.wasm to be same as the runtime pack",
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.wasm"),
Path.Combine(bundleDir, "dotnet.native.wasm"),
"Expected dotnet.native.wasm to be same as the runtime pack",
same: fromRuntimePack);

AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.js"),
Path.Combine(bundleDir, "dotnet.js"),
"Expected dotnet.js to be same as the runtime pack",
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.js"),
Path.Combine(bundleDir, "dotnet.native.js"),
"Expected dotnet.native.js to be same as the runtime pack",
same: fromRuntimePack);
}

protected static void AssertDotNetJsSymbols(string bundleDir, bool fromRuntimePack, string targetFramework)
=> AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.js.symbols"),
Path.Combine(bundleDir, "dotnet.js.symbols"),
=> AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.js.symbols"),
Path.Combine(bundleDir, "dotnet.native.js.symbols"),
same: fromRuntimePack);

protected static void AssertFilesDontExist(string dir, string[] filenames, string? label = null)
Expand Down Expand Up @@ -819,22 +821,22 @@ protected void AssertBlazorBundle(string config, bool isPublish, bool dotnetWasm
{
binFrameworkDir ??= FindBlazorBinFrameworkDir(config, isPublish, targetFramework);

AssertBlazorBootJson(config, isPublish, targetFramework, binFrameworkDir: binFrameworkDir);
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.wasm"),
Path.Combine(binFrameworkDir, "dotnet.wasm"),
"Expected dotnet.wasm to be same as the runtime pack",
AssertBlazorBootJson(config, isPublish, targetFramework != DefaultTargetFrameworkForBlazor, targetFramework, binFrameworkDir: binFrameworkDir);
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.wasm"),
Path.Combine(binFrameworkDir, "dotnet.native.wasm"),
"Expected dotnet.native.wasm to be same as the runtime pack",
same: dotnetWasmFromRuntimePack);

string? dotnetJsPath = Directory.EnumerateFiles(binFrameworkDir, "dotnet.*.js").FirstOrDefault();
string? dotnetJsPath = Directory.EnumerateFiles(binFrameworkDir, "dotnet.native.*.js").FirstOrDefault();
Assert.True(dotnetJsPath != null, $"Could not find blazor's dotnet*js in {binFrameworkDir}");

AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.js"),
AssertFile(Path.Combine(s_buildEnv.GetRuntimeNativeDir(targetFramework), "dotnet.native.js"),
dotnetJsPath!,
"Expected dotnet.js to be same as the runtime pack",
"Expected dotnet.native.js to be same as the runtime pack",
same: dotnetWasmFromRuntimePack);
}

protected void AssertBlazorBootJson(string config, bool isPublish, string targetFramework = DefaultTargetFrameworkForBlazor, string? binFrameworkDir=null)
protected void AssertBlazorBootJson(string config, bool isPublish, bool isNet7AndBelow, string targetFramework = DefaultTargetFrameworkForBlazor, string? binFrameworkDir=null)
{
binFrameworkDir ??= FindBlazorBinFrameworkDir(config, isPublish, targetFramework);

Expand All @@ -847,7 +849,7 @@ protected void AssertBlazorBootJson(string config, bool isPublish, string target
Assert.NotNull(runtimeObj);

string msgPrefix=$"[{( isPublish ? "publish" : "build" )}]";
Assert.True(runtimeObj!.Where(kvp => kvp.Key == "dotnet.wasm").Any(), $"{msgPrefix} Could not find dotnet.wasm entry in blazor.boot.json");
Assert.True(runtimeObj!.Where(kvp => kvp.Key == (isNet7AndBelow ? "dotnet.wasm" : "dotnet.native.wasm")).Any(), $"{msgPrefix} Could not find dotnet.native.wasm entry in blazor.boot.json");
Assert.True(runtimeObj!.Where(kvp => kvp.Key.StartsWith("dotnet.", StringComparison.OrdinalIgnoreCase) &&
kvp.Key.EndsWith(".js", StringComparison.OrdinalIgnoreCase)).Any(),
$"{msgPrefix} Could not find dotnet.*js in {bootJson}");
Expand Down
Loading