{
  "manifest": {
    "name": "webpack-dev-middleware",
    "version": "5.3.4",
    "description": "A development middleware for webpack",
    "license": "MIT",
    "repository": {
      "type": "git",
      "url": "https://github.com/webpack/webpack-dev-middleware.git"
    },
    "author": {
      "name": "Tobias Koppers @sokra"
    },
    "homepage": "https://github.com/webpack/webpack-dev-middleware",
    "bugs": {
      "url": "https://github.com/webpack/webpack-dev-middleware/issues"
    },
    "funding": {
      "type": "opencollective",
      "url": "https://opencollective.com/webpack"
    },
    "main": "dist/index.js",
    "types": "types/index.d.ts",
    "engines": {
      "node": ">= 12.13.0"
    },
    "scripts": {
      "commitlint": "commitlint --from=master",
      "security": "npm audit --production",
      "fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
      "lint:js": "eslint --cache src test",
      "lint:types": "tsc --pretty --noEmit",
      "lint": "npm-run-all lint:js fmt:check",
      "fmt": "npm run fmt:check -- --write",
      "fix:js": "npm run lint:js -- --fix",
      "fix": "npm-run-all fix:js fmt",
      "clean": "del-cli dist types",
      "prebuild": "npm run clean",
      "build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
      "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
      "build": "npm-run-all -p \"build:**\"",
      "test:only": "cross-env NODE_ENV=test jest",
      "test:watch": "npm run test:only -- --watch",
      "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
      "pretest": "npm run lint",
      "test": "npm run test:coverage",
      "prepare": "husky install && npm run build",
      "release": "standard-version"
    },
    "files": [
      "dist",
      "types"
    ],
    "peerDependencies": {
      "webpack": "^4.0.0 || ^5.0.0"
    },
    "dependencies": {
      "colorette": "^2.0.10",
      "memfs": "^3.4.3",
      "mime-types": "^2.1.31",
      "range-parser": "^1.2.1",
      "schema-utils": "^4.0.0"
    },
    "devDependencies": {
      "@babel/cli": "^7.16.7",
      "@babel/core": "^7.16.7",
      "@babel/preset-env": "^7.16.7",
      "@commitlint/cli": "^17.0.0",
      "@commitlint/config-conventional": "^17.0.0",
      "@types/connect": "^3.4.35",
      "@types/express": "^4.17.13",
      "@types/mime-types": "^2.1.1",
      "@types/node": "^12.20.43",
      "@webpack-contrib/eslint-config-webpack": "^3.0.0",
      "babel-jest": "^28.1.0",
      "chokidar": "^3.5.1",
      "connect": "^3.7.0",
      "cross-env": "^7.0.3",
      "deepmerge": "^4.2.2",
      "del": "^6.0.0",
      "del-cli": "^4.0.0",
      "eslint": "^8.6.0",
      "eslint-config-prettier": "^8.3.0",
      "eslint-plugin-import": "^2.25.4",
      "execa": "^5.1.1",
      "express": "^4.17.1",
      "file-loader": "^6.2.0",
      "husky": "^7.0.0",
      "jest": "^28.1.0",
      "lint-staged": "^12.1.7",
      "npm-run-all": "^4.1.5",
      "prettier": "^2.5.0",
      "standard-version": "^9.3.0",
      "strip-ansi": "^6.0.0",
      "supertest": "^6.1.3",
      "typescript": "4.5.5",
      "webpack": "^5.68.0"
    },
    "keywords": [
      "webpack",
      "middleware",
      "development"
    ],
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-webpack-dev-middleware-5.3.4-eb7b39281cbce10e104eb2b8bf2b63fce49a3517-integrity/node_modules/webpack-dev-middleware/package.json",
    "readmeFilename": "README.md",
    "readme": "<div align=\"center\">\n  <a href=\"https://github.com/webpack/webpack\">\n    <img width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\">\n  </a>\n</div>\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![chat][chat]][chat-url]\n[![size][size]][size-url]\n\n# webpack-dev-middleware\n\nAn express-style development middleware for use with [webpack](https://webpack.js.org)\nbundles and allows for serving of the files emitted from webpack.\nThis should be used for **development only**.\n\nSome of the benefits of using this middleware include:\n\n- No files are written to disk, rather it handles files in memory\n- If files changed in watch mode, the middleware delays requests until compiling\n  has completed.\n- Supports hot module reload (HMR).\n\n## Getting Started\n\nFirst thing's first, install the module:\n\n```console\nnpm install webpack-dev-middleware --save-dev\n```\n\n_Note: We do not recommend installing this module globally._\n\n## Usage\n\n```js\nconst webpack = require(\"webpack\");\nconst middleware = require(\"webpack-dev-middleware\");\nconst compiler = webpack({\n  // webpack options\n});\nconst express = require(\"express\");\nconst app = express();\n\napp.use(\n  middleware(compiler, {\n    // webpack-dev-middleware options\n  })\n);\n\napp.listen(3000, () => console.log(\"Example app listening on port 3000!\"));\n```\n\nSee [below](#other-servers) for an example of use with fastify.\n\n## Options\n\n|                    Name                     |           Type            |                    Default                    | Description                                                                                                          |\n| :-----------------------------------------: | :-----------------------: | :-------------------------------------------: | :------------------------------------------------------------------------------------------------------------------- |\n|          **[`methods`](#methods)**          |          `Array`          |              `[ 'GET', 'HEAD' ]`              | Allows to pass the list of HTTP request methods accepted by the middleware                                           |\n|          **[`headers`](#headers)**          | `Array\\|Object\\|Function` |                  `undefined`                  | Allows to pass custom HTTP headers on each request.                                                                  |\n|            **[`index`](#index)**            |     `Boolean\\|String`     |                 `index.html`                  | If `false` (but not `undefined`), the server will not respond to requests to the root URL.                           |\n|        **[`mimeTypes`](#mimetypes)**        |         `Object`          |                  `undefined`                  | Allows to register custom mime types or extension mappings.                                                          |\n|       **[`publicPath`](#publicpath)**       |         `String`          |  `output.publicPath` (from a configuration)   | The public path that the middleware is bound to.                                                                     |\n|            **[`stats`](#stats)**            | `Boolean\\|String\\|Object` |        `stats` (from a configuration)         | Stats options object or preset name.                                                                                 |\n| **[`serverSideRender`](#serversiderender)** |         `Boolean`         |                  `undefined`                  | Instructs the module to enable or disable the server-side rendering mode.                                            |\n|      **[`writeToDisk`](#writetodisk)**      |    `Boolean\\|Function`    |                    `false`                    | Instructs the module to write files to the configured location on disk as specified in your `webpack` configuration. |\n| **[`outputFileSystem`](#outputfilesystem)** |         `Object`          | [`memfs`](https://github.com/streamich/memfs) | Set the default file system which will be used by webpack as primary destination of generated files.                 |\n\nThe middleware accepts an `options` Object. The following is a property reference for the Object.\n\n### methods\n\nType: `Array`  \nDefault: `[ 'GET', 'HEAD' ]`\n\nThis property allows a user to pass the list of HTTP request methods accepted by the middleware\\*\\*.\n\n### headers\n\nType: `Array|Object|Function`\nDefault: `undefined`\n\nThis property allows a user to pass custom HTTP headers on each request.\neg. `{ \"X-Custom-Header\": \"yes\" }`\n\nor\n\n```js\nwebpackDevMiddleware(compiler, {\n  headers: () => {\n    return {\n      \"Last-Modified\": new Date(),\n    };\n  },\n});\n```\n\nor\n\n```js\nwebpackDevMiddleware(compiler, {\n  headers: (req, res, context) => {\n    res.setHeader(\"Last-Modified\", new Date());\n  },\n});\n```\n\nor\n\n```js\nwebpackDevMiddleware(compiler, {\n  headers: [\n    {\n      key: \"X-custom-header\"\n      value: \"foo\"\n    },\n    {\n      key: \"Y-custom-header\",\n      value: \"bar\"\n    }\n  ]\n  },\n});\n```\n\nor\n\n```js\nwebpackDevMiddleware(compiler, {\n  headers: () => [\n    {\n      key: \"X-custom-header\"\n      value: \"foo\"\n    },\n    {\n      key: \"Y-custom-header\",\n      value: \"bar\"\n    }\n  ]\n  },\n});\n```\n\n### index\n\nType: `Boolean|String`\nDefault: `index.html`\n\nIf `false` (but not `undefined`), the server will not respond to requests to the root URL.\n\n### mimeTypes\n\nType: `Object`  \nDefault: `undefined`\n\nThis property allows a user to register custom mime types or extension mappings.\neg. `mimeTypes: { phtml: 'text/html' }`.\n\nPlease see the documentation for [`mime-types`](https://github.com/jshttp/mime-types) for more information.\n\n### publicPath\n\nType: `String`\nDefault: `output.publicPath` (from a configuration)\n\nThe public path that the middleware is bound to.\n\n_Best Practice: use the same `publicPath` defined in your webpack config. For more information about `publicPath`, please see [the webpack documentation](https://webpack.js.org/guides/public-path)._\n\n### stats\n\nType: `Boolean|String|Object`\nDefault: `stats` (from a configuration)\n\nStats options object or preset name.\n\n### serverSideRender\n\nType: `Boolean`  \nDefault: `undefined`\n\nInstructs the module to enable or disable the server-side rendering mode.\nPlease see [Server-Side Rendering](#server-side-rendering) for more information.\n\n### writeToDisk\n\nType: `Boolean|Function`  \nDefault: `false`\n\nIf `true`, the option will instruct the module to write files to the configured location on disk as specified in your `webpack` config file.\n_Setting `writeToDisk: true` won't change the behavior of the `webpack-dev-middleware`, and bundle files accessed through the browser will still be served from memory._\nThis option provides the same capabilities as the [`WriteFilePlugin`](https://github.com/gajus/write-file-webpack-plugin/pulls).\n\nThis option also accepts a `Function` value, which can be used to filter which files are written to disk.\nThe function follows the same premise as [`Array#filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) in which a return value of `false` _will not_ write the file, and a return value of `true` _will_ write the file to disk. eg.\n\n```js\nconst webpack = require(\"webpack\");\nconst configuration = {\n  /* Webpack configuration */\n};\nconst compiler = webpack(configuration);\n\nmiddleware(compiler, {\n  writeToDisk: (filePath) => {\n    return /superman\\.css$/.test(filePath);\n  },\n});\n```\n\n### outputFileSystem\n\nType: `Object`  \nDefault: [memfs](https://github.com/streamich/memfs)\n\nSet the default file system which will be used by webpack as primary destination of generated files.\nThis option isn't affected by the [writeToDisk](#writeToDisk) option.\n\nYou have to provide `.join()` and `mkdirp` method to the `outputFileSystem` instance manually for compatibility with `webpack@4`.\n\nThis can be done simply by using `path.join`:\n\n```js\nconst webpack = require(\"webpack\");\nconst path = require(\"path\");\nconst myOutputFileSystem = require(\"my-fs\");\nconst mkdirp = require(\"mkdirp\");\n\nmyOutputFileSystem.join = path.join.bind(path); // no need to bind\nmyOutputFileSystem.mkdirp = mkdirp.bind(mkdirp); // no need to bind\n\nconst compiler = webpack({\n  /* Webpack configuration */\n});\n\nmiddleware(compiler, { outputFileSystem: myOutputFileSystem });\n```\n\n## API\n\n`webpack-dev-middleware` also provides convenience methods that can be use to\ninteract with the middleware at runtime:\n\n### `close(callback)`\n\nInstructs `webpack-dev-middleware` instance to stop watching for file changes.\n\n#### Parameters\n\n##### `callback`\n\nType: `Function`\nRequired: `No`\n\nA function executed once the middleware has stopped watching.\n\n```js\nconst express = require(\"express\");\nconst webpack = require(\"webpack\");\nconst compiler = webpack({\n  /* Webpack configuration */\n});\nconst middleware = require(\"webpack-dev-middleware\");\nconst instance = middleware(compiler);\n\nconst app = new express();\n\napp.use(instance);\n\nsetTimeout(() => {\n  // Says `webpack` to stop watch changes\n  instance.close();\n}, 1000);\n```\n\n### `invalidate(callback)`\n\nInstructs `webpack-dev-middleware` instance to recompile the bundle, e.g. after a change to the configuration.\n\n#### Parameters\n\n##### `callback`\n\nType: `Function`\nRequired: `No`\n\nA function executed once the middleware has invalidated.\n\n```js\nconst express = require(\"express\");\nconst webpack = require(\"webpack\");\nconst compiler = webpack({\n  /* Webpack configuration */\n});\nconst middleware = require(\"webpack-dev-middleware\");\nconst instance = middleware(compiler);\n\nconst app = new express();\n\napp.use(instance);\n\nsetTimeout(() => {\n  // After a short delay the configuration is changed and a banner plugin is added to the config\n  new webpack.BannerPlugin(\"A new banner\").apply(compiler);\n\n  // Recompile the bundle with the banner plugin:\n  instance.invalidate();\n}, 1000);\n```\n\n### `waitUntilValid(callback)`\n\nExecutes a callback function when the compiler bundle is valid, typically after\ncompilation.\n\n#### Parameters\n\n##### `callback`\n\nType: `Function`\nRequired: `No`\n\nA function executed when the bundle becomes valid.\nIf the bundle is valid at the time of calling, the callback is executed immediately.\n\n```js\nconst express = require(\"express\");\nconst webpack = require(\"webpack\");\nconst compiler = webpack({\n  /* Webpack configuration */\n});\nconst middleware = require(\"webpack-dev-middleware\");\nconst instance = middleware(compiler);\n\nconst app = new express();\n\napp.use(instance);\n\ninstance.waitUntilValid(() => {\n  console.log(\"Package is in a valid state\");\n});\n```\n\n### `getFilenameFromUrl(url)`\n\nGet filename from URL.\n\n#### Parameters\n\n##### `url`\n\nType: `String`\nRequired: `Yes`\n\nURL for the requested file.\n\n```js\nconst express = require(\"express\");\nconst webpack = require(\"webpack\");\nconst compiler = webpack({\n  /* Webpack configuration */\n});\nconst middleware = require(\"webpack-dev-middleware\");\nconst instance = middleware(compiler);\n\nconst app = new express();\n\napp.use(instance);\n\ninstance.waitUntilValid(() => {\n  const filename = instance.getFilenameFromUrl(\"/bundle.js\");\n\n  console.log(`Filename is ${filename}`);\n});\n```\n\n## Known Issues\n\n### Multiple Successive Builds\n\nWatching will frequently cause multiple compilations\nas the bundle changes during compilation. This is due in part to cross-platform\ndifferences in file watchers, so that webpack doesn't loose file changes when\nwatched files change rapidly. If you run into this situation, please make use of\nthe [`TimeFixPlugin`](https://github.com/egoist/time-fix-plugin).\n\n## Server-Side Rendering\n\n_Note: this feature is experimental and may be removed or changed completely in the future._\n\nIn order to develop an app using server-side rendering, we need access to the\n[`stats`](https://github.com/webpack/docs/wiki/node.js-api#stats), which is\ngenerated with each build.\n\nWith server-side rendering enabled, `webpack-dev-middleware` sets the `stats` to `res.locals.webpack.devMiddleware.context.stats`\nand the filesystem to `res.locals.webpack.devMiddleware.context.outputFileSystem` before invoking the next middleware,\nallowing a developer to render the page body and manage the response to clients.\n\n_Note: Requests for bundle files will still be handled by\n`webpack-dev-middleware` and all requests will be pending until the build\nprocess is finished with server-side rendering enabled._\n\nExample Implementation:\n\n```js\nconst express = require(\"express\");\nconst webpack = require(\"webpack\");\nconst compiler = webpack({\n  /* Webpack configuration */\n});\nconst isObject = require(\"is-object\");\nconst middleware = require(\"webpack-dev-middleware\");\n\nconst app = new express();\n\n// This function makes server rendering of asset references consistent with different webpack chunk/entry configurations\nfunction normalizeAssets(assets) {\n  if (isObject(assets)) {\n    return Object.values(assets);\n  }\n\n  return Array.isArray(assets) ? assets : [assets];\n}\n\napp.use(middleware(compiler, { serverSideRender: true }));\n\n// The following middleware would not be invoked until the latest build is finished.\napp.use((req, res) => {\n  const { devMiddleware } = res.locals.webpack;\n  const outputFileSystem = devMiddleware.context.outputFileSystem;\n  const jsonWebpackStats = devMiddleware.context.stats.toJson();\n  const { assetsByChunkName, outputPath } = jsonWebpackStats;\n\n  // Then use `assetsByChunkName` for server-side rendering\n  // For example, if you have only one main chunk:\n  res.send(`\n<html>\n  <head>\n    <title>My App</title>\n    <style>\n    ${normalizeAssets(assetsByChunkName.main)\n      .filter((path) => path.endsWith(\".css\"))\n      .map((path) => outputFileSystem.readFileSync(path.join(outputPath, path)))\n      .join(\"\\n\")}\n    </style>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    ${normalizeAssets(assetsByChunkName.main)\n      .filter((path) => path.endsWith(\".js\"))\n      .map((path) => `<script src=\"${path}\"></script>`)\n      .join(\"\\n\")}\n  </body>\n</html>\n  `);\n});\n```\n\n## Support\n\nWe do our best to keep Issues in the repository focused on bugs, features, and\nneeded modifications to the code for the module. Because of that, we ask users\nwith general support, \"how-to\", or \"why isn't this working\" questions to try one\nof the other support channels that are available.\n\nYour first-stop-shop for support for webpack-dev-server should by the excellent\n[documentation][docs-url] for the module. If you see an opportunity for improvement\nof those docs, please head over to the [webpack.js.org repo][wjo-url] and open a\npull request.\n\nFrom there, we encourage users to visit the [webpack Gitter chat][chat-url] and\ntalk to the fine folks there. If your quest for answers comes up dry in chat,\nhead over to [StackOverflow][stack-url] and do a quick search or open a new\nquestion. Remember; It's always much easier to answer questions that include your\n`webpack.config.js` and relevant files!\n\nIf you're twitter-savvy you can tweet [#webpack][hash-url] with your question\nand someone should be able to reach out and lend a hand.\n\nIf you have discovered a :bug:, have a feature suggestion, or would like to see\na modification, please feel free to create an issue on Github. _Note: The issue\ntemplate isn't optional, so please be sure not to remove it, and please fill it\nout completely._\n\n## Other servers\n\nExamples of use with other servers will follow here.\n\n### Fastify\n\nFastify interop will require the use of `fastify-express` instead of `middie` for providing middleware support. As the authors of `fastify-express` recommend, this should only be used as a stopgap while full Fastify support is worked on.\n\n```js\nconst fastify = require(\"fastify\")();\nconst webpack = require(\"webpack\");\nconst webpackConfig = require(\"./webpack.config.js\");\nconst devMiddleware = require(\"webpack-dev-middleware\");\n\nconst compiler = webpack(webpackConfig);\nconst { publicPath } = webpackConfig.output;\n\n(async () => {\n  await fastify.register(require(\"fastify-express\"));\n  await fastify.use(devMiddleware(compiler, { publicPath }));\n  await fastify.listen(3000);\n})();\n```\n\n## Contributing\n\nPlease take a moment to read our contributing guidelines if you haven't yet done so.\n\n[CONTRIBUTING](./CONTRIBUTING.md)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/webpack-dev-middleware.svg\n[npm-url]: https://npmjs.com/package/webpack-dev-middleware\n[node]: https://img.shields.io/node/v/webpack-dev-middleware.svg\n[node-url]: https://nodejs.org\n[deps]: https://david-dm.org/webpack/webpack-dev-middleware.svg\n[deps-url]: https://david-dm.org/webpack/webpack-dev-middleware\n[tests]: https://github.com/webpack/webpack-dev-middleware/workflows/webpack-dev-middleware/badge.svg\n[tests-url]: https://github.com/webpack/webpack-dev-middleware/actions\n[cover]: https://codecov.io/gh/webpack/webpack-dev-middleware/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack/webpack-dev-middleware\n[chat]: https://badges.gitter.im/webpack/webpack.svg\n[chat-url]: https://gitter.im/webpack/webpack\n[size]: https://packagephobia.com/badge?p=webpack-dev-middleware\n[size-url]: https://packagephobia.com/result?p=webpack-dev-middleware\n[docs-url]: https://webpack.js.org/guides/development/#using-webpack-dev-middleware\n[hash-url]: https://twitter.com/search?q=webpack\n[middleware-url]: https://github.com/webpack/webpack-dev-middleware\n[stack-url]: https://stackoverflow.com/questions/tagged/webpack-dev-middleware\n[wjo-url]: https://github.com/webpack/webpack.js.org\n",
    "licenseText": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz#eb7b39281cbce10e104eb2b8bf2b63fce49a3517",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-5.3.4.tgz",
    "hash": "eb7b39281cbce10e104eb2b8bf2b63fce49a3517",
    "integrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q==",
    "registry": "npm",
    "packageName": "webpack-dev-middleware",
    "cacheIntegrity": "sha512-BVdTqhhs+0IfoeAf7EoH5WE+exCmqGerHfDM0IL096Px60Tq2Mn9MAbnaGUe6HiMa41KMCYF19gyzZmBcq/o4Q== sha1-63s5KBy84Q4QTrK4vytj/OSaNRc="
  },
  "registry": "npm",
  "hash": "eb7b39281cbce10e104eb2b8bf2b63fce49a3517"
}