Socket
Socket
Sign inDemoInstall

webpack-hot-middleware

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-hot-middleware - npm Package Compare versions

Comparing version 2.23.1 to 2.24.0

27

middleware.js

@@ -14,2 +14,3 @@ module.exports = webpackHotMiddleware;

var latestStats = null;
var closed = false;

@@ -24,2 +25,3 @@ if (compiler.hooks) {

function onInvalid() {
if (closed) return;
latestStats = null;

@@ -30,2 +32,3 @@ if (opts.log) opts.log("webpack building...");

function onDone(statsResult) {
if (closed) return;
// Keep hold of latest stats so they can be propagated to new clients

@@ -36,2 +39,3 @@ latestStats = statsResult;

var middleware = function(req, res, next) {
if (closed) return next();
if (!pathMatch(req.url, opts.path)) return next();

@@ -45,3 +49,14 @@ eventStream.handler(req, res);

};
middleware.publish = eventStream.publish;
middleware.publish = function(payload) {
if (closed) return;
eventStream.publish(payload);
};
middleware.close = function() {
if (closed) return;
// Can't remove compiler plugins, so we just set a flag and noop if closed
// https://github.com/webpack/tapable/issues/32#issuecomment-350644466
closed = true;
eventStream.close();
eventStream = null;
};
return middleware;

@@ -58,3 +73,3 @@ }

}
setInterval(function heartbeatTick() {
var interval = setInterval(function heartbeatTick() {
everyClient(function(client) {

@@ -65,2 +80,9 @@ client.write("data: \uD83D\uDC93\n\n");

return {
close: function() {
clearInterval(interval);
everyClient(function(client) {
if (!client.finished) client.end();
});
clients = {};
},
handler: function(req, res) {

@@ -89,2 +111,3 @@ var headers = {

req.on("close", function(){
if (!res.finished) res.end();
delete clients[id];

@@ -91,0 +114,0 @@ });

2

package.json
{
"name": "webpack-hot-middleware",
"version": "2.23.1",
"version": "2.24.0",
"description": "Webpack hot reloading you can attach to your own server",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc