Skip to content

Commit 9dd72ef

Browse files
authored
fix: ensure __wbindgen_start is called when necessary for --inline (#157)
1 parent b6c5f64 commit 9dd72ef

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

deno.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
"fmt": "deno fmt && cargo fmt",
2222
"build": "WASMBUILD_BINDGEN_UPGRADE=1 deno run -A ./main.ts -p wasmbuild",
2323
"build:lkg": "deno run -A jsr:@deno/wasmbuild@^0.15.4 -p wasmbuild",
24-
"test": "cd tests && rm -rf lib lib_out_js_file lib_inline lib_no_cache && deno task test:main && deno task test:js-ext && deno task test:inline && deno test -A && deno task test:check && deno task test:start",
24+
"test": "cd tests && rm -rf lib lib_out_js_file lib_inline lib_no_cache && deno task test:main && deno task test:js-ext && deno task test:inline && deno test -A && deno task test:check && deno task test:start && deno task test:start-inline",
2525
"test:main": "cd tests && deno run -A ../main.ts -p deno_test",
2626
"test:js-ext": "deno task test:main --js-ext mjs --out lib_out_js_file && cat tests/lib_out_js_file/deno_test.mjs > /dev/null",
2727
"test:check": "deno task test:main --check",
2828
"test:inline": "deno task test:main --inline --out lib_inline",
29-
"test:start": "cd tests && deno run -A ../main.ts -p deno_test --features start && USES_START=1 deno test -A test.ts"
29+
"test:start": "cd tests && deno run -A ../main.ts -p deno_test --features start && USES_START=1 deno test -A test.ts",
30+
"test:start-inline": "cd tests && deno run -A ../main.ts -p deno_test --features start --inline && USES_START=1 deno test -A test.ts"
3031
},
3132
"imports": {
3233
"@david/path": "jsr:@david/path@^0.2.0",

lib/commands/build_command.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ const wasm = new WebAssembly.Instance(wasmModule, {
130130
131131
export * from "./${output.bindingJsBg.path.basename()}";
132132
import { __wbg_set_wasm } from "./${output.bindingJsBg.path.basename()}";
133-
__wbg_set_wasm(wasm.exports);
133+
__wbg_set_wasm(wasm.exports);${
134+
output.hasStart ? "\nwasm.exports.__wbindgen_start();" : ""
135+
}
134136
135137
function base64decode(b64) {
136138
const binString = atob(b64);

0 commit comments

Comments
 (0)