Skip to content

Commit

Permalink
Updates link_prerender_component to be compatible with `prerender_c…
Browse files Browse the repository at this point in the history
…omponent` rewrite.

This generates a component metadata along with aliases linked to it. Works with both the old and new `prerender_component` implementations.
  • Loading branch information
dgp1130 committed Jul 22, 2023
1 parent 0ba49cf commit 56a3713
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/rules_prerender/link_prerender_component.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
load("@aspect_rules_js//js:providers.bzl", "JsInfo")
load("//packages/rules_prerender/css:css_group.bzl", "css_group")
load("//tools/typescript:defs.bzl", "ts_project")
load("//packages/rules_prerender:web_resources.bzl", "WebResourceInfo")
load(":prerender_metadata.bzl", "alias_with_metadata", "prerender_metadata")
load(":web_resources.bzl", "WebResourceInfo")

visibility(["//"])

Expand Down Expand Up @@ -37,23 +38,29 @@ def link_prerender_component(name, package, visibility = None, testonly = None):
visibility: See https://bazel.build/reference/be/common-definitions
testonly: See https://bazel.build/reference/be/common-definitions
"""
native.alias(
name = "%s_prerender" % name,
actual = package,
metadata = "%s_metadata" % name
prerender_metadata(
name = metadata,
prerender = package,
scripts = package,
styles = None,
resources = None,
visibility = visibility,
testonly = testonly,
)

native.alias(
name = "%s_prerender_for_test" % name,
alias_with_metadata(
name = "%s_prerender" % name,
actual = package,
metadata = metadata,
visibility = visibility,
testonly = testonly,
)

native.alias(
alias_with_metadata(
name = "%s_scripts" % name,
actual = package,
metadata = metadata,
visibility = visibility,
testonly = testonly,
)
Expand Down

0 comments on commit 56a3713

Please sign in to comment.