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
@@ -19,7 +19,8 @@ dioxus_server_macro = { workspace = true }
|
||||
axum = { workspace = true, optional = true }
|
||||
tower-http = { workspace = true, optional = true, features = ["fs"] }
|
||||
|
||||
dioxus-lib = { workspace = true, features = ["html"] }
|
||||
dioxus-core = { workspace = true }
|
||||
dioxus-document = { workspace = true }
|
||||
generational-box = { workspace = true }
|
||||
|
||||
# Dioxus + SSR
|
||||
@@ -73,6 +74,7 @@ dioxus-history = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
dioxus = { workspace = true, features = ["fullstack"] }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
|
||||
[features]
|
||||
default = ["devtools", "document", "file_engine", "mounted"]
|
||||
|
||||
@@ -86,6 +86,7 @@ Then we can set up dioxus with the axum server:
|
||||
```rust, no_run
|
||||
#![allow(non_snake_case)]
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_fullstack::ServeConfig;
|
||||
|
||||
// The entry point for the server
|
||||
#[cfg(feature = "server")]
|
||||
@@ -99,7 +100,7 @@ async fn main() {
|
||||
let router = axum::Router::new()
|
||||
// You can add a dioxus application to the router with the `serve_dioxus_application` method
|
||||
// This will add a fallback route to the router that will serve your component and server functions
|
||||
.serve_dioxus_application(ServeConfigBuilder::default(), App);
|
||||
.serve_dioxus_application(ServeConfig::new().unwrap(), App);
|
||||
|
||||
// Finally, we can launch the server
|
||||
let router = router.into_make_service();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
This method interacts with information from the current request. The request may come from:
|
||||
|
||||
1. The initial SSR render if this method called from a [`Component`](dioxus_lib::prelude::component) or a [`server`](dioxus_server) function that is called during the initial render
|
||||
1. The initial SSR render if this method called from a [`Component`](dioxus_core_macro::component) or a [`server`](dioxus_server) function that is called during the initial render
|
||||
|
||||
```rust
|
||||
# use dioxus::prelude::*;
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
str::FromStr,
|
||||
};
|
||||
|
||||
use dioxus_lib::core::{CapturedError, RenderError};
|
||||
use dioxus_core::{CapturedError, RenderError};
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use server_fn::{
|
||||
codec::JsonEncoding,
|
||||
@@ -33,7 +33,7 @@ pub type ServerFnResult<T = (), E = String> = std::result::Result<T, ServerFnErr
|
||||
///
|
||||
/// You can use the [`ServerFnError`] type in the Error type of your server function result or use the [`ServerFnResult`]
|
||||
/// type as the return type of your server function. When you call the server function, you can handle the error directly
|
||||
/// or convert it into a [`CapturedError`] to throw into the nearest [`ErrorBoundary`](dioxus_lib::prelude::ErrorBoundary).
|
||||
/// or convert it into a [`CapturedError`] to throw into the nearest [`ErrorBoundary`](dioxus_core::ErrorBoundary).
|
||||
///
|
||||
/// ```rust
|
||||
/// use dioxus::prelude::*;
|
||||
@@ -137,16 +137,8 @@ impl ServerFnError {
|
||||
/// use dioxus::prelude::*;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
///
|
||||
/// #[derive(Serialize, Deserialize, Debug)]
|
||||
/// struct MyCustomError;
|
||||
/// impl std::fmt::Display for MyCustomError {
|
||||
/// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
/// write!(f, "My custom error")
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// #[server]
|
||||
/// async fn server_function() -> ServerFnResult<String, MyCustomError> {
|
||||
/// async fn server_function() -> ServerFnResult<String> {
|
||||
/// // Return your custom error
|
||||
/// Err(ServerFnError::new("Something went wrong"))
|
||||
/// }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! On the client, we use the [`WebDocument`] implementation to render the head for any elements that were not rendered on the server.
|
||||
|
||||
use dioxus_lib::document::*;
|
||||
use dioxus_document::*;
|
||||
use dioxus_web::WebDocument;
|
||||
|
||||
fn head_element_written_on_server() -> bool {
|
||||
|
||||
Reference in new issue
Block a user