oxc/npm/oxc-parser
ottomated b075982eaa fix(types): Change @oxc/types package name (#6874)
Closes #6862.

Possible options:
- `oxc-types`
- `@oxc-project/types`
- `@oxc-ast/types`
- `oxc-ast-types`
2024-10-24 20:04:09 +00: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.33.0 (#6843) 2024-10-24 10:29:22 +08:00
package.json fix(types): Change @oxc/types package name (#6874) 2024-10-24 20:04:09 +00: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);
}