Support public dir (#4783)

* Add optional static_dir support

- add optional application.static_dir field defaulting to none
- copy configured static directory into web output during build/serve
- document config knob and add unit tests
- force full rebuild when static_dir contents change
- sync removes stale outputs and logs copy activity
- track static manifest next to platform dir

Tests: cargo fmt

* default to public dir to match vite

* static_dir -> public_dir

* wip

* deser as none...

* wip... use .manifest.json

* implement dumb form of asset manifest generation

* implement manifest using asset system directly

* cleanup

* dont create extra asset dir for server

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-10-20 17:03:34 -04:00
1 parent 2f6be083ce
commit b3966c3509
10 files changed
+245 -78

No files matched your search

+15
View File
@@ -379,6 +379,12 @@ impl AppServer {
}
}
// If it's in the public dir, we sync it and trigger a full rebuild
if self.client.build.path_is_in_public_dir(path) {
needs_full_rebuild = true;
continue;
}
// If it's a rust file, we want to hotreload it using the filemap
if ext == "rs" {
// And grabout the contents
@@ -1028,6 +1034,15 @@ impl AppServer {
let mut watched_crates = self.local_dependencies(crate_package);
watched_crates.push(crate_dir);
// Watch the `public` directory if this is the client crate
if self.client.build.crate_package == crate_package {
if let Some(public_dir) = self.client.build.user_public_dir() {
if public_dir.exists() {
watched_paths.push(public_dir);
}
}
}
// Now, watch all the folders in the crates, but respecting their respective ignore files
for krate_root in watched_crates {
// Build the ignore builder for this crate, but with our default ignore list as well