Skip to content

Commit

Permalink
rename swc_rule to swc_transpiler
Browse files Browse the repository at this point in the history
This is more obvious as an argument to ts_project#transpiler
  • Loading branch information
alexeagle committed Jan 8, 2022
1 parent 76567bf commit 08b3374
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions docs/swc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ swc(name = "transpile")
```


<a id="#swc_rule"></a>
<a id="#swc_transpiler"></a>

## swc_rule
## swc_transpiler

<pre>
swc_rule(<a href="#swc_rule-name">name</a>, <a href="#swc_rule-args">args</a>, <a href="#swc_rule-data">data</a>, <a href="#swc_rule-js_outs">js_outs</a>, <a href="#swc_rule-map_outs">map_outs</a>, <a href="#swc_rule-output_dir">output_dir</a>, <a href="#swc_rule-srcs">srcs</a>, <a href="#swc_rule-swc_cli">swc_cli</a>, <a href="#swc_rule-swcrc">swcrc</a>)
swc_transpiler(<a href="#swc_transpiler-name">name</a>, <a href="#swc_transpiler-args">args</a>, <a href="#swc_transpiler-data">data</a>, <a href="#swc_transpiler-js_outs">js_outs</a>, <a href="#swc_transpiler-map_outs">map_outs</a>, <a href="#swc_transpiler-output_dir">output_dir</a>, <a href="#swc_transpiler-srcs">srcs</a>, <a href="#swc_transpiler-swc_cli">swc_cli</a>, <a href="#swc_transpiler-swcrc">swcrc</a>)
</pre>

Underlying rule for the `swc` macro.
Expand All @@ -31,15 +31,15 @@ for example to set your own output labels for `js_outs`.

| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="swc_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="swc_rule-args"></a>args | additional arguments to pass to swc cli, see https://swc.rs/docs/usage/cli | List of strings | optional | [] |
| <a id="swc_rule-data"></a>data | runtime dependencies propagated to binaries that depend on this | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="swc_rule-js_outs"></a>js_outs | list of expected JavaScript output files.<br><br>There must be one for each entry in srcs, and in the same order. | List of labels | optional | |
| <a id="swc_rule-map_outs"></a>map_outs | list of expected source map output files.<br><br>Can be empty, meaning no source maps should be produced. If non-empty, there must be one for each entry in srcs, and in the same order. | List of labels | optional | |
| <a id="swc_rule-output_dir"></a>output_dir | whether to produce a directory output rather than individual files | Boolean | optional | False |
| <a id="swc_rule-srcs"></a>srcs | source files, typically .ts files in the source tree | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
| <a id="swc_rule-swc_cli"></a>swc_cli | binary that executes the swc CLI | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | @aspect_rules_swc//swc:cli |
| <a id="swc_rule-swcrc"></a>swcrc | label of a configuration file for swc, see https://swc.rs/docs/configuration/swcrc | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| <a id="swc_transpiler-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="swc_transpiler-args"></a>args | additional arguments to pass to swc cli, see https://swc.rs/docs/usage/cli | List of strings | optional | [] |
| <a id="swc_transpiler-data"></a>data | runtime dependencies propagated to binaries that depend on this | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="swc_transpiler-js_outs"></a>js_outs | list of expected JavaScript output files.<br><br>There must be one for each entry in srcs, and in the same order. | List of labels | optional | |
| <a id="swc_transpiler-map_outs"></a>map_outs | list of expected source map output files.<br><br>Can be empty, meaning no source maps should be produced. If non-empty, there must be one for each entry in srcs, and in the same order. | List of labels | optional | |
| <a id="swc_transpiler-output_dir"></a>output_dir | whether to produce a directory output rather than individual files | Boolean | optional | False |
| <a id="swc_transpiler-srcs"></a>srcs | source files, typically .ts files in the source tree | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
| <a id="swc_transpiler-swc_cli"></a>swc_cli | binary that executes the swc CLI | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | @aspect_rules_swc//swc:cli |
| <a id="swc_transpiler-swcrc"></a>swcrc | label of a configuration file for swc, see https://swc.rs/docs/configuration/swcrc | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |


<a id="#swc"></a>
Expand Down
4 changes: 2 additions & 2 deletions examples/custom_outs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
load("@aspect_rules_swc//swc:swc.bzl", swc = "swc_rule")
load("@aspect_rules_swc//swc:swc.bzl", "swc_transpiler")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")

[
swc(
swc_transpiler(
name = "transpile_" + format,
srcs = ["in.ts"],
args = [
Expand Down
4 changes: 2 additions & 2 deletions swc/swc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ swc(name = "transpile")
load("//swc/private:swc.bzl", _swc_lib = "swc")
load("@bazel_skylib//lib:paths.bzl", "paths")

swc_rule = rule(
swc_transpiler = rule(
doc = """Underlying rule for the `swc` macro.
Most users should just use [swc](#swc) instead.
Expand Down Expand Up @@ -79,7 +79,7 @@ def swc(name, srcs = None, args = [], data = [], output_dir = False, swcrc = Non
if source_map_outputs:
map_outs.append(paths.replace_extension(f, ".js.map"))

swc_rule(
swc_transpiler(
name = name,
srcs = srcs,
js_outs = js_outs,
Expand Down

0 comments on commit 08b3374

Please sign in to comment.