feature flag blitz-shell behind new shell feature#5650
Conversation
|
@rydb Hmm... my intention was for the |
I did have it in my codebase, but It didn't register with me to use it. However, while trying to swap out dioxus-native for dioxus-native-dom, I noticed dioxus_asset_resolver is feature flagged behind native, and so I would need to pull in dioxus-native in order to make a NetProvider impl for my crate regardless: impl NetProvider for BevyNetProvider {
fn fetch(
&self,
_doc_id: usize,
request: blitz_traits::net::Request,
handler: Box<dyn NetHandler>,
) {
match request.url.scheme() {
// Load Dioxus assets
"dioxus" => match dioxus_asset_resolver::native::serve_asset(request.url.path()) {
Ok(res) => handler.bytes(request.url.to_string(), res.into_body().into()),
Err(err) => {
warn!("{err}");
}
},
... rest of impl
}#[allow(unused)]
pub fn asset_path(asset: impl ToString) -> Result<PathBuf, AssetPathError> {
#[cfg(all(feature = "web", target_arch = "wasm32"))]
return Err(AssetPathError::CannotRepresentAsPath);
#[cfg(feature = "native")]
return native::resolve_native_asset_path(asset.to_string().as_str());
Err(AssetPathError::NotFound)
}would it make sense to:
or
I think for consistency with, e.g; dioxus-desktop, it might be worth unifying these crates. Looking at the difference of this crate pre and post shell feature flag, the non-shell feature flagged content inside it is pretty slim at only around ~200 lines. |
pr addresses the following issue:
#5647
This pr feature flags blitz-shell in dioxus-native behind a new shell feature(which is set to default for feature parity with present behavior).
If this pr is merged, blitz-shell and winit will become optional dependencies of dioxus-native and will no longer require double compile winit if you use a framework downstream with a different winit version(e.g; bevy).
All shell implementation related code is moved into a new /shell folder to minimize cfg flags and separate it from the rest of dioxus-native.