mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-27 03:55:20 +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| {
|
||||
me.expose_drop_ref();
|
||||
Ok("function(i) {
|
||||
dropRef(i);
|
||||
Ok("function(i) {
|
||||
dropRef(i);
|
||||
}".to_string())
|
||||
})?;
|
||||
|
||||
@ -149,8 +149,8 @@ impl<'a> Context<'a> {
|
||||
|
||||
self.bind("__wbindgen_number_new", &|me| {
|
||||
me.expose_add_heap_object();
|
||||
Ok(String::from("function(i) {
|
||||
return addHeapObject(i);
|
||||
Ok(String::from("function(i) {
|
||||
return addHeapObject(i);
|
||||
}"))
|
||||
})?;
|
||||
|
||||
@ -169,8 +169,8 @@ impl<'a> Context<'a> {
|
||||
|
||||
self.bind("__wbindgen_undefined_new", &|me| {
|
||||
me.expose_add_heap_object();
|
||||
Ok(String::from("function() {
|
||||
return addHeapObject(undefined);
|
||||
Ok(String::from("function() {
|
||||
return addHeapObject(undefined);
|
||||
}"))
|
||||
})?;
|
||||
|
||||
@ -365,7 +365,7 @@ impl<'a> Context<'a> {
|
||||
module_name));
|
||||
format!("var wasm;")
|
||||
} else {
|
||||
format!("import * as wasm from './{}_bg';", module_name)
|
||||
format!("import * as wasm from './{}_bg.wasm';", module_name)
|
||||
};
|
||||
|
||||
format!("\
|
||||
|
@ -403,11 +403,11 @@ fn indent_recurse(mut lines: ::std::str::Lines, current_indent: usize) -> String
|
||||
next_indent += 1;
|
||||
}
|
||||
if trimmed.starts_with('}') || trimmed.ends_with('}') {
|
||||
if current_indent > 0 {
|
||||
current_indent -= 1;
|
||||
if current_indent > 0 {
|
||||
current_indent -= 1;
|
||||
}
|
||||
if next_indent > 0 {
|
||||
next_indent -= 1;
|
||||
if next_indent > 0 {
|
||||
next_indent -= 1;
|
||||
}
|
||||
}
|
||||
if trimmed.starts_with('?') || trimmed.starts_with(':') {
|
||||
|
Loading…
Reference in New Issue
Block a user