Skip to content

Commit

Permalink
chore: Change dependency from syn-rsx to rstml
Browse files Browse the repository at this point in the history
  • Loading branch information
vldm committed May 17, 2023
1 parent f8f854d commit 7576e0a
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion leptos_hot_reload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ syn = { version = "2", features = [
"printing",
] }
quote = "1"
syn-rsx = {git = "https://github.com/vldm/syn-rsx"}
rstml = "0.10.6"
proc-macro2 = { version = "1", features = ["span-locations", "nightly"] }
parking_lot = "0.12"
walkdir = "2"
Expand Down
2 changes: 1 addition & 1 deletion leptos_hot_reload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl ViewMacros {
tokens.next(); // ,
// TODO handle class = ...
let rsx =
syn_rsx::parse2(tokens.collect::<proc_macro2::TokenStream>())?;
rstml::parse2(tokens.collect::<proc_macro2::TokenStream>())?;
let template = LNode::parse_view(rsx)?;
views.push(MacroInvocation { id, template })
}
Expand Down
2 changes: 1 addition & 1 deletion leptos_hot_reload/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::parsing::is_component_node;
use anyhow::Result;
use quote::ToTokens;
use serde::{Deserialize, Serialize};
use syn_rsx::{Node, NodeAttribute};
use rstml::node::{Node, NodeAttribute};

// A lightweight virtual DOM structure we can use to hold
// the state of a Leptos view macro template. This is because
Expand Down
2 changes: 1 addition & 1 deletion leptos_hot_reload/src/parsing.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use syn_rsx::NodeElement;
use rstml::node::NodeElement;

pub fn value_to_string(value: &syn::Expr) -> Option<String> {
match &value {
Expand Down
2 changes: 1 addition & 1 deletion leptos_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc-macro-error = "1"
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full"] }
syn-rsx = {git = "https://github.com/vldm/syn-rsx"}
rstml = "0.10.6"
leptos_hot_reload = { workspace = true }
server_fn_macro = { workspace = true }
convert_case = "0.6.0"
Expand Down
6 changes: 3 additions & 3 deletions leptos_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use proc_macro2::{Span, TokenTree};
use quote::ToTokens;
use server_fn_macro::{server_macro_impl, ServerContext};
use syn::parse_macro_input;
use syn_rsx::{parse, KeyedAttribute};
use rstml::{parse, node::KeyedAttribute};

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub(crate) enum Mode {
Expand Down Expand Up @@ -351,8 +351,8 @@ pub fn view(tokens: TokenStream) -> TokenStream {
.chain(tokens)
.collect()
};
let config = syn_rsx::ParserConfig::default().recover_block(true);
let parser = syn_rsx::Parser::new(config);
let config = rstml::ParserConfig::default().recover_block(true);
let parser = rstml::Parser::new(config);
let (nodes, errors) = parser.parse_recoverable(tokens).split_vec();
let errors = errors.into_iter().map(|e| e.emit_as_expr_tokens());
let nodes_output = render_view(
Expand Down
2 changes: 1 addition & 1 deletion leptos_macro/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use leptos_hot_reload::parsing::is_component_node;
use proc_macro2::{Ident, Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use syn::{spanned::Spanned, ExprBlock};
use syn_rsx::{Node, NodeAttribute, NodeElement, KeyedAttribute, NodeBlock};
use rstml::node::{Node, NodeAttribute, NodeElement, KeyedAttribute, NodeBlock};
use uuid::Uuid;

pub(crate) fn render_template(cx: &Ident, nodes: &[Node]) -> TokenStream {
Expand Down
2 changes: 1 addition & 1 deletion leptos_macro/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use proc_macro2::{Ident, Span, TokenStream, TokenTree};
use quote::{format_ident, quote, quote_spanned};
use std::collections::HashMap;
use syn::{spanned::Spanned, Expr, ExprLit, ExprPath, Lit};
use syn_rsx::{Node, NodeAttribute, NodeElement, NodeName, KeyedAttribute};
use rstml::node::{Node, NodeAttribute, NodeElement, NodeName, KeyedAttribute};

#[derive(Clone, Copy)]
enum TagType {
Expand Down

0 comments on commit 7576e0a

Please sign in to comment.