mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
029c84bcda
- `substitute_typeof_undefined`: do not recreate binnary expression and instead just update right/left argument and operator - `substitute_rotate_binary_expression`: replace `take_in*2` and reassign with `std::mem::swap` - `substitute_object_or_array_constructor`, `substitute_global_new_expression`: introduce new helper `transform_new_expr_to_call_expr` to convert new to call expr - `substitute_iife_call`: use array to alloc all items in sequence without reallocs
Oxc Minifier
Next-generation JavaScript/TypeScript minifier achieving best-in-class compression.
Inspiration
- Closure Compiler: Advanced size optimizations
- Terser/UglifyJS: Comprehensive battle-tested transforms
- esbuild: Efficient algorithms and architecture
- SWC: Modern Rust performance
Key Features
- Maximum compression through exhaustive optimizations
- 100% correctness with comprehensive testing
- Fixed-point iteration for optimal size
- Arena allocation for performance
Current Performance
See tasks/minsize for compression benchmarks.
- Matching/beating esbuild on many libraries
- Full test262, Babel, TypeScript conformance
Usage
use oxc_minifier::{Minifier, MinifierOptions};
let options = MinifierOptions::default();
let minifier = Minifier::new(options);
let result = minifier.minify(&mut program);
Testing Infrastructure
just minsize- Track compression benchmarkscargo coverage- Conformance tests (test262, Babel, TypeScript)tasks/e2e- Real-world E2E testing
Development
just test- Run all testscargo run -p oxc_minifier --example minifier- Try the minifier
Key Dependencies
oxc_ecmascript- ECMAScript operations and constant evaluationoxc_semantic- Scope and symbol analysisoxc_mangler- Variable renaming
Documentation
- Architecture - Design and components
- Optimizations - Complete optimization catalog
- Assumptions - Code assumptions for optimization
- Correctness - Testing and validation
- Roadmap - Development plan
- Claude Guide - AI assistant reference