* Check if a component name correlates with any DOM class
( componentName: string, domClasses: Set<string>, )
| 278 | * Check if a component name correlates with any DOM class |
| 279 | */ |
| 280 | function componentCorrelatesWithDOM( |
| 281 | componentName: string, |
| 282 | domClasses: Set<string>, |
| 283 | ): boolean { |
| 284 | const normalized = normalizeComponentName(componentName); |
| 285 | |
| 286 | for (const cls of domClasses) { |
| 287 | // Exact match: SideNav -> side-nav |
| 288 | if (cls === normalized) return true; |
| 289 | |
| 290 | // Contains match: LinkComponent -> nav-link contains "link" |
| 291 | // Split both by hyphens and check for word overlaps |
| 292 | const componentWords = normalized.split("-").filter((w) => w.length > 2); |
| 293 | const classWords = cls.split("-").filter((w) => w.length > 2); |
| 294 | |
| 295 | for (const cWord of componentWords) { |
| 296 | for (const dWord of classWords) { |
| 297 | if (cWord === dWord || cWord.includes(dWord) || dWord.includes(cWord)) { |
| 298 | return true; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | return false; |
| 305 | } |
| 306 | |
| 307 | function shouldIncludeComponent( |
| 308 | name: string, |
no test coverage detected
searching dependent graphs…