Skip to content

Parser ​

A high-performance JavaScript / TypeScript parser written in Rust, powering other tools in the Oxc project.

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.

Print ​

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.