diff --git a/Cargo.lock b/Cargo.lock index 01a5d6552..568e80cf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,9 +49,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8" +checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" [[package]] name = "arrayref" @@ -224,9 +224,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" [[package]] name = "byteorder" @@ -447,9 +447,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +checksum = "dc948ebb96241bb40ab73effeb80d9f93afaad49359d159a5e61be51619fe813" dependencies = [ "libc", ] @@ -523,40 +523,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - [[package]] name = "data-encoding" version = "2.3.2" @@ -574,19 +540,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dioxus" -version = "0.2.4" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-core", - "dioxus-core-macro", - "dioxus-hooks", - "dioxus-html", - "dioxus-rsx", - "dioxus-rsx-interpreter", -] - [[package]] name = "dioxus-cli" version = "0.1.5" @@ -601,8 +554,6 @@ dependencies = [ "clap", "colored 2.0.0", "convert_case", - "dioxus", - "dioxus-rsx-interpreter", "dirs 4.0.0", "fern", "flate2", @@ -631,94 +582,6 @@ dependencies = [ "zip 0.6.2", ] -[[package]] -name = "dioxus-core" -version = "0.2.1" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "backtrace", - "bumpalo", - "futures-channel", - "futures-util", - "fxhash", - "indexmap", - "log", - "longest-increasing-subsequence", - "once_cell", - "serde", - "slab", - "smallvec", -] - -[[package]] -name = "dioxus-core-macro" -version = "0.2.1" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-rsx", - "dioxus-rsx-interpreter", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dioxus-hooks" -version = "0.2.1" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-core", - "futures-channel", - "log", -] - -[[package]] -name = "dioxus-html" -version = "0.2.1" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-core", - "enumset", - "euclid", - "keyboard-types", -] - -[[package]] -name = "dioxus-rsx" -version = "0.0.0" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dioxus-rsx-interpreter" -version = "0.1.0" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-core", - "dioxus-hooks", - "dioxus-html", - "dioxus-rsx", - "dioxus-ssr", - "lazy_static", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", -] - -[[package]] -name = "dioxus-ssr" -version = "0.2.1" -source = "git+https://github.com/dioxuslabs/dioxus/#baf180733871848a178a5397a1e1934c768e04e8" -dependencies = [ - "dioxus-core", -] - [[package]] name = "dirs" version = "1.0.5" @@ -777,36 +640,6 @@ dependencies = [ "syn", ] -[[package]] -name = "enumset" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "euclid" -version = "0.22.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52c2ef4a78da0ba68fbe1fd920627411096d2ac478f7f4c9f3a54ba6705bade" -dependencies = [ - "num-traits", -] - [[package]] name = "failure" version = "0.1.8" @@ -1005,15 +838,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.6" @@ -1054,9 +878,9 @@ checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "h2" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ "bytes", "fnv", @@ -1258,9 +1082,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.44" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf7d67cf4a22adc5be66e75ebdf769b3f2ea032041437a7061f97a63dad4b" +checksum = "ad2bfd338099682614d3ee3fe0cd72e0b6a41ca6a87f6a74a3bd593c91650501" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1275,12 +1099,6 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.2.3" @@ -1393,17 +1211,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "keyboard-types" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7668b7cff6a51fe61cdde64cd27c8a220786f399501b57ebe36f7d8112fd68" -dependencies = [ - "bitflags", - "serde", - "unicode-segmentation", -] - [[package]] name = "kqueue" version = "1.0.6" @@ -1438,9 +1245,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.131" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "libz-sys" @@ -1479,12 +1286,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "longest-increasing-subsequence" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" - [[package]] name = "lru-cache" version = "0.1.2" @@ -1647,9 +1448,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "opaque-debug" @@ -1762,9 +1563,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pest" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8" +checksum = "4b0560d531d1febc25a3c9398a62a71256c0178f2e3443baedd9ad4bb8c9deb4" dependencies = [ "thiserror", "ucd-trie", @@ -1772,9 +1573,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13570633aff33c6d22ce47dd566b10a3b9122c2fe9d8e7501895905be532b91" +checksum = "905708f7f674518498c1f8d644481440f476d39ca6ecae83319bba7c6c12da91" dependencies = [ "pest", "pest_generator", @@ -1782,9 +1583,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c567e5702efdc79fb18859ea74c3eb36e14c43da7b8c1f098a4ed6514ec7a0" +checksum = "5803d8284a629cc999094ecd630f55e91b561a1d1ba75e233b00ae13b91a69ad" dependencies = [ "pest", "pest_meta", @@ -1795,9 +1596,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb32be5ee3bbdafa8c7a18b0a8a8d962b66cfa2ceee4037f49267a50ee821fe" +checksum = "1538eb784f07615c6d9a8ab061089c6c54a344c5b4301db51990ca1c241e8c04" dependencies = [ "once_cell", "pest", @@ -1806,18 +1607,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78203e83c48cffbe01e4a2d35d566ca4de445d79a85372fc64e378bfc812a260" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -2146,9 +1947,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.6.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" dependencies = [ "bitflags", "core-foundation", @@ -2178,18 +1979,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.143" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.143" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", @@ -2198,9 +1999,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" +checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ "itoa", "ryu", @@ -2284,9 +2085,9 @@ checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "10c98bba371b9b22a71a9414e420f92ddeb2369239af08200816169d5e2dd7aa" dependencies = [ "libc", "winapi", @@ -2422,9 +2223,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db76ff9fa4b1458b3c7f077f3ff9887394058460d21e634355b273aaf11eea45" +checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" dependencies = [ "itoa", "libc", @@ -3259,7 +3060,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1", - "time 0.3.13", + "time 0.3.14", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index 2cf01cf5d..e8755b4ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,14 +52,15 @@ tar = "0.4.38" zip = "0.6.2" tower = "0.4.12" -syn = { version = "1.0" } +syn = { version = "1.0", features = ["full", "extra-traits"] } -dioxus = { git = "https://github.com/dioxuslabs/dioxus/", features = ["hot-reload"] } -dioxus-rsx-interpreter = { git = "https://github.com/dioxuslabs/dioxus/" } +dioxus-core = { git = "https://github.com/dioxuslabs/dioxus/", features = ["hot-reload"] } +dioxus-rsx = { git = "https://github.com/dioxuslabs/dioxus/", features = ["hot-reload"] } proc-macro2 = { version = "1.0", features = ["span-locations"] } [[bin]] path = "src/main.rs" + name = "dioxus" diff --git a/src/cli/serve/mod.rs b/src/cli/serve/mod.rs index 93770b6ed..6619da53d 100644 --- a/src/cli/serve/mod.rs +++ b/src/cli/serve/mod.rs @@ -56,7 +56,7 @@ impl Serve { } return Ok(()); } else if platform != "web" { - return custom_error!("Unsoppurt platform target."); + return custom_error!("Unsupported platform target."); } // generate dev-index page diff --git a/src/hot_reload/mod.rs b/src/hot_reload/mod.rs index 3aced9567..ac4a537b8 100644 --- a/src/hot_reload/mod.rs +++ b/src/hot_reload/mod.rs @@ -6,6 +6,7 @@ pub enum DiffResult { RsxChanged(Vec<(Macro, TokenStream)>), } +/// Find any rsx calls in the given file and return a list of all the rsx calls that have changed. pub fn find_rsx(new: &File, old: &File) -> DiffResult { let mut rsx_calls = Vec::new(); if new.items.len() != old.items.len() { diff --git a/src/server/hot_reload.rs b/src/server/hot_reload.rs index ae8d67e08..7b6a43951 100644 --- a/src/server/hot_reload.rs +++ b/src/server/hot_reload.rs @@ -2,14 +2,14 @@ use axum::{ extract::{ws::Message, Extension, TypedHeader, WebSocketUpgrade}, response::IntoResponse, }; -use dioxus_rsx_interpreter::SetRsxMessage; +use dioxus_core::{prelude::TemplateId, CodeLocation, OwnedCodeLocation, SetTemplateMsg}; +use dioxus_rsx::try_parse_template; use std::{path::PathBuf, sync::Arc}; use super::BuildManager; pub use crate::hot_reload::{find_rsx, DiffResult}; use crate::CrateConfig; -pub use dioxus_rsx_interpreter::{error::Error, CodeLocation, SetManyRsxMessage}; pub use proc_macro2::TokenStream; pub use std::collections::HashMap; pub use std::sync::Mutex; @@ -21,7 +21,7 @@ use syn::spanned::Spanned; use tokio::sync::broadcast; pub struct HotReloadState { - pub messages: broadcast::Sender, + pub messages: broadcast::Sender, pub build_manager: Arc, pub last_file_rebuild: Arc>, pub watcher_config: CrateConfig, @@ -91,10 +91,12 @@ pub async fn hot_reload_handler( } } let mut new_str = String::new(); - file.read_to_string(&mut new_str).expect("Unable to read file"); + file.read_to_string(&mut new_str) + .expect("Unable to read file"); if let Ok(new_file) = syn::parse_file(&new_str) { if let Ok(old_file) = syn::parse_file(&v) { - if let DiffResult::RsxChanged(changed) = find_rsx(&new_file, &old_file) { + if let DiffResult::RsxChanged(changed) = find_rsx(&new_file, &old_file) + { for (old, new) in changed.into_iter() { let hr = get_location( &state.watcher_config.crate_dir, @@ -116,72 +118,54 @@ pub async fn hot_reload_handler( if let Some(last) = lines.last_mut() { // if there is only one line the start index of last line will be the start of the rsx!, not the start of the line if start.line == end.line { - *last = - last.split_at(end.column - start.column).0; + *last = last.split_at(end.column - start.column).0; } else { *last = last.split_at(end.column).0; } } let rsx = lines.join("\n"); - messages.push(SetRsxMessage { - location: hr, - new_text: rsx, - }); + + let old_dyn_ctx = try_parse_template( + &format!("{}", old.tokens), + hr.to_owned(), + None, + ) + .map(|(_, old_dyn_ctx)| old_dyn_ctx); + if let Ok((template, _)) = + try_parse_template(&rsx, hr.to_owned(), old_dyn_ctx.ok()) + { + messages.push(SetTemplateMsg(TemplateId(hr), template)); + } } } } } } - log::info!("finished"); } - - let msg = SetManyRsxMessage(messages); - if socket - .send(Message::Text(serde_json::to_string(&msg).unwrap())) - .await - .is_err() - { - return; + for msg in messages { + if socket + .send(Message::Text(serde_json::to_string(&msg).unwrap())) + .await + .is_err() + { + return; + } } + log::info!("finished"); } let mut rx = state.messages.subscribe(); let hot_reload_handle = tokio::spawn(async move { loop { - let read_set_rsx = rx.recv(); - let read_err = socket.recv(); - tokio::select! { - err = read_err => { - if let Some(Ok(err)) = err { - if let Message::Text(err) = err { - let error: Error = serde_json::from_str(&err).unwrap(); - match error{ - Error::ParseError(parse_error) => { - log::error!("parse error:\n--> at {}:{}:{}\n\t{:?}", parse_error.location.file_path, parse_error.location.line, parse_error.location.column, parse_error.message); - }, - Error::RecompileRequiredError(_) => { - if let Err(err) = state.build_manager.rebuild(){ - log::error!("{}", err); - } - } - } - } - } else { - break; - } - }, - set_rsx = read_set_rsx => { - if let Ok(rsx) = set_rsx { - if socket - .send(Message::Text(serde_json::to_string(&rsx).unwrap())) - .await - .is_err() - { - break; - }; - } - } - }; + if let Ok(rsx) = rx.recv().await { + if socket + .send(Message::Text(serde_json::to_string(&rsx).unwrap())) + .await + .is_err() + { + break; + }; + } } }); @@ -192,10 +176,10 @@ pub async fn hot_reload_handler( pub fn get_location(crate_path: &Path, path: &Path, ts: TokenStream) -> CodeLocation { let span = ts.span().start(); let relative = path.strip_prefix(crate_path).unwrap(); - CodeLocation { + CodeLocation::Dynamic(Box::new(OwnedCodeLocation { file_path: relative.display().to_string(), crate_path: crate_path.display().to_string(), line: span.line as u32, column: span.column as u32 + 1, - } + })) } diff --git a/src/server/mod.rs b/src/server/mod.rs index a9484faf6..cc2afdec0 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -8,7 +8,8 @@ use axum::{ }; use cargo_metadata::diagnostic::Diagnostic; use colored::Colorize; -use dioxus_rsx_interpreter::SetRsxMessage; +use dioxus_core::{prelude::TemplateId, SetTemplateMsg}; +use dioxus_rsx::try_parse_template; use notify::{RecommendedWatcher, Watcher}; use syn::spanned::Spanned; @@ -155,10 +156,25 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> { } } let rsx = lines.join("\n"); - messages.push(SetRsxMessage { - location: hr, - new_text: rsx, - }); + + let old_dyn_ctx = try_parse_template( + &format!("{}", old.tokens), + hr.to_owned(), + None, + ) + .map(|(_, old_dyn_ctx)| old_dyn_ctx); + if let Ok((template, _)) = try_parse_template( + &rsx, + hr.to_owned(), + old_dyn_ctx.ok(), + ) { + messages.push(SetTemplateMsg( + TemplateId(hr), + template, + )); + } else { + needs_rebuild = true; + } } } } @@ -187,8 +203,8 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> { } } } - if !messages.is_empty() { - let _ = hot_reload_tx.send(SetManyRsxMessage(messages)); + for msg in messages { + let _ = hot_reload_tx.send(msg); } } last_update_time = chrono::Local::now().timestamp(); @@ -428,8 +444,8 @@ fn print_console_info(port: u16, config: &CrateConfig, options: PrettierOptions) "clear" }) .output() - .unwrap() - .stdout + .map(|output| output.stdout) + .unwrap_or_default() ) );