angular/adev/shared-docs/pipeline/api-gen/rendering/BUILD.bazel
Joey Perrott 3bdead1b2f refactor(docs-infra): migrate api-gen from dev-infra into the repo (#57241)
Move the api-gen pipeline into the shared-docs directory.

PR Close #57241
2024-08-05 17:06:29 +00:00

76 lines
1.9 KiB
Text

load("@npm//@angular/build-tooling/bazel:defaults.bzl", "ts_library")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", "esbuild_esm_bundle")
package(default_visibility = ["//adev/shared-docs/pipeline/api-gen:__subpackages__"])
esbuild_esm_bundle(
name = "bin",
entry_point = ":index.ts",
output = "bin.mjs",
platform = "node",
target = "es2022",
deps = [
":render_api_to_html_lib",
],
)
ts_library(
name = "render_api_to_html_lib",
srcs = glob(
[
"**/*.ts",
"**/*.tsx",
],
exclude = [
"entities.ts",
],
),
devmode_module = "commonjs",
tsconfig = "//adev:tsconfig.json",
deps = [
":entities",
"@npm//@bazel/runfiles",
"@npm//@types/node",
"@npm//html-entities",
"@npm//marked",
"@npm//preact",
"@npm//preact-render-to-string",
"@npm//shiki",
],
)
ts_library(
name = "entities",
srcs = [
"entities.ts",
],
tsconfig = "//adev:tsconfig.json",
visibility = [
"//adev/shared-docs/pipeline/api-gen/rendering:__pkg__",
"//docs/pipeline/guides:__pkg__",
],
)
# Action binary for the api_gen bazel rule.
nodejs_binary(
name = "render_api_to_html",
data = [
":render_api_to_html_lib",
],
entry_point = "bin.mjs",
# Do not use the NodeJS linker because:
# - it's brittle and causes race conditions on Windows.
# - it requires additional work to setup the runtime linker.
templated_args = [
"--bazel_patch_module_resolver",
"--node_options=--preserve-symlinks-main",
],
visibility = ["//visibility:public"],
)
# Expose the sources in the dev-infra NPM package.
filegroup(
name = "files",
srcs = glob(["**/*"]),
)