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.
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.
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
onts_project
to map to a macro which comes with visibility. Gazelle supportsdefault_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 asgo_visibility
. This is different in that it can overridego_x
targets regardless of what they are. https://github.com/bazelbuild/bazel-gazelle#directivesWe would like to propose something similar to that called
js_visibility
. The expectation is if we used the following syntaxWe 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.