{"_id":"@amokrushin/koa-webpack","_rev":"2-6d543849cf7e73f42920124e333fad99","name":"@amokrushin/koa-webpack","dist-tags":{"latest":"4.2.0"},"versions":{"4.1.0":{"name":"@amokrushin/koa-webpack","version":"4.1.0","description":"Development and Hot Reload Middleware for Koa2","license":"MIT","repository":{"type":"git","url":"git+https://github.com/shellscape/koa-webpack.git"},"author":{"name":"Andrew Powell","email":"andrew@shellscape.org"},"main":"index.js","engines":{"node":">= 6.0.0"},"scripts":{"ci":"npm run lint && npm run test","mocha":"mocha test/test.js --exit","lint":"eslint index.js test/*.js","test":"npm run mocha"},"peerDependencies":{"webpack":"^4.0.0"},"dependencies":{"app-root-path":"^2.0.1","merge-options":"^1.0.0","webpack-dev-middleware":"^3.0.0","@amokrushin/webpack-hot-client":"^3.1.0","webpack-log":"^1.1.1"},"devDependencies":{"@babel/cli":"^7.0.0-beta.37","@babel/core":"^7.0.0-beta.37","@babel/polyfill":"^7.0.0-beta.37","@babel/preset-env":"^7.0.0-beta.37","@babel/register":"^7.0.0-beta.37","deepmerge":"^2.0.1","eslint":"^4.1.0","eslint-config-webpack":"^1.2.5","eslint-plugin-import":"^2.8.0","killable":"^1.0.0","koa":"^2.2.0","koa-compose":"^4.0.0","loud-rejection":"^1.6.0","mocha":"^5.0.1","server-destroy":"^1.0.1","supertest":"^3.0.0","webpack":"^4.0.1","wtfnode":"^0.6.0"},"publishConfig":{"access":"public"},"gitHead":"c19a2f486370fff362490f2860cb147cb36293e0","bugs":{"url":"https://github.com/shellscape/koa-webpack/issues"},"homepage":"https://github.com/shellscape/koa-webpack#readme","_id":"@amokrushin/koa-webpack@4.1.0","_npmVersion":"6.1.0","_nodeVersion":"10.4.1","_npmUser":{"name":"amokrushin","email":"anton@mokr.org"},"dist":{"integrity":"sha512-3fYyTcbFNfREnevmYwWfZK6EJi4VrXM5gQowpraEnLx7vb2JIaILkZPZsviDe0oXl0wcuq5bihT+cZSNCjaqLA==","shasum":"a62346195558ed086c967397243bf68ff3a6d2d2","tarball":"https://registry.npmjs.org/@amokrushin/koa-webpack/-/koa-webpack-4.1.0.tgz","fileCount":11,"unpackedSize":17376,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKnfYCRA9TVsSAnZWagAA+f4QAIPwwbts0l3GWEi37dzT\n5uTb1KisJD0wVm4Jxgmkznyd/1KrmXufUOU6PDDVoI/wTE2JcZU95LblcuFM\nKnc+xUa4em7wI0bSlmsgH4A1Q084Q/Q9cj54dru0D6cKxX2QANWyflJVjiZf\n1aXIC0myQwhnSjjXizZ51/ADkMOc8mX7YxfVK1NO/RGUfqaIOkf61nwHOaxK\n50EWC+xIzWxA5dAc6H8PQzSneR+DLn3DprKS8sTSkASkYE9Bms5svSv+xOZC\nBa08vdm9pR4ZpZs72jiXhFIDRU3pPTnCR1PoBkowjznfKh0pM/OPiUbrhwjS\nTvCYsZ4bieA1fIgTikhFFUXzMWWYuFgMtWSvi/i4JDo+pb5FlfzuFRk/Idb8\nDVWHQDtQawqovYFajNqHDydf0EHj/f8Bksad6uPDm3MH1x8komxpoB7HUC3F\nIdI2m+BoJ5kkJFHNfY5ZjxnD8QSSw1xQMFq5Zh8bzHEyhLzluSYepEA/1Q5y\nbyScwBwq5lnFoaLBmfDHpSKnVZy9+WUA0EA+mN6/q4uG9sdkkMwvACRreiKM\nwQHwb+azw03CF+u7ildeaRAkEXooTEZvGjfSQytLPOU/LkC1OvEhSYnwsWbU\n+Us3CQqtUESAX26PPI1Jig4inCRKjIKQ2kCnHGR8oCo+g42Kb8g3ufQdVPMz\nIznS\r\n=E47B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF8Szf8gLpnJzcdnwiavnMPWbIPGIcFZNXUp8pLEJwDNAiAbONfTrb8pGa7kUC7qUc21o+ziOXI+rL1NMFbKNY2moQ=="}]},"maintainers":[{"name":"amokrushin","email":"anton@mokr.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/koa-webpack_4.1.0_1529509846549_0.9123959348136197"},"_hasShrinkwrap":false},"4.2.0":{"name":"@amokrushin/koa-webpack","version":"4.2.0","description":"Development and Hot Reload Middleware for Koa2","license":"MIT","repository":{"type":"git","url":"git+https://github.com/shellscape/koa-webpack.git"},"author":{"name":"Andrew Powell","email":"andrew@shellscape.org"},"main":"index.js","engines":{"node":">= 6.0.0"},"scripts":{"ci":"npm run lint && npm run test","mocha":"mocha test/test.js --exit","lint":"eslint index.js test/*.js","test":"npm run mocha"},"peerDependencies":{"webpack":"^4.0.0"},"dependencies":{"@amokrushin/webpack-hot-client":"^3.1.0","app-root-path":"^2.0.1","etag":"^1.8.1","merge-options":"^1.0.0","webpack-dev-middleware":"^3.0.0","webpack-log":"^1.1.1"},"devDependencies":{"@babel/cli":"^7.0.0-beta.37","@babel/core":"^7.0.0-beta.37","@babel/polyfill":"^7.0.0-beta.37","@babel/preset-env":"^7.0.0-beta.37","@babel/register":"^7.0.0-beta.37","deepmerge":"^2.0.1","eslint":"^4.1.0","eslint-config-webpack":"^1.2.5","eslint-plugin-import":"^2.8.0","killable":"^1.0.0","koa":"^2.2.0","koa-compose":"^4.0.0","loud-rejection":"^1.6.0","mocha":"^5.0.1","server-destroy":"^1.0.1","supertest":"^3.0.0","webpack":"^4.0.1","wtfnode":"^0.6.0"},"publishConfig":{"access":"public"},"gitHead":"483146cf5750400976b2d2a86183bffc350062b5","bugs":{"url":"https://github.com/shellscape/koa-webpack/issues"},"homepage":"https://github.com/shellscape/koa-webpack#readme","_id":"@amokrushin/koa-webpack@4.2.0","_npmVersion":"6.1.0","_nodeVersion":"10.4.1","_npmUser":{"name":"amokrushin","email":"anton@mokr.org"},"dist":{"integrity":"sha512-FOLppX0JtX1MHejvmwr1blyT1badbAqYnj1Wrk0NLi+dj7Aiznfahagt/wRy5PsPOVpdcaTYX3Tb/+Wj0BAsnw==","shasum":"a53932fc633b19ed1531e4f9868bc9c41d2d4c41","tarball":"https://registry.npmjs.org/@amokrushin/koa-webpack/-/koa-webpack-4.2.0.tgz","fileCount":11,"unpackedSize":17479,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbLyDCCRA9TVsSAnZWagAAE7AP/Rk6vQ8vXw2kpZmFuVNr\nNMHjvWyW9CESP2HD+ovOSLCCMkKRP/9HYqsrR2Z97gZKJlisGimw6LL0AOUv\nyn67cVr7XwbgxSu9O4+FFTyoNuChnwxNFgdzr9dV2i2F6rnsbpVAJRJOhMWD\nUN01KXIXHq3FHjL3PZ6Hll0l5fTRVYnEQfMYsJJV1EJwQmuzjmO5hSnU7962\naH63ASTB6xIW7T8pzLbbHS6I005TH25h0/+ihMD94tx4A9J3qPOu1dpz2TS6\nryKLxeWg7A626K1SwOjREdL5Uaywipd1K98/RWhngjxdumVChfHax1I0nBv7\n2zFGVzfyGlrcM2SmjnycQZr4QG78+vhGwGSoua2eQzjDq7gaIBfh1V+qJE2q\ndAo8gdf0nSDhySMggNyIE/IeF+BP0tt7s/KLV7XIENpAFJUokiC6Z2CAUAlv\nuPdguWHUhQzpLjIopcqit4ox7ZBTUJEagIjReMBVroWwwUlLvU3IWOCJTuEz\nH2+dcrrVJ2VHOBNwk0YkEzFVfgmbYn0UbGuYaUDUns838J56Zu+lmzA3Rf/8\npVw4qYsvJFbCI5E8TSuo9Xwu3NiSdKOtnDABY1/K/Vz1KdvmjNtc7tCp16Lb\nGytrnf9wqyoypV1Hl2GO4j8cHtzJdRwMAnrxj6kV6RSSRQ1TjBlnewmj1M2M\nJZ16\r\n=tysM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICLV20ngJscCA8MANfZdsjjyZP9VpQxMZcKlc70dDPfKAiB5V5KduSzJbXYFRCzQlvGYtrdIBAZ/GIbBoAyaNI5KPg=="}]},"maintainers":[{"name":"amokrushin","email":"anton@mokr.org"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/koa-webpack_4.2.0_1529815234472_0.10666948097382156"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-20T15:50:46.312Z","4.1.0":"2018-06-20T15:50:46.620Z","modified":"2022-04-04T13:50:33.919Z","4.2.0":"2018-06-24T04:40:34.570Z"},"maintainers":[{"name":"amokrushin","email":"anton@mokr.org"}],"description":"Development and Hot Reload Middleware for Koa2","homepage":"https://github.com/shellscape/koa-webpack#readme","repository":{"type":"git","url":"git+https://github.com/shellscape/koa-webpack.git"},"author":{"name":"Andrew Powell","email":"andrew@shellscape.org"},"bugs":{"url":"https://github.com/shellscape/koa-webpack/issues"},"license":"MIT","readme":"# koa-webpack [![Build Status](https://travis-ci.org/shellscape/koa-webpack.svg?branch=master)](https://travis-ci.org/shellscape/koa-webpack)\n\nDevelopment and Hot Module Reload Middleware for **Koa2**, in a single middleware module.\n\nThis module wraps and composes\n[`webpack-dev-middleware`](https://github.com/webpack/webpack-dev-middleware) and\n[`webpack-hot-client`](https://github.com/webpack-contrib/webpack-hot-client)\ninto a single middleware module, allowing for quick and concise implementation.\n\nAs an added bonus, it'll also use the installed `webpack` module from your project,\nand the `webpack.config.js` file in the root of your project, automagically, should\nyou choose to let it. This negates the need for all of the repetitive setup and\nconfig that you get with `koa-webpack-middleware`.\n\n## Version 2 Breaking Changes\n\nAs of version 2.0.0, Node v4 is no longer supported. The minimum version of Node\nsupported is v6.11. Browser support is limited to those browsers which support\n_native_ `WebSocket`. That typically means the last two major versions of a\nbrowser. If you need support for older browsers, please use version 1.x of this\nmodule. If you would like to submit a fix for a 1.x version of the module, please\nsubmit that to the `1.x` branch.\n\n### Migrating to Version 2.x\n\nVersion 1.x leveraged webpack-hot-middleware, which required the user to add an entry to the config for `webpack-hot-middleware/client`, and also add `webpack.HotModuleReplacementPlugin` to plugins. These are no longer needed, and will cause errors if not removed from the webpack config.\n\nIf you have setup `hot` options for `koa-webpack` in your config or code, you'll need to reference the [`webpack-hot-client` options](https://github.com/webpack-contrib/webpack-hot-client#options) and update those accordingly. The options for `webpack-hot-middleware` are _not_ 1:1 with `webpack-hot-client`\n\n## Getting Started\n\nFirst thing's first, install the module:\n\n```bash\nnpm install koa-webpack --save-dev\n```\n\nIf you happen to see warning from npm that reads:\n`UNMET PEER DEPENDENCY webpack@2.1.0-beta.25` fear not, simply install the latest\nbeta version of `webpack`.\n\nNext, setup the module in your code. (We're assuming ES6 syntax here)\n\n```js\nimport Koa from 'koa';\nimport middleware from 'koa-webpack';\n\nconst app = new Koa();\n\napp.use(middleware({\n  // options\n}))\n```\n\n## API\n\n### koaWebpack([options])\n\nReturns an `Object` containing:\n\n- `close(callback)` *(Function)* - Closes both the instance of `webpack-dev-middleware`\nand `webpack-hot-client`. Accepts a single `Function` callback parameter that is\nexecuted when complete.\n- `client` *(Object)* - An instance of `webpack-hot-client`.\n- `dev` *(Object)* - An instance of `webpack-dev-middleware`\n\n## options\n\nThe middleware accepts an `options` Object, which can contain options for the\n`webpack-dev-middleware` and `webpack-hot-client` bundled with this module.\nThe following is a property reference for the Object:\n\n#### compiler\n\nType: `Object`  \n`optional`\n\nShould you rather that the middleware use an instance of `webpack` that you've\nalready init'd [with webpack config], you can pass it to the middleware using\nthis option.\n\nExample:\n\n```js\nimport Webpack from 'webpack';\nimport config from './webpack.config.js';\n\nconst compiler = Webpack(config);\n\napp.use(middleware({\n  compiler: compiler\n}))\n```\n\n#### config\n\nType: `Object`  \n`optional`\n\nShould you rather that the middleware use an instance of webpack configuration\nthat you've already required/imported, you can pass it to the middleware using\nthis option.\n\nExample:\n\n```js\nimport config from './webpack.config.js';\n\napp.use(middleware({\n  config: config\n}))\n```\n\n#### dev\n\nType: `Object`  \n`optional`\n\nThe `dev` property should contain options for `webpack-dev-middleware`, a list of\nwhich is available at [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware).\nOmitting this property will result in `webpack-dev-middleware` using its default\noptions.\n\n#### hot\n\nType: `Object|Boolean`  \n`optional`\n\nThe `hot` property should contain options for `webpack-hot-client`, a list of\nwhich is available at [webpack-hot-client](https://github.com/webpack-contrib/webpack-hot-client).\nOmitting this property will result in `webpack-hot-client` using its default\noptions.\n\nAs of `v3.0.1` setting this to `false` will completely disable `webpack-hot-client`\nand all automatic Hot Module Replacement functionality.\n\n## Using with koa-compress\n\nWhen using `koa-webpack` with [koa-compress](https://github.com/koajs/compress),\nyou may experience issues with saving files and hot module reload. Please review\n[this issue](https://github.com/shellscape/koa-webpack/issues/36#issuecomment-289565573)\nfor more information and a workaround.\n\n## Server-Side-Rendering\n\nWhen `serverSideRender` is set to true in `config.dev`, `webpackStats` is accessible from `ctx.state.webpackStats`.\n\n```js\napp.use(async (ctx, next) => {\n  const assetsByChunkName = ctx.state.webpackStats.toJson().assetsByChunkName;\n  // do something with assetsByChunkName\n})\n```\n\nFor more details please refer to: [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware#server-side-rendering)\n\n## Lint and test\n\n```bash\nnpm install\nnpm run lint\nnpm test\n```\n\n## Contributing\n\nWe welcome your contributions! Please have a read of [CONTRIBUTING](CONTRIBUTING.md).\n\n## Attribution\n\nThis module started as a fork of [`koa-webpack-middleware`](https://github.com/leecade/koa-webpack-middleware)\n","readmeFilename":"README.md"}