mirror of
https://github.com/ApfelTeeSaft/LiveSplitOne.git
synced 2026-08-27 19:19:42 +00:00
This introduces wasm-bindgen which will allow us to directly use all kinds of JS APIs in WASM without us having to manually provide all the functionality as imports. Instead we let wasm-bindgen handle all the importing. Additional webpack now handles the instantiation of the wasm module for us, which simplifies a bunch of things as well.
42 lines
810 B
JavaScript
42 lines
810 B
JavaScript
const { spawnSync } = require("child_process");
|
|
const fs = require("fs");
|
|
|
|
spawnSync(
|
|
"cargo",
|
|
["run"],
|
|
{
|
|
cwd: "livesplit-core/capi/bind_gen",
|
|
stdio: "inherit",
|
|
},
|
|
);
|
|
|
|
spawnSync(
|
|
"cargo",
|
|
[
|
|
"build",
|
|
"-p", "cdylib",
|
|
"--features", "wasm-web",
|
|
"--target", "wasm32-unknown-unknown",
|
|
"--release",
|
|
],
|
|
{
|
|
cwd: "livesplit-core",
|
|
stdio: "inherit",
|
|
},
|
|
);
|
|
|
|
spawnSync(
|
|
"wasm-bindgen",
|
|
[
|
|
"livesplit-core/target/wasm32-unknown-unknown/release/livesplit_core.wasm",
|
|
"--out-dir", "src/livesplit-core",
|
|
],
|
|
{
|
|
stdio: "inherit",
|
|
},
|
|
);
|
|
|
|
fs
|
|
.createReadStream("livesplit-core/capi/bindings/wasm_bindgen/index.ts")
|
|
.pipe(fs.createWriteStream("src/livesplit-core/index.ts"));
|