@@ -8,7 +8,7 @@ repository = "https://github.com/polyphony-chat/polyproto"
88rust-version = " 1.85.0"
99
1010[lib ]
11- crate-type = [" rlib " , " cdylib" , " staticlib " ]
11+ crate-type = [" cdylib" , " rlib " ]
1212
1313[features ]
1414default = [" types" , " serde" , " gateway" , " tokio/net" ]
@@ -20,6 +20,8 @@ serde = ["dep:serde", "serde_json", "serde_with", "url/serde"]
2020serde_with = [" dep:serde_with" ]
2121serde_json = [" dep:serde_json" ]
2222gateway = [" serde" , " types" ]
23+ _wasm_bindgen = [" wasm" , " dep:wasm-bindgen" , " dep:js-sys" , " dep:wee_alloc" ]
24+ __no_wee_alloc = []
2325
2426[dependencies ]
2527der = { version = " 0.7.9" , features = [" pem" ] }
@@ -50,6 +52,11 @@ futures-util = "0.3.31"
5052urlencoding = " 2.1.3"
5153ws_stream_wasm = { version = " *" , optional = true }
5254
55+ [target .'cfg(target_arch = "wasm32")' .dependencies ]
56+ wasm-bindgen = { version = " 0.2.100" , optional = true }
57+ js-sys = { version = " 0.3.77" , optional = true }
58+ wee_alloc = { version = " 0.4.5" , optional = true }
59+
5360[target .'cfg(not(target_arch = "wasm32"))' .dependencies ]
5461rustls = " 0.23.25"
5562tokio-tungstenite = { version = " 0.26.2" , features = [
@@ -73,7 +80,18 @@ httptest = "0.16.3"
7380
7481[target .'cfg(target_arch = "wasm32")' .dev-dependencies ]
7582wasm-bindgen-test = " 0.3.50"
76- wasm-bindgen = " 0.2.100"
83+ # The `console_error_panic_hook` crate provides better debugging of panics by
84+ # logging them with `console.error`. This is great for development, but requires
85+ # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
86+ # code size when deploying.
87+ console_error_panic_hook = { version = " 0.1.7" }
88+
89+ [target .'cfg(target_arch = "wasm32")' .release ]
90+ # Tell `rustc` to optimize for small code size.
91+ opt-level = " s"
92+ lto = true
93+ codegen-units = 1
94+ panic = " abort"
7795
7896[lints .rust ]
7997unexpected_cfgs = { level = " warn" , check-cfg = [' cfg(tarpaulin_include)' ] }
0 commit comments