@@ -20,6 +20,7 @@ import type {
2020 runCommandWithTimeout as runCommandWithTimeoutRuntime ,
2121 runExec as runExecRuntime ,
2222} from "./process/exec.js" ;
23+ import { createLazyRuntimeModule } from "./shared/lazy-runtime.js" ;
2324import { normalizeE164 } from "./utils.js" ;
2425
2526type GetReplyFromConfig = typeof getReplyFromConfigRuntime ;
@@ -29,38 +30,13 @@ type RunExec = typeof runExecRuntime;
2930type RunCommandWithTimeout = typeof runCommandWithTimeoutRuntime ;
3031type MonitorWebChannel = typeof monitorWebChannelRuntime ;
3132
32- let replyRuntimePromise : Promise < typeof import ( "./auto-reply/reply.runtime.js" ) > | null = null ;
33- let promptRuntimePromise : Promise < typeof import ( "./cli/prompt.js" ) > | null = null ;
34- let binariesRuntimePromise : Promise < typeof import ( "./infra/binaries.js" ) > | null = null ;
35- let execRuntimePromise : Promise < typeof import ( "./process/exec.js" ) > | null = null ;
36- let webChannelRuntimePromise : Promise <
37- typeof import ( "./plugins/runtime/runtime-web-channel-plugin.js" )
38- > | null = null ;
39-
40- function loadReplyRuntime ( ) {
41- replyRuntimePromise ??= import ( "./auto-reply/reply.runtime.js" ) ;
42- return replyRuntimePromise ;
43- }
44-
45- function loadPromptRuntime ( ) {
46- promptRuntimePromise ??= import ( "./cli/prompt.js" ) ;
47- return promptRuntimePromise ;
48- }
49-
50- function loadBinariesRuntime ( ) {
51- binariesRuntimePromise ??= import ( "./infra/binaries.js" ) ;
52- return binariesRuntimePromise ;
53- }
54-
55- function loadExecRuntime ( ) {
56- execRuntimePromise ??= import ( "./process/exec.js" ) ;
57- return execRuntimePromise ;
58- }
59-
60- function loadWebChannelRuntime ( ) {
61- webChannelRuntimePromise ??= import ( "./plugins/runtime/runtime-web-channel-plugin.js" ) ;
62- return webChannelRuntimePromise ;
63- }
33+ const loadReplyRuntime = createLazyRuntimeModule ( ( ) => import ( "./auto-reply/reply.runtime.js" ) ) ;
34+ const loadPromptRuntime = createLazyRuntimeModule ( ( ) => import ( "./cli/prompt.js" ) ) ;
35+ const loadBinariesRuntime = createLazyRuntimeModule ( ( ) => import ( "./infra/binaries.js" ) ) ;
36+ const loadExecRuntime = createLazyRuntimeModule ( ( ) => import ( "./process/exec.js" ) ) ;
37+ const loadWebChannelRuntime = createLazyRuntimeModule (
38+ ( ) => import ( "./plugins/runtime/runtime-web-channel-plugin.js" ) ,
39+ ) ;
6440
6541export const getReplyFromConfig : GetReplyFromConfig = async ( ...args ) =>
6642 ( await loadReplyRuntime ( ) ) . getReplyFromConfig ( ...args ) ;
0 commit comments