About this project
Oxc for Ruby is a gem that packages the Rust-based Oxc compiler, offering Ruby developers a suite of high-performance tools for JavaScript and TypeScript. It enables parsing, transforming, and minifying JavaScript directly from Ruby, eliminating the need for a JavaScript runtime.
Key features include:
- **Minification**: Compress and mangle JavaScript with configurable options.
- **Transformation**: Compile TypeScript and JSX, lower syntax to target ECMAScript versions, and optionally minify in the same pass.
- **Declaration files**: Generate `.d.ts` files from TypeScript sources.
- **Parsing**: Obtain an ESTree-compliant AST as plain Ruby hashes, with error recovery and diagnostics.
- **AST walking and rewriting**: Traverse and mutate the AST with a visitor pattern, preserving original formatting.
- **Symbol and module analysis**: Extract declared and unresolved symbols, imports, and exports.
- **Source maps**: Generate source maps as JSON text.
- **Runtime helpers**: Manage helper functions for lowering, with options for external helpers or assumptions to avoid them.
The gem version tracks the bundled Oxc version, and precompiled gems are available for many platforms; otherwise, it builds from source requiring Rust 1.96+. The API is designed to be intuitive, with options validated strictly and results providing detailed diagnostics.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.