Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 36 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
[workspace]
resolver = "2"
members = [
# utilities
"oco",
"any_spawner",
"const_str_slice_concat",
"either_of",
"next_tuple",
"oco",
"or_poisoned",
# utilities
"oco",
"any_spawner",
"const_str_slice_concat",
"either_of",
"next_tuple",
"oco",
"or_poisoned",

# core
"hydration_context",
"leptos",
"leptos_dom",
"leptos_config",
"leptos_hot_reload",
"leptos_macro",
"leptos_server",
"reactive_graph",
"reactive_stores",
"reactive_stores_macro",
"server_fn",
"server_fn_macro",
"server_fn/server_fn_macro_default",
"tachys",
# core
"hydration_context",
"leptos",
"leptos_dom",
"leptos_config",
"leptos_hot_reload",
"leptos_macro",
"leptos_macro/leptos_macro_core",
"leptos_server",
"reactive_graph",
"reactive_stores",
"reactive_stores_macro",
"server_fn",
"server_fn_macro",
"server_fn/server_fn_macro_default",
"tachys",

# integrations
"integrations/actix",
"integrations/axum",
"integrations/utils",
# integrations
"integrations/actix",
"integrations/axum",
"integrations/utils",

# libraries
"meta",
"router",
"router_macro",
"any_error",
# libraries
"meta",
"router",
"router_macro",
"any_error",
]
exclude = ["benchmarks", "examples", "projects"]

Expand All @@ -58,6 +59,7 @@ leptos_dom = { path = "./leptos_dom", version = "0.8.0-rc3" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.8.0-rc3" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.8.0-rc3" }
leptos_macro = { path = "./leptos_macro", version = "0.8.0-rc3" }
leptos_macro_core = { path = "./leptos_macro/leptos_macro_core", version = "0.8.0-rc3" }
leptos_router = { path = "./router", version = "0.8.0-rc3" }
leptos_router_macro = { path = "./router_macro", version = "0.8.0-rc3" }
leptos_server = { path = "./leptos_server", version = "0.8.0-rc3" }
Expand Down Expand Up @@ -90,6 +92,6 @@ max_combination_size = 2

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(erase_components)',
'cfg(leptos_debuginfo)',
'cfg(erase_components)',
] }
95 changes: 15 additions & 80 deletions leptos_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "leptos_macro"
version = { workspace = true }
authors = ["Greg Johnston"]
license = "MIT"
repository = "https://github.com/leptos-rs/leptos"
description = "view macro for the Leptos web framework."
readme = "../README.md"
Expand All @@ -13,90 +12,26 @@ edition.workspace = true
proc-macro = true

[dependencies]
attribute-derive = { version = "0.10.3", features = ["syn-full"] }
cfg-if = "1.0"
html-escape = "0.2.13"
itertools = { workspace = true }
prettyplease = "0.2.25"
proc-macro-error2 = { version = "2.0", default-features = false }
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
rstml = "0.12.0"
leptos_hot_reload = { workspace = true }
server_fn_macro = { workspace = true }
convert_case = { workspace = true }
uuid = { version = "1.11", features = ["v4"] }
tracing = { version = "0.1.41", optional = true }

[dev-dependencies]
log = "0.4.22"
typed-builder = "0.20.0"
trybuild = { workspace = true }
leptos = { path = "../leptos" }
leptos_router = { path = "../router", features = ["ssr"] }
server_fn = { path = "../server_fn", features = ["cbor"] }
insta = "1.41"
serde = "1.0"

[build-dependencies]
rustc_version = "0.4.1"
leptos_macro_core.workspace = true
proc-macro-error2 = "2.0.1"
proc-macro2 = "1.0.95"

[features]
csr = []
hydrate = []
ssr = ["server_fn_macro/ssr", "leptos/ssr"]
nightly = ["server_fn_macro/nightly"]
tracing = ["dep:tracing"]
islands = []
trace-components = []
trace-component-props = []
actix = ["server_fn_macro/actix"]
axum = ["server_fn_macro/axum"]
generic = ["server_fn_macro/generic"]
csr = ["leptos_macro_core/csr"]
hydrate = ["leptos_macro_core/hydrate"]
ssr = ["leptos_macro_core/ssr"]
nightly = ["leptos_macro_core/nightly"]
tracing = ["leptos_macro_core/tracing"]
islands = ["leptos_macro_core/islands"]
trace-components = ["leptos_macro_core/trace-components"]
trace-component-props = ["leptos_macro_core/trace-component-props"]
actix = ["leptos_macro_core/actix"]
axum = ["leptos_macro_core/axum"]
generic = ["leptos_macro_core/generic"]
# Having an erasure feature rather than normal --cfg erase_components for the proc macro crate is a workaround for this rust issue:
# https://github.com/rust-lang/cargo/issues/4423
# TLDR proc macros will ignore RUSTFLAGS when --target is specified on the cargo command.
# This works around the issue by the non proc-macro crate which does see RUSTFLAGS enabling the replacement feature on the proc-macro crate, which wouldn't.
# This is automatic as long as the leptos crate is depended upon,
# downstream usage should never manually enable this feature.
__internal_erase_components = []

