aspect-build / rules_swc

Bazel rules for the swc toolchain https://swc.rs/
https://docs.aspect.build/rules/aspect_rules_swc
Apache License 2.0
41 stars 21 forks source link

[FR]: Support setting a default file extension #252

Open Aghassi opened 1 month ago

Aghassi commented 1 month ago

What is the current behavior?

Currently rules_swc defaults to js unless you have file types mts, mjs, cts, cjs. This means that you can't customize the file extension type out easily without doing a bunch of list comprehension. There are cases where you may not have individual files, so having the ability to just ask the rule to produce a different extension would be nice.

Describe the feature

Support passing something like


        default_ext = ".cjs",

to the swc_compile rule such that it renames all the files created on your behalf without the need for js_outs

We wrote a patch for this internally and would happily contrib it upstream if the maintainers are open to it.