oxc-parser

v0.34.0
Oxc Parser Node API
Parser

The JavaScript Oxidation Compiler

See index.d.ts for parseSync and parseAsync API.

import assert from 'assert';
import oxc from 'oxc-parser';

const sourceText = "let foo: Foo = 'foo';";
// Filename extension is used to determine which
// dialect to parse source as
const options = { sourceFilename: 'text.tsx' };

test(oxc.parseSync(sourceText, options));
test(await oxc.parseAsync(sourceText, options));

function test(ret) {
  assert(ret.program.body.length == 1);
  assert(ret.errors.length == 0);
}
npm i oxc-parser

Metadata

  • MIT
  • Whatever
  • Boshen and oxc contributors
  • released 10/26/2024

Downloads

Maintainers