Skip to main content

webui_dev_server/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT license.
3
4//! Shared dev-server primitives for WebUI tooling.
5//!
6//! See the crate README for the high-level overview. The crate exposes:
7//!
8//! - [`LiveReload`] / [`livereload::sse_handler`] — Server-Sent Events
9//!   broadcaster and actix handler for browser auto-reload.
10//! - [`watch::spawn_watcher`] — debounced filesystem watcher.
11//! - [`path`] — segment-aware basePath stripping and traversal-safe path
12//!   resolution.
13//! - [`reporter::RebuildReporter`] — terminal UX for rebuild loops
14//!   (rolling line, timestamps, success/error formatting).
15//! - [`worker::spawn_rebuild_worker`] — generic background worker that
16//!   coalesces watcher ticks, runs a user-supplied rebuild closure,
17//!   and reports the result.
18//! - [`serve::serve_static_file`] — actix-friendly static file
19//!   responder with basePath-aware routing and HTML livereload
20//!   injection.
21
22pub mod inject;
23pub mod livereload;
24pub mod path;
25pub mod reporter;
26pub mod serve;
27pub mod watch;
28pub mod worker;
29
30pub use livereload::{sse_handler, LiveReload, ReloadEvent};
31pub use reporter::{local_hms, RebuildReporter};
32pub use serve::{serve_file_response, serve_static_file, NotFoundStrategy, StaticServeConfig};
33pub use watch::{default_ignore_paths, spawn_watcher, WatchConfig, WatcherHandle};
34pub use worker::{spawn_rebuild_worker, TickSender};