@@ -18,6 +18,7 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
1818 async open ( context , options ) {
1919 this . make = context . messageMaker ( pluginname ) . make ;
2020 this . harAnalyzer = new HarAnalyzer ( ) ;
21+ this . isWebperfCorePluginPresent = false ;
2122 const libFolder = fileURLToPath ( new URL ( '..' , import . meta. url ) ) ;
2223 this . pluginFolder = path . resolve ( libFolder ) ;
2324 this . options = options ;
@@ -32,8 +33,11 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
3233 // const filterRegistry = this.filterRegistry;
3334 switch ( message . type ) {
3435 case 'sitespeedio.setup' : {
35- // Let other plugins know that the pagenotfound plugin is alive
36- // queue.postMessage(this.make(pluginname + '.setup'));
36+ // Let other plugins know that our plugin is alive
37+ queue . postMessage ( this . make ( pluginname + '.setup' , {
38+ 'version' : this . version ,
39+ 'dependencies' : this . dependencies
40+ } ) ) ;
3741 // Add the HTML pugs
3842 queue . postMessage (
3943 this . make ( 'html.pug' , {
@@ -53,24 +57,40 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
5357 ) ;
5458 break ;
5559 }
60+ case 'plugin-webperf-core.setup' : {
61+ this . isWebperfCorePluginPresent = true ;
62+ break ;
63+ }
5664 case 'browsertime.har' : {
5765 const url = message . url ;
5866 const group = message . group ;
5967 const harData = message . data ;
6068 var data = await this . harAnalyzer . analyzeData ( url , harData , group ) ;
61-
62- super . sendMessage (
63- // The HTML plugin will pickup every message names *.pageSummary
64- // and publish the data under pageInfo.data.*.pageSummary
65- // in this case pageInfo.data.gpsi.pageSummary
66- pluginname + '.pageSummary' ,
67- data ,
68- {
69- url,
70- group
71- }
72- ) ;
7369
70+ if ( this . isWebperfCorePluginPresent ) {
71+ super . sendMessage (
72+ // The WebPerf plugin will pickup every message names *.webPerfCoreSummary
73+ // and publish the data under pageInfo.data.*.pageSummary
74+ pluginname + '.webPerfCoreSummary' ,
75+ data ,
76+ {
77+ url,
78+ group
79+ }
80+ ) ;
81+ } else {
82+ super . sendMessage (
83+ // The HTML plugin will pickup every message names *.pageSummary
84+ // and publish the data under pageInfo.data.*.pageSummary
85+ // in this case pageInfo.data.gpsi.pageSummary
86+ pluginname + '.pageSummary' ,
87+ data ,
88+ {
89+ url,
90+ group
91+ }
92+ ) ;
93+ }
7494 break ;
7595 }
7696 case 'sitespeedio.summarize' : {
0 commit comments