feat(sdk): rename attribute to #[chain_module], keep #[fai_module] alias
Some checks failed
CI / Linux x86_64 (Forgejo) (push) Failing after 2s

The public macro name was the last product-scoped 'fai' identifier
in the SDK surface. #[chain_module] is now the primary attribute
(README + examples updated); #[fai_module] stays as a delegating
alias so modules written before the rename keep compiling. 0.2.1.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-07-11 19:02:40 +02:00
parent 40f3dbd885
commit 4b4de3374c
9 changed files with 33 additions and 19 deletions

View file

@ -1,6 +1,7 @@
//! Procedural macros powering `chain-module-sdk`.
//!
//! This crate exists only to host the `#[fai_module]` attribute.
//! This crate exists only to host the `#[chain_module]` attribute
//! (and its legacy alias `#[fai_module]`).
//! Module authors should depend on `chain-module-sdk` (which
//! re-exports the macro), not on this crate directly.
@ -26,7 +27,19 @@ const WIT_INLINE: &str = include_str!("../../../wit/world.wit");
/// the `wit_bindgen::export!` call. The function can be named
/// anything — only its signature matters.
#[proc_macro_attribute]
pub fn chain_module(_attrs: TokenStream, input: TokenStream) -> TokenStream {
expand_module(input)
}
/// Legacy alias for [`chain_module`], kept so modules written
/// before the product rename keep compiling. New code uses
/// `#[chain_module]`.
#[proc_macro_attribute]
pub fn fai_module(_attrs: TokenStream, input: TokenStream) -> TokenStream {
expand_module(input)
}
fn expand_module(input: TokenStream) -> TokenStream {
let user_fn = parse_macro_input!(input as ItemFn);
let user_fn_name = user_fn.sig.ident.clone();
let wit_literal = WIT_INLINE;