mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-28 07:51:07 +00:00
Fix the webidl-tests crate
This commit is contained in:
parent
5de3189411
commit
20f1e503d3
@ -3,6 +3,7 @@ use crate::descriptor::{Descriptor, VectorKind};
|
|||||||
use crate::{Bindgen, EncodeInto, OutputMode};
|
use crate::{Bindgen, EncodeInto, OutputMode};
|
||||||
use failure::{bail, Error, ResultExt};
|
use failure::{bail, Error, ResultExt};
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
use std::env;
|
||||||
use walrus::{MemoryId, Module};
|
use walrus::{MemoryId, Module};
|
||||||
use wasm_bindgen_wasm_interpreter::Interpreter;
|
use wasm_bindgen_wasm_interpreter::Interpreter;
|
||||||
|
|
||||||
@ -2797,11 +2798,14 @@ impl<'a, 'b> SubContext<'a, 'b> {
|
|||||||
// module syntax in the snippet to a CommonJS module, which is in theory
|
// module syntax in the snippet to a CommonJS module, which is in theory
|
||||||
// not that hard but is a chunk of work to do.
|
// not that hard but is a chunk of work to do.
|
||||||
if is_local_snippet && self.cx.config.mode.nodejs() {
|
if is_local_snippet && self.cx.config.mode.nodejs() {
|
||||||
bail!(
|
// have a small unergonomic escape hatch for our webidl-tests tests
|
||||||
"local JS snippets are not supported with `--nodejs`; \
|
if env::var("WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE").is_err() {
|
||||||
see rustwasm/rfcs#6 for more details, but this restriction \
|
bail!(
|
||||||
will be lifted in the future"
|
"local JS snippets are not supported with `--nodejs`; \
|
||||||
);
|
see rustwasm/rfcs#6 for more details, but this restriction \
|
||||||
|
will be lifted in the future"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Similar to `--no-modules`, only allow vendor prefixes basically for web
|
// Similar to `--no-modules`, only allow vendor prefixes basically for web
|
||||||
|
@ -21,14 +21,13 @@ fn main() {
|
|||||||
|
|
||||||
let out_file = out_dir.join(path.file_name().unwrap()).with_extension("rs");
|
let out_file = out_dir.join(path.file_name().unwrap()).with_extension("rs");
|
||||||
|
|
||||||
let js_file = path.with_extension("js").canonicalize().unwrap();
|
|
||||||
generated_rust.push_str(&format!(
|
generated_rust.push_str(&format!(
|
||||||
r#"
|
r#"
|
||||||
pub mod import_script {{
|
pub mod import_script {{
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use wasm_bindgen_test::*;
|
use wasm_bindgen_test::*;
|
||||||
|
|
||||||
#[wasm_bindgen(module = r"{}")]
|
#[wasm_bindgen(module = "/{}.js")]
|
||||||
extern "C" {{
|
extern "C" {{
|
||||||
fn not_actually_a_function{1}(x: &str);
|
fn not_actually_a_function{1}(x: &str);
|
||||||
}}
|
}}
|
||||||
@ -41,7 +40,7 @@ fn main() {
|
|||||||
}}
|
}}
|
||||||
}}
|
}}
|
||||||
"#,
|
"#,
|
||||||
js_file.display(),
|
path.file_stem().unwrap().to_str().unwrap(),
|
||||||
i
|
i
|
||||||
));
|
));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user