fix(site): use first-match-wins for multipart primary selection (#519)

This commit is contained in:
Darius Cepulis
2026-02-12 10:16:50 -06:00
committed by GitHub
parent 82944041f9
commit d5e41bfa4d
+8 -2
View File
@@ -254,8 +254,14 @@ function discoverParts(source: ComponentSource, program: ts.Program): PartSource
const subPartElementFile = path.join(htmlDir, `${componentKebab}-${kebab}-element.ts`);
const hasSubPartElement = fs.existsSync(subPartElementFile);
// Primary part: no matching sub-part element, but main element exists
const isPrimary = !hasSubPartElement && !!source.htmlPath;
// Primary part: no matching sub-part element, main element exists, and first match wins.
const isPrimary = !hasSubPartElement && !!source.htmlPath && !hasPrimary;
if (!hasSubPartElement && !!source.htmlPath && hasPrimary) {
log.warn(
`${source.name}: Part "${partExport.name}" also matches primary criteria and was skipped (first-match-wins)`
);
}
if (isPrimary) hasPrimary = true;