mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-27 20:15:14 +03:00
Make JS use a '.wasm' extension when importing the binary
This commit is contained in:
parent
7936e1eb27
commit
a596dc4129
@ -132,8 +132,8 @@ impl<'a> Context<'a> {
|
|||||||
|
|
||||||
self.bind("__wbindgen_object_drop_ref", &|me| {
|
self.bind("__wbindgen_object_drop_ref", &|me| {
|
||||||
me.expose_drop_ref();
|
me.expose_drop_ref();
|
||||||
Ok("function(i) {
|
Ok("function(i) {
|
||||||
dropRef(i);
|
dropRef(i);
|
||||||
}".to_string())
|
}".to_string())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -149,8 +149,8 @@ impl<'a> Context<'a> {
|
|||||||
|
|
||||||
self.bind("__wbindgen_number_new", &|me| {
|
self.bind("__wbindgen_number_new", &|me| {
|
||||||
me.expose_add_heap_object();
|
me.expose_add_heap_object();
|
||||||
Ok(String::from("function(i) {
|
Ok(String::from("function(i) {
|
||||||
return addHeapObject(i);
|
return addHeapObject(i);
|
||||||
}"))
|
}"))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -169,8 +169,8 @@ impl<'a> Context<'a> {
|
|||||||
|
|
||||||
self.bind("__wbindgen_undefined_new", &|me| {
|
self.bind("__wbindgen_undefined_new", &|me| {
|
||||||
me.expose_add_heap_object();
|
me.expose_add_heap_object();
|
||||||
Ok(String::from("function() {
|
Ok(String::from("function() {
|
||||||
return addHeapObject(undefined);
|
return addHeapObject(undefined);
|
||||||
}"))
|
}"))
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ impl<'a> Context<'a> {
|
|||||||
module_name));
|
module_name));
|
||||||
format!("var wasm;")
|
format!("var wasm;")
|
||||||
} else {
|
} else {
|
||||||
format!("import * as wasm from './{}_bg';", module_name)
|
format!("import * as wasm from './{}_bg.wasm';", module_name)
|
||||||
};
|
};
|
||||||
|
|
||||||
format!("\
|
format!("\
|
||||||
|
@ -403,11 +403,11 @@ fn indent_recurse(mut lines: ::std::str::Lines, current_indent: usize) -> String
|
|||||||
next_indent += 1;
|
next_indent += 1;
|
||||||
}
|
}
|
||||||
if trimmed.starts_with('}') || trimmed.ends_with('}') {
|
if trimmed.starts_with('}') || trimmed.ends_with('}') {
|
||||||
if current_indent > 0 {
|
if current_indent > 0 {
|
||||||
current_indent -= 1;
|
current_indent -= 1;
|
||||||
}
|
}
|
||||||
if next_indent > 0 {
|
if next_indent > 0 {
|
||||||
next_indent -= 1;
|
next_indent -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if trimmed.starts_with('?') || trimmed.starts_with(':') {
|
if trimmed.starts_with('?') || trimmed.starts_with(':') {
|
||||||
|
Loading…
Reference in New Issue
Block a user