gojax
v0.1.2
Published
Gojax CLI - Async JS runtime and bundler written in pure Go
Readme
Gojax 🚀
Gojax is a high-performance, asynchronous JavaScript & TypeScript runtime and bundler built entirely in pure Go. Designed to provide a native developer experience (DX) without depending on Node.js or heavy environments (like V8), it directly integrates a custom Event Loop, Asynchronous Native Bindings, concurrent testing, and high-speed packaging into a single Universal CLI.
Key Features
- ⚡ Blazing Fast Bundler: Integrated with ESBuild for instantly transpiling and combining TS/JSX modules.
- 🔄 Independent Event Loop: A custom Job Queue manages async operations natively via Go Channels & Goroutines.
- 📦 Built-in Package Manager: Aggressive concurrent HTTP polling downloading cleanly directly from the NPM registry to
node_modules. No external tools required. - 🧪 Fast Testing API: A native test runner (
gojax test) that parallelizes test suites without idle sleep times, injectingtest()andexpect()dynamically. - 🌐 100% Cross-Platform: True universal execution. Download the binary or install via NPM, it hooks to your native OS transparently (
win32,linux,darwin). - 💡 Zero-Config TypeScript & JSX: Out-of-the-box support for TypeScript and native JSX compilation by injecting dynamic factories and TS configuration on the fly.
Installation
Gojax can be installed universally via NPM. Our node wrapper intelligently detects your OS and proxies standard I/O streams directly to the highly-optimized compiled Go binary.
# Global installation via NPM
npm install -g gojax
# Or use it directly via npx
npx gojax --helpBuild from source (Requires Go)
git clone https://github.com/your-username/Gojax.git
cd Gojax
go mod download
# Compile for your native system
go build -o bin/gojax main.go
# Alternatively, cross-compile:
GOOS=windows go build -o bin/gojax-win.exe main.go
GOOS=linux go build -o bin/gojax-linux main.go
GOOS=darwin go build -o bin/gojax-darwin main.goUsage & Commands
1. Execute a Script (run)
Run any ECMAScript, TypeScript or JSX file directly on the Gojax engine. Native async operations (like Custom fs.readFileAsync) are naturally resolved using internal Goroutines.
gojax run app.ts2. Bundle an Application (build)
Combines local .ts, .tsx, or .js entries and their modules into a single optimized dist/out.js execution file.
gojax build src/index.tsx3. Native Test Runner (test)
A totally parallel test execution engine that scans your repository for *.test.ts/js.
# Evaluates every suite concurrently
gojax test .
# Specify a directory
gojax test src/components/Example of supported syntax injected at runtime:
test("Math works", () => {
expect(2 + 2).toBe(4);
});4. Install Dependencies (install)
Ultra-fast concurrent package installations interacting directly with the latest Tarballs from NPM Registry. Built utilizing aggressive HTTP connection pooling.
gojax install is-even chalk left-pad5. Initialize IntelliSense (init)
Scaffolds a perfectly optimized tsconfig.json and gojax.d.ts definitions in your current directory. Allows IDEs (like VSCode) to autocomplte Gojax's native functions.
gojax initArchitecture Overview
Gojax breaks down modern runtimes (like Node or Bun) and rebuilds them conceptually in pure Go.
- Packages / CLI Structure: Managed optimally via Cobra.
- Compiler: Uses
evanw/esbuild/pkg/apito perform AST manipulations entirely in RAM using lazy configurations (Singleton TSConfig parsing). - Runtime: Evaluates JS expressions over the ECMAScript 5.1+ specification utilizing
dop251/goja, abstracting standard functions likeconsole.logto write to Stdout.
Made with ❤️ using Go.
