mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-16 02:00:51 +00:00
Emit *.d.ts
file by default
This commit is contained in:
parent
acb5eac96a
commit
89bd10f974
@ -550,9 +550,8 @@ some notable options are:
|
||||
`window.wasm_bindgen.foo`. Note that the name `wasm_bindgen` can be configured
|
||||
with the `--no-modules-global FOO` flag.
|
||||
|
||||
* `--typescript` - when passed a `*.d.ts` file will be generated for the
|
||||
generated JS file. This should allow hooking into TypeScript projects to
|
||||
ensure everything still typechecks.
|
||||
* `--no-typescript` - by default a `*.d.ts` file is generated for the generated
|
||||
JS file, but this flag will disable generating this TypeScript file.
|
||||
|
||||
* `--debug` - generates a bit more JS and wasm in "debug mode" to help catch
|
||||
programmer errors, but this output isn't intended to be shipped to production
|
||||
|
@ -28,7 +28,8 @@ Options:
|
||||
--browser Generate output that only works in a browser
|
||||
--no-modules Generate output that only works in a browser (without modules)
|
||||
--no-modules-global VAR Name of the global variable to initialize
|
||||
--typescript Output a TypeScript definition file
|
||||
--typescript Output a TypeScript definition file (on by default)
|
||||
--no-typescript Don't emit a *.d.ts file
|
||||
--debug Include otherwise-extraneous debug checks in output
|
||||
--no-demangle Don't demangle Rust symbol names
|
||||
-V --version Print the version number of wasm-bindgen
|
||||
@ -40,6 +41,7 @@ struct Args {
|
||||
flag_browser: bool,
|
||||
flag_no_modules: bool,
|
||||
flag_typescript: bool,
|
||||
flag_no_typescript: bool,
|
||||
flag_out_dir: Option<PathBuf>,
|
||||
flag_debug: bool,
|
||||
flag_version: bool,
|
||||
@ -74,6 +76,8 @@ fn rmain(args: &Args) -> Result<(), Error> {
|
||||
None => bail!("input file expected"),
|
||||
};
|
||||
|
||||
let typescript = args.flag_typescript || !args.flag_no_typescript;
|
||||
|
||||
let mut b = Bindgen::new();
|
||||
b.input_path(input)
|
||||
.nodejs(args.flag_nodejs)
|
||||
@ -81,7 +85,7 @@ fn rmain(args: &Args) -> Result<(), Error> {
|
||||
.no_modules(args.flag_no_modules)
|
||||
.debug(args.flag_debug)
|
||||
.demangle(!args.flag_no_demangle)
|
||||
.typescript(args.flag_typescript);
|
||||
.typescript(typescript);
|
||||
if let Some(ref name) = args.flag_no_modules_global {
|
||||
b.no_modules_global(name);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user