webpack-dev-middleware
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -21,2 +21,3 @@ 'use strict'; | ||
}, | ||
watchOffset: 11000, | ||
watchOptions: { | ||
@@ -23,0 +24,0 @@ aggregateTimeout: 200 |
@@ -97,8 +97,25 @@ 'use strict'; | ||
context.rebuild = rebuild; | ||
context.compiler.plugin('done', done); | ||
context.compiler.plugin('invalid', invalid); | ||
context.compiler.plugin('watch-run', invalid); | ||
context.compiler.plugin('run', invalid); | ||
context.compiler.plugin('done', (stats) => { | ||
// clean up the time offset | ||
if (options.watchOffset > 0) { | ||
stats.startTime -= options.watchOffset; | ||
} | ||
done(stats); | ||
}); | ||
context.compiler.plugin('watch-run', (watcher, callback) => { | ||
// apply a fix for compiler.watch, if watchOffset is greater than 0: | ||
// ff0000-ad-tech/wp-plugin-watch-offset | ||
// offset start-time | ||
if (options.watchOffset > 0) { | ||
watcher.startTime += options.watchOffset; | ||
} | ||
invalid(watcher, callback); | ||
}); | ||
return context; | ||
}; |
@@ -18,2 +18,6 @@ 'use strict'; | ||
let compilerPublicPath; | ||
// the path portion of compilerPublicPath | ||
let compilerPublicPathBase; | ||
for (let i = 0; i < compilers.length; i++) { | ||
@@ -23,3 +27,12 @@ compilerPublicPath = compilers[i].options | ||
&& compilers[i].options.output.publicPath; | ||
if (url.indexOf(compilerPublicPath) === 0) { | ||
if (compilerPublicPath.indexOf('/') === 0) { | ||
compilerPublicPathBase = compilerPublicPath; | ||
} else { | ||
// handle the case where compilerPublicPath is a URL with hostname | ||
compilerPublicPathBase = parse(compilerPublicPath).pathname; | ||
} | ||
// check the url vs the path part of the compilerPublicPath | ||
if (url.indexOf(compilerPublicPathBase) === 0) { | ||
return { | ||
@@ -26,0 +39,0 @@ publicPath: compilerPublicPath, |
{ | ||
"name": "webpack-dev-middleware", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "A development middleware for webpack", | ||
@@ -34,3 +34,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"webpack": "^2.2.0 || ^3.0.0 || ^4.0.0-alpha" | ||
"webpack": "^2.2.0 || ^3.0.0 || ^4.0.0-alpha || ^4.0.0-beta || ^4.0.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "dependencies": { |
@@ -67,3 +67,3 @@ <div align="center"> | ||
Type: `Object` | ||
Type: `Object` | ||
Default: `undefined` | ||
@@ -76,3 +76,3 @@ | ||
Type: `String` | ||
Type: `String` | ||
Default: `undefined` | ||
@@ -87,3 +87,3 @@ | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `undefined` | ||
@@ -96,9 +96,10 @@ | ||
Type: `Object` | ||
Default: [`log`](/webpack/webpack-dev-middleware/blob/master/lib/log.js) | ||
Type: `Object` | ||
Default: [`webpack-log`](https://github.com/webpack-contrib/webpack-log/blob/master/index.js) | ||
In the rare event that a user would like to provide a custom logging interface, | ||
this property allows the user to assign one. The module leverages | ||
[`loglevel`](https://github.com/pimterry/loglevel#documentation) | ||
for logging management by default, and any custom logger must adhere to the same | ||
[`webpack-log`](https://github.com/webpack-contrib/webpack-log#readme) | ||
for creating the [`loglevelnext`](https://github.com/shellscape/loglevelnext#readme) | ||
logging management by default. Any custom logger must adhere to the same | ||
exports for compatibility. Specifically, all custom loggers must have the | ||
@@ -117,3 +118,3 @@ following exported methods at a minimum: | ||
Type: `String` | ||
Type: `String` | ||
Default: `'info'` | ||
@@ -133,3 +134,3 @@ | ||
console. Setting `logLevel: 'silent'` will hide all console output. The module | ||
leverages [`loglevel`](https://github.com/pimterry/loglevel#documentation) | ||
leverages [`webpack-log`](https://github.com/webpack-contrib/webpack-log#readme) | ||
for logging management, and more information can be found on its page. | ||
@@ -139,3 +140,3 @@ | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -148,3 +149,3 @@ | ||
Type: `Object` | ||
Type: `Object` | ||
Default: `null` | ||
@@ -158,3 +159,3 @@ | ||
Type: `String` | ||
Type: `String` | ||
_Required_ | ||
@@ -167,7 +168,7 @@ | ||
Type: `Object` | ||
Type: `Object` | ||
Default: `undefined` | ||
Allows users to provide a custom reporter to handle logging within the module. | ||
Please see the [default reporter](/webpack/webpack-dev-middleware/blob/master/lib/reporter.js) | ||
Please see the [default reporter](/lib/reporter.js) | ||
for an example. | ||
@@ -177,3 +178,3 @@ | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `undefined` | ||
@@ -185,3 +186,4 @@ | ||
### stats | ||
Type: `Object` | ||
Type: `Object` | ||
Default: `{ context: process.cwd() }` | ||
@@ -193,5 +195,20 @@ | ||
### watchOffset | ||
Type: `Number` | ||
Default: `11000` | ||
Watching (by means of `lazy: false`) will frequently cause multiple compilations | ||
as the bundle changes during compilation. This is due in part to cross-platform | ||
differences in file watchers, so that webpack doesn't loose file changes when | ||
watched files change rapidly. Since that scenario is more an edge case than not, | ||
this option serves as a means to prevent multiple needless, identical compilations | ||
by advancing start-time of a watcher by a number of seconds, which keeps generated | ||
files from triggering the watch cycle. | ||
_To disable this prevention, set this option to a value of `0`._ | ||
### watchOptions | ||
Type: `Object` | ||
Type: `Object` | ||
Default: `{ aggregateTimeout: 200 }` | ||
@@ -399,3 +416,3 @@ | ||
[docs-url]: https://webpack.js.org/configuration/dev-middleware/#devmiddleware | ||
[docs-url]: https://webpack.js.org/guides/development/#using-webpack-dev-middleware | ||
[hash-url]: https://twitter.com/search?q=webpack | ||
@@ -402,0 +419,0 @@ [middleware-url]: https://github.com/webpack/webpack-dev-middleware |
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
28404
426
409