fix(plugin): preserve sdk alias fallback for native loads

This commit is contained in:
Vincent Koc
2026-05-03 23:24:57 -07:00
parent 6e8cdd7d59
commit baecb6b4d6
6 changed files with 33 additions and 12 deletions

View File

@@ -64,6 +64,19 @@ describe("tryNativeRequireJavaScriptModule", () => {
);
});
it("declines missing dependency errors when source-transform fallback is available", () => {
const dir = makeTempDir();
const modulePath = path.join(dir, "plugin.cjs");
fs.writeFileSync(modulePath, 'require("openclaw/plugin-sdk");\n', "utf8");
expect(
tryNativeRequireJavaScriptModule(modulePath, {
allowWindows: true,
fallbackOnMissingDependency: true,
}),
).toEqual({ ok: false });
});
it("propagates real module evaluation errors instead of falling back", () => {
const dir = makeTempDir();
const modulePath = path.join(dir, "plugin.cjs");