Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
The dot-named edit joins the bundle key's file list in place, and its test is in raea-runtime-bake: raea-runtime-bundle is at its 2,000-line limit
shinyobjectza956d8f8ee87
diff --git a/runtime/bake/src/lib.rs b/runtime/bake/src/lib.rsindex f75b0342..6b687460 100644--- a/runtime/bake/src/lib.rs+++ b/runtime/bake/src/lib.rs@@ -453,3 +453,24 @@ pub fn bake_incremental(old: &Baked, js: &Path) -> R<(Baked, i64)> {}Ok((b, stepped))}++// raea-runtime-bundle's cache key, tested here: that crate is at its size limit+#[cfg(test)]+mod bundle_key {+ #[test]+ fn a_dot_named_edit_rewritten_gets_another_bundle() {+ // the app's preview wrapper (.raea-view-NAME.tsx) is rewritten at one path, and the folder walk passes dot files over+ let t = std::env::temp_dir().join(format!("raea-bundle-dot-{}", std::process::id()));+ std::fs::create_dir_all(&t).unwrap();+ let o = raea_runtime_bundle::comp_opts(&[]).unwrap();+ let (hidden, plain) = (t.join(".raea-view-body.tsx"), t.join("body.tsx"));+ std::fs::write(&hidden, "export const a = 1\n").unwrap();+ std::fs::write(&plain, "export const a = 1\n").unwrap();+ let (first, other) = (raea_runtime_bundle::bundle_cache(&hidden, &o).unwrap(), raea_runtime_bundle::bundle_cache(&plain, &o).unwrap());+ std::fs::write(&hidden, "export const a = 22\n").unwrap();+ assert_ne!(raea_runtime_bundle::bundle_cache(&hidden, &o).unwrap(), first);+ // a file the walk sees is counted once, as before+ assert_eq!(raea_runtime_bundle::bundle_cache(&plain, &o).unwrap(), other);+ std::fs::remove_dir_all(&t).unwrap();+ }+}diff --git a/runtime/bundle/src/cache.rs b/runtime/bundle/src/cache.rsindex 0fceb178..348db2ba 100644--- a/runtime/bundle/src/cache.rs+++ b/runtime/bundle/src/cache.rs@@ -165,11 +165,6 @@ pub fn bundle_cache(tsx: &Path, o: &CompOpts) -> Option<PathBuf> {let js = raea_io_home::home().join("sdk/react/js");let mut files = Vec::new();walk(tsx.parent()?, 0, &mut files);- // the edit itself when its name starts with a dot, which the walk passes over (the app's preview wrappers,- // .raea-view-NAME.tsx, are rewritten at one path: without this a rewritten one got the bundle of the last)- if file_is_hidden(tsx) {- files.extend(stat(tsx).map(|(n, t)| (tsx.to_path_buf(), n, t)));- }// what it imports from outside its folder (outside.rs): editing an example re-bundles what imports itfor o in outside(tsx.parent()?).unwrap_or_default() {files.extend(stat(&o.file).map(|(n, t)| (o.file, n, t)));@@ -182,8 +177,8 @@ pub fn bundle_cache(tsx: &Path, o: &CompOpts) -> Option<PathBuf> {walk(&js.join("lite"), 0, &mut files);files.extend(stat(&js.join("node_modules/bevy-react/src/bridge.ts")).map(|(n, t)| (js.join("node_modules/bevy-react/src/bridge.ts"), n, t)));}- // sdk/tsconfig.base.json: what the SDK's import names mean (rewrite_into)- for p in [js.join("tsconfig.json"), js.join("package.json"), js.join("bun.lock"), raea_io_home::home().join("sdk").join(raea_io_home::sdk::LIST)] {+ // sdk/tsconfig.base.json: what the SDK's import names mean (rewrite_into); and the edit itself when it is a dot file, which the walk passes over (the app's preview wrapper, .raea-view-NAME.tsx, is rewritten at one path and got the bundle of the last one)+ for p in [js.join("tsconfig.json"), js.join("package.json"), js.join("bun.lock"), raea_io_home::home().join("sdk").join(raea_io_home::sdk::LIST)].into_iter().chain(file.starts_with('.').then(|| tsx.to_path_buf())) {files.extend(stat(&p).map(|(n, t)| (p, n, t)));}files.extend(std::env::current_exe().ok().and_then(|p| stat(&p).map(|(n, t)| (p, n, t))));@@ -205,10 +200,6 @@ pub fn bundle_cache(tsx: &Path, o: &CompOpts) -> Option<PathBuf> {Some(root.join(format!("{key:016x}.js")))}-fn file_is_hidden(p: &Path) -> bool {- p.file_name().is_some_and(|n| n.to_string_lossy().starts_with('.'))-}-/// The newest `keep` files with extension `ext` in `dir` kept, by when they were last written or used.pub fn prune_cache(dir: &Path, ext: &str, keep: usize) {// a write that never finished (its process killed between the copy and the rename) goes after an hourdiff --git a/runtime/bundle/src/tests.rs b/runtime/bundle/src/tests.rsindex 9a55ada8..be589420 100644--- a/runtime/bundle/src/tests.rs+++ b/runtime/bundle/src/tests.rs@@ -70,20 +70,3 @@ fn outside_copies_what_the_edit_imports_beyond_its_folder() {assert!(e.contains("lib/c.ts") && e.contains("outside raea's home"), "{e}");std::fs::remove_dir_all(&t).unwrap();}--#[test]-fn a_dot_named_edit_rewritten_gets_another_bundle() {- // the app's preview wrapper (.raea-view-NAME.tsx) is rewritten at one path, and the folder walk passes dot files over- let t = std::env::temp_dir().join(format!("raea-bundle-dot-{}", std::process::id()));- std::fs::create_dir_all(&t).unwrap();- let o = comp_opts(&[]).unwrap();- let (hidden, plain) = (t.join(".raea-view-body.tsx"), t.join("body.tsx"));- std::fs::write(&hidden, "export const a = 1\n").unwrap();- std::fs::write(&plain, "export const a = 1\n").unwrap();- let (first, other) = (bundle_cache(&hidden, &o).unwrap(), bundle_cache(&plain, &o).unwrap());- std::fs::write(&hidden, "export const a = 22\n").unwrap();- assert_ne!(bundle_cache(&hidden, &o).unwrap(), first);- // a file the walk sees is counted once, as before- assert_eq!(bundle_cache(&plain, &o).unwrap(), other);- std::fs::remove_dir_all(&t).unwrap();-}