Hotreloading of for/if/body, formatted strings, literals, component props, nested rsx, light CLI rewrite, cli TUI (#2258)

Hotreload the contents of for loops, if chains, component bodies, props, attributes, and any literals discovered in rsx!
Add a TUI renderer to the CLI.
Improve the CLI build system to be async and parallel.
Refactor RSX to allow partial expansion of expressions.
Merge autofmt implementations for consistency.
Merge the representation of elements and components under the hood.
Add a diagnostics system for rsx for improved error messages.
Drop interprocess and move to websockets for communication between the CLI and the server.
Assign IDs to nodes and attributes in a stable way to be used in non compiler contexts.
Add hotreloading to any body of component/for loop/if chain/etc.

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Liam Mitchell <liamkarlmitchell@gmail.com>
This commit is contained in:
authored and GitHub committed 2024-07-17 19:11:18 -07:00
1 parent 176e67e5b7
commit 88af3e7eff
181 files changed
+12755 -10806

No files matched your search

+5 -21
View File
@@ -8,37 +8,21 @@ pub use config::*;
mod bundle;
pub use bundle::*;
mod cargo;
pub use cargo::*;
#[cfg(feature = "cli")]
mod serve;
#[cfg(feature = "cli")]
pub use serve::*;
#[cfg(feature = "cli")]
mod settings;
#[cfg(feature = "cli")]
pub use settings::*;
#[doc(hidden)]
pub mod __private {
use crate::CrateConfig;
use crate::DioxusConfig;
pub(crate) const CONFIG_ENV: &str = "DIOXUS_CONFIG";
pub(crate) const CONFIG_BASE_PATH_ENV: &str = "DIOXUS_CONFIG_BASE_PATH";
pub fn save_config(config: &CrateConfig) -> CrateConfigDropGuard {
pub fn save_config(config: &DioxusConfig) -> CrateConfigDropGuard {
std::env::set_var(CONFIG_ENV, serde_json::to_string(config).unwrap());
std::env::set_var(
CONFIG_BASE_PATH_ENV,
config
.dioxus_config
.web
.app
.base_path
.clone()
.unwrap_or_default(),
config.web.app.base_path.clone().unwrap_or_default(),
);
CrateConfigDropGuard
}
@@ -53,7 +37,7 @@ pub mod __private {
}
}
#[cfg(feature = "cli")]
#[cfg(feature = "read-config")]
/// The environment variable that stores the CLIs serve configuration.
/// We use this to communicate between the CLI and the server for fullstack applications.
pub const SERVE_ENV: &str = "DIOXUS_SERVE_CONFIG";
@@ -74,7 +58,7 @@ impl std::error::Error for DioxusCLINotUsed {}
#[cfg(feature = "read-config")]
/// The current crate's configuration.
pub static CURRENT_CONFIG: once_cell::sync::Lazy<
Result<crate::config::CrateConfig, DioxusCLINotUsed>,
Result<crate::config::DioxusConfig, DioxusCLINotUsed>,
> = once_cell::sync::Lazy::new(|| {
CURRENT_CONFIG_JSON
.and_then(|config| serde_json::from_str(config).ok())