aspect-build / aspect-cli

correct, fast, usable: choose three
https://aspect.build/cli
Apache License 2.0
93 stars 22 forks source link

[FR]: add support for `js_visibility` directive, which is similar to `go_visibility` #732

Closed Aghassi closed 3 months ago

Aghassi commented 3 months ago

What is the current behavior?

Currently there is no way to selectively generate a visibility overwrite in a nested package given the default gazelle directives. In our case, we use map_kind on ts_project to map to a macro which comes with visibility. Gazelle supports default_visibility today, but that will not touch rules or targets that already have a visibility set. Therefore, we have to do this by hand instead of having gazelle do it for us.

Describe the feature

gazelle supports a feature upstream known as go_visibility. This is different in that it can override go_x targets regardless of what they are. https://github.com/bazelbuild/bazel-gazelle#directives

We would like to propose something similar to that called js_visibility. The expectation is if we used the following syntax

# gazelle:js_visibility [target] visibility

We would be able to manage default visibility in a package as well as in all the subpackages. The use case for this in our case is where we want a design system to have different visibility internally than we do outside the design system folder.

This discussion is a paraphrase of what @etlovett and @jbedard spoke about with me in slack.