mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-27 06:32:17 +00:00
Tweak typescript option
This commit is contained in:
parent
1487288050
commit
235bc2957e
@ -20,14 +20,14 @@ Usage:
|
|||||||
Options:
|
Options:
|
||||||
-h --help Show this screen.
|
-h --help Show this screen.
|
||||||
-o --output FILE File to place output in
|
-o --output FILE File to place output in
|
||||||
--output-ts FILE File to place a typescript definition of the module to
|
--typescript Output a `*.d.ts` file next to the JS output
|
||||||
--base64 Inline the wasm module using base64 encoding
|
--base64 Inline the wasm module using base64 encoding
|
||||||
";
|
";
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct Args {
|
struct Args {
|
||||||
flag_output: Option<PathBuf>,
|
flag_output: Option<PathBuf>,
|
||||||
flag_output_ts: Option<PathBuf>,
|
flag_typescript: bool,
|
||||||
flag_base64: bool,
|
flag_base64: bool,
|
||||||
arg_input: PathBuf,
|
arg_input: PathBuf,
|
||||||
}
|
}
|
||||||
@ -50,9 +50,12 @@ fn main() {
|
|||||||
.generate(&wasm)
|
.generate(&wasm)
|
||||||
.expect("failed to parse wasm");
|
.expect("failed to parse wasm");
|
||||||
|
|
||||||
if let Some(ref p) = args.flag_output_ts {
|
if args.flag_typescript {
|
||||||
File::create(p).expect("failed to create output")
|
if let Some(ref p) = args.flag_output {
|
||||||
.write_all(object.typescript().as_bytes()).expect("failed to write output");
|
let dst = p.with_extension("d.ts");
|
||||||
|
File::create(dst).expect("failed to create output")
|
||||||
|
.write_all(object.typescript().as_bytes()).expect("failed to write output");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let js = object.js();
|
let js = object.js();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user