diff --git a/slhx-derive/src/lib.rs b/slhx-derive/src/lib.rs index 90cbae0..f47ec2b 100644 --- a/slhx-derive/src/lib.rs +++ b/slhx-derive/src/lib.rs @@ -89,22 +89,10 @@ pub fn component(_attr: TokenStream, item: TokenStream) -> TokenStream { .into(); }; let Some(syms_path) = syms_path() else { - return quote!( - #module - compile_error!("#[slhx::component] requires OUT_DIR; run inside a Cargo crate with slhx_build::app() in build.rs"); - ) - .into(); + return quote!(#module).into(); }; if !syms_path.exists() { - let message = format!( - "#[slhx::component] could not find {}; add slhx_build::app().run()? to build.rs or check template generation", - syms_path.display() - ); - return quote!( - #module - compile_error!(#message); - ) - .into(); + return quote!(#module).into(); } let missing = missing_component_handlers(&syms_path, items); if !missing.is_empty() { diff --git a/slhx-derive/tests/surface.rs b/slhx-derive/tests/surface.rs index 01e8f6a..0275172 100644 --- a/slhx-derive/tests/surface.rs +++ b/slhx-derive/tests/surface.rs @@ -1,4 +1,9 @@ -use slhx_derive::surface; +use slhx_derive::{component, surface}; + +#[component] +mod local_component { + pub const EXISTING: u8 = 1; +} #[surface] mod ui { @@ -9,3 +14,8 @@ mod ui { fn surface_macro_preserves_inline_module_with_generated_file() { assert_eq!(ui::EXISTING, 1); } + +#[test] +fn component_macro_preserves_inline_module_without_generated_symbols() { + assert_eq!(local_component::EXISTING, 1); +}