diff --git a/Cargo.lock b/Cargo.lock index 25b79250034..77605b32093 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,9 +129,9 @@ dependencies = [ "form_urlencoded", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-util", "itoa", "matchit", @@ -160,7 +160,7 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "mime", "pin-project-lite", @@ -170,12 +170,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -577,12 +571,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "data-encoding" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" - [[package]] name = "deranged" version = "0.5.3" @@ -808,7 +796,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" name = "file_upload" version = "0.1.0" dependencies = [ - "base64 0.22.1", + "base64", "gloo", "js-sys", "web-sys", @@ -1280,25 +1268,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "h2" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.12" @@ -1335,14 +1304,14 @@ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" [[package]] name = "headers" -version = "0.3.9" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" dependencies = [ - "base64 0.21.7", + "base64", "bytes", "headers-core", - "http 0.2.12", + "http 1.3.1", "httpdate", "mime", "sha1", @@ -1350,11 +1319,11 @@ dependencies = [ [[package]] name = "headers-core" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" dependencies = [ - "http 0.2.12", + "http 1.3.1", ] [[package]] @@ -1414,17 +1383,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -1444,7 +1402,7 @@ dependencies = [ "bytes", "futures-core", "http 1.3.1", - "http-body 1.0.1", + "http-body", "pin-project-lite", ] @@ -1466,30 +1424,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.27", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.5.10", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.7.0" @@ -1500,9 +1434,9 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2 0.4.12", + "h2", "http 1.3.1", - "http-body 1.0.1", + "http-body", "httparse", "httpdate", "itoa", @@ -1520,7 +1454,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ "http 1.3.1", - "hyper 1.7.0", + "hyper", "hyper-util", "rustls", "rustls-pki-types", @@ -1537,7 +1471,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-util", "native-tls", "tokio", @@ -1551,19 +1485,19 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-core", "futures-util", "http 1.3.1", - "http-body 1.0.1", - "hyper 1.7.0", + "http-body", + "hyper", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.0", + "socket2", "system-configuration", "tokio", "tower-service", @@ -2087,24 +2021,6 @@ dependencies = [ "yew", ] -[[package]] -name = "multer" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 0.2.12", - "httparse", - "log", - "memchr", - "mime", - "spin", - "version_check", -] - [[package]] name = "nanoid" version = "0.4.0" @@ -2586,17 +2502,17 @@ version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2 0.4.12", + "h2", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", - "hyper 1.7.0", + "hyper", "hyper-rustls", "hyper-tls", "hyper-util", @@ -2891,7 +2807,6 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" name = "simple_ssr" version = "0.1.0" dependencies = [ - "bytes", "clap", "futures 0.3.31", "log", @@ -2917,16 +2832,6 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -[[package]] -name = "socket2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "socket2" version = "0.6.0" @@ -2955,7 +2860,7 @@ dependencies = [ "env_logger", "function_router", "futures 0.3.31", - "hyper 1.7.0", + "hyper", "hyper-util", "jemallocator", "log", @@ -3262,7 +3167,7 @@ dependencies = [ "libc", "mio", "pin-project-lite", - "socket2 0.6.0", + "socket2", "tokio-macros", "windows-sys 0.61.0", ] @@ -3309,18 +3214,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.16" @@ -3434,7 +3327,7 @@ dependencies = [ "futures-core", "futures-util", "http 1.3.1", - "http-body 1.0.1", + "http-body", "http-body-util", "http-range-header", "httpdate", @@ -3516,25 +3409,6 @@ dependencies = [ "toml", ] -[[package]] -name = "tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.3.1", - "httparse", - "log", - "rand 0.8.5", - "sha1", - "thiserror 1.0.69", - "url", - "utf-8", -] - [[package]] name = "two_apps" version = "0.1.0" @@ -3596,12 +3470,6 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8-width" version = "0.1.7" @@ -3670,20 +3538,20 @@ dependencies = [ [[package]] name = "warp" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" +version = "0.4.2" +source = "git+https://github.com/seanmonstar/warp.git?rev=de1ccd8#de1ccd83e2b65575cade3520e6b8031afe7d87b7" dependencies = [ "bytes", - "futures-channel", "futures-util", "headers", - "http 0.2.12", - "hyper 0.14.32", + "http 1.3.1", + "http-body", + "http-body-util", + "hyper", + "hyper-util", "log", "mime", "mime_guess", - "multer", "percent-encoding", "pin-project", "scoped-tls", @@ -3691,7 +3559,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", - "tokio-tungstenite", "tokio-util", "tower-service", "tracing", diff --git a/Cargo.toml b/Cargo.toml index 010e30ba3b3..58cf78f9e85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,6 @@ quote = "1" syn = { version = "2" } trybuild = "1" clap = { version = "4", features = ["derive"] } -bytes = "1" wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" js-sys = "0.3" diff --git a/examples/simple_ssr/Cargo.toml b/examples/simple_ssr/Cargo.toml index d4175e13ec3..b3491163031 100644 --- a/examples/simple_ssr/Cargo.toml +++ b/examples/simple_ssr/Cargo.toml @@ -18,7 +18,6 @@ reqwest = { workspace = true, features = ["json"] } serde = { workspace = true, features = ["derive"] } uuid = { version = "1.18.1", features = ["serde"] } futures.workspace = true -bytes = { workspace = true } [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen-futures.workspace = true @@ -27,7 +26,7 @@ log.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tokio = { workspace = true, features = ["macros", "rt-multi-thread", "fs"] } -warp = "0.3" +warp = { git = "https://github.com/seanmonstar/warp.git", rev = "de1ccd8", features = ["server"] } clap = { workspace = true } [features] diff --git a/examples/simple_ssr/src/bin/simple_ssr_server.rs b/examples/simple_ssr/src/bin/simple_ssr_server.rs index 18a7c26709f..b16b9a482c6 100644 --- a/examples/simple_ssr/src/bin/simple_ssr_server.rs +++ b/examples/simple_ssr/src/bin/simple_ssr_server.rs @@ -1,14 +1,11 @@ -use std::error::Error; +use std::convert::Infallible; use std::path::PathBuf; -use bytes::Bytes; use clap::Parser; use futures::stream::{self, Stream, StreamExt}; use simple_ssr::App; use warp::Filter; -type BoxedError = Box; - /// A basic example #[derive(Parser, Debug)] struct Opt { @@ -20,15 +17,12 @@ struct Opt { async fn render( index_html_before: String, index_html_after: String, -) -> Box> + Send> { +) -> impl Stream> { let renderer = yew::ServerRenderer::::new(); - Box::new( - stream::once(async move { index_html_before }) - .chain(renderer.render_stream()) - .chain(stream::once(async move { index_html_after })) - .map(|m| Result::<_, BoxedError>::Ok(m.into())), - ) + stream::once(async move { Ok(index_html_before) }) + .chain(renderer.render_stream().map(Ok)) + .chain(stream::once(async move { Ok(index_html_after) })) } #[tokio::main] @@ -48,7 +42,14 @@ async fn main() { let index_html_before = index_html_before.clone(); let index_html_after = index_html_after.clone(); - async move { warp::reply::html(render(index_html_before, index_html_after).await) } + async move { + let body = render(index_html_before, index_html_after).await; + warp::reply::with_header( + warp::reply::stream(body), + "content-type", + "text/html; charset=utf-8", + ) + } }); let routes = html.or(warp::fs::dir(opts.dir)); diff --git a/examples/wasi_ssr_module/Cargo.toml b/examples/wasi_ssr_module/Cargo.toml index d91a55f1fab..27e57a98958 100644 --- a/examples/wasi_ssr_module/Cargo.toml +++ b/examples/wasi_ssr_module/Cargo.toml @@ -9,7 +9,7 @@ yew = { path = "../../packages/yew", features = ["ssr"] } yew-router = { path = "../../packages/yew-router" } anyhow = "^1" -bytes = { workspace = true } +bytes = "1" serde = { version = "^1", features = ["derive"] } serde_json = "^1" lazy_static = "^1"