Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2be5cfe
add component subcommand
ealmloff Sep 15, 2025
af28ffd
Merge branch 'remote-origin' into dx-components-command
ealmloff Sep 15, 2025
60a1006
add dx component add, remove and list commands
ealmloff Sep 16, 2025
94dd8ef
handle rust dependencies
ealmloff Sep 16, 2025
c35262a
handle component dependencies
ealmloff Sep 17, 2025
c9346f7
fetch remote registries
ealmloff Sep 17, 2025
6640345
sort components before listing them
ealmloff Sep 17, 2025
89d6a00
remove local dependency
ealmloff Sep 17, 2025
84bf206
move te component manifest into the dioxus workspace
ealmloff Sep 18, 2025
5a92333
add additional instalation instructions the first time the component
ealmloff Sep 18, 2025
ee9cf63
fix mod name
ealmloff Sep 18, 2025
04c865c
fix clippy
ealmloff Sep 18, 2025
c201197
improve docs and move to the main branch of components
ealmloff Sep 19, 2025
29fa5d6
fix typos
ealmloff Sep 19, 2025
9b34aeb
more typos
ealmloff Sep 19, 2025
36f4d8e
undo const-serialize changes
ealmloff Sep 19, 2025
3987bc9
remove a few unwraps
ealmloff Sep 19, 2025
1798a01
Allow adding multiple components at once and add a `--all` flag
ealmloff Sep 22, 2025
e4950ce
add options to the config for the base path, global asset path and
ealmloff Sep 22, 2025
f2b782c
component_path -> component_dir
ealmloff Sep 22, 2025
195bc4b
component_dir is always relative to the crate root
ealmloff Sep 22, 2025
987366a
fix clippy
ealmloff Sep 22, 2025
a57f501
fix hot patching with a base path
ealmloff Oct 2, 2025
234cd9c
read the hot patch file from stdin instead of a CLI arg to allow for …
ealmloff Oct 2, 2025
afc5178
Merge branch 'remote-origin' into dx-components-command
ealmloff Oct 7, 2025
795cb6d
Merge branch 'remote-origin' into dx-components-command
ealmloff Oct 7, 2025
5cdc17c
fix request imports
ealmloff Oct 7, 2025
ea36cfd
Merge branch 'dx-components-command' into cli-playground
ealmloff Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,171 changes: 1,681 additions & 1,490 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ dioxus-native = { path = "packages/native", version = "0.7.0-rc.0" }
dioxus-native-dom = { path = "packages/native-dom", version = "0.7.0-rc.0" }
dioxus-asset-resolver = { path = "packages/asset-resolver", version = "0.7.0-rc.0" }
dioxus-config-macros = { path = "packages/config-macros", version = "0.7.0-rc.0" }
dioxus-component-manifest = { path = "packages/component-manifest", version = "0.7.0-rc.0" }

generational-box = { path = "packages/generational-box", version = "0.7.0-rc.0" }
lazy-js-bundle = { path = "packages/lazy-js-bundle", version = "0.7.0-rc.0" }
Expand Down Expand Up @@ -244,7 +245,7 @@ futures-util = { version = "0.3", default-features = false }
rustc-hash = "2.1.1"
wasm-bindgen = "0.2.100"
wasm-bindgen-futures = "0.4.50"
js-sys = "0.3.77"
js-sys = "0.3"
web-sys = { version = "0.3.77", default-features = false }
html_parser = "0.7.0"
thiserror = "2.0.12"
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ wasm-split-cli = { workspace = true }
depinfo = { workspace = true }
subsecond-types = { workspace = true }
dioxus-cli-telemetry = { workspace = true }
dioxus-component-manifest = { workspace = true }

clap = { workspace = true, features = ["derive", "cargo"] }
convert_case = { workspace = true }
Expand Down Expand Up @@ -78,6 +79,7 @@ dunce = { workspace = true }
dirs = { workspace = true }
reqwest = { workspace = true, features = ["rustls-tls", "trust-dns", "json"] }
tower = { workspace = true }
git2 = "0.20.2"

# path lookup
which = { version = "8.0.0" }
Expand Down
25 changes: 7 additions & 18 deletions packages/cli/src/build/builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
serve::WebServer, BuildArtifacts, BuildRequest, BuildStage, BuilderUpdate, BundleFormat,
ProgressRx, ProgressTx, Result, RustcArgs, StructuredOutput,
serve::WebServer, verbosity_or_default, BuildArtifacts, BuildRequest, BuildStage,
BuilderUpdate, BundleFormat, ProgressRx, ProgressTx, Result, RustcArgs, StructuredOutput,
};
use anyhow::{bail, Context};
use dioxus_cli_opt::process_file_to;
Expand Down Expand Up @@ -484,11 +484,7 @@ impl AppBuilder {
));
}

