adds feature server_fn_axum that compiles for wasm target (#3840)
The current `axum` feature and `server` feature are incompatible with wasm32-unknown-unknown target due to: 1. depends on axum features not compatible with wasm 2. SSR requires reading the filesystem for index.html With this patch I add the `server_fn_axum` feature which disables SSR and enables targeting wasm32-unknown-unknown with server functions enabled. Note that for this to work, `server_fn` depends on `inventory` and as stated in this docs depending on the context you might need to expose and call [`__wasm_call_ctors`](https://docs.rs/inventory/latest/inventory/#webassembly-and-constructors) (I needed that specifically for cloudflare workers) change axum_server_fn feature for axum_wasm and include SSR tools there This change additionaly make axum_server_fn feature additive by exposing a different `DioxusRouterWasmExt` with only the wasm-compatible parts instead of exposing the `DioxusRouter` trait under the same name. Docs are updated to reflect this change. rename axum_wasm to axum_core and update docs fix typo re-enable default-features for axum in dioxus-cli re-enable axum default-features for liveview re-enable default-features for axum for playwright-tests
This commit is contained in:
10 files changed
+446
-368
No files matched your search
@@ -4,14 +4,24 @@
|
||||
#![deny(missing_docs)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use once_cell;
|
||||
|
||||
mod html_storage;
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) type ContextProviders =
|
||||
Arc<Vec<Box<dyn Fn() -> Box<dyn std::any::Any> + Send + Sync + 'static>>>;
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
|
||||
pub mod server;
|
||||
|
||||
#[cfg(feature = "axum_core")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "axum_core")))]
|
||||
pub mod axum_core;
|
||||
|
||||
mod hooks;
|
||||
|
||||
pub mod document;
|
||||
@@ -22,6 +32,7 @@ mod streaming;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
mod serve_config;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub use serve_config::*;
|
||||
|
||||
@@ -37,6 +48,9 @@ pub mod prelude {
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
|
||||
pub use crate::server::*;
|
||||
|
||||
#[cfg(feature = "axum_core")]
|
||||
pub use crate::axum_core::*;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
|
||||
pub use crate::render::{FullstackHTMLTemplate, SSRState};
|
||||
@@ -45,8 +59,8 @@ pub mod prelude {
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "server")))]
|
||||
pub use crate::serve_config::{ServeConfig, ServeConfigBuilder};
|
||||
|
||||
#[cfg(all(feature = "server", feature = "axum"))]
|
||||
#[cfg_attr(docsrs, doc(cfg(all(feature = "server", feature = "axum"))))]
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
|
||||
pub use crate::server_context::Axum;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
|
||||
Reference in new issue
Block a user