From 6353f81f25e17ec68e7da0b4d3445c5ca6ae1233 Mon Sep 17 00:00:00 2001 From: davidon-top Date: Mon, 18 Nov 2024 23:42:19 +0100 Subject: [PATCH] Move view.rs from sycamore-macro into sycamore-view-parser codegen.rs (#762) refactor(macro): move view.rs from macro into view-parser --- packages/sycamore-macro/src/lib.rs | 3 +-- .../src/view.rs => sycamore-view-parser/src/codegen.rs} | 3 ++- packages/sycamore-view-parser/src/lib.rs | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) rename packages/{sycamore-macro/src/view.rs => sycamore-view-parser/src/codegen.rs} (99%) diff --git a/packages/sycamore-macro/src/lib.rs b/packages/sycamore-macro/src/lib.rs index dd687f61..553cdf34 100644 --- a/packages/sycamore-macro/src/lib.rs +++ b/packages/sycamore-macro/src/lib.rs @@ -10,7 +10,6 @@ use syn::{parse_macro_input, DeriveInput}; mod component; mod inline_props; mod props; -mod view; /// A macro for ergonomically creating complex UI complex layouts. /// @@ -20,7 +19,7 @@ mod view; pub fn view(input: TokenStream) -> TokenStream { let root = parse_macro_input!(input as sycamore_view_parser::ir::Root); - view::Codegen {}.root(&root).into() + sycamore_view_parser::codegen::Codegen {}.root(&root).into() } /// A macro for creating components from functions. diff --git a/packages/sycamore-macro/src/view.rs b/packages/sycamore-view-parser/src/codegen.rs similarity index 99% rename from packages/sycamore-macro/src/view.rs rename to packages/sycamore-view-parser/src/codegen.rs index a885e0b0..433e1e1a 100644 --- a/packages/sycamore-macro/src/view.rs +++ b/packages/sycamore-view-parser/src/codegen.rs @@ -5,9 +5,10 @@ use proc_macro2::TokenStream; use quote::quote; -use sycamore_view_parser::ir::{DynNode, Node, Prop, PropType, Root, TagIdent, TagNode, TextNode}; use syn::{Expr, Pat}; +use crate::ir::{DynNode, Node, Prop, PropType, Root, TagIdent, TagNode, TextNode}; + pub struct Codegen { // TODO: configure mode: Client, Hydrate, SSR } diff --git a/packages/sycamore-view-parser/src/lib.rs b/packages/sycamore-view-parser/src/lib.rs index 93af47d4..76b2072f 100644 --- a/packages/sycamore-view-parser/src/lib.rs +++ b/packages/sycamore-view-parser/src/lib.rs @@ -1,4 +1,5 @@ //! Proc-macro support crate for Sycamore. +pub mod codegen; pub mod ir; pub mod parse;