webpack-dev-middleware
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -5,2 +5,3 @@ /* | ||
*/ | ||
var path = require("path"); | ||
var MemoryFileSystem = require("memory-fs"); | ||
@@ -15,10 +16,2 @@ var mime = require("mime"); | ||
if(!options.stats.context) options.stats.context = process.cwd(); | ||
if(options.lazy) { | ||
if(typeof options.filename === "string") { | ||
var str = options.filename | ||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") | ||
.replace(/\\\[[a-z]+\\\]/ig, ".+"); | ||
options.filename = new RegExp("^" + str + "$"); | ||
} | ||
} | ||
@@ -119,4 +112,4 @@ // store our files in memory | ||
if(url.indexOf(localPrefix) !== 0) { | ||
if(/^https?:\/\//.test(localPrefix)) { | ||
localPrefix = "/" + localPrefix.replace(/^https?:\/\/[^\/]+\//, ""); | ||
if(/^(https?:)?\/\//.test(localPrefix)) { | ||
localPrefix = "/" + localPrefix.replace(/^(https?:)?\/\/[^\/]+\//, ""); | ||
// fast exit if another directory requested | ||
@@ -138,5 +131,5 @@ if(url.indexOf(localPrefix) !== 0) return false; | ||
if (filename === false) return next(); | ||
// in lazy mode, rebuild on bundle request | ||
if(options.lazy && (!options.filename || options.filename.test(filename))) | ||
if(options.lazy && filename === pathJoin(compiler.outputPath, options.filename)) | ||
rebuild(); | ||
@@ -147,3 +140,11 @@ // delay the request until we have a vaild bundle | ||
var stat = fs.statSync(filename); | ||
if(!stat.isFile()) throw "next"; | ||
if(!stat.isFile()) { | ||
if (stat.isDirectory()) { | ||
filename = path.join(filename, "index.html"); | ||
stat = fs.statSync(filename); | ||
if(!stat.isFile()) throw "next"; | ||
} else { | ||
throw "next"; | ||
} | ||
} | ||
} catch(e) { | ||
@@ -150,0 +151,0 @@ return next(); |
{ | ||
"name": "webpack-dev-middleware", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Offers a dev middleware for webpack, which arguments a live bundle to a directory", |
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
155
7417