How lacig/slidev works
Main Components
• CLI/Server (packages/slidev): This package contains the core CLI commands, server setup (for live preview, building, serving), and integrations (e.g., exporting slides, handling add-ons). It communicates with the parsing layer and with the client.
• Presentation Client (packages/client): A Vue-based frontend application that renders the slides. It encapsulates components like layouts (in packages/client/layouts), interactive controls, and embedded Vue components to support interactivity (e.g., drawing, live coding).
• Theme & App Scaffolding (packages/create-app and packages/create-theme): Provides templates and tooling to rapidly bootstrap new projects or themes, facilitating customization.
• VSCode Integration (packages/vscode): Contains the language server, commands, and live preview capabilities for an integrated development experience in VSCode.
• Shared Types and Utilities (packages/types, shared state): These packages define TypeScript definitions used across the project and contain shared logic (e.g., configuration, context menus, and state management).
Out Relationships and Interactions
• User Workflow: A developer writes slides in Markdown. The CLI (Slidev) is then used to start a development session.
• The CLI fetches the markdown content and passes it to the Parser, which processes it and produces an intermediate representation.
• The Presentation Client picks up this processed data and renders the slides using Vue 3. This client communicates with both the backend (for live preview, reloading, presenter mode, etc.) and with external libraries.
• Theme and plugin systems inject additional functionalities (e.g., UnoCSS for styling, Shiki and Monaco for code editing and syntax highlighting, RecordRTC for recording).
• The VSCode extension integrates directly with these components, providing an editor experience with real-time preview and debugging support.
Architectural Patterns and Design Principles
• Monorepo Structure: Emphasize that all packages are maintained in one repository, facilitating shared tooling and consistency. It follows a modular design where each package has its own responsibility.
• Separation of Concerns: UI (client), processing/parsing (parser), and command/control (CLI/slidev) are clearly decoupled.
• Plugin and Extensibility: Multiple integration points (themes, addons, VSCode integration) enable high customizability.
• Developer Experience Focus: Fast reloading via Vite, a rich set of interactive features, and a focus on markdown as the source of truth.