[package.metadata.cargo-all-features]
denylist = ["tracing", "trace-component-props", "trace-components"]
skip_feature_sets = [
[
"csr",
"hydrate",
],
[
"hydrate",
"csr",
],
[
"hydrate",
"ssr",
],
[
"actix",
"axum",
],
[
"actix",
"generic",
],
[
"generic",
"axum",
],
[
"nightly",
],
]
max_combination_size = 2

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }
__internal_erase_components = ["leptos_macro_core/__internal_erase_components"]
99 changes: 99 additions & 0 deletions leptos_macro/leptos_macro_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[package]
name = "leptos_macro_core"
version = { workspace = true }
authors = ["Greg Johnston"]
license = "MIT"
repository = "https://github.com/leptos-rs/leptos"
description = "Internal code for the view macro for the Leptos web framework."
readme = "../../README.md"
rust-version.workspace = true
edition.workspace = true

[dependencies]
attribute-derive = { version = "0.10.3", features = ["syn-full"] }
cfg-if = "1.0"
html-escape = "0.2.13"
itertools = { workspace = true }
prettyplease = "0.2.25"
proc-macro-error2 = { version = "2.0", default-features = false }
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
rstml = "0.12.0"
leptos_hot_reload = { workspace = true }
server_fn_macro = { workspace = true }
convert_case = { workspace = true }
uuid = { version = "1.11", features = ["v4"] }
tracing = { version = "0.1.41", optional = true }

[dev-dependencies]
log = "0.4.22"
typed-builder = "0.20.0"
trybuild = { workspace = true }
leptos = { workspace = true }
leptos_router = { workspace = true, features = ["ssr"] }
server_fn = { workspace = true, features = ["cbor"] }
insta = "1.41"
serde = "1.0"

[build-dependencies]
rustc_version = "0.4.1"

[features]
csr = []
hydrate = []
ssr = ["server_fn_macro/ssr", "leptos/ssr"]
nightly = ["server_fn_macro/nightly"]
tracing = ["dep:tracing"]
islands = []
trace-components = []
trace-component-props = []
actix = ["server_fn_macro/actix"]
axum = ["server_fn_macro/axum"]
generic = ["server_fn_macro/generic"]
# Having an erasure feature rather than normal --cfg erase_components for the proc macro crate is a workaround for this rust issue:
# https://github.com/rust-lang/cargo/issues/4423
# TLDR proc macros will ignore RUSTFLAGS when --target is specified on the cargo command.
# This works around the issue by the non proc-macro crate which does see RUSTFLAGS enabling the replacement feature on the proc-macro crate, which wouldn't.
# This is automatic as long as the leptos crate is depended upon,
# downstream usage should never manually enable this feature.
__internal_erase_components = []

[package.metadata.cargo-all-features]
denylist = ["tracing", "trace-component-props", "trace-components"]
skip_feature_sets = [
[
"csr",
"hydrate",
],
[
"hydrate",
"csr",
],
[
"hydrate",
"ssr",
],
[
"actix",
"axum",
],
[
"actix",
"generic",
],
[
"generic",
"axum",
],
[
"nightly",
],
]
max_combination_size = 2

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use convert_case::{Case, Casing};
use proc_macro::TokenStream;
use proc_macro2::Ident;
use proc_macro2::{Ident, TokenStream};
use proc_macro_error2::abort;
use quote::quote;
use syn::{spanned::Spanned, ItemFn};

pub fn lazy_impl(
_args: proc_macro::TokenStream,
_args: proc_macro2::TokenStream,
s: TokenStream,
) -> TokenStream {
let fun = syn::parse::<ItemFn>(s).unwrap_or_else(|e| {
let fun = syn::parse2::<ItemFn>(s).unwrap_or_else(|e| {
abort!(e.span(), "`lazy` can only be used on a function")
});
if fun.sig.asyncness.is_none() {
Expand Down
Loading
Loading