feat!: clearer bzlmod extension API for TypeScript toolchains - #972
Open
jbedard wants to merge 1 commit into
Open
feat!: clearer bzlmod extension API for TypeScript toolchains#972jbedard wants to merge 1 commit into
jbedard wants to merge 1 commit into
Conversation
jbedard
force-pushed
the
941-extension-renaming
branch
from
July 18, 2026 03:13
abcfb10 to
b276897
Compare
jbedard
marked this pull request as ready for review
July 18, 2026 03:43
acozzette
reviewed
Jul 20, 2026
acozzette
approved these changes
Jul 20, 2026
thesayyn
reviewed
Jul 20, 2026
| rules_ts_ext.deps( | ||
| ts_version_from = "//:package.json", | ||
| typescript = use_extension("@aspect_rules_ts//ts:extensions.bzl", "typescript") | ||
| typescript.toolchain( |
Member
There was a problem hiding this comment.
does this mean we have a typescript toolchain now?
Member
Author
There was a problem hiding this comment.
I guess it's not actually a toolchain, so we could potentially (for now) stick with the .deps() name? That also reduces the breaking change.
Regarding toolchains... see #951 - we can debate the correctness there, but maybe we should also wait till then to do this rename?
Member
There was a problem hiding this comment.
eh i am fine with breaking changes, i was just curious. i'd be happy to see #951 land honestly. so that we can use configurability and platforms and toolchains to configure typescript in the graph.
thesayyn
approved these changes
Jul 20, 2026
acozzette
approved these changes
Jul 22, 2026
jbedard
force-pushed
the
941-extension-renaming
branch
from
July 31, 2026 23:24
b276897 to
aadb6a2
Compare
Rename the module extension surface so a MODULE.bazel reads self-documenting:
typescript = use_extension("@aspect_rules_ts//ts:extensions.bzl", "typescript")
typescript.toolchain(version = "5.6.2") # or version_from = "//:package.json"
use_repo(typescript, "npm_typescript")
- Extension symbol `ext` -> `typescript`, matching rules_js's convention of
naming the extension after its domain concept rather than a generic "ext".
- Tag class `deps` -> `toolchain`: the tag selects the TypeScript compiler
version backing the toolchain; it does not declare dependencies.
- Attrs lose their redundant `ts_` prefix inside the `typescript.toolchain`
context: `ts_version`/`ts_version_from`/`ts_integrity` ->
`version`/`version_from`/`integrity`.
The default repo name `npm_typescript` and the multi-toolchain `name` escape
hatch are unchanged. The internal `npm_dependencies` repo rule (shared with the
WORKSPACE path) is untouched.
Fixes aspect-build#941
BREAKING CHANGES:
The bzlmod module extension API has changed. Update MODULE.bazel:
# before
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext")
rules_ts_ext.deps(ts_version = "5.6.2")
use_repo(rules_ts_ext, "npm_typescript")
# after
typescript = use_extension("@aspect_rules_ts//ts:extensions.bzl", "typescript")
typescript.toolchain(version = "5.6.2")
use_repo(typescript, "npm_typescript")
Renames:
- `use_extension(..., "ext")` -> `use_extension(..., "typescript")`
- `.deps(...)` -> `.toolchain(...)`
- `ts_version` -> `version`
- `ts_version_from` -> `version_from`
- `ts_integrity` -> `integrity`
The local variable bound to `use_extension` (commonly `rules_ts_ext`) is
arbitrary and may be named anything; the examples now use `typescript`. The
`npm_typescript` repo name and the `name` attribute for registering additional
TypeScript versions are unaffected.
jbedard
force-pushed
the
941-extension-renaming
branch
from
August 3, 2026 03:58
aadb6a2 to
875cf1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rename the module extension surface so a MODULE.bazel reads self-documenting:
ext->typescript, matching rules_js's convention of naming the extension after its domain concept rather than a generic "ext".deps->toolchain: the tag selects the TypeScript compiler version backing the toolchain; it does not declare dependencies.ts_prefix inside thetypescript.toolchaincontext:
ts_version/ts_version_from/ts_integrity->version/version_from/integrity.The default repo name
npm_typescriptand the multi-toolchainnameescape hatch are unchanged. The internalnpm_dependenciesrepo rule (shared with the WORKSPACE path) is untouched.Fix #941
Changes are visible to end-users: yes
BREAKING CHANGES:
The bzlmod module extension API has changed. Update MODULE.bazel:
before
after
Renames:
use_extension(..., "ext")->use_extension(..., "typescript").deps(...)->.toolchain(...)ts_version->versionts_version_from->version_fromts_integrity->integrityThe local variable bound to
use_extension(commonlyrules_ts_ext) is arbitrary and may be named anything; the examples now usetypescript. Thenpm_typescriptrepo name and thenameattribute for registering additional TypeScript versions are unaffected.Test plan