oxc/npm/oxc-parser
2024-12-04 19:43:22 +08:00
..
scripts chore(doc): replace main/master to tag/commit to make the url always accessible (#7298) 2024-11-16 21:00:30 +08:00
.gitignore feat(napi/parser)!: add typings to napi/parser (#6796) 2024-10-24 13:08:59 +00:00
CHANGELOG.md release(crates): v0.39.0 (#7643) 2024-12-04 19:43:22 +08:00
package.json release(crates): v0.39.0 (#7643) 2024-12-04 19:43:22 +08:00
README.md refactor(oxc_napi): remove source_map - moved to its crate (#7614) 2024-12-03 14:42:34 +00:00

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 filename = 'test.tsx';

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

function test(ret) {
  assert(ret.program.body.length == 1);
  assert(ret.errors.length == 0);
}