Skip to main content

Module dev_server

Module dev_server 

Source
Expand description

WASM Development Server

Real HTTP server implementation for serving WASM applications with hot reload. Implements GitHub issue #7: https://github.com/paiml/probar/issues/7

§Features

  • HTTP server with correct MIME types for WASM
  • WebSocket server for hot reload notifications
  • File watcher with debouncing
  • wasm-pack build integration

§Architecture

┌─────────────────────────────────────────────────────────────┐
│                    DevServer                                │
│  ┌──────────────┐     ┌──────────────┐                     │
│  │ HTTP Server  │     │  WS Server   │                     │
│  │ (port 8080)  │     │ (port 8081)  │                     │
│  └──────┬───────┘     └──────┬───────┘                     │
│         │                    │                              │
│         ▼                    ▼                              │
│  ┌──────────────┐     ┌──────────────┐                     │
│  │ Static Files │     │ HotReload    │◀───FileWatcher      │
│  │ .wasm .js    │     │ Messages     │                     │
│  └──────────────┘     └──────────────┘                     │
└─────────────────────────────────────────────────────────────┘

Structs§

DevServer
WASM development server with HTTP and WebSocket support
DevServerConfig
WASM development server configuration
DevServerConfigBuilder
Builder for DevServerConfig
FileWatcher
File watcher for hot reload
FileWatcherBuilder
Builder for FileWatcher
ImportRef
Import reference found in HTML/JS files
ImportValidationError
Validation error for a single import
ModuleValidationResult
Result of validating all imports
ModuleValidator
Module validator for checking import resolution

Enums§

FileChangeEvent
File change event types
HotReloadMessage
Hot reload message sent to connected clients (JSON serializable)
ImportType
Type of module import

Functions§

get_mime_type
Get MIME type for a file path
run_wasm_pack_build
Run wasm-pack build