From 9817acdcfa259d2030d143d63c986a805277ae9d Mon Sep 17 00:00:00 2001 From: luoxiao Date: Sat, 27 Jan 2024 00:06:07 +0800 Subject: [PATCH] feat: update dependencies and update leptos to v0.6.0-rc1 --- demo/Cargo.toml | 6 +-- demo_markdown/Cargo.toml | 8 ++-- demo_markdown/src/markdown/mod.rs | 1 + examples/ssr_axum/Cargo.toml | 20 ++++----- examples/ssr_axum/src/fileserv.rs | 72 ++++++++++++++++--------------- examples/ssr_axum/src/lib.rs | 21 ++++----- examples/ssr_axum/src/main.rs | 4 +- thaw/Cargo.toml | 12 +++--- 8 files changed, 72 insertions(+), 72 deletions(-) diff --git a/demo/Cargo.toml b/demo/Cargo.toml index abbc8e7..de1810d 100644 --- a/demo/Cargo.toml +++ b/demo/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -leptos = { version = "0.5.7" } -leptos_meta = { version = "0.5.7" } -leptos_router = { version = "0.5.7" } +leptos = { version = "0.6.0-rc1" } +leptos_meta = { version = "0.6.0-rc1" } +leptos_router = { version = "0.6.0-rc1" } leptos_devtools = { version = "0.0.1", optional = true} thaw = { path = "../thaw", default-features = false } demo_markdown = { path = "../demo_markdown" } diff --git a/demo_markdown/Cargo.toml b/demo_markdown/Cargo.toml index b9e5a59..34173da 100644 --- a/demo_markdown/Cargo.toml +++ b/demo_markdown/Cargo.toml @@ -10,8 +10,8 @@ edition = "2021" proc-macro = true [dependencies] -quote = "1.0.33" -comrak = "0.20.0" -proc-macro2 = "1.0.71" -syn = "2.0.43" +quote = "1.0.35" +comrak = "0.21.0" +proc-macro2 = "1.0.78" +syn = "2.0.48" syntect = "5.1.0" \ No newline at end of file diff --git a/demo_markdown/src/markdown/mod.rs b/demo_markdown/src/markdown/mod.rs index 8e77e9b..0379fc4 100644 --- a/demo_markdown/src/markdown/mod.rs +++ b/demo_markdown/src/markdown/mod.rs @@ -145,5 +145,6 @@ fn iter_nodes<'a>(node: &'a AstNode<'a>, demos: &mut Vec) -> TokenStream NodeValue::Link(_) => quote!("Link todo!!!"), NodeValue::Image(_) => quote!("Image todo!!!"), NodeValue::FootnoteReference(_) => quote!("FootnoteReference todo!!!"), + NodeValue::MultilineBlockQuote(_) => quote!("FootnoteReference todo!!!"), } } diff --git a/examples/ssr_axum/Cargo.toml b/examples/ssr_axum/Cargo.toml index cb2800d..6f86192 100644 --- a/examples/ssr_axum/Cargo.toml +++ b/examples/ssr_axum/Cargo.toml @@ -7,22 +7,22 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -axum = { version = "0.6.4", optional = true } +axum = { version = "0.7.4", optional = true } console_error_panic_hook = "0.1" console_log = "1" cfg-if = "1" -leptos = { version = "0.5" } -leptos_axum = { version = "0.5", optional = true } -leptos_meta = { version = "0.5" } -leptos_router = { version = "0.5" } +leptos = { version = "0.6.0-rc1" } +leptos_axum = { version = "0.6.0-rc1", optional = true } +leptos_meta = { version = "0.6.0-rc1" } +leptos_router = { version = "0.6.0-rc1" } log = "0.4" simple_logger = "4" -tokio = { version = "1.25.0", optional = true } +tokio = { version = "1.35.1", features = ["rt-multi-thread"], optional = true } tower = { version = "0.4.13", optional = true } -tower-http = { version = "0.4", features = ["fs"], optional = true } -wasm-bindgen = "=0.2.89" -thiserror = "1.0.38" -tracing = { version = "0.1.37", optional = true } +tower-http = { version = "0.5.1", features = ["fs"], optional = true } +wasm-bindgen = "=0.2.90" +thiserror = "1.0.56" +tracing = { version = "0.1.40", optional = true } http = "0.2.8" demo = { path = "../../demo", default-features = false } diff --git a/examples/ssr_axum/src/fileserv.rs b/examples/ssr_axum/src/fileserv.rs index eef7b71..a71b53a 100644 --- a/examples/ssr_axum/src/fileserv.rs +++ b/examples/ssr_axum/src/fileserv.rs @@ -1,40 +1,42 @@ -use cfg_if::cfg_if; +use axum::{ + body::Body, + extract::State, + http::{Request, Response, StatusCode, Uri}, + response::{IntoResponse, Response as AxumResponse}, +}; +use demo::App; +use leptos::{view, LeptosOptions}; +use tower::ServiceExt; +use tower_http::services::ServeDir; -cfg_if! { if #[cfg(feature = "ssr")] { - use axum::{ - body::{boxed, Body, BoxBody}, - extract::State, - response::IntoResponse, - http::{Request, Response, StatusCode, Uri}, - }; - use axum::response::Response as AxumResponse; - use tower::ServiceExt; - use tower_http::services::ServeDir; - use leptos::*; - use demo::App; +pub async fn file_and_error_handler( + uri: Uri, + State(options): State, + req: Request, +) -> AxumResponse { + let root = options.site_root.clone(); + let res = get_static_file(uri.clone(), &root).await.unwrap(); - pub async fn file_and_error_handler(uri: Uri, State(options): State, req: Request) -> AxumResponse { - let root = options.site_root.clone(); - let res = get_static_file(uri.clone(), &root).await.unwrap(); - - if res.status() == StatusCode::OK { - res.into_response() - } else { - let handler = leptos_axum::render_app_to_stream(options.to_owned(), move || view!{}); - handler(req).await.into_response() - } + if res.status() == StatusCode::OK { + res.into_response() + } else { + let handler = leptos_axum::render_app_to_stream(options.to_owned(), move || view! {}); + handler(req).await.into_response() } +} - async fn get_static_file(uri: Uri, root: &str) -> Result, (StatusCode, String)> { - let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap(); - // `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot` - // This path is relative to the cargo root - match ServeDir::new(root).oneshot(req).await { - Ok(res) => Ok(res.map(boxed)), - Err(err) => Err(( - StatusCode::INTERNAL_SERVER_ERROR, - format!("Something went wrong: {err}"), - )), - } +async fn get_static_file(uri: Uri, root: &str) -> Result, (StatusCode, String)> { + let req = Request::builder() + .uri(uri.clone()) + .body(Body::empty()) + .unwrap(); + // `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot` + // This path is relative to the cargo root + match ServeDir::new(root).oneshot(req).await { + Ok(res) => Ok(res.into_response()), + Err(err) => Err(( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Something went wrong: {err}"), + )), } -}} +} diff --git a/examples/ssr_axum/src/lib.rs b/examples/ssr_axum/src/lib.rs index 1bae92b..a1249d7 100644 --- a/examples/ssr_axum/src/lib.rs +++ b/examples/ssr_axum/src/lib.rs @@ -1,17 +1,14 @@ -use cfg_if::cfg_if; +#[cfg(feature = "ssr")] pub mod fileserv; -cfg_if! { if #[cfg(feature = "hydrate")] { - use leptos::*; - use wasm_bindgen::prelude::wasm_bindgen; +#[cfg(feature = "hydrate")] +#[wasm_bindgen::prelude::wasm_bindgen] +pub fn hydrate() { use demo::App; - #[wasm_bindgen] - pub fn hydrate() { - // initializes logging using the `log` crate - _ = console_log::init_with_level(log::Level::Debug); - console_error_panic_hook::set_once(); + // initializes logging using the `log` crate + _ = console_log::init_with_level(log::Level::Debug); + console_error_panic_hook::set_once(); - leptos::mount_to_body(App); - } -}} + leptos::mount_to_body(App); +} diff --git a/examples/ssr_axum/src/main.rs b/examples/ssr_axum/src/main.rs index 8222418..3647ee9 100644 --- a/examples/ssr_axum/src/main.rs +++ b/examples/ssr_axum/src/main.rs @@ -29,8 +29,8 @@ async fn main() { // run our app with hyper // `axum::Server` is a re-export of `hyper::Server` log::info!("listening on http://{}", &addr); - axum::Server::bind(&addr) - .serve(app.into_make_service()) + let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); + axum::serve(listener, app.into_make_service()) .await .unwrap(); } diff --git a/thaw/Cargo.toml b/thaw/Cargo.toml index 7d1e02b..df4f166 100644 --- a/thaw/Cargo.toml +++ b/thaw/Cargo.toml @@ -13,19 +13,19 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -leptos = { version = "0.5.7" } -leptos_meta = { version = "0.5.7", optional = true } -web-sys = { version = "0.3.63", features = [ +leptos = { version = "0.6.0-rc1" } +leptos_meta = { version = "0.6.0-rc1", optional = true } +web-sys = { version = "0.3.67", features = [ "DomRect", "File", "FileList", "DataTransfer", ] } -wasm-bindgen = "0.2.89" +wasm-bindgen = "0.2.90" icondata = "0.3.0" -uuid = { version = "1.5.0", features = ["v4"] } +uuid = { version = "1.7.0", features = ["v4"] } cfg-if = "1.0.0" -chrono = "0.4.31" +chrono = "0.4.33" [features] default = ["csr"]