Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork683
⚓ A collection of JavaScript tools written in Rust.
License
oxc-project/oxc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The Oxidation Compiler is a collection of high-performance tools for JavaScript and TypeScript written in Rust.
Our goal is to enable a new generation of faster, more reliable development tools by providing:
- Performance: 2-100x faster than existing JavaScript tools
- Reliability: 100% compatibility with JavaScript and TypeScript standards
- Modularity: Use individual tools or compose them into complete toolchains
- Developer Experience: Clear error messages and seamless editor integration
We are building a parser, linter, formatter, transformer, minifier, resolver ... all written in Rust.
For more information, check out our documentation atoxc.rs and architecture guide inARCHITECTURE.md.
Oxc is a project ofVoidZero, see our announcementAnnouncing VoidZero - Next Generation Toolchain for JavaScript.
If you have requirements for JavaScript tools at scale, pleaseget in touch!
- Rolldown uses theoxc crate for parsing and transformation.
- Nova engine uses theoxc crate for parsing.
- Rolldown,swc-node andknip use theoxc_resolver crate for module resolution.
- Projects and companies likePreact,Shopify, ByteDance and Shopee uses oxlint for linting.
- ...and many more
SeeCONTRIBUTING.md for guidance.
Check out some of thegood first issues or ask us onDiscord.
If you are unable to contribute by code, you can still participate by:
- Add aGitHub Star to the project.
- Join us onDiscord.
- Follow me on X and post about this project.
The linter is ready to catch mistakes for you. It comes with 93 rules turned on by default (out of 430+ in total) and no configuration is required.
To get started, runoxlint or vianpx
:
npx oxlint@latest
To give you an idea of its capabilities, here is an example from thevscode repository, which finishes linting 4800+ files in 0.7 seconds.
- The parser aims to be the fastest Rust-based ready-for-production parser.
- The linter is more than 50 times faster thanESLint, and scales with the number of CPU cores.
Individual crates are published, you may use them to build your own JavaScript tools.
- The umbrella crateoxc exports all public crates from this repository.
- The AST and parser cratesoxc_ast andoxc_parser are production ready.
- The resolver crateoxc_resolver for module resolution is also production ready.
- Example usages of these crates can be found in their respective
crates/*/examples
directory.
We have optimized Rust compilation speed to ensure developing your own Oxc-based tools remains efficient.OurCI runs complete in approximately 3 minutes.
- via napi:oxc-parser,oxc-transform
Oxc maintains its own AST and parser, which is by far the fastest and most conformant JavaScript and TypeScript (including JSX and TSX) parser written in Rust.
As the parser often represents a key performance bottleneck in JavaScript tooling, any minor improvements can have a cascading effect on our downstream tools.
Ourbenchmark reveals that the Oxc parser surpasses the speed of theswc parser by approximately 3 times and theBiome parser by 5 times.
The linter embraces convention over configuration, eliminating the need for extensive configuration and plugin setup.Unlike other linters likeESLint, which often require intricate configurations and plugin installations (e.g.@typescript-eslint),our linter only requires a single command that you can immediately run on your codebase:
npx oxlint@latest
The linter is 50 - 100 times faster thanESLint depending on the number of rules and number of CPU cores used.It completes in less than a second for most codebases with a few hundred files and completes in a few seconds forlarger monorepos. Seebench-javascript-linter for details.
As an upside, the binary is approximately 5MB, whereasESLint and its associated plugin dependencies can easily exceed 100.
You may also download the linter binary from thelatest release tag as a standalone binary,this lets you run the linter without a Node.js installation in your CI.
Module resolution plays a crucial role in JavaScript tooling, especially for tasks like multi-file analysis or bundling. However, it can often become a performance bottleneck.To address this, we developedoxc_resolver.
The resolver is production-ready and is currently being used inRolldown. Usage and examples can be found in its ownrepository.
A transformer is responsible for turning higher versions of ECMAScript to a lower version that can be used in older browsers.
TypeScript, React, ES6 transforms are complete.
oxc-transform can be used for experimentation.
TypeScript Isolated Declarations Emit without using the TypeScript compiler.
Ourbenchmark indicates that our implementation is at least 20 times faster than the TypeScript compiler.
Thenpm package orcrate can be used for this task.
JavaScript minification plays a crucial role in optimizing website performance as it reduces the amount of data sent to users,resulting in faster page loads.This holds tremendous economic value, particularly for e-commerce websites, where every second can equate to millions of dollars.
However, existing minifiers typically require a trade-off between compression quality and speed.You have to choose between the slowest for the best compression or the fastest for less compression.But what if we could develop a faster minifier without compromising on compression?
We are actively working on a prototype that aims to achieve this goal,by porting all test cases from well-known minifiers such asgoogle-closure-compiler,terser,esbuild, andtdewolff-minify.
Preliminary results indicate that we are on track to achieve our objectives.With the Oxc minifier, you can expect faster minification times without sacrificing compression quality.
Seeminification benchmarks for comparisons.
Whileprettier has established itself as the de facto code formatter for JavaScript, there is a significant demand in the developer community for a less opinionated alternative. Recognizing this need, our ambition is to undertake research and development to create a new JavaScript formatter that offers increased flexibility and customization options.
Theprototype is currently work in progress.
In Oxc, correctness and reliability are taken extremely seriously.
We spend half of our time on strengthening the test infrastructure to prevent problems from propagating to downstream tools.
Test Infrastructure documents our test procedures:
- Conformance suite on Test262, Babel, TypeScript
- Lots of fuzzing
- Linter snapshot diagnostics
- oxlint ecosystem ci
- Idempotency testing
- Code coverage
- End to end 3000 top npm packages
- My small tutorial onhow to write a JavaScript Parser in Rust
- My small articlePursuit of Performance on Building a JavaScript Compiler
- And more
This project was incubated with the assistance of these exceptional mentors and their projects:
Special thanks go to
- @domonji for bootstrapping this project together, and also completing the TypeScript parser.
- @tongtong-lu and@guan-wy for designing theproject logo.
❤ Who'sSponsoring Oxc?
Oxc is free and open-source software licensed under theMIT License.
Oxc ports or copies code from other open source projects, their licenses are listed inThird-party library licenses.
About
⚓ A collection of JavaScript tools written in Rust.
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.