diff --git a/Cargo.lock b/Cargo.lock index d748de0df..a270e2577 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,37 +279,6 @@ dependencies = [ "syn 2.0.77", ] -[[package]] -name = "argh" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" -dependencies = [ - "argh_derive", - "argh_shared", -] - -[[package]] -name = "argh_derive" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" -dependencies = [ - "argh_shared", - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "argh_shared" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" -dependencies = [ - "serde", -] - [[package]] name = "arrayvec" version = "0.7.6" @@ -2664,6 +2633,10 @@ dependencies = [ "trybuild", ] +[[package]] +name = "dioxus-core-types" +version = "0.6.0-alpha.2" + [[package]] name = "dioxus-desktop" version = "0.6.0-alpha.2" @@ -2761,6 +2734,7 @@ dependencies = [ "dioxus-desktop", "dioxus-hot-reload", "dioxus-interpreter-js", + "dioxus-isrg", "dioxus-lib", "dioxus-mobile", "dioxus-ssr", @@ -2880,6 +2854,7 @@ name = "dioxus-interpreter-js" version = "0.6.0-alpha.2" dependencies = [ "dioxus-core", + "dioxus-core-types", "dioxus-html", "js-sys", "lazy-js-bundle", @@ -2892,6 +2867,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "dioxus-isrg" +version = "0.6.0-alpha.2" +dependencies = [ + "chrono", + "http 1.1.0", + "lru 0.12.4", + "rustc-hash 1.1.0", + "thiserror", + "tracing", +] + [[package]] name = "dioxus-lib" version = "0.6.0-alpha.2" @@ -3099,28 +3086,11 @@ dependencies = [ name = "dioxus-ssr" version = "0.6.0-alpha.2" dependencies = [ - "anyhow", - "argh", "askama_escape", - "async-trait", - "chrono", "dioxus", - "dioxus-cli-config", "dioxus-core", - "dioxus-html", - "dioxus-interpreter-js", - "dioxus-signals", - "fern", - "fs_extra", - "generational-box", - "http 1.1.0", - "lru 0.12.4", + "dioxus-core-types", "rustc-hash 1.1.0", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", ] [[package]] @@ -3133,6 +3103,7 @@ dependencies = [ "dioxus-cli-config", "dioxus-fullstack", "dioxus-hot-reload", + "dioxus-isrg", "dioxus-lib", "dioxus-router", "dioxus-ssr", @@ -3160,6 +3131,7 @@ dependencies = [ "console_error_panic_hook", "dioxus", "dioxus-core", + "dioxus-core-types", "dioxus-hot-reload", "dioxus-html", "dioxus-interpreter-js", diff --git a/Cargo.toml b/Cargo.toml index afbe7229f..227d47148 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "packages/dioxus", "packages/dioxus-lib", "packages/core", + "packages/core-types", "packages/cli", "packages/cli-config", "packages/core-macro", @@ -68,6 +69,7 @@ version = "0.6.0-alpha.2" dioxus = { path = "packages/dioxus", version = "0.6.0-alpha.0" } dioxus-lib = { path = "packages/dioxus-lib", version = "0.6.0-alpha.0" } dioxus-core = { path = "packages/core", version = "0.6.0-alpha.0" } +dioxus-core-types = { path = "packages/core-types", version = "0.6.0-alpha.0" } dioxus-core-macro = { path = "packages/core-macro", version = "0.6.0-alpha.0" } dioxus-config-macro = { path = "packages/config-macro", version = "0.6.0-alpha.0" } dioxus-router = { path = "packages/router", version = "0.6.0-alpha.0" } @@ -76,6 +78,7 @@ dioxus-html = { path = "packages/html", version = "0.6.0-alpha.0", default-featu dioxus-html-internal-macro = { path = "packages/html-internal-macro", version = "0.6.0-alpha.0" } dioxus-hooks = { path = "packages/hooks", version = "0.6.0-alpha.0" } dioxus-web = { path = "packages/web", version = "0.6.0-alpha.0", default-features = false } +dioxus-isrg = { path = "packages/isrg", version = "0.6.0-alpha.0" } dioxus-ssr = { path = "packages/ssr", version = "0.6.0-alpha.0", default-features = false } dioxus-desktop = { path = "packages/desktop", version = "0.6.0-alpha.0", default-features = false } dioxus-mobile = { path = "packages/mobile", version = "0.6.0-alpha.0" } @@ -102,6 +105,7 @@ warnings = { version = "0.2.0" } # a fork of pretty please for tests prettier-please = { version = "0.3.0", features = ["verbatim"]} +askama_escape = "0.10.3" tracing = "0.1.37" tracing-futures = "0.2.5" toml = "0.8" diff --git a/packages/core-types/Cargo.toml b/packages/core-types/Cargo.toml new file mode 100644 index 000000000..688d053aa --- /dev/null +++ b/packages/core-types/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "dioxus-core-types" +edition = "2021" +version.workspace = true + +[dependencies] diff --git a/packages/core-types/src/bubbles.rs b/packages/core-types/src/bubbles.rs new file mode 100644 index 000000000..c38faf074 --- /dev/null +++ b/packages/core-types/src/bubbles.rs @@ -0,0 +1,100 @@ +/// Check if the event bubbles +/// +/// todo: this should not be in this crate, but this crate is a "root" crate and +/// has zero-deps, meaning it gets compiled before anything else. +/// +/// This function being here means we can use it in the interpreter without pulling in dioxus-html, +/// drastically shortening the crate graph and thus compile times +/// +/// The real solution to this problem is that events need to mark themselves as "bubbling" or "not bubbling" +/// in their definition, which gets passed as part of the mutations. +pub fn event_bubbles(evt: &str) -> bool { + match evt { + "copy" => true, + "cut" => true, + "paste" => true, + "compositionend" => true, + "compositionstart" => true, + "compositionupdate" => true, + "keydown" => true, + "keypress" => true, + "keyup" => true, + "focus" => false, + "focusout" => true, + "focusin" => true, + "blur" => false, + "change" => true, + "input" => true, + "invalid" => true, + "reset" => true, + "submit" => true, + "click" => true, + "contextmenu" => true, + "doubleclick" => true, + "dblclick" => true, + "drag" => true, + "dragend" => true, + "dragenter" => false, + "dragexit" => false, + "dragleave" => true, + "dragover" => true, + "dragstart" => true, + "drop" => true, + "mousedown" => true, + "mouseenter" => false, + "mouseleave" => false, + "mousemove" => true, + "mouseout" => true, + "scroll" => false, + "mouseover" => true, + "mouseup" => true, + "pointerdown" => true, + "pointermove" => true, + "pointerup" => true, + "pointercancel" => true, + "gotpointercapture" => true, + "lostpointercapture" => true, + "pointerenter" => false, + "pointerleave" => false, + "pointerover" => true, + "pointerout" => true, + "select" => true, + "touchcancel" => true, + "touchend" => true, + "touchmove" => true, + "touchstart" => true, + "wheel" => true, + "abort" => false, + "canplay" => false, + "canplaythrough" => false, + "durationchange" => false, + "emptied" => false, + "encrypted" => true, + "ended" => false, + "error" => false, + "loadeddata" => false, + "loadedmetadata" => false, + "loadstart" => false, + "load" => false, + "pause" => false, + "play" => false, + "playing" => false, + "progress" => false, + "ratechange" => false, + "resize" => false, + "seeked" => false, + "seeking" => false, + "stalled" => false, + "suspend" => false, + "timeupdate" => false, + "volumechange" => false, + "waiting" => false, + "animationstart" => true, + "animationend" => true, + "animationiteration" => true, + "transitionend" => true, + "toggle" => true, + "mounted" => false, + _ => true, + } +} diff --git a/packages/core-types/src/lib.rs b/packages/core-types/src/lib.rs new file mode 100644 index 000000000..4ab232624 --- /dev/null +++ b/packages/core-types/src/lib.rs @@ -0,0 +1,3 @@ +pub mod bubbles; + +pub use bubbles::*; diff --git a/packages/fullstack/Cargo.toml b/packages/fullstack/Cargo.toml index 20cbc6f30..b58175fb4 100644 --- a/packages/fullstack/Cargo.toml +++ b/packages/fullstack/Cargo.toml @@ -24,6 +24,7 @@ generational-box = { workspace = true } # Dioxus + SSR dioxus-ssr = { workspace = true, optional = true } +dioxus-isrg = { workspace = true, optional = true } hyper = { workspace = true, optional = true } http = { workspace = true, optional = true } @@ -95,7 +96,7 @@ server = [ "dep:tokio-util", "dep:tokio-stream", "dep:dioxus-ssr", - "dioxus-ssr/incremental", + "dep:dioxus-isrg", "dep:tower", "dep:hyper", "dep:http", diff --git a/packages/fullstack/README.md b/packages/fullstack/README.md index 764bdbded..b982681ff 100644 --- a/packages/fullstack/README.md +++ b/packages/fullstack/README.md @@ -65,7 +65,7 @@ async fn get_meaning(of: String) -> Result, ServerFnError> { ## Getting Started -To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/learn/0.5/getting_started), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/fullstack/examples). +To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/learn/0.5/getting_started), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/examples). ## Contributing diff --git a/packages/fullstack/src/lib.rs b/packages/fullstack/src/lib.rs index c7794ac4a..7e32eb114 100644 --- a/packages/fullstack/src/lib.rs +++ b/packages/fullstack/src/lib.rs @@ -62,7 +62,7 @@ pub mod prelude { #[cfg(feature = "server")] #[cfg_attr(docsrs, doc(cfg(feature = "server")))] - pub use dioxus_ssr::incremental::{IncrementalRenderer, IncrementalRendererConfig}; + pub use dioxus_isrg::{IncrementalRenderer, IncrementalRendererConfig}; pub use dioxus_server_macro::*; pub use server_fn::{self, ServerFn as _, ServerFnError}; diff --git a/packages/fullstack/src/render.rs b/packages/fullstack/src/render.rs index c0f5c010a..526985108 100644 --- a/packages/fullstack/src/render.rs +++ b/packages/fullstack/src/render.rs @@ -1,10 +1,8 @@ //! A shared pool of renderers for efficient server side rendering. use crate::streaming::{Mount, StreamingRenderer}; use dioxus_interpreter_js::INITIALIZE_STREAMING_JS; -use dioxus_ssr::{ - incremental::{CachedRender, RenderFreshness}, - Renderer, -}; +use dioxus_isrg::{CachedRender, RenderFreshness}; +use dioxus_ssr::Renderer; use futures_channel::mpsc::Sender; use futures_util::{Stream, StreamExt}; use std::sync::Arc; @@ -48,13 +46,13 @@ where struct SsrRendererPool { renderers: RwLock>, - incremental_cache: Option>, + incremental_cache: Option>, } impl SsrRendererPool { fn new( initial_size: usize, - incremental: Option, + incremental: Option, ) -> Self { let renderers = RwLock::new((0..initial_size).map(|_| pre_renderer()).collect()); Self { @@ -67,7 +65,7 @@ impl SsrRendererPool { fn check_cached_route( &self, route: &str, - render_into: &mut Sender>, + render_into: &mut Sender>, ) -> Option { if let Some(incremental) = &self.incremental_cache { if let Ok(mut incremental) = incremental.write() { @@ -79,11 +77,7 @@ impl SsrRendererPool { .. } = cached_render; _ = render_into.start_send(String::from_utf8(response.to_vec()).map_err( - |err| { - dioxus_ssr::incremental::IncrementalRendererError::Other(Box::new( - err, - )) - }, + |err| dioxus_isrg::IncrementalRendererError::Other(Box::new(err)), )); return Some(freshness); } @@ -110,19 +104,19 @@ impl SsrRendererPool { ) -> Result< ( RenderFreshness, - impl Stream>, + impl Stream>, ), - dioxus_ssr::incremental::IncrementalRendererError, + dioxus_isrg::IncrementalRendererError, > { struct ReceiverWithDrop { receiver: futures_channel::mpsc::Receiver< - Result, + Result, >, cancel_task: Option>, } impl Stream for ReceiverWithDrop { - type Item = Result; + type Item = Result; fn poll_next( mut self: std::pin::Pin<&mut Self>, @@ -142,7 +136,7 @@ impl SsrRendererPool { } let (mut into, rx) = futures_channel::mpsc::channel::< - Result, + Result, >(1000); // before we even spawn anything, we can check synchronously if we have the route cached @@ -302,9 +296,7 @@ impl SsrRendererPool { resolved_data, &mut resolved_chunk, ) { - throw_error!( - dioxus_ssr::incremental::IncrementalRendererError::RenderError(err) - ); + throw_error!(dioxus_isrg::IncrementalRendererError::RenderError(err)); } stream.render(resolved_chunk); @@ -406,9 +398,9 @@ impl SSRState { ) -> Result< ( RenderFreshness, - impl Stream>, + impl Stream>, ), - dioxus_ssr::incremental::IncrementalRendererError, + dioxus_isrg::IncrementalRendererError, > { self.renderers .clone() @@ -435,11 +427,11 @@ impl FullstackHTMLTemplate { &self, to: &mut R, virtual_dom: &VirtualDom, - ) -> Result<(), dioxus_ssr::incremental::IncrementalRendererError> { + ) -> Result<(), dioxus_isrg::IncrementalRendererError> { let ServeConfig { index, .. } = &self.cfg; let title = { - let document: Option> = + let document: Option> = virtual_dom.in_runtime(|| ScopeId::ROOT.consume_context()); let document: Option<&crate::document::server::ServerDocument> = document .as_ref() @@ -478,7 +470,7 @@ impl FullstackHTMLTemplate { fn render_before_body( &self, to: &mut R, - ) -> Result<(), dioxus_ssr::incremental::IncrementalRendererError> { + ) -> Result<(), dioxus_isrg::IncrementalRendererError> { let ServeConfig { index, .. } = &self.cfg; to.write_str(&index.close_head)?; @@ -493,7 +485,7 @@ impl FullstackHTMLTemplate { &self, to: &mut R, virtual_dom: &VirtualDom, - ) -> Result<(), dioxus_ssr::incremental::IncrementalRendererError> { + ) -> Result<(), dioxus_isrg::IncrementalRendererError> { let ServeConfig { index, .. } = &self.cfg; // Collect the initial server data from the root node. For most apps, no use_server_futures will be resolved initially, so this will be full on `None`s. @@ -512,7 +504,7 @@ impl FullstackHTMLTemplate { pub fn render_after_body( &self, to: &mut R, - ) -> Result<(), dioxus_ssr::incremental::IncrementalRendererError> { + ) -> Result<(), dioxus_isrg::IncrementalRendererError> { let ServeConfig { index, .. } = &self.cfg; to.write_str(&index.after_closing_body_tag)?; @@ -526,7 +518,7 @@ impl FullstackHTMLTemplate { to: &mut R, virtual_dom: &VirtualDom, body: impl std::fmt::Display, - ) -> Result<(), dioxus_ssr::incremental::IncrementalRendererError> { + ) -> Result<(), dioxus_isrg::IncrementalRendererError> { self.render_head(to, virtual_dom)?; write!(to, "{body}")?; self.render_after_main(to, virtual_dom)?; diff --git a/packages/fullstack/src/serve_config.rs b/packages/fullstack/src/serve_config.rs index 0d30136f7..3f1482b95 100644 --- a/packages/fullstack/src/serve_config.rs +++ b/packages/fullstack/src/serve_config.rs @@ -11,7 +11,7 @@ pub struct ServeConfigBuilder { pub(crate) root_id: Option<&'static str>, pub(crate) index_html: Option, pub(crate) index_path: Option, - pub(crate) incremental: Option, + pub(crate) incremental: Option, } impl ServeConfigBuilder { @@ -26,7 +26,7 @@ impl ServeConfigBuilder { } /// Enable incremental static generation - pub fn incremental(mut self, cfg: dioxus_ssr::incremental::IncrementalRendererConfig) -> Self { + pub fn incremental(mut self, cfg: dioxus_isrg::IncrementalRendererConfig) -> Self { self.incremental = Some(cfg); self } @@ -166,7 +166,7 @@ pub(crate) struct IndexHtml { #[derive(Clone)] pub struct ServeConfig { pub(crate) index: IndexHtml, - pub(crate) incremental: Option, + pub(crate) incremental: Option, } impl ServeConfig { diff --git a/packages/html/src/events/mod.rs b/packages/html/src/events/mod.rs index 29fcf0ded..e9a5bb511 100644 --- a/packages/html/src/events/mod.rs +++ b/packages/html/src/events/mod.rs @@ -303,97 +303,3 @@ pub use toggle::*; pub use touch::*; pub use transition::*; pub use wheel::*; - -pub fn event_bubbles(evt: &str) -> bool { - match evt { - "copy" => true, - "cut" => true, - "paste" => true, - "compositionend" => true, - "compositionstart" => true, - "compositionupdate" => true, - "keydown" => true, - "keypress" => true, - "keyup" => true, - "focus" => false, - "focusout" => true, - "focusin" => true, - "blur" => false, - "change" => true, - "input" => true, - "invalid" => true, - "reset" => true, - "submit" => true, - "click" => true, - "contextmenu" => true, - "doubleclick" => true, - "dblclick" => true, - "drag" => true, - "dragend" => true, - "dragenter" => false, - "dragexit" => false, - "dragleave" => true, - "dragover" => true, - "dragstart" => true, - "drop" => true, - "mousedown" => true, - "mouseenter" => false, - "mouseleave" => false, - "mousemove" => true, - "mouseout" => true, - "scroll" => false, - "mouseover" => true, - "mouseup" => true, - "pointerdown" => true, - "pointermove" => true, - "pointerup" => true, - "pointercancel" => true, - "gotpointercapture" => true, - "lostpointercapture" => true, - "pointerenter" => false, - "pointerleave" => false, - "pointerover" => true, - "pointerout" => true, - "select" => true, - "touchcancel" => true, - "touchend" => true, - "touchmove" => true, - "touchstart" => true, - "wheel" => true, - "abort" => false, - "canplay" => false, - "canplaythrough" => false, - "durationchange" => false, - "emptied" => false, - "encrypted" => true, - "ended" => false, - "error" => false, - "loadeddata" => false, - "loadedmetadata" => false, - "loadstart" => false, - "load" => false, - "pause" => false, - "play" => false, - "playing" => false, - "progress" => false, - "ratechange" => false, - "resize" => false, - "seeked" => false, - "seeking" => false, - "stalled" => false, - "suspend" => false, - "timeupdate" => false, - "volumechange" => false, - "waiting" => false, - "animationstart" => true, - "animationend" => true, - "animationiteration" => true, - "transitionend" => true, - "toggle" => true, - "mounted" => false, - _ => { - tracing::warn!("Unknown event name: {evt}"); - true - } - } -} diff --git a/packages/interpreter/Cargo.toml b/packages/interpreter/Cargo.toml index 14d64ad2d..3839eb0f1 100644 --- a/packages/interpreter/Cargo.toml +++ b/packages/interpreter/Cargo.toml @@ -24,6 +24,7 @@ serde = { version = "1.0", features = ["derive"], optional = true } rustc-hash = { workspace = true, optional = true } dioxus-core = { workspace = true, optional = true } +dioxus-core-types = { workspace = true, optional = true } dioxus-html = { workspace = true, optional = true } [build-dependencies] @@ -41,5 +42,5 @@ webonly = [ "dep:web-sys", "sledgehammer_bindgen/web", ] -binary-protocol = ["sledgehammer", "dep:dioxus-core", "dep:dioxus-html"] +binary-protocol = ["sledgehammer", "dep:dioxus-core", "dep:dioxus-core-types", "dep:dioxus-html"] minimal_bindings = [] diff --git a/packages/interpreter/src/write_native_mutations.rs b/packages/interpreter/src/write_native_mutations.rs index 92b51a7a5..93d072724 100644 --- a/packages/interpreter/src/write_native_mutations.rs +++ b/packages/interpreter/src/write_native_mutations.rs @@ -1,6 +1,6 @@ use crate::unified_bindings::Interpreter as Channel; use dioxus_core::{Template, TemplateAttribute, TemplateNode, WriteMutations}; -use dioxus_html::event_bubbles; +use dioxus_core_types::event_bubbles; use rustc_hash::FxHashMap; /// The state needed to apply mutations to a channel. This state should be kept across all mutations for the app diff --git a/packages/isrg/Cargo.toml b/packages/isrg/Cargo.toml new file mode 100644 index 000000000..db0dfe370 --- /dev/null +++ b/packages/isrg/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "dioxus-isrg" +edition = "2021" +version.workspace = true + +[dependencies] +chrono = { workspace = true } +http = { workspace = true } +thiserror = { workspace = true } +rustc-hash = { workspace = true } +lru = { workspace = true } +tracing = { workspace = true } diff --git a/packages/ssr/src/incremental/config.rs b/packages/isrg/src/config.rs similarity index 95% rename from packages/ssr/src/incremental/config.rs rename to packages/isrg/src/config.rs index b05487def..c785265e6 100644 --- a/packages/ssr/src/incremental/config.rs +++ b/packages/isrg/src/config.rs @@ -1,6 +1,6 @@ #![allow(non_snake_case)] -use crate::incremental::IncrementalRenderer; +use crate::IncrementalRenderer; use std::{ path::{Path, PathBuf}, @@ -82,7 +82,7 @@ impl IncrementalRendererConfig { pub fn build(self) -> IncrementalRenderer { let mut renderer = IncrementalRenderer { #[cfg(not(target_arch = "wasm32"))] - file_system_cache: crate::incremental::fs_cache::FileSystemCache::new( + file_system_cache: crate::fs_cache::FileSystemCache::new( self.static_dir.clone(), self.map_path, self.invalidate_after, diff --git a/packages/ssr/src/incremental/freshness.rs b/packages/isrg/src/freshness.rs similarity index 100% rename from packages/ssr/src/incremental/freshness.rs rename to packages/isrg/src/freshness.rs diff --git a/packages/ssr/src/incremental/fs_cache.rs b/packages/isrg/src/fs_cache.rs similarity index 100% rename from packages/ssr/src/incremental/fs_cache.rs rename to packages/isrg/src/fs_cache.rs diff --git a/packages/ssr/src/incremental/mod.rs b/packages/isrg/src/lib.rs similarity index 100% rename from packages/ssr/src/incremental/mod.rs rename to packages/isrg/src/lib.rs diff --git a/packages/ssr/src/incremental/memory_cache.rs b/packages/isrg/src/memory_cache.rs similarity index 100% rename from packages/ssr/src/incremental/memory_cache.rs rename to packages/isrg/src/memory_cache.rs diff --git a/packages/ssr/Cargo.toml b/packages/ssr/Cargo.toml index 9f4756847..a3b75ff7e 100644 --- a/packages/ssr/Cargo.toml +++ b/packages/ssr/Cargo.toml @@ -10,42 +10,12 @@ keywords = ["dom", "ui", "gui", "react", "ssr"] [dependencies] dioxus-core = { workspace = true, features = ["serialize"] } -dioxus-html = { workspace = true, features = ["document"]} -dioxus-cli-config = { workspace = true, features = ["read-config"], optional = true } -dioxus-interpreter-js = { workspace = true } -generational-box = { workspace = true } -askama_escape = "0.10.3" -thiserror = "1.0.23" -rustc-hash = "1.1.0" -lru = { workspace = true } -tracing = { workspace = true } -http = { workspace = true } -async-trait = { workspace = true } -serde_json = { workspace = true } -chrono = { version = "0.4.34", optional = true } - -[target.'cfg(target_arch = "wasm32")'.dependencies] -tokio = { version = "1.28", features = ["io-util"], optional = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -tokio = { version = "1.28", features = ["fs", "io-util"], optional = true } +dioxus-core-types = { workspace = true } +askama_escape = { workspace = true } +rustc-hash = { workspace = true } [dev-dependencies] dioxus = { workspace = true } -dioxus-signals = { workspace = true } -tokio = { version = "1", features = ["full"] } - -tracing = { workspace = true } -fern = { version = "0.6.0", features = ["colored"] } -anyhow = "1.0" -argh = "0.1.4" -serde = "1.0.120" -serde_json = "1.0.61" -fs_extra = "1.2.0" - -[features] -default = [] -incremental = ["dep:tokio", "dep:chrono", "dep:dioxus-cli-config"] [package.metadata.docs.rs] cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] diff --git a/packages/ssr/src/lib.rs b/packages/ssr/src/lib.rs index 7d666dab8..18764c1e3 100644 --- a/packages/ssr/src/lib.rs +++ b/packages/ssr/src/lib.rs @@ -4,8 +4,6 @@ mod cache; pub mod config; -#[cfg(feature = "incremental")] -pub mod incremental; pub mod renderer; pub mod template; diff --git a/packages/ssr/src/renderer.rs b/packages/ssr/src/renderer.rs index dc8c0ca2f..d9e178f32 100644 --- a/packages/ssr/src/renderer.rs +++ b/packages/ssr/src/renderer.rs @@ -243,7 +243,11 @@ impl Renderer { // then write any listeners for name in accumulated_listeners.drain(..) { write!(buf, ",{}:", &name[2..])?; - write!(buf, "{}", dioxus_html::event_bubbles(&name[2..]) as u8)?; + write!( + buf, + "{}", + dioxus_core_types::event_bubbles(&name[2..]) as u8 + )?; } } diff --git a/packages/static-generation/Cargo.toml b/packages/static-generation/Cargo.toml index 0b3f54662..c4a123955 100644 --- a/packages/static-generation/Cargo.toml +++ b/packages/static-generation/Cargo.toml @@ -14,7 +14,8 @@ resolver = "2" dioxus-fullstack = { workspace = true } dioxus-lib.workspace = true dioxus-router = { workspace = true, features = ["fullstack"]} -dioxus-ssr = { workspace = true, features = ["incremental"], optional = true } +dioxus-ssr = { workspace = true, optional = true } +dioxus-isrg = { workspace = true, optional = true } axum = { workspace = true, features = ["ws", "macros"], optional = true } tower-http = { workspace = true, features = ["fs"], optional = true } dioxus-hot-reload = { workspace = true, features = ["serve"], optional = true } @@ -34,10 +35,5 @@ default = [] server = ["dioxus-fullstack/server", "dioxus-router/ssr", "dep:dioxus-ssr", "dep:tokio", "dep:http", "dep:axum", "dep:tower-http", "dep:dioxus-hot-reload", "dep:dioxus-cli-config", "dep:tower"] web = ["dioxus-fullstack/web", "dioxus-router/web", "dep:dioxus-web"] -# [[bench]] -# name = "incremental" -# required-features = ["server"] -# harness = false - [package.metadata.docs.rs] cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] diff --git a/packages/static-generation/README.md b/packages/static-generation/README.md index b09e5f08c..a3b5c2e17 100644 --- a/packages/static-generation/README.md +++ b/packages/static-generation/README.md @@ -65,7 +65,7 @@ async fn get_meaning(of: String) -> Result, ServerFnError> { ## Getting Started -To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/learn/0.5/getting_started), or the [full stack examples](https://github.com/DioxusLabs/dioxus/tree/master/packages/fullstack/examples). +To get started with full stack Dioxus, check out our [getting started guide](https://dioxuslabs.com/learn/0.5/getting_started), or the [examples examples](https://github.com/DioxusLabs/dioxus/tree/master/examples). ## Contributing diff --git a/packages/static-generation/src/config.rs b/packages/static-generation/src/config.rs index c96a28613..12f123a7a 100644 --- a/packages/static-generation/src/config.rs +++ b/packages/static-generation/src/config.rs @@ -175,9 +175,9 @@ impl Config { FullstackHTMLTemplate::new(&cfg.unwrap()) } - pub(crate) fn create_cache(&mut self) -> dioxus_ssr::incremental::IncrementalRenderer { - let mut builder = dioxus_ssr::incremental::IncrementalRenderer::builder() - .static_dir(self.output_dir.clone()); + pub(crate) fn create_cache(&mut self) -> dioxus_isrg::IncrementalRenderer { + let mut builder = + dioxus_isrg::IncrementalRenderer::builder().static_dir(self.output_dir.clone()); if let Some(map_path) = self.map_path.take() { builder = builder.map_path(map_path); } diff --git a/packages/static-generation/src/ssg.rs b/packages/static-generation/src/ssg.rs index 142e64de3..0c58c0d8d 100644 --- a/packages/static-generation/src/ssg.rs +++ b/packages/static-generation/src/ssg.rs @@ -1,6 +1,6 @@ +use dioxus_isrg::*; use dioxus_lib::prelude::*; use dioxus_router::prelude::*; -use dioxus_ssr::incremental::*; use dioxus_ssr::renderer; use std::collections::HashSet; use std::fs; @@ -105,9 +105,9 @@ async fn prerender_route( app: fn() -> Element, route: String, renderer: &mut renderer::Renderer, - cache: &mut dioxus_ssr::incremental::IncrementalRenderer, + cache: &mut dioxus_isrg::IncrementalRenderer, config: &Config, -) -> Result { +) -> Result { use dioxus_fullstack::prelude::*; let context = server_context_for_route(&route); diff --git a/packages/web/Cargo.toml b/packages/web/Cargo.toml index b404725cd..8c0d3b429 100644 --- a/packages/web/Cargo.toml +++ b/packages/web/Cargo.toml @@ -11,6 +11,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"] [dependencies] dioxus-core = { workspace = true } +dioxus-core-types = { workspace = true } dioxus-html = { workspace = true, features = ["wasm-bind"] } dioxus-hot-reload = { workspace = true, features = ["client"] } dioxus-signals = { workspace = true } diff --git a/packages/web/src/mutations.rs b/packages/web/src/mutations.rs index 592c2e5f4..b0c2b7e84 100644 --- a/packages/web/src/mutations.rs +++ b/packages/web/src/mutations.rs @@ -2,7 +2,7 @@ use crate::dom::WebsysDom; use dioxus_core::prelude::*; use dioxus_core::WriteMutations; use dioxus_core::{AttributeValue, ElementId}; -use dioxus_html::event_bubbles; +use dioxus_core_types::event_bubbles; use dioxus_interpreter_js::minimal_bindings; use wasm_bindgen::JsCast; use wasm_bindgen::JsValue;