# dwlad90/stylex-swc-plugin architecture

> Architecture diagram of the GitHub repository dwlad90/stylex-swc-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dwlad90/stylex-swc-plugin
- Repository: https://github.com/dwlad90/stylex-swc-plugin

## Overview

##### Main Components

a. Core Components:
- StyleX RS Compiler (NAPI-RS based)
- Shared Rust Codebase
- Path Resolver

b. Integration Layer:
- Next.js Plugin
- Webpack Plugin
- Rollup Plugin
- Unplugin (multi-build tool support)
- PostCSS Plugin

c. Build Tool Support:
- Farm
- Rollup
- Rsbuild
- Rspack
- Solid
- Vite
- Vue
- Webpack

**[Core Layer (Rust)]**
- ↑
**[Shared Components]**
- ↑
**[Integration Layer]**
- ↑
**[Build Tools Layer]**

##### Component Relationships

- Data flow from Core Layer through Integration Layer to Build Tools
- Dependencies between components
- Plugin interactions with build systems

##### Specific Implementation Details

a. Core Layer:
**[StyleX RS Compiler (NAPI-RS)] ←→ [Shared Rust Codebase]**
- ↑
**[Path Resolver Utilities]**

b. Integration Layer:
**[Next.js Plugin] [Webpack Plugin] [Rollup Plugin] [Unplugin] [PostCSS Plugin]**
- ↑
- [Core Components]

c. Build Tools Layer:
**[Farm] [Rollup] [Rsbuild] [Rspack] [Solid] [Vite] [Vue] [Webpack]**
- ↑
- [Integration Plugins]

##### Additional Elements

Include:
- Version information
- Configuration flow paths

##### Notes for Implementation

- Version badges where relevant
- Deprecated components clearly

**┌─ Build Tools ─────────────────────┐**
- [Various Build Tool Integrations] │
- Integration Layer ───────────────┤
- [Plugin Implementations]          │
- Shared Components ──────────────┤
- [Common Utilities and Code]      │
- Core Layer ────────────────────┤
- [Rust Implementation]           │
- ┘

Remember to include a note about the deprecated packages and their replacements, as mentioned in the README, using a distinct visual style to indicate their deprecated status.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#DE5D3C,color:white
    classDef shared fill:#4B8BBE,color:white
    classDef integration fill:#3EAF7C,color:white
    classDef buildtools fill:#666666,color:white
    classDef deprecated fill:#cccccc,color:#666666,stroke-dasharray: 5 5

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        Compiler["StyleX RS Compiler"]
        SharedCode["Shared Rust Codebase"]
        PathResolver["Path Resolver"]
        
        Compiler <--> SharedCode
        SharedCode --> PathResolver
    end

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        NextPlugin["Next.js Plugin"]
        WebpackPlugin["Webpack Plugin"]
        RollupPlugin["Rollup Plugin"]
        UnPlugin["Unplugin"]
        PostCSSPlugin["PostCSS Plugin"]
    end

    %% Build Tools Layer
    subgraph BuildTools["Build Tools Layer"]
        Farm["Farm"]
        Rollup["Rollup"]
        Rsbuild["Rsbuild"]
        Rspack["Rspack"]
        Solid["Solid"]
        Vite["Vite"]
        Vue["Vue"]
        Webpack["Webpack"]
    end

    %% Relationships
    CoreLayer --> IntegrationLayer
    IntegrationLayer --> BuildTools

    %% Click events for Core Layer
    click Compiler "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/crates/stylex-rs-compiler"
    click SharedCode "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/crates/stylex-shared"
    click PathResolver "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/crates/stylex-path-resolver"

    %% Click events for Integration Layer
    click NextPlugin "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/packages/nextjs-plugin"
    click WebpackPlugin "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/packages/webpack-plugin"
    click RollupPlugin "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/packages/rollup-plugin"
    click UnPlugin "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/packages/unplugin"
    click PostCSSPlugin "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/packages/postcss-plugin"

    %% Click events for Build Tools
    click Farm "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/farm-unplugin-example"
    click Rollup "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/rollup-unplugin-example"
    click Rsbuild "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/rsbuild-unplugin-example"
    click Rspack "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/rspack-unplugin-example"
    click Solid "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/solid-unplugin-example"
    click Vite "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/vite-unplugin-example"
    click Vue "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/vue-unplugin-example"
    click Webpack "https://github.com/Dwlad90/stylex-swc-plugin/tree/develop/apps/webpack-unplugin-example"

    %% Style Applications
    class Compiler,SharedCode,PathResolver core
    class NextPlugin,WebpackPlugin,RollupPlugin,UnPlugin,PostCSSPlugin integration
    class Farm,Rollup,Rsbuild,Rspack,Solid,Vite,Vue,Webpack buildtools

    %% Legend
    subgraph Legend["Legend"]
        CoreComp["Core Component"]:::core
        IntComp["Integration Plugin"]:::integration
        BuildComp["Build Tool"]:::buildtools
    end
```
