@@ -342,12 +342,16 @@ const detectPageTechnologies = (ruleConfig: Record<string, unknown> = {}) => {
342342 }
343343
344344 function normalizeFallbackTechName ( name ) {
345- return String ( name || '' )
345+ const normalized = String ( name || '' )
346346 . toLowerCase ( )
347347 . replace ( / ^ 疑 似 前 端 库 : \s * / , '' )
348348 . replace ( / (?: \. j s | j s ) $ / i, '' )
349349 . replace ( / (?: [ . _ - ] p k g d ) $ / i, '' )
350350 . replace ( / [ ^ a - z 0 - 9 \u4e00 - \u9fa5 ] + / g, '' )
351+ const aliases = {
352+ slickcarousel : 'slick'
353+ }
354+ return aliases [ normalized ] || normalized
351355 }
352356
353357 function suppressFrontendFallbackDuplicates ( items ) {
@@ -1159,18 +1163,39 @@ ${html}`
11591163
11601164 function scoreTailwind ( classes ) {
11611165 const tokens = Object . keys ( classes )
1162- let score = 0
1166+ let utilityScore = 0
1167+ let specificScore = 0
1168+ let bootstrapScore = 0
1169+ let distinctUtilityCount = 0
11631170 let count = 0
11641171 const TAILWIND_PATTERN =
11651172 / ^ (?: s m | m d | l g | x l | 2 x l ) : | ^ - ? (?: m | p | m t | m r | m b | m l | m x | m y | p t | p r | p b | p l | p x | p y ) - | ^ (?: t e x t | b g | b o r d e r | r i n g | s h a d o w | r o u n d e d | g r i d | f l e x | i t e m s | j u s t i f y | g a p | s p a c e | w | h | m i n - w | m a x - w | m i n - h | m a x - h ) - | ^ (?: h o v e r | f o c u s | a c t i v e | d i s a b l e d | d a r k ) : | \[ [ ^ \] ] + \] /
1173+ const TAILWIND_SPECIFIC_PATTERN =
1174+ / ^ (?: s m | m d | l g | x l | 2 x l | h o v e r | f o c u s | a c t i v e | d i s a b l e d | d a r k ) : | ^ \[ [ ^ \] ] + \] $ | ^ (?: t e x t | b g | b o r d e r | r i n g | f r o m | t o | v i a ) - (?: s l a t e | g r a y | z i n c | n e u t r a l | s t o n e | r e d | o r a n g e | a m b e r | y e l l o w | l i m e | g r e e n | e m e r a l d | t e a l | c y a n | s k y | b l u e | i n d i g o | v i o l e t | p u r p l e | f u c h s i a | p i n k | r o s e ) - (?: 5 0 | 1 0 0 | 2 0 0 | 3 0 0 | 4 0 0 | 5 0 0 | 6 0 0 | 7 0 0 | 8 0 0 | 9 0 0 | 9 5 0 ) $ | ^ (?: g r i d - c o l s | g r i d - r o w s | g a p | s p a c e - x | s p a c e - y ) - \d + $ | ^ (?: w | h | m i n - w | m a x - w | m i n - h | m a x - h ) - (?: s c r e e n | f u l l | f i t | m i n | m a x | \d + \/ \d + ) $ /
1175+ const BOOTSTRAP_PATTERN =
1176+ / ^ (?: c o n t a i n e r (?: - (?: f l u i d | s m | m d | l g | x l | x x l ) ) ? | r o w | c o l (?: - \d + | - (?: s m | m d | l g | x l | x x l ) (?: - \d + ) ? ) ? | b t n (?: - .+ ) ? | n a v b a r (?: - .+ ) ? | c a r d (?: - .+ ) ? | d r o p d o w n (?: - .+ ) ? | m o d a l (?: - .+ ) ? | f o r m (?: - .+ ) ? | i n p u t - g r o u p (?: - .+ ) ? | t a b l e (?: - .+ ) ? | a l e r t (?: - .+ ) ? | b a d g e (?: - .+ ) ? | d - (?: n o n e | i n l i n e | i n l i n e - b l o c k | b l o c k | g r i d | t a b l e | f l e x | i n l i n e - f l e x ) | j u s t i f y - c o n t e n t - .+ | a l i g n - i t e m s - .+ | t e x t - (?: c e n t e r | s t a r t | e n d | l e f t | r i g h t | m u t e d | p r i m a r y | s e c o n d a r y | s u c c e s s | d a n g e r | w a r n i n g | i n f o | l i g h t | d a r k | w h i t e | b o d y | b l a c k - 5 0 | w h i t e - 5 0 ) | (?: m | p ) [ t b l r x y ] ? - (?: [ 0 - 5 ] | a u t o ) | m d i (?: - .+ ) ? ) $ /
11661177 for ( const token of tokens ) {
11671178 if ( count ++ >= 5000 ) break
1179+ if ( BOOTSTRAP_PATTERN . test ( token ) ) {
1180+ const c = classes [ token ]
1181+ bootstrapScore += c < 3 ? c : 3
1182+ }
11681183 if ( TAILWIND_PATTERN . test ( token ) ) {
11691184 const c = classes [ token ]
1170- score += c < 3 ? c : 3
1185+ utilityScore += c < 3 ? c : 3
1186+ distinctUtilityCount += 1
1187+ if ( TAILWIND_SPECIFIC_PATTERN . test ( token ) ) {
1188+ specificScore += c < 3 ? c : 3
1189+ }
11711190 }
11721191 }
1173- return score
1192+ if ( specificScore < 3 && bootstrapScore >= 8 ) {
1193+ return 0
1194+ }
1195+ if ( specificScore < 2 && ( distinctUtilityCount < 14 || utilityScore < 24 ) ) {
1196+ return 0
1197+ }
1198+ return utilityScore + specificScore * 4
11741199 }
11751200
11761201 function getMetaContent ( name ) {
0 commit comments