-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.bazel
122 lines (107 loc) · 4.01 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package", "npm_package")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@rules_prerender_npm//:defs.bzl", "npm_link_all_packages")
load("//:index.bzl", "link_prerender_component")
load("//tools/publish:defs.bzl", "npm_publish")
load("//tools/stamping:defs.bzl", "stamp_package")
exports_files(
[".npmrc"],
visibility = ["//:__subpackages__"],
)
ts_config(
name = "tsconfig",
src = "tsconfig.json",
visibility = ["//:__subpackages__"],
)
ts_config(
name = "tsconfig_client",
src = "tsconfig.client.json",
visibility = ["//:__subpackages__"],
deps = [":tsconfig"],
)
npm_link_all_packages(name = "node_modules")
# Makes an internal NPM package for `rules_prerender` and links it.
stamp_package(
name = "package",
# So internal `ts_project` targets can depend on `type: "module"`.
visibility = ["//:__subpackages__"],
)
npm_package(
name = "rules_prerender_pkg",
srcs = [
"README.md",
":package",
"//packages/rules_prerender:rules_prerender_lib",
],
# TODO(#59): Remove when upstream is fixed.
# See: https://github.com/dgp1130/rules_prerender/issues/48#issuecomment-1425257276
include_external_repositories = ["rules_prerender"],
package = "rules_prerender",
visibility = ["//visibility:public"],
)
npm_publish(
name = "rules_prerender_pkg_publish",
npmrc = ".npmrc",
package = ":rules_prerender_pkg",
)
npm_link_package(
name = "node_modules/rules_prerender",
src = ":rules_prerender_pkg",
visibility = ["//:__subpackages__"],
)
npm_link_package(
name = "node_modules/@rules_prerender/declarative_shadow_dom",
src = "//packages/declarative_shadow_dom:pkg",
# Should use `//:prerender_components/@rules_prerender/declarative_shadow_dom`.
visibility = ["//visibility:private"],
)
link_prerender_component(
name = "prerender_components/@rules_prerender/declarative_shadow_dom",
package = ":node_modules/@rules_prerender/declarative_shadow_dom",
visibility = ["//:__subpackages__"],
)
npm_link_package(
name = "node_modules/@rules_prerender/preact",
src = "//packages/preact:pkg",
visibility = ["//:__subpackages__"],
# `@rules_prerender/preact` has an NPM peer dep on `rules_prerender`. We
# need to supply this at link-time rather than when the `npm_package()` is
# built so different links can specify different `rules_prerender` packages.
#
# For example, `@rules_prerender//:node_modules/@rules_prerender/preact`
# needs a dependency on `@rules_prerender//:node_modules/rules_prerender`,
# but an external workspace linking the same `npm_package()` would need its
# `@external_wksp//:node_modules/@rules_prerender/preact` to depend on
# `@external_wksp//:node_modules/rules_prerender`.
#
# If we didn't do this and allowed `//packages/preact:pkg` to directly
# depend on `//:node_modules/rules_prerender`, it would duplicate the
# `rules_prerender` package at runtime.
# See: https://bazelbuild.slack.com/archives/CEZUUKQ6P/p1678741591216319
deps = {
"//:.aspect_rules_js/node_modules/rules_prerender": "rules_prerender",
},
)
bzl_library(
name = "rules_prerender",
srcs = [
"dependencies.bzl",
"index.bzl",
"npm_repositories.bzl",
"repositories.bzl",
],
visibility = ["//visibility:public"],
deps = [
"//packages/rules_prerender:extract_single_resource",
"//packages/rules_prerender:inject_resources",
# "//packages/rules_prerender:prerender_component",
# "//packages/rules_prerender:prerender_pages",
# "//packages/rules_prerender:prerender_pages_unbundled",
"//packages/rules_prerender:prerender_resources",
"//packages/rules_prerender:web_resources",
"//packages/rules_prerender:web_resources_devserver",
"//packages/rules_prerender/css:css_group",
"//packages/rules_prerender/css:css_library",
],
)