Skip to content

Conversation

@stevez
Copy link
Owner

@stevez stevez commented Dec 26, 2025

Split large monolithic files into focused, maintainable modules:

Converter Refactoring

  • Split converter.ts (2,117 L) → converter/ (4 modules, 2,183 L):
    • converter/index.ts - Main CoverageConverter class (1,007 L)
    • converter/merge.ts - V8 coverage merging (82 L)
    • converter/sanitizer.ts - Source map sanitization (340 L)
    • converter/coverage-fixes.ts - Istanbul fixes (754 L)

Parsers Extraction

  • Created parsers/ (6 modules, 553 L total):
    • Extracted bundler patterns from constants.ts
    • parsers/nextjs.ts - Next.js URL patterns (101 L)
    • parsers/vite.ts - Vite URL patterns (93 L)
    • parsers/webpack.ts - Webpack URL patterns (94 L)
    • parsers/sourcemap.ts - Source map patterns (92 L)
    • parsers/url-utils.ts - URL utilities (68 L)
    • parsers/index.ts - Re-exports (105 L)

Code Reduction

  • Reduced constants.ts: 317 → 92 lines (-71%)
  • Net production code: +411 lines (+17%)
    • Trade-off: Better organization vs. code size

Test Coverage

  • Added comprehensive tests (+2,047 test lines):
    • 3 converter module tests (1,344 L)
    • 6 parser module tests (691 L)
  • Coverage improved: 72.75% → 77.53% (+4.78%)
  • All 678 tests passing (on main branch)
  • Zero lint errors

Documentation

  • Added docs/folder-structure.md for future refactoring reference

Backward Compatibility

  • ✅ All exports remain unchanged
  • ✅ Public API stays the same
  • ✅ Users don't need to update their code
  • ✅ No breaking changes

Files changed:

  • 19 new files (converter/, parsers/, docs/)
  • 11 modified files (imports updated)
  • Build: ✅ Successful
  • Lint: ✅ Zero errors

Split large monolithic files into focused, maintainable modules:

## Converter Refactoring
- Split converter.ts (2,117 L) → converter/ (4 modules, 2,183 L):
  - converter/index.ts - Main CoverageConverter class (1,007 L)
  - converter/merge.ts - V8 coverage merging (82 L)
  - converter/sanitizer.ts - Source map sanitization (340 L)
  - converter/coverage-fixes.ts - Istanbul fixes (754 L)

## Parsers Extraction
- Created parsers/ (6 modules, 553 L total):
  - Extracted bundler patterns from constants.ts
  - parsers/nextjs.ts - Next.js URL patterns (101 L)
  - parsers/vite.ts - Vite URL patterns (93 L)
  - parsers/webpack.ts - Webpack URL patterns (94 L)
  - parsers/sourcemap.ts - Source map patterns (92 L)
  - parsers/url-utils.ts - URL utilities (68 L)
  - parsers/index.ts - Re-exports (105 L)

## Code Reduction
- Reduced constants.ts: 317 → 92 lines (-71%)
- Net production code: +411 lines (+17%)
  - Trade-off: Better organization vs. code size

## Test Coverage
- Added comprehensive tests (+2,047 test lines):
  - 3 converter module tests (1,344 L)
  - 6 parser module tests (691 L)
- Coverage improved: 72.75% → 77.53% (+4.78%)
- All 678 tests passing (on main branch)
- Zero lint errors

## Documentation
- Added docs/folder-structure.md for future refactoring reference

## Backward Compatibility
- ✅ All exports remain unchanged
- ✅ Public API stays the same
- ✅ Users don't need to update their code
- ✅ No breaking changes

Files changed:
- 19 new files (converter/, parsers/, docs/)
- 11 modified files (imports updated)
- Build: ✅ Successful
- Lint: ✅ Zero errors
@stevez stevez merged commit 04a64e7 into main Dec 26, 2025
6 checks passed
@stevez stevez deleted the 0.11.0-refactoring branch December 26, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants