mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
Split out isrg from ssr and reorient build graph to make interpreter build 2x faster (#2969)
* split out isrg and core-types to speed up interpreter build
This commit is contained in:
parent
f0d814fede
commit
143ad749ea
28 changed files with 197 additions and 231 deletions
70
Cargo.lock
generated
70
Cargo.lock
generated
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
6
packages/core-types/Cargo.toml
Normal file
6
packages/core-types/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "dioxus-core-types"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
100
packages/core-types/src/bubbles.rs
Normal file
100
packages/core-types/src/bubbles.rs
Normal file
|
@ -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,
|
||||
}
|
||||
}
|
3
packages/core-types/src/lib.rs
Normal file
3
packages/core-types/src/lib.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub mod bubbles;
|
||||
|
||||
pub use bubbles::*;
|
|
@ -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",
|
||||
|
|
|
@ -65,7 +65,7 @@ async fn get_meaning(of: String) -> Result<Option<u32>, 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
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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<Vec<Renderer>>,
|
||||
incremental_cache: Option<RwLock<dioxus_ssr::incremental::IncrementalRenderer>>,
|
||||
incremental_cache: Option<RwLock<dioxus_isrg::IncrementalRenderer>>,
|
||||
}
|
||||
|
||||
impl SsrRendererPool {
|
||||
fn new(
|
||||
initial_size: usize,
|
||||
incremental: Option<dioxus_ssr::incremental::IncrementalRendererConfig>,
|
||||
incremental: Option<dioxus_isrg::IncrementalRendererConfig>,
|
||||
) -> 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<Result<String, dioxus_ssr::incremental::IncrementalRendererError>>,
|
||||
render_into: &mut Sender<Result<String, dioxus_isrg::IncrementalRendererError>>,
|
||||
) -> Option<RenderFreshness> {
|
||||
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<Item = Result<String, dioxus_ssr::incremental::IncrementalRendererError>>,
|
||||
impl Stream<Item = Result<String, dioxus_isrg::IncrementalRendererError>>,
|
||||
),
|
||||
dioxus_ssr::incremental::IncrementalRendererError,
|
||||
dioxus_isrg::IncrementalRendererError,
|
||||
> {
|
||||
struct ReceiverWithDrop {
|
||||
receiver: futures_channel::mpsc::Receiver<
|
||||
Result<String, dioxus_ssr::incremental::IncrementalRendererError>,
|
||||
Result<String, dioxus_isrg::IncrementalRendererError>,
|
||||
>,
|
||||
cancel_task: Option<tokio::task::JoinHandle<()>>,
|
||||
}
|
||||
|
||||
impl Stream for ReceiverWithDrop {
|
||||
type Item = Result<String, dioxus_ssr::incremental::IncrementalRendererError>;
|
||||
type Item = Result<String, dioxus_isrg::IncrementalRendererError>;
|
||||
|
||||
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<String, dioxus_ssr::incremental::IncrementalRendererError>,
|
||||
Result<String, dioxus_isrg::IncrementalRendererError>,
|
||||
>(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<Item = Result<String, dioxus_ssr::incremental::IncrementalRendererError>>,
|
||||
impl Stream<Item = Result<String, dioxus_isrg::IncrementalRendererError>>,
|
||||
),
|
||||
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<std::rc::Rc<dyn dioxus_lib::prelude::document::Document>> =
|
||||
let document: Option<std::rc::Rc<dyn Document>> =
|
||||
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<R: std::fmt::Write>(
|
||||
&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<R: std::fmt::Write>(
|
||||
&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)?;
|
||||
|
|
|
@ -11,7 +11,7 @@ pub struct ServeConfigBuilder {
|
|||
pub(crate) root_id: Option<&'static str>,
|
||||
pub(crate) index_html: Option<String>,
|
||||
pub(crate) index_path: Option<PathBuf>,
|
||||
pub(crate) incremental: Option<dioxus_ssr::incremental::IncrementalRendererConfig>,
|
||||
pub(crate) incremental: Option<dioxus_isrg::IncrementalRendererConfig>,
|
||||
}
|
||||
|
||||
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<dioxus_ssr::incremental::IncrementalRendererConfig>,
|
||||
pub(crate) incremental: Option<dioxus_isrg::IncrementalRendererConfig>,
|
||||
}
|
||||
|
||||
impl ServeConfig {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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
|
||||
|
|
12
packages/isrg/Cargo.toml
Normal file
12
packages/isrg/Cargo.toml
Normal file
|
@ -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 }
|
|
@ -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,
|
|
@ -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"]
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
mod cache;
|
||||
pub mod config;
|
||||
#[cfg(feature = "incremental")]
|
||||
pub mod incremental;
|
||||
pub mod renderer;
|
||||
pub mod template;
|
||||
|
||||
|
|
|
@ -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
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -65,7 +65,7 @@ async fn get_meaning(of: String) -> Result<Option<u32>, 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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<RenderFreshness, dioxus_ssr::incremental::IncrementalRendererError> {
|
||||
) -> Result<RenderFreshness, dioxus_isrg::IncrementalRendererError> {
|
||||
use dioxus_fullstack::prelude::*;
|
||||
|
||||
let context = server_context_for_route(&route);
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue