fix: allow duplicate selectors in scope, coz its safe to have them, coz hashing isnt affected by selector position

This commit is contained in:
Yiffy Dev 2024-12-13 01:26:23 +05:00 • committed by spushk
commit 1b63e4cd3c
Signed by: spushk
GPG key ID: 7797B761E105E8AA
2 changed files with 68 additions and 11 deletions

View file

@ -16,6 +16,7 @@ quote = {version = "^1.0"}
proc-macro2 = {version = "^1.0", features = ["span-locations"]}
raffia = {version = "^0.9"}
regex = {version = "^1.11"}
itertools = {version = "^0.13"}
[features]
nightly = []

View file

@ -1,5 +1,6 @@
use std::path::PathBuf;
use itertools::Itertools;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use sabry_intrnl::{
@ -94,6 +95,7 @@ pub fn styly_macro_impl(input: TokenStream, source_path: Option<PathBuf>) -> Tok
interp
})
})
.unique()
.map(|s| {
let ident = apply_basic_rusty_member_gen_rules(&s);
let fnident = syn::parse_str::<Ident>(format!("_{ident}").as_str())
@ -110,6 +112,7 @@ pub fn styly_macro_impl(input: TokenStream, source_path: Option<PathBuf>) -> Tok
let scope_members = scope
.hashed_selectors
.iter()
.unique()
.filter_map(|hs| {
hs.html_ident.clone().map(|html| {
let name = match hs.sel {