Skip to content

Commit

Permalink
Adds load visibility to //packages/rules_prerender/... Starlark code.
Browse files Browse the repository at this point in the history
Refs #67.

This does not attempt to refactor to the new `defs.bzl` convention just yet.
  • Loading branch information
dgp1130 committed Feb 19, 2023
1 parent 71876c4 commit f91b5a7
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 8 deletions.
5 changes: 1 addition & 4 deletions packages/declarative_shadow_dom/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/css/css_binaries.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/css/css_group.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

load(":css_providers.bzl", "CssImportMapInfo")

visibility(["//packages/rules_prerender/..."])

def _css_group_impl(ctx):
return [
DefaultInfo(
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/css/css_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/css/css_providers.bzl
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/extract_single_resource.bzl
Original file line number Diff line number Diff line change
@@ -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`.
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/inject_resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/link_prerender_component.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/multi_inject_resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/prerender_component.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/prerender_pages.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/prerender_pages_unbundled.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/prerender_resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/script_entry_point.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/web_resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
2 changes: 2 additions & 0 deletions packages/rules_prerender/web_resources_devserver.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f91b5a7

Please sign in to comment.