Skip to content
Tim Richter edited this page Apr 19, 2025 · 3 revisions

Welcome to the spinne wiki!

stateDiagram-v2
    [*] --> FindProjects
    FindProjects --> EnterSubdir

    EnterSubdir --> CheckDir : next subdirectory
    CheckDir --> ProjectFound : has .git & package.json
    CheckDir --> EnterSubdir : otherwise

    ProjectFound --> SourceProject : imported by other local projects
    ProjectFound --> ConsumerProject : lists other local projects as deps

    state SourceProject {
        [*] --> FindExports
        FindExports --> StoreExports
        StoreExports --> FindComponents
        FindComponents --> StoreComponents
        StoreComponents --> [*]
    }

    state ConsumerProject {
        [*] --> FindComponents
        FindComponents --> StoreComponents
        StoreComponents --> [*]
    }

    SourceProject --> EnterSubdir
    ConsumerProject --> EnterSubdir

    EnterSubdir --> ConnectMatching : no more dirs

    state ConnectMatching {
        [*] --> MatchByNameAndPath : compare export names & file paths
        MatchByNameAndPath --> StoreConnections : link exports ↔ components
        StoreConnections --> [*]
    }

    ConnectMatching --> [*]

Loading
graph TD
    A[Start Traversing File] --> B{Is it a File?}
    B -- Yes --> C[Find React Components]
    C --> D{React Component Found?}
    D -- Yes --> E[Find Children Components]
    E --> F[Check Import Source of Each Child]
    F --> G[Follow References and Reassignments]
    G --> H{Import Found?}
    H -- Yes --> I[Traverse to Imported File]
    I --> J[Look for Component as Export]
    J --> K{Is Component Directly Exported?}
    K -- Yes --> L[Add Component to Graph]
    K -- No --> M[Follow Exports to Root Component]
    M --> L
    B -- No --> N[End]
    D -- No --> N
    H -- No --> N
Loading

Clone this wiki locally