From f91b5a7f96169c91bcaeec40954440122e8b7b2a Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Sat, 18 Feb 2023 23:34:45 -0800 Subject: [PATCH] Adds load visibility to `//packages/rules_prerender/...` Starlark code. Refs #67. This does not attempt to refactor to the new `defs.bzl` convention just yet. --- packages/declarative_shadow_dom/BUILD.bazel | 5 +---- packages/rules_prerender/css/css_binaries.bzl | 2 ++ packages/rules_prerender/css/css_group.bzl | 2 ++ packages/rules_prerender/css/css_library.bzl | 2 ++ packages/rules_prerender/css/css_providers.bzl | 2 ++ packages/rules_prerender/extract_single_resource.bzl | 2 ++ packages/rules_prerender/inject_resources.bzl | 2 ++ packages/rules_prerender/link_prerender_component.bzl | 2 ++ packages/rules_prerender/multi_inject_resources.bzl | 2 ++ packages/rules_prerender/prerender_component.bzl | 2 ++ .../rules_prerender/prerender_component_publish_files.bzl | 2 ++ .../prerender_component_publish_files_testdata/BUILD.bazel | 5 +---- packages/rules_prerender/prerender_pages.bzl | 2 ++ packages/rules_prerender/prerender_pages_unbundled.bzl | 2 ++ packages/rules_prerender/prerender_resources.bzl | 2 ++ packages/rules_prerender/script_entry_point.bzl | 2 ++ packages/rules_prerender/web_resources.bzl | 2 ++ packages/rules_prerender/web_resources_devserver.bzl | 2 ++ 18 files changed, 34 insertions(+), 8 deletions(-) diff --git a/packages/declarative_shadow_dom/BUILD.bazel b/packages/declarative_shadow_dom/BUILD.bazel index b111bc2d..758d0005 100644 --- a/packages/declarative_shadow_dom/BUILD.bazel +++ b/packages/declarative_shadow_dom/BUILD.bazel @@ -1,10 +1,7 @@ load("@aspect_rules_js//npm:defs.bzl", "npm_package") load( - "//packages/rules_prerender:prerender_component.bzl", + "//:index.bzl", "prerender_component", -) -load( - "//packages/rules_prerender:prerender_component_publish_files.bzl", "prerender_component_publish_files", ) load("//tools/jasmine:defs.bzl", "jasmine_node_test") diff --git a/packages/rules_prerender/css/css_binaries.bzl b/packages/rules_prerender/css/css_binaries.bzl index 5e46c13f..9400476d 100644 --- a/packages/rules_prerender/css/css_binaries.bzl +++ b/packages/rules_prerender/css/css_binaries.bzl @@ -4,6 +4,8 @@ load("//tools/binaries/css_bundler:css_bundle.bzl", "css_bundle") load(":css_group.bzl", "css_group") load(":css_providers.bzl", "CssInfo") +visibility(["//packages/rules_prerender/..."]) + def css_binaries( name, deps, diff --git a/packages/rules_prerender/css/css_group.bzl b/packages/rules_prerender/css/css_group.bzl index b4587e3e..d4f0673b 100644 --- a/packages/rules_prerender/css/css_group.bzl +++ b/packages/rules_prerender/css/css_group.bzl @@ -2,6 +2,8 @@ load(":css_providers.bzl", "CssImportMapInfo") +visibility(["//packages/rules_prerender/..."]) + def _css_group_impl(ctx): return [ DefaultInfo( diff --git a/packages/rules_prerender/css/css_library.bzl b/packages/rules_prerender/css/css_library.bzl index 12e952e1..117d4ea7 100644 --- a/packages/rules_prerender/css/css_library.bzl +++ b/packages/rules_prerender/css/css_library.bzl @@ -3,6 +3,8 @@ load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_files_to_bin_actions") load(":css_providers.bzl", "CssInfo") +visibility(["//", "//packages/rules_prerender/..."]) + def _css_library_impl(ctx): # Copy sources to bin so they are always available for downstream `js_binary()` # tools. diff --git a/packages/rules_prerender/css/css_providers.bzl b/packages/rules_prerender/css/css_providers.bzl index 61e2acd4..f4718c7b 100644 --- a/packages/rules_prerender/css/css_providers.bzl +++ b/packages/rules_prerender/css/css_providers.bzl @@ -1,3 +1,5 @@ +visibility(["//packages/rules_prerender/...", "//tools/binaries/css_bundler/..."]) + # Provider of information related to CSS compilation. CssInfo = provider(fields = { "direct_sources": "Direct sources of the target.", diff --git a/packages/rules_prerender/extract_single_resource.bzl b/packages/rules_prerender/extract_single_resource.bzl index c5109b25..abe0e193 100644 --- a/packages/rules_prerender/extract_single_resource.bzl +++ b/packages/rules_prerender/extract_single_resource.bzl @@ -1,5 +1,7 @@ """Defines `extract_single_resource()` functionality.""" +visibility(["//"]) + def extract_single_resource(name = None, resources = None, out = None): """Takes the single file in the given resources directory and copies it to `out`. diff --git a/packages/rules_prerender/inject_resources.bzl b/packages/rules_prerender/inject_resources.bzl index cf490877..2fb13cb2 100644 --- a/packages/rules_prerender/inject_resources.bzl +++ b/packages/rules_prerender/inject_resources.bzl @@ -4,6 +4,8 @@ load(":extract_single_resource.bzl", "extract_single_resource") load(":multi_inject_resources.bzl", "multi_inject_resources") load(":web_resources.bzl", "web_resources") +visibility(["//"]) + def inject_resources( name, input, diff --git a/packages/rules_prerender/link_prerender_component.bzl b/packages/rules_prerender/link_prerender_component.bzl index 367f4cc1..9cc29e67 100644 --- a/packages/rules_prerender/link_prerender_component.bzl +++ b/packages/rules_prerender/link_prerender_component.bzl @@ -2,6 +2,8 @@ load("@aspect_rules_js//js:providers.bzl", "JsInfo") load("//tools/typescript:defs.bzl", "ts_project") load("//packages/rules_prerender:web_resources.bzl", "WebResourceInfo") +visibility(["//"]) + def link_prerender_component(name, package, visibility = None, testonly = None): """Links a `prerender_component()` from a linked NPM package. diff --git a/packages/rules_prerender/multi_inject_resources.bzl b/packages/rules_prerender/multi_inject_resources.bzl index a5464d9c..718aba64 100644 --- a/packages/rules_prerender/multi_inject_resources.bzl +++ b/packages/rules_prerender/multi_inject_resources.bzl @@ -2,6 +2,8 @@ load(":web_resources.bzl", "WebResourceInfo") +visibility(["//"]) + def _multi_inject_resources_impl(ctx): # Generate configuration JSON from inputs. script_injections = [{"type": "script", "path": script} diff --git a/packages/rules_prerender/prerender_component.bzl b/packages/rules_prerender/prerender_component.bzl index 3c7f15bb..9d8e58e0 100644 --- a/packages/rules_prerender/prerender_component.bzl +++ b/packages/rules_prerender/prerender_component.bzl @@ -9,6 +9,8 @@ load("//packages/rules_prerender/css:css_binaries.bzl", "css_binaries") load("//packages/rules_prerender/css:css_group.bzl", "css_group") load(":web_resources.bzl", "web_resources") +visibility(["//"]) + def prerender_component( name, srcs, diff --git a/packages/rules_prerender/prerender_component_publish_files.bzl b/packages/rules_prerender/prerender_component_publish_files.bzl index 45e1f377..af5ee978 100644 --- a/packages/rules_prerender/prerender_component_publish_files.bzl +++ b/packages/rules_prerender/prerender_component_publish_files.bzl @@ -3,6 +3,8 @@ load("@aspect_rules_js//js:providers.bzl", "JsInfo", "js_info") load("//common:label.bzl", "absolute") +visibility(["//"]) + def prerender_component_publish_files( name, dep, diff --git a/packages/rules_prerender/prerender_component_publish_files_testdata/BUILD.bazel b/packages/rules_prerender/prerender_component_publish_files_testdata/BUILD.bazel index 8e689df3..e891a648 100644 --- a/packages/rules_prerender/prerender_component_publish_files_testdata/BUILD.bazel +++ b/packages/rules_prerender/prerender_component_publish_files_testdata/BUILD.bazel @@ -1,9 +1,6 @@ load( - "//packages/rules_prerender:prerender_component.bzl", + "//:index.bzl", "prerender_component", -) -load( - "//packages/rules_prerender:prerender_component_publish_files.bzl", "prerender_component_publish_files", ) load("//packages/rules_prerender:web_resources.bzl", "web_resources") diff --git a/packages/rules_prerender/prerender_pages.bzl b/packages/rules_prerender/prerender_pages.bzl index d4d395c0..5eab5300 100644 --- a/packages/rules_prerender/prerender_pages.bzl +++ b/packages/rules_prerender/prerender_pages.bzl @@ -6,6 +6,8 @@ load(":multi_inject_resources.bzl", "multi_inject_resources") load(":prerender_pages_unbundled.bzl", "prerender_pages_unbundled") load(":web_resources.bzl", "web_resources") +visibility(["//"]) + def prerender_pages( name, src, diff --git a/packages/rules_prerender/prerender_pages_unbundled.bzl b/packages/rules_prerender/prerender_pages_unbundled.bzl index 40546664..b904f35b 100644 --- a/packages/rules_prerender/prerender_pages_unbundled.bzl +++ b/packages/rules_prerender/prerender_pages_unbundled.bzl @@ -7,6 +7,8 @@ load(":prerender_resources.bzl", "prerender_resources_internal") load(":script_entry_point.bzl", "script_entry_point") load(":web_resources.bzl", "WebResourceInfo", "web_resources") +visibility(["//"]) + def prerender_pages_unbundled( name, src, diff --git a/packages/rules_prerender/prerender_resources.bzl b/packages/rules_prerender/prerender_resources.bzl index 6862c7f3..0733fd07 100644 --- a/packages/rules_prerender/prerender_resources.bzl +++ b/packages/rules_prerender/prerender_resources.bzl @@ -8,6 +8,8 @@ load("//packages/rules_prerender/css:css_providers.bzl", "CssImportMapInfo") load("//tools/binaries/renderer:build_vars.bzl", "RENDERER_RUNTIME_DEPS") load(":web_resources.bzl", "WebResourceInfo") +visibility(["//"]) + def prerender_resources( name, entry_point, diff --git a/packages/rules_prerender/script_entry_point.bzl b/packages/rules_prerender/script_entry_point.bzl index 66785845..62e6a4ef 100644 --- a/packages/rules_prerender/script_entry_point.bzl +++ b/packages/rules_prerender/script_entry_point.bzl @@ -3,6 +3,8 @@ load("@aspect_rules_js//js:defs.bzl", "js_run_binary") load("//common:label.bzl", "absolute", "file_path_of") +visibility(["//"]) + def script_entry_point( name, metadata, diff --git a/packages/rules_prerender/web_resources.bzl b/packages/rules_prerender/web_resources.bzl index eb25f9bb..ca670394 100644 --- a/packages/rules_prerender/web_resources.bzl +++ b/packages/rules_prerender/web_resources.bzl @@ -5,6 +5,8 @@ load("@aspect_bazel_lib//lib:paths.bzl", "to_output_relative_path") load("@bazel_skylib//lib:collections.bzl", "collections") load("//common:label.bzl", "absolute") +visibility(["//", "//packages/rules_prerender/..."]) + WebResourceInfo = provider( "Resources for web projects.", fields = ["transitive_entries"], diff --git a/packages/rules_prerender/web_resources_devserver.bzl b/packages/rules_prerender/web_resources_devserver.bzl index 24be38e3..9a39f322 100644 --- a/packages/rules_prerender/web_resources_devserver.bzl +++ b/packages/rules_prerender/web_resources_devserver.bzl @@ -4,6 +4,8 @@ load("@aspect_rules_js//js:defs.bzl", "js_run_devserver") load("@rules_prerender_npm//:http-server/package_json.bzl", http_server_bin = "bin") load("//common:label.bzl", "absolute", "file_path_of") +visibility(["//"]) + def web_resources_devserver( name, resources,