# gloriasoft/veaury architecture

> Architecture diagram of the GitHub repository gloriasoft/veaury, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gloriasoft/veaury
- Repository: https://github.com/gloriasoft/veaury

## Overview

This project is an open‑source tool library—Veaury—that enables seamless integration between Vue3 and React. Its main purpose is to allow developers to use Vue components in React applications and vice versa, complete with support for advanced features such as context sharing, hooks injection, lazy loading, and even SSR integration. The file tree and README together show that this is not a typical full‑stack application but rather a highly modular library with multiple demonstration projects (for both React and Vue) and a comprehensive set of utilities to manage cross‑framework component conversion.

##### Main Components
- Core Library (src):
– This directory includes all conversion and utility functions such as “applyVueInReact”, “applyReactInVue”, “lazyVueInReact”, “lazyReactInVue” and related providers.
– It also holds cross‑framework helper functions, like “createCrossingProviderForVueInReact” and “createCrossingProviderForPureReactInVue”, which enable context sharing and injection between Vue and React.
- Build & Configuration Tools:
– The “babel”, “webpack”, and “vite” directories provide configurations and plugins that allow the compilation of both Vue and React JSX in the same project.
– Files like “babel.config.js” and “rollup.config.js” indicate that the project is prepared for multiple build systems (webpack, rollup, vite).
- Demo/Development Projects:
– “dev-project-react” and “dev-project-vue3” serve as concrete examples on how to integrate the library into new projects (the React project and the Vue project, respectively). They include configurations for their respective development environments.
- Tests and Types:
– “tests” directory shows unit testing and integration tests across various cases (e.g., applying Vue in React scenarios, lazy loading, event handling).
– “types” contains TypeScript definitions that ensure the correct interoperability of JSX types between Vue and React.

##### Relationships and Data Flow
- This core library to the build tools layer; mark out how Babel presets, webpack plugins, and vite plugins use and wrap these functionalities.
- Two major interaction flows:
– Vue in React: Illustrate how Vue components are wrapped (via applyVueInReact or applyPureVueInReact) to be used inside React apps.
– React in Vue: Show how React components are similarly wrapped (via applyReactInVue or applyPureReactInVue) to be used inside Vue apps.

##### Architectural Patterns and Design Principles
- Component Wrapping / HOC: Identify the use of higher‑order components (HOCs) and wrapper factories to convert components from one framework to the other.
- Cross‑framework Context Management: Note the use of “injectSyncUpdateForPureReactInVue” and similar helper functions that demonstrate the bridging of reactive contexts.
- Separation of Build Concerns: Emphasize that various build configuration directories (babel, webpack, vite) act like “adapters” allowing the library core to be used in multiple environments.
- Testing as a cross‑cutting concern: Illustrate that thorough tests are in place to validate each conversion and integration pathway.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Library
    CORE["Core Conversion Utilities (src)"]:::core

    %% Build & Configuration Tools
    subgraph "Build & Configuration Tools"
        subgraph Babel
            BABEL_DIR["Babel Directory"]:::tools
            BABEL_CONFIG["babel.config.js"]:::tools
        end
        subgraph Webpack
            WEBPACK_DIR["Webpack Directory"]:::tools
            WEBPACK_FILE["webpack/VeauryVuePlugin.js"]:::tools
        end
        subgraph Vite
            VITE_DIR["Vite Directory"]:::tools
            VITE_FILE["vite/index.js"]:::tools
        end
        ROLLUP["rollup.config.js"]:::tools
    end

    %% Demo Projects
    subgraph "Demo Projects"
        REACT_DEMO["React Demo Project"]:::demoReact
        VUE_DEMO["Vue Demo Project"]:::demoVue
    end

    %% Testing & Types
    subgraph "Testing & Types"
        TESTS["Testing Suite"]:::test
        TYPES["Type Definitions"]:::test
    end

    %% Connections from Build Tools to Core Library
    BABEL_DIR -->|"uses_core"| CORE
    BABEL_CONFIG -->|"uses_core"| CORE
    WEBPACK_DIR -->|"uses_core"| CORE
    WEBPACK_FILE -->|"uses_core"| CORE
    VITE_DIR -->|"uses_core"| CORE
    VITE_FILE -->|"uses_core"| CORE
    ROLLUP -->|"uses_core"| CORE

    %% Connections from Core Library to Demo Projects
    CORE -->|"applied_to"| REACT_DEMO
    CORE -->|"applied_to"| VUE_DEMO
    CORE -.->|"VueInReact"| REACT_DEMO
    CORE -.->|"ReactInVue"| VUE_DEMO

    %% Connections from Testing & Types to Core Library
    TESTS -->|"tests"| CORE
    TYPES -->|"ensures_types_for"| CORE

    %% Styles
    classDef core fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef tools fill:#66ccff,stroke:#333,stroke-width:2px;
    classDef demoReact fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef demoVue fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef test fill:#ffffcc,stroke:#333,stroke-width:2px;

    %% Click Events
    click CORE "https://github.com/gloriasoft/veaury/tree/master/src"
    click BABEL_DIR "https://github.com/gloriasoft/veaury/tree/master/babel"
    click BABEL_CONFIG "https://github.com/gloriasoft/veaury/blob/master/babel.config.js"
    click WEBPACK_DIR "https://github.com/gloriasoft/veaury/tree/master/webpack"
    click WEBPACK_FILE "https://github.com/gloriasoft/veaury/blob/master/webpack/VeauryVuePlugin.js"
    click VITE_DIR "https://github.com/gloriasoft/veaury/tree/master/vite"
    click VITE_FILE "https://github.com/gloriasoft/veaury/blob/master/vite/index.js"
    click ROLLUP "https://github.com/gloriasoft/veaury/blob/master/rollup.config.js"
    click REACT_DEMO "https://github.com/gloriasoft/veaury/tree/master/dev-project-react"
    click VUE_DEMO "https://github.com/gloriasoft/veaury/tree/master/dev-project-vue3"
    click TESTS "https://github.com/gloriasoft/veaury/tree/master/tests"
    click TYPES "https://github.com/gloriasoft/veaury/tree/master/types"
```
