diff --git a/docs/api/build_defs.html b/docs/api/build_defs.html index 10a4fb90..4d0f181e 100644 --- a/docs/api/build_defs.html +++ b/docs/api/build_defs.html @@ -68,7 +68,7 @@
ts_library(name, srcs, compiler, internal_testing_type_check_dependencies, node_modules, supports_workers, tsconfig, tsickle_typed)+
ts_library(name, deps, srcs, compiler, internal_testing_type_check_dependencies, node_modules, supports_workers, tsconfig, tsickle_typed)
ts_library
type-checks and compiles a set of TypeScript sources to JavaScript.
It produces declarations files (.d.ts
) which are used for compiling downstream
@@ -218,6 +218,13 @@
A unique name for this rule.
+deps
List of labels; Optional; Default is []
srcs
compiler
Label; Optional; Default is //internal:tsc_wrapped_bin
Intended for internal use only. - Sets a different TypeScript compiler binary to use for this library. +
Label; Optional; Default is @build_bazel_rules_typescript//:@bazel/typescript/tsc_wrapped
Sets a different TypeScript compiler binary to use for this library.
For example, we use the vanilla TypeScript tsc.js for bootstrapping,
and Angular compilations can replace this with ngc
.
The default ts_library compiler depends on the `@npm//:@bazel/typescript`
+ target which is setup for projects that use bazel managed npm deps that
+ fetch the @bazel/typescript npm package. It is recommended that you use
+ the workspace name `@npm` for bazel managed deps so the default
+ compiler works out of the box. Otherwise, you'll have to override
+ the compiler attribute manually.
+
node_modules
Label; Optional; Default is @//:node_modules
Label; Optional; Default is @npm//:typescript__typings
The npm packages which should be available during the compile.
+ The default value is `@npm//:typescript__typings` is setup
+ for projects that use bazel managed npm deps that. It is recommended
+ that you use the workspace name `@npm` for bazel managed deps so the
+ default node_modules works out of the box. Otherwise, you'll have to
+ override the node_modules attribute manually. This default is in place
+ since ts_library will always depend on at least the typescript
+ default libs which are provided by `@npm//:typescript__typings`.
+
+ This attribute is DEPRECATED. As of version 0.18.0 the recommended
+ approach to npm dependencies is to use fine grained npm dependencies
+ which are setup with the `yarn_install` or `npm_install` rules.
+
+ For example, in targets that used a `//:node_modules` filegroup,
+
+ ```
+ ts_library(
+ name = "my_lib",
+ ...
+ node_modules = "//:node_modules",
+ )
+ ```
+
+ which specifies all files within the `//:node_modules` filegroup
+ to be inputs to the `my_lib`. Using fine grained npm dependencies,
+ `my_lib` is defined with only the npm dependencies that are
+ needed:
+
+ ```
+ ts_library(
+ name = "my_lib",
+ ...
+ deps = [
+ "@npm//:@types/foo",
+ "@npm//:@types/bar",
+ "@npm//:foo",
+ "@npm//:bar",
+ ...
+ ],
+ )
+ ```
+
+ In this case, only the listed npm packages and their
+ transitive deps are includes as inputs to the `my_lib` target
+ which reduces the time required to setup the runfiles for this
+ target (see https://github.com/bazelbuild/bazel/issues/5153).
+ The default typescript libs are also available via the node_modules
+ default in this case.
+
+ The @npm external repository and the fine grained npm package
+ targets are setup using the `yarn_install` or `npm_install` rule
+ in your WORKSPACE file:
+
+ yarn_install(
+ name = "npm",
+ package_json = "//:package.json",
+ yarn_lock = "//:yarn.lock",
+ )
+