{"bin":{"es-dev-server":"dist/cli.js"},"bugs":{"url":"https://github.com/open-wc/open-wc/issues"},"dist":{"shasum":"afd03a23cbd537affea0082ef4535022b60aaa5d","tarball":"https://registry.npmjs.org/es-dev-server/-/es-dev-server-1.37.0-alpha.1.tgz","fileCount":62,"integrity":"sha512-ccDpl8baSEFo9Xj2xyG361HD/wmD4WFtyoArBihRJhyS/wXa7tCeRFQX3WaAbiRxSvlkn9au/pMeO6EMh8iH0g==","signatures":[{"sig":"MEQCIEOiXzD21UY6Lija7JC+Jbu96ApUKgLC6wE+FmW5gBy6AiBfTZ9AipVJMiTXXbOPZ5kE4Ne9cMAyGDn+rD7rLWrfqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":249571,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeLcUZCRA9TVsSAnZWagAA7+MP+wR9zshhJbBMpQ5M+Ox5\n77Q5sSg17MhkSoI7vB4M9FbzFq6DX9sQuBKEondBmD4jseXd1h3pL2TwCS9V\nXh1BT1j88ROGgs33J1M7D48xZikB/twTqRvr6A3u1GKJvJzK8e+7TFDXf7lB\nD8ASG8XoV3aZe4tgMJApmYb1YJZCKTphTcyPLO/fZZcPC9/7N/E+Jx+M4G2x\nIM36v84vzlBydjOuUNmszFJHZF321gHwn4VJLTyB0FU35UwVTbknqrvNsLKM\nXzrR7UKw9a9zWewBKXCn6IjFYavGGCytwgd9QklFtrONfSINevQnCHUENO20\n8mHC3jAELnFgnhLPLqpUPaP5CRr9/GGJjXMVPhWKpWMovcz5An9IrG69kMvT\n6bgq5HE8f7btTUPvcerEMHz5YQq2Pvl3O94DQvAMUpzz6y2RQaUa3QKVOMzH\nBc3nN/E24LwO9wip2YVgoYvaLRo8o6rQzZdHAiiM7YzgVF/HcHgXC1VzL6yV\n9wUOA6XH+STEMAYshwbg+PdiKwEcMtSqEgxUt/iFD6MCP1cNNK/ZQ5tBHHqA\nxxP/VexsE6WqNn/diBkrCcyiHkkYT6J+sRl76jMPHp1Hn3SB1Qh/AakigN70\nNA77U30ctSnMjasaIVsHGeUl55FrtFW8IHqUA3xOtyg4tpx2R1BSzANGA1ih\nep0e\r\n=taI6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./dist/es-dev-server.js","name":"es-dev-server","author":{"name":"open-wc"},"readme":"# ES dev server\n\n> Part of [Open Web Components](https://github.com/open-wc/open-wc/)\n\nOpen Web Components provides a set of defaults, recommendations and tools to help facilitate your web component project. Our recommendations include: developing, linting, testing, building, tooling, demoing, publishing and automating.\n\n[![CircleCI](https://circleci.com/gh/open-wc/open-wc.svg?style=shield)](https://circleci.com/gh/open-wc/open-wc)\n[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=M2UrSFVRang2OWNuZXlWSlhVc3FUVlJtTDkxMnp6eGFDb2pNakl4bGxnbz0tLUE5RjhCU0NUT1ZWa0NuQ3MySFFWWnc9PQ==--86f7fac07cdbd01dd2b26ae84dc6c8ca49e45b50)](https://www.browserstack.com/automate/public-build/M2UrSFVRang2OWNuZXlWSlhVc3FUVlJtTDkxMnp6eGFDb2pNakl4bGxnbz0tLUE5RjhCU0NUT1ZWa0NuQ3MySFFWWnc9PQ==--86f7fac07cdbd01dd2b26ae84dc6c8ca49e45b50)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)\n\nA web server for development without bundling, utilizing the browser's standard module loader and efficient browser caching for simple and fast web development.\n\n```bash\nnpx es-dev-server --node-resolve --watch\n```\n\n**Quick overview**\n\n- efficient browser caching for fast reloads\n- [transform code on older browsers for compatibility](#compatibility-mode)\n- [resolve bare module imports for use in the browser](#node-resolve) (`--node-resolve`)\n- [deduplicate multiple installations of the same package](#dedupe)\n- auto reload the browser on file changes with the (`--watch`)\n- history API fallback for SPA routing with the (`--app-index index.html`)\n\n[See all commands](#Command%20line%20flags%20and%20Configuration)\n\n## Getting started\n\nWe recommend [following this guide](https://dev.to/open-wc/developing-without-a-build-2-es-dev-server-1cf5) for a step by step overview of different workflows with `es-dev-server`.\n\n## Setup\n\nWith our project scaffolding you can set up a pre-configured project:\n\n```bash\nnpm init @open-wc\n```\n\n### Manual\n\nYou can also set up the dev server manually:\n\n```bash\nnpm i -D es-dev-server\n```\n\nAdd scripts to your `package.json`, modify the flags as needed:\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"es-dev-server --app-index index.html --node-resolve --watch --open\"\n  }\n}\n```\n\nRun the server:\n\n```bash\nnpm run start\n```\n\n## Node version\n\nes-dev-server requires node v10 or higher\n\n## Command line flags and Configuration\n\n### Server configuration\n\n| name      | type           | description                                                             |\n| --------- | -------------- | ----------------------------------------------------------------------- |\n| port      | number         | The port to use, uses a random free port if not set.                    |\n| hostname  | string         | The hostname to use. Default: localhost                                 |\n| open      | boolean/string | Opens the browser on app-index, root dir or a custom path               |\n| app-index | string         | The app's index.html file, sets up history API fallback for SPA routing |\n| root-dir  | string         | The root directory to serve files from. Default: working directory      |\n| base-path | string         | Base path the app is served on. Example: /my-app                        |\n| config    | string         | The file to read configuration from (JS or JSON)                        |\n| help      | none           | See all options                                                         |\n\n### Development help\n\n| name  | type    | description                                                         |\n| ----- | ------- | ------------------------------------------------------------------- |\n| watch | boolean | Reload the browser when files are edited                            |\n| http2 | boolean | Serve files over HTTP2. Sets up HTTPS with self-signed certificates |\n\n### Code transformation\n\n| name                 | type          | description                                                                                                                     |\n| -------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------- |\n| compatibility        | string        | Compatibility mode for older browsers. Can be: `auto`, `always`, `min`, `max` or `none` Default `auto`                          |\n| node-resolve         | boolean       | Resolve bare import imports using node resolve                                                                                  |\n| dedupe               | boolean/array | Deduplicates all modules, or modules from specified packages if the value is an array                                           |\n| preserve-symlinks    | boolean       | Preserve symlinks when resolving modules. Set to true, if using tools that rely on symlinks, such as `npm link`. Default false. |\n| module-dirs          | string/array  | Directories to resolve modules from. Used by node-resolve                                                                       |\n| babel                | boolean       | Transform served code through babel. Requires .babelrc                                                                          |\n| file-extensions      | number/array  | Extra file extensions to use when transforming code.                                                                            |\n| babel-exclude        | number/array  | Patterns of files to exclude from babel compilation.                                                                            |\n| babel-modern-exclude | number/array  | Patterns of files to exclude from babel compilation on modern browsers.                                                         |\n| babel-module-exclude | number/array  | Patterns of files to exclude from babel compilation for modules only.                                                           |\n\nMost commands have an alias/shorthand. You can view them by using `--help`.\n\n### Configuration files\n\nWe pick up an `es-dev-server.config.js` file automatically if it is present in the current working directory. You can specify a custom config path using the `config` flag.\n\nConfiguration options are the same as command line flags, using their camelCased names. Example:\n\n```javascript\nmodule.exports = {\n  port: 8080,\n  watch: true,\n  nodeResolve: true,\n  appIndex: 'demo/index.html',\n  moduleDirs: ['node_modules', 'web_modules'],\n};\n```\n\nIn addition to the command-line flags, the configuration file accepts these additional options:\n\n| name                 | type   | description                                              |\n| -------------------- | ------ | -------------------------------------------------------- |\n| middlewares          | array  | Koa middlewares to add to the server, read more below.   |\n| responseTransformers | array  | Functions which transform the server's response.         |\n| babelConfig          | object | Babel config to run with the server                      |\n| polyfillsLoader      | object | Configuration for the polyfills loader, read more below. |\n\n## Node resolve\n\n\"Bare imports\" are imports which don't specify a full path to a file:\n\n```js\nimport foo from 'bar';\n```\n\nThe browser doesn't know where to find this file called `bar`. The `--node-resolve` flag resolves this bare import to the actual file path before serving it to the browser:\n\n```js\nimport foo from './node_modules/bar/bar.js';\n```\n\nBecause we use [es-module-lexer](https://github.com/guybedford/es-module-lexer) for blazing fast analysis to find the imports in a file without booting up a full-blown parser like babel, we can do this without noticeable impact on performance.\n\nFor the actual resolve logic, we internally use [@rollup/plugin-node-resolve](https://github.com/rollup/plugins/tree/master/packages/node-resolve) so that you can keep the resolve logic in sync between development and production. When using a config file, the `nodeResolve` can also be an object which accepts the same options as the rollup plugin. options.\n\n<details>\n<summary>Example config</summary>\n\nSee [the rollup docs](https://github.com/rollup/plugins/tree/master/packages/node-resolve) for all options and what they do.\n\nSome options like `dedupe`, `fileExtensions`, `preserveSymlinks` and `moduleDirs` are mapped to options for `nodeResolve` internally. You can overwrite them with your custom config.\n\n```js\nmodule.exports = {\n  nodeResolve: {\n    jsnext: true,\n    browser: true,\n    // set default to false because es-dev-server always\n    // runs in the browser\n    preferBuiltins: true,\n    // will overwrite es-dev-server's fileExtensions option\n    extensions: ['.mjs', '.js'],\n    // will overwrite es-dev-server's dedupe option\n    dedupe: ['lit-html'],\n    customResolveOptions: {\n      // will overwrite es-dev-server's moduleDirs option\n      moduleDirectory: ['node_modules'],\n      preserveSymlinks: true,\n    },\n  },\n};\n```\n\n</details>\n\nIn future, we are hoping that [import maps](https://github.com/WICG/import-maps) will make this step unnecessary.\n\n## Dedupe\n\nWhen your dependencies depend on different versions of the same package, package managers like yarn or npm may end up installing multiple versions of the same package with nested `node_modules` directories. This can create problems when modules expect to be singletons on the page, or when it includes side-effects such as custom element registration which can only be run once.\n\nYou can use the `dedupe` option to ensure a particular package is only loaded once by resolving from the root of the package instead of relative to the originating module.\n\nWhen `dedupe` is a boolean, all packages are deduplicated:\n\n```bash\nes-dev-server --dedupe\n```\n\nWhen it is an array, only the specified packages are deduplicated. An array can only be set from a config:\n\n```javascript\nmodule.exports = {\n  dedupe: ['foo', 'bar'],\n};\n```\n\n## Folder structure\n\n`es-dev-server` serves static files using the same structure as your file system. It cannot serve any files outside of the root of the webserver. You need to make sure any files requested, including node modules, are accessible for the webserver.\n\nOutside of that one requirement, however, `es-dev-server` does not have any opinions on how you should scaffold your project. The following are examples of a variety of different suggested strategies for setting up your project's folder structure.\n\n### index.html in the Root\n\n<details>\n  <summary>The simplest setup, making sure that all files are accessible, is to place your index.html at the root of your project</summary>\n\nConsider this example directory structure in the web root:\n\n```\nnode_modules/...\nsrc/...\nindex.html\n```\n\nIf you run the `es-dev-server` command from the root of the project, you can access your app at `/` or `/index.html` in the browser.\n\n</details>\n\n### index.html in a Subfolder\n\nIf you move your `index.html` inside a subfolder:\n\n<details>\n  <summary>Use the `--open` parameter for when you'd like to keep you index.html in a subfolder.</summary>\n\n```\nnode_modules/...\nsrc/...\nsrc/index.html\n```\n\nYou can access your app in the browser at `/src/` or `/src/index.html`. You can tell `es-dev-server` to explicitly open at this path:\n\n```bash\n# with app-index flag\nes-dev-server --app-index src/index.html --open\n# without app-index flag\nes-dev-server --open src/\n```\n\nYou can also change the root directory of the dev server:\n\n```bash\nes-dev-server --root-dir src --open\n```\n\nNow your `index.html` is accessible at `/` or `/index.html`. However, the dev server cannot serve any files outside of the root directory. So if your app uses any node modules, they will no longer because accessible.\n\nIf you want your index in a subfolder without this being visible in the browser URL, you can set up a file rewrite rule. [Read more here](#rewriting-file-requests)\n\n</details>\n\n### Monorepos\n\n<details>\n  <summary>Use `--app-index` or `--root-dir` when your index.html and web root are in different places, e.g.. in a monorepo setup.</summary>\n\nIf you are using `es-dev-server` in a monorepo, your node modules are in two different locations. In the package's folder and the repository root:\n\n```\nnode_modules/...\npackages/my-package/node_modules/...\npackages/my-package/index.html\n```\n\nYou will need to make sure the root node_modules folder is accessible to the dev server.\n\nIf your working directory is `packages/my-package` you can use this command:\n\n```bash\n# with app-index\nes-dev-server --root-dir ../../ --app-index packages/my-package/index.html --open\n# without app-index\nes-dev-server --root-dir ../../ --open packages/my-package/index.html\n```\n\nIf your working directory is the root of the repository you can use this command:\n\n```bash\nes-dev-server --app-index packages/my-package/index.html --open\n```\n\nThis is the same approach as serving an index.html in a subdirectory, so the section above applies here as well.\n\n</details>\n\n### Base Element\n\n<details>\n  <summary>Use platform features to specify your web root, e.g. in <abbr title=\"Single Page Applications\">SPAs</abbr></summary>\n\nYou can set up a `<base href=\"\">` element to modify how files are resolved relatively to your index.html. This can be very useful when your index.html is not at the root of your project.\n\nIf you use <abbr title=\"Single Page Application\">SPA</abbr> routing, using a base element is highly recommended. [Read more](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base)\n\n</details>\n\n## Custom middlewares / proxy\n\nYou can install custom middlewares, using the `middlewares` property.\n\n<details>\n  <summary>Read more</summary>\n\nThe middleware should be a standard koa middleware. [Read more about koa here.](https://koajs.com/)\n\nYou can use custom middlewares to set up a proxy, for example:\n\n```javascript\nconst proxy = require('koa-proxies');\n\nmodule.exports = {\n  port: 9000,\n  middlewares: [\n    proxy('/api', {\n      target: 'http://localhost:9001',\n    }),\n  ],\n};\n```\n\n</details>\n\n## Rewriting request urls\n\nYou can rewrite certain file requests using a simple custom middleware. This can be useful for example to serve your `index.html` from a different file location or to alias a module.\n\n<details>\n  <summary>Read more</summary>\n\nServe `/index.html` from `/src/index.html`:\n\n```javascript\nmodule.exports = {\n  middlewares: [\n    function rewriteIndex(context, next) {\n      if (context.url === '/' || context.url === '/index.html') {\n        context.url = '/src/index.html';\n      }\n\n      return next();\n    },\n  ],\n};\n```\n\n</details>\n\n## Response transformers\n\nWith the `responseTransformers` property, you can transform the server's response before it is sent to the browser. This is useful for injecting code into your index.html, performing transformations on files or to serve virtual files programmatically.\n\n<details>\n  <summary>Read more</summary>\n\nA response transformer is a function which receives the original response and returns an optionally modified response. This transformation happens before any other built-in transformations such as node resolve, babel or compatibility. You can register multiple transformers, they are called in order.\n\nThe functions can be sync or async, see the full signature below:\n\n```typescript\n({ url: string, status: number, contentType: string, body: string }) => Promise<{ body?: string, contentType?: string } | null>\n```\n\nSome examples:\n\nRewrite the base path of your `index.html`:\n\n```javascript\nmodule.exports = {\n  responseTransformers: [\n    function rewriteBasePath({ url, status, contentType, body }) {\n      if (url === '/' || url === '/index.html') {\n        const rewritten = body.replace(/<base href=\".*\">/, '<base href=\"/foo/\">');\n        return { body: rewritten };\n      }\n    },\n  ],\n};\n```\n\nServe a virtual file, for example an auto generated `index.html`:\n\n```javascript\nconst indexHTML = generateIndexHTML();\n\nmodule.exports = {\n  responseTransformers: [\n    function serveIndex({ url, status, contentType, body }) {\n      if (url === '/' || url === '/index.html') {\n        return { body: indexHTML, contentType: 'text/html' };\n      }\n    },\n  ],\n};\n```\n\nTransform markdown to HTML:\n\n```javascript\nconst markdownToHTML = require('markdown-to-html-library');\n\nmodule.exports = {\n  responseTransformers: [\n    async function transformMarkdown({ url, status, contentType, body }) {\n      if (url === '/readme.md') {\n        const html = await markdownToHTML(body);\n        return {\n          body: html,\n          contentType: 'text/html',\n        };\n      }\n    },\n  ],\n};\n```\n\nPolyfill CSS modules in JS:\n\n```javascript\nmodule.exports = {\n  responseTransformers: [\n    async function transformCSS({ url, status, contentType, body }) {\n      if (url.endsWith('.css')) {\n        const transformedBody = `\n          const stylesheet = new CSSStyleSheet();\n          stylesheet.replaceSync(${JSON.stringify(body)});\n          export default stylesheet;\n        `;\n        return { body: transformedBody, contentType: 'application/javascript' };\n      }\n    },\n  ],\n};\n```\n\n</details>\n\n## Typescript support\n\n`es-dev-server` is based around developing without any build tools but you can make it work with typescript as well.\n\n<details>\n  <summary>Read more</summary>\n\nThe easiest way to use the server with typescript is to compile your typescript to javascript before running the server. Just run `tsc` in watch mode and include the compiled js files from your `index.html`.\n\nYou can also configure the dev server to consume your typescript files directly. This is done by running the server with a babel plugin to compile your typescript files to javascript.\n\nNote that when compiling typescript with babel it does not do any type checking or special typescript compilation such as decorators, class fields and enums. You can configure babel to cover most of these, but not all. [Read more about babel typescript here](https://babeljs.io/docs/en/babel-plugin-transform-typescript).\n\n1. Install the preset:\n\n```bash\nnpm i --save-dev @babel/preset-typescript\n```\n\n2. Add a `babel.config.js` or `.babelrc` to your project:\n\n```json\n{\n  \"presets\": [\"@babel/preset-typescript\"]\n}\n```\n\n3. Import a typescript file from your `index.html`\n\n```html\n<html>\n  <head></head>\n\n  <body>\n    <script type=\"module\" src=\"./my-app.ts\"></script>\n  </body>\n</html>\n```\n\n4. Run `es-dev-server` with these flags:\n\n```bash\nes-dev-server --file-extensions .ts --node-resolve --babel --open\n```\n\nTo add support for experimental features that are normally handled by the typescript compiler, you can add extra babel plugins:\n\n1. Install the plugins:\n\n```bash\nnpm i --save-dev @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties\n```\n\n2. Update your babel configuration:\n\n```json\n{\n  \"presets\": [\"@babel/preset-typescript\"],\n  // for libraries that support babel decorators (lit-element) use:\n  \"plugins\": [\n    [\"@babel/plugin-proposal-decorators\", { \"decoratorsBeforeExport\": true }],\n    \"@babel/plugin-proposal-class-properties\"\n  ]\n  // for libraries that only support typescript:\n  // \"plugins\": [\n  //   [\"@babel/plugin-proposal-decorators\", { \"legacy\": true }],\n  //   [\"@babel/plugin-proposal-class-properties\", { \"loose\": true }]\n  // ],\n}\n```\n\n</details>\n\n## Compatibility mode\n\nCompatibility mode enables bundle-free development using modern browsers features on older browsers. Automatic compatibility mode is enabled by default.\n\n<details>\n\n  <summary>Read more</summary>\n\nCompatibility mode can be configured using the `--compatibility` flag. The possible options are: `auto`, `min`, `max` and `none`. The default is mode is `auto`.\n\n**auto**\n`auto` compatibility looks at the current browser to determine the level of compatibility to enable. On the latest 2 versions of the major browsers, it doesn't do any work. This keeps the server as fast as possible in the general case.\n\nOn older browsers, the server uses the browser's user agent and [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) to do a targeted transformation for that specific browser and version. `@babel/preset-env` only works with with stage 4 javascript features, they should become an official standard before they can be used.\n\nIf the browser does not support es module scripts, dynamic imports or `import.meta.url` es modules are transformed to [system-js](https://github.com/systemjs/systemjs).\n\nThis works down to at least IE11. Depending on what browser features you are using, it might work with earlier version too but this is not tested.\n\n**always**\n`always` compatibility is the same as `auto`, except that it doesn't skip compiling on the latest 2 versions of the major browsers. This makes it a bit slower on modern browsers, but allows you to use new features before they are implemented in the browser.\n\n**min**\n`min` compatibility forces the same level of compatibility on all browsers. It makes code compatible with the latest two versions of the major browsers, and does not transform es modules.\n\n**max**\n`max` compatibility forces the same level of compatibility on all browsers. It compiles everything to es5 and [system-js](https://github.com/systemjs/systemjs).\n\n**none**\n`none` disables compatibility mode entirely.\n\n</details>\n\n### Polyfills loader\n\nWhen compatibility mode is enabled, polyfills are loaded using [polyfills-loader](https://github.com/open-wc/open-wc/tree/master/packages/polyfills-loader).\n\n<details>\n  <summary>Read more</summary>\n\nYou can customize the polyfill loader configuration from your configuration file. Check the docs for the [polyfills-loader](https://github.com/open-wc/open-wc/tree/master/packages/polyfills-loader) for all possible options.\n\n```js\nmodule.exports = {\n  polyfillsLoader: {\n    polyfills: {\n      fetch: false,\n      custom: [\n        {\n          name: 'my-feature-polyfill',\n          path: require.resolve('my-feature-polyfill'),\n          test: \"!('myFeature' in window)\",\n        },\n      ],\n    },\n  },\n};\n```\n\nBy default, es-dev-server wraps all scripts and are deferred until polyfills are loaded. Loading order of scripts are preserved, but this can create problems if you rely on a script being executed before HTML is parsed. You can configure `es-dev-server` to exclude certain types of scripts:\n\n```js\nmodule.exports = {\n  polyfillsLoader: {\n    exclude: {\n      jsModules: true,\n      inlineJsModules: true,\n      jsScripts: true,\n      inlineJsScripts: true,\n    },\n  },\n};\n```\n\n</details>\n\n## Using es-dev-server programmatically\n\nYou can use different components from `es-dev-server` as a library and integrate it with other tools:\n\n<details>\n\n<summary>Read more</summary>\n\n### createConfig\n\nWhen using the server from javascript you are going to need a config object to tell the server what options to turn on and off. It's best to use `createConfig` for this as this converts the public API to an internal config structure and sets up default values.\n\nBy default, all options besides static file serving are turned off, so it's easy to configure based on your requirements.\n\nThe config structure is the same as the configuration explained in the [configuration files section](#configuration-files)\n\n```javascript\nimport { createConfig } from 'es-dev-server';\n\nconst config = createConfig({\n  http2: true,\n  babel: true,\n  open: true,\n});\n```\n\n### createMiddlewares\n\n`createMiddlewares` creates the dev server's middlewares based on your configuration. You can use this to hook them up to your koa server.\n\nReturns an array of koa middleware functions.\n\n```javascript\nimport Koa from 'koa';\nimport { createConfig, createMiddlewares } from 'es-dev-server';\n\nconst config = createConfig({});\nconst middlewares = createMiddlewares(config);\n\nconst app = new Koa();\nmiddlewares.forEach(middleware => {\n  app.use(middleware);\n});\n```\n\n### createServer\n\n`createServer` creates an instance of the dev server including all middlewares, but without starting the server. This is useful if you want to be in control of starting the server yourself.\n\nReturns the koa app and a node http or http2 server.\n\n```javascript\nimport Koa from 'koa';\nimport { createConfig, createServer } from 'es-dev-server';\n\nconst config = createConfig({ ... });\nconst { app, server } = createServer(config);\nserver.listen(3000);\n```\n\n### watch mode\n\n`createMiddlewares` and `createServer` requires a chokidar fileWatcher if watch mode is enabled. You need to pass this separately because the watcher needs to be killed explicitly when the server closes.\n\n```javascript\nimport Koa from 'koa';\nimport chokidar from 'chokidar';\nimport { createConfig, createMiddlewares, createServer } from 'es-dev-server';\n\nconst config = createConfig({ ... });\nconst fileWatcher = chokidar.watch([]);\n\n// if using createMiddlewares\ncreateMiddlewares(config, fileWatcher);\n// if using createServer\ncreateServer(config, fileWatcher);\n\n// close filewatcher when no longer necessary\nfileWatcher.close();\n```\n\n### startServer\n\n`startServer` creates and starts the server, listening on the configured port. It opens the browser if configured and logs a startup message.\n\nReturns the koa app and a node http or http2 server.\n\n```javascript\nimport Koa from 'koa';\nimport { createConfig, startServer } from 'es-dev-server';\n\nconst config = createConfig({ ... });\nconst { app, server } = startServer(config, fileWatcher);\n```\n\n</details>\n\n<script>\n  export default {\n    mounted() {\n      const editLink = document.querySelector('.edit-link a');\n      if (editLink) {\n        const url = editLink.href;\n        editLink.href = url.substr(0, url.indexOf('/master/')) + '/master/packages/es-dev-server/README.md';\n      }\n    }\n  }\n</script>\n","engines":{"node":">=0.10.0"},"license":"MIT","scripts":{"test":"npm run test:node","build":"babel src --out-dir dist --copy-files --include-dotfiles","test:node":"mocha test/**/*.test.js test/*.test.js --require @babel/register","start:babel":"yarn build && node dist/cli.js -c demo/babel/server.js --open --watch","start:http2":"yarn build && node dist/cli.js -c demo/http2/server.js","start:dedupe":"yarn build && node dist/cli.js -c demo/dedupe/server.js --open --watch","start:static":"yarn build && node dist/cli.js -c demo/static/server.js --open","start:syntax":"yarn build && node dist/cli.js -c demo/syntax/server.js --open --watch","prepublishOnly":"npm run build && ../../scripts/insert-header.js","start:root-dir":"yarn build && node dist/cli.js --root-dir demo/static/ --open","start:base-path":"yarn build && node dist/cli.js -c demo/base-path/server.js","start:import-map":"yarn build && node dist/cli.js -c demo/import-map/server.js","start:typescript":"yarn build && node dist/cli.js -c demo/typescript/server.js --open --watch","start:performance":"yarn build && node dist/cli.js -c demo/performance/server.js","start:node-resolve":"yarn build && node dist/cli.js -c demo/node-resolve/server.js --open --watch","start:transformers":"yarn build && node dist/cli.js -c demo/response-transformers/server.js","start:node-builtins":"yarn build && node dist/cli.js -c demo/node-builtins/server.js --open --watch","generate-certificates":"node scripts/generate-certificates.js","test:update-snapshots":"mocha test/**/*.test.js test/*.test.js --require @babel/register --update-snapshots"},"_npmUser":{"name":"larsdenbakker","email":"larsdenbakker@gmail.com"},"homepage":"https://github.com/open-wc/open-wc/","keywords":["server","http-server","polyfill"],"repository":{"url":"git+https://github.com/open-wc/open-wc.git","type":"git","directory":"packages/es-dev-server"},"_npmVersion":"6.13.4","description":"Development server for modern web apps","directories":{},"maintainers":[{"name":"d4kmor","email":"d4kmor@gmail.com"},{"name":"larsdenbakker","email":"larsdenbakker@gmail.com"}],"_nodeVersion":"13.6.0","dependencies":{"koa":"^2.7.0","opn":"^5.4.0","parse5":"^5.1.0","chokidar":"^3.0.0","debounce":"^1.2.0","koa-etag":"^3.0.0","camelcase":"^5.3.1","deepmerge":"^3.2.0","is-stream":"^2.0.0","lru-cache":"^5.1.1","minimatch":"^3.0.4","useragent":"^2.3.0","get-stream":"^5.1.0","koa-static":"^5.0.0","portfinder":"^1.0.21","strip-ansi":"^5.2.0","whatwg-url":"^7.0.0","@babel/core":"^7.7.2","caniuse-api":"^3.0.0","browserslist":"^4.7.2","caniuse-lite":"^1.0.30001008","isbinaryfile":"^4.0.2","koa-compress":"^3.0.0","path-is-inside":"^1.0.2","builtin-modules":"^3.1.0","es-module-lexer":"^0.3.13","@types/minimatch":"^3.0.3","polyfills-loader":"^1.0.0-alpha.0","@babel/preset-env":"^7.7.1","command-line-args":"^5.0.2","command-line-usage":"^6.1.0","@rollup/pluginutils":"^3.0.0","browserslist-useragent":"^3.0.2","@open-wc/building-utils":"^2.11.0","@rollup/plugin-node-resolve":"^6.1.0","@babel/plugin-syntax-import-meta":"^7.2.0","@babel/plugin-proposal-dynamic-import":"^7.7.0","@babel/plugin-syntax-class-properties":"^7.2.0","@babel/plugin-syntax-numeric-separator":"^7.2.0","@babel/plugin-syntax-optional-chaining":"^7.2.0","@babel/plugin-proposal-optional-chaining":"^7.7.5","@babel/plugin-transform-template-literals":"^7.7.4","@babel/plugin-syntax-nullish-coalescing-operator":"^7.2.0","@babel/plugin-proposal-nullish-coalescing-operator":"^7.7.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"^4.2.0","uuid":"^3.3.2","mocha":"^6.2.2","sinon":"^7.4.1","buffer":"^5.4.3","request":"^2.88.0","lit-html":"^1.0.0","lodash-es":"^4.17.15","puppeteer":"^2.0.0","@babel/cli":"^7.7.0","@types/koa":"^2.0.48","node-fetch":"^2.6.0","selfsigned":"^1.10.4","koa-proxies":"^0.8.1","lit-element":"^2.0.1","@types/request":"^2.48.1","@babel/register":"^7.7.0","@types/lru-cache":"^5.1.0","@types/puppeteer":"^2.0.0","abort-controller":"^3.0.0","@types/koa-static":"^4.0.1","@types/node-fetch":"^2.3.7","@types/whatwg-url":"^6.4.0","@babel/preset-typescript":"^7.7.2","@babel/plugin-proposal-decorators":"^7.7.0","@babel/plugin-proposal-private-methods":"^7.6.0","@babel/plugin-proposal-class-properties":"^7.7.0","@babel/plugin-transform-modules-systemjs":"^7.7.0"},"_npmOperationalInternal":{"tmp":"tmp/es-dev-server_1.37.0-alpha.1_1580057880889_0.18776752252374873","host":"s3://npm-registry-packages"},"_id":"es-dev-server@1.37.0-alpha.1","version":"1.37.0-alpha.1"}