@@ -13,28 +13,22 @@ export type ReplayScriptSourceRequest = {
1313 env ?: Readonly < Record < string , string > > ;
1414} ;
1515
16- export function loadReplayScriptSourceBundle (
16+ export async function loadReplayScriptSourceBundle (
1717 params : ReplayScriptSourceRequest ,
18- ) : ReplayScriptSourceBundle | Promise < ReplayScriptSourceBundle > {
19- try {
20- const entry = resolveUserPath ( params . inputPath , { cwd : params . cwd } ) ;
21- const entrySource = readReplayEntryScript ( entry , params . inputPath ) ;
22- if ( resolveReplayFormat ( entry , params . replayBackend ) !== 'maestro' ) {
23- return finishBundle ( entry , { [ entry ] : entrySource } , params . inputPath ) ;
24- }
25- return ( async ( ) => {
26- const { collectMaestroFlowSources } = await import ( '@agent-device/maestro' ) ;
27- const files = collectMaestroFlowSources ( {
28- entryPath : entry ,
29- entrySource,
30- env : params . env ,
31- readSource : tryReadScriptFile ,
32- } ) ;
33- return finishBundle ( entry , files , params . inputPath ) ;
34- } ) ( ) ;
35- } catch ( error ) {
36- return Promise . reject ( error ) ;
18+ ) : Promise < ReplayScriptSourceBundle > {
19+ const entry = resolveUserPath ( params . inputPath , { cwd : params . cwd } ) ;
20+ const entrySource = readReplayEntryScript ( entry , params . inputPath ) ;
21+ if ( resolveReplayFormat ( entry , params . replayBackend ) !== 'maestro' ) {
22+ return finishBundle ( entry , { [ entry ] : entrySource } , params . inputPath ) ;
3723 }
24+ const { collectMaestroFlowSources } = await import ( '@agent-device/maestro' ) ;
25+ const files = collectMaestroFlowSources ( {
26+ entryPath : entry ,
27+ entrySource,
28+ env : params . env ,
29+ readSource : tryReadScriptFile ,
30+ } ) ;
31+ return finishBundle ( entry , files , params . inputPath ) ;
3832}
3933
4034function finishBundle (
0 commit comments