refactor: dedupe plugin string list helpers

This commit is contained in:
Peter Steinberger
2026-04-07 04:13:30 +01:00
parent 7dc085890e
commit 80a37ef32a
8 changed files with 80 additions and 76 deletions

View File

@@ -13,6 +13,16 @@ export function trimBundledPluginString(value: unknown): string | undefined {
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
}
export function normalizeBundledPluginStringList(value: unknown): string[] {
if (!Array.isArray(value)) {
return [];
}
return value.flatMap((entry) => {
const normalized = trimBundledPluginString(entry);
return normalized ? [normalized] : [];
});
}
export function rewriteBundledPluginEntryToBuiltPath(
entry: string | undefined,
): string | undefined {