load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@npm//@angular/build-tooling/bazel/esbuild:index.bzl", "esbuild_esm_bundle") load("//tools:defaults2.bzl", "ts_project") package(default_visibility = ["//adev/shared-docs/pipeline/api-gen:__subpackages__"]) esbuild_esm_bundle( name = "bin", entry_point = ":index.mts", output = "bin.mjs", platform = "node", target = "es2022", deps = [ ":render_api_to_html_lib", ], ) ts_project( name = "render_api_to_html_lib", srcs = glob( [ "**/*.mts", "**/*.tsx", "shiki.d.ts", ], exclude = [ "entities.mts", ], ), tsconfig = "//adev/shared-docs:tsconfig_build", deps = [ ":entities_rjs", "//:node_modules/@bazel/runfiles", "//:node_modules/@types/node", "//:node_modules/html-entities", "//:node_modules/marked", "//:node_modules/preact", "//:node_modules/preact-render-to-string", "//:node_modules/shiki", ], ) ts_project( name = "entities", srcs = [ "entities.mts", ], tsconfig = "//adev/shared-docs:tsconfig_build", 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(["**/*"]), )