A roblox-ts fork in Go. goblox is the roblox-ts compiler (TypeScript to Luau) ported
to Go on top of typescript-go, the native TypeScript 7 compiler. It is a
drop-in replacement for rbxtsc: same flags, same tsconfig.json and rbxts options, same out/ folder, same Luau.
A 40-second rbxtsc build of a ~500-file game takes 5 seconds with goblox, and an edit rebuilds in under a second.
With goblox -w running, a one-shot goblox build of the same project takes it over and finishes in well under a
second.
npm i -D goblox # or: bun add -d goblox
npx goblox # instead of rbxtsc
npx goblox -w # instead of rbxtsc -wThe npm package ships prebuilt native binaries for Windows, macOS and Linux (x64 and arm64), so you don't need Go to
use it. typetorch uses goblox automatically when it is installed.
gnome-game is a real Roblox game with 487 .ts/.tsx files (~80k lines), using Flamework-style DI and
@typetorch/transformer. The table shows medians of 3 runs, wall clock from process start to exit.
Laptop: Intel i5-4210U (2 cores / 4 threads), 3.7 GB RAM, Linux.
| Scenario | rbxtsc | goblox | Speedup |
|---|---|---|---|
Fresh build (no out/) |
39.10 s | 4.95 s | 7.9× |
| Rebuild, nothing changed | 4.28 s | 0.51 s | 8.4× |
| Comment edited in a leaf file | 5.05 s | 0.88 s | 5.7× |
| Comment edited in a widely imported file | 28.85 s | 0.80 s | 36× |
| New export in a widely imported file | 28.80 s | 3.93 s | 7.3× |
| Peak memory, fresh build | 885 MB | 650 MB | 0.73× |
Desktop: 12 threads, 32 GB RAM, Windows. These runs used an older 407-file snapshot of the same game.
| Scenario | rbxtsc | goblox | Speedup |
|---|---|---|---|
| Fresh build | 18.65 s | 2.11 s | 8.8× |
| Rebuild, nothing changed | 5.73 s | 0.43 s | 13× |
| Comment in a widely imported file | 14.85 s | 0.62 s | 24× |
| New export in a leaf file | 6.35 s | 0.60 s | 11× |
| New export in a widely imported file (160 files) | 14.74 s | 1.59 s | 9.3× |
The same laptop, gnome-game at 647 files, goblox 0.2.4 and later:
| Scenario | goblox |
|---|---|
goblox -w: save a leaf file → "Found 0 errors" |
~0.3 s |
goblox build while goblox -w runs, nothing changed |
0.2–0.5 s |
goblox build while goblox -w runs, after a leaf edit |
~0.5 s |
goblox build with no watcher (in-process, same project) |
~7 s |
Idle goblox -w: CPU |
~1% of a core |
Idle goblox -w: memory |
~270 MB |
Idle goblox -w: memory after an hour without a build (hibernated) |
~55 MB |
- Build handoff. A one-shot
goblox buildasks a runninggoblox -wof the same tsconfig to do the build, and prints exactly what an in-process build would: same files, same output, same exit code. The watcher checks every input by content, not just by modification time, before it reuses anything. If no watcher answers, or its version, flags or environment differ, the build runs in-process as before.--noHandofforGOBLOX_NO_HANDOFF=1turns it off. It works with plaingoblox -w; nothing else needs to run. - Cheap idle. The watcher looks only at the files the build reads (the source folders, the tsconfig chain, the
Rojo project,
package.jsonand the lockfiles), not the whole project folder. - Native file events. The OS reports changes (fanotify or inotify on Linux, FSEvents on macOS,
ReadDirectoryChangesW on Windows) and the watcher looks at once instead of at its next poll. The events only wake
it: a comparison of the files still decides what changed, and a slow poll stays on as a net.
--usePollingturns the events off. - Hibernate. After
--hibernateAfterwithout a build (default1h), the watcher drops what it keeps in memory and keeps polling. The next change rebuilds from the incremental cache on disk.
Where the speed comes from:
- Native, parallel type checking. typescript-go runs the checker in parallel on native code, so there is no Node startup or JIT warm-up.
- The plugin runs in-process.
@typetorch/transformeris ported to Go and runs inside the compiler, in parallel across files. - A tuned runtime. goblox runs Go's garbage collector at GOGC 400 during builds (with a memory limit of a third
of the RAM;
GOGC/GOMEMLIMIToverride it) and is compiled with profile-guided optimization from a real build. - Incremental builds that skip comment-only edits. goblox recompiles only the files whose output can change. An edit that only changes comments in a shared file recompiles nothing that depends on it. rbxtsc recompiles all 183 of that file's dependents.
Full methodology, profiles and step breakdowns: docs/goblox/BENCHMARKS.md and docs/goblox/BENCHMARKS-espresso.md.
goblox is checked against rbxtsc built from roblox-ts 3.0.0 (see CONFORMANCE.md):
| Check | Result |
|---|---|
| roblox-ts transform fixtures, Luau compared byte for byte | 73 / 73 |
| roblox-ts runtime specs, run under Lune | 874 / 874 |
The same specs with --optimizedLoops |
874 / 874 |
| Diagnostic fixtures: code, message, span and printed text | 169 / 169 |
| CLI scenarios: exit code, stdout, stderr and files written | 64 (57 byte for byte, 7 intentional differences) |
Real games compile with the same imports and DI metadata as rbxtsc. Known differences are listed in CLI.md.
| Flag | What it does |
|---|---|
--stripComments |
Leaves source comments and macro markers out of the output. The header and --! directives at the top of a file stay. Also available as "rbxts": { "stripComments": true } in tsconfig.json. Unlike removeComments, it keeps incremental builds |
--noIncremental |
Compiles every file, ignoring the incremental cache |
--emitFirst |
Watch mode: writes the files without errors, then reports the errors |
--noHandoff |
Builds in this process even when a goblox -w of the project is running. Also GOBLOX_NO_HANDOFF=1. On a watcher: don't take builds |
--hibernateAfter <duration> |
Watch mode: drops the in-memory state after this long without a build (default 1h, 0 = never) |
--checkers <n> |
Number of parallel type checkers (default: 4 with 8 or more threads) |
--timing |
Prints the build time |
Every compiled file starts with -- goblox, a roblox-ts fork. goblox v<version>, roblox-ts v3.0.0.
Incremental state lives next to the tsbuildinfo (out/tsconfig.goblox.tsbuildinfo), so set "incremental": true
in tsconfig.json.
TypeScript transformer plugins written in JS can't run inside a Go compiler. goblox compiles
@typetorch/transformer into the release binary instead, ported to Go
(guards for networking, DI ids, $print/$warn/$git and user macros). Other JS plugins listed in tsconfig are
skipped with a warning, and typetorch doctor reports them. See PLUGINS.md.
goblox is a fork of typescript-go, because Go's internal/ rule only lets code inside the module use the compiler
packages. The goblox code is:
| Path | Contents |
|---|---|
cmd/goblox |
The CLI |
internal/roblox/transform |
The roblox-ts transform (TypeScript AST to Luau AST) |
internal/roblox/luau |
Luau AST and renderer |
internal/roblox/project |
Builds, watch mode, incremental state, include files |
internal/roblox/rojo |
Rojo project resolution |
pkg/goblox |
The plugin API that @typetorch/transformer builds on |
cmd/goblox-fixtures |
The conformance harness against an rbxtsc oracle |
npm/ |
The npm launcher and platform packages |
Everything else is upstream typescript-go. More docs are in docs/goblox: CLI.md, PORTING.md and RELEASING.md.
git clone https://github.com/typetorch/goblox-ts && cd goblox-ts
go build -o goblox ./cmd/goblox # without the typetorch plugin
go build -tags typetorch -o goblox ./cmd/goblox # with it (needs typetorch/transformer, see RELEASING.md)Releases are built by CI when a v* tag is pushed. They publish goblox, @typetorch/goblox and the
@typetorch/goblox-<os>-<arch> binaries to npm.
goblox is a fork of typescript-go (Apache-2.0, see LICENSE and NOTICE.txt) and a port of roblox-ts (MIT). It is not affiliated with Microsoft or the roblox-ts project.