Make http a required feature for a number of examples

This commit is contained in:
Jonathan Kelley 2024-01-18 12:50:25 -08:00
parent 84e82fc3e2
commit 3506b3ea72
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
4 changed files with 24 additions and 30 deletions

16
Cargo.lock generated
View file

@ -2485,26 +2485,20 @@ dependencies = [
name = "dioxus-examples"
version = "0.4.3"
dependencies = [
"anyhow",
"dioxus",
"dioxus-desktop",
"dioxus-router",
"dioxus-signals",
"dioxus-ssr",
"env_logger",
"futures-util",
"http-range",
"log",
"manganis",
"num-format",
"rand 0.8.5",
"reqwest",
"separator",
"serde",
"serde_json",
"thiserror",
"tokio",
"tracing-subscriber",
]
[[package]]
@ -6347,16 +6341,6 @@ dependencies = [
"syn 2.0.48",
]
[[package]]
name = "num-format"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3"
dependencies = [
"arrayvec",
"itoa 1.0.10",
]
[[package]]
name = "num-integer"
version = "0.1.45"

View file

@ -126,6 +126,8 @@ publish = false
[dependencies]
manganis = { workspace = true, optional = true}
reqwest = { version = "0.11.9", features = ["json"], optional = true}
http-range = {version = "0.1.5", optional = true }
[dev-dependencies]
dioxus = { workspace = true, features = ["desktop"] }
@ -133,23 +135,33 @@ dioxus-desktop = { workspace = true, features = ["transparent"] }
dioxus-ssr = { workspace = true }
dioxus-router = { workspace = true }
dioxus-signals = { workspace = true }
# fermi = { workspace = true }
futures-util = "0.3.21"
log = "0.4.14"
num-format = "0.4.0"
separator = "0.4.1"
serde = { version = "1.0.136", features = ["derive"] }
anyhow = "1.0.53"
serde_json = "1.0.79"
rand = { version = "0.8.4", features = ["small_rng"] }
tokio = { version = "1.16.1", features = ["full"] }
reqwest = { version = "0.11.9", features = ["json"] }
env_logger = "0.10.0"
thiserror = { workspace = true }
tracing-subscriber = "0.3.17"
http-range = "0.1.5"
# fermi = { workspace = true }
# To make most examples faster to compile, we split out assets and http-related stuff
# This trims off like 270 dependencies, leading to a significant speedup in compilation time
[features]
default = []
collect-assets = ["manganis"]
http = ["reqwest", "http-range"]
[[example]]
name = "login_form"
required-features = ["http"]
[[example]]
name = "dog_app"
required-features = ["http"]
[[example]]
name = "video_stream"
required-features = ["http"]
[[example]]
name = "suspense"
required-features = ["http"]

View file

@ -3,8 +3,6 @@ use dioxus_desktop::{tao::dpi::LogicalSize, Config, WindowBuilder};
use dioxus_router::prelude::*;
fn main() {
env_logger::init();
LaunchBuilder::desktop()
.cfg(
Config::new().with_window(

View file

@ -71,19 +71,19 @@ fn NavBar() -> Element {
#[component]
fn Home() -> Element {
log::debug!("rendering home {:?}", current_scope_id());
println!("rendering home {:?}", current_scope_id());
rsx! { h1 { "Home" } }
}
#[component]
fn BlogList() -> Element {
log::debug!("rendering blog list {:?}", current_scope_id());
println!("rendering blog list {:?}", current_scope_id());
rsx! { div { "Blog List" } }
}
#[component]
fn BlogPost(post: String) -> Element {
log::debug!("rendering blog post {}", post);
println!("rendering blog post {}", post);
rsx! {
div {