webpack-dev-middleware
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [4.2.0](https://github.com/webpack/webpack-dev-middleware/compare/v4.1.0...v4.2.0) (2021-05-10) | ||
### Features | ||
* allow the `headers` option to accept function ([#897](https://github.com/webpack/webpack-dev-middleware/issues/897)) ([966afb3](https://github.com/webpack/webpack-dev-middleware/commit/966afb3e331f09912bb9fc5f403e758f586b1a07)) | ||
## [4.1.0](https://github.com/webpack/webpack-dev-middleware/compare/v4.0.4...v4.1.0) (2021-01-15) | ||
@@ -7,0 +14,0 @@ |
@@ -52,5 +52,10 @@ "use strict"; | ||
const filename = (0, _getFilenameFromUrl.default)(context, req.url); | ||
const { | ||
let { | ||
headers | ||
} = context.options; | ||
if (typeof headers === 'function') { | ||
headers = headers(req, res, context); | ||
} | ||
let content; | ||
@@ -57,0 +62,0 @@ |
@@ -28,3 +28,10 @@ { | ||
"headers": { | ||
"type": "object" | ||
"anyOf": [ | ||
{ | ||
"type": "object" | ||
}, | ||
{ | ||
"instanceof": "Function" | ||
} | ||
] | ||
}, | ||
@@ -31,0 +38,0 @@ "publicPath": { |
{ | ||
"name": "webpack-dev-middleware", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "A development middleware for webpack", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">= 10.13.0" | ||
"node": ">= v10.23.3" | ||
}, | ||
@@ -24,3 +24,6 @@ "scripts": { | ||
"lint": "npm-run-all -l -p \"lint:**\"", | ||
"prepare": "npm run build", | ||
"fix:prettier": "npm run lint:prettier -- --write", | ||
"fix:js": "npm run lint:js -- --fix", | ||
"fix": "npm-run-all fix:js fix:prettier", | ||
"prepare": "husky install && npm run build", | ||
"build": "del dist && babel src -d dist --copy-files", | ||
@@ -33,4 +36,3 @@ "release": "standard-version", | ||
"pretest": "npm run lint", | ||
"test": "npm run test:coverage", | ||
"defaults": "webpack-defaults" | ||
"test": "npm run test:coverage" | ||
}, | ||
@@ -44,6 +46,6 @@ "files": [ | ||
"dependencies": { | ||
"colorette": "^1.2.1", | ||
"mem": "^8.0.0", | ||
"memfs": "^3.2.0", | ||
"mime-types": "^2.1.28", | ||
"colorette": "^1.2.2", | ||
"mem": "^8.1.1", | ||
"memfs": "^3.2.2", | ||
"mime-types": "^2.1.30", | ||
"range-parser": "^1.2.1", | ||
@@ -53,11 +55,10 @@ "schema-utils": "^3.0.0" | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"@babel/preset-env": "^7.12.11", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@webpack-contrib/defaults": "^6.3.0", | ||
"@babel/cli": "^7.13.16", | ||
"@babel/core": "^7.14.0", | ||
"@babel/preset-env": "^7.14.1", | ||
"@commitlint/cli": "^12.1.1", | ||
"@commitlint/config-conventional": "^12.1.1", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"babel-jest": "^26.6.3", | ||
"chokidar": "^3.5.0", | ||
"chokidar": "^3.5.1", | ||
"connect": "^3.7.0", | ||
@@ -68,18 +69,18 @@ "cross-env": "^7.0.3", | ||
"del-cli": "^3.0.1", | ||
"eslint": "^7.17.0", | ||
"eslint-config-prettier": "^7.1.0", | ||
"eslint": "^7.26.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"execa": "^5.0.0", | ||
"express": "^4.17.1", | ||
"file-loader": "^6.2.0", | ||
"husky": "^4.3.7", | ||
"husky": "^6.0.0", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.3", | ||
"lint-staged": "^10.5.4", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.2.1", | ||
"standard-version": "^9.1.0", | ||
"prettier": "^2.3.0", | ||
"standard-version": "^9.3.0", | ||
"strip-ansi": "^6.0.0", | ||
"supertest": "^6.0.1", | ||
"webpack": "^5.14.0" | ||
"supertest": "^6.1.3", | ||
"webpack": "^5.36.2" | ||
}, | ||
@@ -86,0 +87,0 @@ "keywords": [ |
@@ -73,3 +73,3 @@ <div align="center"> | ||
Type: `Object` | ||
Type: `Object|Function` | ||
Default: `undefined` | ||
@@ -80,2 +80,24 @@ | ||
or | ||
```js | ||
webpackDevMiddleware(compiler, { | ||
headers: () => { | ||
return { | ||
'Last-Modified': new Date(), | ||
}; | ||
}, | ||
}); | ||
``` | ||
or | ||
```js | ||
webpackDevMiddleware(compiler, { | ||
headers: (req, res, context) => { | ||
res.setHeader('Last-Modified', new Date()); | ||
}, | ||
}); | ||
``` | ||
### index | ||
@@ -82,0 +104,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51058
29
647
421
Updatedcolorette@^1.2.2
Updatedmem@^8.1.1
Updatedmemfs@^3.2.2
Updatedmime-types@^2.1.30