Merge pull request #1272 from matthiasgeihs/option-omit-default-path

Add wasmbindgen option: `omit_default_module_path`
master
Jesper Håkansson 2 years ago committed by GitHub
commit 063ecc40b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/src/cargo-toml-configuration.md
  2. 3
      src/bindgen.rs
  3. 12
      src/manifest/mod.rs

@ -27,6 +27,8 @@ debug-js-glue = true
demangle-name-section = true
# Should we emit the DWARF debug info custom sections?
dwarf-debug-info = false
# Should we omit the default import path?
omit-default-module-path = false
[package.metadata.wasm-pack.profile.profiling]
wasm-opt = ['-O']
@ -35,6 +37,7 @@ wasm-opt = ['-O']
debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false
omit-default-module-path = false
# `wasm-opt` is on by default in for the release profile, but it can be
# disabled by setting it to `false`
@ -45,4 +48,5 @@ wasm-opt = false
debug-js-glue = false
demangle-name-section = true
dwarf-debug-info = false
omit-default-module-path = false
```

@ -91,6 +91,9 @@ pub fn wasm_bindgen_build(
if profile.wasm_bindgen_dwarf_debug_info() {
cmd.arg("--keep-debug");
}
if profile.wasm_bindgen_omit_default_module_path() {
cmd.arg("--omit-default-module-path");
}
child::run(cmd, "wasm-bindgen").context("Running the wasm-bindgen CLI")?;
Ok(())

@ -117,6 +117,9 @@ struct CargoWasmPackProfileWasmBindgen {
#[serde(default, rename = "dwarf-debug-info")]
dwarf_debug_info: Option<bool>,
#[serde(default, rename = "omit-default-module-path")]
omit_default_module_path: Option<bool>,
}
/// Struct for storing information received from crates.io
@ -271,6 +274,7 @@ impl CargoWasmPackProfile {
debug_js_glue: Some(true),
demangle_name_section: Some(true),
dwarf_debug_info: Some(false),
omit_default_module_path: Some(false),
},
wasm_opt: None,
}
@ -282,6 +286,7 @@ impl CargoWasmPackProfile {
debug_js_glue: Some(false),
demangle_name_section: Some(true),
dwarf_debug_info: Some(false),
omit_default_module_path: Some(false),
},
wasm_opt: Some(CargoWasmPackProfileWasmOpt::Enabled(true)),
}
@ -293,6 +298,7 @@ impl CargoWasmPackProfile {
debug_js_glue: Some(false),
demangle_name_section: Some(true),
dwarf_debug_info: Some(false),
omit_default_module_path: Some(false),
},
wasm_opt: Some(CargoWasmPackProfileWasmOpt::Enabled(true)),
}
@ -334,6 +340,7 @@ impl CargoWasmPackProfile {
d!(wasm_bindgen.debug_js_glue);
d!(wasm_bindgen.demangle_name_section);
d!(wasm_bindgen.dwarf_debug_info);
d!(wasm_bindgen.omit_default_module_path);
if self.wasm_opt.is_none() {
self.wasm_opt = defaults.wasm_opt.clone();
@ -355,6 +362,11 @@ impl CargoWasmPackProfile {
self.wasm_bindgen.dwarf_debug_info.unwrap()
}
/// Get this profile's configured `[wasm-bindgen.omit-default-module-path]` value.
pub fn wasm_bindgen_omit_default_module_path(&self) -> bool {
self.wasm_bindgen.omit_default_module_path.unwrap()
}
/// Get this profile's configured arguments for `wasm-opt`, if enabled.
pub fn wasm_opt_args(&self) -> Option<Vec<String>> {
match self.wasm_opt.as_ref()? {

Loading…
Cancel
Save