Make JS use a '.wasm' extension when importing the binary

This commit is contained in:
Jamen Marz 2018-06-25 12:57:02 -06:00
parent 7936e1eb27
commit a596dc4129
No known key found for this signature in database
GPG Key ID: 88CEF5A09D29321F
2 changed files with 11 additions and 11 deletions

View File

@ -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!("\

View File

@ -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(':') {