@@ -40,25 +40,33 @@ async function loadPlugins({
4040 import ( "./generated/plugin_greet/transpiled/plugin_greet.js" ) ,
4141 import ( "./generated/plugin_ls/transpiled/plugin_ls.js" ) ,
4242 import ( "./generated/plugin_cat/transpiled/plugin_cat.js" ) ,
43- ] ) . then ( ( plugins ) => plugins . map ( ( plugin ) => plugin . plugin ) ) ;
44-
45- // log the plugins names
46- const pluginsNames = plugins . map ( ( plugin ) => plugin . name ( ) ) ;
47- for ( const pluginName of pluginsNames ) {
48- addReplHistoryEntry ( {
49- stdin : `[Host] Loading plugin: ${ pluginName } ` ,
50- } ) ;
51- }
43+ ] ) . then ( ( plugins ) =>
44+ plugins . map ( ( plugin ) => {
45+ addReplHistoryEntry ( {
46+ stdin : `[Host] Loaded plugin: ${ plugin . plugin . name ( ) } ` ,
47+ } ) ;
48+ return plugin . plugin ;
49+ } ) ,
50+ ) ;
5251
5352 // set the plugins names in the host state
53+ const pluginsNames = plugins . map ( ( plugin ) => plugin . name ( ) ) ;
5454 hostStateSetPluginsNames ( pluginsNames ) ;
5555
5656 // return the plugins instances
5757 return plugins ;
5858}
5959
60- async function loadReplLogicGuest ( ) : Promise < HostApi > {
61- return import ( "./generated/repl_logic_guest/transpiled/repl_logic_guest.js" ) ;
60+ async function loadReplLogicGuest ( {
61+ addReplHistoryEntry,
62+ } : AddReplHistoryEntryProp ) : Promise < HostApi > {
63+ const replLogicGuest = await import (
64+ "./generated/repl_logic_guest/transpiled/repl_logic_guest.js"
65+ ) ;
66+ addReplHistoryEntry ( {
67+ stdin : `[Host] Loaded REPL logic` ,
68+ } ) ;
69+ return replLogicGuest ;
6270}
6371
6472export async function prepareEngine ( {
@@ -75,9 +83,8 @@ export async function prepareEngine({
7583 return ;
7684 }
7785 addReplHistoryEntry ( { stdin : `[Host] Starting REPL host...` } ) ;
78- addReplHistoryEntry ( { stdin : `[Host] Loading REPL logic` } ) ;
7986 const [ replLogicGuest , plugins ] = await Promise . all ( [
80- loadReplLogicGuest ( ) ,
87+ loadReplLogicGuest ( { addReplHistoryEntry } ) ,
8188 loadPlugins ( { addReplHistoryEntry } ) ,
8289 ] ) ;
8390 const engine = makeEngine ( ) ;
0 commit comments