@@ -18,6 +18,7 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
18
18
async open ( context , options ) {
19
19
this . make = context . messageMaker ( pluginname ) . make ;
20
20
this . harAnalyzer = new HarAnalyzer ( ) ;
21
+ this . isWebperfCorePluginPresent = false ;
21
22
const libFolder = fileURLToPath ( new URL ( '..' , import . meta. url ) ) ;
22
23
this . pluginFolder = path . resolve ( libFolder ) ;
23
24
this . options = options ;
@@ -32,8 +33,11 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
32
33
// const filterRegistry = this.filterRegistry;
33
34
switch ( message . type ) {
34
35
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
+ } ) ) ;
37
41
// Add the HTML pugs
38
42
queue . postMessage (
39
43
this . make ( 'html.pug' , {
@@ -53,24 +57,40 @@ export default class JavascriptPlugin extends SitespeedioPlugin {
53
57
) ;
54
58
break ;
55
59
}
60
+ case 'plugin-webperf-core.setup' : {
61
+ this . isWebperfCorePluginPresent = true ;
62
+ break ;
63
+ }
56
64
case 'browsertime.har' : {
57
65
const url = message . url ;
58
66
const group = message . group ;
59
67
const harData = message . data ;
60
68
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
- ) ;
73
69
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
+ }
74
94
break ;
75
95
}
76
96
case 'sitespeedio.summarize' : {
0 commit comments