webpack-dev-middleware
Advanced tools
Comparing version 3.7.1 to 3.7.2
@@ -5,2 +5,10 @@ # Changelog | ||
### [3.7.2](https://github.com/webpack/webpack-dev-middleware/compare/v3.7.1...v3.7.2) (2019-09-28) | ||
### Bug Fixes | ||
* compatibility with webpack@5 ([#473](https://github.com/webpack/webpack-dev-middleware/issues/473)) ([63da9ae](https://github.com/webpack/webpack-dev-middleware/commit/63da9ae)) | ||
* memory leak when `writeToDisk` used ([#472](https://github.com/webpack/webpack-dev-middleware/issues/472)) ([6730076](https://github.com/webpack/webpack-dev-middleware/commit/6730076)) | ||
### [3.7.1](https://github.com/webpack/webpack-dev-middleware/compare/v3.7.0...v3.7.1) (2019-09-03) | ||
@@ -7,0 +15,0 @@ |
18
index.js
@@ -30,12 +30,2 @@ 'use strict'; | ||
if (options.lazy) { | ||
if (typeof options.filename === 'string') { | ||
const filename = options.filename | ||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&') // eslint-disable-line no-useless-escape | ||
.replace(/\\\[[a-z]+\\\]/gi, '.+'); | ||
options.filename = new RegExp(`^[/]{0,1}${filename}$`); | ||
} | ||
} | ||
// defining custom MIME type | ||
@@ -61,2 +51,10 @@ if (options.mimeTypes) { | ||
} else { | ||
if (typeof options.filename === 'string') { | ||
const filename = options.filename | ||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&') // eslint-disable-line no-useless-escape | ||
.replace(/\\\[[a-z]+\\\]/gi, '.+'); | ||
options.filename = new RegExp(`^[/]{0,1}${filename}$`); | ||
} | ||
context.state = true; | ||
@@ -63,0 +61,0 @@ } |
@@ -18,23 +18,35 @@ 'use strict'; | ||
compiler.hooks.emit.tap('WebpackDevMiddleware', (compilation) => { | ||
if (compiler.hasWebpackDevMiddlewareAssetEmittedCallback) { | ||
return; | ||
} | ||
compiler.hooks.assetEmitted.tapAsync( | ||
'WebpackDevMiddleware', | ||
(file, content, callback) => { | ||
let targetFile = file; | ||
(file, info, callback) => { | ||
let targetPath = null; | ||
let content = null; | ||
const queryStringIdx = targetFile.indexOf('?'); | ||
// webpack@5 | ||
if (info.compilation) { | ||
({ targetPath, content } = info); | ||
} else { | ||
let targetFile = file; | ||
if (queryStringIdx >= 0) { | ||
targetFile = targetFile.substr(0, queryStringIdx); | ||
} | ||
const queryStringIdx = targetFile.indexOf('?'); | ||
let { outputPath } = compiler; | ||
if (queryStringIdx >= 0) { | ||
targetFile = targetFile.substr(0, queryStringIdx); | ||
} | ||
// TODO Why? Need remove in future major release | ||
if (outputPath === '/') { | ||
outputPath = compiler.context; | ||
} | ||
let { outputPath } = compiler; | ||
outputPath = compilation.getPath(outputPath, {}); | ||
// TODO Why? Need remove in future major release | ||
if (outputPath === '/') { | ||
outputPath = compiler.context; | ||
} | ||
const targetPath = path.join(outputPath, targetFile); | ||
outputPath = compilation.getPath(outputPath, {}); | ||
content = info; | ||
targetPath = path.join(outputPath, targetFile); | ||
} | ||
@@ -78,2 +90,3 @@ const { writeToDisk: filter } = context.options; | ||
); | ||
compiler.hasWebpackDevMiddlewareAssetEmittedCallback = true; | ||
}); | ||
@@ -80,0 +93,0 @@ } |
{ | ||
"name": "webpack-dev-middleware", | ||
"version": "3.7.1", | ||
"version": "3.7.2", | ||
"description": "A development middleware for webpack", | ||
@@ -41,7 +41,7 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@babel/preset-env": "^7.5.5", | ||
"@commitlint/cli": "^8.1.0", | ||
"@commitlint/config-conventional": "^8.1.0", | ||
"@babel/cli": "^7.6.2", | ||
"@babel/core": "^7.6.2", | ||
"@babel/preset-env": "^7.6.2", | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"@webpack-contrib/defaults": "^5.0.2", | ||
@@ -54,15 +54,15 @@ "@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
"del-cli": "^1.1.0", | ||
"eslint": "^6.3.0", | ||
"eslint": "^6.4.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"express": "^4.17.1", | ||
"file-loader": "^4.2.0", | ||
"husky": "^3.0.5", | ||
"husky": "^3.0.7", | ||
"jest": "^24.9.0", | ||
"jest-junit": "^8.0.0", | ||
"lint-staged": "^9.2.5", | ||
"lint-staged": "^9.4.0", | ||
"prettier": "^1.18.2", | ||
"standard-version": "^7.0.0", | ||
"supertest": "^4.0.2", | ||
"webpack": "^4.39.3" | ||
"webpack": "^4.41.0" | ||
}, | ||
@@ -69,0 +69,0 @@ "keywords": [ |
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
40311
583