diff --git a/BUILD.bazel b/BUILD.bazel
index 7ae96ef28f..d1da4f59d9 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -65,7 +65,7 @@ diff_test(
)
# Example of manually linking a first-party dependency. Its transitive npm dependencies
-# are picked up automatically via 'npm_package_store_deps' in the js_library targets that
+# are picked up automatically via 'npm_package_store_infos' in the js_library targets that
# the `npm_package` target depends on.
npm_link_package(
name = "node_modules/@mycorp/pkg-b",
diff --git a/docs/js_library.md b/docs/js_library.md
index 13d09c0fd0..94c4c17599 100644
--- a/docs/js_library.md
+++ b/docs/js_library.md
@@ -55,9 +55,9 @@ for more context on why we do this.
| :------------- | :------------- | :------------- | :------------- | :------------- |
| name | A unique name for this target. | Name | required | |
| copy_data_to_bin | When True, data
files are copied to the Bazel output tree before being passed as inputs to runfiles. | Boolean | optional | True
|
-| data | Runtime dependencies to include in binaries/tests that depend on this target.
The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the data
attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which has a runtime dependency on this target.
If this list contains linked npm packages, npm package store targets or other targets that provide JsInfo
, NpmPackageStoreInfo
providers are gathered from JsInfo
. This is done directly from the npm_package_store_deps
field of these. For linked npm package targets, the underlying npm_package_store
target(s) that back the links is used. Gathered NpmPackageStoreInfo
providers are propagated to the direct dependencies of downstream linked npm_package
targets.
NB: Linked npm package targets that are "dev" dependencies do not forward their underlying npm_package_store
target(s) through npm_package_store_deps
and will therefore not be propagated to the direct dependencies of downstream linked npm_package
targets. npm packages that come in from npm_translate_lock
are considered "dev" dependencies if they are have dev: true
set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all package.json
files within the pnpm workspace. This behavior is intentional to mimic how devDependencies
work in published npm packages. | List of labels | optional | []
|
+| data | Runtime dependencies to include in binaries/tests that depend on this target.
The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the data
attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which has a runtime dependency on this target.
If this list contains linked npm packages, npm package store targets or other targets that provide JsInfo
, NpmPackageStoreInfo
providers are gathered from JsInfo
. This is done directly from the npm_package_store_infos
field of these. For linked npm package targets, the underlying npm_package_store
target(s) that back the links is used. Gathered NpmPackageStoreInfo
providers are propagated to the direct dependencies of downstream linked npm_package
targets.
NB: Linked npm package targets that are "dev" dependencies do not forward their underlying npm_package_store
target(s) through npm_package_store_infos
and will therefore not be propagated to the direct dependencies of downstream linked npm_package
targets. npm packages that come in from npm_translate_lock
are considered "dev" dependencies if they are have dev: true
set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all package.json
files within the pnpm workspace. This behavior is intentional to mimic how devDependencies
work in published npm packages. | List of labels | optional | []
|
| declarations | Same as srcs
except all files are also provided as "declarations" available to downstream rules for type checking.
For example, a js_library with only .js
files that are intended to be imported as .js
files by downstream type checking rules such as ts_project
would list those files in declarations
:
js_library( name = "js_lib", declarations = ["index.js"], )
| List of labels | optional | []
|
-| deps | Dependencies of this target.deps
attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which is output by or has a runtime dependency on this target.JsInfo
, NpmPackageStoreInfo
providers are gathered from JsInfo
. This is done directly from the npm_package_store_deps
field of these. For linked npm package targets, the underlying npm_package_store
target(s) that back the links is used. Gathered NpmPackageStoreInfo
providers are propagated to the direct dependencies of downstream linked npm_package
targets.npm_package_store
target(s) through npm_package_store_deps
and will therefore not be propagated to the direct dependencies of downstream linked npm_package
targets. npm packages that come in from npm_translate_lock
are considered "dev" dependencies if they are have dev: true
set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all package.json
files within the pnpm workspace. This behavior is intentional to mimic how devDependencies
work in published npm packages. | List of labels | optional | []
|
+| deps | Dependencies of this target.deps
attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which is output by or has a runtime dependency on this target.JsInfo
, NpmPackageStoreInfo
providers are gathered from JsInfo
. This is done directly from the npm_package_store_infos
field of these. For linked npm package targets, the underlying npm_package_store
target(s) that back the links is used. Gathered NpmPackageStoreInfo
providers are propagated to the direct dependencies of downstream linked npm_package
targets.npm_package_store
target(s) through npm_package_store_infos
and will therefore not be propagated to the direct dependencies of downstream linked npm_package
targets. npm packages that come in from npm_translate_lock
are considered "dev" dependencies if they are have dev: true
set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all package.json
files within the pnpm workspace. This behavior is intentional to mimic how devDependencies
work in published npm packages. | List of labels | optional | []
|
| no_copy_to_bin | List of files to not copy to the Bazel output tree when copy_data_to_bin
is True.copy_to_bin
is not possible or not suitable for an input file such as a file in an external repository. In most cases, this option is not needed. See copy_data_to_bin
docstring for more info. | List of labels | optional | []
|
| srcs | Source files that are included in this library.srcs
attribute are added to the runfiles of this target. They should appear in the '*.runfiles' area of any executable which is output by or has a runtime dependency on this target.declarations
attribute instead. | List of labels | optional | []
|
diff --git a/docs/npm_package.md b/docs/npm_package.md
index 7f536f9cd0..ecd42c4d9f 100644
--- a/docs/npm_package.md
+++ b/docs/npm_package.md
@@ -90,7 +90,7 @@ To stamp the current git tag as the "version" in the package.json file, see
| :------------- | :------------- | :------------- |
| name | Unique name for this target. | none |
| srcs | Files and/or directories or targets that provide DirectoryPathInfo
to copy into the output directory. | []
|
-| data | Runtime / linktime npm dependencies of this npm package.NpmPackageStoreInfo
providers are gathered from JsInfo
of the targets specified. Targets can be linked npm packages, npm package store targets or other targets that provide JsInfo
. This is done directly from the npm_package_store_deps
field of these. For linked npm package targets, the underlying npm_package_store target(s) that back the links is used.NpmPackageStoreInfo
providers are used downstream as direct dependencies of this npm package when linking with npm_link_package
. | []
|
+| data | Runtime / linktime npm dependencies of this npm package.NpmPackageStoreInfo
providers are gathered from JsInfo
of the targets specified. Targets can be linked npm packages, npm package store targets or other targets that provide JsInfo
. This is done directly from the npm_package_store_infos
field of these. For linked npm package targets, the underlying npm_package_store target(s) that back the links is used.NpmPackageStoreInfo
providers are used downstream as direct dependencies of this npm package when linking with npm_link_package
. | []
|
| args | Arguments that are passed down to <name>.publish
target and npm publish
command. | []
|
| out | Path of the output directory, relative to this package. | None
|
| package | The package name. If set, should match the name
field in the package.json
file for this package.""
|
diff --git a/js/libs.bzl b/js/libs.bzl
index 4aeba44689..693d3e5bd2 100644
--- a/js/libs.bzl
+++ b/js/libs.bzl
@@ -16,7 +16,7 @@ load(
_envs_for_log_level = "envs_for_log_level",
_gather_files_from_js_info = "gather_files_from_js_info",
_gather_npm_linked_packages = "gather_npm_linked_packages",
- _gather_npm_package_store_deps = "gather_npm_package_store_deps",
+ _gather_npm_package_store_infos = "gather_npm_package_store_infos",
_gather_runfiles = "gather_runfiles",
_gather_transitive_declarations = "gather_transitive_declarations",
_gather_transitive_sources = "gather_transitive_sources",
@@ -29,7 +29,7 @@ js_lib_helpers = struct(
envs_for_log_level = _envs_for_log_level,
gather_files_from_js_info = _gather_files_from_js_info,
gather_npm_linked_packages = _gather_npm_linked_packages,
- gather_npm_package_store_deps = _gather_npm_package_store_deps,
+ gather_npm_package_store_infos = _gather_npm_package_store_infos,
gather_runfiles = _gather_runfiles,
gather_transitive_declarations = _gather_transitive_declarations,
gather_transitive_sources = _gather_transitive_sources,
diff --git a/js/private/js_helpers.bzl b/js/private/js_helpers.bzl
index 45a789aeb3..a46f97256a 100644
--- a/js/private/js_helpers.bzl
+++ b/js/private/js_helpers.bzl
@@ -7,12 +7,12 @@ load(":js_info.bzl", "JsInfo")
DOWNSTREAM_LINKED_NPM_DEPS_DOCSTRING = """If this list contains linked npm packages, npm package store targets or other targets that provide
`JsInfo`, `NpmPackageStoreInfo` providers are gathered from `JsInfo`. This is done directly from
-the `npm_package_store_deps` field of these. For linked npm package targets, the underlying
+the `npm_package_store_infos` field of these. For linked npm package targets, the underlying
`npm_package_store` target(s) that back the links is used. Gathered `NpmPackageStoreInfo`
providers are propagated to the direct dependencies of downstream linked `npm_package` targets.
NB: Linked npm package targets that are "dev" dependencies do not forward their underlying
-`npm_package_store` target(s) through `npm_package_store_deps` and will therefore not be
+`npm_package_store` target(s) through `npm_package_store_infos` and will therefore not be
propagated to the direct dependencies of downstream linked `npm_package` targets. npm packages
that come in from `npm_translate_lock` are considered "dev" dependencies if they are have
`dev: true` set in the pnpm lock file. This should be all packages that are only listed as
@@ -90,7 +90,7 @@ def gather_npm_linked_packages(srcs, deps):
if JsInfo in target and hasattr(target[JsInfo], "npm_linked_packages")
])
-def gather_npm_package_store_deps(targets):
+def gather_npm_package_store_infos(targets):
"""Gathers NpmPackageStoreInfo providers from the list of targets
Args:
@@ -100,14 +100,14 @@ def gather_npm_package_store_deps(targets):
A depset of npm package stores gathered
"""
- # npm_package_store_deps
- npm_package_store_deps = [
- target[JsInfo].npm_package_store_deps
+ # npm_package_store_infos
+ npm_package_store_infos = [
+ target[JsInfo].npm_package_store_infos
for target in targets
if JsInfo in target
]
- return depset([], transitive = npm_package_store_deps)
+ return depset([], transitive = npm_package_store_infos)
def copy_js_file_to_bin_action(ctx, file):
if ctx.label.workspace_name != file.owner.workspace_name or ctx.label.package != file.owner.package:
diff --git a/js/private/js_info.bzl b/js/private/js_info.bzl
index 38f67f044e..3a07bd0d94 100644
--- a/js/private/js_info.bzl
+++ b/js/private/js_info.bzl
@@ -5,7 +5,7 @@ JsInfo = provider(
fields = {
"declarations": "A depset of declaration files produced by the target",
"npm_linked_packages": "A depset of files in npm linked package dependencies of the target and the target's transitive deps",
- "npm_package_store_deps": "A depset of NpmPackageStoreInfo providers from non-dev npm dependencies of the target and the target's transitive dependencies to use as direct dependencies when linking downstream npm_package targets with npm_link_package",
+ "npm_package_store_infos": "A depset of NpmPackageStoreInfo providers from non-dev npm dependencies of the target and the target's transitive dependencies to use as direct dependencies when linking downstream npm_package targets with npm_link_package",
"sources": "A depset of source files produced by the target",
"transitive_declarations": "A depset of declaration files produced by the target and the target's transitive deps",
"transitive_sources": "A depset of source files produced by the target and the target's transitive deps",
@@ -15,7 +15,7 @@ JsInfo = provider(
def js_info(
declarations = depset(),
npm_linked_packages = depset(),
- npm_package_store_deps = depset(),
+ npm_package_store_infos = depset(),
sources = depset(),
transitive_declarations = depset(),
transitive_sources = depset()):
@@ -24,7 +24,7 @@ def js_info(
Args:
declarations: See JsInfo documentation
npm_linked_packages: See JsInfo documentation
- npm_package_store_deps: See JsInfo documentation
+ npm_package_store_infos: See JsInfo documentation
sources: See JsInfo documentation
transitive_declarations: See JsInfo documentation
transitive_sources: See JsInfo documentation
@@ -36,8 +36,8 @@ def js_info(
fail("Expected declarations to be a depset")
if type(npm_linked_packages) != "depset":
fail("Expected npm_linked_packages to be a depset")
- if type(npm_package_store_deps) != "depset":
- fail("Expected npm_package_store_deps to be a depset")
+ if type(npm_package_store_infos) != "depset":
+ fail("Expected npm_package_store_infos to be a depset")
if type(sources) != "depset":
fail("Expected sources to be a depset")
if type(transitive_declarations) != "depset":
@@ -48,7 +48,7 @@ def js_info(
return JsInfo(
declarations = declarations,
npm_linked_packages = npm_linked_packages,
- npm_package_store_deps = npm_package_store_deps,
+ npm_package_store_infos = npm_package_store_infos,
sources = sources,
transitive_declarations = transitive_declarations,
transitive_sources = transitive_sources,
diff --git a/js/private/js_library.bzl b/js/private/js_library.bzl
index b3fd7c9533..49451ac53f 100644
--- a/js/private/js_library.bzl
+++ b/js/private/js_library.bzl
@@ -24,7 +24,7 @@ js_library(
"""
load(":js_info.bzl", "JsInfo", "js_info")
-load(":js_helpers.bzl", "DOWNSTREAM_LINKED_NPM_DEPS_DOCSTRING", "JS_LIBRARY_DATA_ATTR", "copy_js_file_to_bin_action", "gather_npm_linked_packages", "gather_npm_package_store_deps", "gather_runfiles", "gather_transitive_declarations", "gather_transitive_sources")
+load(":js_helpers.bzl", "DOWNSTREAM_LINKED_NPM_DEPS_DOCSTRING", "JS_LIBRARY_DATA_ATTR", "copy_js_file_to_bin_action", "gather_npm_linked_packages", "gather_npm_package_store_infos", "gather_runfiles", "gather_transitive_declarations", "gather_transitive_sources")
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "COPY_FILE_TO_BIN_TOOLCHAINS")
_DOC = """A library of JavaScript sources. Provides JsInfo, the primary provider used in rules_js
@@ -195,7 +195,7 @@ def _js_library_impl(ctx):
deps = ctx.attr.deps,
)
- npm_package_store_deps = gather_npm_package_store_deps(
+ npm_package_store_infos = gather_npm_package_store_infos(
targets = ctx.attr.srcs + ctx.attr.data + ctx.attr.deps,
)
@@ -216,7 +216,7 @@ def _js_library_impl(ctx):
js_info(
declarations = declarations,
npm_linked_packages = npm_linked_packages,
- npm_package_store_deps = npm_package_store_deps,
+ npm_package_store_infos = npm_package_store_infos,
sources = sources,
transitive_declarations = transitive_declarations,
transitive_sources = transitive_sources,
diff --git a/npm/private/npm_link_package_store.bzl b/npm/private/npm_link_package_store.bzl
index 70fa03d84b..11b945f7d1 100644
--- a/npm/private/npm_link_package_store.bzl
+++ b/npm/private/npm_link_package_store.bzl
@@ -107,7 +107,7 @@ def _npm_link_package_store_impl(ctx):
js_info(
npm_linked_packages = transitive_files_depset,
# only propagate non-dev npm dependencies to use as direct dependencies when linking downstream npm_package targets with npm_link_package
- npm_package_store_deps = depset([store_info]) if not store_info.dev else depset(),
+ npm_package_store_infos = depset([store_info]) if not store_info.dev else depset(),
),
]
if OutputGroupInfo in ctx.attr.src:
diff --git a/npm/private/npm_package.bzl b/npm/private/npm_package.bzl
index 0478be7c3f..931230b7dd 100644
--- a/npm/private/npm_package.bzl
+++ b/npm/private/npm_package.bzl
@@ -89,13 +89,13 @@ def _npm_package_files_impl(ctx):
def _npm_package_impl(ctx):
dst = ctx.actions.declare_directory(ctx.attr.out if ctx.attr.out else ctx.attr.name)
- # forward all npm_package_store_deps
- npm_package_store_deps = [
- target[JsInfo].npm_package_store_deps
+ # forward all npm_package_store_infos
+ npm_package_store_infos = [
+ target[JsInfo].npm_package_store_infos
for target in ctx.attr.srcs
- if JsInfo in target and hasattr(target[JsInfo], "npm_package_store_deps")
+ if JsInfo in target and hasattr(target[JsInfo], "npm_package_store_infos")
]
- npm_package_store_deps.append(js_lib_helpers.gather_npm_package_store_deps(
+ npm_package_store_infos.append(js_lib_helpers.gather_npm_package_store_infos(
targets = ctx.attr.data,
))
@@ -129,7 +129,7 @@ def _npm_package_impl(ctx):
package = ctx.attr.package,
version = ctx.attr.version,
src = dst,
- npm_package_store_deps = depset([], transitive = npm_package_store_deps),
+ npm_package_store_infos = depset([], transitive = npm_package_store_infos),
),
]
@@ -246,7 +246,7 @@ def npm_package(
`NpmPackageStoreInfo` providers are gathered from `JsInfo` of the targets specified. Targets can be linked npm
packages, npm package store targets or other targets that provide `JsInfo`. This is done directly from the
- `npm_package_store_deps` field of these. For linked npm package targets, the underlying npm_package_store
+ `npm_package_store_infos` field of these. For linked npm package targets, the underlying npm_package_store
target(s) that back the links is used.
Gathered `NpmPackageStoreInfo` providers are used downstream as direct dependencies of this npm package when
diff --git a/npm/private/npm_package_info.bzl b/npm/private/npm_package_info.bzl
index e2550daf77..7b2d799f13 100644
--- a/npm/private/npm_package_info.bzl
+++ b/npm/private/npm_package_info.bzl
@@ -6,6 +6,6 @@ NpmPackageInfo = provider(
"package": "name of this npm package",
"version": "version of this npm package",
"src": "the sources of this npm package; either a tarball file, a TreeArtifact or a source directory",
- "npm_package_store_deps": "A depset of NpmPackageStoreInfo providers from npm dependencies of the package and the packages's transitive deps to use as direct dependencies when linking with npm_link_package",
+ "npm_package_store_infos": "A depset of NpmPackageStoreInfo providers from npm dependencies of the package and the packages's transitive deps to use as direct dependencies when linking with npm_link_package",
},
)
diff --git a/npm/private/npm_package_internal.bzl b/npm/private/npm_package_internal.bzl
index 0980debfcc..30ab509003 100644
--- a/npm/private/npm_package_internal.bzl
+++ b/npm/private/npm_package_internal.bzl
@@ -33,7 +33,7 @@ def _npm_package_internal_impl(ctx):
package = ctx.attr.package,
version = ctx.attr.version,
src = dst,
- npm_package_store_deps = depset(),
+ npm_package_store_infos = depset(),
),
]
diff --git a/npm/private/npm_package_store.bzl b/npm/private/npm_package_store.bzl
index 5823613122..fa59d4e6ca 100644
--- a/npm/private/npm_package_store.bzl
+++ b/npm/private/npm_package_store.bzl
@@ -165,7 +165,7 @@ def _npm_package_store_impl(ctx):
files = []
direct_ref_deps = {}
- npm_package_store_deps = []
+ npm_package_store_infos = []
if ctx.attr.src:
# output the package as a TreeArtifact to its package store location
@@ -242,7 +242,7 @@ deps of npm_package_store must be in the same package.""" % (ctx.label.package,
# party npm deps; it is not recommended for 1st party deps
direct_ref_deps[dep] = dep_aliases
- for store in ctx.attr.src[NpmPackageInfo].npm_package_store_deps.to_list():
+ for store in ctx.attr.src[NpmPackageInfo].npm_package_store_infos.to_list():
dep_package = store.package
dep_package_store_directory = store.package_store_directory
@@ -252,7 +252,7 @@ deps of npm_package_store must be in the same package.""" % (ctx.label.package,
# "node_modules/{package_store_root}/{package_store_name}/node_modules/{package}"
dep_symlink_path = paths.join("node_modules", utils.package_store_root, package_store_name, "node_modules", dep_package)
files.append(utils.make_symlink(ctx, dep_symlink_path, dep_package_store_directory))
- npm_package_store_deps.append(store)
+ npm_package_store_infos.append(store)
else:
# if ctx.attr.src is _not_ set then this is a terminal 3p package with ctx.attr.deps is
# being the transitive closure of deps; this pattern is used to break circular dependencies
@@ -295,7 +295,7 @@ deps of npm_package_store must be in the same package.""" % (ctx.label.package,
if package_store_directory:
files.append(package_store_directory)
- npm_package_store_deps.extend([
+ npm_package_store_infos.extend([
target[NpmPackageStoreInfo]
for target in ctx.attr.deps
])
@@ -305,19 +305,19 @@ deps of npm_package_store must be in the same package.""" % (ctx.label.package,
if ctx.attr.src:
transitive_files_depset = depset(files, transitive = [
npm_package_store.transitive_files
- for npm_package_store in npm_package_store_deps
+ for npm_package_store in npm_package_store_infos
])
else:
# if ctx.attr.src is _not_ set then this is a terminal 3p package with ctx.attr.deps is
# being the transitive closure of deps; this pattern is used to break circular dependencies
# between 3rd party npm deps; it is not recommended for 1st party deps because
- # npm_package_store_deps is the transitive closure of all the entire package store deps, we
+ # npm_package_store_infos is the transitive closure of all the entire package store deps, we
# can safely add just `files` from each of these to `transitive_files_depset`. Doing so
# reduces the size of `transitive_files_depset` significantly and reduces analysis time and
# Bazel memory usage during analysis
transitive_files_depset = depset(files, transitive = [
npm_package_store.files
- for npm_package_store in npm_package_store_deps
+ for npm_package_store in npm_package_store_infos
])
providers = [