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>
30 lines
834 B
Rust
30 lines
834 B
Rust
#![allow(unused)]
|
|
|
|
#[cfg(feature = "hot_reload")]
|
|
use internment::Intern;
|
|
|
|
use proc_macro2::TokenStream as TokenStream2;
|
|
use std::{fmt::Debug, hash::Hash};
|
|
|
|
/// interns a object into a static object, resusing the value if it already exists
|
|
#[cfg(feature = "hot_reload")]
|
|
pub(crate) fn intern<T: Eq + Hash + Send + Sync + ?Sized + 'static>(
|
|
s: impl Into<Intern<T>>,
|
|
) -> &'static T {
|
|
s.into().as_ref()
|
|
}
|
|
|
|
/// These are just helpful methods for tests to pretty print the token stream - they are not used in the actual code
|
|
// #[cfg(test)]
|
|
pub trait PrettyUnparse {
|
|
fn pretty_unparse(&self) -> String;
|
|
}
|
|
|
|
// #[cfg(test)]
|
|
impl PrettyUnparse for TokenStream2 {
|
|
fn pretty_unparse(&self) -> String {
|
|
let parsed = syn::parse2::<syn::Expr>(self.clone()).unwrap();
|
|
prettier_please::unparse_expr(&parsed)
|
|
}
|
|
}
|