use std::{ collections::{HashMap, HashSet}, error::Error, }; use oxc::allocator::Allocator; pub type RewriteRuleCallback = Box< dyn for<'alloc, 'data> Fn( &'alloc Allocator, &'data str, &'data T, ) -> Result, Box>, >; pub struct RewriteRule { pub attrs: HashMap>>, pub func: RewriteRuleCallback, } #[macro_export] macro_rules! attrmap { ({ $($attr:literal: [$($el:literal),*]),* }) => { { let mut map = std::collections::HashMap::>>::new(); $( { let mut vec = std::collections::HashSet::new(); $( vec.insert($el.to_string()); )* map.insert($attr.to_string(), Some(vec)); } )* map } }; }