PromoCursed/node_modules/.cache/babel-loader/e5ace8e19a174df7b3b6b06f6d2ead2a418b2a92984b9cd7ea1ef52f2ecfd4ec.json

1 line
6.4 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import hotEmitter from \"webpack/hot/emitter.js\";\nimport { log } from \"./log.js\";\n\n/** @typedef {import(\"../index\").Options} Options\n/** @typedef {import(\"../index\").Status} Status\n\n/**\n * @param {Options} options\n * @param {Status} status\n */\nfunction reloadApp(_ref, status) {\n var hot = _ref.hot,\n liveReload = _ref.liveReload;\n if (status.isUnloading) {\n return;\n }\n var currentHash = status.currentHash,\n previousHash = status.previousHash;\n var isInitial = currentHash.indexOf( /** @type {string} */previousHash) >= 0;\n if (isInitial) {\n return;\n }\n\n /**\n * @param {Window} rootWindow\n * @param {number} intervalId\n */\n function applyReload(rootWindow, intervalId) {\n clearInterval(intervalId);\n log.info(\"App updated. Reloading...\");\n rootWindow.location.reload();\n }\n var search = self.location.search.toLowerCase();\n var allowToHot = search.indexOf(\"webpack-dev-server-hot=false\") === -1;\n var allowToLiveReload = search.indexOf(\"webpack-dev-server-live-reload=false\") === -1;\n if (hot && allowToHot) {\n log.info(\"App hot update...\");\n hotEmitter.emit(\"webpackHotUpdate\", status.currentHash);\n if (typeof self !== \"undefined\" && self.window) {\n // broadcast update to window\n self.postMessage(\"webpackHotUpdate\".concat(status.currentHash), \"*\");\n }\n }\n // allow refreshing the page only if liveReload isn't disabled\n else if (liveReload && allowToLiveReload) {\n var rootWindow = self;\n\n // use parent window for reload (in case we're in an iframe with no valid src)\n var intervalId = self.setInterval(function () {\n if (rootWindow.location.protocol !== \"about:\") {\n // reload immediately if protocol is valid\n applyReload(rootWindow, intervalId);\n } else {\n rootWindow = rootWindow.parent;\n if (rootWindow.parent === rootWindow) {\n // if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways\n applyReload(rootWindow, intervalId);\n }\n }\n });\n }\n}\nexport default reloadApp;","map":{"version":3,"names":["hotEmitter","log","reloadApp","_ref","status","hot","liveReload","isUnloading","currentHash","previousHash","isInitial","indexOf","applyReload","rootWindow","intervalId","clearInterval","info","location","reload","search","self","toLowerCase","allowToHot","allowToLiveReload","emit","window","postMessage","concat","setInterval","protocol","parent"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/webpack-dev-server/client/utils/reloadApp.js"],"sourcesContent":["import hotEmitter from \"webpack/hot/emitter.js\";\nimport { log } from \"./log.js\";\n\n/** @typedef {import(\"../index\").Options} Options\n/** @typedef {import(\"../index\").Status} Status\n\n/**\n * @param {Options} options\n * @param {Status} status\n */\nfunction reloadApp(_ref, status) {\n var hot = _ref.hot,\n liveReload = _ref.liveReload;\n if (status.isUnloading) {\n return;\n }\n var currentHash = status.currentHash,\n previousHash = status.previousHash;\n var isInitial = currentHash.indexOf( /** @type {string} */previousHash) >= 0;\n if (isInitial) {\n return;\n }\n\n /**\n * @param {Window} rootWindow\n * @param {number} intervalId\n */\n function applyReload(rootWindow, intervalId) {\n clearInterval(intervalId);\n log.info(\"App updated. Reloading...\");\n rootWindow.location.reload();\n }\n var search = self.location.search.toLowerCase();\n var allowToHot = search.indexOf(\"webpack-dev-server-hot=false\") === -1;\n var allowToLiveReload = search.indexOf(\"webpack-dev-server-live-reload=false\") === -1;\n if (hot && allowToHot) {\n log.info(\"App hot update...\");\n hotEmitter.emit(\"webpackHotUpdate\", status.currentHash);\n if (typeof self !== \"undefined\" && self.window) {\n // broadcast update to window\n self.postMessage(\"webpackHotUpdate\".concat(status.currentHash), \"*\");\n }\n }\n /