refactor: rename npm_link_package_deps to npm_deps and npm_package_store_deps to npm_package_store_infos
diff --git a/BUILD.bazel b/BUILD.bazel index 7ae96ef..d1da4f5 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -65,7 +65,7 @@ ) # 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_binary.md b/docs/js_binary.md index 25f4696..b5e9da1 100644 --- a/docs/js_binary.md +++ b/docs/js_binary.md
@@ -23,9 +23,9 @@ <pre> js_binary(<a href="#js_binary-name">name</a>, <a href="#js_binary-chdir">chdir</a>, <a href="#js_binary-copy_data_to_bin">copy_data_to_bin</a>, <a href="#js_binary-data">data</a>, <a href="#js_binary-enable_runfiles">enable_runfiles</a>, <a href="#js_binary-entry_point">entry_point</a>, <a href="#js_binary-env">env</a>, - <a href="#js_binary-expected_exit_code">expected_exit_code</a>, <a href="#js_binary-fixed_args">fixed_args</a>, <a href="#js_binary-include_declarations">include_declarations</a>, <a href="#js_binary-include_npm">include_npm</a>, - <a href="#js_binary-include_npm_linked_packages">include_npm_linked_packages</a>, <a href="#js_binary-include_transitive_sources">include_transitive_sources</a>, <a href="#js_binary-log_level">log_level</a>, <a href="#js_binary-no_copy_to_bin">no_copy_to_bin</a>, - <a href="#js_binary-node_options">node_options</a>, <a href="#js_binary-node_toolchain">node_toolchain</a>, <a href="#js_binary-patch_node_fs">patch_node_fs</a>, <a href="#js_binary-preserve_symlinks_main">preserve_symlinks_main</a>) + <a href="#js_binary-expected_exit_code">expected_exit_code</a>, <a href="#js_binary-fixed_args">fixed_args</a>, <a href="#js_binary-include_declarations">include_declarations</a>, <a href="#js_binary-include_npm">include_npm</a>, <a href="#js_binary-include_npm_deps">include_npm_deps</a>, + <a href="#js_binary-include_transitive_sources">include_transitive_sources</a>, <a href="#js_binary-log_level">log_level</a>, <a href="#js_binary-no_copy_to_bin">no_copy_to_bin</a>, <a href="#js_binary-node_options">node_options</a>, <a href="#js_binary-node_toolchain">node_toolchain</a>, + <a href="#js_binary-patch_node_fs">patch_node_fs</a>, <a href="#js_binary-preserve_symlinks_main">preserve_symlinks_main</a>) </pre> Execute a program in the Node.js runtime. @@ -78,7 +78,7 @@ | <a id="js_binary-fixed_args"></a>fixed_args | Fixed command line arguments to pass to the Node.js when this binary target is executed.<br><br> Subject to [$(location)](https://bazel.build/reference/be/make-variables#predefined_label_variables) and ["Make variable"](https://bazel.build/reference/be/make-variables) substitution.<br><br> Unlike the built-in <code>args</code>, which are only passed to the target when it is executed either by the <code>bazel run</code> command or as a test, <code>fixed_args</code> are baked into the generated launcher script so are always passed even when the binary target is run outside of Bazel directly from the launcher script.<br><br> <code>fixed_args</code> are passed before the ones specified in <code>args</code> and before ones that are specified on the <code>bazel run</code> or <code>bazel test</code> command line.<br><br> See https://bazel.build/reference/be/common-definitions#common-attributes-binaries for more info on the built-in <code>args</code> attribute. | List of strings | optional | <code>[]</code> | | <a id="js_binary-include_declarations"></a>include_declarations | When True, <code>declarations</code> and <code>transitive_declarations</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> Defaults to false since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes. | Boolean | optional | <code>False</code> | | <a id="js_binary-include_npm"></a>include_npm | When True, npm is included in the runfiles of the target.<br><br> An npm binary is also added on the PATH so tools can spawn npm processes. This is a bash script on Linux and MacOS and a batch script on Windows.<br><br> A minimum of rules_nodejs version 5.7.0 is required which contains the Node.js toolchain changes to use npm. | Boolean | optional | <code>False</code> | -| <a id="js_binary-include_npm_linked_packages"></a>include_npm_linked_packages | When True, files in <code>npm_linked_packages</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the runfiles of the target. | Boolean | optional | <code>True</code> | +| <a id="js_binary-include_npm_deps"></a>include_npm_deps | When True, files in <code>npm_deps</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the runfiles of the target. | Boolean | optional | <code>True</code> | | <a id="js_binary-include_transitive_sources"></a>include_transitive_sources | When True, <code>transitive_sources</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target. | Boolean | optional | <code>True</code> | | <a id="js_binary-log_level"></a>log_level | Set the logging level.<br><br> Log from are written to stderr. They will be supressed on success when running as the tool of a js_run_binary when silent_on_success is True. In that case, they will be shown only on a build failure along with the stdout & stderr of the node tool being run.<br><br> Log levels: fatal, error, warn, info, debug | String | optional | <code>"error"</code> | | <a id="js_binary-no_copy_to_bin"></a>no_copy_to_bin | List of files to not copy to the Bazel output tree when <code>copy_data_to_bin</code> is True.<br><br> This is useful for exceptional cases where a <code>copy_to_bin</code> 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 <code>copy_data_to_bin</code> docstring for more info. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | @@ -94,9 +94,9 @@ <pre> js_test(<a href="#js_test-name">name</a>, <a href="#js_test-chdir">chdir</a>, <a href="#js_test-copy_data_to_bin">copy_data_to_bin</a>, <a href="#js_test-data">data</a>, <a href="#js_test-enable_runfiles">enable_runfiles</a>, <a href="#js_test-entry_point">entry_point</a>, <a href="#js_test-env">env</a>, <a href="#js_test-expected_exit_code">expected_exit_code</a>, - <a href="#js_test-fixed_args">fixed_args</a>, <a href="#js_test-include_declarations">include_declarations</a>, <a href="#js_test-include_npm">include_npm</a>, <a href="#js_test-include_npm_linked_packages">include_npm_linked_packages</a>, - <a href="#js_test-include_transitive_sources">include_transitive_sources</a>, <a href="#js_test-log_level">log_level</a>, <a href="#js_test-no_copy_to_bin">no_copy_to_bin</a>, <a href="#js_test-node_options">node_options</a>, <a href="#js_test-node_toolchain">node_toolchain</a>, - <a href="#js_test-patch_node_fs">patch_node_fs</a>, <a href="#js_test-preserve_symlinks_main">preserve_symlinks_main</a>) + <a href="#js_test-fixed_args">fixed_args</a>, <a href="#js_test-include_declarations">include_declarations</a>, <a href="#js_test-include_npm">include_npm</a>, <a href="#js_test-include_npm_deps">include_npm_deps</a>, <a href="#js_test-include_transitive_sources">include_transitive_sources</a>, + <a href="#js_test-log_level">log_level</a>, <a href="#js_test-no_copy_to_bin">no_copy_to_bin</a>, <a href="#js_test-node_options">node_options</a>, <a href="#js_test-node_toolchain">node_toolchain</a>, <a href="#js_test-patch_node_fs">patch_node_fs</a>, + <a href="#js_test-preserve_symlinks_main">preserve_symlinks_main</a>) </pre> Identical to js_binary, but usable under `bazel test`. @@ -137,7 +137,7 @@ | <a id="js_test-fixed_args"></a>fixed_args | Fixed command line arguments to pass to the Node.js when this binary target is executed.<br><br> Subject to [$(location)](https://bazel.build/reference/be/make-variables#predefined_label_variables) and ["Make variable"](https://bazel.build/reference/be/make-variables) substitution.<br><br> Unlike the built-in <code>args</code>, which are only passed to the target when it is executed either by the <code>bazel run</code> command or as a test, <code>fixed_args</code> are baked into the generated launcher script so are always passed even when the binary target is run outside of Bazel directly from the launcher script.<br><br> <code>fixed_args</code> are passed before the ones specified in <code>args</code> and before ones that are specified on the <code>bazel run</code> or <code>bazel test</code> command line.<br><br> See https://bazel.build/reference/be/common-definitions#common-attributes-binaries for more info on the built-in <code>args</code> attribute. | List of strings | optional | <code>[]</code> | | <a id="js_test-include_declarations"></a>include_declarations | When True, <code>declarations</code> and <code>transitive_declarations</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> Defaults to false since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes. | Boolean | optional | <code>False</code> | | <a id="js_test-include_npm"></a>include_npm | When True, npm is included in the runfiles of the target.<br><br> An npm binary is also added on the PATH so tools can spawn npm processes. This is a bash script on Linux and MacOS and a batch script on Windows.<br><br> A minimum of rules_nodejs version 5.7.0 is required which contains the Node.js toolchain changes to use npm. | Boolean | optional | <code>False</code> | -| <a id="js_test-include_npm_linked_packages"></a>include_npm_linked_packages | When True, files in <code>npm_linked_packages</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the runfiles of the target. | Boolean | optional | <code>True</code> | +| <a id="js_test-include_npm_deps"></a>include_npm_deps | When True, files in <code>npm_deps</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the runfiles of the target. | Boolean | optional | <code>True</code> | | <a id="js_test-include_transitive_sources"></a>include_transitive_sources | When True, <code>transitive_sources</code> from <code>JsInfo</code> providers in data targets are included in the runfiles of the target. | Boolean | optional | <code>True</code> | | <a id="js_test-log_level"></a>log_level | Set the logging level.<br><br> Log from are written to stderr. They will be supressed on success when running as the tool of a js_run_binary when silent_on_success is True. In that case, they will be shown only on a build failure along with the stdout & stderr of the node tool being run.<br><br> Log levels: fatal, error, warn, info, debug | String | optional | <code>"error"</code> | | <a id="js_test-no_copy_to_bin"></a>no_copy_to_bin | List of files to not copy to the Bazel output tree when <code>copy_data_to_bin</code> is True.<br><br> This is useful for exceptional cases where a <code>copy_to_bin</code> 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 <code>copy_data_to_bin</code> docstring for more info. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
diff --git a/docs/js_info_files.md b/docs/js_info_files.md index c5a8e7f..c6baf82 100644 --- a/docs/js_info_files.md +++ b/docs/js_info_files.md
@@ -7,7 +7,7 @@ ## js_info_files <pre> -js_info_files(<a href="#js_info_files-name">name</a>, <a href="#js_info_files-include_declarations">include_declarations</a>, <a href="#js_info_files-include_npm_linked_packages">include_npm_linked_packages</a>, <a href="#js_info_files-include_sources">include_sources</a>, +js_info_files(<a href="#js_info_files-name">name</a>, <a href="#js_info_files-include_declarations">include_declarations</a>, <a href="#js_info_files-include_npm_deps">include_npm_deps</a>, <a href="#js_info_files-include_sources">include_sources</a>, <a href="#js_info_files-include_transitive_declarations">include_transitive_declarations</a>, <a href="#js_info_files-include_transitive_sources">include_transitive_sources</a>, <a href="#js_info_files-srcs">srcs</a>) </pre> @@ -23,7 +23,7 @@ | :------------- | :------------- | :------------- | :------------- | :------------- | | <a id="js_info_files-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | | <a id="js_info_files-include_declarations"></a>include_declarations | When True, <code>declarations</code> from <code>JsInfo</code> providers in srcs targets are included in the default outputs of the target.<br><br> Defaults to False since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes. | Boolean | optional | <code>False</code> | -| <a id="js_info_files-include_npm_linked_packages"></a>include_npm_linked_packages | When True, files in <code>npm_linked_packages</code> from <code>JsInfo</code> providers in srcs targets are included in the default outputs of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the default outputs of the target. | Boolean | optional | <code>True</code> | +| <a id="js_info_files-include_npm_deps"></a>include_npm_deps | When True, files in <code>npm_deps</code> from <code>JsInfo</code> providers in srcs targets are included in the default outputs of the target.<br><br> <code>transitive_files</code> from <code>NpmPackageStoreInfo</code> providers in data targets are also included in the default outputs of the target. | Boolean | optional | <code>True</code> | | <a id="js_info_files-include_sources"></a>include_sources | When True, <code>sources</code> from <code>JsInfo</code> providers in <code>srcs</code> targets are included in the default outputs of the target. | Boolean | optional | <code>True</code> | | <a id="js_info_files-include_transitive_declarations"></a>include_transitive_declarations | When True, <code>transitive_declarations</code> from <code>JsInfo</code> providers in srcs targets are included in the default outputs of the target.<br><br> Defaults to False since declarations are generally not needed at runtime and introducing them could slow down developer round trip time due to having to generate typings on source file changes. | Boolean | optional | <code>False</code> | | <a id="js_info_files-include_transitive_sources"></a>include_transitive_sources | When True, <code>transitive_sources</code> from <code>JsInfo</code> providers in <code>srcs</code> targets are included in the default outputs of the target. | Boolean | optional | <code>True</code> |
diff --git a/docs/js_library.md b/docs/js_library.md index 13d09c0..94c4c17 100644 --- a/docs/js_library.md +++ b/docs/js_library.md
@@ -55,9 +55,9 @@ | :------------- | :------------- | :------------- | :------------- | :------------- | | <a id="js_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | | | <a id="js_library-copy_data_to_bin"></a>copy_data_to_bin | When True, <code>data</code> files are copied to the Bazel output tree before being passed as inputs to runfiles. | Boolean | optional | <code>True</code> | -| <a id="js_library-data"></a>data | Runtime dependencies to include in binaries/tests that depend on this target.<br><br>The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the <code>data</code> 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.<br><br>If this list contains linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>, <code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code>. This is done directly from the <code>npm_package_store_deps</code> field of these. For linked npm package targets, the underlying <code>npm_package_store</code> target(s) that back the links is used. Gathered <code>NpmPackageStoreInfo</code> providers are propagated to the direct dependencies of downstream linked <code>npm_package</code> targets.<br><br>NB: Linked npm package targets that are "dev" dependencies do not forward their underlying <code>npm_package_store</code> target(s) through <code>npm_package_store_deps</code> and will therefore not be propagated to the direct dependencies of downstream linked <code>npm_package</code> targets. npm packages that come in from <code>npm_translate_lock</code> are considered "dev" dependencies if they are have <code>dev: true</code> set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all <code>package.json</code> files within the pnpm workspace. This behavior is intentional to mimic how <code>devDependencies</code> work in published npm packages. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | +| <a id="js_library-data"></a>data | Runtime dependencies to include in binaries/tests that depend on this target.<br><br>The transitive npm dependencies, transitive sources, default outputs and runfiles of targets in the <code>data</code> 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.<br><br>If this list contains linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>, <code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code>. This is done directly from the <code>npm_package_store_infos</code> field of these. For linked npm package targets, the underlying <code>npm_package_store</code> target(s) that back the links is used. Gathered <code>NpmPackageStoreInfo</code> providers are propagated to the direct dependencies of downstream linked <code>npm_package</code> targets.<br><br>NB: Linked npm package targets that are "dev" dependencies do not forward their underlying <code>npm_package_store</code> target(s) through <code>npm_package_store_infos</code> and will therefore not be propagated to the direct dependencies of downstream linked <code>npm_package</code> targets. npm packages that come in from <code>npm_translate_lock</code> are considered "dev" dependencies if they are have <code>dev: true</code> set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all <code>package.json</code> files within the pnpm workspace. This behavior is intentional to mimic how <code>devDependencies</code> work in published npm packages. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | | <a id="js_library-declarations"></a>declarations | Same as <code>srcs</code> except all files are also provided as "declarations" available to downstream rules for type checking.<br><br>For example, a js_library with only <code>.js</code> files that are intended to be imported as <code>.js</code> files by downstream type checking rules such as <code>ts_project</code> would list those files in <code>declarations</code>:<br><br><pre><code> js_library( name = "js_lib", declarations = ["index.js"], ) </code></pre> | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | -| <a id="js_library-deps"></a>deps | Dependencies of this target.<br><br>This may include other js_library targets or other targets that provide JsInfo<br><br>The transitive npm dependencies, transitive sources & runfiles of targets in the <code>deps</code> 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.<br><br>If this list contains linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>, <code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code>. This is done directly from the <code>npm_package_store_deps</code> field of these. For linked npm package targets, the underlying <code>npm_package_store</code> target(s) that back the links is used. Gathered <code>NpmPackageStoreInfo</code> providers are propagated to the direct dependencies of downstream linked <code>npm_package</code> targets.<br><br>NB: Linked npm package targets that are "dev" dependencies do not forward their underlying <code>npm_package_store</code> target(s) through <code>npm_package_store_deps</code> and will therefore not be propagated to the direct dependencies of downstream linked <code>npm_package</code> targets. npm packages that come in from <code>npm_translate_lock</code> are considered "dev" dependencies if they are have <code>dev: true</code> set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all <code>package.json</code> files within the pnpm workspace. This behavior is intentional to mimic how <code>devDependencies</code> work in published npm packages. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | +| <a id="js_library-deps"></a>deps | Dependencies of this target.<br><br>This may include other js_library targets or other targets that provide JsInfo<br><br>The transitive npm dependencies, transitive sources & runfiles of targets in the <code>deps</code> 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.<br><br>If this list contains linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>, <code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code>. This is done directly from the <code>npm_package_store_infos</code> field of these. For linked npm package targets, the underlying <code>npm_package_store</code> target(s) that back the links is used. Gathered <code>NpmPackageStoreInfo</code> providers are propagated to the direct dependencies of downstream linked <code>npm_package</code> targets.<br><br>NB: Linked npm package targets that are "dev" dependencies do not forward their underlying <code>npm_package_store</code> target(s) through <code>npm_package_store_infos</code> and will therefore not be propagated to the direct dependencies of downstream linked <code>npm_package</code> targets. npm packages that come in from <code>npm_translate_lock</code> are considered "dev" dependencies if they are have <code>dev: true</code> set in the pnpm lock file. This should be all packages that are only listed as "devDependencies" in all <code>package.json</code> files within the pnpm workspace. This behavior is intentional to mimic how <code>devDependencies</code> work in published npm packages. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | | <a id="js_library-no_copy_to_bin"></a>no_copy_to_bin | List of files to not copy to the Bazel output tree when <code>copy_data_to_bin</code> is True.<br><br> This is useful for exceptional cases where a <code>copy_to_bin</code> 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 <code>copy_data_to_bin</code> docstring for more info. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> | | <a id="js_library-srcs"></a>srcs | Source files that are included in this library.<br><br>This includes all your checked-in code and any generated source files.<br><br>The transitive npm dependencies, transitive sources & runfiles of targets in the <code>srcs</code> 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.<br><br>Source files that are JSON files, declaration files or directory artifacts will be automatically provided as "declarations" available to downstream rules for type checking. To explicitly provide source files as "declarations" available to downstream rules for type checking that do not match these criteria, move those files to the <code>declarations</code> attribute instead. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
diff --git a/docs/js_run_binary.md b/docs/js_run_binary.md index 7b62a5a..762efa3 100644 --- a/docs/js_run_binary.md +++ b/docs/js_run_binary.md
@@ -19,8 +19,8 @@ <pre> js_run_binary(<a href="#js_run_binary-name">name</a>, <a href="#js_run_binary-tool">tool</a>, <a href="#js_run_binary-env">env</a>, <a href="#js_run_binary-srcs">srcs</a>, <a href="#js_run_binary-outs">outs</a>, <a href="#js_run_binary-out_dirs">out_dirs</a>, <a href="#js_run_binary-args">args</a>, <a href="#js_run_binary-chdir">chdir</a>, <a href="#js_run_binary-stdout">stdout</a>, <a href="#js_run_binary-stderr">stderr</a>, <a href="#js_run_binary-exit_code_out">exit_code_out</a>, <a href="#js_run_binary-silent_on_success">silent_on_success</a>, <a href="#js_run_binary-use_execroot_entry_point">use_execroot_entry_point</a>, <a href="#js_run_binary-copy_srcs_to_bin">copy_srcs_to_bin</a>, - <a href="#js_run_binary-include_transitive_sources">include_transitive_sources</a>, <a href="#js_run_binary-include_declarations">include_declarations</a>, <a href="#js_run_binary-include_npm_linked_packages">include_npm_linked_packages</a>, - <a href="#js_run_binary-log_level">log_level</a>, <a href="#js_run_binary-mnemonic">mnemonic</a>, <a href="#js_run_binary-progress_message">progress_message</a>, <a href="#js_run_binary-execution_requirements">execution_requirements</a>, <a href="#js_run_binary-stamp">stamp</a>, <a href="#js_run_binary-patch_node_fs">patch_node_fs</a>, + <a href="#js_run_binary-include_transitive_sources">include_transitive_sources</a>, <a href="#js_run_binary-include_declarations">include_declarations</a>, <a href="#js_run_binary-include_npm_deps">include_npm_deps</a>, <a href="#js_run_binary-log_level">log_level</a>, <a href="#js_run_binary-mnemonic">mnemonic</a>, + <a href="#js_run_binary-progress_message">progress_message</a>, <a href="#js_run_binary-execution_requirements">execution_requirements</a>, <a href="#js_run_binary-stamp">stamp</a>, <a href="#js_run_binary-patch_node_fs">patch_node_fs</a>, <a href="#js_run_binary-allow_execroot_entry_point_with_no_copy_data_to_bin">allow_execroot_entry_point_with_no_copy_data_to_bin</a>, <a href="#js_run_binary-use_default_shell_env">use_default_shell_env</a>, <a href="#js_run_binary-kwargs">kwargs</a>) </pre> @@ -64,7 +64,7 @@ | <a id="js_run_binary-copy_srcs_to_bin"></a>copy_srcs_to_bin | When True, all srcs files are copied to the output tree that are not already there. | <code>True</code> | | <a id="js_run_binary-include_transitive_sources"></a>include_transitive_sources | see <code>js_info_files</code> documentation | <code>True</code> | | <a id="js_run_binary-include_declarations"></a>include_declarations | see <code>js_info_files</code> documentation | <code>False</code> | -| <a id="js_run_binary-include_npm_linked_packages"></a>include_npm_linked_packages | see <code>js_info_files</code> documentation | <code>True</code> | +| <a id="js_run_binary-include_npm_deps"></a>include_npm_deps | see <code>js_info_files</code> documentation | <code>True</code> | | <a id="js_run_binary-log_level"></a>log_level | Set the logging level of the <code>js_binary</code> tool.<br><br>This overrides the log level set on the <code>js_binary</code> tool target. | <code>None</code> | | <a id="js_run_binary-mnemonic"></a>mnemonic | A one-word description of the action, for example, CppCompile or GoLink. | <code>"JsRunBinary"</code> | | <a id="js_run_binary-progress_message"></a>progress_message | Progress message to show to the user during the build, for example, "Compiling foo.cc to create foo.o". The message may contain %{label}, %{input}, or %{output} patterns, which are substituted with label string, first input, or output's path, respectively. Prefer to use patterns instead of static strings, because the former are more efficient. | <code>None</code> |
diff --git a/docs/npm_package.md b/docs/npm_package.md index 7f536f9..ecd42c4 100644 --- a/docs/npm_package.md +++ b/docs/npm_package.md
@@ -90,7 +90,7 @@ | :------------- | :------------- | :------------- | | <a id="npm_package-name"></a>name | Unique name for this target. | none | | <a id="npm_package-srcs"></a>srcs | Files and/or directories or targets that provide <code>DirectoryPathInfo</code> to copy into the output directory. | <code>[]</code> | -| <a id="npm_package-data"></a>data | Runtime / linktime npm dependencies of this npm package.<br><br><code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code> of the targets specified. Targets can be linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>. This is done directly from the <code>npm_package_store_deps</code> field of these. For linked npm package targets, the underlying npm_package_store target(s) that back the links is used.<br><br>Gathered <code>NpmPackageStoreInfo</code> providers are used downstream as direct dependencies of this npm package when linking with <code>npm_link_package</code>. | <code>[]</code> | +| <a id="npm_package-data"></a>data | Runtime / linktime npm dependencies of this npm package.<br><br><code>NpmPackageStoreInfo</code> providers are gathered from <code>JsInfo</code> of the targets specified. Targets can be linked npm packages, npm package store targets or other targets that provide <code>JsInfo</code>. This is done directly from the <code>npm_package_store_infos</code> field of these. For linked npm package targets, the underlying npm_package_store target(s) that back the links is used.<br><br>Gathered <code>NpmPackageStoreInfo</code> providers are used downstream as direct dependencies of this npm package when linking with <code>npm_link_package</code>. | <code>[]</code> | | <a id="npm_package-args"></a>args | Arguments that are passed down to <code><name>.publish</code> target and <code>npm publish</code> command. | <code>[]</code> | | <a id="npm_package-out"></a>out | Path of the output directory, relative to this package. | <code>None</code> | | <a id="npm_package-package"></a>package | The package name. If set, should match the <code>name</code> field in the <code>package.json</code> file for this package.<br><br>If set, the package name set here will be used for linking if a npm_link_package does not specify a package name. A npm_link_package that specifies a package name will override the value here when linking.<br><br>If unset, a npm_link_package that references this npm_package must define the package name must be for linking. | <code>""</code> |
diff --git a/js/defs.bzl b/js/defs.bzl index 623a4b9..cbc7e47 100644 --- a/js/defs.bzl +++ b/js/defs.bzl
@@ -26,8 +26,21 @@ _js_image_layer = "js_image_layer", ) +# buildifier: disable=function-docstring def js_binary(**kwargs): + include_npm_deps = kwargs.pop("include_npm_deps", False) + + # For backward compat + # TODO(3.0): remove backward compat handling + include_npm_linked_packages = kwargs.pop("include_npm_linked_packages", None) + if include_npm_linked_packages != None: + # buildifier: disable=print + print(""" +WARNING: js_library 'include_npm_linked_packages' is deprecated. Use 'include_npm_deps' instead.""") + include_npm_deps = include_npm_linked_packages + _js_binary( + include_npm_deps = include_npm_deps, enable_runfiles = select({ Label("@aspect_bazel_lib//lib:enable_runfiles"): True, "//conditions:default": False, @@ -35,6 +48,7 @@ **kwargs ) +# buildifier: disable=function-docstring def js_test(**kwargs): _js_test( enable_runfiles = select({
diff --git a/js/libs.bzl b/js/libs.bzl index 4aeba44..eedea36 100644 --- a/js/libs.bzl +++ b/js/libs.bzl
@@ -15,8 +15,8 @@ _LOG_LEVELS = "LOG_LEVELS", _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_deps = "gather_npm_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", @@ -28,8 +28,8 @@ 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_deps = _gather_npm_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_binary.bzl b/js/private/js_binary.bzl index 365db6f..fa5c2e2 100644 --- a/js/private/js_binary.bzl +++ b/js/private/js_binary.bzl
@@ -198,8 +198,8 @@ time due to having to generate typings on source file changes.""", default = False, ), - "include_npm_linked_packages": attr.bool( - doc = """When True, files in `npm_linked_packages` from `JsInfo` providers in data targets are included in the runfiles of the target. + "include_npm_deps": attr.bool( + doc = """When True, files in `npm_deps` from `JsInfo` providers in data targets are included in the runfiles of the target. `transitive_files` from `NpmPackageStoreInfo` providers in data targets are also included in the runfiles of the target. """, @@ -517,7 +517,7 @@ no_copy_to_bin = ctx.files.no_copy_to_bin, include_transitive_sources = ctx.attr.include_transitive_sources, include_declarations = ctx.attr.include_declarations, - include_npm_linked_packages = ctx.attr.include_npm_linked_packages, + include_npm_deps = ctx.attr.include_npm_deps, ).merge(ctx.runfiles( files = launcher_files, transitive_files = transitive_launcher_files,
diff --git a/js/private/js_helpers.bzl b/js/private/js_helpers.bzl index 45a789a..3693af9 100644 --- a/js/private/js_helpers.bzl +++ b/js/private/js_helpers.bzl
@@ -7,12 +7,12 @@ 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 @@ -73,7 +73,7 @@ ] return depset([], transitive = [declarations] + transitive) -def gather_npm_linked_packages(srcs, deps): +def gather_npm_deps(srcs, deps): """Gathers npm linked packages from a list of srcs and deps targets Args: @@ -85,12 +85,12 @@ """ return depset([], transitive = [ - target[JsInfo].npm_linked_packages + target[JsInfo].npm_deps for target in srcs + deps - if JsInfo in target and hasattr(target[JsInfo], "npm_linked_packages") + if JsInfo in target and hasattr(target[JsInfo], "npm_deps") ]) -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 @@ 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: @@ -157,7 +157,7 @@ include_transitive_sources = True, include_declarations = False, include_transitive_declarations = False, - include_npm_linked_packages = True): + include_npm_deps = True): """Creates a runfiles object containing files in `sources`, default outputs from `data` and transitive runfiles from `data` & `deps`. As a defense in depth against `data` & `deps` targets not supplying all required runfiles, also @@ -201,7 +201,7 @@ include_transitive_declarations: see js_info_files documentation - include_npm_linked_packages: see js_info_files documentation + include_npm_deps: see js_info_files documentation Returns: A [runfiles](https://bazel.build/rules/lib/runfiles) object created with [ctx.runfiles](https://bazel.build/rules/lib/ctx#runfiles). @@ -225,7 +225,7 @@ include_transitive_sources = include_transitive_sources, include_declarations = include_declarations, include_transitive_declarations = include_transitive_declarations, - include_npm_linked_packages = include_npm_linked_packages, + include_npm_deps = include_npm_deps, )) files_runfiles = [] @@ -288,7 +288,7 @@ include_transitive_sources, include_declarations, include_transitive_declarations, - include_npm_linked_packages): + include_npm_deps): """Gathers files from JsInfo and NpmPackageStoreInfo providers. Args: @@ -297,7 +297,7 @@ include_transitive_sources: see js_info_files documentation include_declarations: see js_info_files documentation include_transitive_declarations: see js_info_files documentation - include_npm_linked_packages: see js_info_files documentation + include_npm_deps: see js_info_files documentation Returns: A depset of files @@ -327,11 +327,11 @@ for target in targets if JsInfo in target and hasattr(target[JsInfo], "transitive_declarations") ]) - if include_npm_linked_packages: + if include_npm_deps: files_depsets.extend([ - target[JsInfo].npm_linked_packages + target[JsInfo].npm_deps for target in targets - if JsInfo in target and hasattr(target[JsInfo], "npm_linked_packages") + if JsInfo in target and hasattr(target[JsInfo], "npm_deps") ]) files_depsets.extend([ target[NpmPackageStoreInfo].transitive_files
diff --git a/js/private/js_info.bzl b/js/private/js_info.bzl index 38f67f0..c893ae0 100644 --- a/js/private/js_info.bzl +++ b/js/private/js_info.bzl
@@ -4,8 +4,8 @@ doc = "Encapsulates information provided by rules in rules_js and derivative rule sets", 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_deps": "A depset of files in npm dependencies of the target and the target's transitive deps", + "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", @@ -14,8 +14,8 @@ def js_info( declarations = depset(), - npm_linked_packages = depset(), - npm_package_store_deps = depset(), + npm_deps = depset(), + npm_package_store_infos = depset(), sources = depset(), transitive_declarations = depset(), transitive_sources = depset()): @@ -23,8 +23,8 @@ Args: declarations: See JsInfo documentation - npm_linked_packages: See JsInfo documentation - npm_package_store_deps: See JsInfo documentation + npm_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 @@ -34,10 +34,10 @@ """ if type(declarations) != "depset": 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_deps) != "depset": + fail("Expected npm_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": @@ -47,8 +47,8 @@ return JsInfo( declarations = declarations, - npm_linked_packages = npm_linked_packages, - npm_package_store_deps = npm_package_store_deps, + npm_deps = npm_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_info_files.bzl b/js/private/js_info_files.bzl index 7ddf4be..a1561fc 100644 --- a/js/private/js_info_files.bzl +++ b/js/private/js_info_files.bzl
@@ -14,7 +14,7 @@ include_transitive_sources = ctx.attr.include_transitive_sources, include_declarations = ctx.attr.include_declarations, include_transitive_declarations = ctx.attr.include_transitive_declarations, - include_npm_linked_packages = ctx.attr.include_npm_linked_packages, + include_npm_deps = ctx.attr.include_npm_deps, )) js_info_files = rule( @@ -47,8 +47,8 @@ time due to having to generate typings on source file changes.""", default = False, ), - "include_npm_linked_packages": attr.bool( - doc = """When True, files in `npm_linked_packages` from `JsInfo` providers in srcs targets are included in the default outputs of the target. + "include_npm_deps": attr.bool( + doc = """When True, files in `npm_deps` from `JsInfo` providers in srcs targets are included in the default outputs of the target. `transitive_files` from `NpmPackageStoreInfo` providers in data targets are also included in the default outputs of the target. """,
diff --git a/js/private/js_library.bzl b/js/private/js_library.bzl index 35f51aa..fde4302 100644 --- a/js/private/js_library.bzl +++ b/js/private/js_library.bzl
@@ -24,7 +24,7 @@ """ 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_deps", "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 @@ -190,12 +190,12 @@ targets = ctx.attr.srcs + ctx.attr.declarations + ctx.attr.deps, ) - npm_linked_packages = gather_npm_linked_packages( + npm_deps = gather_npm_deps( srcs = ctx.attr.srcs + ctx.attr.declarations, 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.data + ctx.attr.deps, ) @@ -209,14 +209,14 @@ no_copy_to_bin = ctx.files.no_copy_to_bin, include_transitive_sources = True, include_declarations = False, - include_npm_linked_packages = True, + include_npm_deps = True, ) return [ js_info( declarations = declarations, - npm_linked_packages = npm_linked_packages, - npm_package_store_deps = npm_package_store_deps, + npm_deps = npm_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_run_binary.bzl b/js/private/js_run_binary.bzl index 35811cb..13161c4 100644 --- a/js/private/js_run_binary.bzl +++ b/js/private/js_run_binary.bzl
@@ -35,7 +35,7 @@ copy_srcs_to_bin = True, include_transitive_sources = True, include_declarations = False, - include_npm_linked_packages = True, + include_npm_deps = True, log_level = None, mnemonic = "JsRunBinary", progress_message = None, @@ -154,7 +154,7 @@ include_declarations: see `js_info_files` documentation - include_npm_linked_packages: see `js_info_files` documentation + include_npm_deps: see `js_info_files` documentation log_level: Set the logging level of the `js_binary` tool. @@ -247,7 +247,7 @@ # Hoist js provider files to DefaultInfo make_js_info_files_target = (include_transitive_sources or include_declarations or - include_npm_linked_packages) + include_npm_deps) if make_js_info_files_target: js_info_files_name = "{}_js_info_files".format(name) _js_info_files( @@ -255,7 +255,7 @@ srcs = srcs, include_transitive_sources = include_transitive_sources, include_declarations = include_declarations, - include_npm_linked_packages = include_npm_linked_packages, + include_npm_deps = include_npm_deps, # Always tag the target manual since we should only build it when the final target is built. tags = kwargs.get("tags", []) + ["manual"], # Always propagate the testonly attribute
diff --git a/js/private/js_run_devserver.bzl b/js/private/js_run_devserver.bzl index 904a52f..9e5b226 100644 --- a/js/private/js_run_devserver.bzl +++ b/js/private/js_run_devserver.bzl
@@ -46,7 +46,7 @@ include_transitive_sources = ctx.attr.include_transitive_sources, include_declarations = ctx.attr.include_declarations, include_transitive_declarations = ctx.attr.include_declarations, - include_npm_linked_packages = ctx.attr.include_npm_linked_packages, + include_npm_deps = ctx.attr.include_npm_deps, )] # The .to_list() calls here are intentional and cannot be avoided; they should be small sets of
diff --git a/js/private/test/create_launcher/custom_test.bzl b/js/private/test/create_launcher/custom_test.bzl index 62d26b1..dc9683e 100644 --- a/js/private/test/create_launcher/custom_test.bzl +++ b/js/private/test/create_launcher/custom_test.bzl
@@ -25,7 +25,7 @@ include_transitive_sources = ctx.attr.include_transitive_sources, include_declarations = ctx.attr.include_declarations, include_transitive_declarations = ctx.attr.include_declarations, - include_npm_linked_packages = ctx.attr.include_npm_linked_packages, + include_npm_deps = ctx.attr.include_npm_deps, ), ).merge(launcher.runfiles).merge_all([ target[DefaultInfo].default_runfiles
diff --git a/npm/private/npm_link_package_store.bzl b/npm/private/npm_link_package_store.bzl index 70fa03d..8ecfe8e 100644 --- a/npm/private/npm_link_package_store.bzl +++ b/npm/private/npm_link_package_store.bzl
@@ -105,9 +105,9 @@ runfiles = ctx.runfiles(transitive_files = transitive_files_depset), ), js_info( - npm_linked_packages = transitive_files_depset, + npm_deps = 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 0478be7..931230b 100644 --- a/npm/private/npm_package.bzl +++ b/npm/private/npm_package.bzl
@@ -89,13 +89,13 @@ 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 @@ 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 @@ `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 e2550da..7b2d799 100644 --- a/npm/private/npm_package_info.bzl +++ b/npm/private/npm_package_info.bzl
@@ -6,6 +6,6 @@ "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 0980deb..30ab509 100644 --- a/npm/private/npm_package_internal.bzl +++ b/npm/private/npm_package_internal.bzl
@@ -33,7 +33,7 @@ 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 5823613..cb8e5e0 100644 --- a/npm/private/npm_package_store.bzl +++ b/npm/private/npm_package_store.bzl
@@ -165,7 +165,7 @@ 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 @@ # 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 @@ # "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 @@ 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 @@ 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 - # can safely add just `files` from each of these to `transitive_files_depset`. Doing so + # npm_package_store_infos is the transitive closure of the all NpmPackageStoreInfos in 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 = [