fix(derive): keep components incremental
Let #[slhx::component] preserve inline modules when generated symbols are absent, while still enforcing handler completeness when slhx.syms exists. req: component/005 req: test/002
This commit is contained in:
+2
-14
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user