UNPKG

4.81 kBJavaScriptView Raw
1"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var sourceMap=_interopDefault(require("source-map")),fs=_interopDefault(require("fs")),path=_interopDefault(require("path")),loaderUtils=_interopDefault(require("loader-utils")),SourceMapGenerator=sourceMap.SourceMapGenerator;function makeIdentitySourceMap(e,t){var n=new SourceMapGenerator;return n.setSourceContent(t,e),e.split("\n").forEach(function(e,r){n.addMapping({source:t,original:{line:r+1,column:0},generated:{line:r+1,column:0}})}),n.toJSON()}var makeIdentitySourceMap_1=makeIdentitySourceMap,injectionStart={16.6:["if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type)","if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, hotUpdateChild(child), child.type))"],"16.6-compact":["if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.elementType===element.type)","if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type, hotUpdateChild(child), child.type))"],16.4:["if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {","if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type, hotUpdateChild(child), child.type)) {"],"16.4-compact":["if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.type===element.type)","if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type, hotUpdateChild(child), child.type))"]},additional={"16.6-update":["if (current$$1 !== null && current$$1.elementType === element.type) {","if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type, hotUpdateChild(current$$1),current$$1.type)) {"],"16.6-update-compact":["if(current$$1!==null&&current$$1.elementType===element.type)","if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type,hotUpdateChild(current$$1),current$$1.type))"],"16.4-update":["if (current !== null && current.type === element.type) {","if (current !== null && hotCompareElements(current.type, element.type, hotUpdateChild(current),current.type)) {"],"16.4-update-compact":["if (current!== null&&current.type===element.type)","if (current!== null&&hotCompareElements(current.type,element.type,hotUpdateChild(current)))"]},ReactHotLoaderInjection="\nvar hotUpdateChild = function (child) {\n return function (newType) {\n child.type = newType;\n if (child.alternate) {\n child.alternate.type = newType;\n }\n }\n};\nvar hotCompareElements = function (oldType, newType) {\n return oldType === newType\n};\nvar hotCleanupHooks = function () {\n if (typeof resetHooks !== 'undefined') {\n resetHooks();\n }\n}\nvar ReactDOM = {\n evalInReactContext: function (injection) {\n return eval(injection);\n },\n hotCleanup: hotCleanupHooks,\n hotRenderWithHooks: function (current, render) { \n hotCleanupHooks();\n \n if (typeof nextCurrentHook !== 'undefined' && typeof ReactCurrentDispatcher$1 !== 'undefined') { \n nextCurrentHook = current !== null ? current.memoizedState : null;\n if(typeof firstCurrentHook !== 'undefined') {\n firstCurrentHook = nextCurrentHook;\n }\n \n ReactCurrentDispatcher$1.current = nextCurrentHook === null ? HooksDispatcherOnMountInDEV : HooksDispatcherOnUpdateInDEV;\n }\n \n var rendered = render();\n \n hotCleanupHooks();\n \n return rendered;\n },\n setHotElementComparator: function (newComparator) {\n hotCompareElements = newComparator\n },\n",defaultEnd=["var ReactDOM = {",ReactHotLoaderInjection],defaultEndCompact=["var ReactDOM={",ReactHotLoaderInjection],injectionEnd={16.6:defaultEnd,16.4:defaultEnd,"16.6-compact":defaultEndCompact,"16.4-compact":defaultEndCompact},sign="/* 🔥 this is hot-loader/react-dom 🔥 */";function additionalTransform(e){for(var t in additional)e=e.split(additional[t][0]).join(additional[t][1]);return e}function transform(e){if(e.indexOf("reconcileSingleElement")<0)return e;if(e.indexOf(sign)>=0)return e;for(var t in injectionStart)if(e.indexOf(injectionStart[t][0])>0&&e.indexOf(injectionEnd[t][0])>0){var n=additionalTransform(e.replace(injectionStart[t][0],injectionStart[t][1]).replace(injectionEnd[t][0],injectionEnd[t][1]));return sign+"\n"+n+"\n"+sign}return e}var patch=transform,SourceNode=sourceMap.SourceNode,SourceMapConsumer=sourceMap.SourceMapConsumer,tagCommonJSExportsSource=null;function transform$1(e,t){var n=this.async();return n(null,e,t)}transform$1.patch=patch;var webpack=transform$1;exports.default=webpack;