if crate::VERBOSITY
.get()
.map(|f| f.verbose)
.unwrap_or_default()
{
if verbosity_or_default().verbose {
envs.push(("RUST_BACKTRACE".into(), "1".to_string()));
}

Expand Down Expand Up @@ -687,7 +683,10 @@ impl AppBuilder {

tracing::debug!("Patching {} -> {}", original.display(), new.display());

let mut jump_table = crate::build::create_jump_table(&new, &triple, cache)?;
let root_dir = self.build.root_dir();
let base_path = self.build.base_path();
let mut jump_table =
crate::build::create_jump_table(&new, &triple, &root_dir, base_path.as_deref(), cache)?;

// If it's android, we need to copy the assets to the device and then change the location of the patch
if self.build.bundle == BundleFormat::Android {
Expand All @@ -696,16 +695,6 @@ impl AppBuilder {
.await?;
}

// Rebase the wasm binary to be relocatable once the jump table is generated
if triple.architecture == target_lexicon::Architecture::Wasm32 {
// Make sure we use the dir relative to the public dir, so the web can load it as a proper URL
//
// ie we would've shipped `/Users/foo/Projects/dioxus/target/dx/project/debug/web/public/wasm/lib.wasm`
// but we want to ship `/wasm/lib.wasm`
jump_table.lib =
PathBuf::from("/").join(jump_table.lib.strip_prefix(self.build.root_dir()).unwrap())
}

let changed_files = match &res.mode {
BuildMode::Thin { changed_files, .. } => changed_files.clone(),
_ => vec![],
Expand Down
23 changes: 19 additions & 4 deletions packages/cli/src/build/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,32 @@ impl HotpatchModuleCache {
pub fn create_jump_table(
patch: &Path,
triple: &Triple,
root_dir: &Path,
base_path: Option<&str>,
cache: &HotpatchModuleCache,
) -> Result<JumpTable> {
// Symbols are stored differently based on the platform, so we need to handle them differently.
// - Wasm requires the walrus crate and actually modifies the patch file
// - windows requires the pdb crate and pdb files
// - nix requires the object crate
match triple.operating_system {
OperatingSystem::Windows => create_windows_jump_table(patch, cache),
_ if triple.architecture == Architecture::Wasm32 => create_wasm_jump_table(patch, cache),
_ => create_native_jump_table(patch, triple, cache),
let mut jump_table = match triple.operating_system {
OperatingSystem::Windows => create_windows_jump_table(patch, cache)?,
_ if triple.architecture == Architecture::Wasm32 => create_wasm_jump_table(patch, cache)?,
_ => create_native_jump_table(patch, triple, cache)?,
};

// Rebase the wasm binary to be relocatable once the jump table is generated
if triple.architecture == target_lexicon::Architecture::Wasm32 {
// Make sure we use the dir relative to the public dir, so the web can load it as a proper URL
//
// ie we would've shipped `/Users/foo/Projects/dioxus/target/dx/project/debug/web/public/wasm/lib.wasm`
// but we want to ship `/wasm/lib.wasm`
jump_table.lib =
PathBuf::from("/".to_string() + base_path.unwrap_or_default().trim_start_matches('/'))
.join(jump_table.lib.strip_prefix(root_dir).unwrap())
}

Ok(jump_table)
}

fn create_windows_jump_table(patch: &Path, cache: &HotpatchModuleCache) -> Result<JumpTable> {
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/build/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@
//! - xbuild: <https://github.com/rust-mobile/xbuild/blob/master/xbuild/src/command/build.rs>

use crate::{
AndroidTools, BuildContext, BundleFormat, DioxusConfig, Error, LinkAction, LinkerFlavor,
Platform, Renderer, Result, RustcArgs, TargetArgs, TraceSrc, WasmBindgen, WasmOptConfig,
Workspace, DX_RUSTC_WRAPPER_ENV_VAR,
verbosity_or_default, AndroidTools, BuildContext, BundleFormat, DioxusConfig, Error,
LinkAction, LinkerFlavor, Platform, Renderer, Result, RustcArgs, TargetArgs, TraceSrc,
WasmBindgen, WasmOptConfig, Workspace, DX_RUSTC_WRAPPER_ENV_VAR,
};
use anyhow::{bail, Context};
use cargo_metadata::diagnostic::Diagnostic;
Expand Down Expand Up @@ -2512,7 +2512,7 @@ impl BuildRequest {
cargo_args.push(self.executable_name().to_string());

// Set offline/locked/frozen
let lock_opts = crate::VERBOSITY.get().cloned().unwrap_or_default();
let lock_opts = verbosity_or_default();
if lock_opts.frozen {
cargo_args.push("--frozen".to_string());
}
Expand Down
Loading