oxc/npm/oxc-parser
ottomated 7d12669d68
fix(types): move @oxc-project/types to dependencies (#6909)
Hotfix. NPM doesn't install devDependencies automatically, so types were
missing.
2024-10-26 10:26:54 +08:00
..
scripts feat(napi/parser)!: add typings to napi/parser (#6796) 2024-10-24 13:08:59 +00:00
.gitignore feat(napi/parser)!: add typings to napi/parser (#6796) 2024-10-24 13:08:59 +00:00
CHANGELOG.md release(crates): v0.34.0 (#6908) 2024-10-26 09:39:53 +08:00
package.json fix(types): move @oxc-project/types to dependencies (#6909) 2024-10-26 10:26:54 +08:00
README.md docs(napi): Remove JSON.parse from example (#6836) 2024-10-24 14:49:44 +01: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 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);
}