Refuse a shadowing barrel copy, and record the packaging contract
CI / full-gate (push) Successful in 2m45s

This commit is contained in:
lilleman
2026-08-17 22:34:56 +02:00
parent fee4fe632b
commit 616040fda6
7 changed files with 46 additions and 14 deletions
+7 -2
View File
@@ -89,9 +89,14 @@ function pluginFolders(dir: string): string[] {
.sort();
}
// Without a `type`, which npm never writes, the plugin's own package.json leaves its folder
// CommonJS: a .js helper breaks outright and every .ts costs a re-parse.
// The two ways a plugin's own packaging breaks it. A barrel copy resolves before the host's, and its
// GuardError matches no `instanceof` here — the sign-in redirect silently becomes a 500. Without a
// `type`, which npm never writes, the folder is left CommonJS: a .js helper breaks, every .ts re-parses.
function packagingError(folder: string): string | null {
if (existsSync(join(folder, "node_modules", "@plainpages", "plugin-api"))) {
return "ships its own copy of @plainpages/plugin-api — remove it; the host provides the one instance";
}
const file = join(folder, "package.json");
if (!existsSync(file)) return null;