fix: emit section scripts alongside styles

This commit is contained in:
2026-05-01 00:11:00 -06:00
parent 9ccad0ae81
commit 8c059f208a
+13 -19
View File
@@ -124,27 +124,21 @@ export const collectEntries = (sourceDir, config) => {
const relativeSpecPath = normalizePath(relative(sourceRoot, absolutePath)); const relativeSpecPath = normalizePath(relative(sourceRoot, absolutePath));
const isComponentSpec = relativeSpecPath.startsWith(`${config.paths.components}/`); const isComponentSpec = relativeSpecPath.startsWith(`${config.paths.components}/`);
for (const extension of ['.scss', '.css', '.js']) { if (!isComponentSpec) {
const isStyle = styleExtensions.includes(extension); const styleEntry = findFirstExistingStyle(
sourceRoot,
if (isComponentSpec && isStyle) { normalizePath(relative(sourceRoot, join(componentDir, `${stem}.css`)))
continue; );
if (styleEntry) {
entries[normalizePath(styleEntry.relativePath)] = styleEntry.absolutePath;
}
} }
const entryPath = join(componentDir, `${stem}${extension}`); const scriptPath = join(componentDir, `${stem}.js`);
if (!existsSync(entryPath)) { if (existsSync(scriptPath)) {
continue; if (!isComponentSpec || hasRuntimeSelfRegistration(scriptPath)) {
} const relativePath = normalizePath(relative(sourceRoot, scriptPath));
entries[relativePath.slice(0, -extname(relativePath).length)] = scriptPath;
if (isComponentSpec && extension === '.js' && !hasRuntimeSelfRegistration(entryPath)) {
continue;
}
const relativePath = normalizePath(relative(sourceRoot, entryPath));
entries[extension === '.js' ? relativePath.slice(0, -extension.length) : relativePath] = entryPath;
if (isStyle) {
break;
} }
} }
}); });