Projekt

Obecné

Profil

Stáhnout (1.27 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
/*
2
	MIT License http://www.opensource.org/licenses/mit-license.php
3
	Author Tobias Koppers @sokra
4
*/
5
module.exports = function(updatedModules, renewedModules) {
6
	var unacceptedModules = updatedModules.filter(function(moduleId) {
7
		return renewedModules && renewedModules.indexOf(moduleId) < 0;
8
	});
9
	var log = require("./log");
10
11
	if (unacceptedModules.length > 0) {
12
		log(
13
			"warning",
14
			"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
15
		);
16
		unacceptedModules.forEach(function(moduleId) {
17
			log("warning", "[HMR]  - " + moduleId);
18
		});
19
	}
20
21
	if (!renewedModules || renewedModules.length === 0) {
22
		log("info", "[HMR] Nothing hot updated.");
23
	} else {
24
		log("info", "[HMR] Updated modules:");
25
		renewedModules.forEach(function(moduleId) {
26
			if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
27
				var parts = moduleId.split("!");
28
				log.groupCollapsed("info", "[HMR]  - " + parts.pop());
29
				log("info", "[HMR]  - " + moduleId);
30
				log.groupEnd("info");
31
			} else {
32
				log("info", "[HMR]  - " + moduleId);
33
			}
34
		});
35
		var numberIds = renewedModules.every(function(moduleId) {
36
			return typeof moduleId === "number";
37
		});
38
		if (numberIds)
39
			log(
40
				"info",
41
				"[HMR] Consider using the NamedModulesPlugin for module names."
42
			);
43
	}
44
};