@@ -358,44 +358,48 @@ async function probeFrontendPlugins(plugins, port, pluginsRoot) {
358358 return failAll ( "invalid probe response" ) ;
359359 }
360360
361- const results = [ ] ;
362- for ( const fp of frontendPlugins ) {
363- const loaded = body . find (
364- ( lp ) => lp && typeof lp === "object" && lp . name === fp . pkgName ,
365- ) ;
366-
361+ const toFrontendProbeResult = ( fp , loaded ) => {
367362 if ( ! loaded ) {
368- results . push ( {
363+ return {
369364 pkgName : fp . pkgName ,
370365 role : fp . role ,
371366 pluginPath : fp . pluginPath ,
372367 status : "fail-load" ,
373368 detail : "not found in loaded plugins list" ,
374- } ) ;
375- } else if ( loaded . platform !== "web" ) {
376- results . push ( {
369+ } ;
370+ }
371+ if ( loaded . platform !== "web" ) {
372+ return {
377373 pkgName : fp . pkgName ,
378374 role : fp . role ,
379375 pluginPath : fp . pluginPath ,
380376 status : "fail-load" ,
381377 detail : `unexpected platform: ${ loaded . platform } ` ,
382- } ) ;
383- } else if ( loaded . failure ) {
384- results . push ( {
378+ } ;
379+ }
380+ if ( loaded . failure ) {
381+ return {
385382 pkgName : fp . pkgName ,
386383 role : fp . role ,
387384 pluginPath : fp . pluginPath ,
388385 status : "fail-load" ,
389386 detail : `plugin loaded with failure: ${ loaded . failure } ` ,
390- } ) ;
391- } else {
392- results . push ( {
393- pkgName : fp . pkgName ,
394- role : fp . role ,
395- pluginPath : fp . pluginPath ,
396- status : "pass" ,
397- } ) ;
387+ } ;
398388 }
389+ return {
390+ pkgName : fp . pkgName ,
391+ role : fp . role ,
392+ pluginPath : fp . pluginPath ,
393+ status : "pass" ,
394+ } ;
395+ } ;
396+
397+ const results = [ ] ;
398+ for ( const fp of frontendPlugins ) {
399+ const loaded = body . find (
400+ ( lp ) => lp && typeof lp === "object" && lp . name === fp . pkgName ,
401+ ) ;
402+ results . push ( toFrontendProbeResult ( fp , loaded ) ) ;
399403 }
400404 return results ;
401405}
0 commit comments