Skip to content

Commit c7cab6b

Browse files
authored
Revert bundler target specific default transformations (#4253)
1 parent 83c9deb commit c7cab6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+535
-465
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,6 @@ jobs:
344344
- run: rustup update --no-self-update stable && rustup default stable
345345
- run: rustup target add wasm32-unknown-unknown
346346
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -f
347-
- run: |
348-
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_112/binaryen-version_112-x86_64-linux.tar.gz -sSf > binaryen-version_112-x86_64-linux.tar.gz
349-
tar -xz -f binaryen-version_112-x86_64-linux.tar.gz binaryen-version_112/bin/wasm2js
350-
echo "$PWD/binaryen-version_112/bin" >> $GITHUB_PATH
351347
- run: |
352348
cargo build -p wasm-bindgen-cli
353349
ln -snf `pwd`/target/debug/wasm-bindgen $(dirname `which cargo`)/wasm-bindgen

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
* Optimized ABI performance for `Option<{i32,u32,isize,usize,f32,*const T,*mut T}>`.
4747
[#4183](https://github.com/rustwasm/wasm-bindgen/pull/4183)
4848

49-
* Reference type proposal transformations are not applied by default when detecting it in the Wasm module for the bundler target because currently `webpack` doesn't support it.
50-
[#4235](https://github.com/rustwasm/wasm-bindgen/pull/4235)
51-
5249
* Deprecate `--reference-types` in favor of automatic target feature detection.
5350
[#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237)
5451

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ members = [
106106
"examples/wasm-in-wasm",
107107
"examples/wasm-in-wasm-imports",
108108
"examples/wasm-in-web-worker",
109-
"examples/wasm2js",
110109
"examples/weather_report",
111110
"examples/webaudio",
112111
"examples/webgl",

crates/cli-support/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,7 @@ impl Bindgen {
325325
};
326326

327327
// Enable reference type transformations if the module is already using it.
328-
// Currently `webpack` does not support reference types.
329-
if !matches!(self.mode, OutputMode::Bundler { .. })
330-
&& wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types").ok()
331-
== Some(true)
328+
if let Ok(true) = wasm_bindgen_wasm_conventions::target_feature(&module, "reference-types")
332329
{
333330
self.externref = true;
334331
}

crates/cli/tests/reference/add.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,14 @@ export function add_i32(a, b) {
2323
return ret;
2424
}
2525

26+
export function __wbindgen_init_externref_table() {
27+
const table = wasm.__wbindgen_export_0;
28+
const offset = table.grow(4);
29+
table.set(0, undefined);
30+
table.set(offset + 0, undefined);
31+
table.set(offset + 1, null);
32+
table.set(offset + 2, true);
33+
table.set(offset + 3, false);
34+
;
35+
};
36+

crates/cli/tests/reference/add.wat

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
(module $reference_test.wasm
2-
(type (;0;) (func (param i32 i32) (result i32)))
3-
(func $add_u32 (;0;) (type 0) (param i32 i32) (result i32))
4-
(func $add_i32 (;1;) (type 0) (param i32 i32) (result i32))
2+
(type (;0;) (func))
3+
(type (;1;) (func (param i32 i32) (result i32)))
4+
(import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0)))
5+
(func $add_u32 (;1;) (type 1) (param i32 i32) (result i32))
6+
(func $add_i32 (;2;) (type 1) (param i32 i32) (result i32))
7+
(table (;0;) 128 externref)
58
(memory (;0;) 17)
69
(export "memory" (memory 0))
710
(export "add_u32" (func $add_u32))
811
(export "add_i32" (func $add_i32))
12+
(export "__wbindgen_export_0" (table 0))
13+
(export "__wbindgen_start" (func 0))
914
(@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext")
1015
)
1116

crates/cli/tests/reference/builder.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ export class ClassBuilder {
5858
}
5959
}
6060

61+
export function __wbindgen_init_externref_table() {
62+
const table = wasm.__wbindgen_export_0;
63+
const offset = table.grow(4);
64+
table.set(0, undefined);
65+
table.set(offset + 0, undefined);
66+
table.set(offset + 1, null);
67+
table.set(offset + 2, true);
68+
table.set(offset + 3, false);
69+
;
70+
};
71+
6172
export function __wbindgen_throw(arg0, arg1) {
6273
throw new Error(getStringFromWasm0(arg0, arg1));
6374
};
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
(module $reference_test.wasm
2-
(type (;0;) (func (result i32)))
3-
(type (;1;) (func (param i32 i32)))
4-
(func $__wbg_classbuilder_free (;0;) (type 1) (param i32 i32))
5-
(func $classbuilder_builder (;1;) (type 0) (result i32))
2+
(type (;0;) (func))
3+
(type (;1;) (func (result i32)))
4+
(type (;2;) (func (param i32 i32)))
5+
(import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0)))
6+
(func $__wbg_classbuilder_free (;1;) (type 2) (param i32 i32))
7+
(func $classbuilder_builder (;2;) (type 1) (result i32))
8+
(table (;0;) 128 externref)
69
(memory (;0;) 17)
710
(export "memory" (memory 0))
811
(export "__wbg_classbuilder_free" (func $__wbg_classbuilder_free))
912
(export "classbuilder_builder" (func $classbuilder_builder))
13+
(export "__wbindgen_export_0" (table 0))
14+
(export "__wbindgen_start" (func 0))
1015
(@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext")
1116
)
1217

crates/cli/tests/reference/constructor.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ export class ClassConstructor {
4949
}
5050
}
5151

52+
export function __wbindgen_init_externref_table() {
53+
const table = wasm.__wbindgen_export_0;
54+
const offset = table.grow(4);
55+
table.set(0, undefined);
56+
table.set(offset + 0, undefined);
57+
table.set(offset + 1, null);
58+
table.set(offset + 2, true);
59+
table.set(offset + 3, false);
60+
;
61+
};
62+
5263
export function __wbindgen_throw(arg0, arg1) {
5364
throw new Error(getStringFromWasm0(arg0, arg1));
5465
};
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
(module $reference_test.wasm
2-
(type (;0;) (func (result i32)))
3-
(type (;1;) (func (param i32 i32)))
4-
(func $__wbg_classconstructor_free (;0;) (type 1) (param i32 i32))
5-
(func $classconstructor_new (;1;) (type 0) (result i32))
2+
(type (;0;) (func))
3+
(type (;1;) (func (result i32)))
4+
(type (;2;) (func (param i32 i32)))
5+
(import "./reference_test_bg.js" "__wbindgen_init_externref_table" (func (;0;) (type 0)))
6+
(func $__wbg_classconstructor_free (;1;) (type 2) (param i32 i32))
7+
(func $classconstructor_new (;2;) (type 1) (result i32))
8+
(table (;0;) 128 externref)
69
(memory (;0;) 17)
710
(export "memory" (memory 0))
811
(export "__wbg_classconstructor_free" (func $__wbg_classconstructor_free))
912
(export "classconstructor_new" (func $classconstructor_new))
13+
(export "__wbindgen_export_0" (table 0))
14+
(export "__wbindgen_start" (func 0))
1015
(@custom "target_features" (after code) "\04+\0amultivalue+\0fmutable-globals+\0freference-types+\08sign-ext")
1116
)
1217

0 commit comments

Comments
 (0)