How gloriasoft/veaury works
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.