swc-project
swc
BlogDocsChangelog

Branches performance

Pull requests

fix(es/quote): Replace usage of `swc_atoms` with `swc_core::atoms`#11299
last run
50 minutes ago
Create wild-squids-cheer.md
53 minutes ago
70aba9d
kdy1/quote-fix
CodSpeed Performance Gauge
0%
feat: Add oxc-inspired transformer infrastructure#11298
last run
47 minutes ago
fix: Remove unused dev dependencies from swc_ecma_transformer Remove swc_ecma_parser and swc_ecma_codegen from dev-dependencies as they are not used in the crate. This fixes the cargo-shear CI check failure. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
51 minutes ago
a5c99c3
devbird/oxc-transformer-infrastructure
CodSpeed Performance Gauge
0%
docs(es/transformer): Add comprehensive oxc transform porting guide#11297
last run
2 hours ago
docs(es/transformer): Add comprehensive oxc transform porting guide This guide provides a detailed analysis of all transforms implemented in oxc_transformer and their porting priorities to SWC's VisitMutHook architecture. ## Key Contents - **Transform Inventory**: Complete list of all oxc transforms organized by ECMAScript version (ES2015-ES2026), TypeScript, React/JSX, decorators, and regex - **Implementation Details**: For each transform: - Babel equivalent plugin name - Complexity assessment - Key AST nodes operated on - Dependencies and helper functions - Implementation approach (enter/exit hooks) - Current status in SWC - **Porting Priority**: 8 phases prioritizing transforms by: - Foundation utilities first - Frequency of use - Dependencies between transforms - Complexity vs impact balance - **Implementation Patterns**: Detailed patterns for: - Hook usage (entry vs exit) - Mapping oxc's Traverse trait to SWC's VisitMutHook - Common transform patterns (syntax rewrite, side effects, multi-phase, etc.) - Helper function injection - Scope-aware transformations - **Testing Strategy**: Guidance on: - Babel conformance test integration - Unit, integration, and snapshot testing - Performance benchmarking - Real-world validation - **Architecture Comparison**: Detailed comparison of oxc and SWC architectures ## Transforms Analyzed Documented 60+ transforms across: - ES2015 (15 transforms) - ES2016-ES2022 (20+ transforms) - TypeScript (6 transforms) - React/JSX (5 transforms) - Decorators, regex, and utilities Follow-up to #11293 which established the foundational swc_ecma_transformer crate. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 hours ago
2ba95e4
devbird/oxc-transform-analysis
CodSpeed Performance Gauge
0%
feat(es/transformer): Enhance TraverseCtx with essential transformation APIs ## Summary This PR enhances the TraverseCtx implementation with comprehensive APIs needed for AST transformations, based on oxc's TraverseCtx design. ## Changes ### TraverseCtx Enhancements **Ancestry Tracking APIs:** - `parent()` - Get immediate parent node - `ancestor(level)` - Get ancestor at specific depth - `find_ancestor(predicate)` - Find ancestor matching predicate - `ancestors_depth()` - Get current depth in AST - Expanded AncestorNode enum with Try, Catch, Switch, If, Conditional, Call, With **Context Predicates:** - `in_try()`, `in_catch()`, `in_switch()` - Query specific ancestor contexts - `in_class()`, `in_method()`, `in_with()` - Additional context checks - Existing: `in_function()`, `in_loop()`, `in_strict_mode()` **AST Node Creation Helpers:** - `create_ident()`, `create_ident_with_span()`, `create_ident_ref()` - Identifier creation - `create_member_expr()` - Member expression helper - `create_call_expr()` - Call expression helper - `create_var_declarator()`, `create_var_decl()` - Variable declarations - `create_assignment()` - Assignment expressions - `create_return_stmt()`, `create_expr_stmt()`, `create_block_stmt()` - Statements - `create_null()`, `create_undefined()`, `create_bool()`, `create_number()`, `create_string()`, `create_this()` - Literals **Transformation Utilities:** - `generate_unique_name()` - Generate identifiers avoiding conflicts - `is_valid_identifier()` - Validate identifier names against reserved words - `clear_identifier_metadata()`, `identifier_count()` - Metadata management ### Transformer Updates - Added automatic parent tracking for all relevant AST node types - HookAdapter now properly maintains ancestry stack during traversal - Tracks: Function, ArrowFunction, Class, Block, Loop variants, Try, Catch, Switch, If, Conditional, Call, With, Method ### Testing - Added comprehensive unit tests for all new functionality - 17 tests covering ancestry tracking, context predicates, helper generators, and utilities - All tests pass ### Documentation - Enhanced module-level documentation - Added detailed doc comments with examples for all public APIs - Updated lib.rs to describe new TraverseCtx capabilities ## Technical Notes - Follows CLAUDE.md guidelines (uses &str/Cow for Atoms where applicable) - No breaking changes to existing APIs - Performance-conscious: minimal allocations in hot paths - All compilation checks pass (cargo check, tests) - Code formatted with cargo fmt šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 hours ago
3ed768c
devbird/enhance-traverse-ctx
CodSpeed Performance Gauge
0%
Ā© 2025 CodSpeed Technology
Home Terms Privacy Docs