diff --git a/WORKSPACE b/WORKSPACE
index 7da1ed4da..b0a41fe48 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -7,22 +7,19 @@ load("//js:dev_repositories.bzl", "rules_js_dev_dependencies")
rules_js_dev_dependencies()
-load("//js:repositories.bzl", "rules_js_dependencies")
+load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "register_jq_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-aspect_bazel_lib_dependencies()
+rules_js_register_toolchains(node_version = "16.14.2")
-register_jq_toolchains()
+load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+aspect_bazel_lib_dependencies()
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
# Alternate toolchains for testing across versions
nodejs_register_toolchains(
diff --git a/docs/npm_import.md b/docs/npm_import.md
index 2aa3d5e9f..70294cf59 100644
--- a/docs/npm_import.md
+++ b/docs/npm_import.md
@@ -28,8 +28,7 @@ npm_import(name, pa
link_workspace, link_packages, lifecycle_hooks, lifecycle_hooks_execution_requirements,
lifecycle_hooks_env, lifecycle_hooks_use_default_shell_env, integrity, url, commit,
replace_package, package_visibility, patch_args, patches, custom_postinstall, npm_auth,
- npm_auth_basic, npm_auth_username, npm_auth_password, bins, dev,
- register_copy_directory_toolchains, register_copy_to_directory_toolchains, kwargs)
+ npm_auth_basic, npm_auth_username, npm_auth_password, bins, dev, kwargs)
Import a single npm package into Bazel.
@@ -161,8 +160,6 @@ Read more about the downloader config: <https://blog.aspect.dev/configuring-b
| npm_auth_password | Auth password to authenticate with npm. When using Basic authentication. | ""
|
| bins | Dictionary of node_modules/.bin
binary files to create mapped to their node entry points.
This is typically derived from the "bin" attribute in the package.json file of the npm package being linked.
For example:
bins = { "foo": "./foo.js", "bar": "./bar.js", }
{}
|
| dev | Whether this npm package is a dev dependency | False
|
-| register_copy_directory_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_copy_directory_toolchains()
is called if the toolchain is not already registered | True
|
-| register_copy_to_directory_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_copy_to_directory_toolchains()
is called if the toolchain is not already registered | True
|
| kwargs | Internal use only | none |
diff --git a/docs/npm_package.md b/docs/npm_package.md
index c67f7d949..2fd92c4ff 100644
--- a/docs/npm_package.md
+++ b/docs/npm_package.md
@@ -146,14 +146,6 @@ This ensures that actions which use the package.json file can get cache hits.
For more information on stamping, read https://docs.aspect.build/rules/aspect_bazel_lib/docs/stamping.
-Using this rule requires that you register the jq toolchain in your WORKSPACE:
-
-```starlark
-load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains")
-
-register_jq_toolchains()
-```
-
**PARAMETERS**
diff --git a/docs/npm_translate_lock.md b/docs/npm_translate_lock.md
index 67126b35a..61d60a1ba 100644
--- a/docs/npm_translate_lock.md
+++ b/docs/npm_translate_lock.md
@@ -67,8 +67,6 @@ npm_translate_lock(name, lifecycle_hooks_use_default_shell_env, replace_packages, bins,
verify_node_modules_ignored, verify_patches, quiet,
external_repository_action_cache, link_workspace, pnpm_version, use_pnpm,
- register_copy_directory_toolchains, register_copy_to_directory_toolchains,
- register_coreutils_toolchains, register_yq_toolchains, register_tar_toolchains,
npm_package_target_name, use_starlark_yaml_parser, kwargs)
@@ -133,11 +131,6 @@ For more about how to use npm_translate_lock, read [pnpm and rules_js](/docs/pnp
| link_workspace | The workspace name where links will be created for the packages in this lock file.None
|
| pnpm_version | pnpm version to use when generating the @pnpm repository. Set to None to not create this repository.LATEST_PNPM_VERSION
will be used.use_pnpm
for bzlmod. | "8.15.3"
|
| use_pnpm | label of the pnpm extension to use.LATEST_PNPM_VERSION
) will be used.pnpm_version
for non-bzlmod. | None
|
-| register_copy_directory_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_copy_directory_toolchains()
is called if the toolchain is not already registered | True
|
-| register_copy_to_directory_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_copy_to_directory_toolchains()
is called if the toolchain is not already registered | True
|
-| register_coreutils_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_coreutils_toolchains()
is called if the toolchain is not already registered | True
|
-| register_yq_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_yq_toolchains()
is called if the toolchain is not already registered | True
|
-| register_tar_toolchains | if True, @aspect_bazel_lib//lib:repositories.bzl
register_tar_toolchains()
is called if the toolchain is not already registered | True
|
| npm_package_target_name | The name of linked npm_package
targets. When npm_package
targets are linked as pnpm workspace packages, the name of the target must align with this value.{dirname}
placeholder is replaced with the directory name of the target.{dirname}
| "{dirname}"
|
| use_starlark_yaml_parser | Opt-out of using yq
to parse the pnpm-lock file which was added in https://github.com/aspect-build/rules_js/pull/1458 and use the legacy starlark yaml parser instead. resolution: {tarball: https://gitpkg.vercel.app/blockprotocol/blockprotocol/packages/%40blockprotocol/type-system-web?6526c0e}
?
character in the tarball
value causes yq
to fail with: $ yq pnpm-lock.yaml -o=json Error: bad file 'pnpm-lock.yaml': yaml: line 7129: did not find expected ',' or '}'
False
|
| kwargs | Internal use only | none |
diff --git a/e2e/git_dep_metadata/WORKSPACE b/e2e/git_dep_metadata/WORKSPACE
index 639f1b98c..97e0c35af 100644
--- a/e2e/git_dep_metadata/WORKSPACE
+++ b/e2e/git_dep_metadata/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_import")
diff --git a/e2e/gyp_no_install_script/WORKSPACE b/e2e/gyp_no_install_script/WORKSPACE
index a43d69b45..6b0254806 100644
--- a/e2e/gyp_no_install_script/WORKSPACE
+++ b/e2e/gyp_no_install_script/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_bazel_lib//lib:repositories.bzl", "register_coreutils_toolchains")
diff --git a/e2e/js_image_docker/.nvmrc b/e2e/js_image_docker/.nvmrc
new file mode 100644
index 000000000..a1fe18788
--- /dev/null
+++ b/e2e/js_image_docker/.nvmrc
@@ -0,0 +1 @@
+16.14.2
\ No newline at end of file
diff --git a/e2e/js_image_docker/WORKSPACE b/e2e/js_image_docker/WORKSPACE
index 0c87270da..2c98d1bea 100644
--- a/e2e/js_image_docker/WORKSPACE
+++ b/e2e/js_image_docker/WORKSPACE
@@ -12,12 +12,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+rules_js_register_toolchains(node_version_from_nvmrc = "//:.nvmrc")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/js_image_oci/WORKSPACE b/e2e/js_image_oci/WORKSPACE
index 9e7df1dd8..c8c8e2bc6 100644
--- a/e2e/js_image_oci/WORKSPACE
+++ b/e2e/js_image_oci/WORKSPACE
@@ -14,12 +14,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+rules_js_register_toolchains(node_version = "16.14.2")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/js_run_devserver/WORKSPACE b/e2e/js_run_devserver/WORKSPACE
index 762ce191f..dae2de6ce 100644
--- a/e2e/js_run_devserver/WORKSPACE
+++ b/e2e/js_run_devserver/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_link_package-esm/WORKSPACE b/e2e/npm_link_package-esm/WORKSPACE
index cfe378efb..2150885f4 100644
--- a/e2e/npm_link_package-esm/WORKSPACE
+++ b/e2e/npm_link_package-esm/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.9.0",
-)
+rules_js_register_toolchains(node_version = "16.9.0")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_link_package/WORKSPACE b/e2e/npm_link_package/WORKSPACE
index 4a853a1cf..e33d66519 100644
--- a/e2e/npm_link_package/WORKSPACE
+++ b/e2e/npm_link_package/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+rules_js_register_toolchains(node_version = "16.14.2")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock/WORKSPACE b/e2e/npm_translate_lock/WORKSPACE
index 5631b25e9..7f014805b 100644
--- a/e2e/npm_translate_lock/WORKSPACE
+++ b/e2e/npm_translate_lock/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_auth/WORKSPACE b/e2e/npm_translate_lock_auth/WORKSPACE
index 8e31b6545..1a8d239b8 100644
--- a/e2e/npm_translate_lock_auth/WORKSPACE
+++ b/e2e/npm_translate_lock_auth/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_empty/WORKSPACE b/e2e/npm_translate_lock_empty/WORKSPACE
index 6d21251f8..66df89aac 100644
--- a/e2e/npm_translate_lock_empty/WORKSPACE
+++ b/e2e/npm_translate_lock_empty/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_git+ssh/WORKSPACE b/e2e/npm_translate_lock_git+ssh/WORKSPACE
index 8e31b6545..1a8d239b8 100644
--- a/e2e/npm_translate_lock_git+ssh/WORKSPACE
+++ b/e2e/npm_translate_lock_git+ssh/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_multi/WORKSPACE b/e2e/npm_translate_lock_multi/WORKSPACE
index bdd846b2a..2f245588c 100644
--- a/e2e/npm_translate_lock_multi/WORKSPACE
+++ b/e2e/npm_translate_lock_multi/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_partial_clone/WORKSPACE b/e2e/npm_translate_lock_partial_clone/WORKSPACE
index 58a8f42bb..92af2aff5 100644
--- a/e2e/npm_translate_lock_partial_clone/WORKSPACE
+++ b/e2e/npm_translate_lock_partial_clone/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_lock_subdir_patch/WORKSPACE b/e2e/npm_translate_lock_subdir_patch/WORKSPACE
index 5d76c8584..a2d4a605b 100644
--- a/e2e/npm_translate_lock_subdir_patch/WORKSPACE
+++ b/e2e/npm_translate_lock_subdir_patch/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_package_lock/WORKSPACE b/e2e/npm_translate_package_lock/WORKSPACE
index c679ded11..a22a72c91 100644
--- a/e2e/npm_translate_package_lock/WORKSPACE
+++ b/e2e/npm_translate_package_lock/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/npm_translate_yarn_lock/WORKSPACE b/e2e/npm_translate_yarn_lock/WORKSPACE
index f14e83126..bca9968b9 100644
--- a/e2e/npm_translate_yarn_lock/WORKSPACE
+++ b/e2e/npm_translate_yarn_lock/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/package_json_module/WORKSPACE b/e2e/package_json_module/WORKSPACE
index ea3ccba58..3482c2219 100644
--- a/e2e/package_json_module/WORKSPACE
+++ b/e2e/package_json_module/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/patch_from_repo/WORKSPACE b/e2e/patch_from_repo/WORKSPACE
index 1ccc9e8d5..b901ff41d 100644
--- a/e2e/patch_from_repo/WORKSPACE
+++ b/e2e/patch_from_repo/WORKSPACE
@@ -12,12 +12,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/pnpm_lockfiles/WORKSPACE b/e2e/pnpm_lockfiles/WORKSPACE
index 7959e5203..de0a29494 100644
--- a/e2e/pnpm_lockfiles/WORKSPACE
+++ b/e2e/pnpm_lockfiles/WORKSPACE
@@ -7,6 +7,10 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
+
+rules_js_register_toolchains()
+
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
nodejs_register_toolchains(
diff --git a/e2e/pnpm_repo_install/WORKSPACE b/e2e/pnpm_repo_install/WORKSPACE
index ea3ccba58..3482c2219 100644
--- a/e2e/pnpm_repo_install/WORKSPACE
+++ b/e2e/pnpm_repo_install/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/pnpm_workspace/WORKSPACE b/e2e/pnpm_workspace/WORKSPACE
index 53eda86e1..cdcf72348 100644
--- a/e2e/pnpm_workspace/WORKSPACE
+++ b/e2e/pnpm_workspace/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/pnpm_workspace_deps/WORKSPACE b/e2e/pnpm_workspace_deps/WORKSPACE
index e43c4a5b9..a42fea04f 100644
--- a/e2e/pnpm_workspace_deps/WORKSPACE
+++ b/e2e/pnpm_workspace_deps/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/pnpm_workspace_rerooted/WORKSPACE b/e2e/pnpm_workspace_rerooted/WORKSPACE
index 1245ca46f..d29780a0b 100644
--- a/e2e/pnpm_workspace_rerooted/WORKSPACE
+++ b/e2e/pnpm_workspace_rerooted/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+rules_js_register_toolchains(node_version = "16.14.2")
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/rules_foo/WORKSPACE b/e2e/rules_foo/WORKSPACE
index 4a8215532..e3893c614 100644
--- a/e2e/rules_foo/WORKSPACE
+++ b/e2e/rules_foo/WORKSPACE
@@ -10,12 +10,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = "16.14.2",
-)
+rules_js_register_toolchains(node_version = "16.14.2")
load("@rules_foo//foo:repositories.bzl", "foo_repositories")
diff --git a/e2e/stamped_package_json/WORKSPACE b/e2e/stamped_package_json/WORKSPACE
index 568e0f5dc..47606b86a 100644
--- a/e2e/stamped_package_json/WORKSPACE
+++ b/e2e/stamped_package_json/WORKSPACE
@@ -7,6 +7,6 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-register_jq_toolchains()
+rules_js_register_toolchains()
diff --git a/e2e/update_pnpm_lock/WORKSPACE b/e2e/update_pnpm_lock/WORKSPACE
index 144abdba3..1207427b3 100644
--- a/e2e/update_pnpm_lock/WORKSPACE
+++ b/e2e/update_pnpm_lock/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/update_pnpm_lock_with_import/WORKSPACE b/e2e/update_pnpm_lock_with_import/WORKSPACE
index 9d2b79e4a..9e9f619ff 100644
--- a/e2e/update_pnpm_lock_with_import/WORKSPACE
+++ b/e2e/update_pnpm_lock_with_import/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/vendored_node/WORKSPACE b/e2e/vendored_node/WORKSPACE
index fbd512df1..86a70feca 100644
--- a/e2e/vendored_node/WORKSPACE
+++ b/e2e/vendored_node/WORKSPACE
@@ -7,28 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load(
- "@aspect_bazel_lib//lib:repositories.bzl",
- "register_copy_directory_toolchains",
- "register_copy_to_directory_toolchains",
- "register_coreutils_toolchains",
- "register_tar_toolchains",
- "register_yq_toolchains",
-)
-
-register_copy_directory_toolchains()
-
-register_copy_to_directory_toolchains()
-
-register_coreutils_toolchains()
-
-register_tar_toolchains()
-
-register_yq_toolchains()
-
-load("@bazel_features//:deps.bzl", "bazel_features_deps")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-bazel_features_deps()
+rules_js_register_toolchains(register_nodejs_toolchain = False)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
diff --git a/e2e/vendored_node/toolchains/BUILD.bazel b/e2e/vendored_node/toolchains/BUILD.bazel
index 6e439e759..43bd7bbc2 100644
--- a/e2e/vendored_node/toolchains/BUILD.bazel
+++ b/e2e/vendored_node/toolchains/BUILD.bazel
@@ -7,11 +7,11 @@ In a real project you would vendor the binaries you need, or
build them from source, so there shouldn't be any fetches required.
"""
-load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain")
+load("@rules_nodejs//nodejs:toolchain.bzl", "nodejs_toolchain")
[
toolchain(
- name = "node15_%s_toolchain" % os,
+ name = "node_vendored_%s_toolchain" % os,
exec_compatible_with = [
"@platforms//os:" + os,
"@platforms//cpu:x86_64",
@@ -26,17 +26,17 @@ load("@rules_nodejs//nodejs:toolchain.bzl", "node_toolchain")
]
]
-node_toolchain(
+nodejs_toolchain(
name = "node_linux",
- target_tool = "@vendored_node_linux_amd64//:bin/node",
+ node = "@vendored_node_linux_amd64//:bin/node",
)
-node_toolchain(
+nodejs_toolchain(
name = "node_macos",
- target_tool = "@vendored_node_darwin_amd64//:bin/node",
+ node = "@vendored_node_darwin_amd64//:bin/node",
)
-node_toolchain(
+nodejs_toolchain(
name = "node_windows",
- target_tool = "@vendored_node_windows_amd64//:node.exe",
+ node = "@vendored_node_windows_amd64//:node.exe",
)
diff --git a/e2e/vendored_tarfile/WORKSPACE b/e2e/vendored_tarfile/WORKSPACE
index 4c75f2cfb..bfe1b00be 100644
--- a/e2e/vendored_tarfile/WORKSPACE
+++ b/e2e/vendored_tarfile/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/verify_patches/WORKSPACE b/e2e/verify_patches/WORKSPACE
index 1e7cc8666..aebbb4534 100644
--- a/e2e/verify_patches/WORKSPACE
+++ b/e2e/verify_patches/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/webpack_devserver/WORKSPACE b/e2e/webpack_devserver/WORKSPACE
index afeb53a42..3ee7a5a70 100644
--- a/e2e/webpack_devserver/WORKSPACE
+++ b/e2e/webpack_devserver/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/webpack_devserver_esm/WORKSPACE b/e2e/webpack_devserver_esm/WORKSPACE
index afeb53a42..3ee7a5a70 100644
--- a/e2e/webpack_devserver_esm/WORKSPACE
+++ b/e2e/webpack_devserver_esm/WORKSPACE
@@ -7,12 +7,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
+rules_js_register_toolchains()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/e2e/worker/WORKSPACE b/e2e/worker/WORKSPACE
index 85cb981c6..1027fcdcd 100644
--- a/e2e/worker/WORKSPACE
+++ b/e2e/worker/WORKSPACE
@@ -7,33 +7,7 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- # nodejs 14 is used intentionally here, to assert AbortController polyfill is installed properly.
- node_version = "14.20.0",
-)
-
-load(
- "@aspect_bazel_lib//lib:repositories.bzl",
- "register_copy_directory_toolchains",
- "register_copy_to_directory_toolchains",
- "register_coreutils_toolchains",
- "register_tar_toolchains",
- "register_yq_toolchains",
-)
-
-register_copy_directory_toolchains()
-
-register_copy_to_directory_toolchains()
-
-register_coreutils_toolchains()
-
-register_tar_toolchains()
-
-register_yq_toolchains()
-
-load("@bazel_features//:deps.bzl", "bazel_features_deps")
-
-bazel_features_deps()
+# nodejs 14 is used intentionally here, to assert AbortController polyfill is installed properly.
+rules_js_register_toolchains(node_version = "14.20.0")
diff --git a/e2e/workspace/WORKSPACE b/e2e/workspace/WORKSPACE
index 6b21dcbc0..f9a0091d3 100644
--- a/e2e/workspace/WORKSPACE
+++ b/e2e/workspace/WORKSPACE
@@ -9,17 +9,9 @@ load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
-load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
+load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
-nodejs_register_toolchains(
- name = "nodejs",
- node_version = DEFAULT_NODE_VERSION,
-)
-
-# For convenience, npm_translate_lock does this call automatically.
-# Uncomment if you don't call npm_translate_lock at all.
-#load("@bazel_features//:deps.bzl", "bazel_features_deps")
-#bazel_features_deps()
+rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
diff --git a/js/repositories.bzl b/js/repositories.bzl
index 0167909ad..7a45d15c0 100644
--- a/js/repositories.bzl
+++ b/js/repositories.bzl
@@ -27,10 +27,3 @@ def rules_js_dependencies():
strip_prefix = "bazel-lib-2.7.1",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.1/bazel-lib-v2.7.1.tar.gz",
)
-
- http_archive(
- name = "bazel_features",
- sha256 = "f3082bfcdca73dc77dcd68faace806135a2e08c230b02b1d9fbdbd7db9d9c450",
- strip_prefix = "bazel_features-0.1.0",
- url = "https://github.com/bazel-contrib/bazel_features/releases/download/v0.1.0/bazel_features-v0.1.0.tar.gz",
- )
diff --git a/js/toolchains.bzl b/js/toolchains.bzl
new file mode 100644
index 000000000..cf9fbe113
--- /dev/null
+++ b/js/toolchains.bzl
@@ -0,0 +1,86 @@
+"""Configures transitive deps and registers toolchains required by rules_js.
+"""
+
+load(
+ "@aspect_bazel_lib//lib:repositories.bzl",
+ _register_copy_directory_toolchains = "register_copy_directory_toolchains",
+ _register_copy_to_directory_toolchains = "register_copy_to_directory_toolchains",
+ _register_coreutils_toolchains = "register_coreutils_toolchains",
+ _register_jq_toolchains = "register_jq_toolchains",
+ _register_tar_toolchains = "register_tar_toolchains",
+ _register_yq_toolchains = "register_yq_toolchains",
+)
+load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains", _DEFAULT_NODE_REPOSITORY = "DEFAULT_NODE_REPOSITORY", _DEFAULT_NODE_VERSION = "DEFAULT_NODE_VERSION")
+
+DEFAULT_NODE_REPOSITORY = _DEFAULT_NODE_REPOSITORY
+DEFAULT_NODE_VERSION = _DEFAULT_NODE_VERSION
+
+def rules_js_register_toolchains(
+ node_download_auth = {},
+ node_repositories = {},
+ node_urls = None,
+ node_version = DEFAULT_NODE_VERSION,
+ node_version_from_nvmrc = None,
+ **kwargs):
+ """Configures transitive deps and toolchains required by rules_js.
+
+ Node.js toolchain comes from [rules_nodejs](https://docs.aspect.build/rulesets/rules_nodejs).
+ For more details on Node.js toolchain registration see
+ https://docs.aspect.build/rulesets/rules_nodejs/docs/core#node_repositories.
+
+ Additional required toolchains (jq, yq, copy_directory and copy_to_directory) come
+ from [Aspect bazel-lib](https://docs.aspect.build/rulesets/aspect_bazel_lib).
+
+ Args:
+ node_download_auth: Auth to use for all url requests when downloading Node
+
+ Example: {"type": "basic", "login": "