Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-hot-middleware

Package Overview
Dependencies
Maintainers
1
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.6.4 to 2.7.0

2

client.js

@@ -110,3 +110,3 @@ /*eslint-env browser*/

} else if (obj.action == "built") {
if (options.log) console.log("[HMR] bundle rebuilt in " + obj.time + "ms");
if (options.log) console.log("[HMR] bundle " + (obj.name ? obj.name + " " : "") + "rebuilt in " + obj.time + "ms");
if (obj.errors.length > 0) {

@@ -113,0 +113,0 @@ problems('errors', obj);

@@ -8,3 +8,3 @@ module.exports = webpackHotMiddleware;

opts = opts || {};
opts.log = typeof opts.log == 'undefined' ? console.log : opts.log;
opts.log = typeof opts.log == 'undefined' ? console.log.bind(console) : opts.log;
opts.path = opts.path || '/__webpack_hmr';

@@ -18,14 +18,22 @@ opts.heartbeat = opts.heartbeat || 10 * 1000;

});
compiler.plugin("done", function(stats) {
stats = stats.toJson();
if (opts.log) {
opts.log("webpack built " + stats.hash + " in " + stats.time + "ms");
}
eventStream.publish({
action: "built",
time: stats.time,
hash: stats.hash,
warnings: stats.warnings || [],
errors: stats.errors || [],
modules: buildModuleMap(stats.modules)
compiler.plugin("done", function(statsResult) {
statsResult = statsResult.toJson();
//for multi-compiler, stats will be an object with a 'children' array of stats
var children = statsResult.children && statsResult.children.length ?
statsResult.children : [statsResult];
children.forEach(function(stats) {
if (opts.log) {
opts.log("webpack built " + (stats.name ? stats.name + " " : "") +
stats.hash + " in " + stats.time + "ms");
}
eventStream.publish({
name: stats.name,
action: "built",
time: stats.time,
hash: stats.hash,
warnings: stats.warnings || [],
errors: stats.errors || [],
modules: buildModuleMap(stats.modules)
});
});

@@ -32,0 +40,0 @@ });

{
"name": "webpack-hot-middleware",
"version": "2.6.4",
"version": "2.7.0",
"description": "Webpack hot reloading you can attach to your own server",

@@ -5,0 +5,0 @@ "main": "middleware.js",

@@ -22,3 +22,6 @@ # Webpack Hot Middleware

plugins: [
// Webpack 1.0
new webpack.optimize.OccurenceOrderPlugin(),
// Webpack 2.0 fixed this mispelling
// new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),

@@ -28,2 +31,3 @@ new webpack.NoErrorsPlugin()

```
Occurence ensures consistent build hashes, hot module replacement is

@@ -30,0 +34,0 @@ somewhat self-explanatory, no errors is used to handle errors more cleanly.

@@ -87,2 +87,36 @@ /* eslint-env mocha */

});
it("should notify clients when bundle is complete (multicompiler)", function(done) {
request('/__webpack_hmr')
.end(function(err, res) {
if (err) return done(err);
res.on('data', verify);
compiler.emit("done", stats({
children: [
{
time: 100,
hash: "deadbeeffeddad",
warnings: false,
errors: false,
modules: []
},
{
time: 150,
hash: "gwegawefawefawef",
warnings: false,
errors: false,
modules: []
}
]
}));
function verify() {
assert.equal(res.events.length, 1);
var event = JSON.parse(res.events[0].substring(5));
assert.equal(event.action, "built");
done();
}
});
});
it("should have tests on the payload of bundle complete");

@@ -89,0 +123,0 @@ it("should notify all clients", function(done) {

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