mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 12:31:22 +00:00
Add electron support via --omit-imports (#1958)
This commit is contained in:
@ -316,6 +316,11 @@ impl<'a> Context<'a> {
|
||||
|
||||
fn js_import_header(&self) -> Result<String, Error> {
|
||||
let mut imports = String::new();
|
||||
|
||||
if self.config.omit_imports {
|
||||
return Ok(imports)
|
||||
}
|
||||
|
||||
match &self.config.mode {
|
||||
OutputMode::NoModules { .. } => {
|
||||
for (module, _items) in self.js_imports.iter() {
|
||||
|
@ -26,6 +26,7 @@ pub struct Bindgen {
|
||||
mode: OutputMode,
|
||||
debug: bool,
|
||||
typescript: bool,
|
||||
omit_imports: bool,
|
||||
demangle: bool,
|
||||
keep_debug: bool,
|
||||
remove_name_section: bool,
|
||||
@ -97,6 +98,7 @@ impl Bindgen {
|
||||
},
|
||||
debug: false,
|
||||
typescript: false,
|
||||
omit_imports: false,
|
||||
demangle: true,
|
||||
keep_debug: false,
|
||||
remove_name_section: false,
|
||||
@ -222,6 +224,11 @@ impl Bindgen {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn omit_imports(&mut self, omit_imports: bool) -> &mut Bindgen {
|
||||
self.omit_imports = omit_imports;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn demangle(&mut self, demangle: bool) -> &mut Bindgen {
|
||||
self.demangle = demangle;
|
||||
self
|
||||
|
Reference in New Issue
Block a user