79 releases (52 breaking)

Uses new Rust 2024

new 0.68.1 May 4, 2025
0.67.0 Apr 27, 2025
0.61.2 Mar 23, 2025
0.44.0 Dec 25, 2024
0.22.1 Jul 28, 2024

#26 in #typescript-parser

Download history 787/week @ 2025-01-13 557/week @ 2025-01-20 384/week @ 2025-01-27 315/week @ 2025-02-03 1029/week @ 2025-02-10 530/week @ 2025-02-17 596/week @ 2025-02-24 1836/week @ 2025-03-03 1202/week @ 2025-03-10 1145/week @ 2025-03-17 563/week @ 2025-03-24 690/week @ 2025-03-31 1013/week @ 2025-04-07 1638/week @ 2025-04-14 2061/week @ 2025-04-21 977/week @ 2025-04-28

5,869 downloads per month

MIT license

77KB
1K SLoC

Oxc Transform

This is alpha software and may yield incorrect results, feel free to submit a bug report.

TypeScript and React JSX Transform

import assert from 'assert';
import oxc from 'oxc-transform';

const { code, declaration, errors } = oxc.transform(
  'test.ts',
  'class A<T> {}',
  {
    typescript: {
      declaration: true, // With isolated declarations in a single step.
    },
  },
);

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 oxc from 'oxc-transform';

const { map, code, errors } = oxc.isolatedDeclaration('test.ts', 'class A {}');

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

API

See index.d.ts.

export declare function transform(
  filename: string,
  sourceText: string,
  options?: TransformOptions,
): TransformResult;

export function isolatedDeclaration(
  filename: string,
  sourceText: string,
  options?: IsolatedDeclarationsOptions,
): IsolatedDeclarationsResult;

Dependencies

~12–18MB
~250K SLoC