How playform/compress works
Main Components Identification
a) Input/Output Processing Layer
• Input directories/files
• Output compressed files
• Path mapping functionality
b) Compression Engine Core
• Parallel processing capabilities
c) File Type Processors
Processors into categories:
• Style Processors (CSS)
• CSSO processor
• LightningCSS processor
• Markup Processors
• HTML (html-minifier-terser)
• SVG (SVGO)
• Script Processor
• JavaScript (Terser)
• Image Processor
• Sharp (for multiple image formats)
Component Relationships
[Input Files] → [File Type Detection] → [Processor Selection] → [Compression] → [Output Files]
• Rectangle: Core components
• Hexagon: File processors
Integration Points
Integration with Astro:
• Configuration intake
• Build process hooks
• Output directory handling
Specific Implementation Details
Key features:
• File filtering system
• Logger functionality
• Configuration override capabilities
• Path mapping system
┌─ Configuration Layer ─────────────────────┐
• Path configurations │
• Compression options │
• Filtering rules │
• ┬─┘
• ↓ │
┌─ Core Processing Layer ─────────────────┤
• ┌─ File Detection ─┐ ┌─ Orchestrator ─┐ │
• ┘ └───────────────┬┘ │
• ┼─┘
• ↓ │
┌─ Processor Layer ───────────────────────┐
• ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ │
• CSS │ │ HTML│ │ JS │ │Image│ │
• ┘ └─────┘ └─────┘ └─────┘ │
• ┘
Important Elements
• Version compatibility
• Performance optimization paths
• Error handling flows
• Logging points
• Configuration validation