Skip to content

Refactor#566

Closed
owjs3901 wants to merge 3 commits intomainfrom
refactor
Closed

Refactor#566
owjs3901 wants to merge 3 commits intomainfrom
refactor

Conversation

@owjs3901
Copy link
Contributor

@owjs3901 owjs3901 commented Feb 5, 2026

No description provided.

- Move 218 test functions from lib.rs to tests/all_tests.rs
- Reduce lib.rs from 13,500 lines to 375 lines (code only)
- Migrate 544 snapshot files from src/snapshots/ to tests/snapshots/
- All 1,221 tests pass (986 unit + 235 integration)

This separation improves code organization and compile times by
keeping test code separate from library code.
Phase 2 foundation for Turbopack multi-core support:

- Add ExtractionContext struct (extractor/src/context.rs)
  - Holds class_map, file_map, prefix, debug state
  - Replaces global state for parallel extraction
  - Full test coverage (8 tests)

- Add context-aware CSS operations (css/src/context_ops.rs)
  - sheet_to_classname_with_context()
  - sheet_to_variable_name_with_context()
  - keyframes_to_keyframes_name_with_context()
  - Full test coverage (9 tests)

- Export ExtractionContext from extractor crate
- Add bimap dependency to extractor

This lays groundwork for threading context through DevupVisitor
and eliminating global state from core extraction logic.
Add sync methods to ExtractionContext for global state interop:
- sync_to_globals(): push context state to global variables
- sync_from_globals(): pull global state back to context
- from_globals(): create context from current global state

Add extract_with_context() function that wraps extract() with
context synchronization, enabling stateless extraction for
parallel processing (e.g., Turbopack multi-core builds).

This is an incremental approach - internal modules still use
global state, but the new API provides the foundation for
future parallelization work.
@owjs3901 owjs3901 closed this Feb 5, 2026
@owjs3901 owjs3901 deleted the refactor branch February 5, 2026 06:16
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Changepacks

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 58.70968% with 64 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/css/src/context_ops.rs 52.47% 48 Missing ⚠️
libs/extractor/src/context.rs 70.37% 16 Missing ⚠️
Files with missing lines Coverage Δ
libs/css/src/lib.rs 100.00% <ø> (ø)
libs/extractor/src/lib.rs 94.73% <ø> (-5.27%) ⬇️
libs/extractor/src/context.rs 70.37% <70.37%> (ø)
libs/css/src/context_ops.rs 52.47% <52.47%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant