https://github.com/stackb/rules_tsickle
Bazel rules to drive the angular/tsickle tool
https://github.com/stackb/rules_tsickle
Last synced: 20 days ago
JSON representation
Bazel rules to drive the angular/tsickle tool
- Host: GitHub
- URL: https://github.com/stackb/rules_tsickle
- Owner: stackb
- License: apache-2.0
- Created: 2025-10-05T03:08:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-11-03T23:12:12.000Z (4 months ago)
- Last Synced: 2026-01-10T20:20:38.597Z (about 2 months ago)
- Language: Starlark
- Size: 457 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rules_tsickle
## What?
`rules_tsickle` provides a `closure_ts_compile` rule that transforms `.ts` files
into closure-annotated `.js` files. It contains a vendored copy of
(which was archived in May 2025).
## Why?
The primary reason `rules_tsickle` was created was to perform `.ts` to `.js`
translation of for
. Several
of the `soyutils` files in that repo have closure dependencies like:
```js
goog.require('google3.third_party.javascript.safevalues.index');
```
No open-source copy of the translated `.js` files could be located, so
`rules_tsickle` was created to perform that translation.
## How?
To use `rules_tsickle` in your own bazel workspace (lookup most recent version):
```py
bazel_dep("rules_tsickle", version = "0.0.0")
```
Then, in a package containing `.ts` and/or `.d.ts` files:
```py
load("//rules:defs.bzl", "closure_ts_compile")
closure_ts_compile(
name = "index",
srcs = ["index.ts"],
)
```
`bazel build :index` will:
- download npm deps and prepare the `js_binary` tsickle runner
(`//tools/tsicklecompiler`).
- run the tool, which roughly works as follows:
- prepare an internal/minimal `tsconfig.json` configuration.
- runs `tsc` over the inputs to generate a `ts.Program`
- runs tsickle over the `ts.Program` to AST-rewrite/transform it.
- emits the transformed `.js` files.
- output files:
- each `{basename}.ts` will produce an equivalent `{basename}.js` file
- if any `.d.ts` files are present, a single `{name}-externs.js` file will be
produced.
`closure_ts_compile` can take `deps` on other `closure_ts_compile` rules. The
source `.ts` files will be made available to `tsc`. Only direct `.ts` files in
the primary rule will emitted.
### Versioning
The `rules_tsickle` initial version is `1.0.0` not because of a long history of
development, but because it is anticipated this repo will not see a large amount
of future development.