create-dan
Version:
Dan frameworks
1 lines • 11.6 kB
JSON
{"ast":null,"code":"\"use strict\";\n\nvar _regeneratorRuntime = require(\"@babel/runtime-corejs2/regenerator\");\n\nvar _interopRequireDefault = require(\"@babel/runtime-corejs2/helpers/interopRequireDefault\");\n\nvar _keys = _interopRequireDefault(require(\"@babel/runtime-corejs2/core-js/object/keys\"));\n\nvar _asyncToGenerator2 = _interopRequireDefault(require(\"@babel/runtime-corejs2/helpers/asyncToGenerator\"));\n\nvar _unfetch = _interopRequireDefault(require(\"unfetch\"));\n\nvar _eventSourcePolyfill = _interopRequireDefault(require(\"./event-source-polyfill\"));\n\nvar _eventsource = require(\"./error-overlay/eventsource\");\n\nvar _onDemandEntriesUtils = require(\"./on-demand-entries-utils\");\n\nvar _fouc = require(\"./fouc\");\n/* globals __webpack_hash__ */\n\n\nif (!window.EventSource) {\n window.EventSource = _eventSourcePolyfill[\"default\"];\n}\n\nvar data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);\nvar assetPrefix = data.assetPrefix,\n page = data.page;\nassetPrefix = assetPrefix || '';\nvar mostRecentHash = null;\n/* eslint-disable-next-line */\n\nvar curHash = __webpack_hash__;\nvar hotUpdatePath = assetPrefix + (assetPrefix.endsWith('/') ? '' : '/') + '_next/static/webpack/'; // Is there a newer version of this code available?\n\nfunction isUpdateAvailable() {\n // __webpack_hash__ is the hash of the current compilation.\n // It's a global variable injected by Webpack.\n\n /* eslint-disable-next-line */\n return mostRecentHash !== __webpack_hash__;\n} // Webpack disallows updates in other states.\n\n\nfunction canApplyUpdates() {\n return module.hot.status() === 'idle';\n} // This function reads code updates on the fly and hard\n// reloads the page when it has changed.\n\n\nfunction tryApplyUpdates() {\n return _tryApplyUpdates.apply(this, arguments);\n}\n\nfunction _tryApplyUpdates() {\n _tryApplyUpdates = (0, _asyncToGenerator2[\"default\"])(\n /*#__PURE__*/\n _regeneratorRuntime.mark(function _callee() {\n var res, _data, curPage, pageUpdated;\n\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n if (!(!isUpdateAvailable() || !canApplyUpdates())) {\n _context.next = 2;\n break;\n }\n\n return _context.abrupt(\"return\");\n\n case 2:\n _context.prev = 2;\n _context.next = 5;\n return (0, _unfetch[\"default\"])(\"\" + hotUpdatePath + curHash + \".hot-update.json\");\n\n case 5:\n res = _context.sent;\n _context.next = 8;\n return res.json();\n\n case 8:\n _data = _context.sent;\n curPage = page === '/' ? 'index' : page;\n pageUpdated = (0, _keys[\"default\"])(_data.c).some(function (mod) {\n return mod.indexOf(\"pages\" + (curPage.substr(0, 1) === '/' ? curPage : \"/\" + curPage)) !== -1 || mod.indexOf((\"pages\" + (curPage.substr(0, 1) === '/' ? curPage : \"/\" + curPage)).replace(/\\//g, '\\\\')) !== -1;\n });\n\n if (pageUpdated) {\n document.location.reload(true);\n } else {\n curHash = mostRecentHash;\n }\n\n _context.next = 18;\n break;\n\n case 14:\n _context.prev = 14;\n _context.t0 = _context[\"catch\"](2);\n console.error('Error occurred checking for update', _context.t0);\n document.location.reload(true);\n\n case 18:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, null, [[2, 14]]);\n }));\n return _tryApplyUpdates.apply(this, arguments);\n}\n\n(0, _eventsource.getEventSourceWrapper)({\n path: assetPrefix + \"/_next/webpack-hmr\"\n}).addMessageListener(function (event) {\n if (event.data === \"\\uD83D\\uDC93\") {\n return;\n }\n\n try {\n var message = JSON.parse(event.data);\n\n if (message.action === 'sync' || message.action === 'built') {\n if (!message.hash) {\n return;\n }\n\n mostRecentHash = message.hash;\n tryApplyUpdates();\n } else if (message.action === 'reloadPage') {\n document.location.reload(true);\n }\n } catch (ex) {\n console.warn('Invalid HMR message: ' + event.data + '\\n' + ex);\n }\n});\n(0, _onDemandEntriesUtils.setupPing)(assetPrefix, function () {\n return page;\n});\n(0, _fouc.displayContent)();","map":{"version":3,"sources":["/Users/sbourgal/Documents/Projets/DAN/dan-framework/template/node_modules/next/dist/client/dev/amp-dev.js"],"names":["_interopRequireDefault","require","_keys","_asyncToGenerator2","_unfetch","_eventSourcePolyfill","_eventsource","_onDemandEntriesUtils","_fouc","window","EventSource","data","JSON","parse","document","getElementById","textContent","assetPrefix","page","mostRecentHash","curHash","__webpack_hash__","hotUpdatePath","endsWith","isUpdateAvailable","canApplyUpdates","module","hot","status","tryApplyUpdates","_tryApplyUpdates","apply","arguments","res","json","_data","curPage","pageUpdated","c","some","mod","indexOf","substr","replace","location","reload","console","error","getEventSourceWrapper","path","addMessageListener","event","message","action","hash","ex","warn","setupPing","displayContent"],"mappings":"AAAA;;;;AAAa,IAAIA,sBAAsB,GAACC,OAAO,CAAC,sDAAD,CAAlC;;AAA2F,IAAIC,KAAK,GAACF,sBAAsB,CAACC,OAAO,CAAC,4CAAD,CAAR,CAAhC;;AAAwF,IAAIE,kBAAkB,GAACH,sBAAsB,CAACC,OAAO,CAAC,iDAAD,CAAR,CAA7C;;AAA0G,IAAIG,QAAQ,GAACJ,sBAAsB,CAACC,OAAO,CAAC,SAAD,CAAR,CAAnC;;AAAwD,IAAII,oBAAoB,GAACL,sBAAsB,CAACC,OAAO,CAAC,yBAAD,CAAR,CAA/C;;AAAoF,IAAIK,YAAY,GAACL,OAAO,CAAC,6BAAD,CAAxB;;AAAwD,IAAIM,qBAAqB,GAACN,OAAO,CAAC,2BAAD,CAAjC;;AAA+D,IAAIO,KAAK,GAACP,OAAO,CAAC,QAAD,CAAjB;AAA4B;;;AAA8B,IAAG,CAACQ,MAAM,CAACC,WAAX,EAAuB;AAACD,EAAAA,MAAM,CAACC,WAAP,GAAmBL,oBAAoB,WAAvC;AAAiD;;AAAA,IAAIM,IAAI,GAACC,IAAI,CAACC,KAAL,CAAWC,QAAQ,CAACC,cAAT,CAAwB,eAAxB,EAAyCC,WAApD,CAAT;IAA8EC,W,GAAkBN,I,CAAlBM,W;IAAYC,I,GAAMP,I,CAANO,I;AAAWD,WAAW,GAACA,WAAW,IAAE,EAAzB;AAA4B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AAO,CAACE,IAAZ,EAAiB;AAAC;AAAQ;;AAAAnC,MAAAA,cAAc,GAACiC,OAAO,CAACE,IAAvB;AAA4BzB,MAAAA,eAAe;AAAI,KAA/H,MAAoI,IAAGuB,OAAO,CAACC,MAAR,KAAiB,YAApB,EAAiC;AAACvC,MAAAA,QAAQ,CAAC8B,QAAT,CAAkBC,MAAlB,CAAyB,IAAzB;AAAgC;AAAC,GAA9O,CAA8O,OAAMU,EAAN,EAAS;AAACT,IAAAA,OAAO,CAACU,IAAR,CAAa,0BAAwBL,KAAK,CAACxC,IAA9B,GAAmC,IAAnC,GAAwC4C,EAArD;AAA0D;AAAC,CAAtc;AAAwc,CAAC,GAAEhD,qBAAqB,CAACkD,SAAzB,EAAoCxC,WAApC,EAAgD;AAAA,SAAIC,IAAJ;AAAA,CAAhD;AAA0D,CAAC,GAAEV,KAAK,CAACkD,cAAT","sourcesContent":["\"use strict\";var _interopRequireDefault=require(\"@babel/runtime-corejs2/helpers/interopRequireDefault\");var _keys=_interopRequireDefault(require(\"@babel/runtime-corejs2/core-js/object/keys\"));var _asyncToGenerator2=_interopRequireDefault(require(\"@babel/runtime-corejs2/helpers/asyncToGenerator\"));var _unfetch=_interopRequireDefault(require(\"unfetch\"));var _eventSourcePolyfill=_interopRequireDefault(require(\"./event-source-polyfill\"));var _eventsource=require(\"./error-overlay/eventsource\");var _onDemandEntriesUtils=require(\"./on-demand-entries-utils\");var _fouc=require(\"./fouc\");/* globals __webpack_hash__ */if(!window.EventSource){window.EventSource=_eventSourcePolyfill.default;}var data=JSON.parse(document.getElementById('__NEXT_DATA__').textContent);var{assetPrefix,page}=data;assetPrefix=assetPrefix||'';var mostRecentHash=null;/* eslint-disable-next-line */var curHash=__webpack_hash__;var hotUpdatePath=assetPrefix+(assetPrefix.endsWith('/')?'':'/')+'_next/static/webpack/';// Is there a newer version of this code available?\nfunction isUpdateAvailable(){// __webpack_hash__ is the hash of the current compilation.\n// It's a global variable injected by Webpack.\n/* eslint-disable-next-line */return mostRecentHash!==__webpack_hash__;}// Webpack disallows updates in other states.\nfunction canApplyUpdates(){return module.hot.status()==='idle';}// This function reads code updates on the fly and hard\n// reloads the page when it has changed.\nfunction tryApplyUpdates(){return _tryApplyUpdates.apply(this,arguments);}function _tryApplyUpdates(){_tryApplyUpdates=(0,_asyncToGenerator2.default)(function*(){if(!isUpdateAvailable()||!canApplyUpdates()){return;}try{var res=yield(0,_unfetch.default)(\"\"+hotUpdatePath+curHash+\".hot-update.json\");var _data=yield res.json();var curPage=page==='/'?'index':page;var pageUpdated=(0,_keys.default)(_data.c).some(mod=>{return mod.indexOf(\"pages\"+(curPage.substr(0,1)==='/'?curPage:\"/\"+curPage))!==-1||mod.indexOf((\"pages\"+(curPage.substr(0,1)==='/'?curPage:\"/\"+curPage)).replace(/\\//g,'\\\\'))!==-1;});if(pageUpdated){document.location.reload(true);}else{curHash=mostRecentHash;}}catch(err){console.error('Error occurred checking for update',err);document.location.reload(true);}});return _tryApplyUpdates.apply(this,arguments);}(0,_eventsource.getEventSourceWrapper)({path:assetPrefix+\"/_next/webpack-hmr\"}).addMessageListener(event=>{if(event.data==='\\uD83D\\uDC93'){return;}try{var message=JSON.parse(event.data);if(message.action==='sync'||message.action==='built'){if(!message.hash){return;}mostRecentHash=message.hash;tryApplyUpdates();}else if(message.action==='reloadPage'){document.location.reload(true);}}catch(ex){console.warn('Invalid HMR message: '+event.data+'\\n'+ex);}});(0,_onDemandEntriesUtils.setupPing)(assetPrefix,()=>page);(0,_fouc.displayContent)();"]},"metadata":{},"sourceType":"script"}