2017-05-03 15:35:00 +02:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
|
|
|
module.exports = function(updatedModules, renewedModules) {
|
|
|
|
var unacceptedModules = updatedModules.filter(function(moduleId) {
|
|
|
|
return renewedModules && renewedModules.indexOf(moduleId) < 0;
|
|
|
|
});
|
2017-08-14 05:01:11 +02:00
|
|
|
var log = require("./log");
|
2017-05-03 15:35:00 +02:00
|
|
|
|
|
|
|
if(unacceptedModules.length > 0) {
|
2017-08-14 05:01:11 +02:00
|
|
|
log("warning", "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)");
|
2017-05-03 15:35:00 +02:00
|
|
|
unacceptedModules.forEach(function(moduleId) {
|
2017-08-14 05:01:11 +02:00
|
|
|
log("warning", "[HMR] - " + moduleId);
|
2017-05-03 15:35:00 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!renewedModules || renewedModules.length === 0) {
|
2017-08-14 05:01:11 +02:00
|
|
|
log("info", "[HMR] Nothing hot updated.");
|
2017-05-03 15:35:00 +02:00
|
|
|
} else {
|
2017-08-14 05:01:11 +02:00
|
|
|
log("info", "[HMR] Updated modules:");
|
2017-05-03 15:35:00 +02:00
|
|
|
renewedModules.forEach(function(moduleId) {
|
2017-08-14 05:01:11 +02:00
|
|
|
if(typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
|
|
|
|
var parts = moduleId.split("!");
|
|
|
|
log.groupCollapsed("info", "[HMR] - " + parts.pop());
|
|
|
|
log("info", "[HMR] - " + moduleId);
|
|
|
|
log.groupEnd("info");
|
|
|
|
} else {
|
|
|
|
log("info", "[HMR] - " + moduleId);
|
|
|
|
}
|
2017-05-03 15:35:00 +02:00
|
|
|
});
|
|
|
|
var numberIds = renewedModules.every(function(moduleId) {
|
|
|
|
return typeof moduleId === "number";
|
|
|
|
});
|
|
|
|
if(numberIds)
|
2017-08-14 05:01:11 +02:00
|
|
|
log("info", "[HMR] Consider using the NamedModulesPlugin for module names.");
|
2017-05-03 15:35:00 +02:00
|
|
|
}
|
|
|
|
};
|