From 034aad7d17cb073282dbba7da807968fff3d7894 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 18 Apr 2025 12:06:02 -0400 Subject: [PATCH 1/3] fix: ensure `__wbindgen_start` is called when necessary for `--inline` --- deno.json | 5 +++-- lib/commands/build_command.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deno.json b/deno.json index 2c5e682..aed5774 100644 --- a/deno.json +++ b/deno.json @@ -21,12 +21,13 @@ "fmt": "deno fmt && cargo fmt", "build": "WASMBUILD_BINDGEN_UPGRADE=1 deno run -A ./main.ts -p wasmbuild", "build:lkg": "deno run -A jsr:@deno/wasmbuild@^0.15.4 -p wasmbuild", - "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", + "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", "test:main": "cd tests && deno run -A ../main.ts -p deno_test", "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", "test:check": "deno task test:main --check", "test:inline": "deno task test:main --inline --out lib_inline", - "test:start": "cd tests && deno run -A ../main.ts -p deno_test --features start && USES_START=1 deno test -A test.ts" + "test:start": "cd tests && deno run -A ../main.ts -p deno_test --features start && USES_START=1 deno test -A test.ts", + "test:start-inline": "cd tests && deno run -A ../main.ts -p deno_test --features start --inline && USES_START=1 deno test -A test.ts" }, "imports": { "@david/path": "jsr:@david/path@^0.2.0", diff --git a/lib/commands/build_command.ts b/lib/commands/build_command.ts index 53bdcf0..c8d406f 100644 --- a/lib/commands/build_command.ts +++ b/lib/commands/build_command.ts @@ -130,7 +130,7 @@ const wasm = new WebAssembly.Instance(wasmModule, { export * from "./${output.bindingJsBg.path.basename()}"; import { __wbg_set_wasm } from "./${output.bindingJsBg.path.basename()}"; -__wbg_set_wasm(wasm.exports); +__wbg_set_wasm(wasm.exports);${output.hasStart ? "\nwasm.exports.__wbindgen_start();" : ""} function base64decode(b64) { const binString = atob(b64); From 5c04037955c2741541d8f72bb607f8247b5e0b56 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 18 Apr 2025 12:08:32 -0400 Subject: [PATCH 2/3] format --- lib/commands/build_command.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/commands/build_command.ts b/lib/commands/build_command.ts index c8d406f..f888436 100644 --- a/lib/commands/build_command.ts +++ b/lib/commands/build_command.ts @@ -130,7 +130,9 @@ const wasm = new WebAssembly.Instance(wasmModule, { export * from "./${output.bindingJsBg.path.basename()}"; import { __wbg_set_wasm } from "./${output.bindingJsBg.path.basename()}"; -__wbg_set_wasm(wasm.exports);${output.hasStart ? "\nwasm.exports.__wbindgen_start();" : ""} +__wbg_set_wasm(wasm.exports);${ + output.hasStart ? "\nwasm.exports.__wbindgen_start();" : "" + } function base64decode(b64) { const binString = atob(b64); From 842b459b5884c15541a962543c290fab632a26c5 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 18 Apr 2025 12:13:10 -0400 Subject: [PATCH 3/3] fix --- deno.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno.json b/deno.json index aed5774..d014650 100644 --- a/deno.json +++ b/deno.json @@ -21,7 +21,7 @@ "fmt": "deno fmt && cargo fmt", "build": "WASMBUILD_BINDGEN_UPGRADE=1 deno run -A ./main.ts -p wasmbuild", "build:lkg": "deno run -A jsr:@deno/wasmbuild@^0.15.4 -p wasmbuild", - "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", + "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", "test:main": "cd tests && deno run -A ../main.ts -p deno_test", "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", "test:check": "deno task test:main --check",