Pre-release 0.6.0-alpha.0 (#2755)

* CI: add docsrs to ci

* add env vars

* no need for tokio things

* whoops, wrong rust nightly

* add swc

* bump crate versions to 0.6.0-alpha.0

* hoist up warnings and shuffle cargo.toml

* update cargos and disable warnings from ci

* attempt fix of aws

* attempt disabling aws_lc_sys globally

* pull in lc-sys

* add fips feature to fix docs

* turn on features for aws-lc-sys on cargo-doc-all

* pass along more args

* fix cfg docs

* fix: flakey gen box test

* fix: doc_cfg in static gen

* dont include readme

* fix error on static gen

* remove random line

* temporarily disable warnings

* simplify axum desktop so it doesnt count as a lib

* fix binstall link

* bump locks

* lock fixes

* revert axum desktop

* dont publish some crates
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-07-31 22:37:39 -05:00
1 parent 4ffcef16af
commit 0cbcef735f
22 files changed
+1927 -435

No files matched your search

+6 -2
View File
@@ -49,6 +49,8 @@ futures-util = { workspace = true }
futures-channel = { workspace = true }
ciborium = { workspace = true }
base64 = { workspace = true }
rustls = { workspace = true, optional = true }
hyper-rustls = { workspace = true, optional = true }
pin-project = { version = "1.1.2", optional = true }
thiserror = { workspace = true, optional = true }
@@ -61,6 +63,8 @@ web-sys = { version = "0.3.61", optional = true, features = ["Window", "Document
dioxus-cli-config = { workspace = true, features = ["read-config"], optional = true }
clap = { version = "4.5.7", optional = true, features = ["derive"] }
aws-lc-rs = { version = "1.8.1", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "sync"], optional = true }
@@ -82,7 +86,7 @@ web = ["dep:dioxus-web", "dep:web-sys"]
desktop = ["dep:dioxus-desktop", "server_fn/reqwest", "dioxus_server_macro/reqwest"]
mobile = ["dep:dioxus-mobile"]
default-tls = ["server_fn/default-tls"]
rustls = ["server_fn/rustls"]
rustls = ["server_fn/rustls", "dep:rustls", "dep:hyper-rustls"]
axum = ["dep:axum", "dep:tower-http", "server", "server_fn/axum", "dioxus_server_macro/axum", "default-tls"]
server = [
"server_fn/ssr",
@@ -109,4 +113,4 @@ server = [
[package.metadata.docs.rs]
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
features = ["axum", "web"]
features = ["axum", "web", "dep:aws-lc-rs"]
@@ -21,7 +21,7 @@ sqlx = { version = "0.7.0", features = [
"postgres",
"sqlite",
"_unstable-all-types",
"tls-rustls",
"tls-native-tls",
"runtime-tokio",
], optional = true }
http = { workspace = true, optional = true }
@@ -0,0 +1,69 @@
#![allow(non_snake_case)]
use dioxus::prelude::*;
/// Run with `cargo run --features desktop`
#[cfg(feature = "desktop")]
fn main() {
// Set the url of the server where server functions are hosted.
dioxus::fullstack::prelude::server_fn::client::set_server_url("http://127.0.0.1:8080");
// And then launch the app
dioxus::prelude::launch_desktop(app);
}
/// Run with `cargo run --features server`
#[cfg(all(feature = "server", not(feature = "desktop")))]
#[tokio::main]
async fn main() {
use server_fn::axum::register_explicit;
let listener = tokio::net::TcpListener::bind("127.0.0.01:8080")
.await
.unwrap();
register_explicit::<PostServerData>();
register_explicit::<GetServerData>();
axum::serve(
listener,
axum::Router::new()
.register_server_functions()
.into_make_service(),
)
.await
.unwrap();
}
pub fn app() -> Element {
let mut count = use_signal(|| 0);
let mut text = use_signal(|| "...".to_string());
rsx! {
h1 { "High-Five counter: {count}" }
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
button {
onclick: move |_| async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(data).await.unwrap();
}
},
"Run a server function"
}
"Server said: {text}"
}
}
#[server(PostServerData)]
async fn post_server_data(data: String) -> Result<(), ServerFnError> {
println!("Server received: {}", data);
Ok(())
}
#[server(GetServerData)]
async fn get_server_data() -> Result<String, ServerFnError> {
Ok("Hello from the server!".to_string())
}
@@ -3,6 +3,7 @@ name = "dioxus-hackernews"
version = "0.1.0"
authors = ["Evan Almloff <evanalmloff@gmail.com>"]
edition = "2021"
publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html