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, retargeted in
11//!   place with [`watch::WatcherHandle::retarget`].
12//! - [`path`] — segment-aware basePath stripping and traversal-safe path
13//!   resolution.
14//! - [`reporter::RebuildReporter`] — terminal UX for rebuild loops
15//!   (rolling line, timestamps, success/error formatting).
16//! - [`worker::spawn_rebuild_worker`] — generic background worker that
17//!   coalesces watcher ticks, runs a user-supplied rebuild closure,
18//!   and reports the result.
19//! - [`serve::serve_static_file`] — actix-friendly static file
20//!   responder with basePath-aware routing and HTML livereload
21//!   injection.
22
23pub mod inject;
24pub mod livereload;
25pub mod path;
26pub mod reporter;
27pub mod serve;
28#[doc(hidden)]
29pub mod shutdown;
30pub mod watch;
31pub mod worker;
32
33pub use livereload::{sse_handler, LiveReload, ReloadEvent};
34pub use reporter::{local_hms, RebuildReporter};
35pub use serve::{serve_file_response, serve_static_file, NotFoundStrategy, StaticServeConfig};
36pub use watch::{default_ignore_paths, spawn_watcher, WatchConfig, WatchTargets, WatcherHandle};
37pub use worker::{spawn_rebuild_worker, RebuildError, RebuildWorker, TickSender};