Skip to content

Commit

Permalink
update patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
elringus committed Jan 4, 2025
1 parent d81fbbc commit 14c57eb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public void Patch ()
.Replace("import(", "import(/*@vite-ignore*//*webpackIgnore:true*/"), Encoding.UTF8);

File.WriteAllText(runtime, File.ReadAllText(runtime, Encoding.UTF8)
.Replace("pt('WebAssembly resource does not have the expected content type \"application/wasm\", so falling back to slower ArrayBuffer instantiation.')", "true")
.Replace("import(", "import(/*@vite-ignore*//*webpackIgnore:true*/"), Encoding.UTF8);

File.WriteAllText(native, File.ReadAllText(native, Encoding.UTF8)
Expand Down
9 changes: 9 additions & 0 deletions src/cs/Bootsharp.Publish/Pack/ModulePatcher/ModulePatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ public void Patch ()
if (thread) PatchThreading();
if (embed) new InternalPatcher(dotnet, runtime, native).Patch();
if (trim) RemoveMaps();
RemoveWasmNag();
CopyInternals();
}

private void RemoveWasmNag ()
{
// Removes "WebAssembly resource does not have the expected content type..." warning.

File.WriteAllText(dotnet, File.ReadAllText(dotnet, Encoding.UTF8)
.Replace("w('WebAssembly resource does not have the expected content type \"application/wasm\", so falling back to slower ArrayBuffer instantiation.')", "true"));
}

private void PatchThreading ()
{
// Overprotective browser-only assert breaks unit testing:
Expand Down
2 changes: 1 addition & 1 deletion src/cs/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.4.0-alpha.37</Version>
<Version>0.4.0-alpha.40</Version>
<Authors>Elringus</Authors>
<PackageTags>javascript typescript ts js wasm node deno bun interop codegen</PackageTags>
<PackageProjectUrl>https://sharp.elringus.com</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/js/scripts/cover.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node --expose-gc ./node_modules/vitest/vitest.mjs run --silent \
node ./node_modules/vitest/vitest.mjs run \
--coverage.enabled --coverage.thresholds.100 --coverage.include=**/sideload/*.mjs \
--coverage.exclude=**/dotnet.* --coverage.allowExternal
2 changes: 1 addition & 1 deletion src/js/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node --expose-gc ./node_modules/vitest/vitest.mjs run --silent
node ./node_modules/vitest/vitest.mjs run

0 comments on commit 14c57eb

Please sign in to comment.