@@ -137,6 +137,21 @@ export const suppressGenericCdnFallbacks = (technologies: any[]) => {
137137 return technologies . filter ( tech => tech ?. category !== 'CDN / 托管' || ! GENERIC_CDN_FALLBACK_NAMES . has ( tech ?. name ) )
138138}
139139
140+ // 同名技术既被识别为 UI / CSS 框架(或前端框架),又被归到「前端库」类目时,去掉后者的重复条目
141+ // 例:Bootstrap 同时进了「UI / CSS 框架」和「前端库」,只保留前者
142+ const SPECIFIC_CATEGORIES_OVER_GENERIC_LIB = new Set ( [ 'UI / CSS 框架' , '前端框架' , '构建与运行时' ] )
143+ export const suppressGenericFrontendLibDuplicates = ( technologies : any [ ] ) => {
144+ if ( ! Array . isArray ( technologies ) || ! technologies . length ) return technologies
145+ const specificNames = new Set < string > ( )
146+ for ( const tech of technologies ) {
147+ if ( tech ?. category && SPECIFIC_CATEGORIES_OVER_GENERIC_LIB . has ( tech . category ) && tech . name ) {
148+ specificNames . add ( normalizeTechName ( tech . name ) )
149+ }
150+ }
151+ if ( ! specificNames . size ) return technologies
152+ return technologies . filter ( tech => tech ?. category !== '前端库' || ! specificNames . has ( normalizeTechName ( tech . name ) ) )
153+ }
154+
140155export const filterTechnologiesBySettings = ( technologies : any [ ] , settings : any ) => {
141156 const disabledCategories = new Set ( cleanStringArray ( settings ?. disabledCategories ) )
142157 const disabledTechnologies = new Set ( cleanStringArray ( settings ?. disabledTechnologies ) . map ( name => normalizeTechName ( name ) ) )
@@ -290,7 +305,11 @@ const buildDisplayTechnologies = (data: any, settings: any, suppressMap: Record<
290305 )
291306 const pageUrl = data . page ?. url || data . dynamic ?. url || data . main ?. url || ''
292307 return filterTechnologiesBySettings (
293- suppressSelfHostTechs ( suppressGenericCdnFallbacks ( mergeDisplayTechnologyRecords ( all ) ) , pageUrl , suppressMap ) ,
308+ suppressSelfHostTechs (
309+ suppressGenericFrontendLibDuplicates ( suppressGenericCdnFallbacks ( mergeDisplayTechnologyRecords ( all ) ) ) ,
310+ pageUrl ,
311+ suppressMap
312+ ) ,
294313 settings
295314 )
296315}
0 commit comments