Skip to content

Latest commit

 

History

History
81 lines (52 loc) · 1.92 KB

File metadata and controls

81 lines (52 loc) · 1.92 KB

Quickstart: build and use bamts

This tutorial builds the pre-release CLI from source, type-checks a TypeScript file, emits a native host executable, and runs that executable.

1. Install prerequisites

You need:

  • Rust 1.97.1 or later
  • Cargo
  • A Linux x64 host matching the current native output target

2. Build the CLI

From the repository root:

cargo build --release -p bamts-cli

The executable is written to target/release/bamts.

3. Create a TypeScript file

Create hello.ts:

const message: string = "hello from bamts";
process.stdout.write(`${message}\n`);

4. Type-check without emitting files

target/release/bamts --noEmit --pretty false hello.ts

A successful invocation exits with status 0. Type errors are reported as diagnostics and produce a nonzero status.

5. Emit a native executable

target/release/bamts hello.ts --outDir out

Run the emitted host binary:

./out/hello

Expected output:

hello from bamts

6. Explore compiler options

target/release/bamts --help
target/release/bamts --help --all

The CLI follows the TypeScript 7.0.2 tsc argument model. It supports direct source-file compilation, tsconfig.json discovery, --project, --build, and response files. The former check, run, compile, explain, --target jit, and --target aot forms are not public commands.

Resource limits

The frontend enforces two source-input budgets:

  • One source file can contain at most 16 MiB (16,777,216 bytes).
  • One compilation session can load at most 256 MiB (268,435,456 bytes) across all source files.

Exceeding a budget produces a diagnostic and stops compilation before later frontend stages.

Next steps