1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
#![deny(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]

pub use once_cell;

mod html_storage;

#[cfg(feature = "axum")]
mod assets;
#[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
#[cfg(feature = "axum")]
mod axum_adapter;

mod config;
mod hooks;
pub mod launch;

#[cfg(all(
    debug_assertions,
    feature = "hot-reload",
    feature = "server",
    not(target_arch = "wasm32")
))]
mod hot_reload;
pub use config::*;

#[cfg(feature = "server")]
mod render;

#[cfg(feature = "server")]
mod serve_config;

#[cfg(feature = "server")]
mod server_context;

/// A prelude of commonly used items in dioxus-fullstack.
pub mod prelude {
    use crate::hooks;
    pub use hooks::{server_cached::server_cached, server_future::use_server_future};

    #[cfg(feature = "axum")]
    #[cfg_attr(docsrs, doc(cfg(feature = "axum")))]
    pub use crate::axum_adapter::*;

    #[cfg(not(feature = "server"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "server"))))]
    pub use crate::html_storage::deserialize::get_root_props_from_document;

    #[cfg(all(feature = "server", feature = "router"))]
    #[cfg_attr(docsrs, doc(cfg(all(feature = "server", feature = "router"))))]
    pub use crate::render::pre_cache_static_routes_with_props;

    #[cfg(feature = "server")]
    #[cfg_attr(docsrs, doc(cfg(feature = "server")))]
    pub use crate::render::SSRState;

    #[cfg(feature = "router")]
    #[cfg_attr(docsrs, doc(cfg(feature = "router")))]
    pub use crate::router::FullstackRouterConfig;

    #[cfg(feature = "server")]
    #[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"))))]
    pub use crate::server_context::Axum;

    #[cfg(feature = "server")]
    #[cfg_attr(docsrs, doc(cfg(feature = "server")))]
    pub use crate::server_context::{
        extract, server_context, DioxusServerContext, FromServerContext, ProvideServerContext,
    };

    #[cfg(feature = "server")]
    #[cfg_attr(docsrs, doc(cfg(feature = "server")))]
    pub use dioxus_ssr::incremental::IncrementalRendererConfig;

    pub use dioxus_server_macro::*;
    pub use server_fn::{self, ServerFn as _, ServerFnError};
}

// // Warn users about overlapping features
// #[cfg(all(feature = "server", feature = "web", not(doc)))]
// compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `web` feature are overlapping. Please choose one or the other.");

// #[cfg(all(feature = "server", feature = "desktop", not(doc)))]
// compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `desktop` feature are overlapping. Please choose one or the other.");

// #[cfg(all(feature = "server", feature = "mobile", not(doc)))]
// compile_error!("The `ssr` feature (enabled by `warp`, `axum`, or `salvo`) and `mobile` feature are overlapping. Please choose one or the other.");