@polylith/builder 0.2.19 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/App.js +22 -5
  2. package/package.json +1 -1
package/App.js CHANGED
@@ -204,6 +204,23 @@ export default class App {
204
204
  return './' + path;
205
205
  }
206
206
 
207
+ /**
208
+ * Call this method with to set specific options for live reload
209
+ *
210
+ * @param {Object} on set to true to turn on destination watching
211
+ * @property {Number} port set this to a port for as livereload port,
212
+ * defaults to 35800
213
+ * @property {("http"|"https")} protocol the protocol to use for the
214
+ * livereload websocket. default to 'http'
215
+ * @property hostname the hostname for the livereload websocket. defaults to
216
+ * 'localhost;
217
+ * @property {Object} https if this has a value, it will be set as the http
218
+ * value in the livereload options
219
+ */
220
+ setLiveReloadOptions(options) {
221
+ this.liveReloadOptions = options;
222
+ }
223
+
207
224
  /**
208
225
  * Call this method with true to reload the browser when any files in the
209
226
  * destination folder have changed.
@@ -721,11 +738,11 @@ export default class App {
721
738
 
722
739
  // rollup-plugin-livereload always bases the protocol on the
723
740
  // webpage url. This is bad, here we override it
724
- if (typeof livereload === 'object') {
725
- let port = this.liveReload.port || 35800;
726
- let protocol = this.liveReload.https ? 'https' : 'http';
727
- let hostname = liveReload.hostname ? liveReload.hostname : 'localhost';
728
- let https = liveReload.https ? liveReload.https : null;
741
+ if (this.liveReloadOptions) {
742
+ let port = this.liveReloadOptions.port || 35800;
743
+ let protocol = this.liveReloadOptions.protocol || 'http';
744
+ let hostname = this.liveReloadOptions.hostname || 'localhost';
745
+ let https = this.liveReloadOptions.https || null;
729
746
  let url = `${protocol}://${hostname}:${port}/livereload.js?snipver=1&port=${port}`;
730
747
 
731
748
  plugin = livereload({watch: this.destPath, https: https, clientUrl: url, port: port})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polylith/builder",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "The polylith builder",
5
5
  "main": "index.js",
6
6
  "type": "module",