perf(plugins): lazy-load setup surfaces

This commit is contained in:
Peter Steinberger
2026-03-15 18:46:22 -07:00
parent de6666b895
commit fb991e6f31
30 changed files with 443 additions and 16 deletions

View File

@@ -23,6 +23,15 @@ export function rewritePackageExtensions(entries) {
});
}
function rewritePackageEntry(entry) {
if (typeof entry !== "string" || entry.trim().length === 0) {
return undefined;
}
const normalized = entry.replace(/^\.\//, "");
const rewritten = normalized.replace(/\.[^.]+$/u, ".js");
return `./${rewritten}`;
}
function ensurePathInsideRoot(rootDir, rawPath) {
const resolved = path.resolve(rootDir, rawPath);
const relative = path.relative(rootDir, resolved);
@@ -176,6 +185,9 @@ export function copyBundledPluginMetadata(params = {}) {
packageJson.openclaw = {
...packageJson.openclaw,
extensions: rewritePackageExtensions(packageJson.openclaw.extensions),
...(typeof packageJson.openclaw.setupEntry === "string"
? { setupEntry: rewritePackageEntry(packageJson.openclaw.setupEntry) }
: {}),
};
}