js_library
is similar to filegroup
; there are no Bazel actions to run.
It only groups JS files together, and propagates their dependencies, along with a DeclarationInfo so that it can be a dep of ts_project.
For example, this BUILD
file groups a pair of .js/.d.ts
files along with the package.json
.
The latter is needed because it contains a typings
key that allows downstream
users of this library to resolve the one.d.ts
file.
The main
key is another commonly used field in package.json
which would require including it in the library.
load("@aspect_rules_js//js:defs.bzl", "js_library")
js_library(
name = "one",
srcs = [
"one.d.ts",
"one.js",
"package.json",
],
)
Rules
js_library
Copies all sources to the output tree and expose some files with DeclarationInfo.
Can be used as a dep for rules that expect a DeclarationInfo such as ts_project.
Example usage (generated)
load("@aspect_rules_js//js:defs.bzl", "js_library")
js_library(
# A unique name for this target.
name = "",
)
name
A unique name for this target.
deps
srcs
Macros and Functions
js_library_lib.implementation
Example usage (generated)
load("@aspect_rules_js//js:defs.bzl", "js_library_lib")
js_library_lib.implementation(
ctx = None,
)