81 releases (breaking)

Uses new Rust 2024

new 0.70.0 May 15, 2025
0.68.1 May 4, 2025
0.61.2 Mar 23, 2025
0.44.0 Dec 25, 2024
0.22.1 Jul 28, 2024

#25 in #typescript-parser

Download history 360/week @ 2025-01-26 418/week @ 2025-02-02 942/week @ 2025-02-09 585/week @ 2025-02-16 561/week @ 2025-02-23 1700/week @ 2025-03-02 1285/week @ 2025-03-09 1075/week @ 2025-03-16 719/week @ 2025-03-23 565/week @ 2025-03-30 1048/week @ 2025-04-06 1664/week @ 2025-04-13 1918/week @ 2025-04-20 1001/week @ 2025-04-27 1808/week @ 2025-05-04 1440/week @ 2025-05-11

6,342 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–22MB
~253K SLoC

OSZAR »