You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.5 KiB
1 lines
6.5 KiB
{"ast":null,"code":"import \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.search.js\";\nimport hotEmitter from \"webpack/hot/emitter.js\";\nimport { log } from \"./log.js\";\n/** @typedef {import(\"../index\").Options} Options\n/** @typedef {import(\"../index\").Status} Status\n\n/**\n * @param {Options} options\n * @param {Status} status\n */\n\nfunction reloadApp(_ref, status) {\n var hot = _ref.hot,\n liveReload = _ref.liveReload;\n\n if (status.isUnloading) {\n return;\n }\n\n var currentHash = status.currentHash,\n previousHash = status.previousHash;\n var isInitial = currentHash.indexOf(\n /** @type {string} */\n previousHash) >= 0;\n\n if (isInitial) {\n return;\n }\n /**\n * @param {Window} rootWindow\n * @param {number} intervalId\n */\n\n\n function applyReload(rootWindow, intervalId) {\n clearInterval(intervalId);\n log.info(\"App updated. Reloading...\");\n rootWindow.location.reload();\n }\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\n if (hot && allowToHot) {\n log.info(\"App hot update...\");\n hotEmitter.emit(\"webpackHotUpdate\", status.currentHash);\n\n if (typeof self !== \"undefined\" && self.window) {\n // broadcast update to window\n self.postMessage(\"webpackHotUpdate\".concat(status.currentHash), \"*\");\n }\n } // allow refreshing the page only if liveReload isn't disabled\n else if (liveReload && allowToLiveReload) {\n var rootWindow = self; // use parent window for reload (in case we're in an iframe with no valid src)\n\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\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}\n\nexport default reloadApp;","map":{"version":3,"sources":["/tmp/vue-hello/node_modules/webpack-dev-server/client/utils/reloadApp.js"],"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"],"mappings":";;AAAA,OAAOA,UAAP,MAAuB,wBAAvB;AACA,SAASC,GAAT,QAAoB,UAApB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,SAAT,CAAmBC,IAAnB,EAAyBC,MAAzB,EAAiC;AAC/B,MAAIC,GAAG,GAAGF,IAAI,CAACE,GAAf;AAAA,MACIC,UAAU,GAAGH,IAAI,CAACG,UADtB;;AAGA,MAAIF,MAAM,CAACG,WAAX,EAAwB;AACtB;AACD;;AAED,MAAIC,WAAW,GAAGJ,MAAM,CAACI,WAAzB;AAAA,MACIC,YAAY,GAAGL,MAAM,CAACK,YAD1B;AAEA,MAAIC,SAAS,GAAGF,WAAW,CAACG,OAAZ;AAChB;AACAF,EAAAA,YAFgB,KAEC,CAFjB;;AAIA,MAAIC,SAAJ,EAAe;AACb;AACD;AACD;AACF;AACA;AACA;;;AAGE,WAASE,WAAT,CAAqBC,UAArB,EAAiCC,UAAjC,EAA6C;AAC3CC,IAAAA,aAAa,CAACD,UAAD,CAAb;AACAb,IAAAA,GAAG,CAACe,IAAJ,CAAS,2BAAT;AACAH,IAAAA,UAAU,CAACI,QAAX,CAAoBC,MAApB;AACD;;AAED,MAAIC,MAAM,GAAGC,IAAI,CAACH,QAAL,CAAcE,MAAd,CAAqBE,WAArB,EAAb;AACA,MAAIC,UAAU,GAAGH,MAAM,CAACR,OAAP,CAAe,8BAAf,MAAmD,CAAC,CAArE;AACA,MAAIY,iBAAiB,GAAGJ,MAAM,CAACR,OAAP,CAAe,sCAAf,MAA2D,CAAC,CAApF;;AAEA,MAAIN,GAAG,IAAIiB,UAAX,EAAuB;AACrBrB,IAAAA,GAAG,CAACe,IAAJ,CAAS,mBAAT;AACAhB,IAAAA,UAAU,CAACwB,IAAX,CAAgB,kBAAhB,EAAoCpB,MAAM,CAACI,WAA3C;;AAEA,QAAI,OAAOY,IAAP,KAAgB,WAAhB,IAA+BA,IAAI,CAACK,MAAxC,EAAgD;AAC9C;AACAL,MAAAA,IAAI,CAACM,WAAL,CAAiB,mBAAmBC,MAAnB,CAA0BvB,MAAM,CAACI,WAAjC,CAAjB,EAAgE,GAAhE;AACD;AACF,GARD,CAQE;AARF,OASK,IAAIF,UAAU,IAAIiB,iBAAlB,EAAqC;AACxC,QAAIV,UAAU,GAAGO,IAAjB,CADwC,CACjB;;AAEvB,QAAIN,UAAU,GAAGM,IAAI,CAACQ,WAAL,CAAiB,YAAY;AAC5C,UAAIf,UAAU,CAACI,QAAX,CAAoBY,QAApB,KAAiC,QAArC,EAA+C;AAC7C;AACAjB,QAAAA,WAAW,CAACC,UAAD,EAAaC,UAAb,CAAX;AACD,OAHD,MAGO;AACLD,QAAAA,UAAU,GAAGA,UAAU,CAACiB,MAAxB;;AAEA,YAAIjB,UAAU,CAACiB,MAAX,KAAsBjB,UAA1B,EAAsC;AACpC;AACAD,UAAAA,WAAW,CAACC,UAAD,EAAaC,UAAb,CAAX;AACD;AACF;AACF,KAZgB,CAAjB;AAaD;AACF;;AAED,eAAeZ,SAAf","sourcesContent":["import hotEmitter from \"webpack/hot/emitter.js\";\nimport { log } from \"./log.js\";\n/** @typedef {import(\"../index\").Options} Options\n/** @typedef {import(\"../index\").Status} Status\n\n/**\n * @param {Options} options\n * @param {Status} status\n */\n\nfunction reloadApp(_ref, status) {\n var hot = _ref.hot,\n liveReload = _ref.liveReload;\n\n if (status.isUnloading) {\n return;\n }\n\n var currentHash = status.currentHash,\n previousHash = status.previousHash;\n var isInitial = currentHash.indexOf(\n /** @type {string} */\n previousHash) >= 0;\n\n if (isInitial) {\n return;\n }\n /**\n * @param {Window} rootWindow\n * @param {number} intervalId\n */\n\n\n function applyReload(rootWindow, intervalId) {\n clearInterval(intervalId);\n log.info(\"App updated. Reloading...\");\n rootWindow.location.reload();\n }\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\n if (hot && allowToHot) {\n log.info(\"App hot update...\");\n hotEmitter.emit(\"webpackHotUpdate\", status.currentHash);\n\n if (typeof self !== \"undefined\" && self.window) {\n // broadcast update to window\n self.postMessage(\"webpackHotUpdate\".concat(status.currentHash), \"*\");\n }\n } // allow refreshing the page only if liveReload isn't disabled\n else if (liveReload && allowToLiveReload) {\n var rootWindow = self; // use parent window for reload (in case we're in an iframe with no valid src)\n\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\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}\n\nexport default reloadApp;"]},"metadata":{},"sourceType":"module"} |