mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-26 11:34:22 +03:00
Added umd switch
This commit is contained in:
parent
9723fdd69b
commit
3a83b02de0
@ -17,6 +17,7 @@ pub struct Bindgen {
|
||||
path: Option<PathBuf>,
|
||||
nodejs: bool,
|
||||
browser: bool,
|
||||
umd: bool,
|
||||
debug: bool,
|
||||
typescript: bool,
|
||||
}
|
||||
@ -36,6 +37,7 @@ impl Bindgen {
|
||||
path: None,
|
||||
nodejs: false,
|
||||
browser: false,
|
||||
umd: false,
|
||||
debug: false,
|
||||
typescript: false,
|
||||
}
|
||||
@ -56,6 +58,11 @@ impl Bindgen {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn umd(&mut self, umd: bool) -> &mut Bindgen {
|
||||
self.umd = umd;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn debug(&mut self, debug: bool) -> &mut Bindgen {
|
||||
self.debug = debug;
|
||||
self
|
||||
|
@ -22,6 +22,7 @@ Options:
|
||||
--out-dir DIR Output directory
|
||||
--nodejs Generate output that only works in node.js
|
||||
--browser Generate output that only works in a browser
|
||||
--umd Generate output that works both in browser and node.js
|
||||
--typescript Output a TypeScript definition file
|
||||
--debug Include otherwise-extraneous debug checks in output
|
||||
-V --version Print the version number of wasm-bindgen
|
||||
@ -31,6 +32,7 @@ Options:
|
||||
struct Args {
|
||||
flag_nodejs: bool,
|
||||
flag_browser: bool,
|
||||
flag_umd: bool,
|
||||
flag_typescript: bool,
|
||||
flag_out_dir: Option<PathBuf>,
|
||||
flag_debug: bool,
|
||||
@ -45,7 +47,7 @@ fn main() {
|
||||
|
||||
if args.flag_version {
|
||||
println!("wasm-bindgen {}", wasm_bindgen_shared::version());
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
let input = match args.arg_input {
|
||||
@ -55,10 +57,11 @@ fn main() {
|
||||
|
||||
let mut b = Bindgen::new();
|
||||
b.input_path(&input)
|
||||
.nodejs(args.flag_nodejs)
|
||||
.browser(args.flag_browser)
|
||||
.debug(args.flag_debug)
|
||||
.typescript(args.flag_typescript);
|
||||
.nodejs(args.flag_nodejs)
|
||||
.browser(args.flag_browser)
|
||||
.umd(args.flag_umd)
|
||||
.debug(args.flag_debug)
|
||||
.typescript(args.flag_typescript);
|
||||
|
||||
let out_dir = match args.flag_out_dir {
|
||||
Some(ref p) => p,
|
||||
|
Loading…
Reference in New Issue
Block a user