Let a plugin carry its own package.json and npm dependencies
CI / full-gate (push) Successful in 2m53s

This commit is contained in:
lilleman
2026-08-17 22:23:53 +02:00
parent 1ba6dbdc51
commit fee4fe632b
30 changed files with 173 additions and 66 deletions
+9
View File
@@ -5,6 +5,15 @@ import assert from "node:assert/strict";
import test from "node:test";
import * as api from "./plugin-api.ts";
// A plugin with its own package.json reaches the barrel only as a package; a second copy landing
// there would fail every `instanceof GuardError` a handler makes.
test("the barrel resolves by package name to this same module", async () => {
const asPackage = await import("@plainpages/plugin-api");
assert.equal(asPackage.GuardError, api.GuardError);
assert.equal(asPackage.definePlugin, api.definePlugin);
});
test("plugin-api re-exports the stable author value surface", () => {
for (const name of ["definePlugin", "can", "check", "GuardError", "requireSession", "parseListQuery", "readFormBody", "CSRF_FIELD", "tracedFetch", "Log", "safeUrl"]) {
assert.ok(name in api && api[name as keyof typeof api] !== undefined, `missing export: ${name}`);