Oxc (Oxidation Compiler)

repository·main·Indexed 30 days ago

https://github.com/oxc-project/oxc

A high-performance web toolchain written in Rust providing fast linting (oxlint) and formatting (oxfmt). Includes specialized crates for AST management (oxc_ast), high-performance arena allocation (oxc_allocator), control flow graph construction (oxc_cfg), and AST-to-source code generation (oxc_codegen) for JavaScript, TypeScript, JSX, and TSX.

Tokens
131.8K
Snippets
109
Records
890
Agent score
94%

What's inside oxc

  1. Overview of Oxc Lexer

    main

    Oxc Lexer is a standalone, spec-compliant lexer designed for JavaScript (JS), JSX, and TypeScript (TS). It is engineered for high performance with the following characteristics:

    • Compliance: Fully Test262 compliant.
    • Language Support: Native support for TS and JSX.
    • Performance Optimizations:
      • SIMD: Utilizes SIMD on x86_64 platforms with AVX2. Other platforms currently use scalar implementations (work in progress).
      • UTF-8 Validation: Includes an optional parameter for UTF-8 validation, which has a cost of approximately 0.15 CPB (Cycles per byte).
      • Edge Case Handling: Specifically handles complex Regex vs. Division cases, even in pathological scenarios.
  2. Overview of Oxc Codegen

    main
    Oxc Codegen is a high-performance crate designed to convert AST (Abstract Syntax Tree) nodes back into source code strings. It supports JavaScript, TypeScript, and JSX. It is optimized for speed and correctness, aiming to produce clean, readable output while maintaining high fidelity to the original source.
  3. Overview of Oxc Semantic

    main
    The oxc_semantic crate provides comprehensive semantic analysis for JavaScript and TypeScript programs. It transforms raw ASTs into rich, semantically aware structures, enabling advanced static analysis, linting, and code transformations. It is designed to be the foundation for tools requiring deep program understanding, such as IDE features or sophisticated linters.
  4. Overview of Oxc Mangler

    main
    Oxc Mangler is a Rust crate designed for variable name mangling during JavaScript minification. Its primary goal is to reduce bundle size by shortening variable names while maintaining program semantics, respecting JavaScript scoping rules, and optimizing for gzip compression.
  5. Overview of the Oxc Parser

    main

    The oxc_parser crate is a high-performance, spec-compliant parser for JavaScript and TypeScript. It is designed to serve as the foundation for the Oxc toolchain, providing a detailed Abstract Syntax Tree (AST) for analysis, transformation, and code generation.

    Key Capabilities

    • Language Support: Full support for JavaScript (ECMAScript 2024+), TypeScript (including decorators), JSX, and TSX.
    • Modern Features: Supports stable ECMAScript features and Stage 3+ proposals.
    • Error Recovery: Implements sophisticated error recovery, allowing the parser to continue generating a complete AST even when encountering syntax errors. This makes it suitable for IDE integration.
    • Performance: Uses a recursive descent architecture with arena allocation and single-pass streaming for high speed and memory efficiency.
  6. Overview of the Oxc Linter

    main
    The oxc_linter crate is a high-performance, ESLint-compatible linting engine for JavaScript and TypeScript. It is designed to be used either as a standalone tool or integrated as a library component into other development tools. It achieves 50-100x faster performance than ESLint by leveraging oxc's high-performance AST and semantic analysis, utilizing a single AST pass for most rules and parallel file execution.
  7. Overview of Oxc Data Structures

    main
    The oxc_data_structures crate provides specialized, high-performance data structures and utilities optimized for compiler and tooling workloads, specifically targeting JavaScript/TypeScript tooling. These structures are designed to complement the Rust standard library by providing domain-specific optimizations for parsing, code generation, and memory efficiency.
  8. Overview of Oxc Syntax crate

    main

    The oxc_syntax crate provides the foundational JavaScript and TypeScript syntax definitions, constants, and utilities used throughout the entire Oxc toolchain. It serves as the single source of truth for language constructs, ensuring consistency across the parser, semantic analyzer, linter, and transformer.

    Key capabilities include:

    • Syntax constants: Definitions for keywords, operators, and language tokens.
    • AST utilities: Helper functions and patterns for AST manipulation and traversal.
    • Identifier validation: Tools for checking ECMAScript identifier compliance.
    • Operator precedence: Tables used for expression parsing.
    • Module records: Tracking for import/export relationships and module dependency analysis.
  9. Overview of Oxc Transformer Plugins

    main
    The oxc_transformer_plugins crate provides specialized transformation plugins designed for common JavaScript and TypeScript patterns. These plugins can be used as standalone components or integrated into a broader oxc transformation pipeline. They are designed to handle tasks such as global variable injection, module format conversion, and compile-time constant replacement.
  10. Overview of Oxc JSDoc

    main
    The oxc_jsdoc crate provides functionality for parsing JSDoc comments (/** ... */) within the oxc toolchain. It is designed to extract structured data from comments, including tags, types, parameter names, and descriptions. It is particularly useful for tools that need to understand documentation metadata embedded in JavaScript/TypeScript source code.
  11. Overview of Oxc Linter

    main
    Oxc Linter is a high-performance, ESLint-compatible linting engine designed for JavaScript and TypeScript. It is built to serve as either a standalone tool or a library component for integration into other development tools. It achieves 50-100x faster performance than ESLint on large codebases by leveraging oxc's high-performance AST and semantic analysis.
  12. Overview of oxc_regular_expression

    main

    The oxc_regular_expression crate provides a high-performance implementation of the ECMAScript® 2024 Language Specification for regular expressions. It is designed to be compliant with the latest standards and includes support for Stage 4 TC39 proposals.

    Supported Specifications:

    • ECMAScript® 2024 (Lexical Grammar, Text Processing, and Patterns)
    • Stage 4 Proposal: duplicate-named-capturing-groups
    • Stage 4 Proposal: regexp-modifiers