mirror of
https://fastgit.cc/github.com/openclaw/openclaw
synced 2026-04-20 21:02:10 +08:00
refactor(whatsapp): rename lazy channel runtime seam
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
} from "openclaw/plugin-sdk/setup-runtime";
|
||||
import { whatsappSetupWizardContract } from "./src/setup-contract.js";
|
||||
|
||||
type WhatsAppRuntimeAssembly = typeof import("./src/channel-runtime.runtime.js");
|
||||
type WhatsAppRuntimeAssembly = typeof import("./src/channel.runtime.js");
|
||||
type WhatsAppSetupSurface = typeof import("./src/setup-surface.js");
|
||||
|
||||
export const whatsappAssembly = {
|
||||
@@ -103,7 +103,7 @@ let runtimeAssemblyPromise: Promise<WhatsAppRuntimeAssembly> | null = null;
|
||||
let setupSurfacePromise: Promise<WhatsAppSetupSurface> | null = null;
|
||||
|
||||
export function loadWhatsAppChannelRuntime(): Promise<WhatsAppRuntimeAssembly> {
|
||||
runtimeAssemblyPromise ??= import("./src/channel-runtime.runtime.js");
|
||||
runtimeAssemblyPromise ??= import("./src/channel.runtime.js");
|
||||
return runtimeAssemblyPromise;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("whatsapp bundled entries", () => {
|
||||
|
||||
expect(indexSource).toContain("defineWhatsAppBundledChannelEntry(import.meta.url)");
|
||||
expect(setupEntrySource).toContain("defineWhatsAppBundledChannelSetupEntry(import.meta.url)");
|
||||
expect(assemblySource).toContain('import("./src/channel-runtime.runtime.js")');
|
||||
expect(assemblySource).toContain('import("./src/channel.runtime.js")');
|
||||
expect(runtimeApiSource).toContain('from "./src/runtime-api.js"');
|
||||
expect(lightRuntimeApiSource).toContain('from "./src/light-runtime-api.js"');
|
||||
expect(entry.id).toBe(whatsappAssembly.id);
|
||||
|
||||
14
extensions/whatsapp/src/channel.runtime.ts
Normal file
14
extensions/whatsapp/src/channel.runtime.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// Keep the lazy channel runtime boundary separate from the public runtime-api
|
||||
// wrapper so production code does not mix static and dynamic imports of the
|
||||
// same module path.
|
||||
export { getActiveWebListener } from "./active-listener.js";
|
||||
export {
|
||||
getWebAuthAgeMs,
|
||||
logWebSelfId,
|
||||
logoutWeb,
|
||||
readWebSelfId,
|
||||
webAuthExists,
|
||||
} from "./auth-store.js";
|
||||
export { monitorWebChannel } from "./auto-reply/monitor.js";
|
||||
export { loginWeb } from "./login.js";
|
||||
export { startWebLoginWithQr, waitForWebLogin } from "../login-qr-runtime.js";
|
||||
Reference in New Issue
Block a user