github.com/stackb/rules_proto@v0.0.0-20240221195024-5428336c51f1/rules/ts/proto_ts_library.bzl (about)

     1  "proto_ts_library.bzl provides the proto_ts_library rule"
     2  
     3  load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
     4  
     5  def proto_ts_library(
     6          name,
     7          declaration = True,
     8          tsconfig = None,
     9          **kwargs):
    10      """Compiles a Typescript library from generated code.
    11  
    12      This is a thin wrapper around aspect_rules_ts's ts_project macro. Note that the Gazelle rule only supports customizing
    13      the args and tsconfig attributes.
    14  
    15      Additionally, it is necessary to pass
    16      ```
    17      deps = [
    18              "//:node_modules/long",
    19              "//:node_modules/protobufjs",
    20      ],
    21      ```
    22      meaning one must call npm_link_all_packages in the BUILD file at the *root* of the workspace (or figure out how to set rootDirs
    23      appropriately).
    24  
    25      See https://github.com/aspect-build/rules_ts/blob/007d1ab8f168879cad4ba6b741e8c6def20aa262/docs/rules.md#ts_project
    26      """
    27      ts_project(
    28          name = name,
    29          declaration = declaration,
    30          tsconfig = tsconfig or {
    31              "compilerOptions": {
    32                  "declaration": declaration,
    33                  "esModuleInterop": True,
    34              },
    35          },
    36          **kwargs
    37      )