mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:10:58 +00:00
fix(telegram): stabilize topic dispatch runtime
This commit is contained in:
@@ -227,6 +227,38 @@ describe("runtime postbuild static assets", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("rewrites reply-dispatch imports to the stable provider dispatcher runtime alias", async () => {
|
||||
const rootDir = createTempDir("openclaw-runtime-postbuild-");
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
await fs.mkdir(distDir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(distDir, "provider-dispatcher.runtime-NewHash.js"),
|
||||
'export * from "./provider-dispatcher-ImplHash.js";\n',
|
||||
"utf8",
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(distDir, "reply-dispatch-runtime-OldHash.js"),
|
||||
['const dispatcher = () => import("./provider-dispatcher.runtime-NewHash.js");', ""].join(
|
||||
"\n",
|
||||
),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
rewriteRootRuntimeImportsToStableAliases({ rootDir });
|
||||
writeStableRootRuntimeAliases({ rootDir });
|
||||
writeLegacyRootRuntimeCompatAliases({ rootDir });
|
||||
|
||||
expect(await fs.readFile(path.join(distDir, "reply-dispatch-runtime-OldHash.js"), "utf8")).toBe(
|
||||
['const dispatcher = () => import("./provider-dispatcher.runtime.js");', ""].join("\n"),
|
||||
);
|
||||
expect(await fs.readFile(path.join(distDir, "provider-dispatcher.runtime.js"), "utf8")).toBe(
|
||||
'export * from "./provider-dispatcher.runtime-NewHash.js";\n',
|
||||
);
|
||||
expect(await fs.readFile(path.join(distDir, "provider-dispatcher-6EQEtc-t.js"), "utf8")).toBe(
|
||||
'export * from "./provider-dispatcher.runtime.js";\n',
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps hashed imports when a stable runtime alias would collide", async () => {
|
||||
const rootDir = createTempDir("openclaw-runtime-postbuild-");
|
||||
const distDir = path.join(rootDir, "dist");
|
||||
@@ -294,8 +326,8 @@ describe("runtime postbuild static assets", () => {
|
||||
"utf8",
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(distDir, "provider-dispatcher.js"),
|
||||
'export * from "./provider-dispatcher-NewHash.js";\n',
|
||||
path.join(distDir, "provider-dispatcher.runtime.js"),
|
||||
'export * from "./provider-dispatcher.runtime-NewHash.js";\n',
|
||||
"utf8",
|
||||
);
|
||||
|
||||
@@ -308,7 +340,7 @@ describe("runtime postbuild static assets", () => {
|
||||
await fs.readFile(path.join(distDir, "runtime-plugins.runtime-CNAfmQRG.js"), "utf8"),
|
||||
).toBe('export * from "./runtime-plugins.runtime.js";\n');
|
||||
expect(await fs.readFile(path.join(distDir, "provider-dispatcher-6EQEtc-t.js"), "utf8")).toBe(
|
||||
'export * from "./provider-dispatcher.js";\n',
|
||||
'export * from "./provider-dispatcher.runtime.js";\n',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user