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
A comment that says "import" no longer takes the edit's real import
shinyobjectz6cd3a2f29f05
diff --git a/runtime/bundle/src/rewrite.rs b/runtime/bundle/src/rewrite.rsindex e18303e1..3b7ed23a 100644--- a/runtime/bundle/src/rewrite.rs+++ b/runtime/bundle/src/rewrite.rs@@ -45,15 +45,15 @@ pub const MEDIA_EXTS: [&str; 10] = ["mp4", "mov", "m4v", "mp3", "wav", "m4a", "ppub fn rewrite_into(src: &str, from_dir: &Path, motion_src: &Path, to_motion: &str, portable: Option<&Path>) -> R<String> {// `export ... from` too: a package re-exporting the umbrella (tone.tsx's sao and lyria) was left externallet re = regex::Regex::new(r#"(?s)\b(?:(import)\s+([^;'"]*?)|(export)\s+((?:\*|\{|type\s*\{)[^;'"]*?))\s+from\s+(["'])([^"']+)["']"#).unwrap();- let mut out = String::new();- let mut last = 0;// only real statements: an import written inside a string, a template or a comment (a code chip's text) is text- let text = text_spans(src);- for c in re.captures_iter(src) {+ let (mut out, mut last, mut at, text) = (String::new(), 0, 0, text_spans(src));+ while let Some(c) = re.captures_at(src, at) {let whole = c.get(0).unwrap();- if text.iter().any(|&(a, b)| a <= whole.start() && whole.start() < b) {+ if let Some(&(_, end)) = text.iter().find(|&&(a, b)| a <= whole.start() && whole.start() < b) {+ at = end; // looked for again after that text: its match can run on into a real import (css/edit.tsx, 11-22)continue;}+ at = whole.end();let kw = c.get(1).or(c.get(3)).unwrap().as_str();let what = c.get(2).or(c.get(4)).unwrap().as_str().trim();let spec = c.get(6).unwrap().as_str();diff --git a/runtime/bundle/src/tests.rs b/runtime/bundle/src/tests.rsindex 29e211af..bbbaa61d 100644--- a/runtime/bundle/src/tests.rs+++ b/runtime/bundle/src/tests.rs@@ -23,7 +23,7 @@ fn rewrite_into_points_imports_and_re_exports_at_the_copies() {fn an_import_written_in_a_string_template_or_comment_is_left_as_text() {// a code chip's text (a launch film types `import { RigidBody } from "raea/plugins/avian"`) isn't an importlet m = &raea_io_home::home().join("sdk/raea/src");- let src = "import { a } from \"raea\";\nconst chip = `import { b } from \"raea/clock\"; ${ {x: `import c from \"raea\"`}.x }`;\n// import d from \"raea\";\n/* import e from \"raea\"; */\nconst s = 'import f from \"raea\"';\nconst r = /import g from \"raea\"/;\nimport { h } from \"raea/clock\";\n";+ let src = "import { a } from \"raea\";\nconst chip = `import { b } from \"raea/clock\"; ${ {x: `import c from \"raea\"`}.x }`;\n// import d from \"raea\";\n/* import e from \"raea\"; */\nconst s = 'import f from \"raea\"';\nconst r = /import g from \"raea\"/;\n// its @import and nesting\nimport { h } from \"raea/clock\";\n";let out = rewrite_into(src, Path::new("/nowhere/app"), m, "../motion", None).unwrap();assert!(out.starts_with("import { a } from \"../motion/prelude\""), "{out}");assert!(out.ends_with("import { h } from \"../app/clock\";\n"), "{out}");diff --git a/sdk/react/bench/css/check.sh b/sdk/react/bench/css/check.shindex 2ff55515..04b0fe8c 100755--- a/sdk/react/bench/css/check.sh+++ b/sdk/react/bench/css/check.sh@@ -1,11 +1,13 @@#!/bin/sh# A composition's CSS imports and CSS modules reach its page (docs/vite-in-raea.md A2): edit.tsx bundled in process# (RAEA_BUNDLER=rolldown), its first frame rendered, five pixels checked against what Chrome paints for the same CSS.-# sdk/react/bench/css/check.sh [RAEA_MOTION]+# sdk/react/bench/css/check.sh [RAEA] (default: the repo's target/release/raea)# Build first: lane build -- cargo build --release -p raea-cli.set -e+ROOT=$(cd "$(dirname "$0")/../../../.." && pwd)+case ${1:-} in /*|"") ;; *) set -- "$PWD/$1" ;; esaccd "$(dirname "$0")/../.."-BIN=${1:-target/release/raea}+BIN=${1:-$ROOT/target/release/raea}OUT=${TMPDIR:-/tmp}/raea-css-checkmkdir -p "$OUT"RAEA_BUNDLER=rolldown RAEA_BUNDLE_CACHE=0 RAEA_AUDIO_MUTE=1 RAEA_READBACK=rgba "$BIN" render bench/css/edit.tsx -o "$OUT/frame.png" --frame 0 > "$OUT/render.log" 2>&1 || { echo "css: FAIL the render failed (see $OUT/render.log)"; exit 1; }