Hotreloading of for/if/body, formatted strings, literals, component props, nested rsx, light CLI rewrite, cli TUI (#2258)

Hotreload the contents of for loops, if chains, component bodies, props, attributes, and any literals discovered in rsx!
Add a TUI renderer to the CLI.
Improve the CLI build system to be async and parallel.
Refactor RSX to allow partial expansion of expressions.
Merge autofmt implementations for consistency.
Merge the representation of elements and components under the hood.
Add a diagnostics system for rsx for improved error messages.
Drop interprocess and move to websockets for communication between the CLI and the server.
Assign IDs to nodes and attributes in a stable way to be used in non compiler contexts.
Add hotreloading to any body of component/for loop/if chain/etc.

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Liam Mitchell <liamkarlmitchell@gmail.com>
This commit is contained in:
authored and GitHub committed 2024-07-17 19:11:18 -07:00
1 parent 176e67e5b7
commit 88af3e7eff
181 files changed
+12755 -10806

No files matched your search

+3 -3
View File
@@ -82,7 +82,6 @@ impl Runtime {
{
let borrow = self.scope_states.borrow();
if let Some(scope) = &borrow[id.0] {
let _runtime_guard = RuntimeGuard::new(self.clone());
// Manually drop tasks, hooks, and contexts inside of the runtime
self.on_scope(id, || {
// Drop all spawned tasks - order doesn't matter since tasks don't rely on eachother
@@ -112,7 +111,8 @@ impl Runtime {
/// Call this function with the current scope set to the given scope
///
/// Useful in a limited number of scenarios
pub fn on_scope<O>(&self, id: ScopeId, f: impl FnOnce() -> O) -> O {
pub fn on_scope<O>(self: &Rc<Self>, id: ScopeId, f: impl FnOnce() -> O) -> O {
let _runtime_guard = RuntimeGuard::new(self.clone());
{
self.push_scope(id);
}
@@ -164,7 +164,7 @@ impl Runtime {
/// Runs a function with the current runtime
pub(crate) fn with<R>(f: impl FnOnce(&Runtime) -> R) -> Option<R> {
RUNTIMES.with(|stack| stack.borrow().last().map(|r| f(r)))
Self::current().map(|r| f(&r))
}
/// Runs a function with the current scope