# vuejs/babel-plugin-jsx architecture

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

- Interactive diagram: https://gitdiagram.com/vuejs/babel-plugin-jsx
- Repository: https://github.com/vuejs/babel-plugin-jsx

## Overview

##### Overall Project Organization
- Project as a monorepo managed by pnpm (with a pnpm-workspace.yaml). This ties together multiple interdependent packages.
- Main packages/components to document include:
- babel-plugin-jsx – The primary package for transforming JSX.
- babel-plugin-resolve-type – Responsible for resolving types in JSX (likely used by babel-plugin-jsx).
- babel-helper-vue-transform-on – A helper package for Vue-specific transformations.
- jsx-explorer – A demo or exploratory tool that likely provides a UI for testing the plugins and analyzing code transformations.

##### Top-Level Components and Their Relationships
- The babel-plugin-jsx might depend on babel-plugin-resolve-type and potentially on the helper for Vue JSX transformation.
- The jsx-explorer package could be depicted as a consumer of the Babel plugins (acting as a demonstrative frontend showing the plugin’s capabilities).

##### External Tools & Integration Points
- A block representing the CI/CD pipeline (with GitHub Actions workflows such as ci.yml, issue-reply.yml, release.yml, etc.) to show automated testing, linting, and release processes.
- Connections from the individual packages to the build tools (tsup.config.ts in some packages) and tests (vitest.config.ts and test directories) to emphasize a clear build/test/deploy pipeline.

##### Highlighted Architectural Patterns and Design Principles
- Separation of concerns by clearly isolating transformation functionality (plugins and helpers) versus demonstration or interactive exploration (jsx-explorer).
- Notes on how shared configurations (e.g., Prettier, ESLint, TypeScript configurations) assure code style and type safety across all modules.

##### Relevant Technologies, Frameworks, and Libraries
- Babel plugins (babel-plugin-jsx, babel-plugin-resolve-type, babel-helper-vue-transform-on) are built primarily with JavaScript/TypeScript.
- jsx-explorer likely uses Vite (as indicated by vite.config.ts) and a modern JavaScript framework for the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Packages
    subgraph "Babel Plugins and Helpers"
        BabelJSX["babel-plugin-jsx\n(JSX Transformation Plugin)"]:::plugin
        BabelResolve["babel-plugin-resolve-type\n(Type Resolution Plugin)"]:::plugin
        BabelVueHelper["babel-helper-vue-transform-on\n(Vue Transform Helper)"]:::plugin
    end

    subgraph "Interactive Tools"
        JSXExplorer["jsx-explorer\n(Interactive Demo)"]:::explorer
    end

    %% Shared Configuration & Tooling
    subgraph "Shared Configuration & Tooling"
        TSConfig["tsconfig.json"]:::config
        ESLint["eslint.config.js"]:::config
        Prettier[".prettierrc"]:::config
        Workspace["pnpm-workspace.yaml"]:::config
    end

    %% CI/CD Pipeline
    CI["CI/CD Pipeline\n(GitHub Actions)"]:::ci

    %% Relationships between Babel Plugins
    BabelJSX -->|"dependsOn"| BabelResolve
    BabelJSX -->|"dependsOn"| BabelVueHelper

    %% jsx-explorer uses babel-plugin-jsx
    JSXExplorer -->|"uses"| BabelJSX

    %% Each package uses shared configuration (illustrative connections)
    BabelJSX -->|"configUsed"| TSConfig
    BabelResolve -->|"configUsed"| ESLint
    BabelVueHelper -->|"configUsed"| Prettier
    JSXExplorer -->|"configUsed"| Workspace

    %% CI/CD Pipeline builds and tests all packages
    CI -->|"builds"| BabelJSX
    CI -->|"builds"| BabelResolve
    CI -->|"builds"| BabelVueHelper
    CI -->|"builds"| JSXExplorer

    %% Click events for components
    click BabelJSX "https://github.com/vuejs/babel-plugin-jsx/tree/main/packages/babel-plugin-jsx"
    click BabelResolve "https://github.com/vuejs/babel-plugin-jsx/tree/main/packages/babel-plugin-resolve-type"
    click BabelVueHelper "https://github.com/vuejs/babel-plugin-jsx/tree/main/packages/babel-helper-vue-transform-on"
    click JSXExplorer "https://github.com/vuejs/babel-plugin-jsx/tree/main/packages/jsx-explorer"
    click CI "https://github.com/vuejs/babel-plugin-jsx/tree/main/.github/workflows"
    click TSConfig "https://github.com/vuejs/babel-plugin-jsx/blob/main/tsconfig.json"
    click ESLint "https://github.com/vuejs/babel-plugin-jsx/blob/main/eslint.config.js"
    click Prettier "https://github.com/vuejs/babel-plugin-jsx/blob/main/.prettierrc"
    click Workspace "https://github.com/vuejs/babel-plugin-jsx/blob/main/pnpm-workspace.yaml"

    %% Styles
    classDef plugin fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef explorer fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef config fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
    classDef ci fill:#fff9c4,stroke:#f57f17,stroke-width:2px;
```
