feat: Optional web support for hot-reload crate (#1527)
* feat: Optional web support for hot-reload crate * rename feature * tweak * tweak
This commit is contained in:
1 parent
b836851d02
commit
129d0a68ff
3 files changed
+11
-8
No files matched your search
@@ -12,7 +12,7 @@ keywords = ["dom", "ui", "gui", "react", "hot-reloading"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-rsx = { workspace = true }
|
dioxus-rsx = { workspace = true }
|
||||||
dioxus-core = { workspace = true, features = ["serialize"] }
|
dioxus-core = { workspace = true, features = ["serialize"] }
|
||||||
dioxus-html = { workspace = true }
|
dioxus-html = { workspace = true, optional = true }
|
||||||
|
|
||||||
interprocess-docfix = { version = "1.2.2" }
|
interprocess-docfix = { version = "1.2.2" }
|
||||||
notify = { version = "5.0.0", optional = true }
|
notify = { version = "5.0.0", optional = true }
|
||||||
@@ -24,5 +24,6 @@ once_cell = { version = "1.17.0", optional = true }
|
|||||||
ignore = { version = "0.4.19", optional = true }
|
ignore = { version = "0.4.19", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["dioxus-html"]
|
||||||
file_watcher = ["ignore", "chrono", "notify", "execute", "once_cell", "ignore", "dioxus-html/hot-reload-context"]
|
custom_file_watcher = ["ignore", "chrono", "notify", "execute", "once_cell", "ignore"]
|
||||||
|
file_watcher = ["custom_file_watcher", "dioxus-html/hot-reload-context"]
|
||||||
@@ -13,11 +13,12 @@ use dioxus_rsx::{
|
|||||||
};
|
};
|
||||||
use interprocess_docfix::local_socket::{LocalSocketListener, LocalSocketStream};
|
use interprocess_docfix::local_socket::{LocalSocketListener, LocalSocketStream};
|
||||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
|
||||||
|
|
||||||
pub use dioxus_html::HtmlCtx;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub struct Config<Ctx: HotReloadingContext = HtmlCtx> {
|
#[cfg(feature = "file_watcher")]
|
||||||
|
use dioxus_html::HtmlCtx;
|
||||||
|
|
||||||
|
pub struct Config<Ctx: HotReloadingContext> {
|
||||||
root_path: &'static str,
|
root_path: &'static str,
|
||||||
listening_paths: &'static [&'static str],
|
listening_paths: &'static [&'static str],
|
||||||
excluded_paths: &'static [&'static str],
|
excluded_paths: &'static [&'static str],
|
||||||
@@ -39,6 +40,7 @@ impl<Ctx: HotReloadingContext> Default for Config<Ctx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "file_watcher")]
|
||||||
impl Config<HtmlCtx> {
|
impl Config<HtmlCtx> {
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ pub use dioxus_html::HtmlCtx;
|
|||||||
use interprocess_docfix::local_socket::LocalSocketStream;
|
use interprocess_docfix::local_socket::LocalSocketStream;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[cfg(feature = "file_watcher")]
|
#[cfg(feature = "custom_file_watcher")]
|
||||||
mod file_watcher;
|
mod file_watcher;
|
||||||
#[cfg(feature = "file_watcher")]
|
#[cfg(feature = "custom_file_watcher")]
|
||||||
pub use file_watcher::*;
|
pub use file_watcher::*;
|
||||||
|
|
||||||
/// A message the hot reloading server sends to the client
|
/// A message the hot reloading server sends to the client
|
||||||
|
|||||||
Reference in new issue
Block a user