remove the hot-reload-macro crate

This commit is contained in:
= committed 2023-01-11 18:51:09 -06:00
1 parent 042b67b61b
commit 9e45cbe4a7
5 files changed
+12 -24

No files matched your search

-1
View File
@@ -21,7 +21,6 @@ members = [
"packages/rsx-rosetta",
"packages/signals",
"packages/hot-reload",
"packages/hot-reload-macro",
"docs/guide",
]
-13
View File
@@ -1,13 +0,0 @@
[package]
name = "dioxus-hot-reload-macro"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
syn = { version = "1.0.107", features = ["full"] }
proc-macro2 = { version = "1.0" }
[lib]
proc-macro = true
-7
View File
@@ -1,7 +0,0 @@
use proc_macro::TokenStream;
use syn::__private::quote::quote;
#[proc_macro]
pub fn hot_reload(_: TokenStream) -> TokenStream {
quote!(dioxus_hot_reload::init(core::env!("CARGO_MANIFEST_DIR"))).into()
}
-1
View File
@@ -6,7 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus-hot-reload-macro = { path = "../hot-reload-macro" }
dioxus-rsx = { path = "../rsx" }
dioxus-core = { path = "../core", features = ["serialize"] }
dioxus-html = { path = "../html", features = ["hot-reload-context"] }
+12 -2
View File
@@ -6,14 +6,13 @@ use std::{
};
use dioxus_core::Template;
pub use dioxus_hot_reload_macro::hot_reload;
use dioxus_html::HtmlCtx;
use dioxus_rsx::hot_reload::{FileMap, UpdateResult};
use interprocess::local_socket::{LocalSocketListener, LocalSocketStream};
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
/// Initialize the hot reloading listener on the given path
pub fn init(path: &'static str) {
pub fn init(path: &'static str, listening_paths: &'static [&'static str]) {
if let Ok(crate_dir) = PathBuf::from_str(path) {
let temp_file = std::env::temp_dir().join("@dioxusin");
let channels = Arc::new(Mutex::new(Vec::new()));
@@ -109,3 +108,14 @@ pub fn connect(mut f: impl FnMut(Template<'static>) + Send + 'static) {
}
});
}
#[macro_export]
macro_rules! hot_reload {
() => {
dioxus_hot_reload::init(core::env!("CARGO_MANIFEST_DIR"), &[])
};
($($paths: literal,)*,?) => {
dioxus_hot_reload::init(core::env!("CARGO_MANIFEST_DIR"), &[$($path,)*])
};
}