Parser (original) (raw)

This is production ready.

Features

Installation

Node.js

Rust

Use the umbrella crate oxc or the individual oxc_ast and oxc_parser crates.

Rust usage example can be found here.

After parsing and transforming, you can print code.

Here's a direct example using esrap (parse in reverse!):

js

import { print } from "esrap";
import ts from "esrap/languages/ts";
import { parseSync } from "oxc-parser";

const { program } = parseSync("test.js", 'alert("hello oxc & esrap");');
const { code } = print(program, ts());

console.log(code); // alert("hello oxc & esrap");

INFO

Today, comments are not printed. It will be supported thanks to oxc-parser #13285.