Skip to content

Commit 32f6322

Browse files
committed
web: Qualify the vanilla (MVP) WASM module with a name suffix
Instead of the one with extensions enabled.
1 parent abdc9d5 commit 32f6322

File tree

7 files changed

+20
-23
lines changed

7 files changed

+20
-23
lines changed

.cargo/config.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[target.'cfg(all())']
2-
# NOTE that the web build overrides this setting in package.json via the RUSTFLAGS environment variable
2+
# NOTE that the web build overrides this setting in tools/build_wasm.ts via the RUSTFLAGS environment variable
33
rustflags = [
44
# We need to specify this flag for all targets because Clippy checks all of our code against all targets
55
# and our web code does not compile without this flag

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ opt-level = 3
117117
[profile.dev.package.nihav_duck]
118118
opt-level = 3
119119

120-
# TODO: Set rustflags here instead of in web/core/package.json, when that
120+
# TODO: Set rustflags here instead of in tools/build_wasm.ts, when that
121121
# feature becomes stable. See: https://github.com/rust-lang/cargo/issues/10271
122122
# Until then, these custom profiles let cargo keep the build cache alive
123123
# across "dual-wasm" builds, separating it for the two .wasm modules.
124-
[profile.web-vanilla-wasm]
124+
[profile.web-wasm-mvp]
125125
inherits = "release"
126126

127127
[profile.web-wasm-extensions]

web/packages/core/src/internal/builder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RuffleInstanceBuilder } from "../../dist/ruffle_web-wasm_extensions";
1+
import type { RuffleInstanceBuilder } from "../../dist/ruffle_web";
22
import { BaseLoadOptions, Duration, SecsDuration } from "../public/config";
33

44
/**

web/packages/core/src/internal/player/inner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RuffleHandle, ZipWriter } from "../../../dist/ruffle_web-wasm_extensions";
1+
import type { RuffleHandle, ZipWriter } from "../../../dist/ruffle_web";
22
import {
33
AutoPlay,
44
ContextMenu,

web/packages/core/src/load-ruffle.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import {
99
signExtensions,
1010
referenceTypes,
1111
} from "wasm-feature-detect";
12-
import type {
13-
RuffleInstanceBuilder,
14-
ZipWriter,
15-
} from "../dist/ruffle_web-wasm_extensions";
12+
import type { RuffleInstanceBuilder, ZipWriter } from "../dist/ruffle_web";
1613
import { setPolyfillsOnLoad } from "./js-polyfills";
1714

1815
import { internalSourceApi } from "./internal/internal-source-api";
@@ -49,9 +46,9 @@ async function fetchRuffle(
4946
).every(Boolean);
5047

5148
// @ts-expect-error TS2367 %FALLBACK_WASM% gets replaced in set_version.ts.
52-
// %FALLBACK_WASM% is "ruffle_web" if this is a dual-wasm build.
49+
// %FALLBACK_WASM% is "ruffle_web-wasm_mvp" if this is a dual-wasm build.
5350
// We don't say we're falling back if we have only an extension build.
54-
if (!extensionsSupported && "%FALLBACK_WASM%" === "ruffle_web") {
51+
if (!extensionsSupported && "%FALLBACK_WASM%" === "ruffle_web-wasm_mvp") {
5552
console.log(
5653
"Some WebAssembly extensions are NOT available, falling back to the vanilla WebAssembly module",
5754
);
@@ -68,12 +65,12 @@ async function fetchRuffle(
6865
RuffleInstanceBuilder,
6966
ZipWriter,
7067
} = await (extensionsSupported
71-
? import("../dist/ruffle_web-wasm_extensions")
68+
? import("../dist/ruffle_web")
7269
: // @ts-expect-error TS2307 TypeScript compiler is trying to do the import.
7370
import("../dist/%FALLBACK_WASM%"));
7471
let response;
7572
const wasmUrl = extensionsSupported
76-
? new URL("../dist/ruffle_web-wasm_extensions_bg.wasm", import.meta.url)
73+
? new URL("../dist/ruffle_web_bg.wasm", import.meta.url)
7774
: new URL("../dist/%FALLBACK_WASM%_bg.wasm", import.meta.url);
7875
const wasmResponse = await fetch(wasmUrl);
7976
// The Pale Moon browser lacks full support for ReadableStream.

web/packages/core/tools/build_wasm.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ if (wasmSource === "cargo_and_store") {
160160
rmSync("../../dist", { recursive: true, force: true });
161161
mkdirSync("../../dist");
162162
}
163-
buildWasm(
164-
"web-wasm-extensions",
165-
"ruffle_web-wasm_extensions",
166-
hasWasmOpt,
167-
true,
168-
wasmSource,
169-
);
163+
buildWasm("web-wasm-extensions", "ruffle_web", hasWasmOpt, true, wasmSource);
170164
if (buildWasmMvp) {
171-
buildWasm("web-vanilla-wasm", "ruffle_web", hasWasmOpt, false, wasmSource);
165+
buildWasm(
166+
"web-wasm-mvp",
167+
"ruffle_web-wasm_mvp",
168+
hasWasmOpt,
169+
false,
170+
wasmSource,
171+
);
172172
}

web/packages/core/tools/set_version.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ if (process.env["ENABLE_VERSION_SEAL"] === "true") {
6666

6767
const fallbackWasmName =
6868
process.env["BUILD_WASM_MVP"] === "true"
69-
? "ruffle_web"
70-
: "ruffle_web-wasm_extensions";
69+
? "ruffle_web-wasm_mvp"
70+
: "ruffle_web";
7171

7272
const options = {
7373
files: "dist/**",

0 commit comments

Comments
 (0)