feat(swc_ecma_transformer): Add common utilities infrastructure
Implements common utilities and helper infrastructure needed by all transformers, following the design from oxc_transformer but adapted for SWC's AST and patterns.
## Changes
### New Files
**src/common/mod.rs**
- Module organization and re-exports for all common utilities
**src/common/helper_loader.rs**
- Helper function management with three modes: Runtime, External, and Inline (not yet implemented)
- `HelperLoader` for managing helper function expressions
- Support for creating helper calls with proper AST nodes
- Comprehensive tests covering all helper modes
**src/common/statement_injector.rs**
- Statement injection utilities for inserting statements before/after AST nodes
- `StatementInjector` for managing positional statement insertions
- Position-based approach adapted from oxc's address-based system
- Full test coverage for injection ordering and edge cases
**src/common/var_declarations.rs**
- Variable declaration management for inserting at top of scopes
- `VarDeclarations` for collecting and building var/let/const declarations
- Support for both simple identifiers and complex patterns
- Tests for all declaration types and building scenarios
**src/common/module_imports.rs**
- Import statement management and deduplication
- `ModuleImports` for tracking default and named imports
- Preserves source order for predictable output
- Full test suite for import generation and ordering
### Modified Files
**src/lib.rs**
- Added public export of `common` module
## Implementation Notes
- All utilities work with SWC's AST types (not oxc's)
- Uses `swc_common::DUMMY_SP` for spans where appropriate
- Follows CLAUDE.md guidelines: performance-focused, well-documented
- String-based API for flexibility (converted to Atom internally)
- All modules have comprehensive unit tests (43 tests total)
- cargo fmt and cargo clippy pass with -D warnings
## Testing
All tests pass:
```
cargo test -p swc_ecma_transformer
```
Clippy passes with no warnings:
```
cargo clippy -p swc_ecma_transformer -- -D warnings
```
## Related
- Follow-up to PR #11273 (hook-based transformer architecture)
- Based on oxc_transformer/src/common but adapted for SWC patterns
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>