@@ -23,9 +23,12 @@ interface Watcher {
2323 directory : string ;
2424 sockets : Socket [ ] ;
2525 options : Options ;
26+ themeHost : string ;
2627}
2728
28- function setupFileWatcher ( { directory, sockets, options } : Watcher ) {
29+ function setupFileWatcher ( {
30+ directory, sockets, options, themeHost,
31+ } : Watcher ) {
2932 chokidar . watch ( directory ) . on ( 'all' , ( fileEvent : string , filePath : string ) => {
3033 // We only care about change events
3134 if ( fileEvent !== 'change' ) { return ; }
@@ -38,15 +41,15 @@ function setupFileWatcher({ directory, sockets, options }: Watcher) {
3841 case WidgetFileType . CONFIGURATION :
3942 case WidgetFileType . QUERY :
4043 liveReload ( {
41- directory, sockets, fileEvent, filePath, options,
44+ directory, sockets, fileEvent, filePath, options, themeHost ,
4245 } ) ;
4346 break ;
4447
4548 case WidgetFileType . QUERY_PARAMS_BUILDER :
4649 validateQueryParamsBuilder ( directory ) ;
4750
4851 liveReload ( {
49- directory, sockets, fileEvent, filePath, options,
52+ directory, sockets, fileEvent, filePath, options, themeHost ,
5053 } ) ;
5154 break ;
5255
@@ -57,7 +60,7 @@ function setupFileWatcher({ directory, sockets, options }: Watcher) {
5760 generateConfig ( directory ) ;
5861
5962 liveReload ( {
60- directory, sockets, fileEvent, filePath, options,
63+ directory, sockets, fileEvent, filePath, options, themeHost ,
6164 } ) ;
6265
6366 break ;
@@ -71,7 +74,7 @@ function setupFileWatcher({ directory, sockets, options }: Watcher) {
7174 } ) ;
7275}
7376
74- export default function startWidgetBuilder ( directory : string , options : Options ) {
77+ export default function startWidgetBuilder ( directory : string , options : Options , themeHost : string ) {
7578 const app = express ( ) ;
7679 app . use ( express . static ( path . join ( __dirname , '../' , 'client' ) ) ) ;
7780
@@ -102,6 +105,7 @@ export default function startWidgetBuilder(directory: string, options: Options)
102105 event : 'initialize' ,
103106 html,
104107 path : '' ,
108+ themeHost,
105109 } ,
106110 } ) ;
107111 } )
@@ -132,5 +136,6 @@ export default function startWidgetBuilder(directory: string, options: Options)
132136 directory,
133137 sockets,
134138 options,
139+ themeHost,
135140 } ) ;
136141}
0 commit comments