How dev-five-git/devup-ui works
Project Type and Purpose
• This is a polyglot monorepo hosting a CSS-in-JS preprocessing library (“Devup UI”) composed of:
• Core Rust crates for style extraction and CSS generation
• A WebAssembly (WASM) binding package to expose Rust logic in JavaScript
• Multiple bundler plugins (Next.js, Vite, Webpack) and a React component library
• Demo and benchmark applications illustrating usage and measuring performance
• The README confirms it is a zero-runtime CSS preprocessor that integrates at build time via plugins, producing atomic CSS classes and optional CSS variables for theming.
Key Directories and Their Roles
• libs/… (Rust crates):
• libs/extractor – the AST-based style extraction engine
• libs/css – core CSS utility routines
• libs/sheet – converts style descriptors into CSS strings
• bindings/devup-ui-wasm:
• Builds the above crates into a WASM module plus JavaScript glue code
• packages/… (TypeScript):
• next-plugin, vite-plugin, webpack-plugin – bundler loader plugins invoking the WASM extraction at compile time
• apps/…:
• landing, next, vite, vite-lib – demo applications (Next.js, Vite) showing documentation site and library mode
• benchmark/…:
• Comparative benchmark apps to measure build time/size across UI libraries
• Other:
• CI/CD (.github/workflows) for building, testing, and publishing to NPM
• Monorepo manifests (pnpm-workspace.yaml, Cargo.toml, Cargo.lock)
How the System Works (Build-Time Flow)
1. Developer writes JSX/TSX using Devup UI React components.
2. Bundler plugin (Next/Vite/Webpack) sees a TSX file → sends it to the WASM binding.
3. WASM module (built from Rust crates) parses the AST, extracts style props, and outputs:
• A set of generated CSS rules (atomic classes, theme variables)
• A class-name mapping and inline CSS variable declarations
4. Plugin emits CSS file or injects style tags per configuration, and transforms the TSX into standard JSX/TSX with className and style props.
5. React component library simply renders HTML elements with those classNames/styles.
6. Final bundle includes no runtime CSS-in-JS code—only static CSS and minimal inline variables.
Main Components & Interactions
• Core Rust Crates (Extractor, CSS, Sheet)
→ compile to → WASM Module + JS Glue (bindings/devup-ui-wasm)
• Bundler Plugins (packages/next-plugin, vite-plugin, webpack-plugin)
↕ use ↕
WASM Module
• React Component Library (@devup-ui/react)
↕ consumed by ↕
Demo Apps (apps/*) & Benchmark Apps
• CI/CD Pipeline
→ builds & tests Rust crates, packages, demo apps, runs benchmarks, publishes to NPM
Architectural Patterns & Principles
• Monorepo with polyglot workspaces (pnpm and Cargo)
• Build-time plugin architecture (no runtime overhead)
• Separation of concerns:
• Extraction logic in Rust → WASM → Plugin → React components → Consumer apps
• Minimal coupling: React library does not itself parse or generate CSS—it delegates to plugins/WASM
Essential Elements to Capture
• Each major codebase (Rust crates, WASM binding, TS packages, demo/benchmark apps, CI)
• The flow from source code to final bundle (AST extraction → CSS emit → transformed JSX → browser)
• Plugin injection points in build pipelines (Next.js/Vite/Webpack loaders)
• Package publishing step (CI → NPM)