Remove macro-impl crate

This commit is contained in:
Justin Starry 2019-07-15 09:50:49 -04:00
parent 980b2c1071
commit af45d91f05
38 changed files with 50 additions and 65 deletions

View File

@ -13,19 +13,21 @@ description = "A framework for making client-side single-page apps"
edition = "2018"
[dependencies]
failure = "0.1"
log = "0.4"
http = "0.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bincode = "=1.0.1"
anymap = "0.12"
bincode = "=1.0.1"
failure = "0.1"
http = "0.1"
log = "0.4"
proc-macro-hack = "0.5"
proc-macro-nested = "0.1"
rmp-serde = { version = "0.13.7", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_cbor = { version = "0.9.0", optional = true }
serde_json = "1.0"
serde_yaml = { version = "0.8.3", optional = true }
slab = "0.4"
stdweb = "^0.4.16"
toml = { version = "0.4", optional = true }
serde_yaml = { version = "0.8.3", optional = true }
rmp-serde = { version = "0.13.7", optional = true }
serde_cbor = { version = "0.9.0", optional = true }
yew-macro = { path = "crates/macro" }
[target.'cfg(all(target_arch = "wasm32", not(cargo_web)))'.dependencies]
@ -33,6 +35,7 @@ wasm-bindgen = "0.2"
[dev-dependencies]
serde_derive = "1"
trybuild = "1.0"
[target.'cfg(all(target_arch = "wasm32", not(cargo_web)))'.dev-dependencies]
wasm-bindgen-test = "0.2"
@ -47,7 +50,6 @@ cbor = ["serde_cbor"]
[workspace]
members = [
"crates/macro",
"crates/macro-impl",
"examples/counter",
"examples/crm",
"examples/custom_components",

View File

@ -1,15 +0,0 @@
[package]
name = "yew-macro-impl"
version = "0.7.0"
edition = "2018"
[lib]
proc-macro = true
[dependencies]
boolinator = "2.4.0"
lazy_static = "1.3.0"
proc-macro-hack = "0.5"
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "^0.15.34", features = ["full"] }

View File

@ -1,21 +0,0 @@
#![recursion_limit = "128"]
extern crate proc_macro;
mod html_tree;
use html_tree::HtmlRoot;
use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;
use quote::quote;
use syn::buffer::Cursor;
use syn::parse_macro_input;
trait Peek<T> {
fn peek(cursor: Cursor) -> Option<T>;
}
#[proc_macro_hack]
pub fn html(input: TokenStream) -> TokenStream {
let root = parse_macro_input!(input as HtmlRoot);
TokenStream::from(quote! {#root})
}

View File

@ -2,17 +2,14 @@
name = "yew-macro"
version = "0.7.0"
edition = "2018"
autotests = false
[[test]]
name = "tests"
path = "tests/cases.rs"
[dev-dependencies]
trybuild = "1.0"
yew = { path = "../.." }
[lib]
proc-macro = true
[dependencies]
boolinator = "2.4.0"
lazy_static = "1.3.0"
proc-macro-hack = "0.5"
proc-macro-nested = "0.1"
yew-macro-impl = { path = "../macro-impl" }
proc-macro2 = "0.4"
quote = "0.6"
syn = { version = "^0.15.34", features = ["full"] }

View File

@ -1,5 +1,21 @@
use proc_macro_hack::proc_macro_hack;
#![recursion_limit = "128"]
extern crate proc_macro;
/// This macro implements JSX-like templates.
#[proc_macro_hack(support_nested)]
pub use yew_macro_impl::html;
mod html_tree;
use html_tree::HtmlRoot;
use proc_macro::TokenStream;
use proc_macro_hack::proc_macro_hack;
use quote::quote;
use syn::buffer::Cursor;
use syn::parse_macro_input;
trait Peek<T> {
fn peek(cursor: Cursor) -> Option<T>;
}
#[proc_macro_hack]
pub fn html(input: TokenStream) -> TokenStream {
let root = parse_macro_input!(input as HtmlRoot);
TokenStream::from(quote! {#root})
}

View File

@ -16,8 +16,8 @@
//! }
use crate::callback::Callback;
use crate::html;
use crate::html::{ChangeData, Component, ComponentLink, Html, Renderable, ShouldRender};
use crate::macros::html;
/// `Select` component.
pub struct Select<T> {

View File

@ -62,12 +62,18 @@
anonymous_parameters,
elided_lifetimes_in_paths
)]
#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
#![recursion_limit = "512"]
extern crate self as yew;
/// This module contains macros which implements html! macro and JSX-like templates.
use proc_macro_hack::proc_macro_hack;
/// This macro implements JSX-like templates.
#[proc_macro_hack(support_nested)]
pub use yew_macro::html;
/// This module contains macros which implements html! macro and JSX-like templates
pub mod macros {
pub use yew_macro::html;
pub use crate::html;
}
pub mod agent;
@ -126,13 +132,12 @@ where
/// use yew::prelude::*;
/// ```
pub mod prelude {
pub use yew_macro::html;
pub use crate::agent::{Bridge, Bridged, Threaded};
pub use crate::app::App;
pub use crate::callback::Callback;
pub use crate::events::*;
pub use crate::html::{Component, ComponentLink, Href, Html, Renderable, ShouldRender};
pub use crate::macros::*;
/// Prelude module for creating worker.
pub mod worker {

1
src/macros.rs Normal file
View File

@ -0,0 +1 @@