mirror of https://github.com/bazelbuild/rules_rust
Respect "--no-typescript" flag in wasm_bindgen (#2765)
Don't expect typescript outputs if this flag is set. --------- Co-authored-by: Daniel Wagner-Hall <dawagner@gmail.com>
This commit is contained in:
parent
f0276ea585
commit
b5ecaea4b5
|
@ -58,6 +58,15 @@ js_rust_wasm_bindgen(
|
|||
wasm_file = ":hello_world_lib_wasm",
|
||||
)
|
||||
|
||||
js_rust_wasm_bindgen(
|
||||
name = "hello_world_nodejs_no_typescript_wasm_bindgen",
|
||||
bindgen_flags = [
|
||||
"--no-typescript",
|
||||
],
|
||||
target = "nodejs",
|
||||
wasm_file = ":hello_world_lib_wasm",
|
||||
)
|
||||
|
||||
_WASM_DATA = [
|
||||
":hello_world_bundler_wasm_bindgen",
|
||||
":hello_world_deno_wasm_bindgen",
|
||||
|
|
|
@ -53,11 +53,14 @@ def rust_wasm_bindgen_action(ctx, toolchain, wasm_file, target_output, bindgen_f
|
|||
bindgen_wasm_module = ctx.actions.declare_file(ctx.label.name + "_bg.wasm")
|
||||
|
||||
js_out = [ctx.actions.declare_file(ctx.label.name + ".js")]
|
||||
ts_out = [ctx.actions.declare_file(ctx.label.name + ".d.ts")]
|
||||
ts_out = []
|
||||
if not "--no-typescript" in bindgen_flags:
|
||||
ts_out.append(ctx.actions.declare_file(ctx.label.name + ".d.ts"))
|
||||
|
||||
if target_output == "bundler":
|
||||
js_out.append(ctx.actions.declare_file(ctx.label.name + "_bg.js"))
|
||||
ts_out.append(ctx.actions.declare_file(ctx.label.name + "_bg.wasm.d.ts"))
|
||||
if not "--no-typescript" in bindgen_flags:
|
||||
ts_out.append(ctx.actions.declare_file(ctx.label.name + "_bg.wasm.d.ts"))
|
||||
|
||||
outputs = [bindgen_wasm_module] + js_out + ts_out
|
||||
|
||||
|
|
Loading…
Reference in New Issue