diff options
Diffstat (limited to 'node_modules/webpack/hot')
-rw-r--r-- | node_modules/webpack/hot/.eslintrc | 9 | ||||
-rw-r--r-- | node_modules/webpack/hot/dev-server.js | 114 | ||||
-rw-r--r-- | node_modules/webpack/hot/emitter.js | 4 | ||||
-rw-r--r-- | node_modules/webpack/hot/log-apply-result.js | 82 | ||||
-rw-r--r-- | node_modules/webpack/hot/log.js | 91 | ||||
-rw-r--r-- | node_modules/webpack/hot/only-dev-server.js | 176 | ||||
-rw-r--r-- | node_modules/webpack/hot/poll.js | 74 | ||||
-rw-r--r-- | node_modules/webpack/hot/signal.js | 113 |
8 files changed, 361 insertions, 302 deletions
diff --git a/node_modules/webpack/hot/.eslintrc b/node_modules/webpack/hot/.eslintrc deleted file mode 100644 index cceb1047b..000000000 --- a/node_modules/webpack/hot/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{
- "env": {
- "node": true
- },
- "rules": {
- "node/exports-style": ["off"]
- }
-
-}
diff --git a/node_modules/webpack/hot/dev-server.js b/node_modules/webpack/hot/dev-server.js index 95894674d..682a47f84 100644 --- a/node_modules/webpack/hot/dev-server.js +++ b/node_modules/webpack/hot/dev-server.js @@ -1,53 +1,61 @@ -/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-/*globals window __webpack_hash__ */
-if(module.hot) {
- var lastHash;
- var upToDate = function upToDate() {
- return lastHash.indexOf(__webpack_hash__) >= 0;
- };
- var log = require("./log");
- var check = function check() {
- module.hot.check(true).then(function(updatedModules) {
- if(!updatedModules) {
- log("warning", "[HMR] Cannot find update. Need to do a full reload!");
- log("warning", "[HMR] (Probably because of restarting the webpack-dev-server)");
- window.location.reload();
- return;
- }
-
- if(!upToDate()) {
- check();
- }
-
- require("./log-apply-result")(updatedModules, updatedModules);
-
- if(upToDate()) {
- log("info", "[HMR] App is up to date.");
- }
-
- }).catch(function(err) {
- var status = module.hot.status();
- if(["abort", "fail"].indexOf(status) >= 0) {
- log("warning", "[HMR] Cannot apply update. Need to do a full reload!");
- log("warning", "[HMR] " + err.stack || err.message);
- window.location.reload();
- } else {
- log("warning", "[HMR] Update failed: " + err.stack || err.message);
- }
- });
- };
- var hotEmitter = require("./emitter");
- hotEmitter.on("webpackHotUpdate", function(currentHash) {
- lastHash = currentHash;
- if(!upToDate() && module.hot.status() === "idle") {
- log("info", "[HMR] Checking for updates on the server...");
- check();
- }
- });
- log("info", "[HMR] Waiting for update signal from WDS...");
-} else {
- throw new Error("[HMR] Hot Module Replacement is disabled.");
-}
+/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +/*globals window __webpack_hash__ */ +if (module.hot) { + var lastHash; + var upToDate = function upToDate() { + return lastHash.indexOf(__webpack_hash__) >= 0; + }; + var log = require("./log"); + var check = function check() { + module.hot + .check(true) + .then(function(updatedModules) { + if (!updatedModules) { + log("warning", "[HMR] Cannot find update. Need to do a full reload!"); + log( + "warning", + "[HMR] (Probably because of restarting the webpack-dev-server)" + ); + window.location.reload(); + return; + } + + if (!upToDate()) { + check(); + } + + require("./log-apply-result")(updatedModules, updatedModules); + + if (upToDate()) { + log("info", "[HMR] App is up to date."); + } + }) + .catch(function(err) { + var status = module.hot.status(); + if (["abort", "fail"].indexOf(status) >= 0) { + log( + "warning", + "[HMR] Cannot apply update. Need to do a full reload!" + ); + log("warning", "[HMR] " + (err.stack || err.message)); + window.location.reload(); + } else { + log("warning", "[HMR] Update failed: " + (err.stack || err.message)); + } + }); + }; + var hotEmitter = require("./emitter"); + hotEmitter.on("webpackHotUpdate", function(currentHash) { + lastHash = currentHash; + if (!upToDate() && module.hot.status() === "idle") { + log("info", "[HMR] Checking for updates on the server..."); + check(); + } + }); + log("info", "[HMR] Waiting for update signal from WDS..."); +} else { + throw new Error("[HMR] Hot Module Replacement is disabled."); +} diff --git a/node_modules/webpack/hot/emitter.js b/node_modules/webpack/hot/emitter.js index 0c26a031e..05e0fbe09 100644 --- a/node_modules/webpack/hot/emitter.js +++ b/node_modules/webpack/hot/emitter.js @@ -1,2 +1,2 @@ -var EventEmitter = require("events");
-module.exports = new EventEmitter();
+var EventEmitter = require("events"); +module.exports = new EventEmitter(); diff --git a/node_modules/webpack/hot/log-apply-result.js b/node_modules/webpack/hot/log-apply-result.js index 8a312b3c6..b63e75741 100644 --- a/node_modules/webpack/hot/log-apply-result.js +++ b/node_modules/webpack/hot/log-apply-result.js @@ -1,38 +1,44 @@ -/*
- 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;
- });
- var log = require("./log");
-
- if(unacceptedModules.length > 0) {
- log("warning", "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)");
- unacceptedModules.forEach(function(moduleId) {
- log("warning", "[HMR] - " + moduleId);
- });
- }
-
- if(!renewedModules || renewedModules.length === 0) {
- log("info", "[HMR] Nothing hot updated.");
- } else {
- log("info", "[HMR] Updated modules:");
- renewedModules.forEach(function(moduleId) {
- 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);
- }
- });
- var numberIds = renewedModules.every(function(moduleId) {
- return typeof moduleId === "number";
- });
- if(numberIds)
- log("info", "[HMR] Consider using the NamedModulesPlugin for module names.");
- }
-};
+/* + 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; + }); + var log = require("./log"); + + if (unacceptedModules.length > 0) { + log( + "warning", + "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)" + ); + unacceptedModules.forEach(function(moduleId) { + log("warning", "[HMR] - " + moduleId); + }); + } + + if (!renewedModules || renewedModules.length === 0) { + log("info", "[HMR] Nothing hot updated."); + } else { + log("info", "[HMR] Updated modules:"); + renewedModules.forEach(function(moduleId) { + 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); + } + }); + var numberIds = renewedModules.every(function(moduleId) { + return typeof moduleId === "number"; + }); + if (numberIds) + log( + "info", + "[HMR] Consider using the NamedModulesPlugin for module names." + ); + } +}; diff --git a/node_modules/webpack/hot/log.js b/node_modules/webpack/hot/log.js index 2ade0511d..0d05673f8 100644 --- a/node_modules/webpack/hot/log.js +++ b/node_modules/webpack/hot/log.js @@ -1,44 +1,47 @@ -var logLevel = "info";
-
-function dummy() {}
-
-function shouldLog(level) {
- var shouldLog = (logLevel === "info" && level === "info") ||
- (["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") ||
- (["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error");
- return shouldLog;
-}
-
-function logGroup(logFn) {
- return function(level, msg) {
- if(shouldLog(level)) {
- logFn(msg);
- }
- };
-}
-
-module.exports = function(level, msg) {
- if(shouldLog(level)) {
- if(level === "info") {
- console.log(msg);
- } else if(level === "warning") {
- console.warn(msg);
- } else if(level === "error") {
- console.error(msg);
- }
- }
-};
-
-var group = console.group || dummy;
-var groupCollapsed = console.groupCollapsed || dummy;
-var groupEnd = console.groupEnd || dummy;
-
-module.exports.group = logGroup(group);
-
-module.exports.groupCollapsed = logGroup(groupCollapsed);
-
-module.exports.groupEnd = logGroup(groupEnd);
-
-module.exports.setLogLevel = function(level) {
- logLevel = level;
-};
+var logLevel = "info"; + +function dummy() {} + +function shouldLog(level) { + var shouldLog = + (logLevel === "info" && level === "info") || + (["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") || + (["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error"); + return shouldLog; +} + +function logGroup(logFn) { + return function(level, msg) { + if (shouldLog(level)) { + logFn(msg); + } + }; +} + +module.exports = function(level, msg) { + if (shouldLog(level)) { + if (level === "info") { + console.log(msg); + } else if (level === "warning") { + console.warn(msg); + } else if (level === "error") { + console.error(msg); + } + } +}; + +/* eslint-disable node/no-unsupported-features/node-builtins */ +var group = console.group || dummy; +var groupCollapsed = console.groupCollapsed || dummy; +var groupEnd = console.groupEnd || dummy; +/* eslint-enable node/no-unsupported-features/node-builtins */ + +module.exports.group = logGroup(group); + +module.exports.groupCollapsed = logGroup(groupCollapsed); + +module.exports.groupEnd = logGroup(groupEnd); + +module.exports.setLogLevel = function(level) { + logLevel = level; +}; diff --git a/node_modules/webpack/hot/only-dev-server.js b/node_modules/webpack/hot/only-dev-server.js index 252df58fd..043f2430b 100644 --- a/node_modules/webpack/hot/only-dev-server.js +++ b/node_modules/webpack/hot/only-dev-server.js @@ -1,71 +1,105 @@ -/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-/*globals __webpack_hash__ */
-if(module.hot) {
- var lastHash;
- var upToDate = function upToDate() {
- return lastHash.indexOf(__webpack_hash__) >= 0;
- };
- var log = require("./log");
- var check = function check() {
- module.hot.check().then(function(updatedModules) {
- if(!updatedModules) {
- log("warning", "[HMR] Cannot find update. Need to do a full reload!");
- log("warning", "[HMR] (Probably because of restarting the webpack-dev-server)");
- return;
- }
-
- return module.hot.apply({
- ignoreUnaccepted: true,
- ignoreDeclined: true,
- ignoreErrored: true,
- onUnaccepted: function(data) {
- log("warning", "Ignored an update to unaccepted module " + data.chain.join(" -> "));
- },
- onDeclined: function(data) {
- log("warning", "Ignored an update to declined module " + data.chain.join(" -> "));
- },
- onErrored: function(data) {
- log("error", data.error);
- log("warning", "Ignored an error while updating module " + data.moduleId + " (" + data.type + ")");
- }
- }).then(function(renewedModules) {
- if(!upToDate()) {
- check();
- }
-
- require("./log-apply-result")(updatedModules, renewedModules);
-
- if(upToDate()) {
- log("info", "[HMR] App is up to date.");
- }
- });
- }).catch(function(err) {
- var status = module.hot.status();
- if(["abort", "fail"].indexOf(status) >= 0) {
- log("warning", "[HMR] Cannot check for update. Need to do a full reload!");
- log("warning", "[HMR] " + err.stack || err.message);
- } else {
- log("warning", "[HMR] Update check failed: " + err.stack || err.message);
- }
- });
- };
- var hotEmitter = require("./emitter");
- hotEmitter.on("webpackHotUpdate", function(currentHash) {
- lastHash = currentHash;
- if(!upToDate()) {
- var status = module.hot.status();
- if(status === "idle") {
- log("info", "[HMR] Checking for updates on the server...");
- check();
- } else if(["abort", "fail"].indexOf(status) >= 0) {
- log("warning", "[HMR] Cannot apply update as a previous update " + status + "ed. Need to do a full reload!");
- }
- }
- });
- log("info", "[HMR] Waiting for update signal from WDS...");
-} else {
- throw new Error("[HMR] Hot Module Replacement is disabled.");
-}
+/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +/*globals __webpack_hash__ */ +if (module.hot) { + var lastHash; + var upToDate = function upToDate() { + return lastHash.indexOf(__webpack_hash__) >= 0; + }; + var log = require("./log"); + var check = function check() { + module.hot + .check() + .then(function(updatedModules) { + if (!updatedModules) { + log("warning", "[HMR] Cannot find update. Need to do a full reload!"); + log( + "warning", + "[HMR] (Probably because of restarting the webpack-dev-server)" + ); + return; + } + + return module.hot + .apply({ + ignoreUnaccepted: true, + ignoreDeclined: true, + ignoreErrored: true, + onUnaccepted: function(data) { + log( + "warning", + "Ignored an update to unaccepted module " + + data.chain.join(" -> ") + ); + }, + onDeclined: function(data) { + log( + "warning", + "Ignored an update to declined module " + + data.chain.join(" -> ") + ); + }, + onErrored: function(data) { + log("error", data.error); + log( + "warning", + "Ignored an error while updating module " + + data.moduleId + + " (" + + data.type + + ")" + ); + } + }) + .then(function(renewedModules) { + if (!upToDate()) { + check(); + } + + require("./log-apply-result")(updatedModules, renewedModules); + + if (upToDate()) { + log("info", "[HMR] App is up to date."); + } + }); + }) + .catch(function(err) { + var status = module.hot.status(); + if (["abort", "fail"].indexOf(status) >= 0) { + log( + "warning", + "[HMR] Cannot check for update. Need to do a full reload!" + ); + log("warning", "[HMR] " + (err.stack || err.message)); + } else { + log( + "warning", + "[HMR] Update check failed: " + (err.stack || err.message) + ); + } + }); + }; + var hotEmitter = require("./emitter"); + hotEmitter.on("webpackHotUpdate", function(currentHash) { + lastHash = currentHash; + if (!upToDate()) { + var status = module.hot.status(); + if (status === "idle") { + log("info", "[HMR] Checking for updates on the server..."); + check(); + } else if (["abort", "fail"].indexOf(status) >= 0) { + log( + "warning", + "[HMR] Cannot apply update as a previous update " + + status + + "ed. Need to do a full reload!" + ); + } + } + }); + log("info", "[HMR] Waiting for update signal from WDS..."); +} else { + throw new Error("[HMR] Hot Module Replacement is disabled."); +} diff --git a/node_modules/webpack/hot/poll.js b/node_modules/webpack/hot/poll.js index 75e3a2b67..8193db01f 100644 --- a/node_modules/webpack/hot/poll.js +++ b/node_modules/webpack/hot/poll.js @@ -1,34 +1,40 @@ -/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-/*globals __resourceQuery */
-if(module.hot) {
- var hotPollInterval = +(__resourceQuery.substr(1)) || (10 * 60 * 1000);
- var log = require("./log");
-
- var checkForUpdate = function checkForUpdate(fromUpdate) {
- if(module.hot.status() === "idle") {
- module.hot.check(true).then(function(updatedModules) {
- if(!updatedModules) {
- if(fromUpdate) log("info", "[HMR] Update applied.");
- return;
- }
- require("./log-apply-result")(updatedModules, updatedModules);
- checkForUpdate(true);
- }).catch(function(err) {
- var status = module.hot.status();
- if(["abort", "fail"].indexOf(status) >= 0) {
- log("warning", "[HMR] Cannot apply update.");
- log("warning", "[HMR] " + err.stack || err.message);
- log("warning", "[HMR] You need to restart the application!");
- } else {
- log("warning", "[HMR] Update failed: " + err.stack || err.message);
- }
- });
- }
- };
- setInterval(checkForUpdate, hotPollInterval);
-} else {
- throw new Error("[HMR] Hot Module Replacement is disabled.");
-}
+/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +/*globals __resourceQuery */ +if (module.hot) { + var hotPollInterval = +__resourceQuery.substr(1) || 10 * 60 * 1000; + var log = require("./log"); + + var checkForUpdate = function checkForUpdate(fromUpdate) { + if (module.hot.status() === "idle") { + module.hot + .check(true) + .then(function(updatedModules) { + if (!updatedModules) { + if (fromUpdate) log("info", "[HMR] Update applied."); + return; + } + require("./log-apply-result")(updatedModules, updatedModules); + checkForUpdate(true); + }) + .catch(function(err) { + var status = module.hot.status(); + if (["abort", "fail"].indexOf(status) >= 0) { + log("warning", "[HMR] Cannot apply update."); + log("warning", "[HMR] " + (err.stack || err.message)); + log("warning", "[HMR] You need to restart the application!"); + } else { + log( + "warning", + "[HMR] Update failed: " + (err.stack || err.message) + ); + } + }); + } + }; + setInterval(checkForUpdate, hotPollInterval); +} else { + throw new Error("[HMR] Hot Module Replacement is disabled."); +} diff --git a/node_modules/webpack/hot/signal.js b/node_modules/webpack/hot/signal.js index 77ec94d4a..24c4f5cb3 100644 --- a/node_modules/webpack/hot/signal.js +++ b/node_modules/webpack/hot/signal.js @@ -1,51 +1,62 @@ -/*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
-*/
-/*globals __resourceQuery */
-if(module.hot) {
- var log = require("./log");
- var checkForUpdate = function checkForUpdate(fromUpdate) {
- module.hot.check().then(function(updatedModules) {
- if(!updatedModules) {
- if(fromUpdate)
- log("info", "[HMR] Update applied.");
- else
- log("warning", "[HMR] Cannot find update.");
- return;
- }
-
- return module.hot.apply({
- ignoreUnaccepted: true,
- onUnaccepted: function(data) {
- log("warning", "Ignored an update to unaccepted module " + data.chain.join(" -> "));
- },
- }).then(function(renewedModules) {
- require("./log-apply-result")(updatedModules, renewedModules);
-
- checkForUpdate(true);
- });
- }).catch(function(err) {
- var status = module.hot.status();
- if(["abort", "fail"].indexOf(status) >= 0) {
- log("warning", "[HMR] Cannot apply update.");
- log("warning", "[HMR] " + err.stack || err.message);
- log("warning", "[HMR] You need to restart the application!");
- } else {
- log("warning", "[HMR] Update failed: " + err.stack || err.message);
- }
- });
- };
-
- process.on(__resourceQuery.substr(1) || "SIGUSR2", function() {
- if(module.hot.status() !== "idle") {
- log("warning", "[HMR] Got signal but currently in " + module.hot.status() + " state.");
- log("warning", "[HMR] Need to be in idle state to start hot update.");
- return;
- }
-
- checkForUpdate();
- });
-} else {
- throw new Error("[HMR] Hot Module Replacement is disabled.");
-}
+/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +/*globals __resourceQuery */ +if (module.hot) { + var log = require("./log"); + var checkForUpdate = function checkForUpdate(fromUpdate) { + module.hot + .check() + .then(function(updatedModules) { + if (!updatedModules) { + if (fromUpdate) log("info", "[HMR] Update applied."); + else log("warning", "[HMR] Cannot find update."); + return; + } + + return module.hot + .apply({ + ignoreUnaccepted: true, + onUnaccepted: function(data) { + log( + "warning", + "Ignored an update to unaccepted module " + + data.chain.join(" -> ") + ); + } + }) + .then(function(renewedModules) { + require("./log-apply-result")(updatedModules, renewedModules); + + checkForUpdate(true); + return null; + }); + }) + .catch(function(err) { + var status = module.hot.status(); + if (["abort", "fail"].indexOf(status) >= 0) { + log("warning", "[HMR] Cannot apply update."); + log("warning", "[HMR] " + (err.stack || err.message)); + log("warning", "[HMR] You need to restart the application!"); + } else { + log("warning", "[HMR] Update failed: " + (err.stack || err.message)); + } + }); + }; + + process.on(__resourceQuery.substr(1) || "SIGUSR2", function() { + if (module.hot.status() !== "idle") { + log( + "warning", + "[HMR] Got signal but currently in " + module.hot.status() + " state." + ); + log("warning", "[HMR] Need to be in idle state to start hot update."); + return; + } + + checkForUpdate(); + }); +} else { + throw new Error("[HMR] Hot Module Replacement is disabled."); +} |