




















@@ -89,6 +89,38 @@ function createBundledWhatsAppRuntimeFixture() {
8989return path.join(rootDir, "dist-runtime", "extensions", "whatsapp");
9090}
919192+function createExternalTypeScriptRuntimePackageFixture() {
93+const rootDir = makeTrackedTempDir("openclaw-external-boundary-ts", tempDirs);
94+writeRuntimeFixtureText(
95+rootDir,
96+"package.json",
97+JSON.stringify(
98+{
99+name: "openclaw-external-ts-runtime",
100+type: "module",
101+},
102+null,
103+2,
104+),
105+);
106+writeRuntimeFixtureText(
107+rootDir,
108+"runtime-api.ts",
109+[
110+'import { marker } from "./runtime-helper.js";',
111+"export const ok = true;",
112+"export const loadedVia = marker;",
113+"",
114+].join("\n"),
115+);
116+writeRuntimeFixtureText(
117+rootDir,
118+"runtime-helper.ts",
119+'export const marker = "jiti-source-package";\n',
120+);
121+return path.join(rootDir, "runtime-api.ts");
122+}
123+92124function loadWhatsAppBoundaryModules(runtimePluginDir: string) {
93125const loaders: PluginJitiLoaderCache = new Map();
94126return {
@@ -141,15 +173,15 @@ describe("runtime plugin boundary whatsapp seam", () => {
141173expect(loaders.size).toBe(0);
142174});
143175144-it("keeps TypeScript source fallback available for non-bundled plugins", () => {
145-const rootDir = makeTrackedTempDir("openclaw-external-boundary-ts", tempDirs);
146-const modulePath = path.join(rootDir, "runtime-api.ts");
147-writeRuntimeFixtureText(rootDir, "runtime-api.ts", "export const ok = true;\n");
176+it("keeps the Jiti TypeScript package fallback available for non-bundled plugins", () => {
177+const modulePath = createExternalTypeScriptRuntimePackageFixture();
148178const loaders: PluginJitiLoaderCache = new Map();
149179150180expect(
151-loadPluginBoundaryModule<{ ok: boolean }>(modulePath, loaders, { origin: "workspace" }),
152-).toMatchObject({ ok: true });
181+loadPluginBoundaryModule<{ ok: boolean; loadedVia: string }>(modulePath, loaders, {
182+origin: "workspace",
183+}),
184+).toMatchObject({ ok: true, loadedVia: "jiti-source-package" });
153185expect(loaders.size).toBe(1);
154186});
155187});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。