webpack-dev-middleware
Advanced tools
Comparing version 1.8.1 to 1.8.2
@@ -0,1 +1,12 @@ | ||
# 1.8.2 (2016-09-23) | ||
- Add a nice error message when `output.path` in the webpack config is relative. | ||
- Expose stats when using the advanced API ([#127](https://github.com/webpack/webpack-dev-middleware/pull/127)). | ||
- Make log & warn functions replaceable ([#124](https://github.com/webpack/webpack-dev-middleware/pull/124)). | ||
- Fix protocol-relative urls with `publicPath` ([#129](https://github.com/webpack/webpack-dev-middleware/pull/129)). | ||
# 1.8.1 (2016-09-18) | ||
- Fix exception thrown when using webpack array config ([#125](https://github.com/webpack/webpack-dev-middleware/issues/125)). | ||
# 1.8.0 (2016-09-17) | ||
@@ -2,0 +13,0 @@ |
@@ -8,3 +8,3 @@ var pathJoin = require("./PathJoin"); | ||
// localPrefix is the folder our bundle should be in | ||
var localPrefix = urlParse(publicPath || "/"); | ||
var localPrefix = urlParse(publicPath || "/", false, true); | ||
var urlObject = urlParse(url); | ||
@@ -11,0 +11,0 @@ |
@@ -8,2 +8,3 @@ /* | ||
var parseRange = require("range-parser"); | ||
var path = require("path"); | ||
var getFilenameFromUrl = require("./lib/GetFilenameFromUrl"); | ||
@@ -26,9 +27,9 @@ var pathJoin = require("./lib/PathJoin"); | ||
if(displayStats) { | ||
console.log(stats.toString(options.stats)); | ||
options.log(stats.toString(options.stats)); | ||
} | ||
if(!options.noInfo && !options.quiet) { | ||
console.info("webpack: bundle is now VALID."); | ||
options.log("webpack: bundle is now VALID."); | ||
} | ||
} else { | ||
console.info("webpack: bundle is now INVALID."); | ||
options.log("webpack: bundle is now INVALID."); | ||
} | ||
@@ -43,3 +44,3 @@ }; | ||
// TODO remove this in next major version | ||
console.warn("options.watchDelay is deprecated: Use 'options.watchOptions.aggregateTimeout' instead"); | ||
options.warn("options.watchDelay is deprecated: Use 'options.watchOptions.aggregateTimeout' instead"); | ||
options.watchOptions.aggregateTimeout = options.watchDelay; | ||
@@ -59,2 +60,7 @@ } | ||
if(typeof options.reporter !== "function") options.reporter = defaultReporter; | ||
if(typeof options.log !== "function") options.log = console.log.bind(console); | ||
if(typeof options.warn !== "function") options.warn = console.warn.bind(console); | ||
if(typeof compiler.outputPath === "string" && !path.isAbsolute(compiler.outputPath)) { | ||
throw new Error("`output.path` needs to be an absolute path or `/`."); | ||
} | ||
@@ -91,3 +97,3 @@ // store our files in memory | ||
cbs.forEach(function continueBecauseBundleAvailable(cb) { | ||
cb(); | ||
cb(stats); | ||
}); | ||
@@ -136,5 +142,5 @@ }); | ||
function ready(fn, req) { | ||
if(state) return fn(); | ||
if(state) return fn(webpackStats); | ||
if(!options.noInfo && !options.quiet) | ||
console.log("webpack: wait until bundle finished: " + (req.url || fn.name)); | ||
options.log("webpack: wait until bundle finished: " + (req.url || fn.name)); | ||
callbacks.push(fn); | ||
@@ -164,3 +170,3 @@ } | ||
function handleRangeHeaders(content, req, res) { | ||
res.setHeader('Accept-Ranges', 'bytes'); | ||
res.setHeader("Accept-Ranges", "bytes"); | ||
if(req.headers.range) { | ||
@@ -171,3 +177,3 @@ var ranges = parseRange(content.length, req.headers.range); | ||
if(-1 == ranges) { | ||
res.setHeader('Content-Range', 'bytes */' + content.length); | ||
res.setHeader("Content-Range", "bytes */" + content.length); | ||
res.statusCode = 416; | ||
@@ -182,4 +188,4 @@ } | ||
res.setHeader( | ||
'Content-Range', | ||
'bytes ' + ranges[0].start + '-' + ranges[0].end + '/' + length | ||
"Content-Range", | ||
"bytes " + ranges[0].start + "-" + ranges[0].end + "/" + length | ||
); | ||
@@ -203,3 +209,3 @@ | ||
if(req.method !== 'GET') { | ||
if(req.method !== "GET") { | ||
return goNext(); | ||
@@ -206,0 +212,0 @@ } |
{ | ||
"name": "webpack-dev-middleware", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Offers a dev middleware for webpack, which arguments a live bundle to a directory", |
12570
278