144 releases (breaking)

Uses new Rust 2024

new 0.120.0 Mar 16, 2026
0.118.0 Mar 12, 2026
0.106.0 Dec 29, 2025
0.99.0 Nov 24, 2025
0.22.1 Jul 28, 2024

#1997 in Programming languages

Download history 1321/week @ 2025-11-24 2020/week @ 2025-12-01 2874/week @ 2025-12-08 3283/week @ 2025-12-15 2118/week @ 2025-12-22 2238/week @ 2025-12-29 2975/week @ 2026-01-05 4175/week @ 2026-01-12 3309/week @ 2026-01-19 3262/week @ 2026-01-26 2486/week @ 2026-02-02 2890/week @ 2026-02-09 2135/week @ 2026-02-16 2486/week @ 2026-02-23 2640/week @ 2026-03-02 2645/week @ 2026-03-09

10,087 downloads per month

MIT license

90KB
1K SLoC

Oxc Transform

See usage instructions.

TypeScript and React JSX Transform

import assert from "assert";
import { transformSync } from "oxc-transform";

const { code, declaration, errors } = transformSync("test.ts", "class A<T> {}", {
  typescript: {
    declaration: true, // With isolated declarations in a single step.
  },
});
// or `await transform(filename, code, options)`

assert.equal(code, "class A {}\n");
assert.equal(declaration, "declare class A<T> {}\n");
assert(errors.length == 0);

Isolated Declarations for Standalone DTS Emit

Conforms to TypeScript compiler's --isolatedDeclarations .d.ts emit.

Usage

import assert from "assert";
import { isolatedDeclarationSync } from "oxc-transform";

const { map, code, errors } = isolatedDeclarationSync("test.ts", "class A {}");
// or `await isolatedDeclaration(filename, code, options)`

assert.equal(code, "declare class A {}\n");
assert(errors.length == 0);

API

Transform Functions

// Synchronous transform
transformSync(
  filename: string,
  sourceText: string,
  options?: TransformOptions,
): TransformResult

// Asynchronous transform
transform(
  filename: string,
  sourceText: string,
  options?: TransformOptions,
): Promise<TransformResult>

Isolated Declaration Functions

// Synchronous isolated declaration
isolatedDeclarationSync(
  filename: string,
  sourceText: string,
  options?: IsolatedDeclarationsOptions,
): IsolatedDeclarationsResult

// Asynchronous isolated declaration
isolatedDeclaration(
  filename: string,
  sourceText: string,
  options?: IsolatedDeclarationsOptions,
): Promise<IsolatedDeclarationsResult>

Use the Sync versions for synchronous operations. Use async versions for asynchronous operations, which can be beneficial in I/O-bound or concurrent scenarios, though they add async overhead.

See index.d.ts for complete type definitions.

Supports WASM

See https://stackblitz.com/edit/oxc-transform for usage example.

Dependencies

~14MB
~262K SLoC