webpack-hot-middleware
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -100,4 +100,5 @@ /*eslint-env browser*/ | ||
var processUpdate = require('./processUpdate'); | ||
var processUpdate = require('./process-update'); | ||
var customHandler; | ||
function processMessage(obj) { | ||
@@ -119,3 +120,13 @@ if (obj.action == "building") { | ||
} | ||
} else if (customHandler) { | ||
customHandler(obj); | ||
} | ||
} | ||
if (module) { | ||
module.exports = { | ||
subscribe: function subscribe(handler) { | ||
customHandler = handler; | ||
} | ||
}; | ||
} |
@@ -31,6 +31,8 @@ module.exports = webpackHotMiddleware; | ||
}); | ||
return function(req, res, next) { | ||
var middleware = function(req, res, next) { | ||
if (!pathMatch(req.url, opts.path)) return next(); | ||
eventStream.handler(req, res); | ||
}; | ||
middleware.publish = eventStream.publish; | ||
return middleware; | ||
} | ||
@@ -57,2 +59,3 @@ | ||
'Content-Type': 'text/event-stream;charset=utf-8', | ||
'Transfer-Encoding': 'chunked', | ||
'Cache-Control': 'no-cache, no-transform', | ||
@@ -59,0 +62,0 @@ 'Connection': 'keep-alive' |
{ | ||
"name": "webpack-hot-middleware", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "Webpack hot reloading you can attach to your own server", | ||
"main": "middleware.js", | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"travis": "istanbul cover _mocha --" | ||
}, | ||
@@ -19,4 +20,9 @@ "repository": { | ||
"devDependencies": { | ||
"mocha": "^2.3.2" | ||
"express": "^4.13.3", | ||
"mocha": "^2.3.2", | ||
"supertest": "^1.1.0", | ||
"sinon": "^1.12.2", | ||
"coveralls": "^2.11.2", | ||
"istanbul": "^0.3.14" | ||
} | ||
} |
@@ -5,2 +5,4 @@ # Webpack Hot Middleware | ||
[![npm version](https://img.shields.io/npm/v/webpack-hot-middleware.svg)](https://www.npmjs.com/package/webpack-hot-middleware) [![Build Status](https://img.shields.io/travis/glenjamin/webpack-hot-middleware/master.svg)](https://travis-ci.org/glenjamin/webpack-hot-middleware) [![Coverage Status](https://coveralls.io/repos/glenjamin/webpack-hot-middleware/badge.svg?branch=master)](https://coveralls.io/r/glenjamin/webpack-hot-middleware?branch=master) ![MIT Licensed](https://img.shields.io/npm/l/webpack-hot-middleware.svg) | ||
## Installation & Usage | ||
@@ -7,0 +9,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
29148
21
642
108
6
2