feat(cli): support custom renderers via [renderer] config#5416
Open
rlch wants to merge 1 commit intoDioxusLabs:mainfrom
Open
feat(cli): support custom renderers via [renderer] config#5416rlch wants to merge 1 commit intoDioxusLabs:mainfrom
rlch wants to merge 1 commit intoDioxusLabs:mainfrom
Conversation
Add an optional `[renderer]` section to Dioxus.toml that lets projects using `dioxus-core` with their own renderer declare platform-to-feature mappings. When present, this overrides the default renderer autodetection and feature injection. Existing projects without this section are completely unaffected. This enables frameworks like Tanzo (winit+wgpu+vello) and Bevy to use `dx serve`, `dx build`, and `dx bundle` without pulling in dioxus's built-in renderers. Changes: - Add `RendererConfig` struct with `name`, `default_platform`, and `features` fields to `DioxusConfig` - Add `features_for_platform()` with fallback chain support (e.g., `["macos", "desktop"]`) - Consult custom renderer config before default feature injection in each platform match arm - Skip `feature_for_platform_and_renderer()` when custom renderer is configured - Make `Platform::from_identifier()` pub(crate) for config-driven platform resolution - Update schema.json - Add tests for config parsing and behavior
Author
|
Tbh don't need this anymore because I ended up making my own CLI for my renderer, but might be useful for the community nonetheless. Feel free to close. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
[renderer]section toDioxus.tomlso projects usingdioxus-corewith a custom renderer can usedx serve,dx build,dx bundle, anddx fmt— without pulling in any built-in dioxus renderers.Existing projects without this section are completely unaffected.
Why?
If you use
dioxus-corefor the VirtualDom/signals/hooks but bring your own rendering pipeline (winit+wgpu+vello, Bevy, etc.),dxcurrently can't help you — it expects a recognized renderer feature likewebornative. This makes the detection configurable.Example
What changed
RendererConfigstruct indioxus_config.rs—name,default_platform,featuresmap with fallback chain lookuprequest.rschecks custom config before the default dioxus feature injectionPlatform::from_identifier()madepub(crate)for config-driven resolutionBackward compat
RendererConfigdefaults to empty via#[serde(default)]. When absent, all code paths are unchanged.Test plan
cargo test -p dioxus-cli -- config::dioxus_config— 5 pass (3 existing + 2 new)cargo clippy -p dioxus-cli -- -D warnings— cleancargo fmt -p dioxus-cli -- --check— cleandx build/dx bundlework with a custom renderer project