Oxc provides multiple tools and packages for JavaScript/TypeScript development. Choose the installation method that fits your needs.
oxlint (Linter)
Install oxlint as a dev dependency in your project:
npm install --save-dev oxlint
Or run it directly without installation:
Current version: 1.51.0Node.js requirement: ^20.19.0 || >=22.12.0
Install oxfmt as a dev dependency in your project:
npm install --save-dev oxfmt
Or run it directly without installation:
Current version: 0.36.0Node.js requirement: ^20.19.0 || >=22.12.0
Node.js Packages
oxc-parser
The fastest JavaScript/TypeScript parser written in Rust, available as a Node.js package.
Basic usage:
import { parseSync } from "oxc-parser";
const result = parseSync("test.js", "const x = 1;");
console.log(result.program.body.length); // 1
console.log(result.errors); // []
With options:
import { parse } from "oxc-parser";
// Async parsing
const result = await parse("test.ts", code, {
lang: "ts",
sourceType: "module",
showSemanticErrors: true,
});
Current version: 0.116.0Supports JS, TS, JSX, TSX, and DTS files
TypeScript, React, and modern JavaScript transformation (Babel alternative).
npm install oxc-transform
Basic usage:
import { transformSync } from "oxc-transform";
const result = transformSync("source.tsx", code, {
typescript: true,
});
console.log(result.code);
With TypeScript declarations:
import { transformSync } from "oxc-transform";
const result = transformSync("test.ts", "export class A<T> {}", {
typescript: { declaration: {} },
sourcemap: true,
});
console.log(result.declaration); // "export declare class A<T> {}\n"
console.log(result.declarationMap); // Source map for declarations
Target ES2015:
import { transformSync } from "oxc-transform";
const result = transformSync("test.js", "const add = (a, b) => a + b;", {
target: "es2015",
});
console.log(result.code);
Current version: 0.116.0Supports TypeScript, JSX/TSX, and ES6+ transformations
oxc-minify
High-performance JavaScript minifier.
Basic usage:
import { minifySync } from "oxc-minify";
const result = minifySync("test.js", code, {
mangle: true,
sourcemap: true,
});
console.log(result.code);
console.log(result.map);
Disable compression and mangling:
import { minifySync } from "oxc-minify";
const result = minifySync("test.js", code, {
compress: false,
mangle: false,
codegen: { removeWhitespace: false },
});
Tree-shaking with pure annotations:
import { minifySync } from "oxc-minify";
const code = "/* @__PURE__ */ foo(); bar();";
const result = minifySync("test.js", code, {
compress: {},
});
console.log(result.code); // "bar();"
Current version: 0.116.0Supports compression, mangling, and tree-shaking
Rust Crates
Oxc provides individual crates for building custom JavaScript tools in Rust.
Main Crate
The oxc crate is the main entry point that includes all components:
[dependencies]
oxc = "0.116.0"
Individual Crates
You can also use individual crates for specific functionality:
[dependencies]
# Parser - JS/TS parser with AST
oxc_parser = { version = "0.116.0", features = ["regular_expression"] }
# AST definitions and utilities
oxc_ast = "0.116.0"
# Semantic analysis (symbols, scopes)
oxc_semantic = "0.116.0"
# Code generation
oxc_codegen = "0.116.0"
# Transformer (Babel-like transformations)
oxc_transformer = "0.116.0"
# Minifier
oxc_minifier = "0.116.0"
# Memory management
oxc_allocator = "0.116.0"
# AST traversal utilities
oxc_traverse = "0.116.0"
# Error reporting
oxc_diagnostics = "0.116.0"
# Module resolution
oxc_resolver = "11.16.3"
# Source map generation
oxc_sourcemap = "6.0.1"
Rust version: MSRV 1.91.0 (Minimum Supported Rust Version)All crates are published at version 0.116.0
Key Crates Overview
oxc_parser
Fast JavaScript/TypeScript parser producing an AST
oxc_semantic
Semantic analysis with symbol tables and scope information
oxc_transformer
Code transformation (TypeScript, JSX, ES6+)
oxc_minifier
Code minification with compression and mangling
oxc_codegen
Generate code from AST with source maps
oxc_traverse
AST traversal utilities with visitor pattern
All Oxc tools support multiple platforms and architectures:
- macOS: x86_64, ARM64 (Apple Silicon)
- Linux: x86_64, ARM64, ARMv7, RISC-V, s390x (GNU and musl)
- Windows: x86_64, ARM64, x86
- FreeBSD: x86_64
- Android: ARM64, ARMv7
- WASM: wasm32-wasip1-threads (browser and Node.js)
Pre-built binaries are automatically downloaded during installation for supported platforms.
Verification
Verify your installation:
oxlint
oxfmt
Node.js Packages
Rust
// Create test.js
import { parseSync } from "oxc-parser";
console.log(parseSync("test.js", "const x = 1;").program);
cargo --version
rustc --version
Ensure Rust 1.91.0 or later is installed.
Next Steps
Quick Start
Get started with oxlint in minutes
Linter Guide
Configure and customize oxlint
Formatter Guide
Format your code with oxfmt
API Reference
Explore the full API documentation