mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
6c01fd7480
## [0.30.5] - 2024-09-29 ### Features -15552acnapi/transform: Display semantic error (#6160) (Boshen) -f50fdcdnapi/transform: Make react refresh option take a boolean (#6146) (Boshen) ### Bug Fixes -f27d59fnapi/transform: Remove confusing `jsx` option (#6159) (Boshen) -bfd1988transformer/react: Should not collect use-hooks if it's a nested member expression (#6143) (Dunqing) ### Refactor -ab187d1codegen: Restrict visibility of internal methods (#6145) (DonIsaac) -375bebetransformer: Improve parsing React pragmas (#6138) (overlookmotel) -0836f6btransformer: Move parsing pragmas into TS transform (#6137) (overlookmotel) -30424fatransformer: TS transforms only store options they need (#6135) (overlookmotel) --------- Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
The JavaScript Oxidation Compiler
See index.d.ts for parseSync and parseAsync API.
ESM
import assert from 'assert';
import oxc from 'oxc-parser';
function test(ret) {
const program = JSON.parse(ret.program);
assert(program.body.length == 1);
assert(ret.errors.length == 0);
}
const sourceText = "let foo: Foo = 'foo';";
const options = {
sourceFilename: 'text.tsx', // the extension is used to determine which dialect to parse
};
test(oxc.parseSync(sourceText, options));
async function main() {
test(await oxc.parseAsync(sourceText, options));
}
main();