(options)
| 59 | } |
| 60 | |
| 61 | setupMiddleware(options) { |
| 62 | const tinylr = require('tiny-lr'); |
| 63 | const Server = tinylr.Server; |
| 64 | |
| 65 | if (options.liveReloadPrefix) { |
| 66 | this.liveReloadPrefix = cleanBaseUrl(options.liveReloadPrefix); |
| 67 | } |
| 68 | |
| 69 | if (options.liveReload) { |
| 70 | if (options.liveReloadPort && options.port !== options.liveReloadPort) { |
| 71 | return this.createServerforCustomPort(options, Server).catch((error) => { |
| 72 | if (error !== null && typeof error === 'object' && error.code === 'EADDRINUSE') { |
| 73 | let url = `http${options.ssl ? 's' : ''}://${this.displayHost(options.liveReloadHost)}:${ |
| 74 | options.liveReloadPort |
| 75 | }`; |
| 76 | throw new SilentError(`${error.message}\nLivereload failed on '${url}', It may be in use.`); |
| 77 | } else { |
| 78 | throw error; |
| 79 | } |
| 80 | }); |
| 81 | } else { |
| 82 | this.liveReloadServer = this.createServer(options, Server); |
| 83 | } |
| 84 | this.start(); |
| 85 | } else { |
| 86 | this.ui.writeWarnLine('Livereload server manually disabled.'); |
| 87 | } |
| 88 | return Promise.resolve(); |
| 89 | } |
| 90 | |
| 91 | start() { |
| 92 | this.tree = FSTree.fromEntries([]); |
nothing calls this directly
no test coverage detected