Remove dioxus-lib, fix doc imports (#4438)
* remove dioxus lib * inline some doc items * fix tests * test docs * Fix doc tests * Pull out dioxus/lib feature * disable logger and devtools in library feature * fix cargo doc * fix cargo doc
This commit is contained in:
1 parent
4cb32d372b
commit
98f7667fb4
59 files changed
+216
-530
No files matched your search
@@ -1,7 +1,7 @@
|
||||
//! Configuration for how to serve a Dioxus application
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus_lib::prelude::dioxus_core::LaunchConfig;
|
||||
use dioxus_core::LaunchConfig;
|
||||
use std::any::Any;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
@@ -49,7 +49,7 @@ impl ServeConfigBuilder {
|
||||
/// // Finally, launch the app with the config
|
||||
/// LaunchBuilder::new()
|
||||
/// // Only set the server config if the server feature is enabled
|
||||
/// .with_cfg(server_only!(ServeConfigBuilder::default().incremental(IncrementalRendererConfig::default())))
|
||||
/// .with_cfg(server_only!(dioxus_server::ServeConfigBuilder::default().incremental(dioxus_server::IncrementalRendererConfig::default())))
|
||||
/// .launch(app);
|
||||
/// ```
|
||||
pub fn incremental(mut self, cfg: dioxus_isrg::IncrementalRendererConfig) -> Self {
|
||||
@@ -96,7 +96,7 @@ impl ServeConfigBuilder {
|
||||
/// LaunchBuilder::new()
|
||||
/// // Only set the server config if the server feature is enabled
|
||||
/// .with_cfg(server_only! {
|
||||
/// ServeConfigBuilder::default().root_id("app")
|
||||
/// dioxus_server::ServeConfigBuilder::default().root_id("app")
|
||||
/// })
|
||||
/// // You also need to set the root id in your web config
|
||||
/// .with_cfg(web! {
|
||||
@@ -113,7 +113,7 @@ impl ServeConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Provide context to the root and server functions. You can use this context while rendering with [`consume_context`](dioxus_lib::prelude::consume_context)
|
||||
/// Provide context to the root and server functions. You can use this context while rendering with [`consume_context`](dioxus_core::consume_context)
|
||||
/// or in server functions with [`FromContext`](crate::FromContext).
|
||||
///
|
||||
///
|
||||
@@ -183,7 +183,7 @@ impl ServeConfigBuilder {
|
||||
}
|
||||
|
||||
/// Provide context to the root and server functions. You can use this context
|
||||
/// while rendering with [`consume_context`](dioxus_lib::prelude::consume_context) or in server functions with [`FromContext`](crate::FromContext).
|
||||
/// while rendering with [`consume_context`](dioxus_core::consume_context) or in server functions with [`FromContext`](crate::FromContext).
|
||||
///
|
||||
///
|
||||
/// The context providers passed into this method will be called when the context type is requested which may happen many times in the lifecycle of the application.
|
||||
@@ -246,7 +246,7 @@ impl ServeConfigBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Provide context to the root and server functions. You can use this context while rendering with [`consume_context`](dioxus_lib::prelude::consume_context)
|
||||
/// Provide context to the root and server functions. You can use this context while rendering with [`consume_context`](dioxus_core::consume_context)
|
||||
/// or in server functions with [`FromContext`](crate::FromContext).
|
||||
///
|
||||
/// Context will be forwarded from the LaunchBuilder if it is provided.
|
||||
|
||||
@@ -47,6 +47,7 @@ impl AtomicResponsePartsModified {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn read_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -200,6 +201,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn set_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -224,6 +226,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn set_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -246,6 +249,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn set_status() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -267,6 +271,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn set_version() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -288,6 +293,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn set_version() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -322,6 +328,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn read_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -346,6 +353,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn read_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
@@ -369,6 +377,7 @@ mod server_fn_impl {
|
||||
///
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::server_context;
|
||||
/// #[server]
|
||||
/// async fn read_headers() -> ServerFnResult {
|
||||
/// let server_context = server_context();
|
||||
|
||||
@@ -4,7 +4,13 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use dioxus_lib::{document::*, prelude::*};
|
||||
use dioxus_core::Element;
|
||||
use dioxus_core_macro::rsx;
|
||||
use dioxus_document::{
|
||||
Document, Eval, LinkProps, MetaProps, NoOpDocument, ScriptProps, StyleProps,
|
||||
};
|
||||
use dioxus_html as dioxus_elements;
|
||||
use dioxus_signals::{GlobalSignal, Readable};
|
||||
use dioxus_ssr::Renderer;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
@@ -11,8 +11,10 @@ use axum::{
|
||||
routing::IntoMakeService,
|
||||
};
|
||||
use dioxus_cli_config::base_path;
|
||||
use dioxus_core::Element;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use dioxus_core::{RenderError, VNode};
|
||||
use dioxus_devtools::DevserverMsg;
|
||||
use dioxus_lib::prelude::*;
|
||||
use futures_util::{stream::FusedStream, StreamExt};
|
||||
use hyper::body::Incoming;
|
||||
use hyper_util::server::conn::auto::Builder as HyperBuilder;
|
||||
|
||||
@@ -5,16 +5,14 @@ use crate::{
|
||||
DioxusServerContext,
|
||||
};
|
||||
use dioxus_cli_config::base_path;
|
||||
use dioxus_core::{
|
||||
has_context, provide_error_boundary, DynamicNode, ErrorContext, ScopeId, SuspenseContext,
|
||||
VNode, VirtualDom,
|
||||
};
|
||||
use dioxus_fullstack_hooks::history::FullstackHistory;
|
||||
use dioxus_fullstack_hooks::{StreamingContext, StreamingStatus};
|
||||
use dioxus_fullstack_protocol::{HydrationContext, SerializedHydrationData};
|
||||
use dioxus_isrg::{CachedRender, IncrementalRendererError, RenderFreshness};
|
||||
use dioxus_lib::{
|
||||
core::{
|
||||
has_context, provide_error_boundary, DynamicNode, ErrorContext, SuspenseContext, VirtualDom,
|
||||
},
|
||||
document::Document,
|
||||
};
|
||||
use dioxus_router::ParseRouteError;
|
||||
use dioxus_ssr::Renderer;
|
||||
use futures_channel::mpsc::Sender;
|
||||
@@ -23,7 +21,6 @@ use std::{collections::HashMap, fmt::Write, future::Future, rc::Rc, sync::Arc, s
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
use crate::StreamingMode;
|
||||
use dioxus_lib::prelude::*;
|
||||
|
||||
/// A suspense boundary that is pending with a placeholder in the client
|
||||
struct PendingSuspenseBoundary {
|
||||
@@ -210,7 +207,7 @@ impl SsrRendererPool {
|
||||
|
||||
let streaming_context = in_root_scope(&virtual_dom, StreamingContext::new);
|
||||
virtual_dom.provide_root_context(Rc::new(history) as Rc<dyn dioxus_history::History>);
|
||||
virtual_dom.provide_root_context(document.clone() as Rc<dyn Document>);
|
||||
virtual_dom.provide_root_context(document.clone() as Rc<dyn dioxus_document::Document>);
|
||||
virtual_dom.provide_root_context(streaming_context);
|
||||
|
||||
// rebuild the virtual dom
|
||||
|
||||
@@ -9,7 +9,7 @@ use axum::{
|
||||
response::IntoResponse,
|
||||
};
|
||||
|
||||
use dioxus_lib::prelude::{Element, VirtualDom};
|
||||
use dioxus_core::{Element, VirtualDom};
|
||||
use http::header::*;
|
||||
use server_fn::ServerFnTraitObj;
|
||||
use std::path::Path;
|
||||
@@ -25,8 +25,7 @@ pub trait DioxusRouterExt<S>: DioxusRouterFnExt<S> {
|
||||
/// # Example
|
||||
/// ```rust, no_run
|
||||
/// # #![allow(non_snake_case)]
|
||||
/// # use dioxus_lib::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::{DioxusRouterExt, DioxusRouterFnExt};
|
||||
///
|
||||
/// #[tokio::main]
|
||||
@@ -52,9 +51,8 @@ pub trait DioxusRouterExt<S>: DioxusRouterFnExt<S> {
|
||||
/// # Example
|
||||
/// ```rust, no_run
|
||||
/// # #![allow(non_snake_case)]
|
||||
/// # use dioxus_lib::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// use dioxus_server::{DioxusRouterExt, DioxusRouterFnExt};
|
||||
/// # use dioxus::prelude::*;
|
||||
/// use dioxus_server::{DioxusRouterExt, DioxusRouterFnExt, ServeConfig};
|
||||
///
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
@@ -113,8 +111,8 @@ pub trait DioxusRouterFnExt<S> {
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus_lib::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// # use dioxus::prelude::*;
|
||||
/// # use dioxus_server::DioxusRouterFnExt;
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
/// let addr = dioxus::cli_config::fullstack_address_or_localhost();
|
||||
@@ -138,8 +136,8 @@ pub trait DioxusRouterFnExt<S> {
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus_lib::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// # use dioxus::prelude::*;
|
||||
/// # use dioxus_server::DioxusRouterFnExt;
|
||||
/// # use std::sync::Arc;
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
@@ -162,9 +160,8 @@ pub trait DioxusRouterFnExt<S> {
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust, no_run
|
||||
/// # use dioxus_lib::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// # use dioxus_server::prelude::*;
|
||||
/// # use dioxus::prelude::*;
|
||||
/// # use dioxus_server::{DioxusRouterFnExt, ServeConfig};
|
||||
/// #[tokio::main]
|
||||
/// async fn main() {
|
||||
/// let router = axum::Router::new()
|
||||
|
||||
Reference in new issue
Block a user