Introduce runtime_toolchain_type (#3859)

According to discussions in #3854 having two toolchains of the same type
for different things is troublesome. It's better to have separate
runtime as well as compile toolchains.

This commit creates a new runtime_toolchain_type and registers
toolchains without execution constraints for this type. Once merged,
rules_ts can start consuming the new toolchain type in its js_binary
rule to ensure the correct Node for the correct target environment is
selected.

Fixed [Bug]: Execution toolchain defined without
`target_compatible_with` makes it a candidate to selection

Fixes #3854
Work towards #3795

## PR Checklist

Please check if your PR fulfills the following requirements:

- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been added / updated (for bug fixes / features)


## PR Type

What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [x] Bugfix
- [x] Feature (please, look at the "Scope of the project" section in the
README.md file)
- [x] Documentation content changes


## Does this PR introduce a breaking change?

- [ ] Yes
- [x] No

It tries to remain compatible and support existing consumers.

## Other information

This is an alternative to #3800.
10 files changed
tree: dba5dfe3fbfbdaa872047d27986aef14aac5ad6e
  1. .aspect/
  2. .bazelci/
  3. .bcr/
  4. .github/
  5. .vscode/
  6. docs/
  7. e2e/
  8. external/
  9. internal/
  10. nodejs/
  11. packages/
  12. scripts/
  13. tools/
  14. .bazelignore
  15. .bazelrc
  16. .bazelversion
  17. .clang-format
  18. .git-blame-ignore-revs
  19. .gitignore
  20. .npmrc
  21. .pre-commit-config.yaml
  22. .prettierignore
  23. AUTHORS
  24. BUILD.bazel
  25. CHANGELOG.md
  26. CODE_OF_CONDUCT.md
  27. commitlint.config.js
  28. CONTRIBUTING.md
  29. CONTRIBUTORS
  30. DEVELOPING.md
  31. LICENSE
  32. MODULE.bazel
  33. package.json
  34. pnpm-lock.yaml
  35. README.md
  36. renovate.json
  37. repositories.bzl
  38. WORKSPACE
README.md

JavaScript rules for Bazel

Build status GitHub release (latest by date)

This ruleset provides a Node.js development toolchain and runtime with Bazel. It does not have any rules for using Node.js, such as nodejs_binary. For that, we recommend rules_js.

This repository is maintained by volunteers in the Bazel community. Neither Google, nor the Bazel team, provides support for the code. However, this repository is part of the test suite used to vet new Bazel releases.

We follow semantic versioning. Patch releases have bugfixes, minor releases have new features. Only major releases (1.x, 2.x) have breaking changes. We support LTS releases of Bazel (starting at 4.x), see SUPPORTED_BAZEL_VERSIONS in our /index.bzl for the list we test against.

6.0 Scope Reduction

This branch is the latest release, 6.x.x It has a greatly reduced scope from previous releases, as most of the code was unmaintained. See the 5.x branch for the prior state of the repo.

Documentation

See the docs/ folder, and generated API docs on https://registry.bazel.build/docs/rules_nodejs