Remove default features when fullstack is enabled and one platform is enabled in the default features (#3925)
* Don't enable default features when only either the server or client is enabled
This commit is contained in:
1 parent
23286ade2b
commit
8c866b783d
14 files changed
+135
-26
No files matched your search
@@ -252,7 +252,9 @@ impl DioxusCrate {
|
||||
.iter()
|
||||
.flat_map(|feature| {
|
||||
tracing::trace!("Autodetecting platform from feature {feature}");
|
||||
Platform::autodetect_from_cargo_feature(feature).map(|f| (f, feature.to_string()))
|
||||
Platform::autodetect_from_cargo_feature(feature)
|
||||
.filter(|platform| *platform != Platform::Server)
|
||||
.map(|f| (f, feature.to_string()))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -459,8 +461,11 @@ impl DioxusCrate {
|
||||
.map(|krate| krate.krate.version.to_string())
|
||||
}
|
||||
|
||||
pub(crate) fn default_platform(&self) -> Option<Platform> {
|
||||
let default = self.package().features.get("default")?;
|
||||
pub(crate) fn default_platforms(&self) -> Vec<Platform> {
|
||||
let Some(default) = self.package().features.get("default") else {
|
||||
return Vec::new();
|
||||
};
|
||||
let mut platforms = vec![];
|
||||
|
||||
// we only trace features 1 level deep..
|
||||
for feature in default.iter() {
|
||||
@@ -468,8 +473,8 @@ impl DioxusCrate {
|
||||
if feature.starts_with("dioxus/") {
|
||||
let dx_feature = feature.trim_start_matches("dioxus/");
|
||||
let auto = Platform::autodetect_from_cargo_feature(dx_feature);
|
||||
if auto.is_some() {
|
||||
return auto;
|
||||
if let Some(auto) = auto {
|
||||
platforms.push(auto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,15 +485,17 @@ impl DioxusCrate {
|
||||
if feature.starts_with("dioxus/") {
|
||||
let dx_feature = feature.trim_start_matches("dioxus/");
|
||||
let auto = Platform::autodetect_from_cargo_feature(dx_feature);
|
||||
if auto.is_some() {
|
||||
return auto;
|
||||
if let Some(auto) = auto {
|
||||
platforms.push(auto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
platforms.sort();
|
||||
platforms.dedup();
|
||||
platforms
|
||||
}
|
||||
|
||||
/// Gather the features that are enabled for the package
|
||||
|
||||
Reference in new issue
Block a user