CLI fixes for hotpatching the playground (#4715)

* add component subcommand

* add dx component add, remove and list commands

* handle rust dependencies

* handle component dependencies

* fetch remote registries

* sort components before listing them

* remove local dependency

* move te component manifest into the dioxus workspace

* add additional instalation instructions the first time the component
module is created

* fix mod name

* fix clippy

* improve docs and move to the main branch of components

* fix typos

* more typos

* undo const-serialize changes

* remove a few unwraps

* Allow adding multiple components at once and add a `--all` flag

* add options to the config for the base path, global asset path and
default registry

* component_path -> component_dir

* component_dir is always relative to the crate root

* fix clippy

* fix hot patching with a base path

* read the hot patch file from stdin instead of a CLI arg to allow for longer inputs

* fix request imports

* wip: code style changes

* rename to "components" instead of "component"

* bump lock

* move to method on request

* read until eof in the case of pretty json

* strip is now copy

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2025-10-20 17:50:27 -04:00
1 parent 79613f9db9
commit 987e41de16
6 files changed
+1715 -1739

No files matched your search

+1 -12
View File
@@ -640,7 +640,6 @@ impl AppBuilder {
) -> Result<JumpTable> {
let original = self.build.main_exe();
let new = self.build.patch_exe(res.time_start);
let triple = self.build.triple.clone();
let asset_dir = self.build.asset_dir();
// Hotpatch asset!() calls
@@ -688,7 +687,7 @@ impl AppBuilder {
tracing::debug!("Patching {} -> {}", original.display(), new.display());
let mut jump_table = crate::build::create_jump_table(&new, &triple, cache)?;
let mut jump_table = self.build.create_jump_table(&new, 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 {
@@ -697,16 +696,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![],