Added umd switch

This commit is contained in:
Sharad Chand
2018-04-04 20:06:53 +05:45
parent 9723fdd69b
commit 3a83b02de0
2 changed files with 15 additions and 5 deletions

View File

@ -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,