mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: remove unnecessary default features on axum
in server_fns
to support running Axum in a WASM environment (#2270)
This commit is contained in:
parent
a903e19eb2
commit
1b55227d10
7 changed files with 14 additions and 10 deletions
|
@ -14,7 +14,7 @@ axum = { version = "0.7", default-features = false, features = [
|
|||
futures = "0.3"
|
||||
http-body-util = "0.1"
|
||||
leptos = { workspace = true, features = ["ssr"] }
|
||||
server_fn = { workspace = true, features = ["axum"] }
|
||||
server_fn = { workspace = true, features = ["axum-no-default"] }
|
||||
leptos_macro = { workspace = true, features = ["axum"] }
|
||||
leptos_meta = { workspace = true, features = ["ssr"] }
|
||||
leptos_router = { workspace = true, features = ["ssr"] }
|
||||
|
|
|
@ -27,7 +27,7 @@ once_cell = "1"
|
|||
actix-web = { version = "4", optional = true }
|
||||
|
||||
# axum
|
||||
axum = { version = "0.7", optional = true, features = ["multipart"] }
|
||||
axum = { version = "0.7", optional = true, default-features = false, features = ["multipart"] }
|
||||
tower = { version = "0.4", optional = true }
|
||||
tower-layer = { version = "0.3", optional = true }
|
||||
|
||||
|
@ -75,7 +75,7 @@ url = "2"
|
|||
default = ["json", "cbor"]
|
||||
form-redirects = []
|
||||
actix = ["ssr", "dep:actix-web", "dep:send_wrapper"]
|
||||
axum = [
|
||||
axum-no-default = [
|
||||
"ssr",
|
||||
"dep:axum",
|
||||
"dep:hyper",
|
||||
|
@ -83,6 +83,10 @@ axum = [
|
|||
"dep:tower",
|
||||
"dep:tower-layer",
|
||||
]
|
||||
axum = [
|
||||
"axum/default",
|
||||
"axum-no-default",
|
||||
]
|
||||
browser = [
|
||||
"dep:gloo-net",
|
||||
"dep:js-sys",
|
||||
|
|
|
@ -117,7 +117,7 @@ pub mod response;
|
|||
#[cfg(feature = "actix")]
|
||||
#[doc(hidden)]
|
||||
pub use ::actix_web as actix_export;
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg(feature = "axum-no-default")]
|
||||
#[doc(hidden)]
|
||||
pub use ::axum as axum_export;
|
||||
use client::Client;
|
||||
|
@ -456,7 +456,7 @@ impl<Req: 'static, Res: 'static> inventory::Collect
|
|||
}
|
||||
|
||||
/// Axum integration.
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg(feature = "axum-no-default")]
|
||||
pub mod axum {
|
||||
use crate::{
|
||||
middleware::{BoxedService, Service},
|
||||
|
|
|
@ -26,7 +26,7 @@ pub trait Service<Request, Response> {
|
|||
) -> Pin<Box<dyn Future<Output = Response> + Send>>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg(feature = "axum-no-default")]
|
||||
mod axum {
|
||||
use super::{BoxedService, Service};
|
||||
use crate::{response::Res, ServerFnError};
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{borrow::Cow, future::Future};
|
|||
#[cfg(feature = "actix")]
|
||||
pub mod actix;
|
||||
/// Request types for Axum.
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg(feature = "axum-no-default")]
|
||||
pub mod axum;
|
||||
/// Request types for the browser.
|
||||
#[cfg(feature = "browser")]
|
||||
|
|
|
@ -5,7 +5,7 @@ pub mod actix;
|
|||
#[cfg(feature = "browser")]
|
||||
pub mod browser;
|
||||
/// Response types for Axum.
|
||||
#[cfg(feature = "axum")]
|
||||
#[cfg(feature = "axum-no-default")]
|
||||
pub mod http;
|
||||
/// Response types for [`reqwest`].
|
||||
#[cfg(feature = "reqwest")]
|
||||
|
|
|
@ -434,7 +434,7 @@ pub fn server_macro_impl(
|
|||
quote! {
|
||||
#server_fn_path::request::BrowserMockReq
|
||||
}
|
||||
} else if cfg!(feature = "axum") {
|
||||
} else if cfg!(feature = "axum-no-default") {
|
||||
quote! {
|
||||
#server_fn_path::axum_export::http::Request<#server_fn_path::axum_export::body::Body>
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ pub fn server_macro_impl(
|
|||
quote! {
|
||||
#server_fn_path::response::BrowserMockRes
|
||||
}
|
||||
} else if cfg!(feature = "axum") {
|
||||
} else if cfg!(feature = "axum-no-default") {
|
||||
quote! {
|
||||
#server_fn_path::axum_export::http::Response<#server_fn_path::axum_export::body::Body>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue