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AW,WAC5B,SAAS,KAAK,WAAW,mBAAmB,GAAG,SAC/C,SAGD,OAAO,IAGT,MACM,EAAe,sHAAsH,OAD3H,EAAI,WAAW,QAAU,+BAEzC,EAAI,KAAK,EACX,CAAE,MAAO,GACP,OAAO,GACT,CACF,CAGA,UAAA,CAAW,EAAS,EAAO,GAQzB,IANG,GACD,KACE,EAAM,QAAkC,IAAxB,EAAM,OAAO,SAC/B,EAAM,QACN,EAAM,OAAO,OAAO,IAAW,EAAM,UAGrC,OAAO,KAAK,UAAU,EAAS,YAGjC,KAAK,UAAU,EAAS,OAAQ,EAAM,MAElC,EAAM,OAAO,OAAS,EACxB,KAAK,UAAU,EAAS,SAAU,EAAM,QAC/B,EAAM,SAAS,OAAS,EACjC,KAAK,UAAU,EAAS,WAAY,EAAM,UAE1C,KAAK,UAAU,EAAS,KAE5B,CAEA,MAAA,CAAO,GAIL,MAAM,IAAa,KAAK,aAAa,WAAc,EAC7C,EAC8B,iBAA3B,KAAK,aAAa,KACrB,KAAK,aAAa,UAClB,EAEA,EAAe,CACnB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,wBAAwB,EACxB,QAAS,KAAK,aAAa,QAC3B,aACA,YAGI,EAAU,SAAS,MAAM,EAAW,IAEV,IAA5B,KAAK,QAAQ,YACf,EAAQ,GAAG,UAAU,KACnB,KAAK,UAAU,KAAK,QAAS,kBAAkB,IAGnD,KAAK,oBAAoB,KAAK,EAChC,CAEA,UAAA,CAAW,GACL,KAAK,YACP,KAAK,WAAW,WAAW,EAE/B,EAMF,OAAO,wBAA0B,QAAQ,sBAEzC,OAAO,QAAU","file":"/npm/websked-webpack-dev-server@3.8.3/lib/Server.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/websked-webpack-dev-server@3.8.3/lib/Server.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\n/* eslint-disable\n  no-shadow,\n  no-undefined,\n  func-names\n*/\nconst fs = require('fs');\nconst path = require('path');\nconst tls = require('tls');\nconst url = require('url');\nconst http = require('http');\nconst https = require('https');\nconst ip = require('ip');\nconst semver = require('semver');\nconst killable = require('killable');\nconst chokidar = require('chokidar');\nconst express = require('express');\nconst httpProxyMiddleware = require('http-proxy-middleware');\nconst historyApiFallback = require('connect-history-api-fallback');\nconst compress = require('compression');\nconst serveIndex = require('serve-index');\nconst webpack = require('webpack');\nconst webpackDevMiddleware = require('webpack-dev-middleware');\nconst validateOptions = require('schema-utils');\nconst isAbsoluteUrl = require('is-absolute-url');\nconst normalizeOptions = require('./utils/normalizeOptions');\nconst updateCompiler = require('./utils/updateCompiler');\nconst createLogger = require('./utils/createLogger');\nconst getCertificate = require('./utils/getCertificate');\nconst status = require('./utils/status');\nconst createDomain = require('./utils/createDomain');\nconst runBonjour = require('./utils/runBonjour');\nconst routes = require('./utils/routes');\nconst getSocketServerImplementation = require('./utils/getSocketServerImplementation');\nconst schema = require('./options.json');\n\n// Workaround for node ^8.6.0, ^9.0.0\n// DEFAULT_ECDH_CURVE is default to prime256v1 in these version\n// breaking connection when certificate is not signed with prime256v1\n// change it to auto allows OpenSSL to select the curve automatically\n// See https://github.com/nodejs/node/issues/16196 for more information\nif (semver.satisfies(process.version, '8.6.0 - 9')) {\n  tls.DEFAULT_ECDH_CURVE = 'auto';\n}\n\nif (!process.env.WEBPACK_DEV_SERVER) {\n  process.env.WEBPACK_DEV_SERVER = true;\n}\n\nclass Server {\n  constructor(compiler, options = {}, _log) {\n    if (options.lazy && !options.filename) {\n      throw new Error(\"'filename' option must be set in lazy mode.\");\n    }\n\n    validateOptions(schema, options, 'webpack Dev Server');\n\n    this.compiler = compiler;\n    this.options = options;\n\n    this.log = _log || createLogger(options);\n\n    if (this.options.transportMode !== undefined) {\n      this.log.warn(\n        'transportMode is an experimental option, meaning its usage could potentially change without warning'\n      );\n    }\n\n    normalizeOptions(this.compiler, this.options);\n\n    updateCompiler(this.compiler, this.options);\n\n    // this.SocketServerImplementation is a class, so it must be instantiated before use\n    this.socketServerImplementation = getSocketServerImplementation(\n      this.options\n    );\n\n    this.originalStats =\n      this.options.stats && Object.keys(this.options.stats).length\n        ? this.options.stats\n        : {};\n\n    this.sockets = [];\n    this.contentBaseWatchers = [];\n\n    // TODO this.<property> is deprecated (remove them in next major release.) in favor this.options.<property>\n    this.hot = this.options.hot || this.options.hotOnly;\n    this.headers = this.options.headers;\n    this.progress = this.options.progress;\n\n    this.serveIndex = this.options.serveIndex;\n\n    this.clientOverlay = this.options.overlay;\n    this.clientLogLevel = this.options.clientLogLevel;\n\n    this.publicHost = this.options.public;\n    this.allowedHosts = this.options.allowedHosts;\n    this.disableHostCheck = !!this.options.disableHostCheck;\n\n    this.watchOptions = options.watchOptions || {};\n\n    // Replace leading and trailing slashes to normalize path\n    this.sockPath = `/${\n      this.options.sockPath\n        ? this.options.sockPath.replace(/^\\/|\\/$/g, '')\n        : 'sockjs-node'\n    }`;\n\n    if (this.progress) {\n      this.setupProgressPlugin();\n    }\n\n    this.setupHooks();\n    this.setupApp();\n    this.setupCheckHostRoute();\n    this.setupDevMiddleware();\n\n    // set express routes\n    routes(this.app, this.middleware, this.options);\n\n    // Keep track of websocket proxies for external websocket upgrade.\n    this.websocketProxies = [];\n\n    this.setupFeatures();\n    this.setupHttps();\n    this.createServer();\n\n    killable(this.listeningApp);\n\n    // Proxy websockets without the initial http request\n    // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade\n    this.websocketProxies.forEach(function(wsProxy) {\n      this.listeningApp.on('upgrade', wsProxy.upgrade);\n    }, this);\n  }\n\n  setupProgressPlugin() {\n    // for CLI output\n    new webpack.ProgressPlugin({\n      profile: !!this.options.profile,\n    }).apply(this.compiler);\n\n    // for browser console output\n    new webpack.ProgressPlugin((percent, msg, addInfo) => {\n      percent = Math.floor(percent * 100);\n\n      if (percent === 100) {\n        msg = 'Compilation completed';\n      }\n\n      if (addInfo) {\n        msg = `${msg} (${addInfo})`;\n      }\n\n      this.sockWrite(this.sockets, 'progress-update', { percent, msg });\n    }).apply(this.compiler);\n  }\n\n  setupApp() {\n    // Init express server\n    // eslint-disable-next-line new-cap\n    this.app = new express();\n  }\n\n  setupHooks() {\n    // Listening for events\n    const invalidPlugin = () => {\n      this.sockWrite(this.sockets, 'invalid');\n    };\n\n    const addHooks = (compiler) => {\n      const { compile, invalid, done } = compiler.hooks;\n\n      compile.tap('webpack-dev-server', invalidPlugin);\n      invalid.tap('webpack-dev-server', invalidPlugin);\n      done.tap('webpack-dev-server', (stats) => {\n        this._sendStats(this.sockets, this.getStats(stats));\n        this._stats = stats;\n      });\n    };\n\n    if (this.compiler.compilers) {\n      this.compiler.compilers.forEach(addHooks);\n    } else {\n      addHooks(this.compiler);\n    }\n  }\n\n  setupCheckHostRoute() {\n    this.app.all('*', (req, res, next) => {\n      if (this.checkHost(req.headers)) {\n        return next();\n      }\n\n      res.send('Invalid Host header');\n    });\n  }\n\n  setupDevMiddleware() {\n    // middleware for serving webpack bundle\n    this.middleware = webpackDevMiddleware(\n      this.compiler,\n      Object.assign({}, this.options, { logLevel: this.log.options.level })\n    );\n  }\n\n  setupCompressFeature() {\n    this.app.use(compress());\n  }\n\n  setupProxyFeature() {\n    /**\n     * Assume a proxy configuration specified as:\n     * proxy: {\n     *   'context': { options }\n     * }\n     * OR\n     * proxy: {\n     *   'context': 'target'\n     * }\n     */\n    if (!Array.isArray(this.options.proxy)) {\n      if (Object.prototype.hasOwnProperty.call(this.options.proxy, 'target')) {\n        this.options.proxy = [this.options.proxy];\n      } else {\n        this.options.proxy = Object.keys(this.options.proxy).map((context) => {\n          let proxyOptions;\n          // For backwards compatibility reasons.\n          const correctedContext = context\n            .replace(/^\\*$/, '**')\n            .replace(/\\/\\*$/, '');\n\n          if (typeof this.options.proxy[context] === 'string') {\n            proxyOptions = {\n              context: correctedContext,\n              target: this.options.proxy[context],\n            };\n          } else {\n            proxyOptions = Object.assign({}, this.options.proxy[context]);\n            proxyOptions.context = correctedContext;\n          }\n\n          proxyOptions.logLevel = proxyOptions.logLevel || 'warn';\n\n          return proxyOptions;\n        });\n      }\n    }\n\n    const getProxyMiddleware = (proxyConfig) => {\n      const context = proxyConfig.context || proxyConfig.path;\n\n      // It is possible to use the `bypass` method without a `target`.\n      // However, the proxy middleware has no use in this case, and will fail to instantiate.\n      if (proxyConfig.target) {\n        return httpProxyMiddleware(context, proxyConfig);\n      }\n    };\n    /**\n     * Assume a proxy configuration specified as:\n     * proxy: [\n     *   {\n     *     context: ...,\n     *     ...options...\n     *   },\n     *   // or:\n     *   function() {\n     *     return {\n     *       context: ...,\n     *       ...options...\n     *     };\n     *   }\n     * ]\n     */\n    this.options.proxy.forEach((proxyConfigOrCallback) => {\n      let proxyMiddleware;\n\n      let proxyConfig =\n        typeof proxyConfigOrCallback === 'function'\n          ? proxyConfigOrCallback()\n          : proxyConfigOrCallback;\n\n      proxyMiddleware = getProxyMiddleware(proxyConfig);\n\n      if (proxyConfig.ws) {\n        this.websocketProxies.push(proxyMiddleware);\n      }\n\n      this.app.use((req, res, next) => {\n        if (typeof proxyConfigOrCallback === 'function') {\n          const newProxyConfig = proxyConfigOrCallback();\n\n          if (newProxyConfig !== proxyConfig) {\n            proxyConfig = newProxyConfig;\n            proxyMiddleware = getProxyMiddleware(proxyConfig);\n          }\n        }\n\n        // - Check if we have a bypass function defined\n        // - In case the bypass function is defined we'll retrieve the\n        // bypassUrl from it otherwise bypassUrl would be null\n        const isByPassFuncDefined = typeof proxyConfig.bypass === 'function';\n        const bypassUrl = isByPassFuncDefined\n          ? proxyConfig.bypass(req, res, proxyConfig)\n          : null;\n\n        if (typeof bypassUrl === 'boolean') {\n          // skip the proxy\n          req.url = null;\n          next();\n        } else if (typeof bypassUrl === 'string') {\n          // byPass to that url\n          req.url = bypassUrl;\n          next();\n        } else if (proxyMiddleware) {\n          return proxyMiddleware(req, res, next);\n        } else {\n          next();\n        }\n      });\n    });\n  }\n\n  setupHistoryApiFallbackFeature() {\n    const fallback =\n      typeof this.options.historyApiFallback === 'object'\n        ? this.options.historyApiFallback\n        : null;\n\n    // Fall back to /index.html if nothing else matches.\n    this.app.use(historyApiFallback(fallback));\n  }\n\n  setupStaticFeature() {\n    const contentBase = this.options.contentBase;\n    const contentBasePublicPath = this.options.contentBasePublicPath;\n\n    if (Array.isArray(contentBase)) {\n      contentBase.forEach((item) => {\n        this.app.use(contentBasePublicPath, express.static(item));\n      });\n    } else if (isAbsoluteUrl(String(contentBase))) {\n      this.log.warn(\n        'Using a URL as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.'\n      );\n\n      this.log.warn(\n        'proxy: {\\n\\t\"*\": \"<your current contentBase configuration>\"\\n}'\n      );\n\n      // Redirect every request to contentBase\n      this.app.get('*', (req, res) => {\n        res.writeHead(302, {\n          Location: contentBase + req.path + (req._parsedUrl.search || ''),\n        });\n\n        res.end();\n      });\n    } else if (typeof contentBase === 'number') {\n      this.log.warn(\n        'Using a number as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.'\n      );\n\n      this.log.warn(\n        'proxy: {\\n\\t\"*\": \"//localhost:<your current contentBase configuration>\"\\n}'\n      );\n\n      // Redirect every request to the port contentBase\n      this.app.get('*', (req, res) => {\n        res.writeHead(302, {\n          Location: `//localhost:${contentBase}${req.path}${req._parsedUrl\n            .search || ''}`,\n        });\n\n        res.end();\n      });\n    } else {\n      // route content request\n      this.app.use(\n        contentBasePublicPath,\n        express.static(contentBase, this.options.staticOptions)\n      );\n    }\n  }\n\n  setupServeIndexFeature() {\n    const contentBase = this.options.contentBase;\n    const contentBasePublicPath = this.options.contentBasePublicPath;\n\n    if (Array.isArray(contentBase)) {\n      contentBase.forEach((item) => {\n        this.app.use(contentBasePublicPath, serveIndex(item));\n      });\n    } else if (\n      typeof contentBase !== 'number' &&\n      !isAbsoluteUrl(String(contentBase))\n    ) {\n      this.app.use(contentBasePublicPath, serveIndex(contentBase));\n    }\n  }\n\n  setupWatchStaticFeature() {\n    const contentBase = this.options.contentBase;\n\n    if (isAbsoluteUrl(String(contentBase)) || typeof contentBase === 'number') {\n      throw new Error('Watching remote files is not supported.');\n    } else if (Array.isArray(contentBase)) {\n      contentBase.forEach((item) => {\n        if (isAbsoluteUrl(String(item)) || typeof item === 'number') {\n          throw new Error('Watching remote files is not supported.');\n        }\n        this._watch(item);\n      });\n    } else {\n      this._watch(contentBase);\n    }\n  }\n\n  setupBeforeFeature() {\n    // Todo rename onBeforeSetupMiddleware in next major release\n    // Todo pass only `this` argument\n    this.options.before(this.app, this, this.compiler);\n  }\n\n  setupMiddleware() {\n    this.app.use(this.middleware);\n  }\n\n  setupAfterFeature() {\n    // Todo rename onAfterSetupMiddleware in next major release\n    // Todo pass only `this` argument\n    this.options.after(this.app, this, this.compiler);\n  }\n\n  setupHeadersFeature() {\n    this.app.all('*', this.setContentHeaders.bind(this));\n  }\n\n  setupMagicHtmlFeature() {\n    this.app.get('*', this.serveMagicHtml.bind(this));\n  }\n\n  setupSetupFeature() {\n    this.log.warn(\n      'The `setup` option is deprecated and will be removed in v4. Please update your config to use `before`'\n    );\n\n    this.options.setup(this.app, this);\n  }\n\n  setupFeatures() {\n    const features = {\n      compress: () => {\n        if (this.options.compress) {\n          this.setupCompressFeature();\n        }\n      },\n      proxy: () => {\n        if (this.options.proxy) {\n          this.setupProxyFeature();\n        }\n      },\n      historyApiFallback: () => {\n        if (this.options.historyApiFallback) {\n          this.setupHistoryApiFallbackFeature();\n        }\n      },\n      // Todo rename to `static` in future major release\n      contentBaseFiles: () => {\n        this.setupStaticFeature();\n      },\n      // Todo rename to `serveIndex` in future major release\n      contentBaseIndex: () => {\n        this.setupServeIndexFeature();\n      },\n      // Todo rename to `watchStatic` in future major release\n      watchContentBase: () => {\n        this.setupWatchStaticFeature();\n      },\n      before: () => {\n        if (typeof this.options.before === 'function') {\n          this.setupBeforeFeature();\n        }\n      },\n      middleware: () => {\n        // include our middleware to ensure\n        // it is able to handle '/index.html' request after redirect\n        this.setupMiddleware();\n      },\n      after: () => {\n        if (typeof this.options.after === 'function') {\n          this.setupAfterFeature();\n        }\n      },\n      headers: () => {\n        this.setupHeadersFeature();\n      },\n      magicHtml: () => {\n        this.setupMagicHtmlFeature();\n      },\n      setup: () => {\n        if (typeof this.options.setup === 'function') {\n          this.setupSetupFeature();\n        }\n      },\n    };\n\n    const runnableFeatures = [];\n\n    // compress is placed last and uses unshift so that it will be the first middleware used\n    if (this.options.compress) {\n      runnableFeatures.push('compress');\n    }\n\n    runnableFeatures.push('setup', 'before', 'headers', 'middleware');\n\n    if (this.options.proxy) {\n      runnableFeatures.push('proxy', 'middleware');\n    }\n\n    if (this.options.contentBase !== false) {\n      runnableFeatures.push('contentBaseFiles');\n    }\n\n    if (this.options.historyApiFallback) {\n      runnableFeatures.push('historyApiFallback', 'middleware');\n\n      if (this.options.contentBase !== false) {\n        runnableFeatures.push('contentBaseFiles');\n      }\n    }\n\n    // checking if it's set to true or not set (Default : undefined => true)\n    this.serveIndex = this.serveIndex || this.serveIndex === undefined;\n\n    if (this.options.contentBase && this.serveIndex) {\n      runnableFeatures.push('contentBaseIndex');\n    }\n\n    if (this.options.watchContentBase) {\n      runnableFeatures.push('watchContentBase');\n    }\n\n    runnableFeatures.push('magicHtml');\n\n    if (this.options.after) {\n      runnableFeatures.push('after');\n    }\n\n    (this.options.features || runnableFeatures).forEach((feature) => {\n      features[feature]();\n    });\n  }\n\n  setupHttps() {\n    // if the user enables http2, we can safely enable https\n    if (this.options.http2 && !this.options.https) {\n      this.options.https = true;\n    }\n\n    if (this.options.https) {\n      // for keep supporting CLI parameters\n      if (typeof this.options.https === 'boolean') {\n        this.options.https = {\n          ca: this.options.ca,\n          pfx: this.options.pfx,\n          key: this.options.key,\n          cert: this.options.cert,\n          passphrase: this.options.pfxPassphrase,\n          requestCert: this.options.requestCert || false,\n        };\n      }\n\n      for (const property of ['ca', 'pfx', 'key', 'cert']) {\n        const value = this.options.https[property];\n        const isBuffer = value instanceof Buffer;\n\n        if (value && !isBuffer) {\n          let stats = null;\n\n          try {\n            stats = fs.lstatSync(fs.realpathSync(value)).isFile();\n          } catch (error) {\n            // ignore error\n          }\n\n          // It is file\n          this.options.https[property] = stats\n            ? fs.readFileSync(path.resolve(value))\n            : value;\n        }\n      }\n\n      let fakeCert;\n\n      if (!this.options.https.key || !this.options.https.cert) {\n        fakeCert = getCertificate(this.log);\n      }\n\n      this.options.https.key = this.options.https.key || fakeCert;\n      this.options.https.cert = this.options.https.cert || fakeCert;\n\n      // note that options.spdy never existed. The user was able\n      // to set options.https.spdy before, though it was not in the\n      // docs. Keep options.https.spdy if the user sets it for\n      // backwards compatibility, but log a deprecation warning.\n      if (this.options.https.spdy) {\n        // for backwards compatibility: if options.https.spdy was passed in before,\n        // it was not altered in any way\n        this.log.warn(\n          'Providing custom spdy server options is deprecated and will be removed in the next major version.'\n        );\n      } else {\n        // if the normal https server gets this option, it will not affect it.\n        this.options.https.spdy = {\n          protocols: ['h2', 'http/1.1'],\n        };\n      }\n    }\n  }\n\n  createServer() {\n    if (this.options.https) {\n      // Only prevent HTTP/2 if http2 is explicitly set to false\n      const isHttp2 = this.options.http2 !== false;\n\n      // `spdy` is effectively unmaintained, and as a consequence of an\n      // implementation that extensively relies on Node’s non-public APIs, broken\n      // on Node 10 and above. In those cases, only https will be used for now.\n      // Once express supports Node's built-in HTTP/2 support, migrating over to\n      // that should be the best way to go.\n      // The relevant issues are:\n      // - https://github.com/nodejs/node/issues/21665\n      // - https://github.com/webpack/webpack-dev-server/issues/1449\n      // - https://github.com/expressjs/express/issues/3388\n      if (semver.gte(process.version, '10.0.0') || !isHttp2) {\n        if (this.options.http2) {\n          // the user explicitly requested http2 but is not getting it because\n          // of the node version.\n          this.log.warn(\n            'HTTP/2 is currently unsupported for Node 10.0.0 and above, but will be supported once Express supports it'\n          );\n        }\n        this.listeningApp = https.createServer(this.options.https, this.app);\n      } else {\n        // The relevant issues are:\n        // https://github.com/spdy-http2/node-spdy/issues/350\n        // https://github.com/webpack/webpack-dev-server/issues/1592\n        this.listeningApp = require('spdy').createServer(\n          this.options.https,\n          this.app\n        );\n      }\n    } else {\n      this.listeningApp = http.createServer(this.app);\n    }\n  }\n\n  createSocketServer() {\n    const SocketServerImplementation = this.socketServerImplementation;\n    this.socketServer = new SocketServerImplementation(this);\n\n    this.socketServer.onConnection((connection, headers) => {\n      if (!connection) {\n        return;\n      }\n\n      if (!headers) {\n        this.log.warn(\n          'transportMode.server implementation must pass headers to the callback of onConnection(f) ' +\n            'via f(connection, headers) in order for clients to pass a headers security check'\n        );\n      }\n\n      if (!headers || !this.checkHost(headers) || !this.checkOrigin(headers)) {\n        this.sockWrite([connection], 'error', 'Invalid Host/Origin header');\n\n        this.socketServer.close(connection);\n\n        return;\n      }\n\n      this.sockets.push(connection);\n\n      this.socketServer.onConnectionClose(connection, () => {\n        const idx = this.sockets.indexOf(connection);\n\n        if (idx >= 0) {\n          this.sockets.splice(idx, 1);\n        }\n      });\n\n      if (this.clientLogLevel) {\n        this.sockWrite([connection], 'log-level', this.clientLogLevel);\n      }\n\n      if (this.hot) {\n        this.sockWrite([connection], 'hot');\n      }\n\n      // TODO: change condition at major version\n      if (this.options.liveReload !== false) {\n        this.sockWrite([connection], 'liveReload', this.options.liveReload);\n      }\n\n      if (this.progress) {\n        this.sockWrite([connection], 'progress', this.progress);\n      }\n\n      if (this.clientOverlay) {\n        this.sockWrite([connection], 'overlay', this.clientOverlay);\n      }\n\n      if (!this._stats) {\n        return;\n      }\n\n      this._sendStats([connection], this.getStats(this._stats), true);\n    });\n  }\n\n  showStatus() {\n    const suffix =\n      this.options.inline !== false || this.options.lazy === true\n        ? '/'\n        : '/webpack-dev-server/';\n    const uri = `${createDomain(this.options, this.listeningApp)}${suffix}`;\n\n    status(\n      uri,\n      this.options,\n      this.log,\n      this.options.stats && this.options.stats.colors\n    );\n  }\n\n  listen(port, hostname, fn) {\n    this.hostname = hostname;\n\n    return this.listeningApp.listen(port, hostname, (err) => {\n      this.createSocketServer();\n\n      if (this.options.bonjour) {\n        runBonjour(this.options);\n      }\n\n      this.showStatus();\n\n      if (fn) {\n        fn.call(this.listeningApp, err);\n      }\n\n      if (typeof this.options.onListening === 'function') {\n        this.options.onListening(this);\n      }\n    });\n  }\n\n  close(cb) {\n    this.sockets.forEach((socket) => {\n      this.socketServer.close(socket);\n    });\n\n    this.sockets = [];\n\n    this.contentBaseWatchers.forEach((watcher) => {\n      watcher.close();\n    });\n\n    this.contentBaseWatchers = [];\n\n    this.listeningApp.kill(() => {\n      this.middleware.close(cb);\n    });\n  }\n\n  static get DEFAULT_STATS() {\n    return {\n      all: false,\n      hash: true,\n      assets: true,\n      warnings: true,\n      errors: true,\n      errorDetails: false,\n    };\n  }\n\n  getStats(statsObj) {\n    const stats = Server.DEFAULT_STATS;\n\n    if (this.originalStats.warningsFilter) {\n      stats.warningsFilter = this.originalStats.warningsFilter;\n    }\n\n    return statsObj.toJson(stats);\n  }\n\n  use() {\n    // eslint-disable-next-line\n    this.app.use.apply(this.app, arguments);\n  }\n\n  setContentHeaders(req, res, next) {\n    if (this.headers) {\n      // eslint-disable-next-line\n      for (const name in this.headers) {\n        res.setHeader(name, this.headers[name]);\n      }\n    }\n\n    next();\n  }\n\n  checkHost(headers) {\n    return this.checkHeaders(headers, 'host');\n  }\n\n  checkOrigin(headers) {\n    return this.checkHeaders(headers, 'origin');\n  }\n\n  checkHeaders(headers, headerToCheck) {\n    // allow user to opt-out this security check, at own risk\n    if (this.disableHostCheck) {\n      return true;\n    }\n\n    if (!headerToCheck) {\n      headerToCheck = 'host';\n    }\n\n    // get the Host header and extract hostname\n    // we don't care about port not matching\n    const hostHeader = headers[headerToCheck];\n\n    if (!hostHeader) {\n      return false;\n    }\n\n    // use the node url-parser to retrieve the hostname from the host-header.\n    const hostname = url.parse(\n      // if hostHeader doesn't have scheme, add // for parsing.\n      /^(.+:)?\\/\\//.test(hostHeader) ? hostHeader : `//${hostHeader}`,\n      false,\n      true\n    ).hostname;\n    // always allow requests with explicit IPv4 or IPv6-address.\n    // A note on IPv6 addresses:\n    // hostHeader will always contain the brackets denoting\n    // an IPv6-address in URLs,\n    // these are removed from the hostname in url.parse(),\n    // so we have the pure IPv6-address in hostname.\n    // always allow localhost host, for convenience (hostname === 'localhost')\n    // allow hostname of listening address  (hostname === this.hostname)\n    const isValidHostname =\n      ip.isV4Format(hostname) ||\n      ip.isV6Format(hostname) ||\n      hostname === 'localhost' ||\n      hostname === this.hostname;\n\n    if (isValidHostname) {\n      return true;\n    }\n    // always allow localhost host, for convenience\n    // allow if hostname is in allowedHosts\n    if (this.allowedHosts && this.allowedHosts.length) {\n      for (let hostIdx = 0; hostIdx < this.allowedHosts.length; hostIdx++) {\n        const allowedHost = this.allowedHosts[hostIdx];\n\n        if (allowedHost === hostname) {\n          return true;\n        }\n\n        // support \".\" as a subdomain wildcard\n        // e.g. \".example.com\" will allow \"example.com\", \"www.example.com\", \"subdomain.example.com\", etc\n        if (allowedHost[0] === '.') {\n          // \"example.com\"  (hostname === allowedHost.substring(1))\n          // \"*.example.com\"  (hostname.endsWith(allowedHost))\n          if (\n            hostname === allowedHost.substring(1) ||\n            hostname.endsWith(allowedHost)\n          ) {\n            return true;\n          }\n        }\n      }\n    }\n\n    // also allow public hostname if provided\n    if (typeof this.publicHost === 'string') {\n      const idxPublic = this.publicHost.indexOf(':');\n      const publicHostname =\n        idxPublic >= 0 ? this.publicHost.substr(0, idxPublic) : this.publicHost;\n\n      if (hostname === publicHostname) {\n        return true;\n      }\n    }\n\n    // disallow\n    return false;\n  }\n\n  // eslint-disable-next-line\n  sockWrite(sockets, type, data) {\n    sockets.forEach((socket) => {\n      this.socketServer.send(socket, JSON.stringify({ type, data }));\n    });\n  }\n\n  serveMagicHtml(req, res, next) {\n    const _path = req.path;\n\n    try {\n      const isFile = this.middleware.fileSystem\n        .statSync(this.middleware.getFilenameFromUrl(`${_path}.js`))\n        .isFile();\n\n      if (!isFile) {\n        return next();\n      }\n      // Serve a page that executes the javascript\n      const queries = req._parsedUrl.search || '';\n      const responsePage = `<!DOCTYPE html><html><head><meta charset=\"utf-8\"/></head><body><script type=\"text/javascript\" charset=\"utf-8\" src=\"${_path}.js${queries}\"></script></body></html>`;\n      res.send(responsePage);\n    } catch (err) {\n      return next();\n    }\n  }\n\n  // send stats to a socket or multiple sockets\n  _sendStats(sockets, stats, force) {\n    const shouldEmit =\n      !force &&\n      stats &&\n      (!stats.errors || stats.errors.length === 0) &&\n      stats.assets &&\n      stats.assets.every((asset) => !asset.emitted);\n\n    if (shouldEmit) {\n      return this.sockWrite(sockets, 'still-ok');\n    }\n\n    this.sockWrite(sockets, 'hash', stats.hash);\n\n    if (stats.errors.length > 0) {\n      this.sockWrite(sockets, 'errors', stats.errors);\n    } else if (stats.warnings.length > 0) {\n      this.sockWrite(sockets, 'warnings', stats.warnings);\n    } else {\n      this.sockWrite(sockets, 'ok');\n    }\n  }\n\n  _watch(watchPath) {\n    // duplicate the same massaging of options that watchpack performs\n    // https://github.com/webpack/watchpack/blob/master/lib/DirectoryWatcher.js#L49\n    // this isn't an elegant solution, but we'll improve it in the future\n    const usePolling = this.watchOptions.poll ? true : undefined;\n    const interval =\n      typeof this.watchOptions.poll === 'number'\n        ? this.watchOptions.poll\n        : undefined;\n\n    const watchOptions = {\n      ignoreInitial: true,\n      persistent: true,\n      followSymlinks: false,\n      atomic: false,\n      alwaysStat: true,\n      ignorePermissionErrors: true,\n      ignored: this.watchOptions.ignored,\n      usePolling,\n      interval,\n    };\n\n    const watcher = chokidar.watch(watchPath, watchOptions);\n    // disabling refreshing on changing the content\n    if (this.options.liveReload !== false) {\n      watcher.on('change', () => {\n        this.sockWrite(this.sockets, 'content-changed');\n      });\n    }\n    this.contentBaseWatchers.push(watcher);\n  }\n\n  invalidate(callback) {\n    if (this.middleware) {\n      this.middleware.invalidate(callback);\n    }\n  }\n}\n\n// Export this logic,\n// so that other implementations,\n// like task-runners can use it\nServer.addDevServerEntrypoints = require('./utils/addEntries');\n\nmodule.exports = Server;\n"]}