71 releases (45 breaking)

Uses new Rust 2024

new 0.61.2 Mar 23, 2025
0.60.0 Mar 18, 2025
0.44.0 Dec 25, 2024
0.38.0 Nov 26, 2024
0.22.1 Jul 28, 2024

#29 in #javascript-linter

Download history 1182/week @ 2024-12-04 882/week @ 2024-12-11 697/week @ 2024-12-18 657/week @ 2024-12-25 109/week @ 2025-01-01 540/week @ 2025-01-08 768/week @ 2025-01-15 504/week @ 2025-01-22 403/week @ 2025-01-29 457/week @ 2025-02-05 876/week @ 2025-02-12 566/week @ 2025-02-19 789/week @ 2025-02-26 1905/week @ 2025-03-05 1094/week @ 2025-03-12 1197/week @ 2025-03-19

5,098 downloads per month

MIT license

73KB
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 --isolated-declaration .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

~11–18MB
~249K SLoC