From 9daea9ef544f3a251eae66e6a854dc5fd4b586d0 Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Fri, 21 Jul 2023 21:37:40 -0700 Subject: [PATCH] Updates `link_prerender_component` to be compatible with `prerender_component` rewrite. This generates a component metadata along with aliases linked to it. Works with both the old and new `prerender_component` implementations. --- .../link_prerender_component.bzl | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/rules_prerender/link_prerender_component.bzl b/packages/rules_prerender/link_prerender_component.bzl index a97be5c9..d75c1ee1 100644 --- a/packages/rules_prerender/link_prerender_component.bzl +++ b/packages/rules_prerender/link_prerender_component.bzl @@ -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(["//"]) @@ -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, )