[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\n    [\n      \"env\",\n      {\n        \"modules\": false,\n        \"loose\": true\n      }\n    ],\n    \"react\"\n  ],\n  \"plugins\": [\n\n    [\"transform-class-properties\", { \"loose\": true }],\n    \"transform-object-rest-spread\",\n    \"dynamic-import-node\"\n  ]\n}\n"
  },
  {
    "path": ".eslintignore",
    "content": "node_modules/\n__babel_fixtures__/\ndist/\ncoverage/\nexamples/\nbabel.js\nindex.js\npatch.js\nwebpack.js\nroot.js\ntest/hot/react-dom"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  extends: ['airbnb', 'prettier', 'prettier/react'],\n  parser: 'babel-eslint',\n  rules: {\n    'no-underscore-dangle': ['error', { allow: ['__standin_getCurrent'] }],\n    'no-console': ['error', { allow: ['warn', 'error'] }],\n    'no-plusplus': 'off',\n    'no-continue': 'off',\n    'no-restricted-syntax': 'off',\n    'no-prototype-builtins': 'off',\n    'no-param-reassign': 'off',\n    'no-constant-condition': 'off',\n    'no-shadow': 'off',\n    'class-methods-use-this': 'off',\n    'import/no-extraneous-dependencies': 'off',\n    'import/prefer-default-export': 'off',\n    'react/prop-types': 'off',\n    'react/prefer-stateless-function': 'off',\n    'react/no-multi-comp': 'off',\n    'react/prefer-es6-class': 'off',\n    'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],\n    'react/require-default-props': 'off',\n    'jsx-a11y/no-static-element-interactions': 'off',\n    'jsx-a11y/click-events-have-key-events': 'off',\n  },\n  globals: {\n    __REACT_HOT_LOADER__: true,\n  },\n};\n"
  },
  {
    "path": ".gitattributes",
    "content": "*.js text eol=lf\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules/\ndist/\ncoverage/\n.DS_Store\n"
  },
  {
    "path": ".prettierignore",
    "content": "__babel_fixtures__/\n__snapshots__/\nnode_modules/\ndist/\npackage.json\nCHANGELOG.md\n.cache\nbabel.js\nindex.js\npatch.js\nroot.js\ntest/hot/react-dom\ncoverage"
  },
  {
    "path": ".prettierrc",
    "content": "{\n  \"singleQuote\": true,\n  \"trailingComma\": \"all\",\n  \"semi\": true,\n  \"printWidth\": 120\n}"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\n\nnode_js:\n  - 8\n  - 10\n\nbefore_install:\n  - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.3.2\n  - export PATH=\"$HOME/.yarn/bin:$PATH\"\n\nscript:\n  - yarn ci\n\nnotifications:\n  email: false\n\ncache:\n  yarn: true\n  directories:\n    - \".eslintcache\"\n    - \"node_modules\"\n"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\"orta.vscode-jest\", \"editorconfig.editorconfig\", \"dbaeumer.vscode-eslint\"]\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"debug.node.autoAttach\": \"on\"\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n\n## [4.13.0](https://github.com/gaearon/react-hot-loader/compare/v4.12.20...v4.13.0) (2020-09-22)\n\n\n### Bug Fixes\n\n* tailUpdate might be blocked by a PureComponent ([#1448](https://github.com/gaearon/react-hot-loader/issues/1448)) ([e44103a](https://github.com/gaearon/react-hot-loader/commit/e44103a))\n* when module.hot is not truthy ([#1451](https://github.com/gaearon/react-hot-loader/issues/1451)) ([ec3447f](https://github.com/gaearon/react-hot-loader/commit/ec3447f))\n\n\n### Features\n\n* support React 17 ([#1557](https://github.com/gaearon/react-hot-loader/issues/1557)) ([c05396b](https://github.com/gaearon/react-hot-loader/commit/c05396b)), closes [#1425](https://github.com/gaearon/react-hot-loader/issues/1425)\n\n### [4.12.21](https://github.com/gaearon/react-hot-loader/compare/v4.12.20...v4.12.21) (2020-04-30)\n\n### Bug Fixes\n\n* add peerDependenciesMeta in package.json (#1433)\n\n\n### [4.12.20](https://github.com/gaearon/react-hot-loader/compare/v4.12.19...v4.12.20) (2020-03-14)\n\n\n### Bug Fixes\n\n* patch support for react-dom 16.13 ([#1428](https://github.com/gaearon/react-hot-loader/issues/1428)) ([5475fe7](https://github.com/gaearon/react-hot-loader/commit/5475fe7))\n\n### [4.12.19](https://github.com/gaearon/react-hot-loader/compare/v4.12.18...v4.12.19) (2020-01-22)\n\n\n### Bug Fixes\n\n* don't record signatures of local hooks, fixes [#1412](https://github.com/gaearon/react-hot-loader/issues/1412) ([#1413](https://github.com/gaearon/react-hot-loader/issues/1413)) ([c159844](https://github.com/gaearon/react-hot-loader/commit/c159844))\n\n### [4.12.18](https://github.com/gaearon/react-hot-loader/compare/v4.12.17...v4.12.18) (2019-11-16)\n\n\n### Bug Fixes\n\n* (regression) hook order change is causing React error, fixes [#1393](https://github.com/gaearon/react-hot-loader/issues/1393) ([6707b4b](https://github.com/gaearon/react-hot-loader/commit/6707b4b))\n* production babel plugin might perform eager replacement, fixes [#1388](https://github.com/gaearon/react-hot-loader/issues/1388) ([b94adb3](https://github.com/gaearon/react-hot-loader/commit/b94adb3))\n\n### [4.12.17](https://github.com/gaearon/react-hot-loader/compare/v4.12.16...v4.12.17) (2019-11-12)\n\n\n### Bug Fixes\n\n* move @types/react from to peer dependencies, fixes [#1391](https://github.com/gaearon/react-hot-loader/issues/1391) ([5ab2cab](https://github.com/gaearon/react-hot-loader/commit/5ab2cab))\n\n### [4.12.16](https://github.com/gaearon/react-hot-loader/compare/v4.12.15...v4.12.16) (2019-11-06)\n\n\n### Bug Fixes\n\n* dont write to elementType if it is not defined, fixes [#1357](https://github.com/gaearon/react-hot-loader/issues/1357) ([1072303](https://github.com/gaearon/react-hot-loader/commit/1072303))\n* explain why RHL could not be activated, fixes [#1362](https://github.com/gaearon/react-hot-loader/issues/1362) ([9561d66](https://github.com/gaearon/react-hot-loader/commit/9561d66))\n* more @types/react to dependencies, fixes [#1359](https://github.com/gaearon/react-hot-loader/issues/1359) ([af42c1a](https://github.com/gaearon/react-hot-loader/commit/af42c1a))\n* use logger.warn instead of console to report tail update, fixes [#1386](https://github.com/gaearon/react-hot-loader/issues/1386) ([fbc890a](https://github.com/gaearon/react-hot-loader/commit/fbc890a))\n\n<a name=\"4.12.15\"></a>\n## [4.12.15](https://github.com/gaearon/react-hot-loader/compare/v4.12.14...v4.12.15) (2019-10-08)\n\n\n### Bug Fixes\n\n* React 16.10 support ([b7ed82a](https://github.com/gaearon/react-hot-loader/commit/b7ed82a))\n\n\n\n<a name=\"4.12.14\"></a>\n## [4.12.14](https://github.com/gaearon/react-hot-loader/compare/v4.12.13...v4.12.14) (2019-09-23)\n\n\n### Bug Fixes\n\n* autodetect underupdated state and trigger an automatic update, fixes [#1342](https://github.com/gaearon/react-hot-loader/issues/1342) ([33c54f5](https://github.com/gaearon/react-hot-loader/commit/33c54f5))\n* resolve all components to their last versions, [#1342](https://github.com/gaearon/react-hot-loader/issues/1342) ([62bc67e](https://github.com/gaearon/react-hot-loader/commit/62bc67e))\n\n\n\n<a name=\"4.12.13\"></a>\n## [4.12.13](https://github.com/gaearon/react-hot-loader/compare/v4.12.12...v4.12.13) (2019-09-12)\n\n\n### Bug Fixes\n\n* error overlay should not be injected into the first instance, fixes [#1337](https://github.com/gaearon/react-hot-loader/issues/1337) ([c019663](https://github.com/gaearon/react-hot-loader/commit/c019663))\n* return null for null types, fixes [#1324](https://github.com/gaearon/react-hot-loader/issues/1324) ([08d7ed1](https://github.com/gaearon/react-hot-loader/commit/08d7ed1))\n* run hot in batched mode, fixes [#1332](https://github.com/gaearon/react-hot-loader/issues/1332) ([e801daf](https://github.com/gaearon/react-hot-loader/commit/e801daf))\n\n\n\n<a name=\"4.12.12\"></a>\n## [4.12.12](https://github.com/gaearon/react-hot-loader/compare/v4.12.11...v4.12.12) (2019-08-27)\n\n\n### Bug Fixes\n\n* error overlay could fail by itself ([da50985](https://github.com/gaearon/react-hot-loader/commit/da50985))\n* resolve undefined types to undefined, fixes [#1324](https://github.com/gaearon/react-hot-loader/issues/1324) ([73eeb4e](https://github.com/gaearon/react-hot-loader/commit/73eeb4e))\n* speedup levenshtein comparison, fixes [#1087](https://github.com/gaearon/react-hot-loader/issues/1087) ([b81dcb0](https://github.com/gaearon/react-hot-loader/commit/b81dcb0))\n\n\n\n<a name=\"4.12.11\"></a>\n## [4.12.11](https://github.com/gaearon/react-hot-loader/compare/v4.12.10...v4.12.11) (2019-08-12)\n\n### Features\n\n* react 16.9 support, [1320](https://github.com/gaearon/react-hot-loader/pull/1320) by @Bnaya\n\n### Bug Fixes\n\n* add noRegister option to webpack, [#1315](https://github.com/gaearon/react-hot-loader/issues/1315) ([e562375](https://github.com/gaearon/react-hot-loader/commit/e562375))\n* remove circular deps from hot-loader ([2cb544d](https://github.com/gaearon/react-hot-loader/commit/2cb544d))\n\n\n\n<a name=\"4.12.10\"></a>\n## [4.12.10](https://github.com/gaearon/react-hot-loader/compare/v4.12.9...v4.12.10) (2019-07-27)\n\n\n### Bug Fixes\n\n* append react-hot-dom patch note to the ProxyFacade, fixes [#1311](https://github.com/gaearon/react-hot-loader/issues/1311) ([81bbb6a](https://github.com/gaearon/react-hot-loader/commit/81bbb6a))\n* use void IIFE for webpack plugin, fixes [#1309](https://github.com/gaearon/react-hot-loader/issues/1309) ([6089822](https://github.com/gaearon/react-hot-loader/commit/6089822))\n\n\n\n<a name=\"4.12.9\"></a>\n## [4.12.9](https://github.com/gaearon/react-hot-loader/compare/v4.12.8...v4.12.9) (2019-07-23)\n\n\n### Bug Fixes\n\n* forcely update Context Provider, fixes [#1207](https://github.com/gaearon/react-hot-loader/issues/1207) ([897a68d](https://github.com/gaearon/react-hot-loader/commit/897a68d))\n* updating shallowequal dependency ([9269580](https://github.com/gaearon/react-hot-loader/commit/9269580))\n\n\n\n<a name=\"4.12.8\"></a>\n## [4.12.8](https://github.com/gaearon/react-hot-loader/compare/v4.12.7...v4.12.8) (2019-07-18)\n\n\n### Bug Fixes\n\n* script error on IE11 due to lack of Object.entries ([6672b26](https://github.com/gaearon/react-hot-loader/commit/6672b26))\n\n\n\n<a name=\"4.12.7\"></a>\n## [4.12.7](https://github.com/gaearon/react-hot-loader/compare/v4.12.6...v4.12.7) (2019-07-16)\n\n\n### Bug Fixes\n\n* false negative comparisons with react-hot-dom enabled, fixes [#1299](https://github.com/gaearon/react-hot-loader/issues/1299) ([a1c5c31](https://github.com/gaearon/react-hot-loader/commit/a1c5c31))\n* reload hooks when hook body changes ([4795456](https://github.com/gaearon/react-hot-loader/commit/4795456))\n\n\n\n<a name=\"4.12.6\"></a>\n## [4.12.6](https://github.com/gaearon/react-hot-loader/compare/v4.12.5...v4.12.6) (2019-07-10)\n\n\n### Bug Fixes\n\n* do not update hooks while updating hooks, fixes [#1294](https://github.com/gaearon/react-hot-loader/issues/1294) ([afa8ed4](https://github.com/gaearon/react-hot-loader/commit/afa8ed4))\n\n\n\n<a name=\"4.12.5\"></a>\n## [4.12.5](https://github.com/gaearon/react-hot-loader/compare/v4.12.4...v4.12.5) (2019-07-07)\n\n\n### Bug Fixes\n\n* babel 7.5, fixes [#1292](https://github.com/gaearon/react-hot-loader/issues/1292) ([4441d6d](https://github.com/gaearon/react-hot-loader/commit/4441d6d))\n\n\n\n<a name=\"4.12.4\"></a>\n## [4.12.4](https://github.com/gaearon/react-hot-loader/compare/v4.12.3...v4.12.4) (2019-07-06)\n\n\n### Bug Fixes\n\n* remove lodash, [#1269](https://github.com/gaearon/react-hot-loader/issues/1269) ([8ad1b46](https://github.com/gaearon/react-hot-loader/commit/8ad1b46))\n\n\n\n<a name=\"4.12.3\"></a>\n## [4.12.3](https://github.com/gaearon/react-hot-loader/compare/v4.12.2...v4.12.3) (2019-07-04)\n\n\n### Bug Fixes\n\n* babel plugin should use only extrernals hooks, fixes [#1285](https://github.com/gaearon/react-hot-loader/issues/1285) ([c435eaa](https://github.com/gaearon/react-hot-loader/commit/c435eaa))\n* make type comparison stronger ([1b9f2da](https://github.com/gaearon/react-hot-loader/commit/1b9f2da))\n* prevent different typeof of components to be merged ([357249c](https://github.com/gaearon/react-hot-loader/commit/357249c))\n* regression of registered type comparison, fixes [#1284](https://github.com/gaearon/react-hot-loader/issues/1284) ([49851be](https://github.com/gaearon/react-hot-loader/commit/49851be))\n\n\n\n<a name=\"4.12.2\"></a>\n## [4.12.2](https://github.com/gaearon/react-hot-loader/compare/v4.12.1...v4.12.2) (2019-07-03)\n\n\n### Bug Fixes\n\n* [babel][prod] separate default and root 'hot' detection, fixes [#1283](https://github.com/gaearon/react-hot-loader/issues/1283) ([c6d29c9](https://github.com/gaearon/react-hot-loader/commit/c6d29c9))\n\n\n\n<a name=\"4.12.1\"></a>\n## [4.12.1](https://github.com/gaearon/react-hot-loader/compare/v4.12.0...v4.12.1) (2019-07-03)\n\n\n### Bug Fixes\n\n* clone node for signature, fixes [#1268](https://github.com/gaearon/react-hot-loader/issues/1268) ([ed3e1d9](https://github.com/gaearon/react-hot-loader/commit/ed3e1d9))\n* memo components are not updated ([5bca98c](https://github.com/gaearon/react-hot-loader/commit/5bca98c))\n* use deep clone for fresh signature, fixes [#1280](https://github.com/gaearon/react-hot-loader/issues/1280) ([d796af8](https://github.com/gaearon/react-hot-loader/commit/d796af8))\n\n\n\n<a name=\"4.12.0\"></a>\n# [4.12.0](https://github.com/gaearon/react-hot-loader/compare/v4.11.2...v4.12.0) (2019-06-30)\n\n\n### Features\n\n* disable hot replacement render if react-dom is patched, see [#1274](https://github.com/gaearon/react-hot-loader/issues/1274) ([b93eb1d](https://github.com/gaearon/react-hot-loader/commit/b93eb1d))\n\n\n\n<a name=\"4.11.2\"></a>\n## [4.11.2](https://github.com/gaearon/react-hot-loader/compare/v4.11.1...v4.11.2) (2019-06-30)\n\n### Bug Fixes\n\n* babel-plugin is not compatible with commonjs module output if babel 7 is used #1268.\n\n<a name=\"4.11.1\"></a>\n## [4.11.1](https://github.com/gaearon/react-hot-loader/compare/v4.11.0...v4.11.1) (2019-06-15)\n\n\n### Bug Fixes\n\n* hot render of forward props component ([4ba7530](https://github.com/gaearon/react-hot-loader/commit/4ba7530))\n* regression in hidden components reconcilation ([3f8efc4](https://github.com/gaearon/react-hot-loader/commit/3f8efc4))\n* update react-fresh babel plugin ([2fafd44](https://github.com/gaearon/react-hot-loader/commit/2fafd44))\n\n\n\n<a name=\"4.11.0\"></a>\n# [4.11.0](https://github.com/gaearon/react-hot-loader/compare/v4.9.0...v4.11.0) (2019-06-10)\n\n\n### Bug Fixes\n\n* source map consumer could be synchronous ([05a6c8e](https://github.com/gaearon/react-hot-loader/commit/05a6c8e))\n\n\n### Features\n\n* backport React.Fresh to handle hooks order change ([e5c4bb4](https://github.com/gaearon/react-hot-loader/commit/e5c4bb4))\n\n\n<a name=\"4.10.0\"></a>\n# [4.10.0](https://github.com/gaearon/react-hot-loader/compare/v4.9.0...v4.10.0) (2019-06-02)\n\n\n### Features\n\n* transparent class wrapping, fixes [#304](https://github.com/gaearon/react-hot-loader/issues/304) ([9fe4cad](https://github.com/gaearon/react-hot-loader/commit/9fe4cad))\n\n\n\n<a name=\"4.9.0\"></a>\n# [4.9.0](https://github.com/gaearon/react-hot-loader/compare/v4.8.8...v4.9.0) (2019-06-02)\n\n\n### Bug Fixes\n\n* false positive hot merge for forwardRef and Memo components, fixes [#1257](https://github.com/gaearon/react-hot-loader/issues/1257) ([dbf1047](https://github.com/gaearon/react-hot-loader/commit/dbf1047))\n* improve hot api for production mode - error reporting and babel plugin ([6b29911](https://github.com/gaearon/react-hot-loader/commit/6b29911))\n\n\n### Features\n\n* support hooks update on HMR, fixes [#1256](https://github.com/gaearon/react-hot-loader/issues/1256) ([7ab076c](https://github.com/gaearon/react-hot-loader/commit/7ab076c))\n\n\n\n<a name=\"4.8.8\"></a>\n## [4.8.8](https://github.com/gaearon/react-hot-loader/compare/v4.8.7...v4.8.8) (2019-05-23)\n\n\n### Bug Fixes\n\n* disable RHL when NODE_ENV == test, fixes [#1252](https://github.com/gaearon/react-hot-loader/issues/1252) ([6f56d87](https://github.com/gaearon/react-hot-loader/commit/6f56d87))\n\n\n\n<a name=\"4.8.7\"></a>\n## [4.8.7](https://github.com/gaearon/react-hot-loader/compare/v4.8.6...v4.8.7) (2019-05-20)\n\n\n### Bug Fixes\n\n* remove  checks. fixes [#1252](https://github.com/gaearon/react-hot-loader/issues/1252) ([2b2f733](https://github.com/gaearon/react-hot-loader/commit/2b2f733))\n\n\n\n<a name=\"4.8.6\"></a>\n## [4.8.6](https://github.com/gaearon/react-hot-loader/compare/v4.8.5...v4.8.6) (2019-05-18)\n\n\n### Bug Fixes\n\n* No HMR missing error in SSR ([956e52b](https://github.com/gaearon/react-hot-loader/commit/956e52b))\n* trailing commas at entrypoints, fixes [#1226](https://github.com/gaearon/react-hot-loader/issues/1226) ([989eebf](https://github.com/gaearon/react-hot-loader/commit/989eebf))\n\n\n\n<a name=\"4.8.5\"></a>\n## [4.8.5](https://github.com/gaearon/react-hot-loader/compare/v4.8.4...v4.8.5) (2019-05-16)\n\n\n### Bug Fixes\n\n* correct memo fiber updater, fixes [#1230](https://github.com/gaearon/react-hot-loader/issues/1230) ([a185494](https://github.com/gaearon/react-hot-loader/commit/a185494))\n* make  API more error prone, fixes [#1228](https://github.com/gaearon/react-hot-loader/issues/1228) ([a6ba488](https://github.com/gaearon/react-hot-loader/commit/a6ba488))\n* move react-dom notification to AppContainer, fixes [#1227](https://github.com/gaearon/react-hot-loader/issues/1227) ([28bfdd4](https://github.com/gaearon/react-hot-loader/commit/28bfdd4))\n* update root endpoint, fixes [#1226](https://github.com/gaearon/react-hot-loader/issues/1226), [#1240](https://github.com/gaearon/react-hot-loader/issues/1240) ([608805a](https://github.com/gaearon/react-hot-loader/commit/608805a))\n* use simpler conditions for index.js, implements [#1244](https://github.com/gaearon/react-hot-loader/issues/1244) ([4811d57](https://github.com/gaearon/react-hot-loader/commit/4811d57))\n* webpack plugin fails on hot-loader/react-dom, fixes #[#1234](https://github.com/gaearon/react-hot-loader/issues/1234) ([826eee3](https://github.com/gaearon/react-hot-loader/commit/826eee3))\n* webpack-plugin - use RHL global variable, fixes [#1251](https://github.com/gaearon/react-hot-loader/issues/1251) ([f036d36](https://github.com/gaearon/react-hot-loader/commit/f036d36))\n\n\n\n<a name=\"4.8.4\"></a>\n## [4.8.4](https://github.com/gaearon/react-hot-loader/compare/v4.8.3...v4.8.4) (2019-04-15)\n\n\n### Bug Fixes\n\n* document the importance of import order, fixes [#1209](https://github.com/gaearon/react-hot-loader/issues/1209) ([5f50ee4](https://github.com/gaearon/react-hot-loader/commit/5f50ee4))\n* dont skip first update or plain components ([432e0f8](https://github.com/gaearon/react-hot-loader/commit/432e0f8))\n* remove Object.assign, fixes [#1226](https://github.com/gaearon/react-hot-loader/issues/1226) ([c5af009](https://github.com/gaearon/react-hot-loader/commit/c5af009))\n\n\n\n<a name=\"4.8.3\"></a>\n## [4.8.3](https://github.com/gaearon/react-hot-loader/compare/v4.8.2...v4.8.3) (2019-04-05)\n\n\n### Bug Fixes\n\n* Allow refs on lazy components ([798e37f](https://github.com/gaearon/react-hot-loader/commit/798e37f))\n* invariant violation react 15 ([1351f2d](https://github.com/gaearon/react-hot-loader/commit/1351f2d))\n\n\n\n<a name=\"4.8.1\"></a>\n## [4.8.1](https://github.com/gaearon/react-hot-loader/compare/v4.8.0...v4.8.1) (2019-03-29)\n\n\n### Bug Fixes\n\n* root hot for parcel bundler, fixes [#1082](https://github.com/gaearon/react-hot-loader/issues/1082) ([a16679b](https://github.com/gaearon/react-hot-loader/commit/a16679b))\n\n\n\n<a name=\"4.8.0\"></a>\n# [4.8.0](https://github.com/gaearon/react-hot-loader/compare/v4.7.2...v4.8.0) (2019-03-07)\n\n\n### Features\n\n* support 16.8.4 ([38b63cd](https://github.com/gaearon/react-hot-loader/commit/38b63cd))\n\n\n\n<a name=\"4.7.2\"></a>\n## [4.7.2](https://github.com/gaearon/react-hot-loader/compare/v4.7.1...v4.7.2) (2019-03-04)\n\n\n### Bug Fixes\n\n* safer reads from context consumer ([7942d26](https://github.com/gaearon/react-hot-loader/commit/7942d26))\n* suppress error message on a server side, fixes [#1188](https://github.com/gaearon/react-hot-loader/issues/1188) ([b12b430](https://github.com/gaearon/react-hot-loader/commit/b12b430))\n\n\n\n<a name=\"4.7.1\"></a>\n## [4.7.1](https://github.com/gaearon/react-hot-loader/compare/v4.7.0...v4.7.1) (2019-02-20)\n\n\n### Bug Fixes\n\n* destructed Context.Provider breaking registrations. fixes [#1184](https://github.com/gaearon/react-hot-loader/issues/1184) ([8240111](https://github.com/gaearon/react-hot-loader/commit/8240111))\n* do not poison memoized props ([9f6ab6e](https://github.com/gaearon/react-hot-loader/commit/9f6ab6e))\n* rethrow an error is hot comparison is not open ([8befa5a](https://github.com/gaearon/react-hot-loader/commit/8befa5a))\n\n\n\n<a name=\"4.7.0\"></a>\n# [4.7.0](https://github.com/gaearon/react-hot-loader/compare/v4.6.5...v4.7.0) (2019-02-18)\n\n\n### Bug Fixes\n\n* complain if hot patches not present, fixes [#1173](https://github.com/gaearon/react-hot-loader/issues/1173) ([efc3d6b](https://github.com/gaearon/react-hot-loader/commit/efc3d6b))\n* deactivate RHL in dev mode if eval not allowed ([f995b0d](https://github.com/gaearon/react-hot-loader/commit/f995b0d))\n* disable ErrorBoundaries for a first run, fixes [#1172](https://github.com/gaearon/react-hot-loader/issues/1172) ([2a834c2](https://github.com/gaearon/react-hot-loader/commit/2a834c2))\n* Support Context.Provider reload and React.memo, fixes [#1169](https://github.com/gaearon/react-hot-loader/issues/1169) ([09e48eb](https://github.com/gaearon/react-hot-loader/commit/09e48eb))\n\n\n### Features\n\n* activate pureRender by default ([4e971b5](https://github.com/gaearon/react-hot-loader/commit/4e971b5))\n* implement flexible hot injections ([b7e8f5e](https://github.com/gaearon/react-hot-loader/commit/b7e8f5e))\n* make errors retryable to mitigate hooks update ([9967fde](https://github.com/gaearon/react-hot-loader/commit/9967fde))\n\n\n\n<a name=\"4.6.5\"></a>\n## [4.6.5](https://github.com/gaearon/react-hot-loader/compare/v4.6.4...v4.6.5) (2019-01-31)\n\n\n### Bug Fixes\n\n* babel plugin produces a broken code ([6f8573f](https://github.com/gaearon/react-hot-loader/commit/6f8573f))\n\n\n\n<a name=\"4.6.4\"></a>\n## [4.6.4](https://github.com/gaearon/react-hot-loader/compare/v4.6.3...v4.6.4) (2019-01-31)\n\n\n### Bug Fixes\n\n* do not shadow component name ([4b02767](https://github.com/gaearon/react-hot-loader/commit/4b02767))\n* do not supress HMR errors ([be79d2f](https://github.com/gaearon/react-hot-loader/commit/be79d2f))\n* fix wrong react-dom name resolution installation ([6f829a0](https://github.com/gaearon/react-hot-loader/commit/6f829a0))\n* opt-out for module safety net, fixes [#1102](https://github.com/gaearon/react-hot-loader/issues/1102), [#1159](https://github.com/gaearon/react-hot-loader/issues/1159) ([93d0b1f](https://github.com/gaearon/react-hot-loader/commit/93d0b1f))\n* remove platform checks from production bundle, fixes [#1162](https://github.com/gaearon/react-hot-loader/issues/1162) ([24d0448](https://github.com/gaearon/react-hot-loader/commit/24d0448))\n* update fiber cached type, fixes [#1139](https://github.com/gaearon/react-hot-loader/issues/1139) ([35984ff](https://github.com/gaearon/react-hot-loader/commit/35984ff))\n\n\n\n<a name=\"4.6.3\"></a>\n## [4.6.3](https://github.com/gaearon/react-hot-loader/compare/v4.6.2...v4.6.3) (2018-12-19)\n\n\n### Bug Fixes\n\n* context information is not always properly emulated in hot-render, fixes [#1094](https://github.com/gaearon/react-hot-loader/issues/1094) ([100fc9c](https://github.com/gaearon/react-hot-loader/commit/100fc9c))\n* RHL could update non-relative components ([5d4f226](https://github.com/gaearon/react-hot-loader/commit/5d4f226))\n* update memo updater and comparator. fix [#1135](https://github.com/gaearon/react-hot-loader/issues/1135) ([826a57c](https://github.com/gaearon/react-hot-loader/commit/826a57c))\n\n\n\n<a name=\"4.6.2\"></a>\n## [4.6.2](https://github.com/gaearon/react-hot-loader/compare/v4.6.1...v4.6.2) (2018-12-18)\n\n\n### Bug Fixes\n\n* allow multiple 'hot' in one file, registering only the first one ([68c2a0a](https://github.com/gaearon/react-hot-loader/commit/68c2a0a))\n* error overlay initialization prior body, fixes [#1127](https://github.com/gaearon/react-hot-loader/issues/1127) ([9177aba](https://github.com/gaearon/react-hot-loader/commit/9177aba))\n\n\n\n<a name=\"4.6.1\"></a>\n## [4.6.1](https://github.com/gaearon/react-hot-loader/compare/4.6.0...4.6.1) (2018-12-17)\n\n\n### Bug Fixes\n\n* display hmr errors as hmr errors, [#1131](https://github.com/gaearon/react-hot-loader/issues/1131) ([615790f](https://github.com/gaearon/react-hot-loader/commit/615790f))\n* error overlay is not server side friendly, [#1126](https://github.com/gaearon/react-hot-loader/issues/1126) ([40e3ff2](https://github.com/gaearon/react-hot-loader/commit/40e3ff2))\n* hmr error detection is flaky ([9d3a2c0](https://github.com/gaearon/react-hot-loader/commit/9d3a2c0))\n* secure wrapped/uwrapped comparison ([a62bacd](https://github.com/gaearon/react-hot-loader/commit/a62bacd))\n* webpack plugin outputs es2015 code ([8a66401](https://github.com/gaearon/react-hot-loader/commit/8a66401))\n\n\n\n<a name=\"4.6.0\"></a>\n# [4.6.0](https://github.com/gaearon/react-hot-loader/compare/v4.5.3...v4.6.0) (2018-12-13)\n\n\n### Features\n\n* implement flexible error boundaries ([1846019](https://github.com/gaearon/react-hot-loader/commit/1846019))\n* new root/hot for better error management. Fixes [#1078](https://github.com/gaearon/react-hot-loader/issues/1078), [#1111](https://github.com/gaearon/react-hot-loader/issues/1111) ([3029428](https://github.com/gaearon/react-hot-loader/commit/3029428))\n\n<a name=\"4.5.3\"></a>\n## [4.5.3](https://github.com/gaearon/react-hot-loader/compare/v4.5.2...v4.5.3) (2018-12-07)\n\n\n### Bug Fixes\n\n* enable class equality, but disable class merge, when not hot ([8d214b3](https://github.com/gaearon/react-hot-loader/commit/8d214b3))\n* react-dom hot-replacement is too active ([8827a40](https://github.com/gaearon/react-hot-loader/commit/8827a40))\n\n\n\n<a name=\"4.5.2\"></a>\n## [4.5.2](https://github.com/gaearon/react-hot-loader/compare/v4.5.1...v4.5.2) (2018-12-06)\n\n\n### Bug Fixes\n\n* forwardRef to be remounted every frame. React-router to merge components ([3b11866](https://github.com/gaearon/react-hot-loader/commit/3b11866))\n* React-router to merge components ([f45fee0](https://github.com/gaearon/react-hot-loader/commit/f45fee0))\n* remove early reject, [#1115](https://github.com/gaearon/react-hot-loader/issues/1115) ([0a28144](https://github.com/gaearon/react-hot-loader/commit/0a28144))\n\n\n\n<a name=\"4.5.1\"></a>\n## [4.5.1](https://github.com/gaearon/react-hot-loader/compare/v4.5.0...v4.5.1) (2018-11-21)\n\n\n### Bug Fixes\n\n* add lodash.merge as dep ([1de55d6](https://github.com/gaearon/react-hot-loader/commit/1de55d6))\n\n\n\n<a name=\"4.5.0\"></a>\n# [4.5.0](https://github.com/gaearon/react-hot-loader/compare/v4.4.0...v4.5.0) (2018-11-20)\n\n\n### Bug Fixes\n\n* handle older React versions ([a03c1c3](https://github.com/gaearon/react-hot-loader/commit/a03c1c3))\n* hot-render forwardRef ([5f362ad](https://github.com/gaearon/react-hot-loader/commit/5f362ad))\n* IE11 compact, [#1099](https://github.com/gaearon/react-hot-loader/issues/1099) ([f8ef550](https://github.com/gaearon/react-hot-loader/commit/f8ef550))\n\n\n### Features\n\n* webpack patch/inject mode ([42d637b](https://github.com/gaearon/react-hot-loader/commit/42d637b))\n\n\n\n<a name=\"4.4.0-1\"></a>\n## 4.4.0-1 (2018-11-01)\n### Bug Fixes\n- `forwardRef` reconciliation [#1100](https://github.com/gaearon/react-hot-loader/pull/1100)\n\n<a name=\"4.4.0\"></a>\n## [4.4.0](https://github.com/gaearon/react-hot-loader/compare/v4.3.11...v4.3.12) (2018-11-01)\n\n\n### Features\n* React 16.5 and React 16.6 support. forwardRef, memo, lazy [#1084](https://github.com/gaearon/react-hot-loader/pull/1084)\n* Webpack loader [#1098](https://github.com/gaearon/react-hot-loader/pull/1098)\n* mark RHL sideEffect-free in production mode [#1096](https://github.com/gaearon/react-hot-loader/pull/1096)\n* babel plugin will remove `hot` in production [#1091](https://github.com/gaearon/react-hot-loader/pull/1091)\n\n### Bug Fixes\n\n* babel plugin will remove calls to `hot` in production mode to remove side-effect on webpack [#1081](https://github.com/gaearon/react-hot-loader/pull/1081)\n* class methods, deleted on update, will be deleted from proxy [#1091](https://github.com/gaearon/react-hot-loader/pull/1091)\n\n<a name=\"4.3.11\"></a>\n## [4.3.11](https://github.com/gaearon/react-hot-loader/compare/v4.3.9...v4.3.11) (2018-09-20)\n\n\n### Bug Fixes\n\n* hot fixing ES5 literals in index.js ([80f6b63](https://github.com/gaearon/react-hot-loader/commit/80f6b63))\n\n\n\n<a name=\"4.3.10\"></a>\n## [4.3.10](https://github.com/gaearon/react-hot-loader/compare/v4.3.9...v4.3.10) (2018-09-20)\n\n### Bug Fixes\n\n* IE10/CSP compatibility. [#1073](https://github.com/gaearon/react-hot-loader/pull/1073)\n\n<a name=\"4.3.7\"></a>\n## [4.3.7](https://github.com/gaearon/react-hot-loader/compare/v4.3.6...v4.3.7) (2018-09-13)\n\n\n### Bug Fixes\n\n* babel 7 compatibility. [#1043](https://github.com/gaearon/react-hot-loader/issues/1043) ([acad937](https://github.com/gaearon/react-hot-loader/commit/acad937))\n\n\n\n<a name=\"4.3.6\"></a>\n## [4.3.6](https://github.com/gaearon/react-hot-loader/compare/v4.3.5...v4.3.6) (2018-09-04)\n\n\n### Bug Fixes\n\n* don't inadvertendly call getters ([322e746](https://github.com/gaearon/react-hot-loader/commit/322e746))\n\n\n\n<a name=\"4.3.5\"></a>\n## [4.3.5](https://github.com/gaearon/react-hot-loader/compare/4.3.4...4.3.5) (2018-08-23)\n\n\n### Bug Fixes\n\n* dont hot-swap registered components, [#1050](https://github.com/gaearon/react-hot-loader/issues/1050) ([cf165a6](https://github.com/gaearon/react-hot-loader/commit/cf165a6))\n* use the same conditions for index and patch ([f67d5b9](https://github.com/gaearon/react-hot-loader/commit/f67d5b9))\n\n\n\n<a name=\"4.3.4\"></a>\n## [4.3.4](https://github.com/gaearon/react-hot-loader/compare/v4.3.3...v4.3.4) (2018-07-25)\n\n\n### Bug Fixes\n\n* element could be double-proxied ([#1033](https://github.com/gaearon/react-hot-loader/pull/1033))\n* Components, not directly inherited from React.Components, like StyledComponents, are not working ([#1031](https://github.com/gaearon/react-hot-loader/pull/1031)) \n\n\n\n<a name=\"4.3.3\"></a>\n## [4.3.3](https://github.com/gaearon/react-hot-loader/compare/4.3.1...4.3.3) (2018-06-15)\n\n\n### Bug Fixes\n\n* add _this to sandbox variables, [#1020](https://github.com/gaearon/react-hot-loader/issues/1020) ([e5284ab](https://github.com/gaearon/react-hot-loader/commit/e5284ab))\n\n\n\n<a name=\"4.3.2\"></a>\n## [4.3.2](https://github.com/gaearon/react-hot-loader/compare/4.3.1...4.3.2) (2018-06-13)\n\n### Bug Fixes\n* Add cold API to TypeScript definitions\n\n<a name=\"4.3.1\"></a>\n## [4.3.1](https://github.com/gaearon/react-hot-loader/compare/4.3.0...4.3.1) (2018-06-09)\n\n\n### Bug Fixes\n\n* Preact could pass arguments to the render, fix [#1013](https://github.com/gaearon/react-hot-loader/issues/1013) ([605da10](https://github.com/gaearon/react-hot-loader/commit/605da10))\n* Support _this10 and over ([bb47ca4](https://github.com/gaearon/react-hot-loader/commit/bb47ca4))\n* Handle lazy indeterminate static properties(Relay) [#1014](https://github.com/gaearon/react-hot-loader/pull/1014)\n\n\n\n<a name=\"4.3.0\"></a>\n# [4.3.0](https://github.com/gaearon/react-hot-loader/compare/v4.2.0...v4.3.0) (2018-06-05)\n\n\n### Bug Fixes\n\n* Context Provider could crash due update, [#944](https://github.com/gaearon/react-hot-loader/issues/944) ([b0e2b5b](https://github.com/gaearon/react-hot-loader/commit/b0e2b5b))\n* RHL babel plugin will ignore react and react-hot-loader, fixes [#900](https://github.com/gaearon/react-hot-loader/issues/900) ([e90a25c](https://github.com/gaearon/react-hot-loader/commit/e90a25c))\n* RHL should add new class methods ([111d56e](https://github.com/gaearon/react-hot-loader/commit/111d56e))\n* Multiple problems with methods update. Revert behavior back to v4.1.2 [#1001](https://github.com/gaearon/react-hot-loader/issues/1001)\n\n### Features\n\n* Preact support [#952](https://github.com/gaearon/react-hot-loader/issues/952) ([2b40f57](https://github.com/gaearon/react-hot-loader/commit/2b40f57))\n* Cold components [#991](https://github.com/gaearon/react-hot-loader/issues/991) ([9bcff36](https://github.com/gaearon/react-hot-loader/commit/9bcff36))\n\n\n\n<a name=\"4.2.0\"></a>\n## [4.2.0](https://github.com/gaearon/react-hot-loader/compare/v4.1.3...v4.2.0) (2018-05-16)\n\n## Changes\n * Stateless Components will be converted to React.Component ones (as they were prior 4.1.0) [#977](https://github.com/gaearon/react-hot-loader/pull/977)\n\n## Features\n * Basic support for React 16 Context [#979](https://github.com/gaearon/react-hot-loader/issues/979)\n\n## Bug fixes\n * pure components wont update [#959](https://github.com/gaearon/react-hot-loader/issues/959), [#944](https://github.com/gaearon/react-hot-loader/issues/944)\n * better babel compliance (\"this5\"), [#969](https://github.com/gaearon/react-hot-loader/issues/969)\n * sideeffect-less updates [#970](https://github.com/gaearon/react-hot-loader/pull/970)\n * render as a class property [#924](https://github.com/gaearon/react-hot-loader/issues/924)\n * issues around reactLifecyclesCompat.polyfill [#951](https://github.com/gaearon/react-hot-loader/issues/951)\n * more examples and test cases\n * multiple reconsilation related bug fixes\n\n<a name=\"4.1.3\"></a>\n## [4.1.3](https://github.com/gaearon/react-hot-loader/compare/v4.1.2...v4.1.3) (2018-05-08)\n\n\n### Bug Fixes\n\n* always update bound functions. [#949](https://github.com/gaearon/react-hot-loader/issues/949) ([7819c71](https://github.com/gaearon/react-hot-loader/commit/7819c71))\n* Fragment with a single element. fixes [#956](https://github.com/gaearon/react-hot-loader/issues/956) ([7e80881](https://github.com/gaearon/react-hot-loader/commit/7e80881))\n* props merge order. [#967](https://github.com/gaearon/react-hot-loader/issues/967) ([#968](https://github.com/gaearon/react-hot-loader/issues/968)) ([1f8adb9](https://github.com/gaearon/react-hot-loader/commit/1f8adb9))\n\n\n\n<a name=\"4.1.2\"></a>\n\n## [4.1.2](https://github.com/gaearon/react-hot-loader/compare/4.1.0...4.1.2) (2018-04-24)\n\n### Bug Fixes\n\n* condition render in Fragments [#942](https://github.com/gaearon/react-hot-loader/issues/942) ([#943](https://github.com/gaearon/react-hot-loader/issues/943)) ([2549a18](https://github.com/gaearon/react-hot-loader/commit/2549a18))\n\n<a name=\"4.1.1\"></a>\n\n## [4.1.1](https://github.com/gaearon/react-hot-loader/compare/4.1.0...4.1.1) (2018-04-24)\n\n### Bug Fixes\n\n* Proxy should keep methods own props. [#918](https://github.com/gaearon/react-hot-loader/issues/918) ([a84dcd0](https://github.com/gaearon/react-hot-loader/commit/a84dcd0))\n\n<a name=\"4.1.0\"></a>\n\n## [4.1.0](https://github.com/gaearon/react-hot-loader/compare/4.0.1...4.1.0) (2018-04-18)\n\n### Features\n\n* 🚀 React 16.3 support  ([#918](https://github.com/gaearon/react-hot-loader/issues/918))\n* 🧙🏻‍♂️ StatelessFunctionComponents are not wrapped by Stateful components anymore ([#873](https://github.com/gaearon/react-hot-loader/issues/873))\n* 🧠Improved TypeScript support (no more than documentation)  ([#884](https://github.com/gaearon/react-hot-loader/issues/884))\n\n### Bug Fixes\n*  support babel temporal `_this3` ([#928](https://github.com/gaearon/react-hot-loader/issues/928))\n\n<a name=\"4.0.1\"></a>\n\n## [4.0.1](https://github.com/gaearon/react-hot-loader/compare/v4.0.0...v4.0.1) (2018-04-01)\n\n### Bug Fixes\n\n* fix double proxy registration ([#915](https://github.com/gaearon/react-hot-loader/issues/915)) ([f8532df](https://github.com/gaearon/react-hot-loader/commit/f8532df)), closes [#912](https://github.com/gaearon/react-hot-loader/issues/912)\n* replace `.includes` by `.indexOf` (IE11 fix) ([#906](https://github.com/gaearon/react-hot-loader/issues/906)) ([87ad586](https://github.com/gaearon/react-hot-loader/commit/87ad586))\n* break render recursion (MobX fix) ([#889](https://github.com/gaearon/react-hot-loader/issues/889)) ([33f2376](https://github.com/gaearon/react-hot-loader/commit/33f2376))\n\n### Docs\n\n* Improve TypeScript documentation ([#914](https://github.com/gaearon/react-hot-loader/issues/914)) ([d3b91de](https://github.com/gaearon/react-hot-loader/commit/d3b91de))\n\n<a name=\"4.0.0\"></a>\n\n# [4.0.0](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-rc.0...v4.0.0) (2018-02-27)\n\n### Bug Fixes\n\n* proper children reconcile for nested tags, fixes [#869](https://github.com/gaearon/react-hot-loader/issues/869) ([#871](https://github.com/gaearon/react-hot-loader/issues/871)) ([2de4e58](https://github.com/gaearon/react-hot-loader/commit/2de4e58))\n\n<a name=\"4.0.0-rc.0\"></a>\n\n# [4.0.0-rc.0](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.23...v4.0.0-rc.0) (2018-02-19)\n\n<a name=\"4.0.0-beta.23\"></a>\n\n# [4.0.0-beta.23](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.22...v4.0.0-beta.23) (2018-02-18)\n\n### Bug Fixes\n\n* disable RHL when HMR is not activated ([#863](https://github.com/gaearon/react-hot-loader/issues/863)) ([ffe0035](https://github.com/gaearon/react-hot-loader/commit/ffe0035))\n* fix various bugs ([#857](https://github.com/gaearon/react-hot-loader/issues/857)) ([8fa1d42](https://github.com/gaearon/react-hot-loader/commit/8fa1d42)), closes [#845](https://github.com/gaearon/react-hot-loader/issues/845) [#843](https://github.com/gaearon/react-hot-loader/issues/843)\n* transfer original prototype methods ([#859](https://github.com/gaearon/react-hot-loader/issues/859)) ([0b7997f](https://github.com/gaearon/react-hot-loader/commit/0b7997f)), closes [#845](https://github.com/gaearon/react-hot-loader/issues/845) [#843](https://github.com/gaearon/react-hot-loader/issues/843) [#858](https://github.com/gaearon/react-hot-loader/issues/858)\n\n<a name=\"4.0.0-beta.22\"></a>\n\n# [4.0.0-beta.22](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.21...v4.0.0-beta.22) (2018-02-10)\n\n### Bug Fixes\n\n* fix reconciler warnings ([#852](https://github.com/gaearon/react-hot-loader/issues/852)) ([963677f](https://github.com/gaearon/react-hot-loader/commit/963677f)), closes [#843](https://github.com/gaearon/react-hot-loader/issues/843)\n\n### Features\n\n* ship flat bundles ([#844](https://github.com/gaearon/react-hot-loader/issues/844)) ([7580552](https://github.com/gaearon/react-hot-loader/commit/7580552))\n\n<a name=\"4.0.0-beta.21\"></a>\n\n# [4.0.0-beta.21](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.20...v4.0.0-beta.21) (2018-02-05)\n\n### Bug Fixes\n\n* fix proxy adapter ([#842](https://github.com/gaearon/react-hot-loader/issues/842)) ([9bb8251](https://github.com/gaearon/react-hot-loader/commit/9bb8251))\n\n<a name=\"4.0.0-beta.20\"></a>\n\n# [4.0.0-beta.20](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.19...v4.0.0-beta.20) (2018-02-04)\n\n<a name=\"4.0.0-beta.19\"></a>\n\n# [4.0.0-beta.19](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.18...v4.0.0-beta.19) (2018-02-03)\n\n### Bug Fixes\n\n* **areComponentsEqual:** fix behaviour ([#829](https://github.com/gaearon/react-hot-loader/issues/829)) ([d4dcd07](https://github.com/gaearon/react-hot-loader/commit/d4dcd07))\n* **prop-types:** add prop-types as dependency ([#823](https://github.com/gaearon/react-hot-loader/issues/823)) ([c2b7c3c](https://github.com/gaearon/react-hot-loader/commit/c2b7c3c))\n* regenerate overriden members ([#837](https://github.com/gaearon/react-hot-loader/issues/837)) ([39d4f5b](https://github.com/gaearon/react-hot-loader/commit/39d4f5b)), closes [#836](https://github.com/gaearon/react-hot-loader/issues/836)\n\n<a name=\"4.0.0-beta.18\"></a>\n\n# [4.0.0-beta.18](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.17...v4.0.0-beta.18) (2018-01-25)\n\n### Bug Fixes\n\n* break cyclic dependency ([#822](https://github.com/gaearon/react-hot-loader/issues/822)) ([328d793](https://github.com/gaearon/react-hot-loader/commit/328d793)), closes [#820](https://github.com/gaearon/react-hot-loader/issues/820)\n\n<a name=\"4.0.0-beta.17\"></a>\n\n# [4.0.0-beta.17](https://github.com/gaearon/react-hot-loader/compare/4.0.0-beta.16...v4.0.0-beta.17) (2018-01-22)\n\n### Features\n\n* remove useless dependencies ([e1b83e5](https://github.com/gaearon/react-hot-loader/commit/e1b83e5)), closes [#808](https://github.com/gaearon/react-hot-loader/issues/808)\n\n### Bug Fixes\n\n* warn about errors [#814](https://github.com/gaearon/react-hot-loader/issues/814)\n* handle wrong module [#813](https://github.com/gaearon/react-hot-loader/issues/#813)\n\n<a name=\"4.0.0-beta.16\"></a>\n\n# [4.0.0-beta.16](https://github.com/theKashey/react-hot-loader/compare/v4.0.0-beta.15-1...v4.0.0-beta.16) (2018-01-21)\n\n* **react-hot-loader:** Hard code consts from stand-in [#807](https://github.com/gaearon/react-hot-loader/issues/807))\n* **react-hot-loader:** Support React 16 Fragments [#799](https://github.com/gaearon/react-hot-loader/issues/799))\n* **react-hot-loader:** Suppress some warnings [#804](https://github.com/gaearon/react-hot-loader/issues/804))\n* **react-hot-loader:** Better Electron support [#794](https://github.com/gaearon/react-hot-loader/issues/794))\n\n* **react-stand-in:** Fix IE11 regression (again)\n\n<a name=\"4.0.0-beta.15\"></a>\n\n# [4.0.0-beta.15](https://github.com/theKashey/react-hot-loader/compare/v4.0.0-beta.14...v4.0.0-beta.15) (2018-01-16)\n\n* **react-deep-force-update:** remove from the project\n* **react-stand-in:** fix MobX (Cannot assign to read only property 'render', [#796](https://github.com/gaearon/react-hot-loader/issues/796))\n\n<a name=\"4.0.0-beta.14\"></a>\n\n# [4.0.0-beta.14](https://github.com/theKashey/react-hot-loader/compare/v4.0.0-beta.13...v4.0.0-beta.14) (2018-01-14)\n\n* **react-hot-loader:** support IE11 ([#772](https://github.com/gaearon/react-hot-loader/issues/772))\n* **react-stand-in:** support Relay Classis/Modern([#775](https://github.com/gaearon/react-hot-loader/issues/775))\n\n<a name=\"4.0.0-beta.13\"></a>\n\n# [4.0.0-beta.13](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.12...v4.0.0-beta.13) (2018-01-09)\n\n### Features\n\n* **react-hot-loader:** detect wrong usage of `hot` ([#766](https://github.com/gaearon/react-hot-loader/issues/766)) ([b9738c7](https://github.com/gaearon/react-hot-loader/commit/b9738c7)), closes [#765](https://github.com/gaearon/react-hot-loader/issues/765)\n\n<a name=\"4.0.0-beta.12\"></a>\n\n# [4.0.0-beta.12](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.11...v4.0.0-beta.12) (2018-01-02)\n\n### Bug Fixes\n\n* target ES5 for production code ([b1d6d05](https://github.com/gaearon/react-hot-loader/commit/b1d6d05)), closes [#758](https://github.com/gaearon/react-hot-loader/issues/758)\n\n<a name=\"4.0.0-beta.11\"></a>\n\n# [4.0.0-beta.11](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.10...v4.0.0-beta.11) (2017-12-30)\n\n### Bug Fixes\n\n* **build:** fix builded files ([f4aa275](https://github.com/gaearon/react-hot-loader/commit/f4aa275))\n\n<a name=\"4.0.0-beta.10\"></a>\n\n# [4.0.0-beta.10](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.9...v4.0.0-beta.10) (2017-12-30)\n\n### Bug Fixes\n\n* **babel:** do not use capital letters ([#754](https://github.com/gaearon/react-hot-loader/issues/754)) ([bf48675](https://github.com/gaearon/react-hot-loader/commit/bf48675)), closes [#753](https://github.com/gaearon/react-hot-loader/issues/753)\n\n<a name=\"4.0.0-beta.9\"></a>\n\n# [4.0.0-beta.9](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.8...v4.0.0-beta.9) (2017-12-30)\n\n### Bug Fixes\n\n* **react-hot-loader:** require `react-hot-loader/patch` in each file ([3038538](https://github.com/gaearon/react-hot-loader/commit/3038538)), closes [#750](https://github.com/gaearon/react-hot-loader/issues/750)\n\n<a name=\"4.0.0-beta.8\"></a>\n\n# [4.0.0-beta.8](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.7...v4.0.0-beta.8) (2017-12-29)\n\n### Bug Fixes\n\n* **react-hot-loader:** fix missing export ([239ca5d](https://github.com/gaearon/react-hot-loader/commit/239ca5d))\n\n<a name=\"4.0.0-beta.7\"></a>\n\n# [4.0.0-beta.7](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.6...v4.0.0-beta.7) (2017-12-29)\n\n### Bug Fixes\n\n* handle async loading of patch ([#739](https://github.com/gaearon/react-hot-loader/issues/739)) ([af8bd4b](https://github.com/gaearon/react-hot-loader/commit/af8bd4b))\n* **react-hot-loader:** fix componentWillUpdate ([95a9e79](https://github.com/gaearon/react-hot-loader/commit/95a9e79))\n* use safe defineProperty ([f901192](https://github.com/gaearon/react-hot-loader/commit/f901192))\n\n### Features\n\n* replace warnings by `configure({ debug: true })` ([4f079c6](https://github.com/gaearon/react-hot-loader/commit/4f079c6))\n\n<a name=\"4.0.0-beta.6\"></a>\n\n# [4.0.0-beta.6](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.5...v4.0.0-beta.6) (2017-12-27)\n\nSame as 4.0.0-beta.5, fix build problem.\n\n<a name=\"4.0.0-beta.5\"></a>\n\n# [4.0.0-beta.5](https://github.com/gaearon/react-hot-loader/compare/v4.0.0-beta.4...v4.0.0-beta.5) (2017-12-27)\n\n### Bug Fixes\n\n* improve decorators support (autobind)\n  ([56883c9](https://github.com/gaearon/react-hot-loader/commit/56883c9))\n* support nested children\n  ([#735](https://github.com/gaearon/react-hot-loader/issues/735))\n  ([5c81655](https://github.com/gaearon/react-hot-loader/commit/5c81655))\n\n# Manual changelog\n\n### 4.0.0-beta.4\n\n* Handle terminal node in stack (#728)\n\n### 4.0.0-beta.3\n\n* Use setTimeout to tick (#726)\n\n### 4.0.0-beta.2\n\n* Bunch of fixes (#725)\n\n### 4.0.0-beta.1\n\n* Remove webpack plugin (#707)\n* Replace react-proxy by react-stand-in (#707)\n* Replace react-deep-force-update by reconciler (#703)\n* Add `hot` HOC (#707)\n* Add `areComponentsEqual` (#304)\n* `warnings` flag now controls reconciler, not dev patch.\n\n### 3.1.1\n\n* Revert fix arrow function that uses props in constructor (#670)\n* Remove babel-template dependency (#671)\n\n### 3.1.0\n\n* Add an option to disable warnings (#669)\n* Fix arrow function that uses props in constructor (#670)\n\n### 3.0.0\n\n* Add React 16 support (#629, #658)\n* Remove RedBox as default error catcher (#494)\n\n### 3.0.0-beta.6\n\n* Use production versions of `patch` and `AppContainer` if no `module.hot`\n  available, so it doesn't break people using `NODE_ENV=test`. (#398)\n* Opt out of transforming static class properties. (#381)\n\n### 3.0.0-beta.5\n\n* Makes the class properties portion of the Babel plugin work with async\n  functions. (#372)\n* Change the output of the tagger code in the Babel plugin so that it doesn't\n  break the output of `babel-node`. (#374)\n\n### 3.0.0-beta.4\n\n* Extends the Babel plugin to enable hot reloading of class properties. (#322)\n* Fixes a bug in the Webpack loader from a component importing a module with the\n  same basename. (#347)\n\n### 3.0.0-beta.3\n\n* Fixes broken import of RedBox, which led to confusing stack traces when\n  applications threw errors. (#314)\n* Add `module.hot` checks to conditional `require()`s to remove unnecessary\n  warnings when using server rendering. (#302)\n\n### 3.0.0-beta.2\n\n* Patch `React.createFactory` (#287)\n* Fix props typo (#285)\n\n### 3.0.0-beta.1\n\n* Adds complete React Router support. Async routes should work fine now. (#272)\n* Fixes a nasty bug which caused unwrapped component to render. (#266, #272)\n* Fixes an issue that caused components with `shouldComponentUpdate`\n  optimizations not getting redrawn (#269,\n  2a1e384d54e1919117f70f75dd20ad2490b1d9f5)\n* Internal: a rewrite and much better test coverage.\n\n### 3.0.0-beta.0\n\n* Fixes an issue when used in Webpack 2\n  (https://github.com/gaearon/react-hot-loader/issues/263)\n* **Breaking change:** instead of\n\n  ```js\n  ;<AppContainer component={App} props={{ prop: val }} />\n  ```\n\n````\n  you now need to write\n\n  ```js\n  <AppContainer>\n    <App prop={val} />\n  </AppContainer>\n````\n\n(#250)\n\n**See\n[this commit](https://github.com/gaearon/react-hot-boilerplate/commit/b52c727937a499f3efdc5dceb74ae952aa318c3a)\nas an update reference!**\n\n### 3.0.0-alpha\n\nBig changes both to internals and usage. No docs yet but you can look at\nhttps://github.com/gaearon/react-hot-boilerplate/pull/61 for an example.\n\n### 2.0.0-alpha\n\n**Experimental release that isn't really representative on what will go in 2.0,\nbut uses the new engine.**\n\nSome ideas of what should be possible with the new engine:\n\n* There is no requirement to pass `getRootInstances()` anymore, so React Hot\n  Loader doesn't need `react/lib/ReactMount` or walk the tree, which was\n  somewhat fragile and changing between versions\n* Static methods and properties are now hot-reloaded\n* Instance getters and setters are now hot reloaded\n* Static getters and setters are now hot reloaded\n* Deleted instance methods are now deleted during hot reloading\n* Single method form of\n  [autobind-decorator](https://github.com/andreypopp/autobind-decorator) is now\n  supported\n\nWhat might get broken:\n\n* We no longer overwrite or even touch the original class. Every time makeHot is\n  invoked, it will return a special proxy class. This means a caveat: for\n  example, static methods will only be hot-reloaded if you refer to them as\n  `this.constructor.doSomething()` instead of `FooBar.doSomething()`. This is\n  because React Hot Loader calls `makeHot` right before exporting, so `FooBar`\n  still refers to the original class. Similarly, `this.constructor === App` will\n  be `false` inside `App` unless you call `App = makeHot(App)` manually, which\n  you can't do with React Hot Loader. **I'm not sure how much of a problem this\n  will be, so let me know if it pains you.** In the longer term, we will\n  deprecate React Hot Loader in favor of a Babel plugin which will be able to\n  rewrite class definitions correctly, so it shouldn't be a problem for a long\n  time. If there is demand, we can introduce a mode that rewrites passed\n  classes, too.\n\n### 1.3.1\n\n* Fix import for ReactMount to support 15.4.0\n  (**[#430](https://github.com/gaearon/react-hot-loader/pull/430)**)\n\n### 1.3.0\n\n* Recover from module errors on module level\n  (**[#187](https://github.com/gaearon/react-hot-loader/pull/187)**)\n\n### 1.2.9\n\n* Silently ignore exports that raise an error when accessed (#114)\n* Update `source-map` dependency\n\n### 1.2.8\n\n* Remove React from peerDependencies\n* Update React Hot API to support React 0.14 beta 1\n\n### 1.2.7\n\n* Preserve CommonJS `exports` context in the wrapping closure\n  (**[#124](https://github.com/gaearon/react-hot-loader/issues/124)**)\n\n### 1.2.6\n\n* Fix autobinding on newly added methods for `createClass`-style classes\n\n### 1.2.5\n\n* Fix “React is not defined” error\n\n### 1.2.4\n\n* Avoid updating each class twice in React 0.12\n\n### 1.2.3\n\n* Explicitly exclude `react/lib` files from processing. You **should** use\n  `exclude: /node_modules/` in configuration, but at least this doesn't blow up\n  for those who don't.\n\n### 1.2.2\n\n* Fix crash on React 0.13. Now compatible!\n\n### 1.2.1\n\n* Don't try to flatten inheritance chains, as it causes problems with `super`\n* Instead, automatically opt custom base classes into hot reloading as long as\n  they descend from `React.Component` (in React 0.13). If your custom base class\n  doesn't do that but you'd still want to have hot reloading, you need to\n  manually opt it in via `module.makeHot` API.\n\n### 1.2.0\n\n* Support hot-reloading components without a base class\n  (**[react-hot-api#5](https://github.com/gaearon/react-hot-api/issues/5)**)\n* Support hot-reloading inheritance chains\n  (**[react-hot-api#10](https://github.com/gaearon/react-hot-api/issues/10)**)\n* Support using React 0.13 as an external\n\n### 1.1.7\n\n* Add React 0.13 RC2 to peerDeps\n\n### 1.1.6\n\n* Allow React 0.13 RC1\n* Better support for ES6 inheritance\n* Fix reloading for modules with null prototype chain (**#82**)\n\n### 1.1.5\n\n* Wrap user code in IEFF to prevent losing `\"use strict\"`. Fixes #75\n\n### 1.1.4\n\n* Fix crash when hot-reloading element factory. (Note: React discourages\n  exporting factories.)\n\n### 1.1.3\n\n* Avoid warnings on React 0.13\n\n### 1.1.2\n\n* Compatibility with React 0.13.0-beta.1\n\n### 1.1.1\n\n* Fix edge cases by requiring `react/lib/ReactMount` in transformed source files\n* Add a warning if `ReactMount` doesn't return anything useful (e.g. when using\n  external React)\n\n### 1.1.0\n\n* Skipping `node_modules` entirely\n  [wasn't](https://github.com/gaearon/react-hot-loader/issues/58)\n  [the best idea](https://github.com/gaearon/react-hot-loader/issues/55).\n  Instead, we now specifically skip `node_modules/react/`,\n  `node_modules/webpack/` and `node_modules/react-hot-loader/`. However you are\n  still **encouraged** to\n  [add `exclude: /node_modules/` to your loader config](https://github.com/gaearon/react-hot-boilerplate/blob/master/webpack.config.js#L24)\n  for best performance.\n* Now modules that don't export any valid React classes in `module.exports` or\n  any its properties will not be auto-accepted. This prevents hot loader from\n  trying to handle non-React updates and allows changes in plain JS files to\n  propagate to components that can handle them. For example, this allows\n  [react-jss](https://github.com/jsstyles/react-jss) mixin to apply hot updates\n  to JSS styles.\n\n### 1.0.7\n\n* Skip `node_modules` entirely. Fixes\n  [#54](https://github.com/gaearon/react-hot-loader/issues/54) on Windows.\n\n### 1.0.6\n\n* Add `require('react-hot-loader/Injection')` to override Hot Loader behavior.\n  Now you can supply your own way of getting root component instances, so Hot\n  Loader can also work in environment where `require('react/lib/ReactMount')` is\n  not available (for example,\n  [when React is used as standalone bundle and not NPM package](https://github.com/gaearon/react-hot-loader/issues/53)).\n\n### 1.0.5\n\n* Fix stack overflow when hotifying same class twice\n  ([#52](https://github.com/gaearon/react-hot-loader/issues/52))\n\n### 1.0.4\n\n* Allow both `module.exports` and its properties be components (Fixes\n  [#50](https://github.com/gaearon/react-hot-loader/issues/50))\n\n### 1.0.3\n\n* In addition to hotifying `module.exports` by default, also hotify all its own\n  properties\n\n### 1.0.2\n\n* Don't try to hot-replace `module.export`ed `ReactElement`s\n\n### 1.0.1\n\n* Delay `require`ing `ReactMount` to avoid circular dependencies\n* Don't process React or Webpack internals to avoid potential issues\n\n### 1.0.0\n\n* Don't rely on `createClass` regex or any other regex\n* Only `module.exports` is hot by default\n* Supports ES6 classes when they land in React 0.13\n* Supports dynamically created classes\n* Manual mode\n\nSee\n[what changed and how to migrate to 1.0](https://github.com/gaearon/react-hot-loader/blob/master/docs/README.md#migrating-to-10).\n\n### 0.5.0\n\n* Adds source map support, contributed by\n  [Jake Riesterer](https://github.com/jRiest)\n\n### 0.4.5\n\n* Collapse all hot loader code in one line so it doesn't obscure beginning of\n  file.\n\n### 0.4.4\n\n* Errors occuring in module definition (such as `ReferenceError`) should not\n  disable further reloading (fixes\n  **[#29](https://github.com/gaearon/react-hot-loader/issues/29)**)\n\n### 0.4.3\n\n* Support lowercase `react` reference name and usage with ES6 classes\n  (`createClass(MyComponent.prototype)`) via\n  **[#27](https://github.com/gaearon/react-hot-loader/issues/27)**\n\n### 0.4.2\n\n* Catch errors in modules and log them instead of reloading (fixes\n  **[#21](https://github.com/gaearon/react-hot-loader/issues/21)**)\n\n### 0.4.1\n\n* Use more precise\n  [`React.createClass` regex](https://github.com/gaearon/react-hot-loader/commit/f71c6785131adcc85b91789da0d0a0b9f1a9713f)\n  to avoid matching own code when hot loader is applied to all JS files.\n\n### 0.4.0\n\n* Ignore files that contain no `createClass` calls (fixes\n  **[#17](https://github.com/gaearon/react-hot-loader/issues/17)**)\n* Remove the need for pitch loader (fixes\n  **[#19](https://github.com/gaearon/react-hot-loader/issues/19)**)\n* Improve performance by only using one loader instead of two\n* Now that performance is acceptable, remove desktop notifications and `notify`\n  option\n* It is now recommended that you use `devtool: 'eval'` because it's much faster\n  and has no downsides anymore\n\n### 0.3.1\n\n* Avoid warnings on old browsers with missing `Notification` API\n* Errors don't cause page reload anymore\n\n### 0.3.0\n\n* Use React 0.11\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Code of Conduct\n\nAs contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.\n\nWe are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.\n\nExamples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.\n\nThis Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to `react-hot-loader`\n\nAs the creators and maintainers of this project, we want to ensure that\n`react-hot-loader` lives and continues to grow and evolve. The evolution of the\nlibrary should never be blocked by any single person's time. One of the simplest\nways of doing this is by encouraging a larger set of shallow contributors.\nThrough this, we hope to mitigate the problems of a project that needs updates\nbut there's no-one who has the power to do so.\n\n## Code contributions\n\nHere is a quick guide to doing code contributions to the library.\n\n1.  Find some issue you're interested in, or a feature that you'd like to tackle.\n    Also make sure that no one else is already working on it. We don't want you\n    to be disappointed.\n\n2.  Fork, then clone: `git clone https://github.com/YOUR_USERNAME/react-hot-loader.git`\n\n3.  Create a branch with a meaningful name for the issue: `git checkout -b fix-something`\n\n4.  Make your changes and commit: `git add` and `git commit`\n\n5.  Make sure that the tests still pass: `yarn test:es2015 --watch` and `yarn test:modern --watch`\n\n6.  Push your branch: `git push -u origin your-branch-name`\n\n7.  Submit a pull request to the upstream react-hot-loader repository.\n\n8.  Choose a descriptive title and describe your changes briefly.\n\n9.  Wait for a maintainer to review your PR, make changes if it's being\n    recommended, and get it merged.\n\n10. Perform a celebratory dance! :dancer:\n\n### How do I set up the project?\n\n1.  First make sure you have [yarn](https://yarnpkg.com/) installed.\n\n2.  Run `yarn` and let `yarn dev` running in background, you are ready!\n\n3.  You can also run `yarn test:watch` to run tests in watch mode.\n\n### How do I check if it really works?\n\nThere is a lot of examples in the project, they are all under `examples/`\nfolder. Choose an example to test and follow these steps:\n\n1.  Run `yarn`\n2.  Run `yarn install file:../packages/react-hot-loader`\n3.  Test it!\n\n## Credits\n\nHeavily inspired from\n[styled-components contributing guidelines](https://github.com/styled-components/styled-components/blob/master/CONTRIBUTING.md).\n"
  },
  {
    "path": "ISSUE_TEMPLATE.md",
    "content": "If you are reporting a bug or having an issue setting up React Hot Loader, please fill in below. For feature requests, feel free to remove this template entirely.\n\n### Description\n\nWhat you are reporting:\n\n### Expected behavior\n\nWhat you think should happen:\n\n### Actual behavior\n\nWhat actually happens:\n\n### Environment\n\nReact Hot Loader version:\n\nRun these commands in the project folder and fill in their results:\n\n1.  `node -v`:\n2.  `npm -v`:\n\nThen, specify:\n\n1.  Operating system:\n2.  Browser and version:\n\n### Reproducible Demo\n\nPlease take the time to create a new project that reproduces the issue.\n\nYou can copy your project that experiences the problem and start removing things until you’re left with the minimal reproducible demo. This helps contributors, and you might get to the root of your problem during that process.\n\nPush to GitHub and paste the link here.\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2016 Dan Abramov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "PATRONS.md",
    "content": "# Patrons\n\nThe work on React Hot Loader, [React Transform](https://github.com/gaearon/babel-plugin-react-transform), [Redux](https://github.com/rackt/redux), and related projects was [funded by the community](https://www.patreon.com/reactdx).  \nMeet some of the outstanding companies and individuals that made it possible:\n\n* [Webflow](https://github.com/webflow)\n* [Ximedes](https://www.ximedes.com/)\n* [Herman J. Radtke III](http://hermanradtke.com)\n* [Ken Wheeler](http://kenwheeler.github.io/)\n* [Chung Yen Li](https://www.facebook.com/prototocal.lee)\n* [Sunil Pai](https://twitter.com/threepointone)\n* [Charlie Cheever](https://twitter.com/ccheever)\n* [Eugene G](https://twitter.com/e1g)\n* [Matt Apperson](https://twitter.com/mattapperson)\n* [Jed Watson](https://twitter.com/jedwatson)\n* [Sasha Aickin](https://twitter.com/xander76)\n* [Stefan Tennigkeit](https://twitter.com/whobubble)\n* [Sam Vincent](https://twitter.com/samvincent)\n* Olegzandr Denman\n"
  },
  {
    "path": "README.md",
    "content": "# React Hot Loader\n\n[![Build Status][build-badge]][build] [![version][version-badge]][package]\n[![Code Coverage][coverage-badge]][coverage]\n[![MIT License][license-badge]][license]\n\n[![PRs Welcome][prs-badge]][prs] [![Chat][chat-badge]][chat]\n[![Backers on Open Collective][oc-backer-badge]](#backers)\n[![Sponsors on Open Collective][oc-sponsor-badge]](#sponsors)\n\n[![Watch on GitHub][github-watch-badge]][github-watch]\n[![Star on GitHub][github-star-badge]][github-star]\n\nTweak React components in real time ⚛️⚡️\n\nWatch\n**[Dan Abramov's talk on Hot Reloading with Time Travel](https://www.youtube.com/watch?v=xsSnOQynTHs).**\n\n# Moving towards next step\n\nReact-Hot-Loader has been your friendly neighbour, living outside of React. But it has been limiting its powers and causing not the greatest experience. It's time to make a next step.\n\n**React-Hot-Loader is expected to be replaced by [React Fast Refresh](https://github.com/facebook/react/issues/16604)**. Please remove React-Hot-Loader if Fast Refresh is currently supported on your environment.\n\n* `React Native` - [supports Fast Refresh](https://facebook.github.io/react-native/docs/fast-refresh) since 0.61.\n* `parcel 2` - [supports Fast Refresh](https://github.com/facebook/react/issues/16604#issuecomment-556082893) since alpha 3.\n* `webpack` - [supports Fast Refresh](https://github.com/pmmmwh/react-refresh-webpack-plugin/) using a plugin.\n* `other bundler` - no support yet, use React-Hot-Loader\n* `create-react-app` - [supports Fast Refresh](https://create-react-app.dev/docs/advanced-configuration/) with FAST_REFRESH env since 4.\n* `next.js` - [supports Fast Refresh](https://nextjs.org/docs/basic-features/fast-refresh) since 9.4\n\n## Install\n\n```\nnpm install react-hot-loader\n```\n\n> Note: You can safely install react-hot-loader as a regular dependency instead\n> of a dev dependency as it automatically ensures it is not executed in\n> production and the footprint is minimal.\n\n## Getting started\n\n1.  Add `react-hot-loader/babel` to your `.babelrc`:\n\n```js\n// .babelrc\n{\n  \"plugins\": [\"react-hot-loader/babel\"]\n}\n```\n\n2.  Mark your root component as _hot-exported_:\n\n```js\n// App.js\nimport { hot } from 'react-hot-loader/root';\nconst App = () => <div>Hello World!</div>;\nexport default hot(App);\n```\n\n3.  Make sure `react-hot-loader` is required before `react` and `react-dom`:\n\n* or `import 'react-hot-loader'` in your main file (before React)\n* or prepend your webpack entry point with `react-hot-loader/patch`, for example:\n  ```js\n  // webpack.config.js\n  module.exports = {\n    entry: ['react-hot-loader/patch', './src'],\n    // ...\n  };\n  ```\n\n4.  If you need hooks support, use [`@hot-loader/react-dom`](#hot-loaderreact-dom)\n\n### Hook support\n\nHooks would be auto updated on HMR if they _should_ be.\nThere is only one condition for it - a non zero dependencies list.\n\n```js\n❄️ useState(initialState); // will never updated (preserve state)\n❄️ useEffect(effect); // no need to update, updated on every render\n❄️ useEffect(effect, []); // \"on mount\" hook. \"Not changing the past\"\n🔥 useEffect(effect, [anyDep]); // would be updated\n\n🔥 useEffect(effect, [\"hot\"]); // the simplest way to make hook reloadable\n```\n\n**Plus**\n\n* any hook would be reloaded on a function body change. Enabled by default, controlled by `reloadHooksOnBodyChange` option.\n* you may configure RHL to reload any hook by setting `reloadLifeCycleHooks` option to true.\n\n**To disable hooks reloading** - set configuration option:\n\n```js\nimport { setConfig } from 'react-hot-loader';\n\nsetConfig({\n  reloadHooks: false,\n});\n```\n\nWith this option set **all** `useEffects`, `useCallbacks` and `useMemo` would be updated on Hot Module Replacement.\n\n### Hooks reset\n\nHooks would be reset if their order changes. Adding, removing or moving around would\ncause a local tree remount.\n\n**Babel plugin is required** for this operation. Without it changing hook order would throw an error\nwhich would be propagated till the nearest class-based component.\n\n## `@hot-loader/react-dom`\n\n[`@hot-loader/react-dom`](https://github.com/hot-loader/react-dom) replaces the \"react-dom\" package of the same version, but with additional patches to support hot reloading.\n\nThere are 2 ways to install it:\n\n* Use **yarn** name resolution, so `@hot-loader/react-dom` would be installed instead of `react-dom`\n\n```\nyarn add react-dom@npm:@hot-loader/react-dom\n```\n\n* Use [webpack aliases](https://webpack.js.org/configuration/resolve/#resolvealias)\n\n```\nyarn add @hot-loader/react-dom\n```\n\n```js\n// webpack.config.js\nmodule.exports = {\n  // ...\n  resolve: {\n    alias: {\n      'react-dom': '@hot-loader/react-dom',\n    },\n  },\n};\n```\n\n### Old API\n\n**Note:** There is also an old version of `hot`, used prior to version 4.5.4. **Please use the new one**,\nas it is much more resilient to js errors that you may make during development.\n\nMeanwhile, not all the bundlers are compatible with new `/root` API, for example **[parcel](http://parceljs.org/) is not**.\n\nReact-Hot-Load will throw an error, asking you to use the old API, if such incompatibility would be detected.\nIt is almost the same, but you have to pass `module` inside `hot`.\n\n```js\nimport { hot } from 'react-hot-loader';\nconst App = () => <div>Hello World!</div>;\nexport default hot(module)(App);\n```\n\n3.  [Run webpack with Hot Module Replacement](https://webpack.js.org/guides/hot-module-replacement/#enabling-hmr):\n\n```sh\nwebpack-dev-server --hot\n```\n\n## What about production?\n\nThe webpack patch, `hot`, Babel plugin, `@hot-loader/react-dom` etc. are all safe to use in production; they leave a minimal footprint, so there is no need to complicate your configuration based on the environment. Using the Babel plugin in production is even recommended because it switches to cleanup mode.\n\nJust ensure that the production mode has been properly set, both as an environment variable and in your bundler. E.g. with webpack you would build your code by running something like:\n\n```\nNODE_ENV=production webpack --mode production\n```\n\n`NODE_ENV=production` is needed for the Babel plugin, while `--mode production` uses [`webpack.DefinePlugin`](https://webpack.js.org/plugins/define-plugin/) to set `process.env.NODE_ENV` inside the compiled code itself, which is used by `hot` and `@hot-loader/react-dom`.\n\nMake sure to watch your bundle size when implementing react-hot-loader to ensure that you did it correctly.\n\n## Limitations\n\n* (that's the goal) React-Hot-Loader would not change the past, only update the present - no lifecycle event would be called on component update. As a result, any code changes made to `componentWillUnmount` or `componentDidMount` would be ignored for already created components.\n* (that's the goal) React-Hot-Loader would not update any object, including component `state`.\n* (1%) React-Hot-Loader may not apply some changes made to a component's `constructor`. Unless an existing component is recreated, RHL would typically _inject_ new data into that component, but there is no way to detect the actual change or the way it was applied, especially if the change was made to a function. This is because of the way React-Hot-Loader works - it knows what class functions are, not how they were created. See [#1001](https://github.com/gaearon/react-hot-loader/issues/1001) for details.\n\n## Recipes\n\n### Migrating from [create-react-app](https://github.com/facebookincubator/create-react-app)\n\n1.  Run `npm run eject`\n2.  Install React Hot Loader (`npm install --save-dev react-hot-loader`)\n3.  In `config/webpack.config.dev.js`, add `'react-hot-loader/babel'` to Babel\n    loader configuration. The loader should now look like:\n\n```js\n  {\n    test: /\\.(js|jsx)$/,\n    include: paths.appSrc,\n    loader: require.resolve('babel-loader'),\n    options: {\n      // This is a feature of `babel-loader` for webpack (not Babel itself).\n      // It enables caching results in ./node_modules/.cache/babel-loader/\n      // directory for faster rebuilds.\n      cacheDirectory: true,\n      plugins: ['react-hot-loader/babel'],\n    },\n  }\n```\n\n4.  Mark your App (`src/App.js`) as _hot-exported_:\n\n```js\n// ./containers/App.js\nimport React from 'react';\nimport { hot } from 'react-hot-loader';\n\nconst App = () => <div>Hello World!</div>;\n\nexport default hot(module)(App);\n```\n\n### Migrating from [create-react-app](https://github.com/facebookincubator/create-react-app) without ejecting\n\nUsers [report](https://github.com/gaearon/react-hot-loader/pull/729#issuecomment-354097936), that it is possible to use [react-app-rewire-hot-loader](https://github.com/cdharris/react-app-rewire-hot-loader) to setup React-hot-loader without ejecting.\n\n### TypeScript\n\nAs of version 4, React Hot Loader requires you to pass your code through [Babel](http://babeljs.io/) to transform it so that it can be hot-reloaded. This can be a pain point for TypeScript users, who usually do not need to integrate Babel as part of their build process.\n\nFortunately, it's simpler than it may seem! Babel will happily parse TypeScript syntax and can act as an alternative to the TypeScript compiler, so you can safely replace `ts-loader` or `awesome-typescript-loader` in your Webpack configuration with `babel-loader`. Babel won't typecheck your code, but you can use [`fork-ts-checker-webpack-plugin`](https://github.com/Realytics/fork-ts-checker-webpack-plugin) (and/or invoke `tsc --noEmit`) as part of your build process instead.\n\nA sample configuration:\n\n```js\n{\n  // ...you'll probably need to configure the usual Webpack fields like \"mode\" and \"entry\", too.\n  resolve: { extensions: [\".ts\", \".tsx\", \".js\", \".jsx\"] },\n  module: {\n    rules: [\n      {\n        test: /\\.(j|t)sx?$/,\n        exclude: /node_modules/,\n        use: {\n          loader: \"babel-loader\",\n          options: {\n            cacheDirectory: true,\n            babelrc: false,\n            presets: [\n              [\n                \"@babel/preset-env\",\n                { targets: { browsers: \"last 2 versions\" } } // or whatever your project requires\n              ],\n              \"@babel/preset-typescript\",\n              \"@babel/preset-react\"\n            ],\n            plugins: [\n              // plugin-proposal-decorators is only needed if you're using experimental decorators in TypeScript\n              [\"@babel/plugin-proposal-decorators\", { legacy: true }],\n              [\"@babel/plugin-proposal-class-properties\", { loose: true }],\n              \"react-hot-loader/babel\"\n            ]\n          }\n        }\n      }\n    ]\n  },\n  plugins: [\n    new ForkTsCheckerWebpackPlugin()\n  ]\n};\n```\n\nFor a full example configuration of TypeScript with React Hot Loader and newest beta version of Babel, check [here](https://github.com/gaearon/react-hot-loader/tree/master/examples/typescript).\n\nAs an alternative to this approach, it's possible to chain Webpack loaders so that your code passes through Babel and then TypeScript (or TypeScript and then Babel), but this approach is not recommended as it is more complex and may be significantly less performant. Read more [discussion here](https://github.com/gaearon/react-hot-loader/issues/884).\n\n### Parcel\n\nParcel supports Hot Module Reloading out of the box, just follow step 1 and 2 of [Getting Started](https://github.com/gaearon/react-hot-loader/tree/master#getting-started).\n\nWe also have a [full example running Parcel + React Hot Loader](https://github.com/gaearon/react-hot-loader/tree/master/examples/parcel).\n\n### Electron\n\nYou need something to mark your modules as hot in order to use React Hot Loader.\n\nOne way of doing this with Electron is to simply use webpack like any web-based project might do and the general guide above describes. See also [this example Electron app](https://github.com/s-h-a-d-o-w/rhl-electron-quick-start).\n\nA webpack-less way of doing it to use `electron-compile` (which is also used by [`electron-forge`](https://electronforge.io)) - see [this example](https://github.com/rllola/hmr-example-issue-2). While it requires less configuration, something to keep in mind is that `electron-compile`'s HMR will always reload all modules, regardless of what was actually edited.\n\n### Source Maps\n\nIf you use `devtool: 'source-map'` (or its equivalent), source maps will be\nemitted to hide hot reloading code.\n\nSource maps slow down your project. Use `devtool: 'eval'` for best build\nperformance.\n\nHot reloading code is just one line in the beginning and one line at the end of\neach module so you might not need source maps at all.\n\n### Linking\n\nIf you are using `npm link` or `yarn link` for development purposes, there is a chance you will get error `Module not found: Error: Cannot resolve module 'react-hot-loader'` or the linked package is not hot reloaded.\n\nThere are 2 ways to fix `Module not found`:\n\n* Use [`include` in loader configuration](https://github.com/gaearon/react-hot-boilerplate/blob/master/webpack.config.js#L22) to only opt-in your app's files to processing.\n* Alternatively if you are using webpack, override the module resolution in your config:\n\n```js\n{\n  resolve: {\n    alias: {\n      'react-hot-loader': path.resolve(path.join(__dirname, './node_modules/react-hot-loader')),\n    }\n  }\n}\n```\n\nAnd to make your linked package to be hot reloaded, it will need to use the patched version of `react` and `react-dom`, if you're using webpack, add this options to the alias config\n\n```js\n{\n  resolve: {\n    alias: {\n      'react-hot-loader': path.resolve(path.join(__dirname, './node_modules/react-hot-loader')),\n      // add these 2 lines below so linked package will reference the patched version of `react` and `react-dom`\n      'react': path.resolve(path.join(__dirname, './node_modules/react')),\n      'react-dom': path.resolve(path.join(__dirname, './node_modules/react-dom')),\n      // or point react-dom above to './node_modules/@hot-loader/react-dom' if you are using it\n    }\n  }\n}\n```\n\n## Preact\n\nReact-hot-loader should work out of the box with `preact-compat`, but, in case of pure preact, you will need\nto configure it:\n\n* create configuration file (setupHotLoader.js)\n\n```js\nimport reactHotLoader from 'react-hot-loader';\nimport preact from 'preact';\n\nreactHotLoader.preact(preact);\n```\n\n* dont forget to import it\n\n#### Preact limitations\n\n* HOCs and Decorators as not supported yet. For Preact React-Hot-Loader v4 behave as v3.\n\n## React Native\n\nReact Native\n**[supports hot reloading natively](https://facebook.github.io/react-native/blog/2016/03/24/introducing-hot-reloading.html)**\nas of version 0.22.\n\nUsing React Hot Loader with React Native can cause unexpected issues (see #824) and is not recommended.\n\n## Webpack plugin\n\nWe recommend using the `babel` plugin, but there are some situations where you are unable to. If so, try the `webpack` plugin / `webpack-loader` (as seen in v3).\n\nRemember - the `webpack` plugin is **not compatible** with class-based components. The `babel` plugin\nwill inject special methods to every class, to make `class members` (like onClick) hot-updatable, while the `webpack` plugin would leave classes as is, without any _instrumentation_.\n\n```js\nclass MyComponent extends React.Component {\n  onClick = () => this.setState(); // COULD NOT UPDATE\n  variable = 1; // this is ok\n  render() {} // this is ok\n}\n```\n\nBut `webpack-loader` could help with TypeScript or _spreading_ \"cold API\" [to all node_modules](https://github.com/gaearon/react-hot-loader#disabling-a-type-change-for-all-node_modules).\n\n> It is possible to enable this loader for all the files, but if you use `babel` plugin, you need to enable this loader for `react-dom` only. Place it after babel-loader, if babel-loader is present.\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      // would only land a \"hot-patch\" to react-dom\n      {\n        test: /\\.js$/,\n        include: /node_modules\\/react-dom/,\n        use: ['react-hot-loader/webpack'],\n      },\n    ],\n  },\n};\n```\n\nWebpack plugin will also land a \"hot\" patch to react-dom, making React-Hot-Loader more compliant to [the principles](https://github.com/gaearon/react-hot-loader/issues/1118).\n\nIf you are not using `babel` plugin you might need to apply `webpack-loader` to all the files.\n\n```js\n{\n  test: /\\.jsx?$/,\n  include: /node_modules/,\n  use: ['react-hot-loader/webpack']\n},\n```\n\n### Code Splitting\n\nIf you want to use Code Splitting + React Hot Loader, the simplest solution is to pick a library compatible with this one:\n\n* [React Lazy](https://reactjs.org/docs/code-splitting.html#reactlazy)\n* [Imported Component](https://github.com/theKashey/react-imported-component)\n* [React Universal Component](https://github.com/faceyspacey/react-universal-component)\n* [React-Loadable](https://github.com/jamiebuilds/react-loadable)\n\nIf you use a not-yet-friendly library, like [react-async-component](https://github.com/ctrlplusb/react-async-component),\nor are having problems with hot reloading failing to reload code-split components,\nyou can manually mark the components below the code-split boundaries.\n\n```js\n// AsyncHello.js\nimport { asyncComponent } from 'react-async-component';\n\n// asyncComponent could not `hot-reload` itself.\nconst AsyncHello = asyncComponent({\n  resolve: () => import('./Hello'),\n});\n\nexport default AsyncHello;\n```\n\nNote that `Hello` is the component at the root of this particular\ncode-split chunk.\n\n```js\n// Hello.js\nimport { hot } from 'react-hot-loader/root';\n\nconst Hello = () => 'Hello';\n\nexport default hot(Hello); // <-- module will reload itself\n```\n\nWrapping this root component with `hot()` will ensure that it is hot reloaded correctly.\n\n### Out-of-bound warning\n\nYou may see the following warning when code-split components are updated:\n\n```console\nReact-Hot-Loader: some components were updated out-of-bound. Updating your app to reconcile the changes.\n```\n\nThis is because the hot reloading of code-split components happens asynchronously. If you had an `App.js` that implemented\nthe `AsyncHello` component above and you modified `AsyncHello`, it would be bundled and reloaded at the same time as\n`App.js`. However, the core hot reloading logic is synchronous, meaning that it's possible for the hot reload to run before\nthe updates to the split component have landed.\n\nIn this case, RHL uses a special _tail update detection_ logic, where it notes that an an update to a split component\nhas happened after the core hot reloading logic has already finished, and it triggers another update cycle to ensure\nthat all changes are applied.\n\nThe warning is informational - it is a notice that this tail update logic is triggered, and does not indicate a problem\nin the configuration or useage of `react-hot-loader`.\n\nIf the tail update detection is not something you want or need, you can disable this behavior by setting\n`setConfig({ trackTailUpdates:false })`.\n\n### Checking Element `type`s\n\nBecause React Hot Loader creates proxied versions of your components, comparing\nreference types of elements won't work:\n\n```js\nconst element = <Component />;\nconsole.log(element.type === Component); // false\n```\n\nReact Hot Loader exposes a function `areComponentsEqual` to make it possible:\n\n```js\nimport { areComponentsEqual } from 'react-hot-loader';\nconst element = <Component />;\nareComponentsEqual(element.type, Component); // true\n```\n\nAnother way - compare \"rendered\" element type\n\n```js\nconst element = <Component />;\nconsole.log(element.type === <Component />.type); // true\n\n// better - precache rendered type\nconst element = <Component />;\nconst ComponentType = <Component />.type;\nconsole.log(element.type === ComponentType); // true\n```\n\nBut you might have to provide all required props. See [original issue](https://github.com/gaearon/react-hot-loader/issues/304).\nThis is most reliable way to compare components, but it will not work with required props.\n\nAnother way - compare Component name.\n\n> Not all components have a name. **In production displayName could not exists.**\n\n```js\nconst element = <Component />;\nconsole.log(element.displayName === 'Component'); // true\n```\n\nThis is something we did not solve yet. Cold API could help keep original types.\n\n### Webpack ExtractTextPlugin\n\nwebpack ExtractTextPlugin is not compatible with React Hot Loader. Please disable it in development:\n\n```js\nnew ExtractTextPlugin({\n  filename: 'styles/[name].[contenthash].css',\n  disable: NODE_ENV !== 'production',\n});\n```\n\n#### Disabling a type change (❄️)\n\nIt is possible to disable React-Hot-Loader for a specific component, especially to\nenable common way to type comparison.\nSee #991 for the idea behind ⛄️, and #304 about \"type comparison\" problem.\n\n```js\nimport { cold } from 'react-hot-loader';\n\ncold(SomeComponent) // this component will ignored by React-Hot-Loader\n<SomeComponent />.type === SomeComponent // true\n```\n\nIf you will update `cold` component React-Hot-Loader will complain (on error level), and then\nReact will cold-replace Component with a internal state lose.\n\n> Reach-Hot-Loader: cold element got updated\n\n##### Disabling a type change for all node_modules\n\nYou may _cold_ all components from node_modules. This will not work for HOC(like Redux) or dynamically created Components, but might help in most of situations, when type changes\nare not welcomed, and modules are not expected to change.\n\n```js\nimport { setConfig, cold } from 'react-hot-loader';\nsetConfig({\n  onComponentRegister: (type, name, file) => file.indexOf('node_modules') > 0 && cold(type),\n\n  // some components are not visible as top level variables,\n  // thus its not known where they were created\n  onComponentCreate: (type, name) => name.indexOf('styled') > 0 && cold(type),\n});\n```\n\n! To be able to \"cold\" components from 'node_modules' you have to apply babel to node_modules, while this\nfolder is usually excluded.\nYou may add one more babel-loader, with only one React-Hot-Loader plugin inside to solve this.\n**Consider using webpack-loader** for this.\n\n##### React-Hooks\n\nReact hooks are not _really_ supported by React-Hot-Loader. Mostly due to our internal\nprocesses of re-rendering React Tree, which is required to reconcile an updated application\nbefore React will try to rerender it, and fail to do that, obviously.\n\n* hooks **should work** for versions 4.6.0 and above (`pureSFC` is enabled by default).\n* hooks will produce **errors** on every hot-update without patches to `react-dom`.\n* hooks **may loss the state** without patches to `react-dom`.\n* hooks does not support adding new hooks on the fly\n* change in hooks for a mounted components will cause a runtime exception, and a `retry` button (at the nearest class component) will be shown.\n  Pressing a `retry` button will basically remount tree branch.\n\nTo mitigate any hook-related issues (and disable their hot-reloadability) - `cold` them.\n\n* _cold_ components using hooks.\n\n```js\nimport { setConfig, cold } from 'react-hot-loader';\nsetConfig({\n  onComponentCreate: (type, name) =>\n    (String(type).indexOf('useState') > 0 || String(type).indexOf('useEffect') > 0) && cold(type),\n});\n```\n\n## API\n\n### `hot(Component, options)`\n\nMark a component as hot.\n\n#### Babel plugin\n\nRight now babel plugin has only one option, enabled by default.\n\n* `safetyNet` - will help you properly setup ReactHotLoader.\n\nYou may disable it to get more control on the module execution order.\n\n```js\n//.babelrc\n{\n    \"plugins\": [\n        [\n            \"react-hot-loader/babel\",\n            {\n            \"safetyNet\": false\n            }\n        ]\n    ]\n}\n```\n\n#### Important\n\n**!!** Use `hot` only for module `exports`, not for module `imports`. **!!**\n\n```js\nimport { hot } from 'react-hot-loader/root';\n\nconst App = () => 'Hello World!';\n\nexport default hot(App);\n```\n\nKeep in mind - by importing `react-hot-loader/root` you are setting up a boundary for update event propagation.\n\nThe higher(in module hierarchy) you have it - the more stuff would be updated on Hot Module Replacement.\n\nTo make RHL more reliable and safe, please place `hot` _below_ (ie somewhere in _imported_ modules):\n\n* react-dom\n* redux store creation\n* any data, you want to preserve between updates\n* big libraries\n\nYou may(but it's not required) place `hot` to the every route/page/feature/lazy chunk, thus make updates more scoped.\n\nYou don't need to wrap every component with `hot`, application works fine with a single one.\n\n### (old)`hot(module, options)(Component, options)`\n\nMark a component as hot. The \"new\" hot is just hidding the first part - `hot(module)`, giving you\nonly the second `(App)`. The \"new\" hot is using old API.\n\n```js\nimport { hot } from 'react-hot-loader';\n\nconst App = () => 'Hello World!';\n\nexport default hot(module)(App);\n```\n\n### `AppContainer`\n\nMark application as hot reloadable. (**Prefer** using `hot` helper, see below for migration details).\n\nThis low-level approach lets you make **hot **imports\\_\\_, not exports.\n\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport App from './containers/App';\n\nconst render = Component => {\n  ReactDOM.render(\n    <AppContainer>\n      <Component />\n    </AppContainer>,\n    document.getElementById('root'),\n  );\n};\n\nrender(App);\n\n// webpack Hot Module Replacement API\nif (module.hot) {\n  // keep in mind - here you are configuring HMR to accept CHILDREN MODULE\n  // while `hot` would configure HMR for the CURRENT module\n  module.hot.accept('./containers/App', () => {\n    // if you are using harmony modules ({modules:false})\n    render(App);\n    // in all other cases - re-require App manually\n    render(require('./containers/App'));\n  });\n}\n```\n\n### areComponentsEqual(Component1, Component2)\n\nTest if two components have the same type.\n\n```js\nimport { areComponentsEqual } from 'react-hot-loader';\nimport Component1 from './Component1';\nimport Component2 from './Component2';\n\nareComponentsEqual(Component1, Component2); // true or false\n```\n\n### setConfig(config)\n\nSet a new configuration for React Hot Loader.\n\nAvailable options are:\n\n* `logLevel`: specify log level, default to `\"error\"`, available values are: `['debug', 'log', 'warn', 'error']`\n* `pureSFC`: enable Stateless Functional Component. If disabled they will be converted to React Components.\n  Default value: false.\n* `ignoreSFC`: skip \"patch\" for SFC. \"Hot loading\" could still work, with webpack-patch present\n* `pureRender`: do not amend `render` method of any component.\n* for the rest see [index.d.ts](https://github.com/gaearon/react-hot-loader/blob/master/index.d.ts#L62-L133).\n\n```js\n// rhlConfig.js\nimport { setConfig } from 'react-hot-loader';\n\nsetConfig({ logLevel: 'debug' });\n```\n\n**It is important** to set configuration before any other action will take a place\n\n```js\n// index.js\nimport './rhlConfig' // <-- extract configuration to a separate file, and import it in the beggining\nimport React from 'react'\n....\n```\n\n## Migrating from v3\n\n### AppContainer vs hot\n\nPrior v4 the right way to setup React Hot Loader was to wrap your Application\nwith `AppContainer`, set setup module acceptance by yourself. This approach is\nstill valid but only for advanced use cases, prefer using `hot` helper.\n\n**React Hot Loader v3:**\n\n```js\n// App.js\nimport React from 'react';\n\nconst App = () => <div>Hello world!</div>;\n\nexport default App;\n```\n\n```js\n// main.js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { AppContainer } from 'react-hot-loader';\nimport App from './containers/App';\n\nconst render = Component => {\n  ReactDOM.render(\n    <AppContainer>\n      <Component />\n    </AppContainer>,\n    document.getElementById('root'),\n  );\n};\n\nrender(App);\n\n// webpack Hot Module Replacement API\nif (module.hot) {\n  module.hot.accept('./containers/App', () => {\n    // if you are using harmony modules ({modules:false})\n    render(App);\n    // in all other cases - re-require App manually\n    render(require('./containers/App'));\n  });\n}\n```\n\n**React Hot Loader v4:**\n\n```js\n// App.js\nimport React from 'react';\nimport { hot } from 'react-hot-loader';\n\nconst App = () => <div>Hello world!</div>;\n\nexport default hot(module)(App);\n```\n\n```js\n// main.js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './containers/App';\n\nReactDOM.render(<App />, document.getElementById('root'));\n```\n\n### Patch is optional\n\n> Since 4.0 till 4.8\n\nCode is automatically patched, you can safely remove `react-hot-loader/patch` from your webpack config,\nif react-hot-loader is required before React in any other way.\n\n### Error Boundary is inside every component\n\n> Since 4.5.4\n\nOn Hot Module Update we will inject `componentDidCatch` and a _special_ `render`\nto every Class-based component you have, making [Error Boundaries](https://reactjs.org/docs/error-boundaries.html#introducing-error-boundaries) more local.\n\nAfter update we will remove all sugar, keeping only Boundaries you've created.\n\nYou can provide your own `errorReporter`, via `setConfig({errorReporter})` or opt-out from\nroot ErrorBoundaries setting `errorBoundary={false}` prop on `AppContainer` or `hot`.\nHowever - this option affects only SFC behavior, and any ClassComponent would boundary itself.\n\n```js\nimport { setConfig } from 'react-hot-loader';\nimport ErrorBoundary from './ErrorBoundary';\n\n// ErrorBoundary will be given error and errorInfo prop.\nsetConfig({ errorReporter: ErrorBoundary });\n```\n\nIf `errorReporter` is not set - full screen error overlay would be shown.\n\n#### Setting global Error Reporter\n\nGlobal Error Reporter would, created a fixed overlay on top the page,\nwould be used to display errors, not handled by `errorReporter`, and\nany HMR error.\n\nYou may change, or disable this global error overlay\n\n```js\n// to disable\nsetConfig({ ErrorOverlay: () => null });\n\n// to change\nsetConfig({ ErrorOverlay: MyErrorOverlay });\n```\n\nThe UX of existing overlay is a subject to change, and we are open to any proposals.\n\n## Known limitations and side effects\n\n### Note about `hot`\n\n`hot` accepts only React Component (Stateful or Stateless), resulting the `HotExported` variant of it.\nThe `hot` function will setup current module to _self-accept_ itself on reload, and will **ignore** all the changes, made for non-React components.\nYou may mark as many modules as you want. But `HotExportedComponent` **should be the only used export** of a _hot_-module.\n\n> Note: Please note how often we have used `exported` keyword. `hot` is for exports.\n\n> Note: Does nothing in production mode, just passes App through.\n\n### New Components keep executing the old code\n\nThere is no way to hot-update constructor code, as result even new components\nwill be born as the first ones, and then grow into the last ones. As of today, this issue cannot be solved.\n\n## Troubleshooting\n\nIf it doesn't work, in 99% of cases it's a configuration issue. A missing option, a\nwrong path or port. webpack is very strict about configuration, and the best way\nto find out what's wrong is to compare your project to an already working setup,\ncheck out\n**[examples](https://github.com/gaearon/react-hot-loader/tree/master/examples)**,\nbit by bit.\n\nIf something doesn't work, in 99% of cases it's an issue with your code. The Component\ndidn't get registered, due to HOC or Decorator around it, which is making it\ninvisible to the Babel plugin or webpack loader.\n\nWe're also gathering\n**[Troubleshooting Recipes](https://github.com/gaearon/react-hot-loader/blob/master/docs/Troubleshooting.md)**\nso send a PR if you have a lesson to share!\n\n### Switch into debug mode\n\nDebug mode adds additional warnings and can tells you why React Hot Loader is\nnot working properly in your application.\n\n```js\nimport { setConfig } from 'react-hot-loader';\nsetConfig({ logLevel: 'debug' });\n```\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. [Contribute](CONTRIBUTING.md).\n[![contributors][oc-contributors-img]](https://github.com/gaearon/react-hot-loader/graphs/contributors)\n\n## Backers\n\nThank you to all our backers! 🙏 [Become a backer][oc-backer-link]\n[![backers][oc-backer-img]][oc-backer-link]\n\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor][oc-sponsor-link]\n\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/react-hot-loader/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/react-hot-loader/sponsor/9/avatar.svg\"></a>\n\n## License\n\nMIT\n\n[build-badge]: https://img.shields.io/travis/gaearon/react-hot-loader.svg?style=flat-square\n[build]: https://travis-ci.org/gaearon/react-hot-loader\n[coverage-badge]: https://img.shields.io/codecov/c/github/gaearon/react-hot-loader.svg?style=flat-square\n[coverage]: https://codecov.io/github/gaearon/react-hot-loader\n[version-badge]: https://img.shields.io/npm/v/react-hot-loader.svg?style=flat-square\n[package]: https://www.npmjs.com/package/react-hot-loader\n[license-badge]: https://img.shields.io/npm/l/react-hot-loader.svg?style=flat-square\n[license]: https://github.com/gaearon/react-hot-loader/blob/next/LICENSE\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[prs]: http://makeapullrequest.com\n[chat]: https://gitter.im/gaearon/react-hot-loader\n[chat-badge]: https://img.shields.io/gitter/room/gaearon/react-hot-loader.svg?style=flat-square\n[github-watch-badge]: https://img.shields.io/github/watchers/gaearon/react-hot-loader.svg?style=social\n[github-watch]: https://github.com/gaearon/react-hot-loader/watchers\n[github-star-badge]: https://img.shields.io/github/stars/gaearon/react-hot-loader.svg?style=social\n[github-star]: https://github.com/gaearon/react-hot-loader/stargazers\n[oc-backer-badge]: https://opencollective.com/react-hot-loader/backers/badge.svg\n[oc-sponsor-badge]: https://opencollective.com/react-hot-loader/sponsors/badge.svg\n[oc-contributors-img]: https://opencollective.com/react-hot-loader/contributors.svg?width=890&button=false\n[oc-backer-img]: https://opencollective.com/react-hot-loader/backers.svg?width=890\n[oc-backer-link]: https://opencollective.com/react-hot-loader#backers\n[oc-sponsor-link]: https://opencollective.com/react-hot-loader#sponsor\n"
  },
  {
    "path": "babel.js",
    "content": "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./dist/babel.production.min.js');\n} else {\n  module.exports = require('./dist/babel.development.js');\n}\n"
  },
  {
    "path": "docs/Troubleshooting.md",
    "content": "This file serves as a repository of common problems setting up React Hot Loader, and solutions to them.\nKnow a problem? Feel free to send a PR with edits.\n\n### What Should It Look Like?\n\n#### When the page loads\n\n![](http://i.imgur.com/nuSa1i3.png)\n\n#### When you save a file\n\n![](http://i.imgur.com/oOc0ikV.png)\n\nIf you don't see some of the messages, or some of the requests, or if some of the requests fail, this may be a symptom of an incorrect configuration. Comparing your setup with [React Hot Boilerplate](https://github.com/gaearon/react-hot-boilerplate) may help you find the mistake. If hot loading appears to be working but you still do not see all of the above messages, you may need to check your dev server's [clientLogLevel](https://webpack.js.org/configuration/dev-server/#devserver-clientloglevel) setting. Depending on what it is set to, you may not see all of these messages, so you may need to adjust this setting to ensure that your configuration is correct.\n\n##### Common TypeScript Mistake\n\nIf you're a TypeScript user then to get set up with HMR then it's not unusual to alias `module` as an `any` like so:\n\n```ts\nconst anyModule = module as any;\nif (anyModule.hot) {\n  anyModule.hot.accept('./app', () => render(App));\n}\n```\n\n**DON'T DO THIS.** It will result in full page reloads each time you make a change. Instead do something like this:\n\n```ts\nif ((module as any).hot) {\n  (module as any).hot.accept('./app', () => render(App));\n}\n```\n\nor this:\n\n```ts\ndeclare const module: any;\nif (module.hot) {\n  module.hot.accept('./app', () => render(App));\n}\n```\n\nThen you should see the expected messages / get the expected behaviour:\n\n```\n[HMR] Updated modules:\n// ...\n[HMR] App is up to date.\n```\n\n---\n\n### Can't Build\n\n#### Cannot resolve 'file' or 'directory' `react/lib/ReactMount`\n\nIf you're using a precompiled React instead of `react` npm package, React Hot Loader configuration will need a few tweaks. See [Usage with External React](https://github.com/gaearon/react-hot-loader/blob/master/docs/README.md#usage-with-external-react).\n\nMake sure you have `'.js'` in `resolve.extensions` section of Webpack config, or Webpack won't be able to find any JS files without explicitly specifying extension in `require`.\n\n#### SyntaxError: 'import' and 'export' may only appear at the top level\n\nIf you're using React Hot Loader together with [Babel](https://babeljs.io/) (ex 6to5), make sure React Hot Loader stays **to the left** of Babel in `loaders` array in Webpack config:\n\n```js\n  { test: /\\.jsx?$/, loaders: ['react-hot', 'babel'], include: path.join(__dirname, 'src') }\n```\n\nWebpack applies `loaders` right to left, and we need to feed Babel's _output_ to React Hot Loader, not vice versa.\n\n#### Error: Invalid path './' (or similar)\n\nIf you're using a relative output path in your Webpack config, wrap it in a call to `path.resolve()`:\n\n```js\nvar path = require('path');\n\nmodule.exports = {\n  ...,\n  output: {\n    path: path.resolve('./my-relative-path'),\n    ...\n  }\n};\n```\n\nIf you used WebpackDevServer CLI mode and after switching to Node it crashes with `Error: Invalid path ''`, you probably didn't have `path` specified in `output` at all. You can just put `path: __dirname` there, as it won't matter for development config.\n\n### Module not found: Error: Cannot resolve module 'react-hot-loader'\n\nMost likely you used `npm link` or `yarn link` to use a development version of a package in a different folder, and React Hot Loader processed it by mistake. Read the guide about linking package in [README linking section](../README.md#linking)\n\n---\n\n### Page Throws an Error\n\n#### Uncaught TypeError: Cannot read property 'NODE_ENV' of undefined\n\n#### Uncaught TypeError: Cannot read property 'env' of undefined\n\n#### [socket.io] Cannot use 'in' operator to search for 'document' in undefined\n\nMake sure you have `exclude: /node_modules/` or, better, `include: path.join(__dirname, 'src')` (path depends on your application) in loader configuration [just like on this line](https://github.com/gaearon/react-hot-boilerplate/blob/fbdbd93956241320bc3960d350c4dd0030cc6e84/webpack.config.js#L27). You never need to process `node_modules` with React Hot Loader. If you use other loaders such as `jsx?harmony` or `babel`, most likely they **also** need to have `include` specified.\n\n---\n\n### Can't Hot Reload\n\nGenerally, the best way to fix this class of errors is to compare your setup to [React Hot Boilerplate](https://github.com/gaearon/react-hot-boilerplate) very carefully and see what's different.\n\n#### Try WebpackDevServer Node Interface Instead of CLI!\n\nWebpackDevServer CLI mode [behaves slightly differently](https://github.com/webpack/webpack-dev-server/issues/106) from its Node API. When in doubt, I suggest you use Node API like [React Hot Boilerplate does](https://github.com/gaearon/react-hot-boilerplate/blob/master/server.js).\n\n#### Check your NODE_ENV value\n\nIf you are seeing an error like this:\n\n```\n[HMR] The following modules couldn't be hot updated: (Full reload needed)\nThis is usually because the modules which have changed (and their parents) do not know how to hot reload themselves.\n```\n\nYou may have `NODE_ENV` set to either `production` or `test`. Setting `NODE_ENV` to either of these will cause `react-hot-loader` to compile in production mode. Try setting `NODE_ENV` to something like `development`.\n\n#### Uncaught RangeError: Maximum call stack size exceeded\n\nWhen using WebpackDevServer CLI flag `--hot`, the plugin `new HotModuleReplacementPlugin()` should not be used and vice versa, they are mutually exclusive but the desired effect will work with any of them.\n\n#### No 'Access-Control-Allow-Origin' header is present on the requested resource.\n\nIf you're trying to access Webpack Dev Server from a URL served on another port, you may try:\n\n* Changing `WebpackDevServer` options to include CORS header:\n\n```js\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  hot: true,\n  headers: { 'Access-Control-Allow-Origin': '*' },\n});\n```\n\n* Making sure that `webpack-dev-server` **client host and port** in `webpack.config.js` matches those of your development server:\n\n```js\nentry: [\n  'webpack-dev-server/client?http://localhost:3000', // WebpackDevServer host and port\n  'webpack/hot/only-dev-server',\n  './src/app',\n];\n```\n\n#### The following modules couldn't be hot updated: (They would need a full reload!)\n\n**If you get this warning when editing a root component**, this may be because you don't export anything from it, and call `React.render` from there. Put your root component in a separate file (e.g. `App.jsx`) and `require` it from `index.js` where you call `React.render`.\n\nYou also get this warning in v1.x if you write your root component as [stateless plain function](http://facebook.github.io/react/docs/reusable-components.html#stateless-functions) instead of using `React.Component`. This problem is already solved completely in the upcoming [v3.x](https://github.com/gaearon/react-hot-boilerplate/pull/61).\n\nThis warning may also appear **if you edit some non-component file** which is `require`d from files other than components. This means hot update bubbled up, but the app couldn't handle it. This is normal! Just refresh.\n\nIf you get this warning **together with a 404 for `hot-update.json` file**, you're probably using an ancient version of `webpack-dev-server` (just update it).\n\n#### I see “[WDS] Hot Module Replacement enabled” but nothing happens when I edit `App.js`\n\nIf you're running Node 0.11.13, you might want to try updating to 0.12. Some people reported this helped solve this problem. Also **make sure that your `require`s have the same filename casing as the files.** Having `App.js` and doing `require('app')` might trip the watcher on some systems.\n\nOS X also has a rarely-occuring bug that causes some folders to get 'broken' with regards to file system change monitoring. Here are some suggested [fixes](http://feedback.livereload.com/knowledgebase/articles/86239).\n\n#### I see “[HMR] Nothing hot updated.” and nothing happens when I edit `App.js`\n\nIf you have several entry points in `entry` configuration option, make sure `webpack/hot/only-dev-server` **is in each of them:**\n\n```js\n  entry: {\n    app: ['./src/app', 'webpack/hot/only-dev-server'],\n    editor: ['./src/editor', 'webpack/hot/only-dev-server'],\n    ...,\n    client: 'webpack-dev-server/client?http://localhost:3000'\n  }\n```\n\nYou will have to include \"client.js\" in your host page for the hot updates to work. For example:\n\n```html\n  <script src=\"/static/bundle-client.js\"></script>\n  <script src=\"/static/bundle-app.js\"></script>\n  <script src=\"/static/bundle-entry.js\"></script>\n```\n\nThe entry points that don't have `webpack/hot/only-dev-server` (or `webpack/hot/dev-server` if you fancy occasional reloads) won't know how to apply hot updates.\n\n#### Syntax error: Unexpected token <\n\nIf you combine WebpackDevServer with an existing server like Express and get this error message on hot updates, it is because Webpack is configured to request hot updates _from the current hostname_. So if your Express server is on `8000` and `publicPath` in Webpack config is `/build/`, it will request hot updates from `http://localhost:8000/build/`, which in your case is served by Express. Instead, you need to set `publicPath` to point to the port where WebpackDevServer is running. For example, it could be `http://localhost:9000/build/`.\n\n#### Not enough watchers\n\nVerify that if you have enough available watchers in your system. If this value is too low, the file watcher in Webpack won't recognize the changes:\n\n```\ncat /proc/sys/fs/inotify/max_user_watches\n```\n\nArch users, add `fs.inotify.max_user_watches=524288` to `/etc/sysctl.d/99-sysctl.conf` and then execute `sysctl --system`. Ubuntu users (and possibly others): `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`.\n\n#### 404 errors for `hot-update.json` files\n\nFirst, make sure you have recent versions of Webpack and Webpack Dev Server (>= 1.7 is fine). Earlier versions use 404 code when no updates were available, so it wasn't technically an error.\n\nNow, take a look at the path where they are requested. Webpack uses `output.publicPath` from Webpack config to determine this path. If you forget to specify it, Webpack will request updates from a relative path to the current one, so any client-side routing will break it.\n\nNormally you want it to be `'/'` if you're serving scripts from root, something like `'/scripts/'` if you have a virtual path for scripts, and something like `'http://localhost:port/scripts/` if you're using Webpack only for scripts but have another primary server like Express. **This config variable must also match `publicPath` option specified when creating `WebpackDevServer` instance.** [Take a look at React Hot Boilerplate](https://github.com/gaearon/react-hot-boilerplate/blob/master/server.js#L6) to get an idea.\n\n---\n\n### Misc\n\n#### It's slowing down my build!\n\nMake sure you have `include` limited to your app's modules in loader configuration [just like on this line](https://github.com/gaearon/react-hot-boilerplate/blob/fbdbd93956241320bc3960d350c4dd0030cc6e84/webpack.config.js#L27). You never need to process `node_modules` with React Hot Loader.\n\n#### My bundle is so large!\n\nMake sure you have separate configs for development and production. You don't need `react-hot` in `loaders` or `webpack-dev-server/client` or `webpack/hot/only-dev-server` in production config. They are only for development. For easier maintenance, you can set an environment variable before invoking Webpack and read it in config.\n\nAlso make sure you have these plugins in production config:\n\n```js\n// removes a lot of debugging code in React\nnew webpack.DefinePlugin({\n  'process.env': {\n    NODE_ENV: JSON.stringify('production'),\n  },\n}),\n  // keeps hashes consistent between compilations\n  new webpack.optimize.OccurrenceOrderPlugin(),\n  // minifies your code\n  new webpack.optimize.UglifyJsPlugin({\n    compressor: {\n      warnings: false,\n    },\n  });\n```\n\nOh, and don't forget to remove `devtool: 'eval'` from a production config. Otherwise Uglify won't uglify anything at all.\n\n#### I can access my Single Page App (SPA) only via `/` on refresh\n\nThe problem is that by default **WebpackDevServer** doesn't deal with HTML5 History correctly and the server won't route the url as it should. You can fix this issue by setting `historyApiFallback: true`. Here's a full example:\n\n```js\nvar webpack = require('webpack');\nvar WebpackDevServer = require('webpack-dev-server');\n\nvar config = require('./webpack.config');\n\nvar port = 4000;\nvar ip = '0.0.0.0';\n\nnew WebpackDevServer(webpack(config), {\n  publicPath: config.output.publicPath,\n  historyApiFallback: true,\n}).listen(port, ip, function(err) {\n  if (err) {\n    return console.log(err);\n  }\n\n  console.log('Listening at ' + ip + ':' + port);\n});\n```\n\nAfter this you should be able to access your SPA via any url that has been defined in it.\n\n#### React-hot-loader: a Unknown was found where a Unknown was expected.\n\nThe problem is that after hot module update some branches of React Tree differs from the previous versions.\nAs result React-hot-loader will not update these branches at all, and you may lose internal components state.\n\nThe `equality` of Components are defined as:\n\n1.  They have same variable names in the same files. Ie they are both MyComponent from MyComponent.js\n2.  They have same displayName and similar code.\n    > Note: similar code is not _equal_ code. RHL will stand some small changes in code, or even adding a new method in class.\n\n#### Not all of my code got updated.\n\nHot module replacement is a tricky thing. Just double check that you are not exporting anything else from the\nmodules with `hot` exported components – functions, constants, anything NOT REACT.\n\n`hot` function setups module self-acceptance. And it may be a dangerous thing.\n\n#### RHL is not working for Electron or Parcel\n\n`hot` function is not tested in these environments, yet. Please use `old school` AppContainer and setup HRM manually.\n\n#### RHL is not working with Webpack DLL\n\nReact Hot Loader rely on a Babel transformation that register all exports in a global. That's why dependencies included in [Webpack DLL](https://webpack.js.org/plugins/dll-plugin/#dllplugin) will not work.\n\n#### React-hot-loader: fatal error caused by XXX - no instrumentation found.\n\nReact-hot-loader found an Element without instrumentation due to a wrong configuration.\nTo fix this issue - just require RHL before React.\n\nExample of a wrong configuration:\n\n```js\nimport * as React from 'react';\nimport { hot } from 'react-hot-loader'; // React is not patched\n```\n\nExample of correct configurations:\n\n```js\nimport { hot } from 'react-hot-loader';\nimport * as React from 'react'; // React is now patched\n```\n\n```js\nimport React from 'react';\nimport { hot } from 'react-hot-loader'; // React is now patched\n```\n"
  },
  {
    "path": "examples/SSR/.babelrc",
    "content": "{\n  \"presets\": [\n    \"env\",\n    \"react\"\n  ],\n  \"plugins\": [\n    \"react-hot-loader/babel\",\n    \"transform-class-properties\",\n    \"dynamic-import-node\"\n  ]\n}\n"
  },
  {
    "path": "examples/SSR/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/SSR/package.json",
    "content": "{\n  \"name\": \"react-hot-loader-ssr\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"build\": \"webpack\",\n    \"start\": \"babel-node ./src/server.js\",\n    \"start:webpack\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^2.9.7\"\n  },\n  \"dependencies\": {\n    \"babel-cli\": \"^6.26.0\",\n    \"express\": \"^4.16.2\",\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\",\n    \"react-portal\": \"^4.1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/SSR/src/App.js",
    "content": "import { hot, setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport Counter from './Counter';\n// import hidden from './HiddenComponent';\n\nconst App = () => (\n  <h1>\n    <p>{40}!</p>\n    <Counter />\n    <div>\n      {/*{hidden().counter}*/}\n      SSR, and I work fine!\n    </div>\n  </h1>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/SSR/src/Counter.js",
    "content": "import React from 'react';\n\nconst RAND = 1; //Math.round(Math.random() * 1000)\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n  gen = 0;\n\n  componentDidMount() {\n    this.setState({\n      count: RAND,\n    });\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    // gen should change. count - no.\n    return (\n      <span>\n        {this.state.count}:{this.gen++}\n      </span>\n    );\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/SSR/src/HiddenComponent.js",
    "content": "import React from 'react';\nimport Counter from './Counter';\n\nconst hidden = function() {\n  return {\n    counter: () => (\n      <div>\n        this is hidden counter(<Counter />)\n      </div>\n    ),\n  };\n};\n\nexport default hidden;\n"
  },
  {
    "path": "examples/SSR/src/index.js",
    "content": "import 'babel-polyfill';\nimport React from 'react';\nimport { hydrate } from 'react-dom';\nimport App from './App';\n\n//const root = document.createElement('div')\n//document.body.appendChild(root)\n\nconst root = document.getElementById('root');\nhydrate(<App />, root);\n"
  },
  {
    "path": "examples/SSR/src/server.js",
    "content": "import express from 'express';\nimport React from 'react';\nimport { renderToString } from 'react-dom/server';\nimport App from './App';\nimport template from './template';\n\nconst server = express();\n\nserver.use('/dist', express.static('dist'));\n\nserver.get('/', (req, res) => {\n  const app = <App />;\n\n  const appString = renderToString(app);\n\n  res.send(\n    template({\n      body: appString,\n    }),\n  );\n});\n\nserver.listen(8080);\n\nconsole.log('server ready');\n"
  },
  {
    "path": "examples/SSR/src/template.js",
    "content": "export default ({ body }) => {\n  return `\n    <!DOCTYPE html>\n    <html>\n      <head>\n      </head>\n      \n      <body>\n        <div id=\"root\">${body}</div>\n      </body>\n      \n      <script src=\"/dist/bundle.js\"></script>\n    </html>\n  `;\n};\n"
  },
  {
    "path": "examples/SSR/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['webpack/hot/dev-server', './src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        //exclude: /node_modules|packages/,  // should work without exclude\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin()],\n};\n"
  },
  {
    "path": "examples/all-possible-containers/.babelrc",
    "content": "{\n  \"presets\": [\n    \"@babel/preset-flow\",\n    \"@babel/preset-react\",\n    [\n      \"@babel/preset-env\",\n      {\n        \"modules\": false\n      }\n    ]\n  ],\n  \"plugins\": [\n    \"@babel/plugin-proposal-class-properties\",\n    \"@babel/plugin-proposal-object-rest-spread\",\n    \"@babel/plugin-syntax-dynamic-import\"\n  ],\n  \"env\": {\n    \"test\": {\n      \"plugins\": [\n        \"@babel/plugin-transform-modules-commonjs\"\n      ]\n    },\n    \"development\": {\n      \"plugins\": [\n        \"react-hot-loader/babel\"\n      ]\n    },\n    \"production\": {\n      \"plugins\": [\n        \"@babel/plugin-transform-react-constant-elements\",\n        \"@babel/plugin-transform-react-inline-elements\",\n        \"babel-plugin-transform-react-pure-class-to-function\",\n        \"babel-plugin-transform-react-remove-prop-types\"\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/all-possible-containers/.editorconfig",
    "content": "[*]\ncharset=utf-8\nend_of_line=crlf\ninsert_final_newline=false\nindent_style=space\nindent_size=2"
  },
  {
    "path": "examples/all-possible-containers/.flowconfig",
    "content": "[include]\nsrc/\n[ignore]\n.*/__tests__/.*"
  },
  {
    "path": "examples/all-possible-containers/.gitignore",
    "content": ".idea\ndist\nnode_modules"
  },
  {
    "path": "examples/all-possible-containers/LICENSE",
    "content": "MIT License\n\nCopyright (c) 2017 Eli Sherer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "examples/all-possible-containers/README.md",
    "content": "# react-hot-loader-repro918\n\nReproduce an issue for gaearon/react-hot-loader#918\n"
  },
  {
    "path": "examples/all-possible-containers/package.json",
    "content": "{\n  \"name\": \"react-hot-loader-repro918\",\n  \"version\": \"1.0.0\",\n  \"license\": \"UNLICENSED\",\n  \"description\": \"Reproduce an issue for gaearon/react-hot-loader#918\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/elisherer/react-hot-loader-repro918\"\n  },\n  \"author\": {\n    \"name\": \"Eli Sherer\",\n    \"email\": \"eli.sherer@gmail.com\",\n    \"url\": \"http://www.sherer.co.il\"\n  },\n  \"private\": true,\n  \"main\": \"src/index.js\",\n  \"scripts\": {\n    \"build\": \"cross-env NODE_ENV=production webpack -p\",\n    \"start\": \"webpack-serve --port 8080 --host 0.0.0.0\",\n    \"start:link\": \"cp -R ../../dist ./node_modules/react-hot-loader && cp -R ../../*.js ./node_modules/react-hot-loader\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.8.6\",\n    \"react-dom\": \"^16.8.6\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.0.0\",\n    \"@babel/plugin-proposal-class-properties\": \"^7.0.0\",\n    \"@babel/plugin-proposal-object-rest-spread\": \"^7.0.0\",\n    \"@babel/plugin-syntax-dynamic-import\": \"^7.0.0\",\n    \"@babel/plugin-transform-react-constant-elements\": \"^7.0.0\",\n    \"@babel/plugin-transform-react-inline-elements\": \"^7.0.0\",\n    \"@babel/preset-env\": \"^7.0.0\",\n    \"@babel/preset-flow\": \"^7.0.0\",\n    \"@babel/preset-react\": \"^7.0.0\",\n    \"babel-core\": \"^7.0.0-bridge.0\",\n    \"babel-loader\": \"8.0.0\",\n    \"babel-plugin-transform-react-pure-class-to-function\": \"1.0.1\",\n    \"babel-plugin-transform-react-remove-prop-types\": \"0.4.13\",\n    \"cross-env\": \"5.1.4\",\n    \"html-webpack-plugin\": \"3.2.0\",\n    \"jsx-compress-loader\": \"^0.0.1\",\n    \"react-hot-loader\": \"4.3.10\",\n    \"uglifyjs-webpack-plugin\": \"^2.0.1\",\n    \"webpack\": \"4.6.0\",\n    \"webpack-cli\": \"2.0.15\",\n    \"webpack-serve\": \"0.3.2\"\n  }\n}\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/App.js",
    "content": "// @flow\nimport { hot } from 'react-hot-loader/root';\nimport React from 'react';\n\nimport Context from '../context';\nimport Counter from './Counter';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport ModalComponent from './ModalComponent';\n\nimport ClassComponent from './ClassComponent';\nimport FunctionComponent from './FunctionComponent';\nimport PureClassComponent from './PureClassComponent';\nimport ConsumerClassComponent from './ConsumerClassComponent';\nimport ConsumerFunctionComponent from './ConsumerFunctionComponent';\nimport ConsumerPureClassComponent from './ConsumerPureClassComponent';\nimport ChildrenAsFunctionExample from './ChildrenAsFunctionExample';\nimport ConsumerConnectedComponent from './ConsumerConnectedComponent';\nimport ConnectedChildrenAFComponent from './ConnectedChildrenAFComponent';\nimport FunctionConsumerPureClassComponent from './FunctionConsumerPureClassComponent';\nimport HookedComponent from './Hook';\nimport { EDIT_ME } from './_editMe';\n\nconst Secret = (() => {\n  const A = () => (\n    <div>\n      component A <Counter />\n    </div>\n  );\n  const B = () => 'wrong';\n  return { A, B };\n})();\n\nclass App extends React.Component {\n  state = {\n    error: null,\n    errorInfo: null,\n    open: false,\n  };\n\n  render() {\n    const { open, error, errorInfo } = this.state;\n    const { A, B } = Secret;\n\n    return (\n      <div>\n        <React.Fragment>\n          <fieldset>\n            <legend>App Content</legend>\n            {EDIT_ME}\n          </fieldset>\n          <HookedComponent />\n          <ClassComponent />\n          <FunctionComponent />\n          <PureClassComponent />\n          <ConsumerClassComponent />\n          <ConsumerFunctionComponent />\n          <ConsumerPureClassComponent />\n          <ChildrenAsFunctionExample />\n          <ConsumerConnectedComponent />\n          <ConnectedChildrenAFComponent />\n          <FunctionConsumerPureClassComponent />\n          <button onClick={() => this.setState({ open: true })}>Open Modal</button>\n          {open && <ModalComponent onRequestClose={() => this.setState({ open: false })} />}\n          <div>\n            <Context.Provider value=\"42\">\n              <Context.Consumer>{value => (value === '42' ? <A /> : <B />)}</Context.Consumer>\n            </Context.Provider>\n            <PureClassComponent />\n          </div>\n        </React.Fragment>\n      </div>\n    );\n  }\n}\n\nlet ExportedApp = App;\n\nif (__DEV__) {\n  const { setConfig } = require('react-hot-loader');\n  setConfig({\n    logLevel: 'debug',\n    errorReporter: ErrorBoundary,\n  });\n  ExportedApp = hot(App);\n}\n\nexport default ExportedApp;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ChildrenAsFunctionComponent.js",
    "content": "import React from 'react';\nimport { EDIT_ME } from './_editMe';\n\nclass ChildrenAsFunctionComponent extends React.Component {\n  render() {\n    return <div>{this.props.children('passed-argument')}</div>;\n  }\n}\n\nexport default ChildrenAsFunctionComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ChildrenAsFunctionExample.js",
    "content": "import React from 'react';\nimport ChildrenAsFunctionComponent from './ChildrenAsFunctionComponent';\nimport { EDIT_ME } from './_editMe';\n\nconst ChildrenAsFunctionExample = () => (\n  <ChildrenAsFunctionComponent>\n    {value => (\n      <fieldset>\n        <legend>Children as a function Component (value={value})</legend>\n        {EDIT_ME}\n      </fieldset>\n    )}\n  </ChildrenAsFunctionComponent>\n);\n\nexport default ChildrenAsFunctionExample;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ClassComponent.js",
    "content": "import React from 'react';\nimport { EDIT_ME } from './_editMe';\n\nclass ClassComponent extends React.Component {\n  render() {\n    return (\n      <div>\n        <fieldset>\n          <legend>Class Component</legend>\n          {EDIT_ME}\n        </fieldset>\n      </div>\n    );\n  }\n}\n\nexport default ClassComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ConnectedChildrenAFComponent.js",
    "content": "import React from 'react';\nimport ChildrenAsFunctionComponent from './ChildrenAsFunctionComponent';\nimport { connect } from '../context';\nimport { EDIT_ME } from './_editMe';\n\nconst ConnectedChildrenAFComponent = ({ consumedValue }) => (\n  <ChildrenAsFunctionComponent>\n    {value => (\n      <fieldset>\n        <legend>\n          Children as a function Component (value={value}, consumedValue={consumedValue})\n        </legend>\n        {EDIT_ME}\n      </fieldset>\n    )}\n  </ChildrenAsFunctionComponent>\n);\n\nexport default connect(ConnectedChildrenAFComponent);\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ConsumerClassComponent.js",
    "content": "import React from 'react';\nimport Context from '../context';\nimport { EDIT_ME } from './_editMe';\n\nclass ConsumerClassComponent extends React.Component {\n  render() {\n    return (\n      <Context.Consumer>\n        {value => (\n          <div>\n            <fieldset>\n              <legend>Consumer Class Component (value={value})</legend>\n              {EDIT_ME}\n            </fieldset>\n          </div>\n        )}\n      </Context.Consumer>\n    );\n  }\n}\n\nexport default ConsumerClassComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ConsumerConnectedComponent.js",
    "content": "import React from 'react';\nimport { connect } from '../context';\nimport { EDIT_ME } from './_editMe';\n\nclass ConsumerConnectedComponent extends React.Component {\n  render() {\n    return (\n      <div>\n        <fieldset>\n          <legend>Consumer connected Component (value={this.props.consumedValue})</legend>\n          {EDIT_ME}\n        </fieldset>\n      </div>\n    );\n  }\n}\n\nexport default connect(ConsumerConnectedComponent);\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ConsumerFunctionComponent.js",
    "content": "import React from 'react';\nimport Context from '../context';\nimport { EDIT_ME } from './_editMe';\n\nconst ConsumerFunctionComponent = () => (\n  <Context.Consumer>\n    {value => (\n      <div>\n        <fieldset>\n          <legend>Consumer Function Component (value={value})</legend>\n          {EDIT_ME}\n        </fieldset>\n      </div>\n    )}\n  </Context.Consumer>\n);\n\nexport default ConsumerFunctionComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ConsumerPureClassComponent.js",
    "content": "import React from 'react';\nimport Context from '../context';\nimport { EDIT_ME } from './_editMe';\n\nclass ConsumerPureClassComponent extends React.Component {\n  render() {\n    return (\n      <Context.Consumer>\n        {value => (\n          <div>\n            <fieldset>\n              <legend>Consumer Pure Class Component (value={value})</legend>\n              {EDIT_ME}\n            </fieldset>\n          </div>\n        )}\n      </Context.Consumer>\n    );\n  }\n}\n\nexport default ConsumerPureClassComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/Counter.js",
    "content": "import React from 'react';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return <div>#{this.state.count}</div>;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ErrorBoundary.js",
    "content": "// @flow\nimport React from 'react';\n\nconst ErrorBoundary = ({ error, errorInfo }: { error: any, errorInfo: Object }) => (\n  <div\n    style={{\n      margin: '20px auto',\n      padding: '10px',\n      background: 'white',\n      border: '1px solid #555',\n      borderRadius: '5px',\n      width: '80%',\n    }}\n  >\n    <h2 style={{ margin: 0 }}>{'Oh-no! Something went wrong'}</h2>\n    <p style={{ color: 'red' }}>{error && error.toString()}</p>\n    <div>Stacktrace:</div>\n    <div style={{ color: 'red', marginTop: '10px' }}>\n      {errorInfo &&\n        errorInfo.componentStack &&\n        errorInfo.componentStack.split('\\n').map((line, i) => <div key={i}>{line}</div>)}\n    </div>\n  </div>\n);\n\nexport default ErrorBoundary;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/FunctionComponent.js",
    "content": "import React from 'react';\nimport { EDIT_ME } from './_editMe';\n\nconst FunctionComponent = () => (\n  <div>\n    <fieldset>\n      <legend>Function Component</legend>\n      {EDIT_ME}\n    </fieldset>\n  </div>\n);\n\nexport default FunctionComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/FunctionConsumerPureClassComponent.js",
    "content": "import React from 'react';\nimport Context from '../context';\nimport { EDIT_ME } from './_editMe';\n\n/**\n * The bug is reproduced in this file, edit the content of PureTest and see it doesn't update\n * (Changing the PureComponent to Component makes the HMR work)\n */\n\nclass PureTest extends React.PureComponent {\n  render() {\n    return (\n      <div>\n        <fieldset>\n          <legend>Function Consumer Pure Class Component (value={this.props.value})</legend>\n          {EDIT_ME}\n        </fieldset>\n      </div>\n    );\n  }\n}\n\nconst FunctionConsumerPureClassComponent = props => (\n  <Context.Consumer>\n    {value => (\n      <Context.Provider value={value + 'nested'}>\n        <Context.Consumer>{value => <PureTest value={value} {...props} />}</Context.Consumer>\n      </Context.Provider>\n    )}\n  </Context.Consumer>\n);\n\nexport default FunctionConsumerPureClassComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/Hook.js",
    "content": "import React, { useState, useEffect } from 'react';\nimport { hot } from 'react-hot-loader/root';\n\nconst SomeComponent = ac(() => import('./Counter'));\nconst App = () => (\n  <div>\n    <fieldset>\n      <legend>Hook with Async context</legend>\n      <SomeComponent />\n    </fieldset>\n  </div>\n);\nexport default hot(App);\n\n//\nfunction ac(importComponent) {\n  return function Component(props) {\n    const [C, setComponent] = useState();\n    useEffect(() => {\n      importComponent().then(setComponent);\n    }, []);\n    return C ? <C.default {...props} /> : null;\n  };\n}\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/LazyComponent.js",
    "content": "import React from 'react';\nimport { EDIT_ME } from './_editMe';\nimport Counter from './Counter';\n\nconst LazyComponent = () => (\n  <div>\n    <fieldset>\n      <legend>Lazy Component</legend>\n      {EDIT_ME}\n      <Counter />\n    </fieldset>\n  </div>\n);\n\nexport default LazyComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/Modal.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nconst modalRootId = 'modal-root';\nlet modalRoot = document.getElementById(modalRootId);\nif (!modalRoot) {\n  modalRoot = document.createElement('div');\n  modalRoot.id = modalRootId;\n  document.body.appendChild(modalRoot);\n}\n\nconst styles = {\n  modal: {\n    position: 'absolute',\n    top: '50%',\n    left: '50%',\n    right: 'auto',\n    bottom: 'auto',\n    border: '1px solid rgb(204, 204, 204)',\n    background: 'rgb(255, 255, 255)',\n    overflow: 'auto',\n    borderRadius: '4px',\n    outline: 'none',\n    padding: '20px',\n    zIndex: '1000',\n    marginRight: '-50%',\n    transform: 'translate(-50%, -50%)',\n  },\n  closeButton: {\n    position: 'absolute',\n    top: '12px',\n    right: '12px',\n    background:\n      'url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjMDAwMDAwIiBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSI0OCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgICA8cGF0aCBkPSJNMTkgNi40MUwxNy41OSA1IDEyIDEwLjU5IDYuNDEgNSA1IDYuNDEgMTAuNTkgMTIgNSAxNy41OSA2LjQxIDE5IDEyIDEzLjQxIDE3LjU5IDE5IDE5IDE3LjU5IDEzLjQxIDEyeiIvPg0KICAgIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4NCjwvc3ZnPg==) no-repeat',\n    backgroundSize: 'contain',\n    width: '24px',\n    height: '24px',\n    cursor: 'pointer',\n  },\n  content: {\n    minWidth: '300px',\n    maxWidth: '90vw',\n    maxHeight: 'calc(100vh - 100px)',\n  },\n  overlay: {\n    position: 'fixed',\n    top: '0',\n    left: '0',\n    right: '0',\n    bottom: '0',\n    backgroundColor: 'rgba(0, 0, 0, 0.5)',\n    zIndex: '999',\n  },\n};\n\nclass Modal extends React.Component {\n  constructor(props) {\n    super(props);\n    this.el = document.createElement('div');\n    Object.keys(styles.overlay).forEach(key => {\n      this.el.style[key] = styles.overlay[key];\n    });\n  }\n\n  props: {\n    onRequestClose: Function,\n    title: string,\n    children: Object,\n    hideTitle?: boolean,\n  };\n\n  componentDidMount() {\n    modalRoot.appendChild(this.el);\n  }\n\n  componentWillUnmount() {\n    modalRoot.removeChild(this.el);\n  }\n\n  render() {\n    const { onRequestClose, title, children, hideTitle } = this.props;\n    return ReactDOM.createPortal(\n      <div style={styles.modal} role=\"dialog\" aria-labelledby=\"modal__title\" aria-describedby=\"modal__content\">\n        {!hideTitle && (\n          <div id=\"modal__title\" style={{ fontSize: '1.5em' }}>\n            {title}\n          </div>\n        )}\n        <div style={styles.closeButton} onClick={onRequestClose} title=\"Close\" />\n        <div id=\"modal__content\" style={styles.content}>\n          {children}\n        </div>\n      </div>,\n      this.el,\n    );\n  }\n}\n\nexport default Modal;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/ModalComponent.js",
    "content": "// @flow\nimport React from 'react';\nimport Modal from './Modal';\nimport { EDIT_ME } from './_editMe';\n\nconst ModalComponent = ({ onRequestClose }: { onRequestClose: Function }) => (\n  <Modal onRequestClose={onRequestClose} title=\"Modal Component\">\n    {EDIT_ME}\n  </Modal>\n);\n\nexport default ModalComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/PureClassComponent.js",
    "content": "import React from 'react';\nimport { EDIT_ME } from './_editMe';\n\nclass ClassComponent extends React.PureComponent {\n  render() {\n    return (\n      <div>\n        <fieldset>\n          <legend>Pure Class Component</legend>\n          {EDIT_ME}\n        </fieldset>\n      </div>\n    );\n  }\n}\n\nexport default ClassComponent;\n"
  },
  {
    "path": "examples/all-possible-containers/src/components/SomethingWithHooks.js",
    "content": ""
  },
  {
    "path": "examples/all-possible-containers/src/components/_editMe.js",
    "content": "export const EDIT_ME = 'Edit me';\n"
  },
  {
    "path": "examples/all-possible-containers/src/context.js",
    "content": "import React from 'react';\n\nconst Context = React.createContext('dummy-value');\n\nexport const connect = WrappedComponent => {\n  const ConnectComponent = props => (\n    <Context.Consumer>{value => <WrappedComponent {...props} consumedValue={value} />}</Context.Consumer>\n  );\n  ConnectComponent.displayName = `Connect(${WrappedComponent.displayName || WrappedComponent.name || 'Unknown'})`;\n  return ConnectComponent;\n};\n\nexport default Context;\n"
  },
  {
    "path": "examples/all-possible-containers/src/index.js",
    "content": "import React, { StrictMode } from 'react';\nimport { render } from 'react-dom';\nimport App from './components/App';\nimport Context from './context';\n\nconst appElement = document.createElement('div');\nappElement.id = 'root';\ndocument.body.appendChild(appElement);\n\nrender(\n  <Context.Provider value=\"dummy\">\n    <StrictMode>\n      <App />\n    </StrictMode>\n  </Context.Provider>,\n  appElement,\n);\n"
  },
  {
    "path": "examples/all-possible-containers/src/wcl.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst { SourceNode, SourceMapConsumer } = require('source-map');\nconst { SourceMapGenerator } = require('source-map');\n\nfunction transform(source, map) {\n  if (source.indexOf('React.createElement') >= 0) {\n    const separator = '\\n\\n;';\n    const appendText = `  \n    /** @jsx _J$X_ */           \n    var __react_jsx__ = require('react');\n    var _J$X_ = (__react_jsx__.default || __react_jsx__).createElement;\n  `;\n\n    return this.callback(null, [appendText, source.replace(/React\\.createElement\\(/g, '_J$X_(')].join(separator));\n  }\n\n  if (source.match(/import (.*) from ['\"]react[\"']/)) {\n    const separator = '\\n\\n;';\n    const appendText = `  \n    \n    import * as TmpReact from 'react';\n    const _J$X_ = TmpReact.createElement;\n  `;\n\n    return this.callback(null, [appendText, source].join(separator));\n  }\n\n  return this.callback(null, source, map);\n}\n\nmodule.exports = transform;\n"
  },
  {
    "path": "examples/all-possible-containers/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst UglifyJsPlugin = require('uglifyjs-webpack-plugin');\nconst exclude = absPath => /node_modules/.test(absPath);\nconst mode = process.env.NODE_ENV || 'development';\n\nconst production = mode === 'production';\n\nconst wcl = require('./src/wcl');\n\nmodule.exports = {\n  mode,\n  entry: './src/index.js',\n  output: {\n    filename: '[name].[hash].js',\n    path: path.resolve(__dirname, 'dist'),\n    publicPath: '/',\n    chunkFilename: '[name].[chunkhash].js',\n    devtoolModuleFilenameTemplate: info => path.resolve(info.absoluteResourcePath).replace(/\\\\/g, '/'),\n  },\n  devtool: production ? false : 'eval-source-map',\n  plugins: [\n    new webpack.DefinePlugin({\n      __DEV__: JSON.stringify(!production),\n    }),\n\n    new HtmlWebpackPlugin({\n      // Create index.html file\n      cache: production,\n    }),\n  ],\n  module: {\n    strictExportPresence: true,\n    rules: [\n      {\n        test: /\\.js$/,\n        use: ['react-hot-loader/webpack'],\n      },\n      {\n        test: /\\.js$/,\n        exclude: /node_modules/,\n        use: ['babel-loader'],\n      },\n    ],\n  },\n  optimization: {\n    minimizer: [\n      new UglifyJsPlugin({\n        uglifyOptions: {\n          toplevel: true,\n          mangle: true,\n        },\n      }),\n    ],\n\n    splitChunks: {\n      cacheGroups: {\n        commons: {\n          test: /[\\\\/]node_modules[\\\\/]/, // Create a vendor chunk with all the imported node_modules in it\n          name: 'vendor',\n          chunks: 'all',\n        },\n      },\n    },\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      // react: path.resolve(path.join(__dirname, './node_modules/react')),\n      // 'react-dom': path.resolve(path.join(__dirname, './node_modules/react-dom')),\n      // 'react-hot-loader': path.resolve(path.join(__dirname, './node_modules/react-hot-loader')),\n      // 'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  bail: true, // Fail out on the first error instead of tolerating it\n};\n"
  },
  {
    "path": "examples/async-components/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\", \"dynamic-import-node\"]\n}\n"
  },
  {
    "path": "examples/async-components/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/async-components/package.json",
    "content": "{\n  \"name\": \"hot-react-loadable\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"@hot-loader/react-dom\": \"^16.7.0-alpha.2.1\",\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"@loadable/component\": \"^4.0.2\",\n    \"emotion\": \"^8.0.12\",\n    \"loadable-components\": \"^2.2.2\",\n    \"react\": \"^16.4.1\",\n    \"react-async-component\": \"^2.0.0\",\n    \"react-dom\": \"^16.4.1\",\n    \"react-emotion\": \"^8.0.12\",\n    \"react-hot-loader\": \"^4.5.2\",\n    \"react-imported-component\": \"^5.2.0\",\n    \"react-loadable\": \"^5.5.0\",\n    \"react-remock\": \"^0.2.1\",\n    \"react-universal-component\": \"^3.0.3\",\n    \"styled-components\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/async-components/src/App.js",
    "content": "import { hot, setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport emoStyled from 'react-emotion';\n\n// import CAsync from './chunks/async-component'\n// import CLoadableComp from './chunks/loadable-components'\nimport { RLoadable1, RLoadable2 } from './chunks/react-loadable';\n// import CImp from './chunks/react-imported-component'\n// import CUni from './chunks/react-universal-component'\n\nconst BigText = styled.div`\n  font-size: 20px;\n`;\n\nconst SmallText = emoStyled('div')`\n  font-size: 22px;\n`;\n\nconst indirect = {\n  element: () => (\n    <SmallText>\n      hidden <Counter />\n    </SmallText>\n  ),\n};\n\nconst App = () => (\n  <div>\n    Testing React-Hot-Loader againts \"React code splitting\" components\n    <ul>\n      {/*<li>*/}\n      {/*Async-components <CAsync />*/}\n      {/*</li>*/}\n      {/*<li>*/}\n      {/*Loadable-components <CLoadableComp />*/}\n      {/*</li>*/}\n      <li>\n        React-Loadable <RLoadable1 />\n        1\n      </li>\n      {/*<li>*/}\n      {/*Imported-component <CImp />*/}\n      {/*</li>*/}\n      {/*<li>*/}\n      {/*Universal-component <CUni />*/}\n      {/*</li>*/}\n    </ul>\n  </div>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/async-components/src/Counter.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    //\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return (\n      <div>\n        1#{this.state.count}\n        <span>5</span>\n      </div>\n    );\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/async-components/src/Counter2.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    //return;\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 2 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return <div>2#{this.state.count}</div>;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/async-components/src/chunks/async-component.js",
    "content": "import { asyncComponent } from 'react-async-component';\n\nexport default asyncComponent({\n  resolve: () => import('../Counter'),\n});\n"
  },
  {
    "path": "examples/async-components/src/chunks/loadable-components.js",
    "content": "// import loadable from 'loadable-components' // this is old API\nimport loadable from '@loadable/component';\n\nexport const Loadable1 = loadable(() => import('../Counter'));\n\nexport const Loadable2 = loadable(() => import('../Counter2'));\n"
  },
  {
    "path": "examples/async-components/src/chunks/react-imported-component.js",
    "content": "import imported from 'react-imported-component';\n\nconst test = 115582;\n\nexport default imported(() => import('../Counter'));\n"
  },
  {
    "path": "examples/async-components/src/chunks/react-loadable.js",
    "content": "import React from 'react';\nimport Loadable from 'react-loadable';\n\nexport const RLoadable1 = Loadable({\n  loader: () => import('../Counter'),\n  loading: () => <div />,\n});\n\nexport const RLoadable2 = Loadable({\n  loader: () => import('../Counter2'),\n  loading: () => <div />,\n});\n"
  },
  {
    "path": "examples/async-components/src/chunks/react-universal-component.js",
    "content": "import universal from 'react-universal-component';\n\nexport default universal(() => import('../Counter'));\n"
  },
  {
    "path": "examples/async-components/src/index.js",
    "content": "import 'babel-polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/async-components/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/, // should work without exclude\n        test: /\\.js$/,\n        use: ['react-hot-loader/webpack', 'babel-loader'],\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      react: path.resolve(path.join(__dirname, './node_modules/react')),\n      'react-dom': path.resolve(path.join(__dirname, './node_modules/@hot-loader/react-dom')),\n      'react-hot-loader': path.resolve(path.join(__dirname, './node_modules/react-hot-loader')),\n      'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/async-portals/.babelrc",
    "content": "{\n  \"presets\": [\n    \"env\",\n    \"react\"\n  ],\n  \"plugins\": [\n    \"react-hot-loader/babel\",\n    \"transform-class-properties\",\n    \"dynamic-import-node\"\n  ]\n}\n"
  },
  {
    "path": "examples/async-portals/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/async-portals/package.json",
    "content": "{\n  \"name\": \"hot-async-portals\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^2.9.7\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\",\n    \"react-portal\": \"^4.1.2\"\n  }\n}\n"
  },
  {
    "path": "examples/async-portals/src/App.js",
    "content": "import { hot, setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport Counter from './Counter';\nimport AsyncComponent from './async-component';\nimport Portal from './Portal';\n\nconst importer = () => import('./DeferredRender');\nconst Async = () => <AsyncComponent importer={importer} />;\n\nconst App = () => (\n  <h1>\n    <p>{40}!</p>\n    <Counter />\n    <Async />\n    <Portal />\n  </h1>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/async-portals/src/Counter.js",
    "content": "import React from 'react';\n\nconst RAND = Math.round(Math.random() * 1000);\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n  gen = 0;\n\n  componentDidMount() {\n    this.setState({\n      count: RAND,\n    });\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    // gen should change. count - no.\n    return (\n      <span>\n        {this.state.count}:{this.gen++}\n      </span>\n    );\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/async-portals/src/DeferredRender.js",
    "content": "import React from 'react';\nimport { Portal } from 'react-portal';\nimport hidden from './HiddenComponent';\n\nconst Hidden = hidden();\n\nconst APortal = () => (\n  <Portal>\n    This is a async portal\n    <Hidden.counter />\n  </Portal>\n);\n\nexport default () => (\n  <div>\n    ASYNC\n    <Hidden.counter />\n    and <APortal />\n  </div>\n);\n"
  },
  {
    "path": "examples/async-portals/src/HiddenComponent.js",
    "content": "import React from 'react';\nimport Counter from './Counter';\n\nconst hidden = function() {\n  return {\n    counter: () => (\n      <div>\n        this is hidden counter(<Counter />)\n      </div>\n    ),\n  };\n};\n\nexport default hidden;\n"
  },
  {
    "path": "examples/async-portals/src/Portal.js",
    "content": "import React from 'react';\nimport { Portal } from 'react-portal';\nimport hidden from './HiddenComponent';\n\nconst Hidden = hidden();\n\nconst InPortal = ({ children }) => <div> + {children}</div>;\n\nexport default () => (\n  <Portal>\n    <InPortal>\n      This is a first portal\n      <Hidden.counter />\n    </InPortal>\n  </Portal>\n);\n"
  },
  {
    "path": "examples/async-portals/src/async-component.js",
    "content": "import React, { Component } from 'react';\n\nclass AsyncComponent extends Component {\n  constructor(props) {\n    super(props);\n    this.state = {};\n  }\n\n  componentWillMount() {\n    this.load();\n  }\n\n  componentWillReceiveProps() {\n    if (module.hot) {\n      setImmediate(() => {\n        this.load();\n      });\n    }\n  }\n\n  load() {\n    return this.props.importer().then(payload => {\n      this.setState({ AsyncComponent: payload.default });\n    });\n  }\n\n  render() {\n    const { AsyncComponent } = this.state;\n\n    if (AsyncComponent) {\n      return <AsyncComponent {...this.props} />;\n    }\n    return <div>async</div>;\n  }\n}\n\nexport default AsyncComponent;\n"
  },
  {
    "path": "examples/async-portals/src/index.js",
    "content": "import 'babel-polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/async-portals/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        //exclude: /node_modules|packages/,  // should work without exclude\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      react: path.resolve(path.join(__dirname, './node_modules/react')),\n      'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/decorators/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\", \"transform-decorators-legacy\"]\n}\n"
  },
  {
    "path": "examples/decorators/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/decorators/package.json",
    "content": "{\n  \"name\": \"hot-decorators\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-plugin-transform-decorators-legacy\": \"^1.3.4\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^2.9.7\"\n  },\n  \"dependencies\": {\n    \"autobind-decorator\": \"^2.1.0\",\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\"\n  }\n}\n"
  },
  {
    "path": "examples/decorators/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\n\nconst App = () => (\n  <h1>\n    Hello, world.<br />\n    <Counter />\n  </h1>\n);\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/decorators/src/Counter.js",
    "content": "import React from 'react';\nimport autobind from 'autobind-decorator';\n\n@autobind\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(this.increment, 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  increment() {\n    this.setState(prevState => ({ count: prevState.count + 1 }));\n  }\n\n  render() {\n    return this.state.count;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/decorators/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/decorators/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/electron-typescript/.gitignore",
    "content": ".DS_Store\n\nnode_modules\ndist\n"
  },
  {
    "path": "examples/electron-typescript/README.md",
    "content": "# Electron typescript\n\n## Run application\n\nFirst you should start to watch application folder via webpack to enable hot-reloading\n\n```bash\nyarn watch\n```\n\nIn another terminal window run application\n\n```bash\nyarn start\n```\n\n## Compile application\n\n```bash\nyarn build\n```\n\nIn another terminal window run application\n\n```bash\nyarn start\n```\n"
  },
  {
    "path": "examples/electron-typescript/app/App.tsx",
    "content": "import { hot } from 'react-hot-loader/root'\nimport * as React from 'react'\nimport Counter from './Counter'\n\nconst App = () => (\n  <div>\n    <h1>Hello, world.</ h1>\n    <Counter/>\n  </div>\n)\n\nexport default hot(App)\n"
  },
  {
    "path": "examples/electron-typescript/app/Counter.tsx",
    "content": "import * as React from 'react'\n\nclass Counter extends React.Component<{}, { count: number }> {\n  interval: number\n\n  constructor(props : any) {\n    super(props)\n    this.state = { count: 0 }\n  }\n\n  componentDidMount() {\n    this.interval = window.setInterval(\n      () => this.setState(prevState => ({ count: prevState.count + 1 })),\n      200,\n    )\n  }\n\n  generateString1() {\n    return \"1\"\n  }\n\n  generateString2 = ()  => {\n    return \"1\"\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval)\n  }\n\n  render() {\n    return <span>{this.state.count} - {this.generateString1()} - {this.generateString2()}</span>\n  }\n}\n\nexport default Counter\n"
  },
  {
    "path": "examples/electron-typescript/app/development.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>Electron typescript example</title>\n  </head>\n  <body>\n    <main id=\"app\" class=\"app\"></main>\n    <script src=\"http://localhost:8080/bundle.js\"></script>\n    <script src=\"http://localhost:8080/webpack-dev-server.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/electron-typescript/app/index.tsx",
    "content": "import 'core-js/stable'\nimport 'regenerator-runtime/runtime'\nimport * as React from 'react'\nimport { render } from 'react-dom'\nimport App from './App'\n\nrender(<App />, document.getElementById('app'))\n"
  },
  {
    "path": "examples/electron-typescript/app/production.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>Electron typescript example</title>\n  </head>\n  <body>\n    <main id=\"app\" class=\"app\"></main>\n    <script type=\"text/javascript\" src=\"bundle.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/electron-typescript/main.js",
    "content": "const { app, BrowserWindow } = require('electron');\nconst path = require('path');\n\nlet mainWindow;\n\nconst createWindow = () => {\n  mainWindow = new BrowserWindow({\n    width: 1000,\n    height: 600,\n    webPreferences: {\n      nodeIntegration: true,\n    },\n  });\n\n  mainWindow.loadFile(path.join(__dirname, 'dist/index.html'));\n\n  mainWindow.on('closed', () => {\n    mainWindow = null;\n  });\n\n  mainWindow.on('ready-to-show', () => {\n    mainWindow.show();\n    mainWindow.focus();\n  });\n};\n\napp.on('ready', () => {\n  createWindow();\n});\n\napp.on('window-all-closed', () => {\n  if (process.platform !== 'darwin') app.quit();\n});\n\napp.on('activate', () => {\n  if (mainWindow === null) createWindow();\n});\n"
  },
  {
    "path": "examples/electron-typescript/package.json",
    "content": "{\n  \"name\": \"electron-typescript\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"watch\": \"rm -rf ./dist && mkdir ./dist && cp ./app/development.html ./dist/index.html && NODE_ENV=development webpack-dev-server --hot\",\n    \"build\": \"rm -rf ./dist && mkdir ./dist && cp ./app/production.html ./dist/index.html && NODE_ENV=development webpack\",\n    \"start\": \"electron main.js\"\n  },\n  \"main\": \"main.js\",\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.6.0\",\n    \"@babel/plugin-proposal-class-properties\": \"^7.5.5\",\n    \"@babel/plugin-proposal-decorators\": \"^7.6.0\",\n    \"@babel/preset-env\": \"^7.6.0\",\n    \"@babel/preset-react\": \"^7.0.0\",\n    \"@babel/preset-typescript\": \"^7.6.0\",\n    \"@types/react\": \"^16.9.2\",\n    \"@types/react-dom\": \"^16.9.0\",\n    \"babel-loader\": \"^8.0.6\",\n    \"core-js\": \"^3.2.1\",\n    \"electron\": \"^6.0.8\",\n    \"fork-ts-checker-webpack-plugin\": \"^1.5.0\",\n    \"react\": \"^16.9.0\",\n    \"react-dom\": \"^16.9.0\",\n    \"react-hot-loader\": \"^4.12.13\",\n    \"regenerator-runtime\": \"^0.13.3\",\n    \"typescript\": \"^3.6.3\",\n    \"webpack\": \"^4.40.2\",\n    \"webpack-cli\": \"^3.3.8\",\n    \"webpack-dev-server\": \"^3.8.1\",\n    \"webpack-merge\": \"^4.2.2\"\n  }\n}\n"
  },
  {
    "path": "examples/electron-typescript/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"outDir\": \"./dist/\",\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"module\": \"commonjs\",\n    \"target\": \"es6\",\n    \"jsx\": \"react\"\n  },\n  \"include\": [\"./app/**/*\"]\n}\n"
  },
  {
    "path": "examples/electron-typescript/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\nconst merge = require('webpack-merge');\nconst ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\n\nconst env = process.env.NODE_ENV;\n\nconst appConfig = {\n  mode: env || 'development',\n  entry: ['./app/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  resolve: {\n    modules: ['node_modules'],\n    alias: {\n      'react-dom': '@hot-loader/react-dom',\n    },\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n  },\n  target: 'electron-renderer',\n  module: {\n    rules: [\n      {\n        test: /\\.(j|t)s(x)?$/,\n        exclude: /node_modules/,\n        use: {\n          loader: 'babel-loader',\n          options: {\n            cacheDirectory: true,\n            babelrc: false,\n            presets: [\n              ['@babel/preset-env', { targets: { browsers: 'last 1 version' } }],\n              '@babel/preset-typescript',\n              '@babel/preset-react',\n            ],\n            plugins: [\n              // plugin-proposal-decorators is only needed if you're using experimental decorators in TypeScript\n              ['@babel/plugin-proposal-decorators', { legacy: true }],\n              ['@babel/plugin-proposal-class-properties', { loose: true }],\n              'react-hot-loader/babel',\n            ],\n          },\n        },\n      },\n    ],\n  },\n};\n\nconst developmentConfig = {\n  output: {\n    publicPath: 'http://localhost:8080/',\n  },\n  plugins: [new ForkTsCheckerWebpackPlugin(), new webpack.NamedModulesPlugin()],\n  devtool: 'eval-source-map',\n};\n\nconst productionConfig = {\n  output: {\n    publicPath: '/',\n  },\n};\n\nmodule.exports = merge(appConfig, env === 'production' ? productionConfig : developmentConfig);\n"
  },
  {
    "path": "examples/hotCold/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/hotCold/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/hotCold/package.json",
    "content": "{\n  \"name\": \"hot-cold\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"emotion\": \"^8.0.12\",\n    \"react\": \"^16.3.2\",\n    \"react-circle\": \"^1.1.1\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-emotion\": \"^8.0.12\",\n    \"react-hot-loader\": \"^4.2.0\",\n    \"styled-components\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/hotCold/src/App.js",
    "content": "import { hot, setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport emoStyled from 'react-emotion';\nimport Circle from 'react-circle';\nimport Counter from './Counter';\n\nconst BigText = styled.div`\n  font-size: 20px;\n`;\n\nconst SmallText = emoStyled('div')`\n  font-size: 22px;\n`;\n\nconst indirect = {\n  element: () => (\n    <SmallText>\n      hidden <Counter />\n    </SmallText>\n  ),\n};\n\nconst aNumber = 100500;\n\nconst App = () => (\n  <h1>\n    <BigText>1.Hello, world! {aNumber} </BigText>\n    <br />\n    <SmallText>2.Hello, world.</SmallText>\n    <br />\n    <Counter />\n    <indirect.element />\n    <p>{BigText === <BigText />.type ? 'BigText is cold' : 'BigText is hot'} (should be cold!)</p>\n    <p>{SmallText === <SmallText />.type ? 'SmallText is cold' : 'SmallText is hot'} (should be cold!)</p>\n    <p>{Circle === <Circle />.type ? 'Circle is cold' : 'Circle is hot'} (should be cold!)</p>\n    <p>{Counter === <Counter />.type ? 'Counter is cold' : 'Counter is hot'} (should be cold!)</p>\n    <Circle progress={35} />\n    <div>{[<span key={1}>depend on aNumber - </span>, aNumber % 2 && <indirect.element key=\"2\" />]}</div>\n  </h1>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/hotCold/src/Counter.js",
    "content": "import React from 'react';\nimport { cold } from 'react-hot-loader';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return <div>#{this.state.count}</div>;\n  }\n}\n\nexport default cold(Counter);\n//export default Counter;\n"
  },
  {
    "path": "examples/hotCold/src/index.js",
    "content": "import 'babel-polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport './reactHotLoader.setup';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/hotCold/src/reactHotLoader.setup.js",
    "content": "import { setConfig, cold } from 'react-hot-loader';\n\nsetConfig({\n  onComponentRegister: (type, name, file) => file.indexOf('node_modules') > 0 && cold(type),\n\n  onComponentCreate: (type, name) => name.indexOf('styled') > 0 && cold(type),\n});\n"
  },
  {
    "path": "examples/hotCold/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nconst babelPlugin = path.resolve(__dirname, './node_modules/react-hot-loader/babel');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: ['react-hot-loader/webpack', 'babel-loader'],\n      },\n      {\n        include: /node_modules/,\n        test: /\\.js$/,\n        use: {\n          loader: 'react-hot-loader/webpack',\n        },\n      },\n      /*\n      // babel is an option, but slow option\n      {\n        include: /node_modules/,\n        test: /\\.js$/,\n        use: {\n          loader: 'babel-loader',\n          options: {\n            // plugins: ['react-hot-loader/babel'] // <<----- you need this\n\n            plugins: [babelPlugin], // you DON'T need this\n          },\n        },\n      },\n      /* */\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      // you don't need this\n      react: path.resolve(path.join(__dirname, './node_modules/react')),\n      'react-hot-loader': path.resolve(path.join(__dirname, './node_modules/react-hot-loader')),\n      'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/indeterminateComponent/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/indeterminateComponent/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/indeterminateComponent/package.json",
    "content": "{\n  \"name\": \"hot-indeternimate-component\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\"\n  }\n}\n"
  },
  {
    "path": "examples/indeterminateComponent/src/App.js",
    "content": "import { hot, setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport Counter from './Counter';\n\nclass AsyncMiddle1 extends React.Component {\n  render() {\n    return (\n      <div>\n        1:<Counter />\n      </div>\n    );\n  }\n}\n\nclass AsyncMiddle2 extends React.Component {\n  render() {\n    return (\n      <div>\n        2:<Counter />\n      </div>\n    );\n  }\n}\n\nconst DeferAsync = (props, context) => {\n  if (props.n === 1) {\n    return new AsyncMiddle1(props, context);\n  }\n  return new AsyncMiddle2(props, context);\n};\n\nconst SimpleWrapper = () => (\n  <div>\n    C: <Counter /> 44\n  </div>\n);\n\nconst App = () => (\n  <h1>\n    1. <SimpleWrapper />\n    2. <DeferAsync test={3} n={1} />\n    3. <DeferAsync test={3} n={2} />\n    4.{' '}\n    <Counter>\n      inner:<Counter />\n    </Counter>\n    test#5\n  </h1>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/indeterminateComponent/src/Counter.js",
    "content": "import React from 'react';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return (\n      <div>\n        {this.state.count}\n        {this.props.children && <span>{this.props.children}</span>}\n      </div>\n    );\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/indeterminateComponent/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/indeterminateComponent/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      react: path.resolve(path.join(__dirname, './node_modules/react')),\n      'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/mobx/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\", \"transform-decorators-legacy\"]\n}\n"
  },
  {
    "path": "examples/mobx/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/mobx/package.json",
    "content": "{\n  \"name\": \"hot-mobx\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-plugin-transform-decorators-legacy\": \"^1.3.4\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"autobind-decorator\": \"^2.1.0\",\n    \"mobx\": \"^5.0.3\",\n    \"mobx-react\": \"^5.2.3\",\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\"\n  }\n}\n"
  },
  {
    "path": "examples/mobx/src/App.js",
    "content": "import React from 'react';\nimport { hot, setConfig } from 'react-hot-loader';\nimport Counter from './Counter';\n\nconst Element1 = ({ children }) => <div>Block1 {children}</div>;\n\nconst Element2 = () => (\n  <div>\n    Block2 <Counter />\n  </div>\n);\n\nconst App = () => (\n  <h1>\n    Hello, mobx<br />\n    <Counter />\n    <Element1>\n      <Counter />\n    </Element1>\n    <Element2 />\n  </h1>\n);\n\nsetConfig({ logLevel: 'debug' });\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/mobx/src/Counter.js",
    "content": "import React, { Component } from 'react';\nimport { hot } from 'react-hot-loader';\nimport { observer } from 'mobx-react';\nimport { observable } from 'mobx';\n\nclass Counter extends React.Component {\n  state = { count: Math.round(Math.random() * 1000) };\n\n  componentDidMount() {\n    //this.interval = setInterval(this.increment, 200)\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  increment = () => {\n    this.setState(prevState => ({ count: prevState.count + 1 }));\n  };\n\n  render() {\n    return this.state.count;\n  }\n}\n\nclass Comp extends Component {\n  state = {\n    obsObj: null,\n  };\n\n  static getDerivedStateFromProps(nextProps, prevState) {\n    return { obsObj: nextProps.obsObj };\n  }\n\n  componentDidMount() {\n    //setInterval(() => this.setState({update: 1}), 5000);\n  }\n\n  render() {\n    const { prop1 } = this.state.obsObj || {};\n    return (\n      <div style={{ border: '10px solid red' }}>\n        {prop1}\n        <Counter />\n      </div>\n    );\n  }\n}\n\nconst ObsComp = observer(Comp);\n\nclass App extends Component {\n  @observable\n  obj = {\n    prop1: 'Example',\n  };\n\n  render() {\n    return (\n      <div>\n        <ObsComp obsObj={this.obj} />\n      </div>\n    );\n  }\n}\n\nexport default App;\n"
  },
  {
    "path": "examples/mobx/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/mobx/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      react: path.resolve(path.join(__dirname, './node_modules/react')),\n      'babel-core': path.resolve(path.join(__dirname, './node_modules/@babel/core')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/multiple-hocs/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/multiple-hocs/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/multiple-hocs/package.json",
    "content": "{\n  \"name\": \"hot-multiple-hocs\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\",\n    \"recompose\": \"^0.26.0\"\n  }\n}\n"
  },
  {
    "path": "examples/multiple-hocs/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\n\nconst App = () => (\n  <h1>\n    Hello, world.<br />\n    <Counter />\n  </h1>\n);\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/multiple-hocs/src/Counter.js",
    "content": "import React from 'react';\nimport * as r from 'recompose';\n\nconst Counter = r.compose(\n  r.pure,\n  r.withProps({ style: { color: 'red' } }),\n  r.withState('count', 'setCount', 0),\n  r.lifecycle({\n    componentDidMount() {\n      this.interval = setInterval(() => this.props.setCount(this.props.count + 1), 200);\n    },\n\n    componentWillUnmount() {\n      clearInterval(this.interval);\n    },\n  }),\n)(({ style, count }) => <div style={style}>{count}</div>);\n\nexport default Counter;\n"
  },
  {
    "path": "examples/multiple-hocs/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/multiple-hocs/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/parcel/.babelrc",
    "content": "{\n  \"presets\": [\"env\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/parcel/.gitignore",
    "content": "node_modules\n.cache\ndist\n"
  },
  {
    "path": "examples/parcel/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n    <title>My React Project</title>\n</head>\n\n<body>\n  <div id=\"root\"></div>\n  <script src=\"./src/index.js\"></script>\n</body>\n\n</html>\n"
  },
  {
    "path": "examples/parcel/package.json",
    "content": "{\n  \"name\": \"hot-parcel\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"parcel index.html --no-cache\",\n    \"start:prod\": \"parcel build index.html\",\n    \"start:link\": \"cp -R ../../dist ./node_modules/react-hot-loader && cp -R ../../*.js ./node_modules/react-hot-loader\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.4.5\",\n    \"@babel/preset-env\": \"^7.4.5\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.7.0\",\n    \"parcel-bundler\": \"^1.12.3\"\n  },\n  \"dependencies\": {\n    \"@hot-loader/react-dom\": \"^16.8.6\",\n    \"react\": \"^16.8.6\",\n    \"react-dom\": \"^16.8.6\",\n    \"react-hot-loader\": \"^4.11.1\"\n  },\n  \"alias\": {\n    \"react-dom\": \"@hot-loader/react-dom\"\n  }\n}\n"
  },
  {
    "path": "examples/parcel/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\nimport { Problem } from './Problem';\n\nconst App = () => {\n  return (\n    <h1>\n      <Problem />\n      Hello, world.<br />\n      <Counter />\n    </h1>\n  );\n};\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/parcel/src/Counter.js",
    "content": "import React from 'react';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return this.state.count;\n  }\n}\n\nexport default Counter;\n\nexport function useExternalHook() {\n  React.useEffect(() => {});\n}\n"
  },
  {
    "path": "examples/parcel/src/Problem.js",
    "content": "import React from 'react';\nimport { useExternalHook } from './Counter';\n\nexport function Problem() {\n  useExternalHook();\n  return <div>the problem!!!!</div>;\n}\n"
  },
  {
    "path": "examples/parcel/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nfunction renderApp() {\n  render(<App />, root);\n}\n\nrenderApp();\n\nmodule.hot.accept();\n"
  },
  {
    "path": "examples/preact/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/preact/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/preact/package.json",
    "content": "{\n  \"name\": \"hot-preact-simple\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"preact\": \"^8.2.7\",\n    \"preact-compat\": \"^3.18.0\",\n    \"react-hot-loader\": \"^4.1.2\"\n  },\n  \"resolutions\": {\n    \"react\": \"preact-compat\",\n    \"react-dom\": \"preact-compat\"\n  }\n}\n"
  },
  {
    "path": "examples/preact/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\nimport { Internal } from './Internal';\n\nconst App = () => (\n  <h1>\n    Hello, world<br />\n    <Internal />\n    <br />\n    <Counter />\n  </h1>\n);\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/preact/src/Counter.js",
    "content": "import { h, render, Component } from 'preact';\n\n// Tell Babel to transform JSX into h() calls:\n/** @jsx h */\n\nclass Counter extends Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render(props, state) {\n    return <div>10:{state.count}</div>;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/preact/src/Internal.js",
    "content": "import preact from 'preact';\nimport Counter from './Counter';\n\n// Tell Babel to transform JSX into h() calls:\n/** @jsx preact.h */\n\nexport const Internal = () => (\n  <div>\n    <Counter />\n  </div>\n);\n"
  },
  {
    "path": "examples/preact/src/hotLoaderSetup.js",
    "content": "import reactHotLoader, { setConfig } from 'react-hot-loader';\nimport preact from 'preact';\n\nreactHotLoader.preact(preact);\n"
  },
  {
    "path": "examples/preact/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\n// setup Preact before importing App\nimport './hotLoaderSetup';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/preact/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  resolve: {\n    alias: {\n      react: path.resolve(path.join(__dirname, './node_modules/preact-compat')),\n      'react-dom': path.resolve(path.join(__dirname, './node_modules/preact-compat')),\n    },\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/react-bootstrap/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/react-bootstrap/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/react-bootstrap/package.json",
    "content": "{\n  \"name\": \"hot-react-bootstrap\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-bootstrap\": \"^0.31.5\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\"\n  }\n}\n"
  },
  {
    "path": "examples/react-bootstrap/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader/root';\nimport FormControl from 'react-bootstrap/lib/FormControl';\n\nclass App extends React.Component {\n  render() {\n    return (\n      <h1>\n        Hello, world.<br />\n        <FormControl inputRef={console.log} defaultValue=\"Write me\" />\n      </h1>\n    );\n  }\n}\n\nexport default hot(App);\n"
  },
  {
    "path": "examples/react-bootstrap/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/react-bootstrap/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/react-refetch/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/react-refetch/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/react-refetch/package.json",
    "content": "{\n  \"name\": \"hot-react-refetch\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\",\n    \"react-refetch\": \"^1.0.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react-refetch/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader/root';\nimport Characters from './Characters';\n\nconst App = () => (\n  <h1>\n    Hello, world.<br />\n    <Characters />\n  </h1>\n);\n\nexport default hot(App);\n"
  },
  {
    "path": "examples/react-refetch/src/Characters.js",
    "content": "import React from 'react';\nimport { connect } from 'react-refetch';\n\nconst Characters = ({ charactersFetch }) =>\n  charactersFetch.fulfilled ? (\n    <ul>{charactersFetch.value.results.map(result => <li key={result.url}>{result.name}</li>)}</ul>\n  ) : null;\n\nexport default connect(() => ({\n  charactersFetch: 'https://swapi.co/api/people/',\n}))(Characters);\n"
  },
  {
    "path": "examples/react-refetch/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/react-refetch/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/redux/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/redux/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/redux/index_csp.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Webpack App</title>\n    <meta http-equiv=\"Content-Security-Policy\" content=\"default-src http:\">\n</head>\n<body>\n</body>\n</html>"
  },
  {
    "path": "examples/redux/package.json",
    "content": "{\n  \"name\": \"hot-redux\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^3.2.0\",\n    \"webpack\": \"^4.25.1\",\n    \"webpack-cli\": \"^3.1.2\",\n    \"webpack-dev-server\": \"^3.1.10\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.8.6\",\n    \"react-dom\": \"^16.8.6\",\n    \"react-hot-loader\": \"^4.12.5\",\n    \"react-redux\": \"^7.1.0\",\n    \"redux\": \"^4.0.3\"\n  }\n}\n"
  },
  {
    "path": "examples/redux/src/App.js",
    "content": "import React, { useState, useEffect } from 'react';\nimport { hot } from 'react-hot-loader/root';\n\nimport { MyComponent } from './MyComponent';\nimport { HookComponent } from './HookComponent';\n\nconst App = () => {\n  const [state] = useState(42);\n  const [effect, setEffect] = useState(42);\n\n  useEffect(() => {\n    setEffect(effect + 1);\n  }, []);\n\n  useEffect(\n    () => {\n      setEffect(effect + 0.1);\n    },\n    ['hot'],\n  );\n\n  return (\n    <div>\n      <MyComponent>\n        test {state} : {effect}\n      </MyComponent>\n      <HookComponent />\n    </div>\n  );\n};\n\nexport default hot(App);\n"
  },
  {
    "path": "examples/redux/src/HookComponent.js",
    "content": "import { useSelector } from 'react-redux';\n\nexport function HookComponent() {\n  const notifications = useSelector(() => true);\n\n  return null;\n}\n"
  },
  {
    "path": "examples/redux/src/MyComponent.js",
    "content": "import React from 'react';\nimport { connect } from 'react-redux';\n\nexport class MyComponent1 extends React.Component {\n  render() {\n    return <div>{this.props.children}</div>;\n  }\n}\n\nexport const MyComponent = connect(state => state, undefined, undefined, { pure: false })(MyComponent1);\n"
  },
  {
    "path": "examples/redux/src/index.js",
    "content": "import React from 'react';\nimport {Provider} from 'react-redux';\nimport {createStore, combineReducers} from 'redux';\n\nimport {render} from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nconst store =createStore(combineReducers({}));\n\nrender(\n  <Provider store={store}>\n    <App/>\n  </Provider>\n  , root);\n"
  },
  {
    "path": "examples/redux/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  mode: process.env.NODE_ENV || 'development',\n  //devtool: false,\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /packages/, // should work without exclude\n        test: /\\.js$/,\n        use: ['react-hot-loader/webpack', 'babel-loader'],\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      // 'react-dom': '@hot-loader/react-dom',\n      // react: path.resolve(path.join(__dirname, './node_modules/react')),\n      // 'react-hot-loader': path.resolve(\n      //   path.join(__dirname, './node_modules/react-hot-loader'),\n      // ),\n      // 'babel-core': path.resolve(\n      //   path.join(__dirname, './node_modules/@babel/core'),\n      // ),\n    },\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      // uncomment this line to test RHL in \"secure\" env\n      // template: \"index_csp.html\",\n    }),\n    new webpack.NamedModulesPlugin(),\n  ],\n};\n"
  },
  {
    "path": "examples/styled-components/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\", \"dynamic-import-node\"]\n}\n"
  },
  {
    "path": "examples/styled-components/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/styled-components/index_csp.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Webpack App</title>\n    <meta http-equiv=\"Content-Security-Policy\" content=\"default-src http:\">\n</head>\n<body>\n</body>\n</html>"
  },
  {
    "path": "examples/styled-components/package.json",
    "content": "{\n  \"name\": \"hot-styled-components\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"NODE_ENV=development webpack-dev-server --hot\",\n    \"start:cold\": \"NODE_ENV=development webpack-dev-server\",\n    \"start:prod\": \"NODE_ENV=production webpack-dev-server --hot\",\n    \"start:link\": \"cp -R ../../dist ./node_modules/react-hot-loader && cp -R ../../*.js ./node_modules/react-hot-loader\",\n    \"start:hot\": \"cp -R ../../../hot/react-dom/target/cjs ./node_modules/react-dom\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^3.2.0\",\n    \"webpack\": \"^4.25.1\",\n    \"webpack-cli\": \"^3.1.2\",\n    \"webpack-dev-server\": \"^3.1.10\"\n  },\n  \"dependencies\": {\n    \"babel-polyfill\": \"^6.26.0\",\n    \"emotion\": \"^8.0.12\",\n    \"react\": \"^17.0.0-rc.2\",\n    \"react-dom\": \"^17.0.0-rc.2\",\n    \"react-emotion\": \"^9.2.12\",\n    \"react-hot-loader\": \"^4.12.21\",\n    \"react-spring\": \"^8.0.25\",\n    \"styled-components\": \"^4.0.3\"\n  }\n}\n"
  },
  {
    "path": "examples/styled-components/src/App.js",
    "content": "import { hot } from 'react-hot-loader/root';\nimport { setConfig } from 'react-hot-loader';\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport emoStyled from 'react-emotion';\nimport './config';\nimport Counter from './Counter';\nimport { SpringTest } from './Spring';\n\n// const genApp = () => {\nconst BigText = styled.div`\n  font-size: 25px;\n`;\n\nconst SmallText = emoStyled('div')`\n  font-size: 22px;\n`;\n\nconst indirect = {\n  element: () => (\n    <SmallText>\n      hidden <Counter />\n    </SmallText>\n  ),\n};\n\nconst indirectStyled = {\n  DS: styled.div`\n    border: 20px solid #f00;\n  `,\n  DE: emoStyled('div')`border: 1px solid #F00`,\n};\n\nconst Async = React.lazy(() => import('./Async'));\n\nconst aNumber = 200500;\n\nconst OtherComponent = () => <span>test</span>;\n\nconst Context = React.createContext();\n\nconst Hook = () => {\n  const [state, setState] = React.useState({ x: 4 });\n\n  React.useState(0);\n\n  React.useEffect(() => {\n    console.log('mount effected 1');\n    setState(state => ({\n      x: state.x + 1,\n    }));\n  }, []);\n\n  React.useEffect(\n    () => {\n      console.log('hot effected');\n      setState(state => ({\n        x: state.x + 0.5,\n      }));\n    },\n    ['hot'],\n  );\n\n  //React.useState(0);\n  return (\n    <div>\n      hook state 1: {state.x}\n      <Counter />\n    </div>\n  );\n};\n\nconst Memo1 = React.memo(() => (\n  <div>\n    [mem <OtherComponent />\n    <Counter /> memo]\n  </div>\n));\n\nconst Memo2 = React.memo(\n  class extends React.Component {\n    render() {\n      return (\n        <div>\n          [mem2 <Counter /> memo]\n        </div>\n      );\n    }\n  },\n);\n\nconst Memo3 = React.memo(\n  React.forwardRef(() => (\n    <div>\n      [double memo 3 <OtherComponent />\n      <Counter /> memo]\n    </div>\n  )),\n);\n\nconst TwinComponents = [\n  ({ children }) => <div data-twin=\"1\">{children}</div>,\n  ({ children }) => <div data-twin=\"2\">{children}</div>,\n];\n\nconst TwinComponent = props => {\n  const Twin = TwinComponents[window.twinId || 0];\n  return <Twin {...props} />;\n};\n\nconst InApp = () => (\n  <h1>\n    <SpringTest />\n    <BigText>\n      <TwinComponent>\n        1. Hello, world! {aNumber} <Counter />\n      </TwinComponent>\n    </BigText>\n    hook:\n    <Hook />\n    <br />\n    <SmallText>\n      2.Hello, world! <Counter />.\n    </SmallText>\n    <br />\n    <Counter />\n    <Context.Provider>\n      <Memo1 a1 a2 />\n    </Context.Provider>\n    <Memo2 a1 a2 />\n    <Memo3 a1 a2 />\n    <div>\n      <React.Suspense fallback=\"loading\">\n        <Async />\n      </React.Suspense>\n    </div>\n    <indirect.element />\n    <indirectStyled.DS>\n      {' '}\n      indirect DS <Counter />{' '}\n    </indirectStyled.DS>\n    <indirectStyled.DE>\n      {' '}\n      indirect DE <Counter />{' '}\n    </indirectStyled.DE>\n    <div>{[<span key={1}>depend on aNumber - </span>, aNumber % 2 && <indirect.element key=\"2\" />]}</div>\n  </h1>\n);\n\nconst App = () => <InApp />;\n\nsetConfig({\n  logLevel: 'debug',\n  hotHooks: true,\n});\n\n//   return App;\n// }\n//\n// const App = genApp();\n\nexport default hot(App);\n"
  },
  {
    "path": "examples/styled-components/src/Async.js",
    "content": "import React from 'react';\nimport Counter from './Counter';\n\nexport default () => (\n  <div>\n    async<Counter />\n  </div>\n);\n"
  },
  {
    "path": "examples/styled-components/src/Counter.js",
    "content": "import React, { useContext, useState, useEffect, useRef } from 'react';\n\nconst TimerContext = React.createContext(0);\n\nconst ComponentA = () => {\n  const value = useContext(TimerContext);\n  const [state] = useState('A');\n  return (\n    <div>\n      {state}-{value}-\n      <TimerContext.Consumer>{v => v}</TimerContext.Consumer>\n    </div>\n  );\n};\n\nconst ComponentB = () => {\n  const [state] = useState('B');\n  const value = useContext(TimerContext);\n  return (\n    <div>\n      {state}-{value}-\n      <TimerContext.Consumer>{v => v}</TimerContext.Consumer>\n    </div>\n  );\n};\n\nconst useSomeHandler = function() {\n  return 43;\n};\n\nfunction RippleComponent() {\n  function useRippleHandler() {}\n  useRippleHandler();\n  useRippleHandler();\n\n  return false;\n}\n\nconst Counter = ({ children }) => {\n  const [count, setState] = useState(0);\n  const useRippleHandler = function() {};\n  useRippleHandler();\n  useSomeHandler();\n  useState(0);\n  const ref = useRef();\n  useEffect(() => {\n    ref.current = 0;\n    const int = setInterval(() => setState(ref.current++), 1000);\n    return () => clearInterval(int);\n  }, []);\n\n  return (\n    <div>\n      <TimerContext.Provider value={count}>\n        #{count}\n        {children &&\n          React.cloneElement(children, {\n            counter: count,\n          })}\n        {count % 2 ? <ComponentA /> : <ComponentB />}\n        <RippleComponent />\n      </TimerContext.Provider>\n    </div>\n  );\n};\n\nexport default Counter;\n"
  },
  {
    "path": "examples/styled-components/src/Spring.js",
    "content": "// import { animated, useSpring } from 'react-spring';\nimport React, { useCallback, useState } from 'react';\nimport Counter from './Counter';\n\nconst context = React.createContext('test1');\n\nconst Test = () => {\n  const v = React.useContext(context);\n\n  return (\n    <div>\n      --{v}-- ##<Counter />\n    </div>\n  );\n};\n\nexport function SpringTest() {\n  const [thingDone, toggleThingDone] = useState(false);\n  const doTheThing = useCallback(() => toggleThingDone(!thingDone), [thingDone]);\n\n  // const fader = useSpring({ opacity: thingDone ? 1 : 0 });\n\n  const v = React.useContext(context);\n\n  return (\n    <React.Fragment>\n      {v}\n      <context.Provider value={24}>\n        <Test />\n      </context.Provider>\n      <context.Provider value=\"test2\">\n        <Test />\n      </context.Provider>\n      {/*<animated.h1 style={fader}>You did the thing!</animated.h1>*/}\n      <button type=\"button\" onClick={doTheThing}>\n        {thingDone ? 'Undo The Thing' : 'Do The Thing'}\n      </button>\n    </React.Fragment>\n  );\n}\n"
  },
  {
    "path": "examples/styled-components/src/config.js",
    "content": "import { setConfig } from 'react-hot-loader';\nimport ReactDOM from 'react-dom';\n\nsetConfig({\n  ignoreSFC: !!ReactDOM.setHotElementComparator,\n  pureSFC: true,\n  pureRender: true,\n});\n"
  },
  {
    "path": "examples/styled-components/src/index.js",
    "content": "import 'react-lifecycles-compat';\nimport 'core-js/modules/es6.promise';\n// import 'babel-polyfill';\nimport React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\n//const root = ;\ndocument.body.appendChild(document.createElement('div'));\n\nrender(<App />, document.getElementsByTagName('div')[0]);\n"
  },
  {
    "path": "examples/styled-components/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  mode: process.env.NODE_ENV || 'development',\n  //devtool: false,\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules/, // should work without exclude\n        test: /\\.js$/,\n        use: ['babel-loader'],\n      },\n      {\n        include: /node_modules\\/react-lifecycles-compat/, // should work without exclude\n        test: /\\.js$/,\n        use: ['babel-loader'],\n      },\n      {\n        include: /node_modules\\/react-dom/,\n        test: /\\.jsx?$/,\n        use: {\n          loader: 'react-hot-loader/webpack',\n          options: {\n            noRegister: true,\n            cacheBreaker: 1,\n          },\n        },\n      },\n    ],\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n    alias: {\n      // 'react-dom': '@hot-loader/react-dom',\n      // react: path.resolve(path.join(__dirname, './node_modules/react')),\n      // 'react-hot-loader': path.resolve(\n      //   path.join(__dirname, './node_modules/react-hot-loader'),\n      // ),\n      // 'babel-core': path.resolve(\n      //   path.join(__dirname, './node_modules/@babel/core'),\n      // ),\n    },\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      // uncomment this line to test RHL in \"secure\" env\n      // template: \"index_csp.html\",\n    }),\n    new webpack.NamedModulesPlugin(),\n  ],\n};\n"
  },
  {
    "path": "examples/typescript/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/typescript/package.json",
    "content": "{\n  \"name\": \"hot-typescript\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.6.0\",\n    \"@babel/plugin-proposal-class-properties\": \"^7.5.5\",\n    \"@babel/plugin-proposal-decorators\": \"^7.6.0\",\n    \"@babel/preset-env\": \"^7.6.0\",\n    \"@babel/preset-react\": \"^7.0.0\",\n    \"@babel/preset-typescript\": \"^7.6.0\",\n    \"@types/react\": \"^16.9.2\",\n    \"@types/react-dom\": \"^16.9.0\",\n    \"babel-loader\": \"^8.0.6\",\n    \"fork-ts-checker-webpack-plugin\": \"^1.5.0\",\n    \"html-webpack-plugin\": \"^3.2.0\",\n    \"typescript\": \"^3.6.3\",\n    \"webpack\": \"^4.40.2\",\n    \"webpack-cli\": \"^3.3.8\",\n    \"webpack-dev-server\": \"^3.8.1\"\n  },\n  \"dependencies\": {\n    \"@hot-loader/react-dom\": \"^16.10.2\",\n    \"core-js\": \"^3.2.1\",\n    \"react\": \"^16.9.0\",\n    \"react-dom\": \"^16.9.0\",\n    \"react-hot-loader\": \"^4.12.13\",\n    \"regenerator-runtime\": \"^0.13.3\"\n  }\n}\n"
  },
  {
    "path": "examples/typescript/src/App.tsx",
    "content": "import { hot } from 'react-hot-loader/root'\nimport * as React from 'react'\nimport Counter from './Counter'\n\nconst App = () => (\n  <div>\n    <h1>Hello, world.</ h1>\n    <Counter/>\n  </div>\n)\n\nexport default hot(App)\n"
  },
  {
    "path": "examples/typescript/src/Counter.tsx",
    "content": "import * as React from 'react'\n\nclass Counter extends React.Component<{}, { count: number }> {\n  interval: number\n\n  constructor(props : any) {\n    super(props)\n    this.state = { count: 0 }\n  }\n\n  componentDidMount() {\n    this.interval = window.setInterval(\n      () => this.setState(prevState => ({ count: prevState.count + 1 })),\n      200,\n    )\n  }\n\n  generateString1() {\n    return \"1\"\n  }\n\n  generateString2 = ()  => {\n    return \"1\"\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval)\n  }\n\n  render() {\n    return <span>{this.state.count} - {this.generateString1()} - {this.generateString2()}</span>\n  }\n}\n\nexport default Counter\n"
  },
  {
    "path": "examples/typescript/src/index.tsx",
    "content": "import 'core-js/stable'\nimport 'regenerator-runtime/runtime'\nimport * as React from 'react'\nimport { render } from 'react-dom'\nimport App from './App'\n\nconst root = document.createElement('div')\ndocument.body.appendChild(root)\n\nrender(<App />, root)\n"
  },
  {
    "path": "examples/typescript/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"outDir\": \"./dist/\",\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"module\": \"commonjs\",\n    \"target\": \"es6\",\n    \"jsx\": \"react\"\n  },\n  \"include\": [\"./src/**/*\"]\n}\n"
  },
  {
    "path": "examples/typescript/webpack.config.babel.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\nconst ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');\n\nmodule.exports = {\n  mode: 'development',\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  resolve: {\n    modules: ['node_modules'],\n    alias: {\n      'react-dom': '@hot-loader/react-dom',\n    },\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.(j|t)s(x)?$/,\n        exclude: /node_modules/,\n        use: {\n          loader: 'babel-loader',\n          options: {\n            cacheDirectory: true,\n            babelrc: false,\n            presets: [\n              [\n                '@babel/preset-env',\n                { targets: { browsers: 'last 2 versions' } }, // or whatever your project requires\n              ],\n              '@babel/preset-typescript',\n              '@babel/preset-react',\n            ],\n            plugins: [\n              // plugin-proposal-decorators is only needed if you're using experimental decorators in TypeScript\n              ['@babel/plugin-proposal-decorators', { legacy: true }],\n              ['@babel/plugin-proposal-class-properties', { loose: true }],\n              'react-hot-loader/babel',\n            ],\n          },\n        },\n      },\n    ],\n  },\n  devtool: 'eval-source-map',\n  plugins: [new ForkTsCheckerWebpackPlugin(), new webpack.NamedModulesPlugin(), new HtmlWebpackPlugin()],\n};\n"
  },
  {
    "path": "examples/typescript-no-babel/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/typescript-no-babel/README.md",
    "content": "# Attention!!!\n- Hook reloading is relaying on babel plugin! This example don't support hooks reload. If you want to have hook reloading, use typescript with babel.\n"
  },
  {
    "path": "examples/typescript-no-babel/package.json",
    "content": "{\n  \"name\": \"hot-typescript-pure\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"awesome-typescript-loader\": \"^5.2.1\",\n    \"html-webpack-plugin\": \"^3.2.0\",\n    \"typescript\": \"^3.6.3\",\n    \"webpack\": \"^4.40.2\",\n    \"webpack-cli\": \"^3.3.8\",\n    \"webpack-dev-server\": \"^3.8.1\"\n  },\n  \"dependencies\": {\n    \"@types/react\": \"^16.9.2\",\n    \"@types/react-dom\": \"^16.9.0\",\n    \"react\": \"^16.9.0\",\n    \"react-dom\": \"^16.9.0\",\n    \"react-hot-loader\": \"^4.12.13\"\n  }\n}\n"
  },
  {
    "path": "examples/typescript-no-babel/src/App.tsx",
    "content": "import { hot } from 'react-hot-loader/root'\nimport * as React from 'react'\nimport Counter from './Counter'\n\nconst App = () => (\n  <h1>\n    Hello, world!\n    <br />\n    You can update this text, and it will work\n    <Counter />\n  </h1>\n)\n\nexport default hot(App)\n"
  },
  {
    "path": "examples/typescript-no-babel/src/Counter.tsx",
    "content": "import * as React from 'react'\n\nclass Counter extends React.Component<{}, { count: number }> {\n  interval: number\n\n  constructor(props: any) {\n    super(props)\n    this.state = { count: 0 }\n  }\n\n  componentDidMount() {\n    this.interval = window.setInterval(\n      () => this.setState(prevState => ({ count: prevState.count + 1 })),\n      200,\n    )\n  }\n\n  generateString1() {\n    // you can update this method, and it will work\n    return \"1\"\n  }\n\n  generateString2 = ()  => {\n    // this one will not\n    return \"1\"\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval)\n  }\n\n  render() {\n    return <span>{this.state.count} - {this.generateString1()} - {this.generateString2()}</span>\n  }\n}\n\nexport default Counter\n"
  },
  {
    "path": "examples/typescript-no-babel/src/index.tsx",
    "content": "import * as React from 'react'\nimport { render } from 'react-dom'\nimport App from './App'\n\nconst root = document.createElement('div')\n\ndocument.body.appendChild(root)\n\nrender(<App />, root)\n"
  },
  {
    "path": "examples/typescript-no-babel/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"outDir\": \"./dist/\",\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"module\": \"commonjs\",\n    \"target\": \"es6\",\n    \"jsx\": \"react\"\n  },\n  \"include\": [\"./src/**/*\"]\n}\n"
  },
  {
    "path": "examples/typescript-no-babel/webpack.config.js",
    "content": "const path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  resolve: {\n    modules: ['node_modules'],\n    alias: {\n      'react-dom': '@hot-loader/react-dom',\n    },\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.ts(x)?$/,\n        use: ['awesome-typescript-loader'],\n      },\n    ],\n  },\n  devtool: 'eval-source-map',\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/webpack/.babelrc",
    "content": "{\n  \"presets\": [\"env\", \"react\"],\n  \"plugins\": [\"react-hot-loader/babel\", \"transform-class-properties\"]\n}\n"
  },
  {
    "path": "examples/webpack/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/webpack/package.json",
    "content": "{\n  \"name\": \"hot-webpack\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"babel-core\": \"^6.26.0\",\n    \"babel-loader\": \"^7.1.2\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-preset-env\": \"^1.6.1\",\n    \"babel-preset-react\": \"^6.24.1\",\n    \"html-webpack-plugin\": \"^2.30.1\",\n    \"webpack\": \"^3.10.0\",\n    \"webpack-dev-server\": \"^3.1.11\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"next\"\n  }\n}\n"
  },
  {
    "path": "examples/webpack/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\n\nconst App = () => (\n  <h1>\n    Hello, world.<br />\n    <Counter />\n  </h1>\n);\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/webpack/src/Counter.js",
    "content": "import React from 'react';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return this.state.count;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/webpack/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/webpack/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "examples/webpack-modern/.babelrc",
    "content": "{\n  \"presets\": [\n    [\n      \"@babel/preset-env\",\n      {\n        \"loose\": true,\n        \"modules\": false,\n        \"targets\": {\n          \"browsers\": \"last 2 chrome versions\"\n        }\n      }\n    ],\n    \"@babel/preset-react\"\n  ],\n  \"plugins\": [\n    \"react-hot-loader/babel\",\n    [\"@babel/plugin-proposal-class-properties\", { \"loose\": true }]\n  ]\n}\n"
  },
  {
    "path": "examples/webpack-modern/.gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "examples/webpack-modern/package.json",
    "content": "{\n  \"name\": \"hot-webpack-modern\",\n  \"version\": \"1.0.0\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"start\": \"webpack-dev-server --hot\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.4.4\",\n    \"@babel/plugin-proposal-class-properties\": \"^7.4.4\",\n    \"@babel/preset-env\": \"^7.4.4\",\n    \"@babel/preset-react\": \"^7.0.0\",\n    \"@hot-loader/react-dom\": \"^16.8.6\",\n    \"babel-loader\": \"^8.0.5\",\n    \"html-webpack-plugin\": \"^3.2.0\",\n    \"webpack\": \"^4.31.0\",\n    \"webpack-cli\": \"^3.3.2\",\n    \"webpack-dev-server\": \"^3.3.1\"\n  },\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-hot-loader\": \"^4.3.3\"\n  }\n}\n"
  },
  {
    "path": "examples/webpack-modern/src/App.js",
    "content": "import React from 'react';\nimport { hot } from 'react-hot-loader';\nimport Counter from './Counter';\n\nconst App = () => (\n  <h1>\n    Hello, world.<br />\n    <Counter />\n  </h1>\n);\n\nexport default hot(module)(App);\n"
  },
  {
    "path": "examples/webpack-modern/src/Counter.js",
    "content": "import React from 'react';\n\nclass Counter extends React.Component {\n  state = { count: 0 };\n\n  componentDidMount() {\n    this.interval = setInterval(() => this.setState(prevState => ({ count: prevState.count + 1 })), 200);\n  }\n\n  componentWillUnmount() {\n    clearInterval(this.interval);\n  }\n\n  render() {\n    return this.state.count;\n  }\n}\n\nexport default Counter;\n"
  },
  {
    "path": "examples/webpack-modern/src/index.js",
    "content": "import React from 'react';\nimport { render } from 'react-dom';\nimport App from './App';\n\nconst root = document.createElement('div');\ndocument.body.appendChild(root);\n\nrender(<App />, root);\n"
  },
  {
    "path": "examples/webpack-modern/webpack.config.babel.js",
    "content": "/* eslint-disable */\nconst path = require('path');\nconst webpack = require('webpack');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  mode: 'development',\n  entry: ['./src/index'],\n  output: {\n    path: path.join(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  resolve: {\n    alias: {\n      'react-dom': '@hot-loader/react-dom',\n    },\n  },\n  module: {\n    rules: [\n      {\n        exclude: /node_modules|packages/,\n        test: /\\.js$/,\n        use: 'babel-loader',\n      },\n    ],\n  },\n  plugins: [new HtmlWebpackPlugin(), new webpack.NamedModulesPlugin()],\n};\n"
  },
  {
    "path": "index.d.ts",
    "content": "import * as React from 'react';\n\ninterface ErrorReporterProps {\n  error: any;\n}\n\nexport interface AppContainerProps {\n  errorBoundary?: boolean;\n  errorReporter?: React.ComponentType<ErrorReporterProps>;\n}\n\nexport interface AppChildren {\n  children?: React.ReactElement<any>;\n}\n\nexport class AppContainer extends React.Component<AppContainerProps & AppChildren> {}\n\n/**\n * Marks module and a returns a HOC to mark a Component inside it as hot-exported\n * @param {NodeModuleObject} module ALWAYS should be just \"module\".\n * @return {function} \"hot\" HOC.\n *\n * @example marks current module as hot, and export MyComponent as HotExportedMyComponent\n * export default hot(module)(MyComponent)\n */\nexport function hot(module: any): <T = React.ComponentType<any>>(Component: T, props?: AppContainerProps) => T;\n\n/**\n * Marks component as `cold`, and making it invisible for React-Hot-Loader.\n * Any changes to that component will cause local state loss.\n * @param {React.ComponentType} component to chill\n * @return {React.ComponentType} component, as it was passed in.\n *\n * @example marks some component as cold\n * export default cold(MyComponent)\n */\nexport function cold<T = React.ComponentType<any>>(component: T): T;\n\n/**\n * Tests are types of two components equal\n * @param {Component} typeA\n * @param {Component} typeB\n * @return {boolean} are they equal\n *\n * @example test that some rendered component(ReactElement), has the same type as BaseComponent\n * areComponentEqual(RenderedComponent.type, BaseComponent)\n */\nexport function areComponentsEqual<T>(typeA: React.ComponentType<T>, typeB: React.ComponentType<T>): boolean;\n\nexport interface HotError {\n  error: Error;\n  errorInfo?: React.ErrorInfo;\n}\n\nexport interface Config {\n  /**\n   * Specify loglLevel, default to 'error', set it to false to disable logs.\n   * Available levels: ['debug', 'log', 'warn', 'error']\n   */\n  logLevel: string;\n\n  /**\n   *\n   * @param {any} type being registered. This could be ANY top level variable among project.\n   * @param {string} uniqueLocalName - variable name\n   * @param {string} fileName - origin file\n   * @return {any}\n   */\n  onComponentRegister: (type: any, uniqueLocalName: string, fileName: string) => any;\n\n  /**\n   *\n   * @param type {any} type being rendered. The first argument of React.createElement\n   * @param displayName {string} type display name (if exists)\n   */\n  onComponentCreate: (type: any, displayName: string) => any;\n\n  /**\n   *  Allows using SFC without changes. leading to some components not updated\n   */\n  pureSFC: boolean;\n\n  /**\n   * keep render method unpatched, moving sideEffect to componentDidUpdate\n   */\n  pureRender: boolean;\n\n  /**\n   * Allows SFC to be used, enables \"intermediate\" components used by Relay, should be disabled for Preact\n   */\n  allowSFC: boolean;\n\n  /**\n   * Disable \"hot-replacement-render\"\n   */\n  disableHotRenderer: boolean;\n\n  /**\n   * Disable \"hot-replacement-render\" when injection into react-dom are made\n   */\n  disableHotRendererWhenInjected: boolean;\n\n  /**\n   * Show \"hot-loader/react-dom\" warning\n   */\n  showReactDomPatchNotification: boolean;\n\n  /**\n   * flag to completely disable RHL for SFC\n   */\n  ignoreSFC: boolean;\n\n  /**\n   * flag to completely disable RHL for Components\n   */\n  ignoreComponents: boolean;\n\n  /**\n   * enables or disables hooks treatment\n   */\n  reloadHooks: boolean;\n\n  /**\n   * default value for AppContainer errorOverlay\n   */\n  errorReporter: React.ComponentType<HotError>;\n\n  /**\n   * Global error overlay\n   */\n  ErrorOverlay: React.ComponentType<{ errors: Array<HotError> }>;\n\n  /**\n   * Controls tail(deferred) update checking\n   */\n  trackTailUpdates: boolean;\n}\n\n/**\n * Confugures how React Hot Loader works\n * @param {Config} config\n */\nexport function setConfig(config: Partial<Config>): void;\n"
  },
  {
    "path": "index.js",
    "content": "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./dist/react-hot-loader.production.min.js');\n} else if (process.env.NODE_ENV === 'test') {\n  module.exports = require('./dist/react-hot-loader.production.min.js');\n} else if (typeof window === 'undefined') {\n  // this is just server environment\n  module.exports = require('./dist/react-hot-loader.production.min.js');\n} else if (!module.hot) {\n  module.exports = require('./dist/react-hot-loader.production.min.js');\n  module.exports.AppContainer.warnAboutHMRDisabled = true;\n  module.exports.hot.shouldWrapWithAppContainer = true;\n} else {\n  var evalAllowed = false;\n  var evalError = null;\n  try {\n    eval('evalAllowed = true');\n  } catch (e) {\n    // eval not allowed due to CSP\n    evalError = e && e.message ? e.message : 'unknown reason';\n  }\n\n  // TODO: dont use eval to update methods. see #1273\n  // RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods\n  var jsFeaturesPresent = !!Object.setPrototypeOf;\n\n  if (!jsFeaturesPresent || !evalAllowed) {\n    // we are not in prod mode, but RHL could not be activated\n    console.warn(\n      'React-Hot-Loader is not supported in this environment:',\n      [\n        !jsFeaturesPresent && \"some JS features are missing\",\n        !evalAllowed && \"`eval` is not allowed(\" + evalError + \")\"\n      ].join(','),\n      '.'\n    );\n    module.exports = require('./dist/react-hot-loader.production.min.js');\n  } else {\n    module.exports = window.reactHotLoaderGlobal = require('./dist/react-hot-loader.development.js');\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"react-hot-loader\",\n  \"version\": \"4.13.1\",\n  \"description\": \"Tweak React components in real time.\",\n  \"main\": \"index.js\",\n  \"types\": \"index.d.ts\",\n  \"homepage\": \"https://github.com/gaearon/react-hot-loader\",\n  \"repository\": \"https://github.com/gaearon/react-hot-loader/\",\n  \"license\": \"MIT\",\n  \"author\": \"Dan Abramov\",\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"ci\": \"scripts/ci.sh\",\n    \"format\": \"prettier --write \\\"**/*.{js,md,ts,json}\\\" *.{js,md,ts,json}\",\n    \"lint\": \"eslint .\",\n    \"prepublishOnly\": \"yarn build\",\n    \"prebuild\": \"rm -rf dist\",\n    \"precommit\": \"lint-staged\",\n    \"release\": \"standard-version && conventional-github-releaser -p angular\",\n    \"test\": \"yarn test:es2015 && yarn test:modern\",\n    \"test:es2015\": \"cross-env BABEL_TARGET=es2015 jest --no-cache\",\n    \"test:modern\": \"cross-env BABEL_TARGET=modern jest --no-cache\",\n    \"test:react-dom:prepare\": \"rm -Rf ./test/hot/react-dom && node ./test/hot/createPatchedReact.js\",\n    \"yarn-deduplicate\": \"yarn-deduplicate yarn.lock -s fewer\"\n  },\n  \"lint-staged\": {\n    \"*.{js,md,ts,json}\": [\n      \"prettier --write\",\n      \"git add\"\n    ]\n  },\n  \"files\": [\n    \"dist\",\n    \"index.js\",\n    \"babel.js\",\n    \"webpack.js\",\n    \"patch.js\",\n    \"root.js\",\n    \"*.d.ts\"\n  ],\n  \"sideEffects\": false,\n  \"keywords\": [\n    \"react\",\n    \"javascript\",\n    \"webpack\",\n    \"hmr\",\n    \"livereload\",\n    \"live\",\n    \"edit\",\n    \"hot\",\n    \"loader\",\n    \"reload\"\n  ],\n  \"devDependencies\": {\n    \"@hot-loader/react-dom\": \"^16.8.6\",\n    \"@types/react\": \"16\",\n    \"@wojtekmaj/enzyme-adapter-react-17\": \"^0.1.1\",\n    \"babel-cli\": \"^6.7.5\",\n    \"babel-core\": \"^6.26.3\",\n    \"babel-eslint\": \"^8.2.3\",\n    \"babel-jest\": \"^22.4.3\",\n    \"babel-plugin-dynamic-import-node\": \"^1.2.0\",\n    \"babel-plugin-external-helpers\": \"^6.22.0\",\n    \"babel-plugin-transform-class-properties\": \"^6.24.1\",\n    \"babel-plugin-transform-object-rest-spread\": \"^6.26.0\",\n    \"babel-polyfill\": \"^6.26.0\",\n    \"babel-preset-env\": \"^1.6.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"codecov\": \"^3.0.1\",\n    \"conventional-github-releaser\": \"^3.1.3\",\n    \"create-react-class\": \"^15.6.3\",\n    \"cross-env\": \"^5.1.4\",\n    \"enzyme\": \"^3.7.0\",\n    \"enzyme-adapter-react-15\": \"^1.0.5\",\n    \"enzyme-adapter-react-16\": \"^1.6.0\",\n    \"eslint\": \"^4.19.1\",\n    \"eslint-config-airbnb\": \"^16.0.0\",\n    \"eslint-config-prettier\": \"^2.6.0\",\n    \"eslint-plugin-import\": \"^2.11.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.0.3\",\n    \"eslint-plugin-react\": \"^7.7.0\",\n    \"husky\": \"^0.14.3\",\n    \"jest\": \"^22.4.3\",\n    \"lint-staged\": \"9.4.1\",\n    \"prettier\": \"^1.12.1\",\n    \"react\": \"16\",\n    \"react-dom\": \"16\",\n    \"react-mount\": \"^0.1.3\",\n    \"react-test-renderer\": \"16\",\n    \"recompose\": \"^0.27.0\",\n    \"rimraf\": \"^2.5.2\",\n    \"rollup\": \"^0.58.2\",\n    \"rollup-plugin-babel\": \"^3.0.4\",\n    \"rollup-plugin-commonjs\": \"^9.1.3\",\n    \"rollup-plugin-json\": \"^2.3.0\",\n    \"rollup-plugin-node-resolve\": \"^3.3.0\",\n    \"rollup-plugin-replace\": \"^2.0.0\",\n    \"rollup-plugin-uglify\": \"^3.0.0\",\n    \"standard-version\": \"^7.0.0\",\n    \"yarn-deduplicate\": \"^1.1.1\"\n  },\n  \"peerDependencies\": {\n    \"@types/react\": \"^15.0.0 || ^16.0.0 || ^17.0.0\",\n    \"react\": \"^15.0.0 || ^16.0.0 || ^17.0.0\",\n    \"react-dom\": \"^15.0.0 || ^16.0.0 || ^17.0.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@types/react\": {\n      \"optional\": true\n    }\n  },\n  \"dependencies\": {\n    \"fast-levenshtein\": \"^2.0.6\",\n    \"global\": \"^4.3.0\",\n    \"hoist-non-react-statics\": \"^3.3.0\",\n    \"loader-utils\": \"^2.0.3\",\n    \"prop-types\": \"^15.6.1\",\n    \"react-lifecycles-compat\": \"^3.0.4\",\n    \"shallowequal\": \"^1.1.0\",\n    \"source-map\": \"^0.7.3\"\n  },\n  \"engines\": {\n    \"node\": \">= 6\"\n  },\n  \"jest\": {\n    \"moduleDirectories\": [\n      \"node_modules\",\n      \"<rootDir>\"\n    ],\n    \"setupFiles\": [\n      \"<rootDir>/testConfig/setupTests.js\"\n    ],\n    \"transform\": {\n      \"^.+\\\\.js$\": \"<rootDir>/testConfig/babel.js\"\n    }\n  },\n  \"collective\": {\n    \"type\": \"opencollective\",\n    \"url\": \"https://opencollective.com/react-hot-loader\"\n  }\n}\n"
  },
  {
    "path": "patch.js",
    "content": "'use strict';\n\nif (!module.hot || process.env.NODE_ENV === 'production') {\n  module.exports = require('./dist/react-hot-loader.production.min.js');\n} else {\n  module.exports = require('./dist/react-hot-loader.development.js');\n}\n"
  },
  {
    "path": "rollup.config.js",
    "content": "/* eslint-disable flowtype/require-valid-file-annotation, no-console, import/extensions */\nimport nodeResolve from 'rollup-plugin-node-resolve';\nimport replace from 'rollup-plugin-replace';\nimport commonjs from 'rollup-plugin-commonjs';\nimport babel from 'rollup-plugin-babel';\nimport json from 'rollup-plugin-json';\nimport uglify from 'rollup-plugin-uglify';\nimport pkg from './package.json';\n\nconst commonPlugins = [\n  json(),\n  nodeResolve(),\n  babel({ plugins: ['external-helpers'] }),\n  commonjs({ ignoreGlobal: true }),\n];\n\nconst getConfig = (input, dist, env) => ({\n  input,\n  external: ['react-dom', 'react', 'fs', 'path'].concat(Object.keys(pkg.dependencies)),\n  plugins: commonPlugins\n    .concat(\n      env\n        ? [\n            replace({\n              'process.env.NODE_ENV': JSON.stringify(env),\n            }),\n          ]\n        : [],\n    )\n    .concat(env === 'production' ? [uglify()] : []),\n  output: [\n    {\n      file: dist,\n      format: 'cjs',\n      exports: 'named',\n      globals: { react: 'React' },\n    },\n  ],\n});\n\nexport default [\n  getConfig('src/index.dev.js', 'dist/react-hot-loader.development.js', 'development'),\n  getConfig('src/index.prod.js', 'dist/react-hot-loader.production.min.js', 'production'),\n\n  getConfig('src/babel.dev.js', 'dist/babel.development.js', 'development'),\n  getConfig('src/babel.prod.js', 'dist/babel.production.min.js', 'production'),\n\n  getConfig('src/webpack/index.js', 'dist/webpack.development.js', 'development'),\n  getConfig('src/webpack/index.js', 'dist/webpack.production.min.js', 'production'),\n\n  {\n    input: 'src/webpack/webpackTagCommonJSExports.js',\n    plugins: [babel()],\n    output: {\n      file: 'dist/webpackTagCommonJSExports.js',\n      format: 'cjs',\n    },\n  },\n];\n"
  },
  {
    "path": "root.d.ts",
    "content": "import * as React from 'react';\nimport { AppContainerProps } from './index';\n\nexport function hot<T = React.ComponentType<any>>(Component: T, props?: AppContainerProps): T;\n"
  },
  {
    "path": "root.js",
    "content": "if (process.env.NODE_ENV !== 'production') {\n  var hot = require('./index').hot;\n  if (module.hot) {\n    var cache = require.cache;\n\n    if (!module.parents || module.parents.length === 0) {\n      throw new Error(\n        'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +\n        'Please use `import {hot} from \"react-hot-loader\"` instead'\n      );\n    }\n    // access parent\n    var parent = cache[module.parents[0]];\n    if (!parent) {\n      throw new Error(\n        'React-Hot-Loader: `react-hot-loader/root` is not supported on your system. ' +\n        'Please use `import {hot} from \"react-hot-loader\"` instead'\n      );\n    }\n\n    // remove self from a cache\n    delete cache[module.id];\n\n    // setup hot for caller\n    exports.hot = hot(parent);\n  } else {\n    fallbackHot();\n  }\n} else {\n  // prod mode\n  fallbackHot();\n}\n\nfunction fallbackHot() {\n  exports.hot = function (a) {\n    return a;\n  };\n}\n"
  },
  {
    "path": "scripts/ci.sh",
    "content": "set -e\n\necho \"Building project\"\nyarn build\necho \"\\n\\n\"\n\necho \"Linting\"\nyarn lint\necho \"\\n\\n\"\n\n./scripts/react-16.ci.sh\n./scripts/react-17.ci.sh"
  },
  {
    "path": "scripts/react-15.ci.sh",
    "content": "echo \"Installing React 15\"\nyarn add react@15 react-dom@15 react-test-renderer@15 --pure-lockfile\necho \"\\n\\n\"\n\nyarn test:react-dom:prepare\n\n echo \"Running tests on React 15 - Babel ES2015\"\n yarn test:es2015\n echo \"\\n\\n\"\n\n echo \"Running tests on React 15 - Babel Modern\"\n yarn test:modern\n echo \"\\n\\n\"\n echo \"\\n\\n\""
  },
  {
    "path": "scripts/react-16.ci.sh",
    "content": "echo \"Installing React 16.10\"\nyarn add react@16 react-dom@16.10 react-test-renderer@16.10 --pure-lockfile\necho \"\\n\\n\"\n\nyarn test:react-dom:prepare\n\necho \"Running tests on React 16.10 - Babel ES2015\"\nyarn test:es2015\necho \"\\n\\n\"\n\necho \"Running tests on React 16.10 - Babel Modern\"\nyarn test:modern --coverage && codecov\necho \"\\n\\n\"\n\n\n\necho \"Installing React 16:latest\"\nyarn add react@16 react-dom@16 react-test-renderer@16 --pure-lockfile\necho \"\\n\\n\"\n\nyarn test:react-dom:prepare\n\necho \"Running tests on React 16:latest - Babel ES2015\"\nyarn test:es2015\necho \"\\n\\n\"\n\necho \"Running tests on React 16:latest - Babel Modern\"\nyarn test:modern --coverage && codecov\necho \"\\n\\n\""
  },
  {
    "path": "scripts/react-17.ci.sh",
    "content": "echo \"Installing React 17\"\nyarn add react@17.0.0-rc.2 react-dom@17.0.0-rc.2 react-test-renderer@17.0.0-rc.2 --pure-lockfile\necho \"\\n\\n\"\n\nyarn test:react-dom:prepare\n\necho \"Running tests on React 17 - Babel ES2015\"\nyarn test:es2015\necho \"\\n\\n\"\n\necho \"Running tests on React 17 - Babel Modern\"\nyarn test:modern --coverage && codecov\necho \"\\n\\n\"\n"
  },
  {
    "path": "src/AppContainer.dev.js",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport defaultPolyfill, { polyfill } from 'react-lifecycles-compat';\nimport logger from './logger';\nimport { get as getGeneration, hotComparisonOpen } from './global/generation';\nimport configuration from './configuration';\nimport { EmptyErrorPlaceholder, logException } from './errorReporter';\nimport { retryHotLoaderError } from './reconciler/proxyAdapter';\n\nclass AppContainer extends React.Component {\n  static getDerivedStateFromProps(nextProps, prevState) {\n    if (prevState.generation !== getGeneration()) {\n      // Hot reload is happening.\n      return {\n        error: null,\n        generation: getGeneration(),\n      };\n    }\n    return null;\n  }\n\n  static reactHotLoadable = false;\n\n  constructor(props) {\n    super(props);\n    if (configuration.showReactDomPatchNotification) {\n      configuration.showReactDomPatchNotification = false;\n      console.warn('React-Hot-Loader: react-🔥-dom patch is not detected. React 16.6+ features may not work.');\n    }\n\n    this.state = {\n      error: null,\n      errorInfo: null,\n      // eslint-disable-next-line react/no-unused-state\n      generation: 0,\n    };\n  }\n\n  shouldComponentUpdate(prevProps, prevState) {\n    // Don't update the component if the state had an error and still has one.\n    // This allows to break an infinite loop of error -> render -> error -> render\n    // https://github.com/gaearon/react-hot-loader/issues/696\n    if (prevState.error && this.state.error) {\n      return false;\n    }\n\n    return true;\n  }\n\n  componentDidCatch(error, errorInfo) {\n    logger.error(error);\n\n    if (!hotComparisonOpen()) {\n      // do not log error outside of HMR cycle\n\n      // trigger update to kick error\n      this.setState({});\n      throw error;\n    }\n    const { errorReporter = configuration.errorReporter } = this.props;\n    if (!errorReporter) {\n      logException(error, errorInfo, this);\n    }\n    this.setState({\n      error,\n      errorInfo,\n    });\n  }\n\n  retryHotLoaderError() {\n    this.setState({ error: null }, () => {\n      retryHotLoaderError.call(this);\n    });\n  }\n\n  render() {\n    const { error, errorInfo } = this.state;\n\n    const { errorReporter: ErrorReporter = configuration.errorReporter || EmptyErrorPlaceholder } = this.props;\n\n    if (error && this.props.errorBoundary) {\n      return <ErrorReporter error={error} errorInfo={errorInfo} component={this} />;\n    }\n\n    if (this.hotComponentUpdate) {\n      this.hotComponentUpdate();\n    } else {\n      throw new Error('React-Hot-Loader: AppContainer should be patched');\n    }\n\n    return React.Children.only(this.props.children);\n  }\n}\n\nAppContainer.propTypes = {\n  children(props) {\n    if (React.Children.count(props.children) !== 1) {\n      return new Error(\n        'Invalid prop \"children\" supplied to AppContainer. ' +\n          'Expected a single React element with your app’s root component, e.g. <App />.',\n      );\n    }\n\n    return undefined;\n  },\n  errorReporter: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n  errorBoundary: PropTypes.bool,\n};\n\nAppContainer.defaultProps = {\n  errorBoundary: true,\n};\n\n//  trying first react-lifecycles-compat.polyfill, then trying react-lifecycles-compat, which could be .default\nconst realPolyfill = polyfill || defaultPolyfill;\nrealPolyfill(AppContainer);\n\nexport default AppContainer;\n"
  },
  {
    "path": "src/AppContainer.prod.js",
    "content": "/* eslint-disable react/prop-types */\n\nimport React from 'react';\n\nfunction AppContainer(props) {\n  if (AppContainer.warnAboutHMRDisabled) {\n    AppContainer.warnAboutHMRDisabled = true;\n    console.error(\n      'React-Hot-Loader: misconfiguration detected, using production version in non-production environment.',\n    );\n    console.error('React-Hot-Loader: Hot Module Replacement is not enabled.');\n  }\n  return React.Children.only(props.children);\n}\n\nAppContainer.warnAboutHMRDisabled = false;\n\nexport default AppContainer;\n"
  },
  {
    "path": "src/adapters/preact.js",
    "content": "import { setConfiguration } from '../configuration';\n\nconst tune = {\n  allowSFC: false,\n};\n\nexport const preactAdapter = (instance, resolveType) => {\n  const oldHandler = instance.options.vnode;\n\n  setConfiguration(tune);\n\n  instance.options.vnode = vnode => {\n    if (vnode.type) {\n      vnode.type = resolveType(vnode.type);\n    } else if (vnode.nodeName) {\n      vnode.nodeName = resolveType(vnode.nodeName);\n    }\n    if (oldHandler) {\n      oldHandler(vnode);\n    }\n  };\n};\n"
  },
  {
    "path": "src/babel.dev.js",
    "content": "import { REGENERATE_METHOD } from './internal/constants';\nimport fresh from './fresh/babel';\n\nconst templateOptions = {\n  placeholderPattern: /^([A-Z0-9]+)([A-Z0-9_]+)$/,\n};\n\n/* eslint-disable */\nconst shouldIgnoreFile = file =>\n  !!file\n    .split('\\\\')\n    .join('/')\n    .match(/node_modules\\/(react|react-dom|react-hot-loader)([\\/]|$)/);\n\n/* eslint-enable */\n\nfunction plugin(args, options = {}) {\n  // This is a Babel plugin, but the user put it in the Webpack config.\n  if (this && this.callback) {\n    throw new Error(\n      'React Hot Loader: You are erroneously trying to use a Babel plugin ' +\n        'as a Webpack loader. We recommend that you use Babel, ' +\n        'remove \"react-hot-loader/babel\" from the \"loaders\" section ' +\n        'of your Webpack configuration, and instead add ' +\n        '\"react-hot-loader/babel\" to the \"plugins\" section of your .babelrc file. ' +\n        'If you prefer not to use Babel, replace \"react-hot-loader/babel\" with ' +\n        '\"react-hot-loader/webpack\" in the \"loaders\" section of your Webpack configuration. ',\n    );\n  }\n  const { types: t, template } = args;\n\n  const { safetyNet = true } = options;\n\n  const buildRegistration = template('reactHotLoader.register(ID, NAME, FILENAME);', templateOptions);\n\n  const signatureHeader = template(\n    `var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {return a;}`,\n    templateOptions,\n  );\n\n  const headerTemplate = template(\n    `(function () {\n       var enterModule = (typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined);\n       enterModule && enterModule(module);\n     }())`,\n    templateOptions,\n  );\n  const footerTemplate = template(\n    `(function () {\n       var leaveModule = (typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined);\n       leaveModule && leaveModule(module);\n     }())`,\n    templateOptions,\n  );\n  const evalTemplate = template('this[key]=eval(code);', templateOptions);\n\n  // We're making the IIFE we insert at the end of the file an unused variable\n  // because it otherwise breaks the output of the babel-node REPL (#359).\n\n  const buildTagger = template(\n    `    \n(function () {  \n  \n  var reactHotLoader = (typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined);\n  \n  if (!reactHotLoader) {\n    return;\n  }\n\n  REGISTRATIONS  \n}());\n  `,\n    templateOptions,\n  );\n\n  // Gather top-level variables, functions, and classes.\n  // Try our best to avoid variables from require().\n  // Ideally we only want to find components defined by the user.\n  function shouldRegisterBinding(binding) {\n    const { type, node, parent } = binding.path;\n    switch (type) {\n      case 'FunctionDeclaration':\n      case 'ClassDeclaration':\n      case 'VariableDeclaration':\n        return true;\n      case 'VariableDeclarator': {\n        const { init } = node;\n        if (t.isCallExpression(init) && init.callee.name === 'require') {\n          return false;\n        }\n        if (parent.declare) {\n          return false;\n        }\n        return true;\n      }\n      default:\n        return false;\n    }\n  }\n\n  const REGISTRATIONS = Symbol('registrations');\n  return {\n    visitor: {\n      ExportDefaultDeclaration(path, state) {\n        const { file } = state;\n        // Default exports with names are going\n        // to be in scope anyway so no need to bother.\n        if (path.node.declaration.id) {\n          return;\n        }\n\n        // Move export default right hand side to a variable\n        // so we can later refer to it and tag it with __source.\n        const id = path.scope.generateUidIdentifier('default');\n        const expression = t.isExpression(path.node.declaration)\n          ? path.node.declaration\n          : t.toExpression(path.node.declaration);\n        path.scope.registerDeclaration(\n          path.insertBefore(t.variableDeclaration('const', [t.variableDeclarator(id, expression)]))[0],\n        );\n        path.node.declaration = id; // eslint-disable-line no-param-reassign\n\n        // It won't appear in scope.bindings\n        // so we'll manually remember it exists.\n        state[REGISTRATIONS].push(\n          buildRegistration({\n            ID: id,\n            NAME: t.stringLiteral('default'),\n            FILENAME: t.stringLiteral(file.opts.filename),\n          }),\n        );\n      },\n\n      Program: {\n        enter({ scope, node }, state) {\n          const { file } = state;\n          state[REGISTRATIONS] = []; // eslint-disable-line no-param-reassign\n\n          node.body.unshift(signatureHeader());\n\n          // Everything in the top level scope, when reasonable,\n          // is going to get tagged with __source.\n          /* eslint-disable guard-for-in,no-restricted-syntax */\n          for (const id in scope.bindings) {\n            const binding = scope.bindings[id];\n            if (shouldRegisterBinding(binding)) {\n              state[REGISTRATIONS].push(\n                buildRegistration({\n                  ID: binding.identifier,\n                  NAME: t.stringLiteral(id),\n                  FILENAME: t.stringLiteral(file.opts.filename),\n                }),\n              );\n            }\n          }\n          /* eslint-enable */\n        },\n\n        exit({ node }, state) {\n          const { file } = state;\n          const registrations = state[REGISTRATIONS];\n          state[REGISTRATIONS] = [];\n\n          // inject the code only if applicable\n          if (registrations && registrations.length && !shouldIgnoreFile(file.opts.filename)) {\n            if (safetyNet) {\n              node.body.unshift(headerTemplate());\n            }\n            // Inject the generated tagging code at the very end\n            // so that it is as minimally intrusive as possible.\n            node.body.push(t.emptyStatement());\n            node.body.push(buildTagger({ REGISTRATIONS: registrations }));\n            node.body.push(t.emptyStatement());\n\n            if (safetyNet) {\n              node.body.push(footerTemplate());\n            }\n          }\n        },\n      },\n      Class(classPath) {\n        const classBody = classPath.get('body');\n        let hasRegenerateMethod = false;\n        let hasMethods = false;\n\n        classBody.get('body').forEach(path => {\n          const { node } = path;\n\n          // don't apply transform to static class properties\n          if (node.static) {\n            return;\n          }\n\n          if (node.key.name !== REGENERATE_METHOD) {\n            hasMethods = true;\n          } else {\n            hasRegenerateMethod = true;\n          }\n        });\n\n        if (hasMethods && !hasRegenerateMethod) {\n          const regenerateMethod = t.classMethod(\n            'method',\n            t.identifier(REGENERATE_METHOD),\n            [t.identifier('key'), t.identifier('code')],\n            t.blockStatement([evalTemplate()]),\n          );\n\n          classBody.pushContainer('body', regenerateMethod);\n\n          classBody.get('body').forEach(path => {\n            const { node } = path;\n\n            if (node.key.name === REGENERATE_METHOD) {\n              path.addComment('leading', ' @ts-ignore', true);\n              path\n                .get('body')\n                .get('body')[0]\n                .addComment('leading', ' @ts-ignore', true);\n            }\n          });\n        }\n      },\n    },\n  };\n}\n\nconst mergeRecord = (sourceRecord, newRecord) => {\n  Object.keys(newRecord).forEach(key => {\n    const action = newRecord[key];\n    if (typeof action === 'function') {\n      if (!sourceRecord[key]) {\n        sourceRecord[key] = () => ({});\n      }\n      const prev = sourceRecord[key];\n      sourceRecord[key] = (...args) => {\n        prev(...args);\n        action(...args);\n      };\n    } else if (typeof action === 'object') {\n      if (!sourceRecord[key]) {\n        sourceRecord[key] = {};\n      }\n      mergeRecord(sourceRecord[key], action);\n    }\n  });\n};\n\nconst composePlugins = plugins => (...args) => {\n  const result = {};\n  plugins.forEach(creator => {\n    const plugin = creator(...args);\n    mergeRecord(result, plugin);\n  });\n  return result;\n};\n\nmodule.exports = composePlugins([\n  plugin,\n  (...args) => {\n    const p = fresh(...args);\n    // removing everything we dont want right now\n\n    // registration\n    // delete p.visitor.Program;\n    // delete p.visitor.Program.exit;\n\n    // registrations\n    // delete p.visitor.FunctionDeclaration.enter;\n    // delete p.visitor.FunctionDeclaration.leave;\n    // delete p.visitor.VariableDeclaration;\n\n    return p;\n  },\n]);\n\nmodule.exports.shouldIgnoreFile = shouldIgnoreFile;\n"
  },
  {
    "path": "src/babel.prod.js",
    "content": "const RHLPackage = 'react-hot-loader';\nconst RHLRootPackage = 'react-hot-loader/root';\nconst RHLPackages = [RHLPackage, RHLRootPackage];\n\nfunction isImportedFromPackages(path, name, packages) {\n  const binding = path.scope.getBinding(name);\n  const bindingType = binding && binding.path.node.type;\n\n  if (bindingType === 'ImportSpecifier' || bindingType === 'ImportNamespaceSpecifier') {\n    const bindingParent = binding.path.parent;\n    return packages.includes(bindingParent.source.value);\n  }\n\n  return false;\n}\n\nfunction isImportedFromRHL(path, name) {\n  return isImportedFromPackages(path, name, [RHLPackage]);\n}\n\nfunction isImportedFromRHLRoot(path, name) {\n  return isImportedFromPackages(path, name, [RHLRootPackage]);\n}\n\nfunction getRHLContext(file) {\n  const context = [];\n  const { body } = file.ast.program;\n\n  for (let i = 0; i < body.length; i++) {\n    const bodyItem = body[i];\n    const { source, specifiers } = bodyItem;\n\n    if (bodyItem.type !== 'ImportDeclaration' || !RHLPackages.includes(source.value)) {\n      continue;\n    }\n\n    for (let j = 0; j < specifiers.length; j++) {\n      const specifier = specifiers[j];\n\n      if (specifier.type === 'ImportNamespaceSpecifier') {\n        context.push({\n          kind: 'namespace',\n          local: specifier.local.name,\n        });\n      } else if (specifier.type === 'ImportSpecifier') {\n        const specifierData = {\n          kind: 'named',\n          local: specifier.local.name,\n        };\n\n        if (specifier.imported.name === 'hot') {\n          context.push(specifierData);\n        }\n      }\n    }\n  }\n\n  return context.length ? context : null;\n}\n\nexport default function plugin() {\n  function handleCall(path) {\n    if (this.cancel) {\n      return;\n    }\n\n    for (let i = 0; i < this.rhlContext.length; i++) {\n      const specifier = this.rhlContext[i];\n\n      if (specifier.kind === 'named') {\n        // replaces hot(module)(App)\n        if (\n          path.node.callee.name === specifier.local &&\n          // ensure that this is `hot` from RHL\n          isImportedFromRHL(path, specifier.local) &&\n          path.parent.type === 'CallExpression' &&\n          path.parent.arguments.length === 1 &&\n          path.parent.arguments[0] &&\n          path.parent.arguments[0].type === 'Identifier'\n        ) {\n          path.parentPath.replaceWith(path.parent.arguments[0]);\n          break;\n        }\n\n        // replaces hot(App)\n        if (\n          path.node.callee.name === specifier.local &&\n          // ensure that this is `hot` from RHL\n          isImportedFromRHLRoot(path, specifier.local) &&\n          path.type === 'CallExpression' &&\n          path.node.arguments[0] &&\n          path.node.arguments[0].type === 'Identifier'\n        ) {\n          path.replaceWith(path.node.arguments[0]);\n          break;\n        }\n      } else if (specifier.kind === 'namespace') {\n        // replaces RHL.hot(module)(App)\n        if (\n          path.node.callee.callee &&\n          path.node.callee.callee.type === 'MemberExpression' &&\n          path.node.callee.callee.object.type === 'Identifier' &&\n          path.node.callee.callee.object.name === specifier.local &&\n          // ensure that this is from RHL\n          isImportedFromRHL(path, specifier.local) &&\n          path.node.callee.callee.property.type === 'Identifier' &&\n          path.node.callee.callee.property.name === 'hot' &&\n          path.node.arguments[0] &&\n          path.node.arguments[0].type === 'Identifier'\n        ) {\n          path.replaceWith(path.node.arguments[0]);\n          break;\n        }\n      }\n    }\n  }\n\n  return {\n    pre() {\n      // ignore files that do not use RHL\n      this.rhlContext = getRHLContext(this.file);\n\n      if (!this.rhlContext) {\n        this.cancel = true;\n      }\n    },\n    visitor: {\n      CallExpression: handleCall,\n    },\n  };\n}\n"
  },
  {
    "path": "src/configuration.js",
    "content": "const configuration = {\n  // Log level\n  logLevel: 'error',\n\n  // Allows using SFC without changes\n  pureSFC: true,\n\n  // keep render method unpatched, moving sideEffect to componentDidUpdate\n  pureRender: true,\n\n  // Allows SFC to be used, enables \"intermediate\" components used by Relay, should be disabled for Preact\n  allowSFC: true,\n\n  // Allow reload of effect hooks with non zero dependency list\n  reloadHooks: true,\n\n  // Allow reload of mount effect hooks - zero deps\n  reloadLifeCycleHooks: false,\n\n  // Enables hook reload on hook body change\n  reloadHooksOnBodyChange: true,\n\n  // Disable \"hot-replacement-render\"\n  disableHotRenderer: false,\n\n  // @private\n  integratedComparator: false,\n  // @private\n  integratedResolver: false,\n\n  // Disable \"hot-replacement-render\" when injection into react-dom is made\n  disableHotRendererWhenInjected: true,\n\n  // Controls `react-🔥-dom patch` notification\n  showReactDomPatchNotification: true,\n\n  // Hook on babel component register.\n  onComponentRegister: false,\n\n  // Hook on React renders for a first time component\n  onComponentCreate: false,\n\n  // flag to completely disable RHL for SFC. Probably don't use it without dom patch made.\n  ignoreSFC: false,\n\n  // ignoreSFC when injection into react-dom is made\n  ignoreSFCWhenInjected: true,\n\n  // flag to completely disable RHL for Components\n  ignoreComponents: false,\n\n  // default value for AppContainer errorOverlay\n  errorReporter: undefined,\n\n  // Global error overlay\n  ErrorOverlay: undefined,\n\n  // Actively track lazy loaded components\n  trackTailUpdates: true,\n\n  // wrap lazy with AppProvider to allow independent updates\n  wrapLazy: true,\n\n  // react hot dom features enabled\n  IS_REACT_MERGE_ENABLED: false,\n};\n\nexport const internalConfiguration = {\n  // control proxy creation\n  disableProxyCreation: false,\n};\n\nexport const setConfiguration = config => {\n  // not using Object.assing for IE11 compliance\n  for (const i in config) {\n    if (config.hasOwnProperty(i)) {\n      configuration[i] = config[i];\n    }\n  }\n};\n\nexport default configuration;\n"
  },
  {
    "path": "src/errorReporter.js",
    "content": "/* global document */\n/* eslint-disable react/no-array-index-key */\n/* eslint-disable jsx-a11y/accessible-emoji */\n/* eslint-disable no-use-before-define */\n\nimport React from 'react';\nimport ReactDom from 'react-dom';\n\nimport configuration from './configuration';\nimport { getComponentDisplayName } from './internal/reactUtils';\nimport { enterHotUpdate } from './global/generation';\n\nlet lastError = [];\n\nconst overlayStyle = {\n  position: 'fixed',\n  left: 0,\n  top: 0,\n  right: 0,\n\n  backgroundColor: 'rgba(255,200,200,0.9)',\n\n  color: '#000',\n  fontFamily:\n    '-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif',\n  fontSize: '12px',\n  margin: 0,\n  padding: '16px',\n  maxHeight: '50%',\n  overflow: 'auto',\n  zIndex: 10000\n};\n\nconst inlineErrorStyle = {\n  backgroundColor: '#FEE',\n};\n\nconst liCounter = {\n  position: 'absolute',\n  left: '10px',\n};\n\nconst listStyle = {};\n\nexport const EmptyErrorPlaceholder = ({ component }) => (\n  <span style={inlineErrorStyle} role=\"img\" aria-label=\"Rect-Hot-Loader Error\">\n    ⚛️🔥🤕 ({component ? getComponentDisplayName(component.constructor || component) : 'Unknown location'})\n    {component &&\n      component.retryHotLoaderError && (\n        <button onClick={() => component.retryHotLoaderError()} title=\"Retry\">\n          ⟳\n        </button>\n      )}\n  </span>\n);\n\nconst errorHeader = (component, componentStack) => {\n  if (component || componentStack) {\n    return (\n      <span>\n        (\n        {component ? getComponentDisplayName(component.constructor || component) : 'Unknown location'}\n        {component && ', '}\n        {componentStack && componentStack.split('\\n').filter(Boolean)[0]}\n        )\n      </span>\n    );\n  }\n  return null;\n};\n\nconst mapError = ({ error, errorInfo, component }) => {\n  if (!error) {\n    error = { message: 'undefined error' };\n  }\n\n  return (\n    <React.Fragment>\n      <p style={{ color: 'red' }}>\n        {errorHeader(component, errorInfo && errorInfo.componentStack)}{' '}\n        {error.toString ? error.toString() : (error && error.message) || 'undefined error'}\n      </p>\n      {errorInfo && errorInfo.componentStack ? (\n        <div>\n          <div>Stack trace:</div>\n          <ul style={{ color: 'red', marginTop: '10px' }}>\n            {error.stack\n              .split('\\n')\n              .slice(1, 2)\n              .map((line, i) => <li key={String(i)}>{line}</li>)}\n            <hr />\n            {errorInfo.componentStack\n              .split('\\n')\n              .filter(Boolean)\n              .map((line, i) => <li key={String(i)}>{line}</li>)}\n          </ul>\n        </div>\n      ) : (\n        error.stack && (\n          <div>\n            <div>Stack trace:</div>\n            <ul style={{ color: 'red', marginTop: '10px' }}>\n              {error.stack.split('\\n').map((line, i) => <li key={String(i)}>{line}</li>)}\n            </ul>\n          </div>\n        )\n      )}\n    </React.Fragment>\n  );\n};\n\nclass ErrorOverlay extends React.Component {\n  state = {\n    visible: true,\n  };\n\n  toggle = () => this.setState({ visible: !this.state.visible });\n\n  retry = () =>\n    this.setState(() => {\n      const { errors } = this.props;\n      enterHotUpdate();\n      clearExceptions();\n      errors\n        .map(({ component }) => component)\n        .filter(Boolean)\n        .filter(({ retryHotLoaderError }) => !!retryHotLoaderError)\n        .forEach(component => component.retryHotLoaderError());\n\n      return {};\n    });\n\n  render() {\n    const { errors } = this.props;\n    if (!errors.length) {\n      return null;\n    }\n    const { visible } = this.state;\n    return (\n      <div style={overlayStyle}>\n        <h2 style={{ margin: 0 }}>\n          ⚛️🔥😭: hot update was not successful <button onClick={this.toggle}>{visible ? 'collapse' : 'expand'}</button>\n          <button onClick={this.retry}>Retry</button>\n        </h2>\n        {visible && (\n          <ul style={listStyle}>\n            {errors.map((err, i) => (\n              <li key={i}>\n                <span style={liCounter}>\n                  ({i + 1}/{errors.length})\n                </span>\n                {mapError(err)}\n              </li>\n            ))}\n          </ul>\n        )}\n      </div>\n    );\n  }\n}\n\nconst initErrorOverlay = () => {\n  if (typeof document === 'undefined' || !document.body) {\n    return;\n  }\n  let div = document.querySelector('.react-hot-loader-error-overlay');\n  if (!div) {\n    div = document.createElement('div');\n    div.className = 'react-hot-loader-error-overlay';\n    document.body.appendChild(div);\n  }\n  if (lastError.length) {\n    const Overlay = configuration.ErrorOverlay || ErrorOverlay;\n    ReactDom.render(<Overlay errors={lastError} />, div);\n  } else {\n    div.parentNode.removeChild(div);\n  }\n};\n\nexport function clearExceptions() {\n  if (lastError.length) {\n    lastError = [];\n    initErrorOverlay();\n  }\n}\n\nexport function logException(error, errorInfo, component) {\n  // do not suppress error\n\n  /* eslint-disable no-console */\n  console.error(error);\n  /* eslint-enable */\n\n  lastError.push({ error, errorInfo, component });\n  initErrorOverlay();\n}\n"
  },
  {
    "path": "src/fresh/babel.js",
    "content": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nconst SIGNATURE = '__signature__';\n\nexport default function (babel) {\n  const {types: t} = babel;\n\n  const registrationsByProgramPath = new Map();\n\n  function createRegistration(programPath, persistentID) {\n    const handle = programPath.scope.generateUidIdentifier('c');\n    if (!registrationsByProgramPath.has(programPath)) {\n      registrationsByProgramPath.set(programPath, []);\n    }\n    const registrations = registrationsByProgramPath.get(programPath);\n    registrations.push({\n      handle,\n      persistentID,\n    });\n    return handle;\n  }\n\n  function isComponentishName(name) {\n    return typeof name === 'string' && name[0] >= 'A' && name[0] <= 'Z';\n  }\n\n  function findInnerComponents(inferredName, path, callback) {\n    const node = path.node;\n    switch (node.type) {\n      case 'Identifier': {\n        if (!isComponentishName(node.name)) {\n          return false;\n        }\n        // export default hoc(Foo)\n        // const X = hoc(Foo)\n        callback(inferredName, node, null);\n        return true;\n      }\n      case 'FunctionDeclaration': {\n        // function Foo() {}\n        // export function Foo() {}\n        // export default function Foo() {}\n        callback(inferredName, node.id, null);\n        return true;\n      }\n      case 'ArrowFunctionExpression': {\n        if (node.body.type === 'ArrowFunctionExpression') {\n          return false;\n        }\n        // let Foo = () => {}\n        // export default hoc1(hoc2(() => {}))\n        callback(inferredName, node, path);\n        return true;\n      }\n      case 'FunctionExpression': {\n        // let Foo = function() {}\n        // const Foo = hoc1(forwardRef(function renderFoo() {}))\n        // export default memo(function() {})\n        callback(inferredName, node, path);\n        return true;\n      }\n      case 'CallExpression': {\n        const argsPath = path.get('arguments');\n        if (argsPath === undefined || argsPath.length === 0) {\n          return false;\n        }\n        const calleePath = path.get('callee');\n        switch (calleePath.node.type) {\n          case 'MemberExpression':\n          case 'Identifier': {\n            const calleeSource = calleePath.getSource();\n            const firstArgPath = argsPath[0];\n            const innerName = inferredName + '$' + calleeSource;\n            const foundInside = findInnerComponents(\n              innerName,\n              firstArgPath,\n              callback,\n            );\n            if (!foundInside) {\n              return false;\n            }\n            // const Foo = hoc1(hoc2(() => {}))\n            // export default memo(React.forwardRef(function() {}))\n            callback(inferredName, node, path);\n            return true;\n          }\n          default: {\n            return false;\n          }\n        }\n      }\n      case 'VariableDeclarator': {\n        const init = node.init;\n        if (init === null) {\n          return false;\n        }\n        const name = node.id.name;\n        if (!isComponentishName(name)) {\n          return false;\n        }\n        if (init.type === 'Identifier' || init.type === 'MemberExpression') {\n          return false;\n        }\n        const initPath = path.get('init');\n        const foundInside = findInnerComponents(\n          inferredName,\n          initPath,\n          callback,\n        );\n        if (foundInside) {\n          return true;\n        }\n        // See if this identifier is used in JSX. Then it's a component.\n        const binding = path.scope.getBinding(name);\n        if (binding === undefined) {\n          return;\n        }\n        let isLikelyUsedAsType = false;\n        const referencePaths = binding.referencePaths;\n        for (let i = 0; i < referencePaths.length; i++) {\n          const ref = referencePaths[i];\n          if (\n            ref.node.type !== 'JSXIdentifier' &&\n            ref.node.type !== 'Identifier'\n          ) {\n            continue;\n          }\n          const refParent = ref.parent;\n          if (refParent.type === 'JSXOpeningElement') {\n            isLikelyUsedAsType = true;\n          } else if (refParent.type === 'CallExpression') {\n            const callee = refParent.callee;\n            let fnName;\n            switch (callee.type) {\n              case 'Identifier':\n                fnName = callee.name;\n                break;\n              case 'MemberExpression':\n                fnName = callee.property.name;\n                break;\n            }\n            switch (fnName) {\n              case 'createElement':\n              case 'jsx':\n              case 'jsxDEV':\n              case 'jsxs':\n                isLikelyUsedAsType = true;\n                break;\n            }\n          }\n          if (isLikelyUsedAsType) {\n            // const X = ... + later <X />\n            callback(inferredName, init, initPath);\n            return true;\n          }\n        }\n      }\n    }\n    return false;\n  }\n\n  function isBuiltinHook(hookName) {\n    switch (hookName) {\n      case 'useState':\n      case 'React.useState':\n      case 'useReducer':\n      case 'React.useReducer':\n      case 'useEffect':\n      case 'React.useEffect':\n      case 'useLayoutEffect':\n      case 'React.useLayoutEffect':\n      case 'useMemo':\n      case 'React.useMemo':\n      case 'useCallback':\n      case 'React.useCallback':\n      case 'useRef':\n      case 'React.useRef':\n      case 'useContext':\n      case 'React.useContext':\n      case 'useImperativeMethods':\n      case 'React.useImperativeMethods':\n      case 'useDebugValue':\n      case 'React.useDebugValue':\n        return true;\n      default:\n        return false;\n    }\n  }\n\n  function getCalleeName(callee) {\n    if (callee.type === 'MemberExpression' && callee.object.type === 'Identifier') {\n      return callee.object.name;\n    }\n\n    return callee.name;\n  }\n\n  function getHookCallsSignature(functionNode, scope) {\n    const fnHookCalls = hookCalls.get(functionNode);\n    if (fnHookCalls === undefined) {\n      return null;\n    }\n    return {\n      key: fnHookCalls.map(call => call.name + '{' + call.key + '}').join('\\n'),\n      customHooks: fnHookCalls\n        .filter(call => !isBuiltinHook(call.name))\n        .filter(call => scope.parent.hasBinding(call.name))\n        .map(call => t.cloneDeep(call.callee)),\n    };\n  }\n\n  function createArgumentsForSignature(node, signature, scope) {\n    const {key, customHooks} = signature;\n    const args = [node, t.stringLiteral(key)];\n    const hooksInScope = customHooks.filter(call => scope.hasBinding(getCalleeName(call)));\n    if (hooksInScope.length > 0) {\n      args.push(t.arrowFunctionExpression([], t.arrayExpression(hooksInScope)));\n    }\n    return args;\n  }\n\n  let seenForRegistration = new WeakSet();\n  let seenForSignature = new WeakSet();\n\n  let hookCalls = new WeakMap();\n  const HookCallsVisitor = {\n    CallExpression(path) {\n      const node = path.node;\n      const callee = node.callee;\n\n      // Note: this visitor MUST NOT mutate the tree in any way.\n      // It runs early in a separate traversal and should be very fast.\n\n      let name = null;\n      switch (callee.type) {\n        case 'Identifier':\n          name = callee.name;\n          break;\n        case 'MemberExpression':\n          name = callee.property.name;\n          break;\n      }\n      if (name === null || !/^use[A-Z]/.test(name)) {\n        return;\n      }\n      const fnScope = path.scope.getFunctionParent();\n\n      if (fnScope === null) {\n        return;\n      }\n\n      // This is a Hook call. Record it.\n      const fnNode = fnScope.block;\n      if (!hookCalls.has(fnNode)) {\n        hookCalls.set(fnNode, []);\n      }\n\n      let hookCallsForFn = hookCalls.get(fnNode);\n      let key = '';\n      if (path.parent.type === 'VariableDeclarator') {\n        // TODO: if there is no LHS, consider some other heuristic.\n        key = path.parentPath.get('id').getSource();\n      }\n\n      // Some built-in Hooks reset on edits to arguments.\n      const args = path.get('arguments');\n      if (name === 'useState' && args.length > 0) {\n        // useState second argument is initial state.\n        key += '(' + args[0].getSource() + ')';\n      } else if (name === 'useReducer' && args.length > 1) {\n        // useReducer second argument is initial state.\n        key += '(' + args[1].getSource() + ')';\n      }\n\n      hookCallsForFn.push({\n        callee: path.node.callee,\n        name,\n        key,\n      });\n    },\n  };\n\n  return {\n    visitor: {\n      ExportDefaultDeclaration(path) {\n        const node = path.node;\n        const decl = node.declaration;\n        const declPath = path.get('declaration');\n        if (decl.type !== 'CallExpression') {\n          // For now, we only support possible HOC calls here.\n          // Named function declarations are handled in FunctionDeclaration.\n          // Anonymous direct exports like export default function() {}\n          // are currently ignored.\n          return;\n        }\n\n        // Make sure we're not mutating the same tree twice.\n        // This can happen if another Babel plugin replaces parents.\n        if (seenForRegistration.has(node)) {\n          return;\n        }\n        seenForRegistration.add(node);\n        // Don't mutate the tree above this point.\n\n        // This code path handles nested cases like:\n        // export default memo(() => {})\n        // In those cases it is more plausible people will omit names\n        // so they're worth handling despite possible false positives.\n        // More importantly, it handles the named case:\n        // export default memo(function Named() {})\n        const inferredName = '%default%';\n        const programPath = path.parentPath;\n        findInnerComponents(\n          inferredName,\n          declPath,\n          (persistentID, targetExpr, targetPath) => {\n            if (targetPath === null) {\n              // For case like:\n              // export default hoc(Foo)\n              // we don't want to wrap Foo inside the call.\n              // Instead we assume it's registered at definition.\n              return;\n            }\n            const handle = createRegistration(programPath, persistentID);\n            targetPath.replaceWith(\n              t.assignmentExpression('=', handle, targetExpr),\n            );\n          },\n        );\n      },\n      FunctionDeclaration: {\n        enter(path) {\n          return;\n          const node = path.node;\n          let programPath;\n          let insertAfterPath;\n          switch (path.parent.type) {\n            case 'Program':\n              insertAfterPath = path;\n              programPath = path.parentPath;\n              break;\n            case 'ExportNamedDeclaration':\n              insertAfterPath = path.parentPath;\n              programPath = insertAfterPath.parentPath;\n              break;\n            case 'ExportDefaultDeclaration':\n              insertAfterPath = path.parentPath;\n              programPath = insertAfterPath.parentPath;\n              break;\n            default:\n              return;\n          }\n          const id = node.id;\n          if (id === null) {\n            // We don't currently handle anonymous default exports.\n            return;\n          }\n          const inferredName = id.name;\n          if (!isComponentishName(inferredName)) {\n            return;\n          }\n\n          // Make sure we're not mutating the same tree twice.\n          // This can happen if another Babel plugin replaces parents.\n          if (seenForRegistration.has(node)) {\n            return;\n          }\n          seenForRegistration.add(node);\n          // Don't mutate the tree above this point.\n\n          // export function Named() {}\n          // function Named() {}\n          findInnerComponents(\n            inferredName,\n            path,\n            (persistentID, targetExpr) => {\n              const handle = createRegistration(programPath, persistentID);\n              insertAfterPath.insertAfter(\n                t.expressionStatement(\n                  t.assignmentExpression('=', handle, targetExpr),\n                ),\n              );\n            },\n          );\n        },\n        exit(path) {\n          //return;\n          const node = path.node;\n          const id = node.id;\n          if (id === null) {\n            return;\n          }\n          const signature = getHookCallsSignature(node, path.scope);\n          if (signature === null) {\n            return;\n          }\n\n          // Make sure we're not mutating the same tree twice.\n          // This can happen if another Babel plugin replaces parents.\n          if (seenForSignature.has(node)) {\n            return;\n          }\n          seenForSignature.add(node);\n\n\n          // Unlike with __register__, this needs to work for nested\n          // declarations too. So we need to search for a path where\n          // we can insert a statement rather than hardcoding it.\n          let insertAfterPath = null;\n          path.find(p => {\n            if (p.parentPath.isBlock()) {\n              insertAfterPath = p;\n              return true;\n            }\n          });\n          if (insertAfterPath === null) {\n            return;\n          }\n\n          insertAfterPath.insertAfter(\n            t.expressionStatement(\n              t.callExpression(\n                t.identifier(SIGNATURE),\n                createArgumentsForSignature(id, signature, insertAfterPath.scope),\n              ),\n            ),\n          );\n        },\n      },\n      'ArrowFunctionExpression|FunctionExpression': {\n        exit(path) {\n          const node = path.node;\n          const signature = getHookCallsSignature(node, path.scope);\n          if (signature === null) {\n            return;\n          }\n\n          // Make sure we're not mutating the same tree twice.\n          // This can happen if another Babel plugin replaces parents.\n          if (seenForSignature.has(node)) {\n            return;\n          }\n          seenForSignature.add(node);\n          // Don't mutate the tree above this point.\n\n          if (path.parent.type === 'VariableDeclarator') {\n            let insertAfterPath = null;\n            path.find(p => {\n              if (p.parentPath.isBlock()) {\n                insertAfterPath = p;\n                return true;\n              }\n            });\n            if (insertAfterPath === null) {\n              return;\n            }\n            // Special case when a function would get an inferred name:\n            // let Foo = () => {}\n            // let Foo = function() {}\n            // We'll add signature it on next line so that\n            // we don't mess up the inferred 'Foo' function name.\n            insertAfterPath.insertAfter(\n              t.expressionStatement(\n                t.callExpression(\n                  t.identifier(SIGNATURE),\n                  createArgumentsForSignature(path.parent.id, signature, insertAfterPath.scope),\n                ),\n              ),\n            );\n            // Result: let Foo = () => {}; __signature(Foo, ...);\n          } else {\n            // let Foo = hoc(() => {})\n            path.replaceWith(\n              t.callExpression(\n                t.identifier(SIGNATURE),\n                createArgumentsForSignature(node, signature, path.scope),\n              ),\n            );\n            // Result: let Foo = hoc(__signature(() => {}, ...))\n          }\n        },\n      },\n      Program: {\n        enter(path) {\n          // This is a separate early visitor because we need to collect Hook calls\n          // and \"const [foo, setFoo] = ...\" signatures before the destructuring\n          // transform mangles them. This extra traversal is not ideal for perf,\n          // but it's the best we can do until we stop transpiling destructuring.\n          path.traverse(HookCallsVisitor);\n        },\n      },\n    },\n  };\n}"
  },
  {
    "path": "src/global/generation.js",
    "content": "import { forEachKnownClass } from '../proxy/createClassProxy';\n\n// this counter tracks `register` invocations.\n// works good, but code splitting is breaking it\nlet generation = 1;\n\n// these counters are aimed to mitigate the \"first render\"\nlet hotComparisonCounter = 0;\nlet hotComparisonRuns = 0;\nlet hotReplacementGeneration = 0;\n\nconst nullFunction = () => ({});\n\n// these callbacks would be called on component update\nlet onHotComparisonOpen = nullFunction;\nlet onHotComparisonElement = nullFunction;\nlet onHotComparisonClose = nullFunction;\n\n// inversion of control\nexport const setComparisonHooks = (open, element, close) => {\n  onHotComparisonOpen = open;\n  onHotComparisonElement = element;\n  onHotComparisonClose = close;\n};\n\nexport const getElementComparisonHook = component => onHotComparisonElement(component);\nexport const getElementCloseHook = component => onHotComparisonClose(component);\n\nexport const hotComparisonOpen = () =>\n  hotComparisonCounter > 0 && hotComparisonRuns > 0 && hotReplacementGeneration > 0;\n\nexport const openGeneration = () => forEachKnownClass(onHotComparisonElement);\n\nexport const closeGeneration = () => forEachKnownClass(onHotComparisonClose);\n\nconst incrementHot = () => {\n  if (!hotComparisonCounter) {\n    openGeneration();\n    onHotComparisonOpen();\n  }\n  hotComparisonCounter++;\n};\nconst decrementHot = () => {\n  hotComparisonCounter--;\n  if (!hotComparisonCounter) {\n    closeGeneration();\n    hotComparisonRuns++;\n  }\n};\n\nexport const configureGeneration = (counter, runs) => {\n  hotComparisonCounter = counter;\n  hotComparisonRuns = runs;\n  hotReplacementGeneration = runs;\n};\n\n// TODO: shall it be called from incrementHotGeneration?\nexport const enterHotUpdate = () => {\n  Promise.resolve(incrementHot()).then(() => setTimeout(decrementHot, 0));\n};\n\n// TODO: deprecate?\nexport const increment = () => {\n  enterHotUpdate();\n  return generation++;\n};\nexport const get = () => generation;\n\n// These counters tracks HMR generations, and probably should be used instead of the old one\nexport const incrementHotGeneration = () => hotReplacementGeneration++;\nexport const getHotGeneration = () => hotReplacementGeneration;\n"
  },
  {
    "path": "src/global/modules.js",
    "content": "import logger from '../logger';\n\nconst openedModules = {};\nlet lastModuleOpened = '';\nexport const getLastModuleOpened = () => lastModuleOpened;\n\nconst hotModules = {};\n\nconst createHotModule = () => ({ instances: [], updateTimeout: 0 });\n\nexport const hotModule = moduleId => {\n  if (!hotModules[moduleId]) {\n    hotModules[moduleId] = createHotModule();\n  }\n  return hotModules[moduleId];\n};\n\nexport const isOpened = sourceModule => sourceModule && !!openedModules[sourceModule.id];\n\nexport const enter = sourceModule => {\n  if (sourceModule && sourceModule.id) {\n    lastModuleOpened = sourceModule.id;\n    openedModules[sourceModule.id] = true;\n  } else {\n    logger.warn('React-hot-loader: no `module` variable found. Did you shadow a system variable?');\n  }\n};\n\nexport const leave = sourceModule => {\n  if (sourceModule && sourceModule.id) {\n    delete openedModules[sourceModule.id];\n  }\n};\n"
  },
  {
    "path": "src/hot.dev.js",
    "content": "import React, { Component } from 'react';\nimport ReactDOM from 'react-dom';\nimport hoistNonReactStatic from 'hoist-non-react-statics';\n\nimport { getComponentDisplayName } from './internal/reactUtils';\nimport configuration from './configuration';\nimport AppContainer from './AppContainer.dev';\nimport reactHotLoader from './reactHotLoader';\nimport { isOpened as isModuleOpened, hotModule, getLastModuleOpened } from './global/modules';\nimport logger from './logger';\nimport { clearExceptions, logException } from './errorReporter';\nimport { createQueue } from './utils/runQueue';\nimport { enterHotUpdate, getHotGeneration, increment } from './global/generation';\n\n/* eslint-disable camelcase, no-undef */\nconst requireIndirect = typeof __webpack_require__ !== 'undefined' ? __webpack_require__ : require;\n/* eslint-enable */\n\nconst chargeFailbackTimer = id =>\n  setTimeout(() => {\n    const error = `hot update failed for module \"${id}\". Last file processed: \"${getLastModuleOpened()}\".`;\n    logger.error(error);\n    logException({\n      toString: () => error,\n    });\n    // 100 ms more \"code\" tolerant that 0, and would catch error in any case\n  }, 100);\n\nconst clearFailbackTimer = timerId => clearTimeout(timerId);\n\nconst createHoc = (SourceComponent, TargetComponent) => {\n  hoistNonReactStatic(TargetComponent, SourceComponent);\n  TargetComponent.displayName = `HotExported${getComponentDisplayName(SourceComponent)}`;\n  return TargetComponent;\n};\n\nconst runInRequireQueue = createQueue();\nconst runInRenderQueue = createQueue(cb => {\n  if (ReactDOM.unstable_batchedUpdates) {\n    ReactDOM.unstable_batchedUpdates(cb);\n  } else {\n    cb();\n  }\n});\n\nconst makeHotExport = (sourceModule, moduleId) => {\n  const updateInstances = possibleError => {\n    if (possibleError && possibleError instanceof Error) {\n      console.error(possibleError);\n      return;\n    }\n    const module = hotModule(moduleId);\n\n    const deepUpdate = () => {\n      // force flush all updates\n      runInRenderQueue(() => {\n        enterHotUpdate();\n        const gen = getHotGeneration();\n        module.instances.forEach(inst => inst.forceUpdate());\n\n        if (configuration.trackTailUpdates) {\n          let runLimit = 0;\n          const checkTailUpdates = () => {\n            setTimeout(() => {\n              if (getHotGeneration() !== gen) {\n                // we know that some components were updated, but not tracking which ones\n                // even if their updates might be incorporated automatically (like lazy)\n                // we dont know which one should be tracked, and which updates are important\n                logger.warn(\n                  'React-Hot-Loader: some components were updated out-of-bound. Updating your app to reconcile the changes.',\n                );\n                // increment generator for cache-busting existing tree\n                increment();\n                deepUpdate();\n              } else if (++runLimit < 5) {\n                checkTailUpdates();\n              }\n            }, 16);\n          };\n\n          checkTailUpdates();\n        }\n      });\n    };\n\n    // require all modules\n    runInRequireQueue(() => {\n      try {\n        // webpack will require everything by this time\n        // but let's double check...\n        requireIndirect(moduleId);\n      } catch (e) {\n        console.error('React-Hot-Loader: error detected while loading', moduleId);\n        console.error(e);\n      }\n    }).then(deepUpdate);\n  };\n\n  if (sourceModule.hot) {\n    // Mark as self-accepted for Webpack (callback is an Error Handler)\n    // Update instances for Parcel (callback is an Accept Handler)\n    sourceModule.hot.accept(updateInstances);\n\n    // Webpack way\n    if (sourceModule.hot.addStatusHandler) {\n      if (sourceModule.hot.status() === 'idle') {\n        sourceModule.hot.addStatusHandler(status => {\n          if (status === 'apply') {\n            clearExceptions();\n            updateInstances();\n          }\n        });\n      }\n    }\n  } else {\n    logger.warn('React-hot-loader: Hot Module Replacement is not enabled');\n  }\n};\n\nconst hot = sourceModule => {\n  if (!sourceModule) {\n    // this is fatal\n    throw new Error('React-hot-loader: `hot` was called without any argument provided');\n  }\n  const moduleId = sourceModule.id || sourceModule.i || sourceModule.filename;\n  if (!moduleId) {\n    console.error('`module` provided', sourceModule);\n    throw new Error('React-hot-loader: `hot` could not find the `name` of the the `module` you have provided');\n  }\n  const module = hotModule(moduleId);\n  makeHotExport(sourceModule, moduleId);\n\n  clearExceptions();\n  const failbackTimer = chargeFailbackTimer(moduleId);\n  let firstHotRegistered = false;\n\n  // TODO: Ensure that all exports from this file are react components.\n\n  return (WrappedComponent, props) => {\n    clearFailbackTimer(failbackTimer);\n    // register proxy for wrapped component\n    // only one hot per file would use this registration\n    if (!firstHotRegistered) {\n      firstHotRegistered = true;\n      reactHotLoader.register(WrappedComponent, getComponentDisplayName(WrappedComponent), `RHL${moduleId}`);\n    }\n\n    return createHoc(\n      WrappedComponent,\n      class ExportedComponent extends Component {\n        componentDidMount() {\n          module.instances.push(this);\n        }\n\n        componentWillUnmount() {\n          if (isModuleOpened(sourceModule)) {\n            const componentName = getComponentDisplayName(WrappedComponent);\n            logger.error(\n              `React-hot-loader: Detected AppContainer unmount on module '${moduleId}' update.\\n` +\n                `Did you use \"hot(${componentName})\" and \"ReactDOM.render()\" in the same file?\\n` +\n                `\"hot(${componentName})\" shall only be used as export.\\n` +\n                `Please refer to \"Getting Started\" (https://github.com/gaearon/react-hot-loader/).`,\n            );\n          }\n          module.instances = module.instances.filter(a => a !== this);\n        }\n\n        render() {\n          return (\n            <AppContainer {...props}>\n              <WrappedComponent {...this.props} />\n            </AppContainer>\n          );\n        }\n      },\n    );\n  };\n};\n\nreactHotLoader.register(AppContainer, 'AppContainer', 'hot-dev');\n\nexport default hot;\n"
  },
  {
    "path": "src/hot.prod.js",
    "content": "import React from 'react';\nimport AppContainer from './AppContainer.prod';\n\nconst hot = () => {\n  if (hot.shouldWrapWithAppContainer) {\n    return Component => props => (\n      <AppContainer>\n        <Component {...props} />\n      </AppContainer>\n    );\n  }\n  return Component => Component;\n};\n\nhot.shouldWrapWithAppContainer = false;\n\nexport default hot;\n"
  },
  {
    "path": "src/index.dev.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport ReactHotLoader from './reactHotLoader';\nimport './reconciler/proxyAdapter';\n\nexport { default as AppContainer } from './AppContainer.dev';\nexport { default as hot } from './hot.dev';\nexport { enter as enterModule, leave as leaveModule } from './global/modules';\nexport * from './utils.dev';\nexport default ReactHotLoader;\n\nReactHotLoader.patch(React, ReactDOM);\n"
  },
  {
    "path": "src/index.prod.js",
    "content": "export { default as AppContainer } from './AppContainer.prod';\nexport { default as hot } from './hot.prod';\nexport * from './utils.prod';\n"
  },
  {
    "path": "src/internal/constants.js",
    "content": "// the same as before\nconst PREFIX = '__reactstandin__';\nexport const REGENERATE_METHOD = `${PREFIX}regenerateByEval`;\n"
  },
  {
    "path": "src/internal/getReactStack.js",
    "content": "/* eslint-disable no-underscore-dangle */\nimport ReactDOM from 'react-dom';\n\nimport hydrateFiberStack from './stack/hydrateFiberStack';\nimport hydrateLegacyStack from './stack/hydrateLegacyStack';\nimport { getInternalInstance } from './reactUtils';\nimport { resolveType } from '../reconciler/resolver';\n\nfunction getReactStack(instance) {\n  const rootNode = getInternalInstance(instance);\n  const stack = {};\n  if (rootNode) {\n    // React stack\n    const isFiber = typeof rootNode.tag === 'number';\n    if (isFiber) {\n      hydrateFiberStack(rootNode, stack);\n    } else {\n      hydrateLegacyStack(rootNode, stack);\n    }\n  } else {\n    // Non-React stack\n    // preact? // inferno?\n    // there is no known VDOM to get stack from\n  }\n\n  return stack;\n}\n\nconst markUpdate = ({ fiber }) => {\n  // do not update what we should not\n  if (!fiber || typeof fiber.type === 'string') {\n    return;\n  }\n\n  const mostResentType = resolveType(fiber.type) || fiber.type;\n  fiber.type = mostResentType;\n  // do not change fiber.elementType to keep old information for the hot-update\n\n  fiber.expirationTime = 1;\n  if (fiber.alternate) {\n    fiber.alternate.expirationTime = 1;\n    fiber.alternate.type = fiber.type;\n  }\n\n  if (fiber.memoizedProps && typeof fiber.memoizedProps === 'object') {\n    fiber.memoizedProps = {\n      cacheBusterProp: true,\n      ...fiber.memoizedProps,\n    };\n  }\n\n  if (fiber.stateNode) {\n    // TODO: this might work better React 16, but breaking tests for React 15 changing \"updates\" counts.\n    // updateInstance(fiber.stateNode);\n  }\n};\n\nexport const cleanupReact = () => {\n  if (ReactDOM.hotCleanup) {\n    ReactDOM.hotCleanup();\n  }\n};\n\nexport const deepMarkUpdate = stack => {\n  markUpdate(stack);\n  if (stack.children) {\n    stack.children.forEach(deepMarkUpdate);\n  }\n};\n\nexport default getReactStack;\n"
  },
  {
    "path": "src/internal/reactUtils.js",
    "content": "import React from 'react';\n/* eslint-disable no-underscore-dangle */\n\nexport const isCompositeComponent = type => typeof type === 'function';\nexport const isReloadableComponent = type => typeof type === 'function' || typeof type === 'object';\n\nexport const getComponentDisplayName = type => {\n  const displayName = type.displayName || type.name;\n  return displayName && displayName !== 'ReactComponent' ? displayName : 'Component';\n};\n\nexport const reactLifeCycleMountMethods = ['componentWillMount', 'componentDidMount'];\n\nexport function isReactClass(Component) {\n  return !!(\n    Component.prototype &&\n    (React.Component.prototype.isPrototypeOf(Component.prototype) ||\n      // react 14 support\n      Component.prototype.isReactComponent ||\n      Component.prototype.componentWillMount ||\n      Component.prototype.componentWillUnmount ||\n      Component.prototype.componentDidMount ||\n      Component.prototype.componentDidUnmount ||\n      Component.prototype.render)\n  );\n}\n\nexport function isReactClassInstance(Component) {\n  return Component && isReactClass({ prototype: Object.getPrototypeOf(Component) });\n}\n\nexport const getInternalInstance = instance =>\n  instance._reactInternalFiber || // React 16\n  instance._reactInternalInstance || // React 15\n  null;\n\nexport const updateInstance = instance => {\n  const { updater, forceUpdate } = instance;\n  if (typeof forceUpdate === 'function') {\n    instance.forceUpdate();\n  } else if (updater && typeof updater.enqueueForceUpdate === 'function') {\n    updater.enqueueForceUpdate(instance);\n  }\n};\n\nexport const isFragmentNode = ({ type }) => React.Fragment && type === React.Fragment;\n\nconst ContextType = React.createContext ? React.createContext() : null;\nconst ConsumerType = ContextType && ContextType.Consumer.$$typeof;\nconst ProviderType = ContextType && ContextType.Provider.$$typeof;\nconst MemoType = React.memo && React.memo(() => null).$$typeof;\nconst LazyType = React.lazy && React.lazy(() => null).$$typeof;\nconst ForwardType = React.forwardRef && React.forwardRef(() => null).$$typeof;\n\nexport const CONTEXT_CURRENT_VALUE = '_currentValue';\n\nexport const isContextConsumer = ({ type }) =>\n  type && typeof type === 'object' && '$$typeof' in type && type.$$typeof === ConsumerType && ConsumerType;\nexport const isContextProvider = ({ type }) =>\n  type && typeof type === 'object' && '$$typeof' in type && type.$$typeof === ProviderType && ProviderType;\nexport const isMemoType = ({ type }) =>\n  type && typeof type === 'object' && '$$typeof' in type && type.$$typeof === MemoType && MemoType;\nexport const isLazyType = ({ type }) =>\n  type && typeof type === 'object' && '$$typeof' in type && type.$$typeof === LazyType && LazyType;\nexport const isForwardType = ({ type }) =>\n  type && typeof type === 'object' && '$$typeof' in type && type.$$typeof === ForwardType && ForwardType;\nexport const isContextType = type => isContextConsumer(type) || isContextProvider(type);\n\nexport const getElementType = type => {\n  const element = { type };\n\n  if (isContextConsumer(element)) {\n    return 'Consumer';\n  }\n  if (isContextProvider(element)) {\n    return 'Provider';\n  }\n  if (isLazyType(element)) {\n    return 'Lazy';\n  }\n  if (isMemoType(element)) {\n    return 'Memo';\n  }\n  if (isForwardType(element)) {\n    return 'Forward';\n  }\n\n  if (isReactClass(type)) {\n    return 'Class';\n  }\n\n  if (typeof element === 'function') {\n    return 'FC';\n  }\n\n  return 'unknown';\n};\n\nexport const getContextProvider = type => type && type._context;\n"
  },
  {
    "path": "src/internal/stack/hydrateFiberStack.js",
    "content": "/* eslint-disable no-underscore-dangle */\nimport ReactDOM from 'react-dom';\n\nexport const hotRenderWithHooks = ReactDOM.hotRenderWithHooks || ((fiber, render) => render());\n\nfunction pushStack(stack, node) {\n  stack.type = node.type;\n  stack.elementType = node.elementType || node.type;\n  stack.children = [];\n  stack.instance = typeof node.type === 'function' ? node.stateNode : stack;\n  stack.fiber = node;\n\n  if (!stack.instance) {\n    stack.instance = {\n      SFC_fake: stack.type,\n      props: {},\n      render: () => hotRenderWithHooks(node, () => stack.type(stack.instance.props)),\n    };\n  }\n}\n\nfunction hydrateFiberStack(node, stack) {\n  pushStack(stack, node);\n  if (node.child) {\n    let { child } = node;\n    do {\n      const childStack = {};\n      hydrateFiberStack(child, childStack);\n      stack.children.push(childStack);\n      child = child.sibling;\n    } while (child);\n  }\n}\n\nexport default hydrateFiberStack;\n"
  },
  {
    "path": "src/internal/stack/hydrateLegacyStack.js",
    "content": "/* eslint-disable no-underscore-dangle */\n\nfunction pushState(stack, type, instance) {\n  stack.type = type;\n  stack.elementType = type;\n  stack.children = [];\n  stack.instance = instance || stack;\n\n  if (typeof type === 'function' && type.isStatelessFunctionalProxy) {\n    // In React 15 SFC is wrapped by component. We have to detect our proxies and change the way it works\n    stack.instance = {\n      SFC_fake: type,\n      props: {},\n      render: () => type(stack.instance.props),\n    };\n  }\n}\n\nfunction hydrateLegacyStack(node, stack) {\n  if (node._currentElement) {\n    pushState(stack, node._currentElement.type, node._instance || stack);\n  }\n\n  if (node._renderedComponent) {\n    const childStack = {};\n    hydrateLegacyStack(node._renderedComponent, childStack);\n    stack.children.push(childStack);\n  } else if (node._renderedChildren) {\n    Object.keys(node._renderedChildren).forEach(key => {\n      const childStack = {};\n      hydrateLegacyStack(node._renderedChildren[key], childStack);\n      stack.children.push(childStack);\n    });\n  }\n}\n\nexport default hydrateLegacyStack;\n"
  },
  {
    "path": "src/logger.js",
    "content": "/* eslint-disable no-console */\nimport configuration from './configuration';\n\nconst logger = {\n  debug(...args) {\n    if (['debug'].indexOf(configuration.logLevel) !== -1) {\n      console.debug(...args);\n    }\n  },\n  log(...args) {\n    if (['debug', 'log'].indexOf(configuration.logLevel) !== -1) {\n      console.log(...args);\n    }\n  },\n  warn(...args) {\n    if (['debug', 'log', 'warn'].indexOf(configuration.logLevel) !== -1) {\n      console.warn(...args);\n    }\n  },\n  error(...args) {\n    if (['debug', 'log', 'warn', 'error'].indexOf(configuration.logLevel) !== -1) {\n      console.error(...args);\n    }\n  },\n};\n\nexport default logger;\n"
  },
  {
    "path": "src/proxy/constants.js",
    "content": "export const PREFIX = '__reactstandin__';\nexport const PROXY_KEY = `${PREFIX}key`;\nexport const GENERATION = `${PREFIX}proxyGeneration`;\nexport const REGENERATE_METHOD = `${PREFIX}regenerateByEval`;\nexport const UNWRAP_PROXY = `${PREFIX}getCurrent`;\nexport const CACHED_RESULT = `${PREFIX}cachedResult`;\nexport const PROXY_IS_MOUNTED = `${PREFIX}isMounted`;\n\nexport const RENDERED_GENERATION = 'REACT_HOT_LOADER_RENDERED_GENERATION';\n"
  },
  {
    "path": "src/proxy/createClassProxy.js",
    "content": "import { Component } from 'react';\nimport transferStaticProps from './transferStaticProps';\nimport {\n  GENERATION,\n  PROXY_KEY,\n  UNWRAP_PROXY,\n  CACHED_RESULT,\n  PROXY_IS_MOUNTED,\n  PREFIX,\n  RENDERED_GENERATION,\n} from './constants';\nimport { identity, safeDefineProperty, proxyClassCreator } from './utils';\nimport { inject, checkLifeCycleMethods, mergeComponents } from './inject';\nimport config from '../configuration';\nimport { getComponentDisplayName, isReactClass, isReactClassInstance } from '../internal/reactUtils';\nimport { get as getGeneration, getElementCloseHook, getElementComparisonHook } from '../global/generation';\n\nconst has = Object.prototype.hasOwnProperty;\n\nlet proxies = new WeakMap();\n\nexport const resetClassProxies = () => {\n  proxies = new WeakMap();\n};\n\nconst blackListedClassMembers = [\n  'constructor',\n  'render',\n  'componentWillMount',\n  'componentDidMount',\n  'componentDidCatch',\n  'componentWillReceiveProps',\n  'componentWillUnmount',\n  'hotComponentRender',\n\n  'getInitialState',\n  'getDefaultProps',\n];\n\nconst defaultRenderOptions = {\n  componentWillRender: identity,\n  componentDidUpdate: result => result,\n  componentDidRender: result => result,\n};\n\nconst filteredPrototypeMethods = Proto =>\n  Object.getOwnPropertyNames(Proto).filter(prop => {\n    const descriptor = Object.getOwnPropertyDescriptor(Proto, prop);\n    return (\n      descriptor &&\n      prop.indexOf(PREFIX) !== 0 &&\n      blackListedClassMembers.indexOf(prop) < 0 &&\n      typeof descriptor.value === 'function'\n    );\n  });\n\nconst defineClassMember = (Class, methodName, methodBody) =>\n  safeDefineProperty(Class.prototype, methodName, {\n    configurable: true,\n    writable: true,\n    enumerable: false,\n    value: methodBody,\n  });\n\nconst defineClassMembers = (Class, methods) =>\n  Object.keys(methods).forEach(methodName => defineClassMember(Class, methodName, methods[methodName]));\n\nconst setSFPFlag = (component, flag) =>\n  safeDefineProperty(component, 'isStatelessFunctionalProxy', {\n    configurable: false,\n    writable: false,\n    enumerable: false,\n    value: flag,\n  });\n\nconst copyMethodDescriptors = (target, source) => {\n  if (source) {\n    // it is possible to use `function-double` to construct an ideal clone, but does not make a sence\n    const keys = Object.getOwnPropertyNames(source);\n\n    keys.forEach(key => safeDefineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)));\n\n    safeDefineProperty(target, 'toString', {\n      configurable: true,\n      writable: false,\n      enumerable: false,\n      value: function toString() {\n        return String(source);\n      },\n    });\n  }\n\n  return target;\n};\n\nconst knownClassComponents = [];\n\nexport const forEachKnownClass = cb => knownClassComponents.forEach(cb);\n\nfunction createClassProxy(InitialComponent, proxyKey, options = {}) {\n  const renderOptions = {\n    ...defaultRenderOptions,\n    ...options,\n  };\n  const proxyConfig = {\n    ...config,\n    ...options.proxy,\n  };\n  // Prevent double wrapping.\n  // Given a proxy class, return the existing proxy managing it.\n  const existingProxy = proxies.get(InitialComponent);\n\n  if (existingProxy) {\n    return existingProxy;\n  }\n\n  let CurrentComponent;\n  let savedDescriptors = {};\n  let injectedMembers = {};\n  let proxyGeneration = 0;\n  let classUpdatePostponed = null;\n  let instancesCount = 0;\n  let isFunctionalComponent = !isReactClass(InitialComponent);\n\n  let lastInstance = null;\n\n  function postConstructionAction() {\n    this[GENERATION] = 0;\n\n    lastInstance = this;\n    // is there is an update pending\n    if (classUpdatePostponed) {\n      const callUpdate = classUpdatePostponed;\n      classUpdatePostponed = null;\n      callUpdate();\n    }\n    // As long we can't override constructor\n    // every class shall evolve from a base class\n    inject(this, proxyGeneration, injectedMembers);\n  }\n\n  function proxiedUpdate() {\n    if (this) {\n      inject(this, proxyGeneration, injectedMembers);\n    }\n  }\n\n  function lifeCycleWrapperFactory(wrapperName, sideEffect = identity) {\n    return copyMethodDescriptors(function wrappedMethod(...rest) {\n      proxiedUpdate.call(this);\n      sideEffect(this);\n      return (\n        !isFunctionalComponent &&\n        CurrentComponent.prototype[wrapperName] &&\n        CurrentComponent.prototype[wrapperName].apply(this, rest)\n      );\n    }, InitialComponent.prototype && InitialComponent.prototype[wrapperName]);\n  }\n\n  function methodWrapperFactory(wrapperName, realMethod) {\n    return copyMethodDescriptors(function wrappedMethod(...rest) {\n      return realMethod.apply(this, rest);\n    }, realMethod);\n  }\n\n  const fakeBasePrototype = Proto =>\n    filteredPrototypeMethods(Proto).reduce((acc, key) => {\n      acc[key] = methodWrapperFactory(key, Proto[key]);\n      return acc;\n    }, {});\n\n  const componentDidMount = lifeCycleWrapperFactory('componentDidMount', target => {\n    target[PROXY_IS_MOUNTED] = true;\n    target[RENDERED_GENERATION] = getGeneration();\n    instancesCount++;\n  });\n  const componentDidUpdate = lifeCycleWrapperFactory('componentDidUpdate', renderOptions.componentDidUpdate);\n  const componentWillUnmount = lifeCycleWrapperFactory('componentWillUnmount', target => {\n    target[PROXY_IS_MOUNTED] = false;\n    instancesCount--;\n  });\n\n  function hotComponentRender() {\n    // repeating subrender call to keep RENDERED_GENERATION up to date\n    renderOptions.componentWillRender(this);\n    proxiedUpdate.call(this);\n    let result;\n\n    // We need to use hasOwnProperty here, as the cached result is a React node\n    // and can be null or some other falsy value.\n    if (has.call(this, CACHED_RESULT)) {\n      result = this[CACHED_RESULT];\n      delete this[CACHED_RESULT];\n    } else if (isFunctionalComponent) {\n      result = CurrentComponent(this.props, this.context);\n    } else {\n      const renderMethod = CurrentComponent.prototype.render || this.render;\n      /* eslint-disable no-use-before-define */\n      if (renderMethod === proxiedRender) {\n        throw new Error('React-Hot-Loader: you are trying to render Component without .render method');\n      }\n      /* eslint-enable */\n      result = renderMethod.apply(\n        this,\n        // eslint-disable-next-line prefer-rest-params\n        arguments,\n      );\n    }\n\n    return renderOptions.componentDidRender.call(this, result);\n  }\n\n  function hotComponentUpdate() {\n    renderOptions.componentWillRender(this);\n    proxiedUpdate.call(this);\n  }\n\n  function proxiedRender(...args) {\n    renderOptions.componentWillRender(this);\n    return hotComponentRender.call(this, ...args);\n  }\n\n  const defineProxyMethods = (Proxy, Base = {}) => {\n    defineClassMembers(Proxy, {\n      ...fakeBasePrototype(Base),\n      // eslint-disable-next-line no-nested-ternary\n      ...(proxyConfig.pureRender ? {} : { render: proxiedRender }),\n      hotComponentRender,\n      hotComponentUpdate,\n      componentDidMount,\n      componentDidUpdate,\n      componentWillUnmount,\n    });\n  };\n\n  let ProxyFacade;\n  let ProxyComponent = null;\n  let proxy;\n\n  if (!isFunctionalComponent) {\n    // Component\n    ProxyComponent = proxyClassCreator(InitialComponent, postConstructionAction);\n\n    defineProxyMethods(ProxyComponent, InitialComponent.prototype);\n\n    knownClassComponents.push(ProxyComponent);\n\n    ProxyFacade = ProxyComponent;\n  } else if (!proxyConfig.allowSFC) {\n    proxyConfig.pureRender = false;\n    // SFC Converted to component. Does not support returning precreated instances from render.\n    ProxyComponent = proxyClassCreator(Component, postConstructionAction);\n\n    defineProxyMethods(ProxyComponent);\n    ProxyFacade = ProxyComponent;\n  } else {\n    // SFC\n\n    // This function only gets called for the initial mount. The actual\n    // rendered component instance will be the return value.\n\n    // eslint-disable-next-line func-names\n    ProxyFacade = function(props, context) {\n      /*\n\n        ! THIS IS NOT YOUR COMPONENT !\n        !  THIS IS REACT-HOT-LOADER  !\n\n        And you are probably looking for a function component of yours\n        It's hidden, but there is a way to fix this - just reconfigure your application a bit\n        see https://github.com/gaearon/react-hot-loader/issues/1311\n\n       */\n\n      const result = CurrentComponent(props, context);\n\n      // This is a Relay-style container constructor. We can't do the prototype-\n      // style wrapping for this as we do elsewhere, so just we just pass it\n      // through as-is.\n      if (isReactClassInstance(result)) {\n        ProxyComponent = null;\n\n        // Relay lazily sets statics like getDerivedStateFromProps on initial\n        // render in lazy construction, so we need to do the same here.\n        transferStaticProps(ProxyFacade, savedDescriptors, null, CurrentComponent);\n\n        return result;\n      }\n\n      // simple SFC, could continue to be SFC\n      if (proxyConfig.pureSFC) {\n        if (!CurrentComponent.contextTypes) {\n          if (!ProxyFacade.isStatelessFunctionalProxy) {\n            setSFPFlag(ProxyFacade, true);\n          }\n\n          return renderOptions.componentDidRender(result);\n        }\n      }\n      setSFPFlag(ProxyFacade, false);\n      proxyConfig.pureRender = false;\n\n      // Otherwise, it's a normal functional component. Build the real proxy\n      // and use it going forward.\n      ProxyComponent = proxyClassCreator(Component, postConstructionAction);\n\n      defineProxyMethods(ProxyComponent);\n\n      const determinateResult = new ProxyComponent(props, context);\n\n      // Cache the initial render result so we don't call the component function\n      // a second time for the initial render.\n      determinateResult[CACHED_RESULT] = result;\n      return determinateResult;\n    };\n  }\n\n  function get() {\n    return ProxyFacade;\n  }\n\n  function getCurrent() {\n    return CurrentComponent;\n  }\n\n  safeDefineProperty(ProxyFacade, UNWRAP_PROXY, {\n    configurable: false,\n    writable: false,\n    enumerable: false,\n    value: getCurrent,\n  });\n\n  safeDefineProperty(ProxyFacade, PROXY_KEY, {\n    configurable: false,\n    writable: false,\n    enumerable: false,\n    value: proxyKey,\n  });\n\n  safeDefineProperty(ProxyFacade, 'toString', {\n    configurable: true,\n    writable: false,\n    enumerable: false,\n    value: function toString() {\n      return String(CurrentComponent);\n    },\n  });\n\n  function update(NextComponent) {\n    if (typeof NextComponent !== 'function') {\n      throw new Error('Expected a constructor.');\n    }\n\n    if (NextComponent === CurrentComponent) {\n      return false;\n    }\n\n    // Prevent proxy cycles\n    const existingProxy = proxies.get(NextComponent);\n    if (existingProxy) {\n      return false;\n    }\n\n    isFunctionalComponent = !isReactClass(NextComponent);\n\n    proxies.set(NextComponent, proxy);\n\n    proxyGeneration++;\n\n    // Save the next constructor so we call it\n    const PreviousComponent = CurrentComponent;\n    CurrentComponent = NextComponent;\n\n    // Try to infer displayName\n    const displayName = getComponentDisplayName(CurrentComponent);\n\n    safeDefineProperty(ProxyFacade, 'displayName', {\n      configurable: true,\n      writable: false,\n      enumerable: true,\n      value: displayName,\n    });\n\n    if (ProxyComponent) {\n      safeDefineProperty(ProxyComponent, 'name', {\n        value: displayName,\n      });\n    }\n\n    savedDescriptors = transferStaticProps(ProxyFacade, savedDescriptors, PreviousComponent, NextComponent);\n\n    if (isFunctionalComponent || !ProxyComponent) {\n      // nothing\n    } else {\n      const classHotReplacement = () => {\n        checkLifeCycleMethods(ProxyComponent, NextComponent);\n        if (proxyGeneration > 1) {\n          getElementCloseHook(ProxyComponent);\n          filteredPrototypeMethods(ProxyComponent.prototype).forEach(methodName => {\n            if (!has.call(NextComponent.prototype, methodName)) {\n              delete ProxyComponent.prototype[methodName];\n            }\n          });\n        }\n        Object.setPrototypeOf(ProxyComponent.prototype, NextComponent.prototype);\n        defineProxyMethods(ProxyComponent, NextComponent.prototype);\n        if (proxyGeneration > 1) {\n          injectedMembers = mergeComponents(\n            ProxyComponent,\n            NextComponent,\n            InitialComponent,\n            lastInstance,\n            injectedMembers,\n          );\n          getElementComparisonHook(ProxyComponent);\n        }\n      };\n\n      // Was constructed once\n      if (instancesCount > 0) {\n        classHotReplacement();\n      } else {\n        classUpdatePostponed = classHotReplacement;\n      }\n    }\n\n    return true;\n  }\n\n  update(InitialComponent);\n\n  const dereference = () => {\n    proxies.delete(InitialComponent);\n    proxies.delete(ProxyFacade);\n    proxies.delete(CurrentComponent);\n  };\n\n  proxy = { get, update, dereference, getCurrent: () => CurrentComponent };\n\n  proxies.set(InitialComponent, proxy);\n  proxies.set(ProxyFacade, proxy);\n\n  safeDefineProperty(proxy, UNWRAP_PROXY, {\n    configurable: false,\n    writable: false,\n    enumerable: false,\n    value: getCurrent,\n  });\n\n  return proxy;\n}\n\nexport default createClassProxy;\n"
  },
  {
    "path": "src/proxy/index.js",
    "content": "export * from './constants';\nexport { default } from './createClassProxy';\n"
  },
  {
    "path": "src/proxy/inject.js",
    "content": "import { isNativeFunction, safeReactConstructor, getOwnKeys, shallowStringsEqual, deepPrototypeUpdate } from './utils';\nimport { reactLifeCycleMountMethods } from '../internal/reactUtils';\nimport { REGENERATE_METHOD, PREFIX, GENERATION } from './constants';\nimport logger from '../logger';\n\nfunction mergeComponents(ProxyComponent, NextComponent, InitialComponent, lastInstance, injectedMembers) {\n  const injectedCode = {};\n  try {\n    const nextInstance = safeReactConstructor(NextComponent, lastInstance);\n\n    try {\n      // Bypass babel class inheritance checking\n      deepPrototypeUpdate(InitialComponent, NextComponent);\n    } catch (e) {\n      // It was ES6 class\n    }\n\n    const proxyInstance = safeReactConstructor(ProxyComponent, lastInstance);\n\n    if (!nextInstance || !proxyInstance) {\n      return injectedCode;\n    }\n\n    const mergedAttrs = { ...proxyInstance, ...nextInstance };\n    const hasRegenerate = proxyInstance[REGENERATE_METHOD];\n    const ownKeys = getOwnKeys(Object.getPrototypeOf(ProxyComponent.prototype));\n    Object.keys(mergedAttrs).forEach(key => {\n      if (key.indexOf(PREFIX) === 0) return;\n      const nextAttr = nextInstance[key];\n      const prevAttr = proxyInstance[key];\n      if (nextAttr) {\n        if (isNativeFunction(nextAttr) || isNativeFunction(prevAttr)) {\n          // this is bound method\n          const isSameArity = nextAttr.length === prevAttr.length;\n          const existsInPrototype = ownKeys.indexOf(key) >= 0 || ProxyComponent.prototype[key];\n          if ((isSameArity || !prevAttr) && existsInPrototype) {\n            if (hasRegenerate) {\n              injectedCode[key] = `Object.getPrototypeOf(this)['${key}'].bind(this)`;\n            } else {\n              logger.warn(\n                'React Hot Loader:,',\n                'Non-controlled class',\n                ProxyComponent.name,\n                'contains a new native or bound function ',\n                key,\n                nextAttr,\n                '. Unable to reproduce',\n              );\n            }\n          } else {\n            logger.warn(\n              'React Hot Loader:',\n              'Updated class ',\n              ProxyComponent.name,\n              'contains native or bound function ',\n              key,\n              nextAttr,\n              '. Unable to reproduce, use arrow functions instead.',\n              `(arity: ${nextAttr.length}/${prevAttr.length}, proto: ${existsInPrototype ? 'yes' : 'no'}`,\n            );\n          }\n          return;\n        }\n\n        const nextString = String(nextAttr);\n        const injectedBefore = injectedMembers[key];\n        const isArrow = nextString.indexOf('=>') >= 0;\n        const isFunction = nextString.indexOf('function') >= 0 || isArrow;\n        const referToThis = nextString.indexOf('this') >= 0;\n        if (\n          nextString !== String(prevAttr) ||\n          (injectedBefore && nextString !== String(injectedBefore)) ||\n          (isArrow && referToThis)\n        ) {\n          if (!hasRegenerate) {\n            if (!isFunction) {\n              // just copy prop over\n              injectedCode[key] = nextAttr;\n            } else {\n              logger.warn(\n                'React Hot Loader:',\n                ' Updated class ',\n                ProxyComponent.name,\n                'had different code for',\n                key,\n                nextAttr,\n                '. Unable to reproduce. Regeneration support needed.',\n              );\n            }\n          } else {\n            injectedCode[key] = nextAttr;\n          }\n        } else {\n          // key was skipped\n        }\n      } else {\n        // key does not exists anymore\n        // we could not delete it, yet #840\n        // injectedCode[key] = null;\n      }\n    });\n  } catch (e) {\n    logger.warn('React Hot Loader:', e);\n  }\n  return injectedCode;\n}\n\nfunction checkLifeCycleMethods(ProxyComponent, NextComponent) {\n  try {\n    const p1 = Object.getPrototypeOf(ProxyComponent.prototype);\n    const p2 = NextComponent.prototype;\n    reactLifeCycleMountMethods.forEach(key => {\n      const d1 = Object.getOwnPropertyDescriptor(p1, key) || { value: p1[key] };\n      const d2 = Object.getOwnPropertyDescriptor(p2, key) || { value: p2[key] };\n      if (!shallowStringsEqual(d1, d2)) {\n        logger.warn(\n          'React Hot Loader:',\n          'You did update',\n          ProxyComponent.name,\n          's lifecycle method',\n          key,\n          '. Unable to repeat',\n        );\n      }\n    });\n  } catch (e) {\n    // Ignore errors\n  }\n}\n\nfunction inject(target, currentGeneration, injectedMembers) {\n  if (target[GENERATION] !== currentGeneration) {\n    const hasRegenerate = !!target[REGENERATE_METHOD];\n    Object.keys(injectedMembers).forEach(key => {\n      try {\n        if (hasRegenerate) {\n          const usedThis = String(injectedMembers[key]).match(/_this([\\d]+)/gi) || [];\n          target[REGENERATE_METHOD](\n            key,\n            `(function REACT_HOT_LOADER_SANDBOX () {\n          var _this  = this; // common babel transpile\n          ${usedThis.map(name => `var ${name} = this;`)}\n\n          return ${injectedMembers[key]};\n          }).call(this)`,\n          );\n        } else {\n          target[key] = injectedMembers[key];\n        }\n      } catch (e) {\n        logger.warn('React Hot Loader: Failed to regenerate method ', key, ' of class ', target);\n        logger.warn('got error', e);\n      }\n    });\n\n    target[GENERATION] = currentGeneration;\n  }\n}\n\nexport { mergeComponents, checkLifeCycleMethods, inject };\n"
  },
  {
    "path": "src/proxy/transferStaticProps.js",
    "content": "import shallowEqual from 'shallowequal';\nimport { safeDefineProperty } from './utils';\nimport { PROXY_KEY, UNWRAP_PROXY } from './constants';\n\nconst RESERVED_STATICS = [\n  'length',\n  'displayName',\n  'name',\n  'arguments',\n  'caller',\n  'prototype',\n  'toString',\n  'valueOf',\n  'isStatelessFunctionalProxy',\n  PROXY_KEY,\n  UNWRAP_PROXY,\n];\n\nfunction transferStaticProps(ProxyComponent, savedDescriptors, PreviousComponent, NextComponent) {\n  Object.getOwnPropertyNames(ProxyComponent).forEach(key => {\n    if (RESERVED_STATICS.indexOf(key) !== -1) {\n      return;\n    }\n\n    const prevDescriptor = Object.getOwnPropertyDescriptor(ProxyComponent, key);\n    const savedDescriptor = savedDescriptors[key];\n\n    if (!shallowEqual(prevDescriptor, savedDescriptor)) {\n      safeDefineProperty(NextComponent, key, prevDescriptor);\n    }\n  });\n\n  // Copy newly defined static methods and properties\n  Object.getOwnPropertyNames(NextComponent).forEach(key => {\n    if (RESERVED_STATICS.indexOf(key) !== -1) {\n      return;\n    }\n\n    const prevDescriptor = PreviousComponent && Object.getOwnPropertyDescriptor(ProxyComponent, key);\n    const savedDescriptor = savedDescriptors[key];\n\n    // Skip redefined descriptors\n    if (prevDescriptor && savedDescriptor && !shallowEqual(savedDescriptor, prevDescriptor)) {\n      safeDefineProperty(NextComponent, key, prevDescriptor);\n      return;\n    }\n\n    if (prevDescriptor && !savedDescriptor) {\n      safeDefineProperty(ProxyComponent, key, prevDescriptor);\n      return;\n    }\n\n    const nextDescriptor = {\n      ...Object.getOwnPropertyDescriptor(NextComponent, key),\n      configurable: true,\n    };\n\n    savedDescriptors[key] = nextDescriptor;\n    safeDefineProperty(ProxyComponent, key, nextDescriptor);\n  });\n\n  // Remove static methods and properties that are no longer defined\n  Object.getOwnPropertyNames(ProxyComponent).forEach(key => {\n    if (RESERVED_STATICS.indexOf(key) !== -1) {\n      return;\n    }\n    // Skip statics that exist on the next class\n    if (NextComponent.hasOwnProperty(key)) {\n      return;\n    }\n    // Skip non-configurable statics\n    const proxyDescriptor = Object.getOwnPropertyDescriptor(ProxyComponent, key);\n    if (proxyDescriptor && !proxyDescriptor.configurable) {\n      return;\n    }\n\n    const prevDescriptor = PreviousComponent && Object.getOwnPropertyDescriptor(PreviousComponent, key);\n    const savedDescriptor = savedDescriptors[key];\n\n    // Skip redefined descriptors\n    if (prevDescriptor && savedDescriptor && !shallowEqual(savedDescriptor, prevDescriptor)) {\n      return;\n    }\n\n    safeDefineProperty(ProxyComponent, key, {\n      value: undefined,\n    });\n  });\n\n  return savedDescriptors;\n}\n\nexport default transferStaticProps;\n"
  },
  {
    "path": "src/proxy/utils.js",
    "content": "/* eslint-disable no-eval, func-names */\nimport logger from '../logger';\n\nexport function safeReactConstructor(Component, lastInstance) {\n  try {\n    if (lastInstance) {\n      return new Component(lastInstance.props, lastInstance.context);\n    }\n    return new Component({}, {});\n  } catch (e) {\n    // some components, like Redux connect could not be created without proper context\n  }\n  return null;\n}\n\nexport function isNativeFunction(fn) {\n  return typeof fn === 'function' ? fn.toString().indexOf('[native code]') > 0 : false;\n}\n\nexport const identity = a => a;\nconst indirectEval = eval;\n\nexport const doesSupportClasses = (function() {\n  try {\n    indirectEval('class Test {}');\n    return true;\n  } catch (e) {\n    return false;\n  }\n})();\n\nconst ES6ProxyComponentFactory = (InitialParent, postConstructionAction) =>\n  indirectEval(`\n(function(InitialParent, postConstructionAction) {\n  return class ${InitialParent.name || 'HotComponent'} extends InitialParent {\n    /*\n     ! THIS IS NOT YOUR COMPONENT !\n     !  THIS IS REACT-HOT-LOADER  !\n  \n     this is a \"${InitialParent.name}\" component, patched by React-Hot-Loader\n     Sorry, but the real class code was hidden behind this facade\n     Please refer to https://github.com/gaearon/react-hot-loader for details...\n    */    \n    \n    constructor(props, context) {\n      super(props, context)\n      postConstructionAction.call(this)\n    }\n  }\n})\n`)(InitialParent, postConstructionAction);\n\nconst ES5ProxyComponentFactory = function(InitialParent, postConstructionAction) {\n  function ProxyComponent(props, context) {\n    InitialParent.call(this, props, context);\n    postConstructionAction.call(this);\n  }\n  ProxyComponent.prototype = Object.create(InitialParent.prototype);\n  Object.setPrototypeOf(ProxyComponent, InitialParent);\n  return ProxyComponent;\n};\n\nexport const proxyClassCreator = doesSupportClasses ? ES6ProxyComponentFactory : ES5ProxyComponentFactory;\n\nexport function getOwnKeys(target) {\n  return [...Object.getOwnPropertyNames(target), ...Object.getOwnPropertySymbols(target)];\n}\n\nexport function shallowStringsEqual(a, b) {\n  for (const key in a) {\n    if (String(a[key]) !== String(b[key])) {\n      return false;\n    }\n  }\n  return true;\n}\n\nexport function deepPrototypeUpdate(dest, source) {\n  const deepDest = Object.getPrototypeOf(dest);\n  const deepSrc = Object.getPrototypeOf(source);\n  if (deepDest && deepSrc && deepSrc !== deepDest) {\n    deepPrototypeUpdate(deepDest, deepSrc);\n  }\n  if (source.prototype && source.prototype !== dest.prototype) {\n    dest.prototype = source.prototype;\n  }\n}\n\nexport function safeDefineProperty(target, key, props) {\n  try {\n    Object.defineProperty(target, key, props);\n  } catch (e) {\n    logger.warn('Error while wrapping', key, ' -> ', e);\n  }\n}\n"
  },
  {
    "path": "src/reactHotLoader.js",
    "content": "/* eslint-disable no-use-before-define */\nimport {\n  isCompositeComponent,\n  getComponentDisplayName,\n  isLazyType,\n  isMemoType,\n  isForwardType,\n  isContextType,\n} from './internal/reactUtils';\nimport { increment as incrementGeneration, getHotGeneration } from './global/generation';\nimport {\n  updateProxyById,\n  resetProxies,\n  getProxyById,\n  isTypeBlacklisted,\n  registerComponent,\n  updateFunctionProxyById,\n  addSignature,\n} from './reconciler/proxies';\nimport configuration from './configuration';\nimport logger from './logger';\n\nimport { preactAdapter } from './adapters/preact';\nimport { updateContext, updateForward, updateLazy, updateMemo } from './reconciler/fiberUpdater';\nimport { resolveSimpleType, resolveType } from './reconciler/resolver';\nimport { hotComponentCompare } from './reconciler/componentComparator';\n\nconst forceSimpleSFC = { proxy: { pureSFC: true } };\n\nconst hookWrapper = hook => {\n  const wrappedHook = function(cb, deps) {\n    if (configuration.reloadHooks && deps) {\n      const inputs = [...deps];\n\n      // reload hooks which have changed string representation\n      if (configuration.reloadHooksOnBodyChange) {\n        inputs.push(String(cb));\n      }\n\n      if (\n        // reload hooks with dependencies\n        deps.length > 0 ||\n        // reload all hooks of option is set\n        (configuration.reloadLifeCycleHooks && deps.length === 0)\n      ) {\n        inputs.push(getHotGeneration());\n      }\n\n      return hook(cb, inputs);\n    }\n    return hook(cb, deps);\n  };\n  wrappedHook.isPatchedByReactHotLoader = true;\n  return wrappedHook;\n};\n\nconst noDeps = () => [];\n\nconst reactHotLoader = {\n  signature(type, key, getCustomHooks = noDeps) {\n    addSignature(type, { key, getCustomHooks });\n    return type;\n  },\n  register(type, uniqueLocalName, fileName, options = {}) {\n    const id = `${fileName}#${uniqueLocalName}`;\n\n    if (\n      isCompositeComponent(type) &&\n      typeof uniqueLocalName === 'string' &&\n      uniqueLocalName &&\n      typeof fileName === 'string' &&\n      fileName\n    ) {\n      const proxy = getProxyById(id);\n\n      if (proxy && proxy.getCurrent() !== type) {\n        if (!configuration.IS_REACT_MERGE_ENABLED) {\n          if (isTypeBlacklisted(type) || isTypeBlacklisted(proxy.getCurrent())) {\n            logger.error('React-hot-loader: Cold component', uniqueLocalName, 'at', fileName, 'has been updated');\n          }\n        }\n      }\n\n      if (configuration.onComponentRegister) {\n        configuration.onComponentRegister(type, uniqueLocalName, fileName);\n      }\n      if (configuration.onComponentCreate) {\n        configuration.onComponentCreate(type, getComponentDisplayName(type));\n      }\n\n      registerComponent(updateProxyById(id, type, options).get(), 2);\n      registerComponent(type);\n      incrementGeneration();\n    }\n    if (isContextType({ type })) {\n      // possible options - Context, Consumer, Provider.\n      ['Provider', 'Consumer'].forEach(prop => {\n        const descriptor = Object.getOwnPropertyDescriptor(type, prop);\n        if (descriptor && descriptor.value) {\n          updateFunctionProxyById(`${id}:${prop}`, descriptor.value, updateContext);\n        }\n      });\n      updateFunctionProxyById(id, type, updateContext);\n      incrementGeneration();\n    }\n    if (isLazyType({ type })) {\n      updateFunctionProxyById(id, type, updateLazy);\n      incrementGeneration();\n    }\n    if (isForwardType({ type })) {\n      reactHotLoader.register(type.render, `${uniqueLocalName}:render`, fileName, forceSimpleSFC);\n      updateFunctionProxyById(id, type, updateForward);\n      incrementGeneration();\n    }\n    if (isMemoType({ type })) {\n      reactHotLoader.register(type.type, `${uniqueLocalName}:memo`, fileName, forceSimpleSFC);\n      updateFunctionProxyById(id, type, updateMemo);\n      incrementGeneration();\n    }\n  },\n\n  reset() {\n    resetProxies();\n  },\n\n  preact(instance) {\n    preactAdapter(instance, resolveType);\n  },\n\n  resolveType(type) {\n    return resolveType(type);\n  },\n\n  patch(React, ReactDOM) {\n    let typeResolver = resolveType;\n    /* eslint-disable no-console */\n    if (ReactDOM && !ReactDOM.render) {\n      logger.error(\n        'React-Hot-Loader: broken state detected, please import React-Hot-Loader before react-dom, see https://github.com/gaearon/react-hot-loader/issues/1315',\n      );\n    }\n    if (ReactDOM && ReactDOM.setHotElementComparator) {\n      ReactDOM.setHotElementComparator(hotComponentCompare);\n      configuration.disableHotRenderer = configuration.disableHotRendererWhenInjected;\n\n      configuration.ignoreSFC = configuration.ignoreSFCWhenInjected;\n\n      configuration.IS_REACT_MERGE_ENABLED = true;\n      configuration.showReactDomPatchNotification = false;\n      configuration.integratedComparator = true;\n\n      if (ReactDOM.setHotTypeResolver) {\n        configuration.integratedResolver = true;\n        typeResolver = resolveSimpleType;\n        ReactDOM.setHotTypeResolver(resolveType);\n      }\n    }\n\n    // PATCH REACT METHODS\n\n    /* eslint-enable */\n    if (!React.createElement.isPatchedByReactHotLoader) {\n      const originalCreateElement = React.createElement;\n      // Trick React into rendering a proxy so that\n      // its state is preserved when the class changes.\n      // This will update the proxy if it's for a known type.\n      React.createElement = (type, ...args) => originalCreateElement(typeResolver(type), ...args);\n      React.createElement.isPatchedByReactHotLoader = true;\n    }\n\n    if (!React.cloneElement.isPatchedByReactHotLoader) {\n      const originalCloneElement = React.cloneElement;\n\n      React.cloneElement = (element, ...args) => {\n        const newType = element.type && typeResolver(element.type);\n        if (newType && newType !== element.type) {\n          return originalCloneElement(\n            {\n              ...element,\n              type: newType,\n            },\n            ...args,\n          );\n        }\n        return originalCloneElement(element, ...args);\n      };\n\n      React.cloneElement.isPatchedByReactHotLoader = true;\n    }\n\n    if (!React.createFactory.isPatchedByReactHotLoader) {\n      // Patch React.createFactory to use patched createElement\n      // because the original implementation uses the internal,\n      // unpatched ReactElement.createElement\n      React.createFactory = type => {\n        const factory = React.createElement.bind(null, type);\n        factory.type = type;\n        return factory;\n      };\n      React.createFactory.isPatchedByReactHotLoader = true;\n    }\n\n    if (!React.Children.only.isPatchedByReactHotLoader) {\n      const originalChildrenOnly = React.Children.only;\n      // Use the same trick as React.createElement\n      React.Children.only = children =>\n        originalChildrenOnly({\n          ...children,\n          type: typeResolver(children.type),\n        });\n      React.Children.only.isPatchedByReactHotLoader = true;\n    }\n\n    // PATCH REACT HOOKS\n\n    if (React.useEffect && !React.useEffect.isPatchedByReactHotLoader) {\n      React.useEffect = hookWrapper(React.useEffect);\n      React.useLayoutEffect = hookWrapper(React.useLayoutEffect);\n      React.useCallback = hookWrapper(React.useCallback);\n      React.useMemo = hookWrapper(React.useMemo);\n\n      // transform context for useContext\n      const { useContext } = React;\n      React.useContext = (context, ...args) => useContext(typeResolver(context), ...args);\n    }\n\n    // reactHotLoader.reset()\n  },\n};\n\nexport default reactHotLoader;\n"
  },
  {
    "path": "src/reconciler/componentComparator.js",
    "content": "import { getIdByType, getProxyByType, getSignature, isColdType, updateProxyById } from './proxies';\nimport { hotComparisonOpen } from '../global/generation';\nimport {\n  getElementType,\n  isContextType,\n  isForwardType,\n  isLazyType,\n  isMemoType,\n  isReactClass,\n  isReloadableComponent,\n} from '../internal/reactUtils';\nimport { areSwappable } from './utils';\nimport { PROXY_KEY, UNWRAP_PROXY } from '../proxy';\nimport { resolveType } from './resolver';\nimport logger from '../logger';\nimport configuration from '../configuration';\nimport { updateLazy } from './fiberUpdater';\n\nconst getInnerComponentType = component => {\n  const unwrapper = component[UNWRAP_PROXY];\n  return unwrapper ? unwrapper() : component;\n};\n\nfunction haveEqualSignatures(prevType, nextType) {\n  try {\n    const prevSignature = getSignature(prevType);\n    const nextSignature = getSignature(nextType);\n\n    if (prevSignature === undefined && nextSignature === undefined) {\n      return true;\n    }\n    if (prevSignature === undefined || nextSignature === undefined) {\n      return false;\n    }\n    if (prevSignature.key !== nextSignature.key) {\n      return false;\n    }\n\n    // TODO: we might need to calculate previous signature earlier in practice,\n    // such as during the first time a component is resolved. We'll revisit this.\n    const prevCustomHooks = prevSignature.getCustomHooks();\n    const nextCustomHooks = nextSignature.getCustomHooks();\n    if (prevCustomHooks.length !== nextCustomHooks.length) {\n      return false;\n    }\n\n    for (let i = 0; i < nextCustomHooks.length; i++) {\n      if (!haveEqualSignatures(prevCustomHooks[i], nextCustomHooks[i])) {\n        return false;\n      }\n    }\n  } catch (e) {\n    logger.error('React-Hot-Loader: error occurred while comparing hook signature', e);\n    return false;\n  }\n\n  return true;\n}\n\nconst areSignaturesCompatible = (a, b) => {\n  // compare signatures of two components\n  // non-equal component have to remount and there is two options to do it\n  // - fail the comparison, remounting all tree below\n  // - fulfill it, but set `_debugNeedsRemount` on a fiber to drop only local state\n  // the second way is not published yet, so going with the first one\n  if (!haveEqualSignatures(a, b)) {\n    logger.warn('⚛️🔥🎣 Hook order change detected: component', a, 'has been remounted');\n    return false;\n  }\n  return true;\n};\n\nconst compareRegistered = (a, b) =>\n  getIdByType(a) === getIdByType(b) && getProxyByType(a) === getProxyByType(b) && areSignaturesCompatible(a, b);\n\nconst areDeepSwappable = (oldType, newType) => {\n  const type = { type: oldType };\n\n  if (typeof oldType === 'function') {\n    return areSwappable(oldType, newType);\n  }\n\n  if (isForwardType(type)) {\n    return areDeepSwappable(oldType.render, newType.render);\n  }\n\n  if (isMemoType(type)) {\n    return areDeepSwappable(oldType.type, newType.type);\n  }\n\n  // that's not safe\n  // if (isLazyType(type)) {\n  //   return areDeepSwappable(oldType._ctor, newType._ctor)\n  // }\n\n  return false;\n};\n\nconst compareComponents = (oldType, newType, setNewType, baseType) => {\n  let defaultResult = oldType === newType;\n\n  if (\n    (oldType && !newType) ||\n    (!oldType && newType) ||\n    typeof oldType !== typeof newType ||\n    getElementType(oldType) !== getElementType(newType) ||\n    0\n  ) {\n    return defaultResult;\n  }\n\n  if (getIdByType(newType) || getIdByType(oldType)) {\n    if (!compareRegistered(oldType, newType)) {\n      return false;\n    }\n    defaultResult = true;\n  }\n\n  if (isForwardType({ type: oldType }) && isForwardType({ type: newType })) {\n    if (!compareRegistered(oldType.render, newType.render)) {\n      return false;\n    }\n    if (oldType.render === newType.render || areDeepSwappable(oldType, newType)) {\n      setNewType(newType);\n      return true;\n    }\n    return defaultResult;\n  }\n\n  if (isMemoType({ type: oldType }) && isMemoType({ type: newType })) {\n    if (!compareRegistered(oldType.type, newType.type)) {\n      return false;\n    }\n    if (oldType.type === newType.type || areDeepSwappable(oldType, newType)) {\n      if (baseType) {\n        // memo form different fibers, why?\n        if (baseType.$$typeof === newType.$$typeof) {\n          setNewType(newType);\n        } else {\n          setNewType(newType.type);\n        }\n      } else {\n        logger.warn('Please update hot-loader/react-dom');\n        if (isReactClass(newType.type)) {\n          setNewType(newType);\n        } else {\n          setNewType(newType.type);\n        }\n      }\n\n      return true;\n    }\n    return defaultResult;\n  }\n\n  if (isLazyType({ type: oldType })) {\n    updateLazy(oldType, newType);\n    // no need to update\n    // setNewType(newType);\n    return defaultResult;\n  }\n\n  if (isContextType({ type: oldType })) {\n    // update provider\n    setNewType(newType);\n    return defaultResult;\n  }\n\n  if (\n    typeof newType === 'function' &&\n    (defaultResult ||\n      (newType !== oldType && areSignaturesCompatible(newType, oldType) && areSwappable(newType, oldType)))\n  ) {\n    const unwrapFactory = newType[UNWRAP_PROXY];\n    const oldProxy = unwrapFactory && getProxyByType(unwrapFactory());\n    if (oldProxy) {\n      oldProxy.dereference();\n      updateProxyById(oldType[PROXY_KEY] || getIdByType(oldType), getInnerComponentType(newType));\n    } else {\n      setNewType(newType);\n    }\n    return true;\n  }\n\n  return defaultResult;\n};\n\nconst knownPairs = new WeakMap();\nconst emptyMap = new WeakMap();\n\nconst getKnownPair = (oldType, newType) => {\n  const pair = knownPairs.get(oldType) || emptyMap;\n  return pair.get(newType);\n};\n\nexport const hotComponentCompare = (oldType, preNewType, setNewType, baseType) => {\n  const hotActive = hotComparisonOpen();\n  const newType = configuration.integratedResolver ? resolveType(preNewType) : preNewType;\n\n  // TODO: find out the root cause\n  // we could not use \"fast result\" here - go a full part to update a fiber.\n  // const knownType = getKnownPair(oldType, newType);\n  // if (knownType !== undefined) {\n  //   return knownType;\n  // }\n\n  let result = oldType === newType;\n\n  if (hotActive) {\n    // pre fail components which could not be merged\n    if (\n      !isReloadableComponent(oldType) ||\n      !isReloadableComponent(newType) ||\n      isColdType(oldType) ||\n      isColdType(oldType) ||\n      !oldType ||\n      !newType ||\n      0\n    ) {\n      return result;\n    }\n\n    result = compareComponents(oldType, newType, setNewType, baseType);\n    const pair = knownPairs.get(oldType) || new WeakMap();\n    pair.set(newType, result);\n    knownPairs.set(oldType, pair);\n    return result;\n  }\n\n  // result - true if components are equal, or were \"equal\" at any point in the past\n  return result || getKnownPair(oldType, newType) || false;\n};\n"
  },
  {
    "path": "src/reconciler/fiberUpdater.js",
    "content": "/* eslint-disable no-underscore-dangle */\nimport React from 'react';\nimport configuration from '../configuration';\nimport { enterHotUpdate } from '../global/generation';\nimport AppContainer from '../AppContainer.dev';\nimport { resolveType } from './resolver';\n\nconst lazyConstructor = '_ctor';\n\nconst getLazyConstructor = target => {\n  // React 16\n  if (target[lazyConstructor]) {\n    return target[lazyConstructor];\n  }\n\n  // React 17\n  if (target._payload) {\n    return target._payload._result;\n  }\n  return null;\n};\n\nconst setLazyConstructor = (target, replacement) => {\n  replacement.isPatchedByReactHotLoader = true;\n\n  // React 16\n  if (target[lazyConstructor]) {\n    target[lazyConstructor] = replacement;\n  }\n  // React 17\n  else if (target._payload) {\n    target._payload._hotUpdated = true;\n    target._payload._result = replacement;\n  } else {\n    console.error('could not update lazy component');\n  }\n};\n\nconst patched = fn => {\n  fn.isPatchedByReactHotLoader = true;\n  return fn;\n};\n\nconst patchLazyConstructor = target => {\n  if (configuration.wrapLazy && !getLazyConstructor(target).isPatchedByReactHotLoader) {\n    const ctor = getLazyConstructor(target);\n    setLazyConstructor(target, () =>\n      ctor().then(m => {\n        const C = resolveType(m.default);\n        // chunks has been updated - new hot loader process is taking a place\n        enterHotUpdate();\n        if (!React.forwardRef) {\n          return {\n            default: patched(props => (\n              <AppContainer>\n                <C {...props} />\n              </AppContainer>\n            )),\n          };\n        }\n        return {\n          default: patched(\n            // eslint-disable-next-line prefer-arrow-callback\n            React.forwardRef(function HotLoaderLazyWrapper(props, ref) {\n              return (\n                <AppContainer>\n                  <C {...props} ref={ref} />\n                </AppContainer>\n              );\n            }),\n          ),\n        };\n      }),\n    );\n  }\n};\n\nexport const updateLazy = (target, type) => {\n  const ctor = getLazyConstructor(type);\n  if (getLazyConstructor(target) !== ctor) {\n    // just execute `import` and RHL.register will do the job\n    ctor();\n  }\n  patchLazyConstructor(target);\n  patchLazyConstructor(type);\n};\n\nexport const updateMemo = (target, { type }) => {\n  target.type = resolveType(type);\n};\n\nexport const updateForward = (target, { render }) => {\n  target.render = render;\n};\n\nexport const updateContext = () => {\n  // nil\n};\n"
  },
  {
    "path": "src/reconciler/hotReplacementRender.js",
    "content": "import { PROXY_IS_MOUNTED, PROXY_KEY, UNWRAP_PROXY } from '../proxy';\nimport { getIdByType, isRegisteredComponent, isTypeBlacklisted, updateProxyById } from './proxies';\nimport {\n  updateInstance,\n  getComponentDisplayName,\n  isFragmentNode,\n  isContextConsumer,\n  isContextProvider,\n  getContextProvider,\n  isReactClassInstance,\n  CONTEXT_CURRENT_VALUE,\n  isMemoType,\n  isLazyType,\n  isForwardType,\n} from '../internal/reactUtils';\nimport logger from '../logger';\nimport configuration, { internalConfiguration } from '../configuration';\nimport { areSwappable } from './utils';\nimport { resolveType } from './resolver';\nimport { hotRenderWithHooks } from '../internal/stack/hydrateFiberStack';\n\nlet renderStack = [];\n\nconst stackReport = () => {\n  const rev = renderStack.slice().reverse();\n  logger.warn('in', rev[0].name, rev);\n};\n\nconst emptyMap = new Map();\nconst stackContext = () => (renderStack[renderStack.length - 1] || {}).context || emptyMap;\n\nconst shouldUseRenderMethod = fn => fn && (isReactClassInstance(fn) || fn.SFC_fake);\n\nconst getElementType = child => (child.type[UNWRAP_PROXY] ? child.type[UNWRAP_PROXY]() : child.type);\n\nconst filterNullArray = a => {\n  if (!a) return [];\n  return a.filter(x => !!x);\n};\n\nconst unflatten = a =>\n  a.reduce((acc, a) => {\n    if (Array.isArray(a)) {\n      acc.push(...unflatten(a));\n    } else {\n      acc.push(a);\n    }\n    return acc;\n  }, []);\n\nconst isArray = fn => Array.isArray(fn);\nconst asArray = a => (isArray(a) ? a : [a]);\n\nconst render = (component, stack) => {\n  if (!component) {\n    return [];\n  }\n  if (component.hotComponentUpdate) {\n    component.hotComponentUpdate();\n  }\n  if (shouldUseRenderMethod(component)) {\n    // not calling real render method to prevent call recursion.\n    // stateless components does not have hotComponentRender\n    return component.hotComponentRender ? component.hotComponentRender() : component.render();\n  }\n  if (isForwardType(component)) {\n    // render forward type in a sandbox\n    return hotRenderWithHooks(stack.fiber, () => component.type.render(component.props, null));\n  }\n  if (isArray(component)) {\n    return component.map(render);\n  }\n  if (component.children) {\n    return component.children;\n  }\n\n  return [];\n};\n\nconst NO_CHILDREN = { children: [] };\nconst mapChildren = (children, instances) => ({\n  children: children.filter(c => c).map((child, index) => {\n    if (typeof child !== 'object' || child.isMerged) {\n      return child;\n    }\n    const instanceLine = instances[index] || {};\n    const oldChildren = asArray(instanceLine.children || []);\n\n    if (Array.isArray(child)) {\n      return {\n        type: null,\n        ...mapChildren(child, oldChildren),\n      };\n    }\n\n    const newChildren = asArray((child.props && child.props.children) || child.children || []);\n    const nextChildren = child.type !== 'function' && oldChildren.length && mapChildren(newChildren, oldChildren);\n\n    return {\n      nextProps: child.props,\n      isMerged: true,\n      ...instanceLine,\n      // actually child merge is needed only for \"HTML TAG\"s, and usually don't work for Components.\n      // the children from an instance or rendered children\n      // while children from a props is just a props.\n      // they could not exists. they could differ.\n      ...(nextChildren || {}),\n      type: child.type,\n    };\n  }),\n});\n\nconst mergeInject = (a, b, instance) => {\n  if (a && !Array.isArray(a)) {\n    return mergeInject([a], b);\n  }\n  if (b && !Array.isArray(b)) {\n    return mergeInject(a, [b]);\n  }\n\n  if (!a || !b) {\n    return NO_CHILDREN;\n  }\n  if (a.length === b.length) {\n    return mapChildren(a, b);\n  }\n\n  // in some cases (no confidence here) B could contain A except null children\n  // in some cases - could not.\n  // this depends on React version and the way you build component.\n\n  const nonNullA = filterNullArray(a);\n  if (nonNullA.length === b.length) {\n    return mapChildren(nonNullA, b);\n  }\n\n  const flatA = unflatten(nonNullA);\n  const flatB = unflatten(b);\n  if (flatA.length === flatB.length) {\n    return mapChildren(flatA, flatB);\n  }\n  if (flatB.length === 0 && flatA.length === 1 && typeof flatA[0] !== 'object') {\n    // terminal node\n  } else if (!configuration.IS_REACT_MERGE_ENABLED) {\n    logger.warn(`React-hot-loader: unable to merge `, a, 'and children of ', instance);\n    stackReport();\n  }\n  return NO_CHILDREN;\n};\n\nconst transformFlowNode = flow =>\n  flow.reduce((acc, node) => {\n    if (node && isFragmentNode(node)) {\n      if (node.props && node.props.children) {\n        return [...acc, ...filterNullArray(asArray(node.props.children))];\n      }\n      if (node.children) {\n        return [...acc, ...filterNullArray(asArray(node.children))];\n      }\n    }\n    return [...acc, node];\n  }, []);\n\nlet scheduledUpdates = [];\nlet scheduledUpdate = 0;\n\nexport const flushScheduledUpdates = () => {\n  const instances = scheduledUpdates;\n  scheduledUpdates = [];\n  scheduledUpdate = 0;\n  instances.forEach(instance => instance[PROXY_IS_MOUNTED] && updateInstance(instance));\n};\n\nexport const unscheduleUpdate = instance => {\n  scheduledUpdates = scheduledUpdates.filter(inst => inst !== instance);\n};\n\nconst scheduleInstanceUpdate = instance => {\n  scheduledUpdates.push(instance);\n  if (!scheduledUpdate) {\n    scheduledUpdate = setTimeout(flushScheduledUpdates, 4);\n  }\n};\n\nconst hotReplacementRender = (instance, stack) => {\n  if (isReactClassInstance(instance)) {\n    const type = getElementType(stack);\n\n    renderStack.push({\n      name: getComponentDisplayName(type),\n      type,\n      props: stack.instance.props,\n      context: stackContext(),\n    });\n  }\n\n  try {\n    const flow = transformFlowNode(filterNullArray(asArray(render(instance, stack))));\n\n    const { children } = stack;\n\n    flow.forEach((child, index) => {\n      let childType = child.type;\n      const stackChild = children[index];\n      const next = instance => {\n        // copy over props as long new component may be hidden inside them\n        // child does not have all props, as long some of them can be calculated on componentMount.\n        const realProps = instance.props;\n        const nextProps = {\n          ...realProps,\n          ...(child.nextProps || {}),\n          ...(child.props || {}),\n        };\n\n        if (isReactClassInstance(instance) && instance.componentWillUpdate) {\n          // Force-refresh component (bypass redux renderedComponent)\n          instance.componentWillUpdate({ ...realProps }, instance.state);\n        }\n        instance.props = nextProps;\n        hotReplacementRender(instance, stackChild);\n        instance.props = realProps;\n      };\n\n      // text node\n      if (typeof child !== 'object' || !stackChild || !stackChild.instance) {\n        if (stackChild && stackChild.children && stackChild.children.length) {\n          logger.error(\n            'React-hot-loader: reconciliation failed',\n            'could not dive into [',\n            child,\n            '] while some elements are still present in the tree.',\n          );\n          stackReport();\n        }\n        return;\n      }\n\n      // comparing rendered type to fiber.ElementType\n      if (typeof childType !== typeof stackChild.elementType) {\n        // Portals could generate undefined !== null\n        if (childType && stackChild.type) {\n          logger.warn('React-hot-loader: got ', childType, 'instead of', stackChild.type);\n          stackReport();\n        }\n        return;\n      }\n\n      if (isMemoType(child) || isLazyType(child)) {\n        // force update memo children\n        if (stackChild.children && stackChild.children[0]) {\n          scheduleInstanceUpdate(stackChild.children[0].instance);\n        }\n        childType = childType.type || childType;\n      }\n\n      if (isForwardType(child)) {\n        next(stackChild.instance);\n      } else if (isContextConsumer(child)) {\n        try {\n          const contextValue = stackContext().get(getContextProvider(childType));\n          next({\n            children: (child.props ? child.props.children : child.children[0])(\n              contextValue !== undefined ? contextValue : childType[CONTEXT_CURRENT_VALUE],\n            ),\n          });\n        } catch (e) {\n          // do nothing, yet\n        }\n      } else if (typeof childType !== 'function') {\n        // React\n        let childName = childType ? getComponentDisplayName(childType) : 'empty';\n        let extraContext = stackContext();\n\n        if (isContextProvider(child)) {\n          extraContext = new Map(extraContext);\n          extraContext.set(\n            getContextProvider(childType),\n            {\n              ...(child.nextProps || {}),\n              ...(child.props || {}),\n            }.value,\n          );\n          childName = 'ContextProvider';\n        }\n\n        renderStack.push({\n          name: childName,\n          type: childType,\n          props: stack.instance.props,\n          context: extraContext,\n        });\n\n        next(\n          // move types from render to the instances of hydrated tree\n          mergeInject(\n            transformFlowNode(asArray(child.props ? child.props.children : child.children)),\n            stackChild.instance.children,\n            stackChild.instance,\n          ),\n        );\n        renderStack.pop();\n      } else {\n        if (childType === stackChild.type) {\n          next(stackChild.instance);\n        } else {\n          // unwrap proxy\n          let childType = getElementType(child);\n\n          if (isMemoType(child)) {\n            childType = childType.type || childType;\n          }\n\n          if (!stackChild.type[PROXY_KEY]) {\n            if (!configuration.IS_REACT_MERGE_ENABLED) {\n              if (isTypeBlacklisted(stackChild.type)) {\n                logger.warn('React-hot-loader: cold element got updated ', stackChild.type);\n              }\n            }\n          }\n\n          if (isRegisteredComponent(childType) || isRegisteredComponent(stackChild.type)) {\n            // one of elements are registered via babel plugin, and should not be handled by hot swap\n            if (resolveType(childType) === resolveType(stackChild.type)) {\n              next(stackChild.instance);\n            } else {\n              // one component replace another. This is normal situation\n            }\n          } else if (areSwappable(childType, stackChild.type)) {\n            // they are both registered, or have equal code/displayname/signature\n\n            // update proxy using internal PROXY_KEY\n            updateProxyById(stackChild.type[PROXY_KEY] || getIdByType(stackChild.type), childType);\n\n            next(stackChild.instance);\n          } else {\n            logger.warn(\n              `React-hot-loader: a ${getComponentDisplayName(childType)} was found where a ${getComponentDisplayName(\n                stackChild,\n              )} was expected.\n          ${childType}`,\n            );\n            stackReport();\n          }\n        }\n\n        scheduleInstanceUpdate(stackChild.instance);\n      }\n    });\n  } catch (e) {\n    if (e.then) {\n      // this is probably Suspense. Do nothing\n    } else {\n      logger.warn('React-hot-loader: run time error during reconciliation', e);\n    }\n  }\n\n  if (isReactClassInstance(instance)) {\n    renderStack.pop();\n  }\n};\n\nexport default (instance, stack) => {\n  if (configuration.disableHotRenderer) {\n    return;\n  }\n  try {\n    // disable reconciler to prevent upcoming components from proxying.\n    internalConfiguration.disableProxyCreation = true;\n    renderStack = [];\n    hotReplacementRender(instance, stack);\n  } catch (e) {\n    logger.warn('React-hot-loader: reconcilation failed due to error', e);\n  } finally {\n    internalConfiguration.disableProxyCreation = false;\n  }\n};\n"
  },
  {
    "path": "src/reconciler/index.js",
    "content": "import getReactStack, { deepMarkUpdate, cleanupReact } from '../internal/getReactStack';\nimport hotReplacementRender, { flushScheduledUpdates, unscheduleUpdate } from './hotReplacementRender';\n\nconst reconcileHotReplacement = ReactInstance => {\n  const stack = getReactStack(ReactInstance);\n  hotReplacementRender(ReactInstance, stack);\n  cleanupReact();\n  deepMarkUpdate(stack);\n};\n\nexport { flushScheduledUpdates, unscheduleUpdate };\n\nexport default reconcileHotReplacement;\n"
  },
  {
    "path": "src/reconciler/proxies.js",
    "content": "import createProxy, { PROXY_KEY } from '../proxy';\nimport { resetClassProxies } from '../proxy/createClassProxy';\nimport { isCompositeComponent, isReactClass } from '../internal/reactUtils';\nimport configuration from '../configuration';\nimport { incrementHotGeneration } from '../global/generation';\nimport { merge } from './utils';\n\nlet signatures;\nlet proxiesByID;\nlet blackListedProxies;\nlet registeredComponents;\nlet idsByType;\n\nlet elementCount = 0;\nlet renderOptions = {};\n\nlet componentOptions;\n\nconst generateTypeId = () => `auto-${elementCount++}`;\n\nexport const getIdByType = type => idsByType.get(type);\nexport const isProxyType = type => type[PROXY_KEY];\n\nexport const getProxyById = id => proxiesByID[id];\nexport const getProxyByType = type => getProxyById(getIdByType(type));\n\nexport const registerComponent = type => registeredComponents.set(type, 1);\nexport const isRegisteredComponent = type => registeredComponents.has(type);\n\nexport const setStandInOptions = options => {\n  renderOptions = options;\n};\n\nexport const updateFunctionProxyById = (id, type, updater) => {\n  // Remember the ID.\n  idsByType.set(type, id);\n  const proxy = proxiesByID[id];\n  if (!proxy) {\n    proxiesByID[id] = type;\n  }\n  updater(proxiesByID[id], type);\n  // proxiesByID[id] = type; // keep the first ref\n\n  return proxiesByID[id];\n};\n\nexport const updateProxyById = (id, type, options = {}) => {\n  if (!id) {\n    return null;\n  }\n  // Remember the ID.\n  idsByType.set(type, id);\n\n  if (!proxiesByID[id]) {\n    proxiesByID[id] = createProxy(\n      type,\n      id,\n      merge({}, renderOptions, { proxy: componentOptions.get(type) || {} }, options),\n    );\n  } else if (proxiesByID[id].update(type)) {\n    // proxy could be registered again only in case of HMR\n    incrementHotGeneration();\n  }\n  return proxiesByID[id];\n};\n\nexport const createProxyForType = (type, options) =>\n  getProxyByType(type) || updateProxyById(generateTypeId(), type, options);\n\nexport const isColdType = type => blackListedProxies.has(type);\n\nexport const isTypeBlacklisted = type =>\n  isColdType(type) ||\n  (isCompositeComponent(type) &&\n    ((configuration.ignoreSFC && !isReactClass(type)) || (configuration.ignoreComponents && isReactClass(type))));\nexport const blacklistByType = type => blackListedProxies.set(type, true);\n\nexport const setComponentOptions = (component, options) => componentOptions.set(component, options);\n\nexport const addSignature = (type, signature) => signatures.set(type, signature);\nexport const getSignature = type => signatures.get(type);\n\nexport const resetProxies = () => {\n  proxiesByID = {};\n  idsByType = new WeakMap();\n  blackListedProxies = new WeakMap();\n  registeredComponents = new WeakMap();\n  componentOptions = new WeakMap();\n  signatures = new WeakMap();\n  resetClassProxies();\n};\n\nresetProxies();\n"
  },
  {
    "path": "src/reconciler/proxyAdapter.js",
    "content": "import React from 'react';\nimport { enterHotUpdate, get as getGeneration, hotComparisonOpen, setComparisonHooks } from '../global/generation';\nimport { getProxyByType, setStandInOptions } from './proxies';\nimport reconcileHotReplacement, { flushScheduledUpdates, unscheduleUpdate } from './index';\nimport configuration, { internalConfiguration } from '../configuration';\nimport { EmptyErrorPlaceholder, logException } from '../errorReporter';\nimport { RENDERED_GENERATION } from '../proxy';\n\nexport const renderReconciler = (target, force) => {\n  // we are not inside parent reconcilation\n  const currentGeneration = getGeneration();\n  const componentGeneration = target[RENDERED_GENERATION];\n\n  target[RENDERED_GENERATION] = currentGeneration;\n\n  if (!internalConfiguration.disableProxyCreation) {\n    if ((componentGeneration || force) && componentGeneration !== currentGeneration) {\n      enterHotUpdate();\n      reconcileHotReplacement(target);\n      return true;\n    }\n  }\n  return false;\n};\n\nfunction asyncReconciledRender(target) {\n  renderReconciler(target, false);\n}\n\nexport function proxyWrapper(element) {\n  // post wrap on post render\n  if (!internalConfiguration.disableProxyCreation) {\n    unscheduleUpdate(this);\n  }\n\n  if (!element) {\n    return element;\n  }\n  if (Array.isArray(element)) {\n    return element.map(proxyWrapper);\n  }\n  if (typeof element.type === 'function') {\n    const proxy = getProxyByType(element.type);\n    if (proxy) {\n      return {\n        ...element,\n        type: proxy.get(),\n      };\n    }\n  }\n  return element;\n}\n\nconst ERROR_STATE = 'react_hot_loader_catched_error';\nconst ERROR_STATE_PROTO = 'react_hot_loader_catched_error-prototype';\nconst OLD_RENDER = 'react_hot_loader_original_render';\n\nfunction componentDidCatch(error, errorInfo) {\n  this[ERROR_STATE] = {\n    location: 'boundary',\n    error,\n    errorInfo,\n    generation: getGeneration(),\n  };\n  Object.getPrototypeOf(this)[ERROR_STATE_PROTO] = this[ERROR_STATE];\n  if (!configuration.errorReporter) {\n    logException(error, errorInfo, this);\n  }\n  this.forceUpdate();\n}\n\nfunction componentRender(...args) {\n  const { error, errorInfo, generation } = this[ERROR_STATE] || {};\n\n  if (error && generation === getGeneration()) {\n    return React.createElement(configuration.errorReporter || EmptyErrorPlaceholder, {\n      error,\n      errorInfo,\n      component: this,\n    });\n  }\n\n  if (this.hotComponentUpdate) {\n    this.hotComponentUpdate();\n  }\n  try {\n    return this[OLD_RENDER].render.call(this, ...args);\n  } catch (renderError) {\n    this[ERROR_STATE] = {\n      location: 'render',\n      error: renderError,\n      generation: getGeneration(),\n    };\n    if (!configuration.errorReporter) {\n      logException(renderError, undefined, this);\n    }\n    return componentRender.call(this);\n  }\n}\n\nexport function retryHotLoaderError() {\n  delete this[ERROR_STATE];\n  this.forceUpdate();\n}\n\nsetComparisonHooks(\n  () => ({}),\n  component => {\n    if (!hotComparisonOpen()) {\n      return;\n    }\n    const { prototype } = component;\n    if (!prototype[OLD_RENDER]) {\n      const renderDescriptior = Object.getOwnPropertyDescriptor(prototype, 'render');\n      prototype[OLD_RENDER] = {\n        descriptor: renderDescriptior ? renderDescriptior.value : undefined,\n        render: prototype.render,\n      };\n      prototype.componentDidCatch = componentDidCatch;\n      prototype.retryHotLoaderError = retryHotLoaderError;\n\n      prototype.render = componentRender;\n    }\n    delete prototype[ERROR_STATE];\n  },\n  ({ prototype }) => {\n    if (prototype[OLD_RENDER]) {\n      const { generation } = prototype[ERROR_STATE_PROTO] || {};\n\n      if (generation === getGeneration()) {\n        // still in error.\n        // keep render hooked\n      } else {\n        delete prototype.componentDidCatch;\n        delete prototype.retryHotLoaderError;\n\n        // undo only what we did\n        if (prototype.render === componentRender) {\n          if (!prototype[OLD_RENDER].descriptor) {\n            delete prototype.render;\n          } else {\n            prototype.render = prototype[OLD_RENDER].descriptor;\n          }\n        } else {\n          console.error('React-Hot-Loader: something unexpectedly mutated Component', prototype);\n        }\n        delete prototype[ERROR_STATE_PROTO];\n        delete prototype[OLD_RENDER];\n      }\n    }\n  },\n);\n\nsetStandInOptions({\n  componentWillRender: asyncReconciledRender,\n  componentDidRender: proxyWrapper,\n  componentDidUpdate: component => {\n    component[RENDERED_GENERATION] = getGeneration();\n    flushScheduledUpdates();\n  },\n});\n"
  },
  {
    "path": "src/reconciler/resolver.js",
    "content": "import { createProxyForType, getProxyByType, isProxyType, isTypeBlacklisted } from './proxies';\nimport {\n  getComponentDisplayName,\n  isCompositeComponent,\n  isContextType,\n  isForwardType,\n  isLazyType,\n  isMemoType,\n} from '../internal/reactUtils';\nimport configuration, { internalConfiguration } from '../configuration';\n\nconst shouldNotPatchComponent = type => isTypeBlacklisted(type);\n\nexport function resolveUtility(type) {\n  // all \"utility\" types are resolved to their __initial__ shapes\n  // that enables to never change reference to them, and gives the ability to maintain React Tree on HMR\n\n  // all operations could be skipped with react-hot-dom enabled\n\n  if (typeof type === 'object') {\n    if (configuration.integratedComparator) {\n      return type;\n    }\n    const element = { type };\n    if (isLazyType(element) || isMemoType(element) || isForwardType(element) || isContextType(element)) {\n      return getProxyByType(type) || type;\n    }\n  }\n\n  return undefined;\n}\n\nexport function resolveComponent(type, options = {}) {\n  const existingProxy = getProxyByType(type);\n\n  // cold API\n  if (shouldNotPatchComponent(type)) {\n    return existingProxy ? existingProxy.getCurrent() : type;\n  }\n\n  if (!existingProxy && configuration.onComponentCreate) {\n    configuration.onComponentCreate(type, getComponentDisplayName(type));\n    if (shouldNotPatchComponent(type)) {\n      return type;\n    }\n  }\n\n  const proxy = internalConfiguration.disableProxyCreation ? existingProxy : createProxyForType(type, options);\n\n  return proxy ? proxy.get() : undefined;\n}\n\nexport function resolveProxy(type) {\n  if (isProxyType(type)) {\n    return type;\n  }\n\n  return undefined;\n}\n\nexport function resolveNotComponent(type) {\n  if (!isCompositeComponent(type)) {\n    return type;\n  }\n\n  return undefined;\n}\n\nexport const getLatestTypeVersion = type => {\n  const existingProxy = getProxyByType(type);\n  return existingProxy && existingProxy.getCurrent && existingProxy.getCurrent();\n};\n\nexport const resolveSimpleType = type => {\n  if (!type) {\n    return type;\n  }\n\n  const simpleResult = resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type);\n  if (simpleResult) {\n    return simpleResult;\n  }\n\n  const lastType = getLatestTypeVersion(type);\n\n  // only lazy loaded components any now failing into this branch\n\n  // if (lastType && lastType !== type) {\n  //   console.warn('RHL: used type', type, 'is obsolete. Something is wrong with HMR.');\n  // }\n\n  return lastType || type;\n};\n\nexport const resolveType = (type, options = {}) => {\n  if (!type) {\n    return type;\n  }\n\n  return (\n    resolveProxy(type) || resolveUtility(type) || resolveNotComponent(type) || resolveComponent(type, options) || type\n  );\n};\n"
  },
  {
    "path": "src/reconciler/utils.js",
    "content": "import levenshtein from 'fast-levenshtein';\nimport { getIdByType } from './proxies';\nimport { getComponentDisplayName, isReactClass } from '../internal/reactUtils';\n\n// some `empty` names, React can autoset display name to...\nconst UNDEFINED_NAMES = {\n  Unknown: true,\n  Component: true,\n};\n\nconst areNamesEqual = (a, b) => a === b || (UNDEFINED_NAMES[a] && UNDEFINED_NAMES[b]);\n\nconst isFunctional = fn => typeof fn === 'function';\nconst getTypeOf = type => {\n  if (isReactClass(type)) return 'ReactComponent';\n  if (isFunctional(type)) return 'StatelessFunctional';\n  return 'Fragment'; // ?\n};\n\nfunction clearStringFast(str) {\n  return str.length < 12 ? str : ` ${str}`.slice(1);\n}\n\nconst haveTextSimilarity = (a, b) =>\n  // equal or slight changed\n  a === b || levenshtein.get(clearStringFast(a), clearStringFast(b)) < a.length * 0.2;\n\nconst getBaseProto = source =>\n  source.prototype.hotComponentRender ? Object.getPrototypeOf(source.prototype) : source.prototype;\n\nconst equalClasses = (a, b) => {\n  const prototypeA = getBaseProto(a);\n  const prototypeB = getBaseProto(b);\n\n  let hits = 0;\n  let misses = 0;\n  let comparisons = 0;\n  Object.getOwnPropertyNames(prototypeA).forEach(key => {\n    const descriptorA = Object.getOwnPropertyDescriptor(prototypeA, key);\n    const valueA = descriptorA && (descriptorA.value || descriptorA.get || descriptorA.set);\n    const descriptorB = Object.getOwnPropertyDescriptor(prototypeB, key);\n    const valueB = descriptorB && (descriptorB.value || descriptorB.get || descriptorB.set);\n\n    if (typeof valueA === 'function' && key !== 'constructor') {\n      comparisons++;\n      if (haveTextSimilarity(String(valueA), String(valueB))) {\n        hits++;\n      } else {\n        misses++;\n        if (key === 'render') {\n          misses++;\n        }\n      }\n    }\n  });\n  // allow to add or remove one function\n  return (hits > 0 && misses <= 1) || comparisons === 0;\n};\n\nexport const areSwappable = (a, b) => {\n  // both are registered components and have the same name\n  if (getIdByType(b) && getIdByType(a) === getIdByType(b)) {\n    return true;\n  }\n  if (getTypeOf(a) !== getTypeOf(b)) {\n    return false;\n  }\n  if (isReactClass(a)) {\n    return areNamesEqual(getComponentDisplayName(a), getComponentDisplayName(b)) && equalClasses(a, b);\n  }\n\n  if (isFunctional(a)) {\n    const nameA = getComponentDisplayName(a);\n    if (!areNamesEqual(nameA, getComponentDisplayName(b))) {\n      return false;\n    }\n    return nameA !== 'Component' || haveTextSimilarity(String(a), String(b));\n  }\n  return false;\n};\n\nexport function merge(...sources) {\n  let acc = {};\n  for (const source of sources) {\n    if (source instanceof Array) {\n      if (!(acc instanceof Array)) {\n        acc = [];\n      }\n      acc = [...acc, ...source];\n    } else if (source instanceof Object) {\n      for (const key of Object.keys(source)) {\n        let value = source[key];\n        if (value instanceof Object && key in acc) {\n          value = merge(acc[key], value);\n        }\n        acc = { ...acc, [key]: value };\n      }\n    }\n  }\n  return acc;\n}\n"
  },
  {
    "path": "src/utils/runQueue.js",
    "content": "export const createQueue = (runner = a => a()) => {\n  let promise;\n  let queue = [];\n\n  const runAll = () => {\n    const oldQueue = queue;\n    oldQueue.forEach(cb => cb());\n    queue = [];\n  };\n\n  const add = cb => {\n    if (queue.length === 0) {\n      promise = Promise.resolve().then(() => runner(runAll));\n    }\n    queue.push(cb);\n\n    return promise;\n  };\n\n  return add;\n};\n"
  },
  {
    "path": "src/utils.dev.js",
    "content": "import { blacklistByType, getProxyByType, setComponentOptions } from './reconciler/proxies';\nimport { setConfiguration } from './configuration';\nimport { hotComponentCompare } from './reconciler/componentComparator';\n\nconst getProxyOrType = type => {\n  const proxy = getProxyByType(type);\n  return proxy ? proxy.get() : type;\n};\n\nexport const areComponentsEqual = (a, b) => getProxyOrType(a) === getProxyOrType(b);\n\nexport const compareOrSwap = (oldType, newType) => hotComponentCompare(oldType, newType);\n\nexport const cold = type => {\n  blacklistByType(type);\n  return type;\n};\n\nexport const configureComponent = (component, options) => setComponentOptions(component, options);\n\nexport const setConfig = config => setConfiguration(config);\n"
  },
  {
    "path": "src/utils.prod.js",
    "content": "export const areComponentsEqual = (a, b) => a === b;\nexport const setConfig = () => {};\nexport const cold = type => type;\nexport const configureComponent = () => {};\n"
  },
  {
    "path": "src/webpack/index.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst {SourceNode, SourceMapConsumer} = require('source-map');\nconst loaderUtils = require('loader-utils');\nconst makeIdentitySourceMap = require('./makeIdentitySourceMap');\nconst patch = require('./patch');\n\nlet tagCommonJSExportsSource = null;\n\nfunction transform(source, map) {\n  const callback = this.async();\n  const resourcePath = this.resourcePath;\n\n  if (process.env.NODE_ENV === 'production') {\n    return callback(null, source, map);\n  }\n  if (source && source.types && source.types.IfStatement) {\n    throw new Error(\n      'React Hot Loader: You are erroneously trying to use a Webpack loader ' +\n      'as a Babel plugin. Replace \"react-hot-loader/webpack\" with ' +\n      '\"react-hot-loader/babel\" in the \"plugins\" section of your .babelrc file. ' +\n      'While we recommend the above, if you prefer not to use Babel, ' +\n      'you may remove \"react-hot-loader/webpack\" from the \"plugins\" section of ' +\n      'your .babelrc file altogether, and instead add \"react-hot-loader/webpack\" ' +\n      'to the \"loaders\" section of your Webpack configuration.',\n    );\n  }\n\n  if (this.cacheable) {\n    this.cacheable();\n  }\n\n  const options = Object.assign({withPatch: true}, loaderUtils.getOptions(this));\n  if (options.withPatch) {\n    source = patch(source);\n  }\n\n  if (source.indexOf('reactHotLoader.register') > 0 || options.noRegister) {\n    return callback(null, source, map);\n  }\n  // This is a Webpack loader, but the user put it in the Babel config.\n\n  // Read the helper once.\n  if (!tagCommonJSExportsSource) {\n    tagCommonJSExportsSource = fs\n      .readFileSync(path.join(__dirname, 'webpackTagCommonJSExports.js'), 'utf8')\n      // Babel inserts these.\n      // Ideally we'd opt out for one file but this is simpler.\n      .replace(/['\"]use strict['\"];/, '')\n      // eslint comments don't need to end up in the output\n      .replace(/\\/\\* (.*) \\*\\//, '')\n      .replace(/\\/\\/ eslint-disable-line .*\\n/g, '\\n')\n      .replace(/\\/\\* global.*\\*\\//, '')\n      .split(/\\n\\s*/)\n      .join(' ');\n  }\n\n  // Parameterize the helper with the current filename.\n  const separator = '\\n';\n  const appendText = tagCommonJSExportsSource.replace(/__FILENAME__/g, JSON.stringify(resourcePath));\n\n  if (this.sourceMap === false) {\n    return callback(null, [source, appendText].join(separator));\n  }\n\n  if (!map) {\n    map = makeIdentitySourceMap(source, resourcePath); // eslint-disable-line no-param-reassign\n  }\n  const sourceMapConsumer = new SourceMapConsumer(map);\n\n  const onSourceMapReady = consumedMap => {\n    const node = new SourceNode(null, null, null, [\n      SourceNode.fromStringWithSourceMap(source, consumedMap),\n      new SourceNode(null, null, resourcePath, appendText),\n    ]).join(separator);\n    const result = node.toStringWithSourceMap();\n    callback(null, result.code, result.map.toJSON() || undefined);\n  };\n\n  if (sourceMapConsumer.then) {\n    sourceMapConsumer.then(onSourceMapReady);\n  } else {\n    onSourceMapReady(sourceMapConsumer);\n  }\n}\n\ntransform.patch = patch;\n\nmodule.exports = transform;\n"
  },
  {
    "path": "src/webpack/makeIdentitySourceMap.js",
    "content": "const { SourceMapGenerator } = require('source-map');\n\nfunction makeIdentitySourceMap(content, resourcePath) {\n  const map = new SourceMapGenerator();\n  map.setSourceContent(resourcePath, content);\n\n  content.split('\\n').forEach((line, index) => {\n    map.addMapping({\n      source: resourcePath,\n      original: {\n        line: index + 1,\n        column: 0,\n      },\n      generated: {\n        line: index + 1,\n        column: 0,\n      },\n    });\n  });\n\n  return map.toJSON();\n}\n\nmodule.exports = makeIdentitySourceMap;\n"
  },
  {
    "path": "src/webpack/patch.js",
    "content": "const injectionStart = {\n  '16.13': [\n    'isCompatibleFamilyForHotReloading(child, element)',\n    'hotCompareElements(child.elementType, element.type, hotUpdateChild(child), child.type)'\n  ],\n  '16.10': [\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || ( // Keep this check inline so it only runs on the false path:\\n        isCompatibleFamilyForHotReloading(child, element)))',\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, hotUpdateChild(child), child.type))'\n  ],\n  '16.9': [\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type || (\\n        // Keep this check inline so it only runs on the false path:\\n        isCompatibleFamilyForHotReloading(child, element)))',\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, hotUpdateChild(child), child.type))'\n  ],\n  '16.6': [\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type)',\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, hotUpdateChild(child), child.type))',\n  ],\n  '16.6-compact': [\n    'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.elementType===element.type)',\n    'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type, hotUpdateChild(child), child.type))',\n  ],\n  '16.4': [\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {',\n    'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type, hotUpdateChild(child), child.type)) {',\n  ],\n  '16.4-compact': [\n    'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.type===element.type)',\n    'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type, hotUpdateChild(child), child.type))',\n  ],\n};\n\nconst additional = {\n  '16.13-update': [\n    'isCompatibleFamilyForHotReloading(current, element)',\n    'hotCompareElements(current.elementType, element.type, hotUpdateChild(current), current.type)'\n  ],\n  '16.10-update': [\n    'current$$1.elementType === element.type || ( // Keep this check inline so it only runs on the false path:\\n    isCompatibleFamilyForHotReloading(current$$1, element)))',\n    '(hotCompareElements(current$$1.elementType, element.type, hotUpdateChild(current$$1), current$$1.type)))'\n  ],\n  '16.9-update': [\n    'current$$1.elementType === element.type || (\\n    // Keep this check inline so it only runs on the false path:\\n    isCompatibleFamilyForHotReloading(current$$1, element)))',\n    '(hotCompareElements(current$$1.elementType, element.type, hotUpdateChild(current$$1), current$$1.type)))'\n  ],\n  '16.6-update': [\n    'if (current$$1 !== null && current$$1.elementType === element.type) {',\n    'if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type, hotUpdateChild(current$$1),current$$1.type)) {',\n  ],\n  '16.6-update-compact': [\n    'if(current$$1!==null&&current$$1.elementType===element.type)',\n    'if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type,hotUpdateChild(current$$1),current$$1.type))',\n  ],\n  '16.4-update': [\n    'if (current !== null && current.type === element.type) {',\n    'if (current !== null && hotCompareElements(current.type, element.type, hotUpdateChild(current),current.type)) {',\n  ],\n  '16.4-update-compact': [\n    'if (current!== null&&current.type===element.type)',\n    'if (current!== null&&hotCompareElements(current.type,element.type,hotUpdateChild(current)))',\n  ],\n\n  '17.0.0-rc1': [\n    'function createFiberFromTypeAndProps(type, // React$ElementType\\n' +\n    'key, pendingProps, owner, mode, lanes) {',\n    'function createFiberFromTypeAndProps(type, // React$ElementType\\n' +\n    'key, pendingProps, owner, mode, lanes) {type = hotResolveType(type);',\n  ],\n\n  '17.0.0-rc1-compact': [\n    'function createFiberFromTypeAndProps(type,// React$ElementType\\n' +\n    'key,pendingProps,owner,mode,lanes){',\n    'function createFiberFromTypeAndProps(type,// React$ElementType\\n' +\n    'key,pendingProps,owner,mode,lanes){type = hotResolveType(type);',\n  ],\n\n  '16.8-type': [\n    'function createFiberFromTypeAndProps(type, // React$ElementType\\nkey, pendingProps, owner, mode, expirationTime) {',\n    'function createFiberFromTypeAndProps(type, // React$ElementType\\nkey, pendingProps, owner, mode, expirationTime) {type = hotResolveType(type);',\n  ],\n\n  '16.8-type-compact': [\n    'function createFiberFromTypeAndProps(type,// React$ElementType\\nkey,pendingProps,owner,mode,expirationTime){',\n    'function createFiberFromTypeAndProps(type,// React$ElementType\\nkey,pendingProps,owner,mode,expirationTime){type = hotResolveType(type);',\n  ]\n};\n\n\nconst reactHotLoaderCode = `\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 hotResolveType = function (type) {\n  return type;\n};\nvar hotCompareElements = function (oldType, newType) {\n  return oldType === newType\n};\nvar hotCleanupHooks = function () {\n  if (typeof resetHooks !== 'undefined') {\n    resetHooks();\n  }\n}\n\nvar evalInReactContext = function (injection) {\n  return eval(injection);\n};\nvar hotCleanup = hotCleanupHooks;\nvar 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}\nvar setHotElementComparator = function (newComparator) {\n  hotCompareElements = newComparator\n};\nvar setHotTypeResolver = function (newResolver) {\n  hotResolveType = newResolver;\n};\n`;\n\nconst CJS = `\n${reactHotLoaderCode};\n\nvar ReactDOM = {\n  evalInReactContext: evalInReactContext,\n  hotCleanup: hotCleanup,\n  hotRenderWithHooks: hotRenderWithHooks,\n  setHotElementComparator: setHotElementComparator,\n  setHotTypeResolver: setHotTypeResolver,\n`;\n\nconst commonJSEnd = ['var ReactDOM = {', CJS];\nconst commonJSEndCompact = ['var ReactDOM={', CJS];\n\nconst ESM = `\n${reactHotLoaderCode};\n\nexports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;\n\nexports.evalInReactContext= evalInReactContext,\nexports.hotCleanup= hotCleanup,\nexports.hotRenderWithHooks= hotRenderWithHooks,\nexports.setHotElementComparator= setHotElementComparator,\nexports.setHotTypeResolver= setHotTypeResolver,\n`;\n\nconst esmEnd = ['exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;', ESM];\n\nconst injectionEnd = {\n  '16.13': esmEnd,\n  '16.10': commonJSEnd,\n  '16.9': commonJSEnd,\n  '16.6': commonJSEnd,\n  '16.4': commonJSEnd,\n  '16.6-compact': commonJSEndCompact,\n  '16.4-compact': commonJSEndCompact,\n};\n\nconst sign = '/* 🔥 this is hot-loader/react-dom 🔥 */';\n\nfunction additionalTransform(source) {\n  for (const key in additional) {\n    source = source.split(additional[key][0]).join(additional[key][1]);\n  }\n  return source;\n}\n\nfunction transform(source) {\n  if (source.indexOf('reconcileSingleElement') < 0) {\n    // early reject\n    return source;\n  }\n  if (source.indexOf(sign) >= 0) {\n    // already patched\n    return source;\n  }\n  for (const key in injectionStart) {\n    if (source.indexOf(injectionStart[key][0]) > 0 && source.indexOf(injectionEnd[key][0]) > 0) {\n      const result = additionalTransform(\n        source\n          .replace(injectionStart[key][0], injectionStart[key][1])\n          .replace(injectionEnd[key][0], injectionEnd[key][1]),\n      );\n      return `${sign}\\n${result}\\n${sign}`;\n    }\n  }\n  return source;\n}\n\nmodule.exports = transform;\n"
  },
  {
    "path": "src/webpack/webpackTagCommonJSExports.js",
    "content": "/* eslint-disable global-require, import/no-unresolved, no-var, camelcase, func-names, no-void */\n/* global __FILENAME__, reactHotLoaderGlobal */\n\nvoid (function register() {\n  // eslint-disable-line no-extra-semi\n  /* react-hot-loader/webpack */\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  /* eslint-disable camelcase, no-undef */\n  const webpackExports = typeof __webpack_exports__ !== 'undefined' ? __webpack_exports__ : exports;\n  /* eslint-enable camelcase, no-undef */\n  if (!webpackExports) {\n    return;\n  }\n\n  if (typeof webpackExports === 'function') {\n    reactHotLoader.register(webpackExports, 'module.exports', __FILENAME__);\n    return;\n  }\n\n  /* eslint-disable no-restricted-syntax */\n  for (const key in webpackExports) {\n    /* eslint-enable no-restricted-syntax */\n    if (!Object.prototype.hasOwnProperty.call(webpackExports, key)) {\n      continue;\n    }\n\n    let namedExport;\n    try {\n      namedExport = webpackExports[key];\n    } catch (err) {\n      continue;\n    }\n\n    reactHotLoader.register(namedExport, key, __FILENAME__);\n  }\n})();\n"
  },
  {
    "path": "test/.eslintrc.js",
    "content": "module.exports = {\n  env: { jest: true },\n};\n"
  },
  {
    "path": "test/AppContainer.dev.test.js",
    "content": "/* eslint-env browser */\nimport 'babel-polyfill';\nimport React, { Component, PureComponent } from 'react';\nimport createReactClass from 'create-react-class';\nimport { mount } from 'enzyme';\nimport TestRenderer from 'react-test-renderer';\nimport { mapProps } from 'recompose';\nimport { polyfill } from 'react-lifecycles-compat';\nimport { AppContainer } from '../src/index.dev';\nimport RHL from '../src/reactHotLoader';\nimport { closeGeneration, configureGeneration, increment as incrementGeneration } from '../src/global/generation';\nimport { configureComponent } from '../src/utils.dev';\nimport configuration from '../src/configuration';\n\ndescribe(`AppContainer (dev)`, () => {\n  beforeEach(() => {\n    RHL.reset();\n    configureGeneration(1, 1);\n  });\n\n  describe('with class root', () => {\n    it('renders children', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.find('App').length).toBe(1);\n      expect(wrapper.contains(<div>hey</div>)).toBe(true);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('force updates the tree on receiving new children', () => {\n      const spy = jest.fn();\n      const spy2 = jest.fn();\n\n      class App extends Component {\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        class App extends Component {\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            spy();\n            spy2();\n            return <div>ho</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(3);\n      expect(spy2).toHaveBeenCalledTimes(2);\n\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('force updates the tree on receiving cached children', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const element = <App />;\n      const wrapper = mount(<AppContainer>{element}</AppContainer>);\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        class App extends Component {\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: element });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(3);\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('renders latest children on receiving cached never-rendered children', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const element = <App />;\n      let wrapper;\n\n      {\n        class App extends Component {\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper = mount(<AppContainer>{element}</AppContainer>);\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('hot-reloads children without losing state', () => {\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          return <div>old render + {this.state.value} state</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('old render + old state');\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            return <div>new render + {this.state.value} state</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('Could handle render as a prop', () => {\n      const spy = jest.fn();\n\n      /* eslint-disable */\n      class SubApp extends Component {\n        componentWillUnmount() {\n          spy('SubApp1');\n        }\n\n        render = function() {\n          return <span>works</span>;\n        };\n      }\n\n      class App extends Component {\n        componentWillUnmount() {\n          spy('App1');\n        }\n\n        __reactstandin__regenerateByEval(key, code) {\n          this[key] = eval(code);\n        }\n\n        render() {\n          return (\n            <span>\n              <SubApp /> before\n            </span>\n          );\n        }\n      }\n\n      /* eslint-enable */\n\n      const Indirect = ({ App }) => (\n        <AppContainer>\n          <App />\n        </AppContainer>\n      );\n      configureComponent(Indirect, { allowSFC: false });\n\n      const wrapper = mount(<Indirect App={App} />);\n      expect(wrapper.text()).toBe('works before');\n\n      {\n        /* eslint-disable */\n        class SubApp extends Component {\n          componentWillUnmount() {\n            spy('SubApp2');\n          }\n\n          render = function() {\n            return <span>works</span>;\n          };\n        }\n\n        SubApp.displayName = 'SubApp';\n\n        class App extends Component {\n          componentWillUnmount() {\n            spy('App2');\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          render = function() {\n            return (\n              <span>\n                <SubApp /> after\n              </span>\n            );\n          };\n        }\n\n        App.displayName = 'App';\n        /* eslint-enable */\n\n        incrementGeneration();\n        wrapper.setProps({ App });\n      }\n\n      expect(wrapper.text()).toBe('works after');\n      expect(spy).not.toHaveBeenCalled();\n    });\n\n    it('Could handle render as a prop with Pure Render', () => {\n      const { pureRender } = configuration;\n      configuration.pureRender = true;\n      const spy = jest.fn();\n\n      /* eslint-disable */\n      class SubApp extends Component {\n        componentWillUnmount() {\n          spy('SubApp1');\n        }\n\n        render = function() {\n          return <span>works</span>;\n        };\n      }\n\n      class App extends Component {\n        componentWillUnmount() {\n          spy('App1');\n        }\n\n        __reactstandin__regenerateByEval(key, code) {\n          this[key] = eval(code);\n        }\n\n        render() {\n          return (\n            <span>\n              <SubApp /> before\n            </span>\n          );\n        }\n      }\n\n      /* eslint-enable */\n\n      const Indirect = ({ App }) => (\n        <AppContainer>\n          <App />\n        </AppContainer>\n      );\n      configureComponent(Indirect, { allowSFC: false });\n\n      const wrapper = mount(<Indirect App={App} />);\n      expect(wrapper.text()).toBe('works before');\n      expect(<App />.type.prototype.render).toBe(App.prototype.render);\n      const originalRender = App.prototype.render;\n\n      let newRender;\n      {\n        /* eslint-disable */\n        class SubApp extends Component {\n          componentWillUnmount() {\n            spy('SubApp2');\n          }\n\n          render = function() {\n            return <span>works</span>;\n          };\n        }\n\n        SubApp.displayName = 'SubApp';\n\n        class App extends Component {\n          componentWillUnmount() {\n            spy('App2');\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          render() {\n            return (\n              <span>\n                <SubApp /> after\n              </span>\n            );\n          }\n        }\n\n        App.displayName = 'App';\n        /* eslint-enable */\n\n        incrementGeneration();\n        wrapper.setProps({ App });\n        newRender = App.prototype.render;\n      }\n\n      expect(wrapper.text()).toBe('works after');\n      expect(spy).not.toHaveBeenCalled();\n      // render on App is changed by merge process. Compare with stored value\n      expect(<App />.type.prototype.render).not.toBe(originalRender);\n      expect(<App />.type.prototype.render).not.toBe(newRender);\n      closeGeneration();\n      expect(<App />.type.prototype.render).toBe(newRender);\n\n      configuration.pureRender = pureRender;\n    });\n\n    it('replaces children class methods', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        handleClick() {\n          spy('foo');\n        }\n\n        render() {\n          return <span onClick={this.handleClick}>old render + {this.state.value} state</span>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('foo');\n      expect(wrapper.text()).toBe('old render + old state');\n\n      spy.mockReset();\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          handleClick() {\n            spy('bar');\n          }\n\n          render() {\n            return <span onClick={this.handleClick}>new render + {this.state.value} state</span>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('bar');\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('replaces children class property arrow functions', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        handleClick = () => {\n          spy('foo');\n        };\n\n        render() {\n          return <span onClick={this.handleClick}>old render + {this.state.value} state</span>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('foo');\n      expect(wrapper.text()).toBe('old render + old state');\n\n      spy.mockReset();\n      window.spy = spy;\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          handleClick = () => {\n            window.spy('bar');\n          };\n\n          /* eslint-disable */\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          /* eslint-enable */\n\n          render() {\n            return <span onClick={this.handleClick}>new render + {this.state.value} state</span>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('bar');\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('replaces children class arrow functions in constructor', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        constructor(props) {\n          super(props);\n\n          this.handleClick = () => {\n            spy('foo');\n          };\n\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          return <span onClick={this.handleClick}>old render + {this.state.value} state</span>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('foo');\n      expect(wrapper.text()).toBe('old render + old state');\n\n      spy.mockReset();\n      window.spy = spy;\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          handleClick = () => {\n            window.spy('bar');\n          };\n\n          /* eslint-disable */\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          /* eslint-enable */\n\n          render() {\n            return <span onClick={this.handleClick}>new render + {this.state.value} state</span>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('bar');\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('replaces children class property arrow functions without block statement bodies', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        handleClick = () => spy('foo');\n\n        render() {\n          return <span onClick={this.handleClick}>old render + {this.state.value} state</span>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('foo');\n      expect(wrapper.text()).toBe('old render + old state');\n\n      spy.mockReset();\n\n      window.spy = spy;\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          handleClick = () => window.spy('bar');\n\n          /* eslint-disable */\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          /* eslint-enable */\n\n          render() {\n            return <span onClick={this.handleClick}>new render + {this.state.value} state</span>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('bar');\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('replaces PureComponent', () => {\n      const spy = jest.fn();\n\n      class Pure extends PureComponent {\n        componentWillUnmount() {\n          spy();\n        }\n\n        render() {\n          return <span>I am old</span>;\n        }\n      }\n\n      RHL.register(Pure, 'Pure', 'test.js');\n\n      class RenderFn extends PureComponent {\n        render() {\n          const { _children, v } = this.props;\n          return _children()(v);\n        }\n      }\n\n      const innerRenderFn = v => <Pure v={v} />;\n      const renderFn = () => innerRenderFn;\n\n      class App extends PureComponent {\n        render() {\n          return (\n            <div>\n              <RenderFn value={42} _children={renderFn} />\n            </div>\n          );\n        }\n      }\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('I am old');\n\n      {\n        class Pure extends PureComponent {\n          componentWillUnmount() {\n            spy();\n          }\n\n          render() {\n            return <span>I am new</span>;\n          }\n        }\n\n        RHL.register(Pure, 'Pure', 'test.js');\n\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(wrapper.text()).toBe('I am new');\n      expect(spy).not.toHaveBeenCalled();\n    });\n\n    it('replaces React.memo', done => {\n      if (!React.memo) {\n        expect(1).toBe(1);\n        done();\n        return;\n      }\n\n      const Pure = React.memo(() => <span>I am old</span>);\n      RHL.register(Pure, 'Pure', 'test.js');\n\n      const App = () => (\n        <div>\n          <Pure />\n        </div>\n      );\n\n      const wrapper = TestRenderer.create(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.root.findByProps({ children: 'I am old' })).toBeDefined();\n\n      {\n        const Pure = React.memo(() => <span>I am new</span>);\n\n        RHL.register(Pure, 'Pure', 'test.js');\n\n        wrapper.update(\n          <AppContainer update>\n            <App />\n          </AppContainer>,\n        );\n      }\n\n      setTimeout(() => {\n        expect(wrapper.root.findByProps({ children: 'I am new' })).toBeDefined();\n        done();\n      }, 16);\n    });\n\n    it('handles forwardRef', () => {\n      if (!React.forwardRef) {\n        expect(1).toBe(1);\n        return;\n      }\n\n      const spy = jest.fn();\n\n      class MountSpy extends PureComponent {\n        static displayName = 'MountSpy';\n\n        componentWillUnmount() {\n          spy();\n        }\n\n        render() {\n          return <span>I am old</span>;\n        }\n      }\n\n      const FRW = React.forwardRef(() => (\n        <span>\n          <MountSpy />\n        </span>\n      ));\n      RHL.register(FRW, 'FRW', 'test.js');\n\n      const App = () => (\n        <div>\n          <FRW prop1={1} prop2={2}>\n            children\n          </FRW>\n        </div>\n      );\n\n      const wrapper = TestRenderer.create(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.root.findByProps({ children: 'I am old' })).toBeDefined();\n\n      {\n        class MountSpy extends PureComponent {\n          static displayName = 'MountSpy';\n\n          componentWillUnmount() {\n            spy();\n          }\n\n          render() {\n            return <span>I am new</span>;\n          }\n        }\n\n        const FRW = React.forwardRef(() => (\n          <span>\n            <MountSpy />\n          </span>\n        ));\n        RHL.register(FRW, 'FRW', 'test.js');\n\n        wrapper.update(\n          <AppContainer update>\n            <App update />\n          </AppContainer>,\n        );\n      }\n\n      expect(spy).not.toHaveBeenCalled();\n      expect(wrapper.root.findByProps({ children: 'I am new' })).toBeDefined();\n    });\n\n    it.skip('handles react-lazy', async () => {\n      const spy = jest.fn();\n\n      class MountSpy extends PureComponent {\n        static displayName = 'MountSpy';\n\n        componentWillUnmount() {\n          spy();\n        }\n\n        render() {\n          return <span>I am old</span>;\n        }\n      }\n\n      const Tmp = MountSpy;\n\n      const Lazy = React.lazy(() => Promise.resolve({ default: Tmp }));\n\n      RHL.register(MountSpy, 'Pure', 'test.js');\n      RHL.register(Lazy, 'Lazy', 'test.js');\n\n      const ref = jest.fn();\n      class App extends Component {\n        render() {\n          return <Lazy ref={ref} />;\n        }\n      }\n\n      const wrapper = TestRenderer.create(\n        <AppContainer>\n          <React.Suspense fallback=\"loading\">\n            <App />\n          </React.Suspense>\n        </AppContainer>,\n      );\n\n      await Promise.resolve(1);\n\n      expect(spy).not.toHaveBeenCalled();\n      expect(ref).toHaveBeenCalledTimes(1);\n\n      expect(wrapper.root.findByProps({ children: 'I am old' })).toBeDefined();\n\n      {\n        class MountSpy extends PureComponent {\n          static displayName = 'MountSpy';\n\n          componentWillUnmount() {\n            spy();\n          }\n\n          render() {\n            return <span>I am new</span>;\n          }\n        }\n\n        const Lazy = React.lazy(() => Promise.resolve({ default: Tmp }));\n        RHL.register(MountSpy, 'Pure', 'test.js');\n        RHL.register(Lazy, 'Lazy', 'test.js');\n\n        wrapper.update(\n          <AppContainer>\n            <React.Suspense fallback=\"loading\">\n              <App />\n            </React.Suspense>\n          </AppContainer>,\n        );\n\n        await Promise.resolve(1);\n      }\n\n      expect(spy).not.toHaveBeenCalled();\n      expect(wrapper.root.findByProps({ children: 'I am new' })).toBeDefined();\n    });\n\n    it('replaces children with class property arrow functions with different numbers of arguments', () => {\n      const spy = jest.fn();\n\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        handleClick = () => spy('foo');\n\n        render() {\n          return <span onClick={this.handleClick}>old render + {this.state.value} state</span>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      wrapper.find('span').simulate('click');\n      expect(spy).toHaveBeenCalledWith('foo');\n      expect(wrapper.text()).toBe('old render + old state');\n\n      spy.mockReset();\n      window.spy = spy;\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          handleClick = ({ target }) => window.spy(target.value);\n\n          /* eslint-disable */\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n\n          /* eslint-enable */\n\n          render() {\n            return <span onClick={this.handleClick}>new render + {this.state.value} state</span>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      wrapper.find('span').simulate('click', { target: { value: 'bar' } });\n      expect(spy).toHaveBeenCalledWith('bar');\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n\n    it('passes a default context value', () => {\n      if (React.version.startsWith('16')) {\n        const spy = jest.fn();\n        const contextValue = 'value';\n        const { Consumer } = React.createContext('value');\n\n        class App extends Component {\n          render() {\n            return (\n              <Consumer>\n                {value => {\n                  spy();\n                  return <div>{value}</div>;\n                }}\n              </Consumer>\n            );\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        expect(wrapper.contains(<div>{contextValue}</div>)).toBe(true);\n        expect(spy).toHaveBeenCalledTimes(1);\n      } else {\n        expect(true).toBe(true);\n      }\n    });\n\n    it('passes provider defined context value', () => {\n      if (React.version.startsWith('16')) {\n        const spy = jest.fn();\n        const contextValue = 'value';\n        const { Provider, Consumer } = React.createContext();\n\n        class App extends Component {\n          render() {\n            return (\n              <Provider value={contextValue}>\n                <Consumer>\n                  {value => {\n                    spy();\n                    return <div>{value}</div>;\n                  }}\n                </Consumer>\n              </Provider>\n            );\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        expect(wrapper.contains(<div>{contextValue}</div>)).toBe(true);\n        expect(spy).toHaveBeenCalledTimes(1);\n      } else {\n        expect(true).toBe(true);\n      }\n    });\n\n    it('passes provider defined falsy context value', () => {\n      if (React.version.startsWith('16')) {\n        const spy = jest.fn();\n        const contextValue = 0;\n        const { Provider, Consumer } = React.createContext();\n\n        class App extends Component {\n          render() {\n            return (\n              <Provider value={contextValue}>\n                <Consumer>\n                  {value => {\n                    spy(value);\n                    return <div>{value}</div>;\n                  }}\n                </Consumer>\n              </Provider>\n            );\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        expect(wrapper.contains(<div>{contextValue}</div>)).toBe(true);\n        expect(spy).toHaveBeenCalledTimes(1);\n        expect(spy).toHaveBeenCalledWith(contextValue);\n      } else {\n        expect(true).toBe(true);\n      }\n    });\n\n    it('passes provider defined falsy context value on receiving new children', () => {\n      if (React.version.startsWith('16')) {\n        const spy = jest.fn();\n        const spy2 = jest.fn();\n        const contextValue = false;\n        const { Provider, Consumer } = React.createContext();\n\n        class App extends Component {\n          render() {\n            return (\n              <Provider value={contextValue}>\n                <Consumer>\n                  {value => {\n                    spy(value);\n                    return <div>{value}</div>;\n                  }}\n                </Consumer>\n              </Provider>\n            );\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        expect(wrapper.contains(<div>{contextValue}</div>)).toBe(true);\n        expect(spy).toHaveBeenCalledTimes(1);\n        expect(spy).toHaveBeenCalledWith(contextValue);\n\n        {\n          class App extends Component {\n            shouldComponentUpdate() {\n              return false;\n            }\n\n            render() {\n              return (\n                <Provider value={contextValue}>\n                  <Consumer>\n                    {value => {\n                      spy2(value);\n                      return <div>{value}</div>;\n                    }}\n                  </Consumer>\n                </Provider>\n              );\n            }\n          }\n\n          RHL.register(App, 'App', 'test.js');\n          wrapper.setProps({ children: <App /> });\n        }\n\n        const firstCallArg = spy2.mock.calls[0][0];\n\n        expect(spy2).toHaveBeenCalledTimes(2);\n        expect(firstCallArg).toBeDefined();\n        expect(firstCallArg).toBe(contextValue);\n      } else {\n        expect(true).toBe(true);\n      }\n    });\n  });\n\n  describe('with createClass root', () => {\n    it('renders children', () => {\n      const spy = jest.fn();\n      const App = createReactClass({\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.find('App').length).toBe(1);\n      expect(wrapper.contains(<div>hey</div>)).toBe(true);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('force updates the tree on receiving new children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1 + 2);\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('force updates the tree on receiving cached children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n\n      const element = <App />;\n      const wrapper = mount(<AppContainer>{element}</AppContainer>);\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: element });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1 + 2);\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('renders latest children on receiving cached never-rendered children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n\n      const element = <App />;\n      let wrapper;\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper = mount(<AppContainer>{element}</AppContainer>);\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('hot-reloads children without losing state', () => {\n      const App = createReactClass({\n        getInitialState() {\n          return { value: 'old' };\n        },\n\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          return <div>old render + {this.state.value} state</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('old render + old state');\n\n      {\n        const App = createReactClass({\n          getInitialState() {\n            return { value: 'new' };\n          },\n\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            return <div>new render + {this.state.value} state</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n  });\n\n  describe('with createFactory root', () => {\n    it('renders children', () => {\n      const spy = jest.fn();\n      const App = createReactClass({\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n      const AppF = React.createFactory(App);\n\n      const wrapper = mount(<AppContainer>{AppF()}</AppContainer>);\n      expect(wrapper.find('App').length).toBe(1);\n      expect(wrapper.contains(<div>hey</div>)).toBe(true);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('force updates the tree on receiving new children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n      const AppF = React.createFactory(App);\n\n      const wrapper = mount(<AppContainer>{AppF()}</AppContainer>);\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        const AppF = React.createFactory(App);\n        wrapper.setProps({ children: AppF() });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1 + 2);\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('force updates the tree on receiving cached children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n      const AppF = React.createFactory(App);\n\n      const element = AppF();\n      const wrapper = mount(<AppContainer>{element}</AppContainer>);\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: element });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1 + 2);\n      expect(wrapper.update().contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('renders latest children on receiving cached never-rendered children', () => {\n      const spy = jest.fn();\n\n      const App = createReactClass({\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          spy();\n          return <div>hey</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n      const AppF = React.createFactory(App);\n\n      const element = AppF();\n      let wrapper;\n\n      {\n        const App = createReactClass({\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            spy();\n            return <div>ho</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        wrapper = mount(<AppContainer>{element}</AppContainer>);\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('hot-reloads children without losing state', () => {\n      const App = createReactClass({\n        getInitialState() {\n          return { value: 'old' };\n        },\n\n        shouldComponentUpdate() {\n          return false;\n        },\n\n        render() {\n          return <div>old render + {this.state.value} state</div>;\n        },\n      });\n      RHL.register(App, 'App', 'test.js');\n      const AppF = React.createFactory(App);\n\n      const wrapper = mount(<AppContainer>{AppF()}</AppContainer>);\n      expect(wrapper.text()).toBe('old render + old state');\n\n      {\n        const App = createReactClass({\n          getInitialState() {\n            return { value: 'new' };\n          },\n\n          shouldComponentUpdate() {\n            return false;\n          },\n\n          render() {\n            return <div>new render + {this.state.value} state</div>;\n          },\n        });\n        RHL.register(App, 'App', 'test.js');\n        const AppF = React.createFactory(App);\n        wrapper.setProps({ children: AppF() });\n      }\n\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n  });\n\n  describe('with SFC root', () => {\n    it('renders children', () => {\n      const spy = jest.fn();\n      const App = () => {\n        spy();\n        return <div>hey</div>;\n      };\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.find('App').length).toBe(1);\n      expect(wrapper.contains(<div>hey</div>)).toBe(true);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('renders falsy children', () => {\n      const spy = jest.fn();\n      const App = () => {\n        spy();\n        return null;\n      };\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(wrapper.find('App').length).toBe(1);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('force updates the tree on receiving new children', () => {\n      const spy = jest.fn();\n\n      const App = () => {\n        spy();\n        return <div>hey</div>;\n      };\n      RHL.register(App, 'App', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        const App = () => {\n          spy();\n          return <div>ho</div>;\n        };\n        RHL.register(App, 'App', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(spy).toHaveBeenCalledTimes(configuration.pureRender && !React.lazy ? 4 : 3);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('force updates the tree on receiving cached children', () => {\n      const firstSpy = jest.fn();\n      const Dummy = () => {\n        firstSpy();\n        return <div>first</div>;\n      };\n\n      const App = () => <Dummy />;\n      RHL.register(Dummy, 'Dummy', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      expect(firstSpy).toHaveBeenCalledTimes(1);\n\n      const secondSpy = jest.fn();\n\n      {\n        const Dummy = () => {\n          secondSpy();\n          return <div>second</div>;\n        };\n        RHL.register(Dummy, 'Dummy', 'test.js');\n        wrapper.setProps({ children: <App /> });\n      }\n\n      expect(firstSpy).toHaveBeenCalledTimes(1);\n      expect(secondSpy).toHaveBeenCalledTimes(configuration.pureRender && !React.lazy ? 3 : 2);\n      expect(wrapper.contains(<div>second</div>)).toBe(true);\n    });\n\n    it('renders latest children on receiving cached never-rendered children', () => {\n      const spy = jest.fn();\n\n      const App = () => {\n        spy();\n        return <div>hey</div>;\n      };\n      RHL.register(App, 'App', 'test.js');\n\n      const element = <App />;\n      let wrapper;\n\n      {\n        const App = () => {\n          spy();\n          return <div>ho</div>;\n        };\n        RHL.register(App, 'App', 'test.js');\n        wrapper = mount(<AppContainer>{element}</AppContainer>);\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('hot-reloads children without losing state', () => {\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          return <div>old render + {this.state.value} state</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const Root = () => <App />;\n      RHL.register(Root, 'Root', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <Root />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('old render + old state');\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            return <div>new render + {this.state.value} state</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const Root = () => <App />;\n        RHL.register(Root, 'Root', 'test.js');\n        wrapper.setProps({ children: <Root /> });\n      }\n\n      expect(wrapper.text()).toBe('new render + old state');\n    });\n  });\n\n  it('hot-reloads nested children without losing state', () => {\n    const onUnmount = jest.fn();\n    let child = 1;\n\n    function getChild() {\n      if (child === 1) {\n        return class Child extends Component {\n          componentWillUnmount() {\n            onUnmount();\n          }\n\n          render() {\n            return <div>old child</div>;\n          }\n        };\n      }\n      return class Child extends Component {\n        componentWillUnmount() {\n          // onUnmount();\n        }\n\n        render() {\n          return <div>new child</div>;\n        }\n      };\n    }\n\n    class Layout extends Component {\n      render() {\n        return (\n          <div>\n            <h1>TEST</h1>\n            {this.props.children}\n          </div>\n        );\n      }\n    }\n\n    class App extends Component {\n      render() {\n        const Child = getChild();\n        return (\n          <Layout>\n            <Child />\n            <Child />\n          </Layout>\n        );\n      }\n    }\n\n    const Root = () => <App />;\n    RHL.register(Root, 'Root', 'test.js');\n    RHL.register(App, 'App', 'test.js');\n\n    const wrapper = mount(\n      <AppContainer>\n        <Root />\n      </AppContainer>,\n    );\n\n    expect(onUnmount).toHaveBeenCalledTimes(0);\n\n    child = 2;\n    // emulate HRM\n    incrementGeneration();\n    wrapper.setProps({ children: <Root /> });\n    expect(onUnmount).toHaveBeenCalledTimes(0);\n\n    expect(wrapper.text()).toBe('TESTnew childnew child');\n  });\n\n  it('hot-reloads nested SFC children without losing state', () => {\n    const onUnmount = jest.fn();\n\n    class MountSpy extends Component {\n      componentWillUnmount() {\n        onUnmount();\n      }\n\n      render() {\n        return <div>spy</div>;\n      }\n    }\n\n    let child = 1;\n    const childs = [\n      function Child() {\n        return (\n          <div>\n            a <MountSpy />\n          </div>\n        );\n      },\n      function Child() {\n        return (\n          <div>\n            b <MountSpy />\n          </div>\n        );\n      },\n    ];\n\n    function getChild() {\n      return child === 1 ? childs[0] : childs[1];\n    }\n\n    class Layout extends Component {\n      render() {\n        return (\n          <div>\n            <h1>TEST</h1>\n            {this.props.children}\n          </div>\n        );\n      }\n    }\n\n    class App extends Component {\n      render() {\n        const Child = getChild();\n        return (\n          <Layout>\n            <Child />\n            <Child />\n          </Layout>\n        );\n      }\n    }\n\n    const Root = () => <App />;\n    RHL.register(Root, 'Root', 'test.js');\n    RHL.register(App, 'App', 'test.js');\n\n    const wrapper = mount(\n      <AppContainer>\n        <Root />\n      </AppContainer>,\n    );\n\n    expect(onUnmount).toHaveBeenCalledTimes(0);\n    expect(wrapper.text()).toBe('TESTa spya spy');\n\n    child = 2;\n    // emulate HRM\n    incrementGeneration();\n    wrapper.setProps({ children: <Root /> });\n    expect(onUnmount).toHaveBeenCalledTimes(0);\n\n    expect(wrapper.text()).toBe('TESTb spyb spy');\n  });\n\n  it('unmounts nested in mixed condition', () => {\n    const onUnmount = jest.fn();\n\n    class MountSpy extends Component {\n      componentWillUnmount() {\n        onUnmount();\n      }\n\n      render() {\n        return <div>spy</div>;\n      }\n    }\n\n    let child = 1;\n    const childA = () => (\n      <div>\n        a <MountSpy />\n      </div>\n    );\n\n    class ChildB extends Component {\n      render() {\n        return (\n          <div>\n            b <MountSpy />\n          </div>\n        );\n      }\n    }\n\n    function getChild() {\n      return child === 1 ? childA : ChildB;\n    }\n\n    class Layout extends Component {\n      render() {\n        return (\n          <div>\n            <h1>TEST</h1>\n            {this.props.children}\n          </div>\n        );\n      }\n    }\n\n    class App extends Component {\n      render() {\n        const Child = getChild();\n        return (\n          <Layout>\n            <Child />\n            <Child />\n          </Layout>\n        );\n      }\n    }\n\n    const Root = () => <App />;\n    RHL.register(Root, 'Root', 'test.js');\n    RHL.register(App, 'App', 'test.js');\n\n    const wrapper = mount(\n      <AppContainer>\n        <Root />\n      </AppContainer>,\n    );\n\n    expect(onUnmount).toHaveBeenCalledTimes(0);\n    expect(wrapper.text()).toBe('TESTa spya spy');\n\n    child = 2;\n    // emulate HRM\n    incrementGeneration();\n    wrapper.setProps({ children: <Root /> });\n    expect(onUnmount).toHaveBeenCalledTimes(2);\n\n    expect(wrapper.text()).toBe('TESTb spyb spy');\n  });\n\n  it('renders children with chunked re-register', () => {\n    const spy = jest.fn();\n\n    class App extends Component {\n      componentWillUnmount() {\n        spy();\n      }\n\n      render() {\n        return <div>I AM CHILD</div>;\n      }\n    }\n\n    RHL.reset();\n    RHL.register(App, 'App1', 'test.js');\n    RHL.register(App, 'App2', 'test.js');\n\n    const wrapper = mount(\n      <AppContainer>\n        <App />\n      </AppContainer>,\n    );\n    expect(spy).not.toHaveBeenCalled();\n    wrapper.setProps({ children: <App /> });\n    expect(spy).not.toHaveBeenCalled();\n    RHL.register(App, 'App3', 'test.js');\n    wrapper.setProps({ children: <App /> });\n    expect(spy).not.toHaveBeenCalled();\n\n    {\n      class App extends Component {\n        componentWillUnmount() {\n          spy();\n        }\n\n        render() {\n          return <div>I AM NEW CHILD</div>;\n        }\n      }\n\n      RHL.register(App, 'App3', 'test.js');\n      wrapper.setProps({ children: <App /> });\n      expect(spy).not.toHaveBeenCalled();\n\n      RHL.register(App, 'App4', 'test.js');\n      wrapper.setProps({ children: <App /> });\n      expect(spy).not.toHaveBeenCalled();\n    }\n  });\n\n  describe('test similarity', () => {\n    describe('unmounts nested in mixed condition', () => {\n      /* eslint-disable */\n      let onUnmount = jest.fn();\n\n      class MountSpy extends Component {\n        componentWillUnmount() {\n          onUnmount();\n        }\n\n        render() {\n          return <div>spy</div>;\n        }\n      }\n\n      let ChildBase, ChildB, ChildC, ChildD, ChildE, ChildF;\n\n      const generateChilds = () => {\n        ChildBase = class ChildA extends Component {\n          render() {\n            return (\n              <div>\n                b <MountSpy />\n              </div>\n            );\n          }\n        };\n\n        {\n          ChildB = class ChildA extends Component {\n            render() {\n              return (\n                <div>\n                  NOT A BIG CHANGE! <MountSpy />\n                </div>\n              );\n            }\n          };\n        }\n\n        {\n          ChildC = class ChildA extends Component {\n            componentWillUnmount() {\n              // some data\n            }\n\n            render() {\n              return (\n                <div>\n                  b <MountSpy />\n                </div>\n              );\n            }\n          };\n        }\n\n        {\n          ChildD = class ChildA extends Component {\n            componentWillUnmount() {\n              // some data\n            }\n\n            componentWillMount() {\n              // some data\n            }\n\n            render() {\n              return (\n                <div>\n                  BIG CHANGE! <MountSpy />\n                </div>\n              );\n            }\n          };\n        }\n\n        {\n          ChildE = class ChildA extends Component {\n            render() {\n              return (\n                <div>\n                  SUPER <b>MEGA</b> <i>UBER</i> PUPER BIG CHANGE! <MountSpy />\n                </div>\n              );\n            }\n          };\n        }\n\n        {\n          ChildF = function ChildA() {\n            return (\n              <div>\n                b <MountSpy />\n              </div>\n            );\n          };\n        }\n      };\n\n      /* eslint-enable */\n\n      const expectUnmounts = [false, false, true, true, true];\n      generateChilds();\n      [ChildB, ChildC, ChildD, ChildE, ChildF].forEach((Replace, index) => {\n        const expectUnmount = expectUnmounts[index];\n        it(`${expectUnmount ? 'expect unmount' : 'keep'} for ${index}`, () => {\n          generateChilds(); // renegerate base\n          onUnmount = jest.fn();\n          let Child = ChildBase;\n\n          class App extends Component {\n            render() {\n              return (\n                <div>\n                  <Child />\n                </div>\n              );\n            }\n          }\n\n          const wrapper = mount(\n            <AppContainer>\n              <App />\n            </AppContainer>,\n          );\n          expect(onUnmount).toHaveBeenCalledTimes(0);\n\n          // Replace.name=Child.name;\n          Child = Replace;\n\n          incrementGeneration();\n          wrapper.setProps({ children: <App /> });\n\n          expect(onUnmount).toHaveBeenCalledTimes(expectUnmount ? 1 : 0);\n        });\n      });\n    });\n  });\n\n  describe('with HOC-wrapped root', () => {\n    it('renders children', () => {\n      const spy = jest.fn();\n\n      class App extends React.Component {\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n      RHL.register(Enhanced, 'Enhanced', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <Enhanced n={3} />\n        </AppContainer>,\n      );\n      expect(wrapper.find('App').length).toBe(1);\n      expect(wrapper.contains(<div>hey</div>)).toBe(true);\n      expect(wrapper.find('App').prop('n')).toBe(15);\n      expect(spy).toHaveBeenCalledTimes(1);\n    });\n\n    it('force updates the tree on receiving new children', () => {\n      const spy = jest.fn();\n\n      class App extends React.Component {\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n      RHL.register(Enhanced, 'Enhanced', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <Enhanced n={3} />\n        </AppContainer>,\n      );\n      expect(spy).toHaveBeenCalledTimes(1);\n\n      {\n        class App extends React.Component {\n          render() {\n            spy();\n            return <div>ho</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n        RHL.register(Enhanced, 'Enhanced', 'test.js');\n        wrapper.setProps({ children: <Enhanced n={3} /> });\n      }\n\n      if (React.memo && !configuration.pureRender) {\n        expect(spy).toHaveBeenCalledTimes(1 + 2);\n      }\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('force updates the tree on receiving cached children', () => {\n      const firstSpy = jest.fn();\n      const Dummy = () => {\n        firstSpy();\n        return <div>first</div>;\n      };\n      const App = () => <Dummy />;\n      RHL.register(Dummy, 'Dummy', 'test.js');\n\n      const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n      RHL.register(Enhanced, 'Enhanced', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <Enhanced n={3} />\n        </AppContainer>,\n      );\n      expect(firstSpy).toHaveBeenCalledTimes(1);\n\n      const secondSpy = jest.fn();\n      {\n        const Dummy = () => {\n          secondSpy();\n          return <div>second</div>;\n        };\n        RHL.register(Dummy, 'Dummy', 'test.js');\n\n        const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n        RHL.register(Enhanced, 'Enhanced', 'test.js');\n        wrapper.setProps({ children: <Enhanced n={3} /> });\n      }\n\n      expect(firstSpy).toHaveBeenCalledTimes(1);\n      expect(secondSpy).toHaveBeenCalledTimes(configuration.pureRender && !React.lazy ? 3 : 2);\n      expect(wrapper.contains(<div>second</div>)).toBe(true);\n    });\n\n    it('support indeterminateComponent', () => {\n      [false, true].forEach(withContext => {\n        const spy = jest.fn();\n\n        const AnotherComponent = () => <div>old</div>;\n\n        class App extends React.Component {\n          static getDerivedStateFromProps({ n }) {\n            return { n };\n          }\n\n          render() {\n            return (\n              <div>\n                hey {this.state.n} <AnotherComponent />\n              </div>\n            );\n          }\n        }\n\n        // Can't always run polyfill, as running polyfill in React 16 will make\n        // this test case pass even without the fix.\n        if (React.version.startsWith('15')) {\n          polyfill(App);\n        }\n\n        let CurrentApp = App;\n\n        RHL.register(AnotherComponent, 'AnotherComponent', 'test.js');\n        RHL.register(App, 'App', 'test.js');\n\n        // return rendered component from a stateless\n        const IndeterminateComponent = (props, context) => {\n          const instance = new CurrentApp(props, context);\n          IndeterminateComponent.getDerivedStateFromProps = CurrentApp.getDerivedStateFromProps;\n          return instance;\n        };\n\n        if (withContext) {\n          IndeterminateComponent.contextTypes = {};\n        }\n\n        const RootApp = props => <IndeterminateComponent {...props} />;\n\n        const wrapper = mount(\n          <AppContainer>\n            <RootApp n={42} />\n          </AppContainer>,\n        );\n        expect(wrapper.text()).toBe('hey 42 old');\n        {\n          class App2 extends React.Component {\n            static getDerivedStateFromProps({ n }) {\n              return { n };\n            }\n\n            render() {\n              spy();\n              return <div>ho {this.state.n + 1}</div>;\n            }\n          }\n\n          if (React.version.startsWith('15')) {\n            polyfill(App2);\n          }\n\n          RHL.register(App2, 'App', 'test.js');\n          CurrentApp = App2;\n\n          const AnotherComponent = () => <div>new</div>;\n          RHL.register(AnotherComponent, 'AnotherComponent', 'test.js');\n\n          wrapper.setProps({ update: true, children: <RootApp n={44} /> });\n\n          // How it works. IndeterminateComponent calculates return value once.\n          expect(wrapper.text()).toBe('hey 44 new');\n          expect(spy).toHaveBeenCalledTimes(0); // never gets called\n\n          // How it should work\n          // expect(wrapper.text()).toBe('ho 45 new');\n          // expect(spy).toHaveBeenCalledTimes(2);\n        }\n      });\n    });\n\n    it('renders latest children on receiving cached never-rendered children', () => {\n      const spy = jest.fn();\n\n      class App extends React.Component {\n        render() {\n          spy();\n          return <div>hey</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n      RHL.register(Enhanced, 'Enhanced', 'test.js');\n\n      const element = <Enhanced n={3} />;\n      let wrapper;\n\n      {\n        class App extends React.Component {\n          render() {\n            spy();\n            return <div>ho</div>;\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n        RHL.register(Enhanced, 'Enhanced', 'test.js');\n        wrapper = mount(<AppContainer>{element}</AppContainer>);\n      }\n\n      expect(spy).toHaveBeenCalledTimes(1);\n      expect(wrapper.contains(<div>ho</div>)).toBe(true);\n    });\n\n    it('hot-reloads children with overriden render', () => {\n      class App extends Component {\n        constructor() {\n          super();\n          this.secret = 1;\n          this.superSecret = 42;\n        }\n\n        componentWillMount() {\n          const oldRender = this.render.bind(this);\n          this.render = () => {\n            this.superSecret = this.secret + 1;\n            return <div>PATCHED + {oldRender()}</div>;\n          };\n        }\n\n        render() {\n          return <div>{this.superSecret}</div>;\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const MiddleApp = () => (\n        <div>\n          <App />\n        </div>\n      );\n\n      const wrapper = mount(\n        <AppContainer>\n          <MiddleApp />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('PATCHED + 2');\n\n      {\n        class App2 extends Component {\n          constructor() {\n            super();\n            this.secret = 2;\n          }\n\n          render() {\n            return <div>{this.superSecret * 2} v2</div>;\n          }\n        }\n\n        RHL.register(App2, 'App', 'test.js');\n\n        wrapper.setProps({ children: <MiddleApp /> });\n      }\n\n      if (!configuration.pureRender) {\n        expect(wrapper.update().text()).toBe('PATCHED + 6 v2');\n      }\n    });\n\n    it('hot-reloads children inside simple Fragments', () => {\n      if (React.version.startsWith('16')) {\n        const unmount = jest.fn();\n\n        class InnerComponent extends Component {\n          componentWillUnmount() {\n            unmount();\n          }\n\n          render() {\n            return <span>internal</span>;\n          }\n        }\n\n        InnerComponent.displayName = 'InnerComponent';\n\n        const App = () => (\n          <React.Fragment>\n            <button>\n              <React.Fragment>\n                <span />\n                <span>\n                  text <InnerComponent />\n                </span>\n                <span />\n              </React.Fragment>\n            </button>\n          </React.Fragment>\n        );\n\n        RHL.register(App, 'App', 'test.js');\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        {\n          class InnerComponent extends Component {\n            componentWillUnmount() {\n              unmount();\n            }\n\n            render() {\n              return <span>internal</span>;\n            }\n          }\n\n          InnerComponent.displayName = 'InnerComponent';\n\n          const App = () => (\n            <React.Fragment>\n              <button>\n                <React.Fragment>\n                  <span />\n                  <span>\n                    another text <InnerComponent />\n                  </span>\n                  <span />\n                </React.Fragment>\n              </button>\n            </React.Fragment>\n          );\n          RHL.register(App, 'App', 'test.js');\n\n          wrapper.setProps({ children: <App /> });\n        }\n\n        expect(unmount).toHaveBeenCalledTimes(0);\n        expect(wrapper.update().text()).toBe('another text internal');\n      } else {\n        // React 15 is always ok\n        expect(true).toBe(true);\n      }\n    });\n\n    it('hot-reloads children inside Fragments', () => {\n      if (React.version.startsWith('16')) {\n        const unmount = jest.fn();\n\n        class InnerComponent extends Component {\n          componentWillUnmount() {\n            unmount();\n          }\n\n          render() {\n            return <div>OldInnerComponent</div>;\n          }\n        }\n\n        InnerComponent.displayName = 'InnerComponent';\n\n        const InnerItem = () => (\n          <React.Fragment>\n            {false && <div>hole</div>}\n            -1-<InnerComponent />\n            {false && <div>hole</div>}\n            -3-<InnerComponent />\n          </React.Fragment>\n        );\n        RHL.register(InnerItem, 'InnerItem', 'test.js');\n\n        const Item = () => (\n          <React.Fragment>\n            <li>1</li>\n            <li>\n              <InnerItem />\n            </li>\n            <li>3</li>\n            <React.Fragment>\n              <span>F</span>\n            </React.Fragment>\n          </React.Fragment>\n        );\n        //\n        const App = () => (\n          <ul>\n            <Item />\n          </ul>\n        );\n\n        const wrapper = mount(\n          <AppContainer>\n            <App />\n          </AppContainer>,\n        );\n\n        expect(wrapper.update().text()).toBe('1-1-OldInnerComponent-3-OldInnerComponent3F');\n        {\n          class InnerComponent extends Component {\n            componentWillUnmount() {\n              unmount();\n            }\n\n            render() {\n              return <div>NewInnerComponent</div>;\n            }\n          }\n\n          InnerComponent.displayName = 'InnerComponent';\n\n          const InnerItem = () => (\n            <React.Fragment>\n              {false && <div>hole</div>}\n              -2-<InnerComponent />\n              {false && <div>hole</div>}\n              -3-<InnerComponent />\n              <React.Fragment>\n                <span>*</span>\n              </React.Fragment>\n            </React.Fragment>\n          );\n          RHL.register(InnerItem, 'InnerItem', 'test.js');\n\n          wrapper.setProps({ children: <App /> });\n        }\n        expect(unmount).toHaveBeenCalledTimes(0);\n        expect(wrapper.update().text()).toBe(\n          '1-2-NewInnerComponent-3-NewInnerComponent*3F', // it should not be so!\n        );\n      } else {\n        // React 15 is always ok\n        expect(true).toBe(true);\n      }\n    });\n\n    it('hot-reloads children without losing state', () => {\n      class App extends Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: 'old' };\n        }\n\n        shouldComponentUpdate() {\n          return false;\n        }\n\n        render() {\n          return (\n            <div>\n              old render + {this.state.value} state + {this.props.n}\n            </div>\n          );\n        }\n      }\n\n      RHL.register(App, 'App', 'test.js');\n\n      const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n      RHL.register(Enhanced, 'Enhanced', 'test.js');\n\n      const wrapper = mount(\n        <AppContainer>\n          <Enhanced n={3} />\n        </AppContainer>,\n      );\n      expect(wrapper.text()).toBe('old render + old state + 15');\n\n      {\n        class App extends Component {\n          constructor(props) {\n            super(props);\n            this.state = { value: 'new' };\n          }\n\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            return (\n              <div>\n                new render + {this.state.value} state + {this.props.n}\n              </div>\n            );\n          }\n        }\n\n        RHL.register(App, 'App', 'test.js');\n\n        const Enhanced = mapProps(props => ({ n: props.n * 5 }))(App);\n        RHL.register(Enhanced, 'Enhanced', 'test.js');\n        wrapper.setProps({ children: <Enhanced n={4} /> });\n      }\n\n      expect(wrapper.text()).toBe('new render + old state + 20');\n    });\n\n    it('should work with react-lifecycle-compact', () => {\n      class Component extends React.Component {\n        static getDerivedStateFromProps() {\n          return {};\n        }\n      }\n\n      /* eslint-disable no-underscore-dangle */\n      polyfill(Component);\n      expect(Component.prototype.componentWillReceiveProps.__suppressDeprecationWarning).toBe(true);\n\n      const Proxy = <Component />.type;\n      expect(Proxy.prototype.componentWillReceiveProps.__suppressDeprecationWarning).toBe(true);\n\n      /* eslint-enable */\n    });\n  });\n});\n"
  },
  {
    "path": "test/__babel_fixtures__/bindings.js",
    "content": "import P, { Q } from \"left-pad\";\nconst A = 42;\nfunction B() {\n  function R() {}\n  class S {}\n  const T = 42;\n}\nexport class C {\n  U() {\n    function V() {\n      class W {}\n    }\n  }\n}\nconst D = class X {};\nlet E = D;\nvar Y = require(\"left-pad\");\nvar { Z } = require(\"left-pad\");\nexport default React.createClass({});"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/arguments.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    arguments;\n\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/arrow-function-in-constructor.js",
    "content": "class Foo {\n  constructor() {\n    this.onClick = (e) => e.target.value\n  }\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/async-functions-expression-body.js",
    "content": "class Foo {\n  bar = async (a, b) => await b(a)\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/async-functions.js",
    "content": "class Foo {\n  bar = async (a, b) => {\n    return await a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/block-body.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/default-params.js",
    "content": "class Foo {\n  bar = (a = \"foo\") => {\n    return `${a}bar`;\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/destructured-params.js",
    "content": "class Foo {\n  bar = ({ a }, { b }) => {\n    return `${a}${b}`;\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/expression-body.js",
    "content": "class Foo {\n  onClick = (e) => e.target.value\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/nested-arguments.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    () => {\n      arguments;\n    }\n\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/nested-new.target.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    () => {\n      new.target;\n    }\n\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/new.target.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    new.target;\n\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/not-a-function.js",
    "content": "class Foo {\n  bar = 2;\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/not-an-arrow-function.js",
    "content": "class Foo {\n  bar = function (a, b) {\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/same-name-as-class-method.js",
    "content": "class Foo {\n  bar = (a, b) => {\n    return a(b);\n  };\n\n  bar() {\n    return 2\n  }\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/class-properties/static-property.js",
    "content": "class Foo {\n  static bar = (a, b) => {\n    return a(b);\n  };\n}\n"
  },
  {
    "path": "test/__babel_fixtures__/counter.js",
    "content": "class Counter { }\nexport default () => <div><Counter /></div>"
  },
  {
    "path": "test/__babel_fixtures__/drop-hot-half.prod.js",
    "content": "import { hot } from 'react-hot-loader';\nimport { hot as rootHot } from 'react-hot-loader/root';\n\nconst control = compose(\n  withDebug,\n  withDebug,\n)(App);\n\nconst targetCase1 = compose(\n  withDebug,\n  withDebug,\n  hot(module),\n)(App);\n\nconst targetCase2 = compose(\n  withDebug,\n  withDebug,\n  rootHot,\n)(App);\n\nconst removeHot1 = hot(control);\nconst removeHot2 = hot(module)(control);\nconst removeHot3 = rootHot(control);"
  },
  {
    "path": "test/__babel_fixtures__/drop-hot.prod.js",
    "content": "import React from 'react'\nimport { hot, foo } from 'react-hot-loader'\nimport { hot as namedHot, foo as namedFoo } from 'react-hot-loader'\nimport { hot as rootHot } from 'react-hot-loader/root'\nimport { hot as namedHot2 } from 'react-hot-loader'\nimport { hot as notRHLHot } from 'not-react-hot-loader'\nimport * as RHL from 'react-hot-loader'\nimport * as RHL2 from 'react-hot-loader'\nimport * as NOTRHL from 'not-react-hot-loader'\n\nconst App = () => <div>Hello World!</div>\n\nconst a = hot(module)(App);\nconst z = rootHot(App);\nconst b = namedHot(module)(App);\nconst c = namedHot2(module)(App);\nconst d = RHL.hot(module)(App);\nconst e = RHL2.hot(module)(App);\n\nfoo(module)(App);\nnotRHLHot(module)(App);\nnamedFoo(module)(App);\nRHL.foo(module)(App);\nNOTRHL.hot(module)(App);\n\n// should not drop incomplete reference\nnamedFoo(module);\n\nexport { a, b, c, d, e, z };\n"
  },
  {
    "path": "test/__babel_fixtures__/hooks.js",
    "content": "import React, {useState} from 'react';\nimport {useExternalHook} from 'external-hook'\n\nconst NoHooks = () => <div>no hooks</div>;\n\nconst UseStateHook = () => {\n  useState(42);\n};\n\nconst UseStateHooks = () => {\n  useState(42);\n  useState(24);\n};\n\nconst useEffectHook = () => {\n  React.useEffect(() => ({}));\n  useState(24);\n  React.useState(42);\n};\n\nconst useForwardRefHook = React.forwardRef(() => {\n  React.useEffect(() => ({}));\n  useState(24);\n  React.useState(42);\n});\n\nconst useForwardRefFunctionHook = React.forwardRef(function () {\n  React.useEffect(() => ({}));\n  useState(24);\n  React.useState(42);\n});\n\nconst useCustomHook = () => {\n  useState(42);\n  useEffectHook();\n  useExternalHook();\n};\n\nconst useCustomHookAgain = () => {\n  useState(42);\n  useEffectHook();\n  useExternalHook();\n};\n\nconst useInnerHook = ({useHookFromProps}) => {\n  const useHookBase = () => useState();\n  const useHook = () => useState(useHookFromProps(useHookBase()));\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\nfunction useFunc () {\n  useState(42);\n  useEffectHook();\n};"
  },
  {
    "path": "test/__babel_fixtures__/issue-246.js",
    "content": "export function spread(...args) {\n  return args.push(1)\n}"
  },
  {
    "path": "test/__babel_fixtures__/local-hooks.js",
    "content": "import {useState} from \"react\";\n\nfunction Component1() {\n  function useRippleHandler() {}\n  useRippleHandler();\n  useRippleHandler();\n}\n\nfunction Component2() {\n  const useRippleHandler = () => {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\nfunction Component3() {\n  const useRippleHandler = function () {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\nconst useInnerHook = ({useHookFromProps}) => {\n  const useHookBase = () => useState();\n  const useHook = () => useState(useHookFromProps(useHookBase()));\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\nconst OnlyThisOneUsesExternalHook = () => {\n  useInnerHook();\n  useState();\n};\n\n// check for \"return [\""
  },
  {
    "path": "test/__babel_fixtures__/name-clash.js",
    "content": "const _default = 10;\nexport default 42;"
  },
  {
    "path": "test/__snapshots__/babel.test.js.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods arguments.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    var _arguments = arguments;\n\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      _arguments;\n\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods arrow function in constructor.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.onClick = function (e) {\n      return e.target.value;\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods async functions expression body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\\\\\"next\\\\\", value); }, function (err) { step(\\\\\"throw\\\\\", err); }); } } return step(\\\\\"next\\\\\"); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    var _this = this;\n\n    _classCallCheck(this, Foo);\n\n    this.bar = function () {\n      var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(a, b) {\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                _context.next = 2;\n                return b(a);\n\n              case 2:\n                return _context.abrupt(\\\\\"return\\\\\", _context.sent);\n\n              case 3:\n              case \\\\\"end\\\\\":\n                return _context.stop();\n            }\n          }\n        }, _callee, _this);\n      }));\n\n      return function (_x, _x2) {\n        return _ref.apply(this, arguments);\n      };\n    }();\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods async functions.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\\\\\"next\\\\\", value); }, function (err) { step(\\\\\"throw\\\\\", err); }); } } return step(\\\\\"next\\\\\"); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    var _this = this;\n\n    _classCallCheck(this, Foo);\n\n    this.bar = function () {\n      var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(a, b) {\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                _context.next = 2;\n                return a(b);\n\n              case 2:\n                return _context.abrupt(\\\\\"return\\\\\", _context.sent);\n\n              case 3:\n              case \\\\\"end\\\\\":\n                return _context.stop();\n            }\n          }\n        }, _callee, _this);\n      }));\n\n      return function (_x, _x2) {\n        return _ref.apply(this, arguments);\n      };\n    }();\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods block body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods default params.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function () {\n      var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \\\\\"foo\\\\\";\n\n      return a + \\\\\"bar\\\\\";\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods destructured params.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (_ref, _ref2) {\n      var a = _ref.a;\n      var b = _ref2.b;\n\n      return \\\\\"\\\\\" + a + b;\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods expression body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.onClick = function (e) {\n      return e.target.value;\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods nested arguments.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    var _arguments = arguments;\n\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      (function () {\n        _arguments;\n      });\n\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods nested new.target.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      (function () {\n        new.target;\n      });\n\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods new.target.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      new.target;\n\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods not a function.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = 2;\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods not an arrow function.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods same name as class method.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function () {\n  function Foo() {\n    _classCallCheck(this, Foo);\n\n    this.bar = function (a, b) {\n      return a(b);\n    };\n  }\n\n  _createClass(Foo, [{\n    key: \\\\\"bar\\\\\",\n    value: function bar() {\n      return 2;\n    }\n  }, {\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return Foo;\n}();\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" copies arrow function body block onto hidden class methods static property.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Foo = function Foo() {\n  _classCallCheck(this, Foo);\n};\n\nFoo.bar = function (a, b) {\n  return a(b);\n};\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components bindings.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.C = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\\\\"value\\\\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _leftPad = require(\\\\\"left-pad\\\\\");\n\nvar _leftPad2 = _interopRequireDefault(_leftPad);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar A = 42;\nfunction B() {\n  function R() {}\n\n  var S = function S() {\n    _classCallCheck(this, S);\n  };\n\n  var T = 42;\n}\n\nvar C = exports.C = function () {\n  function C() {\n    _classCallCheck(this, C);\n  }\n\n  _createClass(C, [{\n    key: \\\\\"U\\\\\",\n    value: function U() {\n      function V() {\n        var W = function W() {\n          _classCallCheck(this, W);\n        };\n      }\n    }\n  }, {\n    key: \\\\\"__reactstandin__regenerateByEval\\\\\",\n    // @ts-ignore\n    value: function __reactstandin__regenerateByEval(key, code) {\n      // @ts-ignore\n      this[key] = eval(code);\n    }\n  }]);\n\n  return C;\n}();\n\nvar D = function X() {\n  _classCallCheck(this, X);\n};\nvar E = D;\nvar Y = require(\\\\\"left-pad\\\\\");\n\nvar _require = require(\\\\\"left-pad\\\\\"),\n    Z = _require.Z;\n\nvar _default = React.createClass({\n  displayName: \\\\\"_default\\\\\"\n});\n\nexports.default = _default;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(A, \\\\\"A\\\\\", __FILENAME__);\n  reactHotLoader.register(B, \\\\\"B\\\\\", __FILENAME__);\n  reactHotLoader.register(C, \\\\\"C\\\\\", __FILENAME__);\n  reactHotLoader.register(D, \\\\\"D\\\\\", __FILENAME__);\n  reactHotLoader.register(E, \\\\\"E\\\\\", __FILENAME__);\n  reactHotLoader.register(_default, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components counter.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\\\\"Cannot call a class as a function\\\\\"); } }\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar Counter = function Counter() {\n  _classCallCheck(this, Counter);\n};\n\nvar _default = function _default() {\n  return React.createElement(\n    \\\\\"div\\\\\",\n    null,\n    React.createElement(Counter, null)\n  );\n};\n\nexports.default = _default;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Counter, \\\\\"Counter\\\\\", __FILENAME__);\n  reactHotLoader.register(_default, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components drop hot half.prod.js 1`] = `\n\"'use strict';\n\nvar _reactHotLoader = require('react-hot-loader');\n\nvar _root = require('react-hot-loader/root');\n\nvar control = compose(withDebug, withDebug)(App);\n\nvar targetCase1 = compose(withDebug, withDebug, (0, _reactHotLoader.hot)(module))(App);\n\nvar targetCase2 = compose(withDebug, withDebug, _root.hot)(App);\n\nvar removeHot1 = (0, _reactHotLoader.hot)(control);\nvar removeHot2 = control;\nvar removeHot3 = control;\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components drop hot.prod.js 1`] = `\n\"'use strict';\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.z = exports.e = exports.d = exports.c = exports.b = exports.a = undefined;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _reactHotLoader = require('react-hot-loader');\n\nvar RHL = _interopRequireWildcard(_reactHotLoader);\n\nvar RHL2 = _interopRequireWildcard(_reactHotLoader);\n\nvar _root = require('react-hot-loader/root');\n\nvar _notReactHotLoader = require('not-react-hot-loader');\n\nvar NOTRHL = _interopRequireWildcard(_notReactHotLoader);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar App = function App() {\n  return _react2.default.createElement(\n    'div',\n    null,\n    'Hello World!'\n  );\n};\n\nvar a = App;\nvar z = App;\nvar b = App;\nvar c = App;\nvar d = App;\nvar e = App;\n\n(0, _reactHotLoader.foo)(module)(App);\n(0, _notReactHotLoader.hot)(module)(App);\n(0, _reactHotLoader.foo)(module)(App);\nRHL.foo(module)(App);\nNOTRHL.hot(module)(App);\n\n// should not drop incomplete reference\n(0, _reactHotLoader.foo)(module);\n\nexports.a = a;\nexports.b = b;\nexports.c = c;\nexports.d = d;\nexports.e = e;\nexports.z = z;\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components hooks.js 1`] = `\n\"'use strict';\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _externalHook = require('external-hook');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar NoHooks = function NoHooks() {\n  return _react2.default.createElement(\n    'div',\n    null,\n    'no hooks'\n  );\n};\n\nvar UseStateHook = function UseStateHook() {\n  (0, _react.useState)(42);\n};\n\n__signature__(UseStateHook, 'useState{(42)}');\n\nvar UseStateHooks = function UseStateHooks() {\n  (0, _react.useState)(42);\n  (0, _react.useState)(24);\n};\n\n__signature__(UseStateHooks, 'useState{(42)}\\\\\\\\nuseState{(24)}');\n\nvar useEffectHook = function useEffectHook() {\n  _react2.default.useEffect(function () {\n    return {};\n  });\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n};\n\n__signature__(useEffectHook, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}');\n\nvar useForwardRefHook = _react2.default.forwardRef(__signature__(function () {\n  _react2.default.useEffect(function () {\n    return {};\n  });\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n}, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}'));\n\nvar useForwardRefFunctionHook = _react2.default.forwardRef(__signature__(function () {\n  _react2.default.useEffect(function () {\n    return {};\n  });\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n}, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}'));\n\nvar useCustomHook = function useCustomHook() {\n  (0, _react.useState)(42);\n  useEffectHook();\n  (0, _externalHook.useExternalHook)();\n};\n\n__signature__(useCustomHook, 'useState{(42)}\\\\\\\\nuseEffectHook{}\\\\\\\\nuseExternalHook{}', function () {\n  return [useEffectHook, _externalHook.useExternalHook];\n});\n\nvar useCustomHookAgain = function useCustomHookAgain() {\n  (0, _react.useState)(42);\n  useEffectHook();\n  (0, _externalHook.useExternalHook)();\n};\n\n__signature__(useCustomHookAgain, 'useState{(42)}\\\\\\\\nuseEffectHook{}\\\\\\\\nuseExternalHook{}', function () {\n  return [useEffectHook, _externalHook.useExternalHook];\n});\n\nvar useInnerHook = function useInnerHook(_ref) {\n  var useHookFromProps = _ref.useHookFromProps;\n\n  var useHookBase = function useHookBase() {\n    return (0, _react.useState)();\n  };\n\n  __signature__(useHookBase, 'useState{}');\n\n  var useHook = function useHook() {\n    return (0, _react.useState)(useHookFromProps(useHookBase()));\n  };\n\n  __signature__(useHook, 'useState{(useHookFromProps(useHookBase()))}\\\\\\\\nuseHookFromProps{}\\\\\\\\nuseHookBase{}', function () {\n    return [useHookFromProps, useHookBase];\n  });\n\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\n__signature__(useInnerHook, 'useHookFromProps{}\\\\\\\\nuseHook{}');\n\nfunction useFunc() {\n  (0, _react.useState)(42);\n  useEffectHook();\n}\n__signature__(useFunc, 'useState{(42)}\\\\\\\\nuseEffectHook{}', function () {\n  return [useEffectHook];\n});\n\n;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(NoHooks, 'NoHooks', __FILENAME__);\n  reactHotLoader.register(UseStateHook, 'UseStateHook', __FILENAME__);\n  reactHotLoader.register(UseStateHooks, 'UseStateHooks', __FILENAME__);\n  reactHotLoader.register(useEffectHook, 'useEffectHook', __FILENAME__);\n  reactHotLoader.register(useForwardRefHook, 'useForwardRefHook', __FILENAME__);\n  reactHotLoader.register(useForwardRefFunctionHook, 'useForwardRefFunctionHook', __FILENAME__);\n  reactHotLoader.register(useCustomHook, 'useCustomHook', __FILENAME__);\n  reactHotLoader.register(useCustomHookAgain, 'useCustomHookAgain', __FILENAME__);\n  reactHotLoader.register(useInnerHook, 'useInnerHook', __FILENAME__);\n  reactHotLoader.register(useFunc, 'useFunc', __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components issue 246.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.spread = spread;\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nfunction spread() {\n  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n    args[_key] = arguments[_key];\n  }\n\n  return args.push(1);\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(spread, \\\\\"spread\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components local hooks.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _react = require(\\\\\"react\\\\\");\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nfunction Component1() {\n  function useRippleHandler() {}\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component1, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nfunction Component2() {\n  var useRippleHandler = function useRippleHandler() {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component2, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nfunction Component3() {\n  var useRippleHandler = function useRippleHandler() {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component3, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nvar useInnerHook = function useInnerHook(_ref) {\n  var useHookFromProps = _ref.useHookFromProps;\n\n  var useHookBase = function useHookBase() {\n    return (0, _react.useState)();\n  };\n\n  __signature__(useHookBase, \\\\\"useState{}\\\\\");\n\n  var useHook = function useHook() {\n    return (0, _react.useState)(useHookFromProps(useHookBase()));\n  };\n\n  __signature__(useHook, \\\\\"useState{(useHookFromProps(useHookBase()))}\\\\\\\\nuseHookFromProps{}\\\\\\\\nuseHookBase{}\\\\\", function () {\n    return [useHookFromProps, useHookBase];\n  });\n\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\n__signature__(useInnerHook, \\\\\"useHookFromProps{}\\\\\\\\nuseHook{}\\\\\");\n\nvar OnlyThisOneUsesExternalHook = function OnlyThisOneUsesExternalHook() {\n  useInnerHook();\n  (0, _react.useState)();\n};\n\n// check for \\\\\"return [\\\\\"\n\n__signature__(OnlyThisOneUsesExternalHook, \\\\\"useInnerHook{}\\\\\\\\nuseState{}\\\\\", function () {\n  return [useInnerHook];\n});\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Component1, \\\\\"Component1\\\\\", __FILENAME__);\n  reactHotLoader.register(Component2, \\\\\"Component2\\\\\", __FILENAME__);\n  reactHotLoader.register(Component3, \\\\\"Component3\\\\\", __FILENAME__);\n  reactHotLoader.register(useInnerHook, \\\\\"useInnerHook\\\\\", __FILENAME__);\n  reactHotLoader.register(OnlyThisOneUsesExternalHook, \\\\\"OnlyThisOneUsesExternalHook\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"es2015\" tags potential React components name clash.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nvar _default = 10;\nvar _default2 = 42;\nexports.default = _default2;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(_default, \\\\\"_default\\\\\", __FILENAME__);\n  reactHotLoader.register(_default2, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods arguments.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      arguments;\n\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods arrow function in constructor.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.onClick = e => e.target.value;\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods async functions expression body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = async (a, b) => await b(a);\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods async functions.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = async (a, b) => {\n      return await a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods block body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods default params.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a = \\\\\"foo\\\\\") => {\n      return \\`\\${a}bar\\`;\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods destructured params.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = ({ a }, { b }) => {\n      return \\`\\${a}\\${b}\\`;\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods expression body.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.onClick = e => e.target.value;\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods nested arguments.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      () => {\n        arguments;\n      };\n\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods nested new.target.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      () => {\n        new.target;\n      };\n\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods new.target.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      new.target;\n\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods not a function.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = 2;\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods not an arrow function.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = function (a, b) {\n      return a(b);\n    };\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods same name as class method.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {\n  constructor() {\n    this.bar = (a, b) => {\n      return a(b);\n    };\n  }\n\n  bar() {\n    return 2;\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" copies arrow function body block onto hidden class methods static property.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Foo {}\n\nFoo.bar = (a, b) => {\n  return a(b);\n};\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Foo, \\\\\"Foo\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components bindings.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.C = undefined;\n\nvar _leftPad = require(\\\\\"left-pad\\\\\");\n\nvar _leftPad2 = _interopRequireDefault(_leftPad);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nconst A = 42;\nfunction B() {\n  function R() {}\n  class S {}\n  const T = 42;\n}\nclass C {\n  U() {\n    function V() {\n      class W {}\n    }\n  }\n\n  // @ts-ignore\n  __reactstandin__regenerateByEval(key, code) {\n    // @ts-ignore\n    this[key] = eval(code);\n  }\n\n}\nexports.C = C;\nconst D = class X {};\nlet E = D;\nvar Y = require(\\\\\"left-pad\\\\\");\nvar { Z } = require(\\\\\"left-pad\\\\\");\n\nconst _default = React.createClass({\n  displayName: \\\\\"_default\\\\\"\n});\n\nexports.default = _default;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(A, \\\\\"A\\\\\", __FILENAME__);\n  reactHotLoader.register(B, \\\\\"B\\\\\", __FILENAME__);\n  reactHotLoader.register(C, \\\\\"C\\\\\", __FILENAME__);\n  reactHotLoader.register(D, \\\\\"D\\\\\", __FILENAME__);\n  reactHotLoader.register(E, \\\\\"E\\\\\", __FILENAME__);\n  reactHotLoader.register(_default, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components counter.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nclass Counter {}\n\nconst _default = () => React.createElement(\n  \\\\\"div\\\\\",\n  null,\n  React.createElement(Counter, null)\n);\n\nexports.default = _default;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Counter, \\\\\"Counter\\\\\", __FILENAME__);\n  reactHotLoader.register(_default, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components drop hot half.prod.js 1`] = `\n\"'use strict';\n\nvar _reactHotLoader = require('react-hot-loader');\n\nvar _root = require('react-hot-loader/root');\n\nconst control = compose(withDebug, withDebug)(App);\n\nconst targetCase1 = compose(withDebug, withDebug, (0, _reactHotLoader.hot)(module))(App);\n\nconst targetCase2 = compose(withDebug, withDebug, _root.hot)(App);\n\nconst removeHot1 = (0, _reactHotLoader.hot)(control);\nconst removeHot2 = control;\nconst removeHot3 = control;\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components drop hot.prod.js 1`] = `\n\"'use strict';\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.z = exports.e = exports.d = exports.c = exports.b = exports.a = undefined;\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _reactHotLoader = require('react-hot-loader');\n\nvar RHL = _interopRequireWildcard(_reactHotLoader);\n\nvar RHL2 = _interopRequireWildcard(_reactHotLoader);\n\nvar _root = require('react-hot-loader/root');\n\nvar _notReactHotLoader = require('not-react-hot-loader');\n\nvar NOTRHL = _interopRequireWildcard(_notReactHotLoader);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst App = () => _react2.default.createElement(\n  'div',\n  null,\n  'Hello World!'\n);\n\nconst a = App;\nconst z = App;\nconst b = App;\nconst c = App;\nconst d = App;\nconst e = App;\n\n(0, _reactHotLoader.foo)(module)(App);\n(0, _notReactHotLoader.hot)(module)(App);\n(0, _reactHotLoader.foo)(module)(App);\nRHL.foo(module)(App);\nNOTRHL.hot(module)(App);\n\n// should not drop incomplete reference\n(0, _reactHotLoader.foo)(module);\n\nexports.a = a;\nexports.b = b;\nexports.c = c;\nexports.d = d;\nexports.e = e;\nexports.z = z;\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components hooks.js 1`] = `\n\"'use strict';\n\nvar _react = require('react');\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _externalHook = require('external-hook');\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nconst NoHooks = () => _react2.default.createElement(\n  'div',\n  null,\n  'no hooks'\n);\n\nconst UseStateHook = () => {\n  (0, _react.useState)(42);\n};\n\n__signature__(UseStateHook, 'useState{(42)}');\n\nconst UseStateHooks = () => {\n  (0, _react.useState)(42);\n  (0, _react.useState)(24);\n};\n\n__signature__(UseStateHooks, 'useState{(42)}\\\\\\\\nuseState{(24)}');\n\nconst useEffectHook = () => {\n  _react2.default.useEffect(() => ({}));\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n};\n\n__signature__(useEffectHook, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}');\n\nconst useForwardRefHook = _react2.default.forwardRef(__signature__(() => {\n  _react2.default.useEffect(() => ({}));\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n}, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}'));\n\nconst useForwardRefFunctionHook = _react2.default.forwardRef(__signature__(function () {\n  _react2.default.useEffect(() => ({}));\n  (0, _react.useState)(24);\n  _react2.default.useState(42);\n}, 'useEffect{}\\\\\\\\nuseState{(24)}\\\\\\\\nuseState{(42)}'));\n\nconst useCustomHook = () => {\n  (0, _react.useState)(42);\n  useEffectHook();\n  (0, _externalHook.useExternalHook)();\n};\n\n__signature__(useCustomHook, 'useState{(42)}\\\\\\\\nuseEffectHook{}\\\\\\\\nuseExternalHook{}', () => [useEffectHook, _externalHook.useExternalHook]);\n\nconst useCustomHookAgain = () => {\n  (0, _react.useState)(42);\n  useEffectHook();\n  (0, _externalHook.useExternalHook)();\n};\n\n__signature__(useCustomHookAgain, 'useState{(42)}\\\\\\\\nuseEffectHook{}\\\\\\\\nuseExternalHook{}', () => [useEffectHook, _externalHook.useExternalHook]);\n\nconst useInnerHook = ({ useHookFromProps }) => {\n  const useHookBase = () => (0, _react.useState)();\n\n  __signature__(useHookBase, 'useState{}');\n\n  const useHook = () => (0, _react.useState)(useHookFromProps(useHookBase()));\n\n  __signature__(useHook, 'useState{(useHookFromProps(useHookBase()))}\\\\\\\\nuseHookFromProps{}\\\\\\\\nuseHookBase{}', () => [useHookFromProps, useHookBase]);\n\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\n__signature__(useInnerHook, 'useHookFromProps{}\\\\\\\\nuseHook{}');\n\nfunction useFunc() {\n  (0, _react.useState)(42);\n  useEffectHook();\n}\n__signature__(useFunc, 'useState{(42)}\\\\\\\\nuseEffectHook{}', () => [useEffectHook]);\n\n;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(NoHooks, 'NoHooks', __FILENAME__);\n  reactHotLoader.register(UseStateHook, 'UseStateHook', __FILENAME__);\n  reactHotLoader.register(UseStateHooks, 'UseStateHooks', __FILENAME__);\n  reactHotLoader.register(useEffectHook, 'useEffectHook', __FILENAME__);\n  reactHotLoader.register(useForwardRefHook, 'useForwardRefHook', __FILENAME__);\n  reactHotLoader.register(useForwardRefFunctionHook, 'useForwardRefFunctionHook', __FILENAME__);\n  reactHotLoader.register(useCustomHook, 'useCustomHook', __FILENAME__);\n  reactHotLoader.register(useCustomHookAgain, 'useCustomHookAgain', __FILENAME__);\n  reactHotLoader.register(useInnerHook, 'useInnerHook', __FILENAME__);\n  reactHotLoader.register(useFunc, 'useFunc', __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components issue 246.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\nexports.spread = spread;\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nfunction spread(...args) {\n  return args.push(1);\n}\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(spread, \\\\\"spread\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components local hooks.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nvar _react = require(\\\\\"react\\\\\");\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nfunction Component1() {\n  function useRippleHandler() {}\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component1, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nfunction Component2() {\n  const useRippleHandler = () => {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component2, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nfunction Component3() {\n  const useRippleHandler = function () {};\n  useRippleHandler();\n  useRippleHandler();\n}\n\n__signature__(Component3, \\\\\"useRippleHandler{}\\\\\\\\nuseRippleHandler{}\\\\\");\n\nconst useInnerHook = ({ useHookFromProps }) => {\n  const useHookBase = () => (0, _react.useState)();\n\n  __signature__(useHookBase, \\\\\"useState{}\\\\\");\n\n  const useHook = () => (0, _react.useState)(useHookFromProps(useHookBase()));\n\n  __signature__(useHook, \\\\\"useState{(useHookFromProps(useHookBase()))}\\\\\\\\nuseHookFromProps{}\\\\\\\\nuseHookBase{}\\\\\", () => [useHookFromProps, useHookBase]);\n\n  useHookFromProps();\n  {\n    // sub scope\n    useHook();\n  }\n};\n\n__signature__(useInnerHook, \\\\\"useHookFromProps{}\\\\\\\\nuseHook{}\\\\\");\n\nconst OnlyThisOneUsesExternalHook = () => {\n  useInnerHook();\n  (0, _react.useState)();\n};\n\n// check for \\\\\"return [\\\\\"\n\n__signature__(OnlyThisOneUsesExternalHook, \\\\\"useInnerHook{}\\\\\\\\nuseState{}\\\\\", () => [useInnerHook]);\n\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(Component1, \\\\\"Component1\\\\\", __FILENAME__);\n  reactHotLoader.register(Component2, \\\\\"Component2\\\\\", __FILENAME__);\n  reactHotLoader.register(Component3, \\\\\"Component3\\\\\", __FILENAME__);\n  reactHotLoader.register(useInnerHook, \\\\\"useInnerHook\\\\\", __FILENAME__);\n  reactHotLoader.register(OnlyThisOneUsesExternalHook, \\\\\"OnlyThisOneUsesExternalHook\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n\nexports[`babel Targetting \"modern\" tags potential React components name clash.js 1`] = `\n\"\\\\\"use strict\\\\\";\n\nObject.defineProperty(exports, \\\\\"__esModule\\\\\", {\n  value: true\n});\n\n(function () {\n  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;\n  enterModule && enterModule(module);\n})();\n\nvar __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {\n  return a;\n};\n\nconst _default = 10;\nconst _default2 = 42;\nexports.default = _default2;\n;\n\n(function () {\n  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;\n\n  if (!reactHotLoader) {\n    return;\n  }\n\n  reactHotLoader.register(_default, \\\\\"_default\\\\\", __FILENAME__);\n  reactHotLoader.register(_default2, \\\\\"default\\\\\", __FILENAME__);\n})();\n\n;\n\n(function () {\n  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;\n  leaveModule && leaveModule(module);\n})();\"\n`;\n"
  },
  {
    "path": "test/babel.test.js",
    "content": "import path from 'path';\nimport fs from 'fs';\nimport { transformFileSync } from 'babel-core';\n/* eslint-disable import/no-unresolved, import/extensions */\nimport { getOptions, TARGETS } from '../testConfig/babel';\nimport plugin from '../src/babel.dev';\n/* eslint-enable import/no-unresolved, import/extensions */\n\nconst babelPlugin = path.resolve(__dirname, '../src/babel.dev');\nconst babelPluginProd = path.resolve(__dirname, '../src/babel.prod');\n\nconst FIXTURES_DIR = path.join(__dirname, '__babel_fixtures__');\n\nfunction trim(str) {\n  return str.replace(/^\\s+|\\s+$/, '');\n}\n\nfunction addRHLPlugin(babel, prod = false) {\n  babel.plugins.push(prod ? babelPluginProd : babelPlugin);\n  return babel;\n}\n\ndescribe('babel', () => {\n  TARGETS.forEach(target => {\n    describe(`Targetting \"${target}\"`, () => {\n      describe('tags potential React components', () => {\n        fs.readdirSync(FIXTURES_DIR).forEach(fixtureName => {\n          const fixtureFile = path.join(FIXTURES_DIR, fixtureName);\n          const isForProd = fixtureName.endsWith('.prod.js');\n          if (fs.statSync(fixtureFile).isFile()) {\n            it(fixtureName.split('-').join(' '), () => {\n              const actual = transformFileSync(fixtureFile, addRHLPlugin(getOptions(target), isForProd)).code;\n              const codeWithoutFilename = actual.replace(\n                new RegExp(`[\"']${fixtureFile.replace(/\\\\/g, '/')}[\"']`, 'g'),\n                '__FILENAME__',\n              );\n              expect(trim(codeWithoutFilename)).toMatchSnapshot();\n            });\n          }\n        });\n      });\n\n      describe('copies arrow function body block onto hidden class methods', () => {\n        const fixturesDir = path.join(FIXTURES_DIR, 'class-properties');\n        fs.readdirSync(fixturesDir).forEach(fixtureName => {\n          const fixtureFile = path.join(fixturesDir, fixtureName);\n          if (fs.statSync(fixtureFile).isFile()) {\n            it(fixtureName.split('-').join(' '), () => {\n              const actual = transformFileSync(fixtureFile, addRHLPlugin(getOptions(target))).code;\n              const codeWithoutFilename = actual.replace(\n                new RegExp(`[\"']${fixtureFile.replace(/\\\\/g, '/')}[\"']`, 'g'),\n                '__FILENAME__',\n              );\n              expect(trim(codeWithoutFilename)).toMatchSnapshot();\n            });\n          }\n        });\n      });\n    });\n  });\n\n  describe('babel helpers', () => {\n    const { shouldIgnoreFile } = plugin;\n    it('should ignore react and hot-loader', () => {\n      expect(shouldIgnoreFile('node_modules/react')).toBe(true);\n      expect(shouldIgnoreFile('node_modules\\\\react')).toBe(true);\n      expect(shouldIgnoreFile('node_modules/react/xyz')).toBe(true);\n\n      expect(shouldIgnoreFile('node_modules/react-hot-loader')).toBe(true);\n      expect(shouldIgnoreFile('node_modules/react-hot-loader/xyz')).toBe(true);\n    });\n\n    it('should pass all other files', () => {\n      expect(shouldIgnoreFile('react')).toBe(false);\n      expect(shouldIgnoreFile('node_modules/react-select')).toBe(false);\n      expect(shouldIgnoreFile('node_modules\\\\react-select')).toBe(false);\n      expect(shouldIgnoreFile('some_modules/react/xyz')).toBe(false);\n\n      expect(shouldIgnoreFile('node_modules/react-cold-loader')).toBe(false);\n      expect(shouldIgnoreFile('react-hot-loader.js')).toBe(false);\n    });\n  });\n});\n"
  },
  {
    "path": "test/build.test.js",
    "content": "/* eslint-disable camelcase */\nimport { REGENERATE_METHOD as REGENERATE_METHOD_std } from '../src/proxy';\nimport { REGENERATE_METHOD as REGENERATE_METHOD_rhl } from '../src/internal/constants';\n\ndescribe('Consistency tests', () => {\n  it('Should be constant con', () => {\n    expect(REGENERATE_METHOD_rhl).toBe(REGENERATE_METHOD_std);\n  });\n});\n"
  },
  {
    "path": "test/cases/hooks/useContext.test.js",
    "content": "/* eslint-env browser */\n/* eslint-disable no-lone-blocks,  global-require */\nimport 'babel-polyfill';\nimport React from 'react';\nimport TestRenderer from 'react-test-renderer';\nimport ReactHotLoader, { AppContainer, setConfig } from '../../../src/index.dev';\nimport { configureGeneration } from '../../../src/global/generation';\n\n// jest.mock('react-dom', () => require('@hot-loader/react-dom'));\n\ndescribe(`Hooks: useContext`, () => {\n  beforeEach(() => {\n    ReactHotLoader.reset();\n    setConfig({\n      ignoreSFC: true,\n    });\n    configureGeneration(1, 1);\n  });\n\n  if (React.useContext) {\n    it('use', () => {\n      let failed = false;\n      const context = React.createContext(0);\n      const Wrapper = () => {\n        const ctx = React.useContext(context);\n        if (ctx) {\n          return `pass ${ctx}`;\n        }\n        failed = true;\n        return 'fail';\n      };\n      ReactHotLoader.register(Wrapper, 'wrapper', 'hook-test');\n\n      const wrapper = TestRenderer.create(\n        <AppContainer update>\n          <context.Provider value={1}>\n            <Wrapper />\n          </context.Provider>\n        </AppContainer>,\n      );\n\n      expect(wrapper.toJSON()).toEqual('pass 1');\n      expect(failed).toBe(false);\n\n      {\n        ReactHotLoader.register(Wrapper, 'wrapper', 'hook-test');\n        wrapper.update(\n          <AppContainer update>\n            <context.Provider value={2}>\n              <Wrapper />\n            </context.Provider>\n          </AppContainer>,\n        );\n        expect(wrapper.toJSON()).toEqual('pass 2');\n        expect(failed).toBe(false);\n      }\n    });\n  } else {\n    it('target platform does not support useContext', () => {\n      expect(true).toBe(true);\n    });\n  }\n});\n"
  },
  {
    "path": "test/cases/memo/memo.test.js",
    "content": "/* eslint-env browser */\nimport 'babel-polyfill';\nimport React from 'react';\nimport TestRenderer from 'react-test-renderer';\nimport ReactHotLoader, { AppContainer } from '../../../src/index.dev';\nimport { configureGeneration } from '../../../src/global/generation';\n\n// jest.mock('react-dom', () => require('@hot-loader/react-dom'));\n\ndescribe(`React.memo`, () => {\n  beforeEach(() => {\n    ReactHotLoader.reset();\n    configureGeneration(1, 1);\n  });\n\n  const snapShot = {\n    children: ['this is component 2'],\n    props: {},\n    type: 'div',\n  };\n\n  if (React.memo) {\n    it('memo wrapping functional component', () => {\n      const Memo = React.memo(() => <div>this is component 1</div>);\n      ReactHotLoader.register(Memo, 'memo', 'memo-test');\n\n      const wrapper = TestRenderer.create(\n        <AppContainer>\n          <Memo />\n        </AppContainer>,\n      );\n\n      {\n        const Memo = React.memo(() => <div>this is component 2</div>);\n        ReactHotLoader.register(Memo, 'memo', 'memo-test');\n        wrapper.update(\n          <AppContainer update>\n            <Memo test />\n          </AppContainer>,\n        );\n\n        expect(wrapper.toJSON()).toEqual(snapShot);\n      }\n    });\n\n    it('memo wrapping forwardRef component', () => {\n      const Memo = React.memo(React.forwardRef(() => <div>this is component 1</div>));\n      ReactHotLoader.register(Memo, 'memo', 'memo-test');\n\n      const wrapper = TestRenderer.create(\n        <AppContainer>\n          <Memo />\n        </AppContainer>,\n      );\n\n      {\n        const Memo = React.memo(React.forwardRef(() => <div>this is component 2</div>));\n        ReactHotLoader.register(Memo, 'memo', 'memo-test');\n        wrapper.update(\n          <AppContainer update>\n            <Memo />\n          </AppContainer>,\n        );\n\n        expect(wrapper.toJSON()).toEqual(snapShot);\n      }\n    });\n  } else {\n    it('target platform does not support React.memo', () => {\n      expect(true).toBe(true);\n    });\n  }\n});\n"
  },
  {
    "path": "test/global/generation.test.js",
    "content": "import * as generation from '../../src/global/generation';\n\ndescribe('generation', () => {\n  it('should maintain generation counter', () => {\n    expect(generation.get()).toBe(1);\n    generation.increment();\n    expect(generation.get()).toBe(2);\n  });\n});\n"
  },
  {
    "path": "test/global/modules.test.js",
    "content": "import * as modules from '../../src/global/modules';\n\ndescribe('modules', () => {\n  it('should register enter/leave module', () => {\n    const module = { id: 'myModule.js' };\n    expect(modules.isOpened(module)).toBe(false);\n    modules.enter(module);\n    expect(modules.isOpened(module)).toBe(true);\n    modules.leave(module);\n    expect(modules.isOpened(module)).toBe(false);\n  });\n});\n"
  },
  {
    "path": "test/hot/.gitignore",
    "content": "react-dom"
  },
  {
    "path": "test/hot/createPatchedReact.js",
    "content": "const { writeFileSync, readFileSync, readdirSync, statSync, mkdirSync } = require('fs');\nconst {\n  default: { patch },\n} = require('../../webpack');\n\nconst copyFile = (source, dest) => {\n  const data = readFileSync(source).toString();\n  const patchedData = patch(data);\n  writeFileSync(dest, patchedData || data);\n};\n\nconst copy = (source, target) => {\n  const list = readdirSync(source);\n  for (const i of list) {\n    const sourceFile = `${source}/${i}`;\n    const targetFile = `${target}/${i}`;\n\n    const stat = statSync(sourceFile);\n    if (stat.isDirectory()) {\n      mkdirSync(`${target}/${i}`);\n      copy(sourceFile, targetFile);\n    } else {\n      copyFile(sourceFile, targetFile);\n    }\n  }\n};\n\nconst TARGET = `${__dirname}/react-dom`;\n\nmkdirSync(TARGET);\n\ncopy('./node_modules/react-dom/', TARGET);\n"
  },
  {
    "path": "test/hot/react-dom.integration.spec.js",
    "content": "/* eslint-env browser */\n/* eslint-disable no-lone-blocks,  global-require, prefer-template, import/no-unresolved */\nimport 'babel-polyfill';\nimport React, { Suspense } from 'react';\nimport ReactDom from 'react-dom';\n// import TestRenderer from 'react-test-renderer';\nimport ReactHotLoader, { setConfig } from '../../src/index.dev';\nimport { configureGeneration, enterHotUpdate, incrementHotGeneration } from '../../src/global/generation';\nimport configuration from '../../src/configuration';\nimport AppContainer from '../../src/AppContainer.dev';\nimport reactHotLoader from '../../src/reactHotLoader';\nimport reconcileHotReplacement from '../../src/reconciler';\n\njest.mock('react-dom', () => {\n  const reactDom = require('./react-dom');\n  return reactDom;\n});\n\ndescribe(`🔥-dom`, () => {\n  beforeEach(() => {\n    ReactHotLoader.reset();\n    setConfig({\n      ignoreSFC: true,\n    });\n    configureGeneration(1, 1);\n    reactHotLoader.register(AppContainer, 'AppContainer', 'test');\n  });\n\n  const tick = () => new Promise(resolve => setTimeout(resolve, 10));\n\n  if (React.useContext && String(() => 42).indexOf('=>') > 0) {\n    it('shall integrate with React', () => {\n      expect(configuration.IS_REACT_MERGE_ENABLED).toBe(true);\n      expect(configuration.integratedResolver).toBe(true);\n      expect(React.useEffect.isPatchedByReactHotLoader).toBe(true);\n    });\n\n    it('should use component comparator', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(() => {\n          mount('test1');\n          return unmount;\n        }, []);\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          React.useEffect(() => {\n            mount('test2');\n            return unmount;\n          }, []);\n          return 'fun2';\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      // THIS TEST IS EXPECTED TO FAIL ON LOCAL MACHINE (have no idea why)!!\n      expect(mount).not.toHaveBeenCalledWith('test2');\n      expect(unmount).not.toHaveBeenCalled();\n    });\n\n    it('should fail component comparator', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(() => {\n          mount('test1');\n          return unmount;\n        }, []);\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n\n      incrementHotGeneration();\n      {\n        const Fun2 = () => {\n          React.useEffect(() => {\n            mount('test2');\n            return unmount;\n          }, []);\n          return 'fun2';\n        };\n        ReactDom.render(<Fun2 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      expect(mount).toHaveBeenCalledWith('test2');\n      expect(unmount).toHaveBeenCalled();\n    });\n\n    it('should reload context', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n\n      const genApp = contextValue => {\n        const context = React.createContext(contextValue);\n\n        const RenderContext = () => {\n          const v = React.useContext(context);\n\n          return (\n            <span>\n              contextValue={v}\n              <context.Consumer>{v => `~${v}~`}</context.Consumer>\n            </span>\n          );\n        };\n\n        const MountCheck = () => {\n          React.useEffect(() => {\n            mount('test1');\n            return unmount;\n          }, []);\n          return 'fun1';\n        };\n\n        const App = () => (\n          <div>\n            <RenderContext />\n            <context.Provider value={`~${contextValue}~`}>\n              <RenderContext />\n              <MountCheck />\n            </context.Provider>\n          </div>\n        );\n\n        ReactHotLoader.register(context, 'context', 'test');\n\n        return App;\n      };\n\n      const el = document.createElement('div');\n      const App1 = genApp('1-test-1');\n      ReactDom.render(<App1 />, el);\n\n      expect(el.innerHTML).toMatch(/1-test-1/);\n      expect(el.innerHTML).toMatch(/~1-test-1~/);\n      expect(el.innerHTML).toMatch(/~~1-test-1~~/);\n\n      incrementHotGeneration();\n      {\n        const App1 = genApp('2-hot-2');\n        ReactDom.render(<App1 />, el);\n      }\n\n      await tick();\n\n      expect(el.innerHTML).toMatch(/2-hot-2/);\n      expect(el.innerHTML).toMatch(/~2-hot-2~/);\n      expect(el.innerHTML).toMatch(/~~2-hot-2~~/);\n\n      expect(mount).toHaveBeenCalledTimes(1);\n      expect(unmount).toHaveBeenCalledTimes(0);\n    });\n\n    it('should reload hook effect', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(\n          () => {\n            mount('test1');\n            return unmount;\n          },\n          ['hot'],\n        );\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          React.useEffect(\n            () => {\n              mount('test2');\n              return unmount;\n            },\n            ['hot'],\n          );\n          return 'fun2';\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      expect(unmount).toHaveBeenCalled();\n\n      expect(mount).toHaveBeenCalledWith('test2');\n    });\n\n    it('should fail on hook order change', async () => {\n      const Fun1 = () => {\n        const [state, setState] = React.useState('test0');\n        React.useEffect(() => setState('test1'), []);\n        return state;\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('test0');\n\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          React.useState('anotherstate');\n          const [state, setState] = React.useState('test0');\n          React.useEffect(() => setState('test1'), []);\n          return state;\n        };\n        expect(() => ReactDom.render(<Fun1 />, el)).toThrow();\n      }\n    });\n\n    it('should set on hook order change if signature provided', async () => {\n      const ref = React.createRef();\n      const App = ({ children }) => (\n        <AppContainer ref={ref}>\n          <React.Fragment>{children}</React.Fragment>\n        </AppContainer>\n      );\n      const Fun1 = () => {\n        const [state, setState] = React.useState('test0');\n        React.useEffect(() => setState('test1'), []);\n        return state;\n      };\n\n      const Fun2 = () => {\n        const [state, setState] = React.useState('step1');\n        React.useEffect(() => setState('step2'), []);\n        return state;\n      };\n\n      reactHotLoader.signature(Fun1, 'fun1-key1');\n      reactHotLoader.register(Fun1, 'Fun1', 'test');\n\n      const el = document.createElement('div');\n      ReactDom.render(\n        <App>\n          <Fun1 />\n          <Fun2 />\n        </App>,\n        el,\n      );\n\n      expect(el.innerHTML).toEqual('test0step1');\n      await tick();\n      expect(el.innerHTML).toEqual('test1step2');\n\n      {\n        const Fun1 = () => {\n          React.useState('anotherstate');\n          const [state, setState] = React.useState('test-new');\n          React.useEffect(() => setState('test1'), []);\n          return state;\n        };\n        reactHotLoader.signature(Fun1, 'fun1-key2');\n        reactHotLoader.register(Fun1, 'Fun1', 'test');\n\n        incrementHotGeneration();\n        enterHotUpdate();\n        reconcileHotReplacement(ref.current);\n\n        expect(() =>\n          ReactDom.render(\n            <App>\n              <Fun1 />\n              <Fun2 />\n            </App>,\n            el,\n          ),\n        ).not.toThrow();\n        expect(el.innerHTML).toEqual('test-newstep2');\n      }\n    });\n\n    it('should reset hook comparator', async () => {\n      const Fun1 = () => {\n        const [state, setState] = React.useState('test0');\n        React.useEffect(() => setState('test1'), []);\n        return state;\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('test0');\n      await tick();\n      expect(el.innerHTML).toEqual('test1');\n\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          const [state, setState] = React.useState('test0');\n          React.useEffect(() => setState('test2'), []);\n          return state;\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n      // THIS TEST IS EXPECTED TO FAIL ON LOCAL MACHINE (have no idea why)!!\n      expect(el.innerHTML).toEqual('test1');\n\n      incrementHotGeneration();\n      {\n        const f = () => React.useState(0); // aka fail\n        const Fun1 = () => {\n          const [state, setState] = React.useState('test0');\n          React.useEffect(() => setState('test3'), []);\n          f();\n          return 'h' + state;\n        };\n        ReactHotLoader.signature(Fun1, 'somevalue');\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n      expect(el.innerHTML).toEqual('htest3');\n    });\n\n    it('should support classes', async () => {\n      class Comp1 extends React.Component {\n        state = {\n          x: 1,\n        };\n\n        render() {\n          return 'test1' + this.state.x;\n        }\n      }\n\n      Comp1.displayName = 'Comp1';\n\n      const el = document.createElement('div');\n      ReactDom.render(<Comp1 />, el);\n\n      expect(el.innerHTML).toEqual('test11');\n      if (configuration.intergratedResolver) {\n        expect(<Comp1 />.type).toBe(Comp1);\n      }\n\n      incrementHotGeneration();\n      {\n        class Comp1 extends React.Component {\n          state = {\n            x: 2,\n          };\n\n          render() {\n            return 'test2' + this.state.x;\n          }\n        }\n\n        Comp1.displayName = 'Comp1';\n\n        ReactDom.render(<Comp1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('test21');\n    });\n\n    it('should support registered classes', async () => {\n      class Comp1 extends React.Component {\n        state = {\n          x: 1,\n        };\n\n        render() {\n          return 'test1' + this.state.x;\n        }\n      }\n\n      ReactHotLoader.register(Comp1, 'comp1', 'test');\n\n      const el = document.createElement('div');\n      ReactDom.render(<Comp1 />, el);\n\n      expect(el.innerHTML).toEqual('test11');\n      if (configuration.intergratedResolver) {\n        expect(<Comp1 />.type).toBe(Comp1);\n      }\n\n      incrementHotGeneration();\n      {\n        class Comp1 extends React.Component {\n          state = {\n            x: 2,\n          };\n\n          render() {\n            return 'test2' + this.state.x;\n          }\n        }\n\n        ReactHotLoader.register(Comp1, 'comp1', 'test');\n        ReactDom.render(<Comp1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('test21');\n    });\n\n    it('support lazy memo forward in Provider', () => {\n      setConfig({\n        wrapLazy: false,\n      });\n\n      const spy = jest.fn();\n      const sandbox = x => {\n        const Comp = () => {\n          React.useEffect(() => () => spy(), []);\n          return <div>lazy {x}</div>;\n        };\n        ReactHotLoader.register(Comp, 'S1Comp', 'test');\n        // use sync importer\n        const importer = {\n          then(x) {\n            const result = x({ default: Comp });\n            return {\n              then(cb) {\n                cb(result);\n              },\n            };\n          },\n        };\n\n        const Lazy = React.lazy(() => importer);\n        ReactHotLoader.register(Lazy, 'S1Lazy', 'test');\n\n        const Context = React.createContext();\n        ReactHotLoader.register(Context, 'S1Context', 'test');\n\n        const Forward = React.forwardRef(() => (\n          <Suspense fallback=\"loading\">\n            <Context.Provider>\n              <Lazy />\n            </Context.Provider>\n          </Suspense>\n        ));\n        const Memo = Forward; // React.memo(Forward);\n        ReactHotLoader.register(Memo, 'S1Memo', 'test');\n        return () => (\n          <AppContainer>\n            <Memo />\n          </AppContainer>\n        );\n      };\n\n      const S1 = sandbox(1);\n      ReactHotLoader.register(S1, 'S1', 'test');\n\n      const el = document.createElement('div');\n      ReactDom.render(<S1 />, el);\n      expect(el.innerHTML).toEqual('<div>lazy 1</div>');\n      expect(spy).not.toHaveBeenCalled();\n\n      incrementHotGeneration();\n\n      const S2 = sandbox(2);\n      ReactHotLoader.register(S2, 'S1', 'test');\n\n      ReactDom.render(<S2 />, el);\n\n      expect(el.innerHTML).toEqual('<div>lazy 2</div>');\n      expect(spy).not.toHaveBeenCalled();\n    });\n  } else {\n    it('target platform does not support useContext', () => {\n      expect(true).toBe(true);\n    });\n  }\n});\n"
  },
  {
    "path": "test/hot/react-dom.no-integration.spec.js",
    "content": "/* eslint-env browser */\n/* eslint-disable no-lone-blocks,  global-require, prefer-template, import/no-unresolved */\nimport 'babel-polyfill';\nimport React, { Suspense } from 'react';\nimport ReactDom from 'react-dom';\n// import TestRenderer from 'react-test-renderer';\nimport ReactHotLoader, { setConfig } from '../../src/index.dev';\nimport { configureGeneration, incrementHotGeneration } from '../../src/global/generation';\nimport configuration from '../../src/configuration';\nimport { AppContainer } from '../../index';\n\ndescribe(`🔥-dom`, () => {\n  beforeEach(() => {\n    ReactHotLoader.reset();\n    setConfig({\n      ignoreSFC: true,\n    });\n    configureGeneration(1, 1);\n  });\n\n  const tick = () => new Promise(resolve => setTimeout(resolve, 10));\n\n  if (React.useContext && String(() => 42).indexOf('=>') > 0) {\n    it('shall (not) integrate with React', () => {\n      expect(configuration.IS_REACT_MERGE_ENABLED).toBe(false);\n      expect(configuration.integratedResolver).toBe(false);\n      expect(React.useEffect.isPatchedByReactHotLoader).toBe(true);\n    });\n\n    it('should (not) use component comparator', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(() => {\n          mount('test1');\n          return unmount;\n        }, []);\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          React.useEffect(() => {\n            mount('test2');\n            return unmount;\n          }, []);\n          return 'fun2';\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      expect(mount).toHaveBeenCalledWith('test2');\n      expect(unmount).toHaveBeenCalled();\n    });\n\n    it('should fail component comparator', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(() => {\n          mount('test1');\n          return unmount;\n        }, []);\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n\n      incrementHotGeneration();\n      {\n        const Fun2 = () => {\n          React.useEffect(() => {\n            mount('test2');\n            return unmount;\n          }, []);\n          return 'fun2';\n        };\n        ReactDom.render(<Fun2 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      expect(mount).toHaveBeenCalledWith('test2');\n      expect(unmount).toHaveBeenCalled();\n    });\n\n    it('should reload hook effect', async () => {\n      const mount = jest.fn();\n      const unmount = jest.fn();\n      const Fun1 = () => {\n        React.useEffect(\n          () => {\n            mount('test1');\n            return unmount;\n          },\n          ['hot'],\n        );\n        return 'fun1';\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('fun1');\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          React.useEffect(\n            () => {\n              mount('test2');\n              return unmount;\n            },\n            ['hot'],\n          );\n          return 'fun2';\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n\n      expect(el.innerHTML).toEqual('fun2');\n\n      expect(mount).toHaveBeenCalledWith('test1');\n      expect(unmount).toHaveBeenCalled();\n\n      expect(mount).toHaveBeenCalledWith('test2');\n    });\n\n    it('should reset hook comparator', async () => {\n      const Fun1 = () => {\n        const [state, setState] = React.useState('test0');\n        React.useEffect(() => setState('test1'), []);\n        return state;\n      };\n\n      const el = document.createElement('div');\n      ReactDom.render(<Fun1 />, el);\n\n      expect(el.innerHTML).toEqual('test0');\n      await tick();\n      expect(el.innerHTML).toEqual('test1');\n\n      incrementHotGeneration();\n      {\n        const Fun1 = () => {\n          const [state, setState] = React.useState('test0');\n          React.useEffect(() => setState('test2'), []);\n          return state;\n        };\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n      expect(el.innerHTML).toEqual('test2');\n\n      incrementHotGeneration();\n      {\n        const f = () => React.useState(0); // aka fail\n        const Fun1 = () => {\n          const [state, setState] = React.useState('test0');\n          React.useEffect(() => setState('test3'), []);\n          f();\n          return 'h' + state;\n        };\n        ReactHotLoader.signature(Fun1, 'somevalue');\n        ReactDom.render(<Fun1 />, el);\n      }\n\n      await tick();\n      expect(el.innerHTML).toEqual('htest3');\n    });\n\n    it('should support classes', async () => {\n      class Comp1 extends React.Component {\n        state = {\n          x: 1,\n        };\n\n        render() {\n          return 'test1' + this.state.x;\n        }\n      }\n\n      Comp1.displayName = 'Comp1';\n\n      const el = document.createElement('div');\n      ReactDom.render(<Comp1 />, el);\n\n      expect(el.innerHTML).toEqual('test11');\n      if (configuration.intergratedResolver) {\n        expect(<Comp1 />.type).toBe(Comp1);\n      }\n\n      incrementHotGeneration();\n      {\n        class Comp1 extends React.Component {\n          state = {\n            x: 2,\n          };\n\n          render() {\n            return 'test2' + this.state.x;\n          }\n        }\n\n        Comp1.displayName = 'Comp1';\n\n        ReactDom.render(<Comp1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('test22');\n    });\n\n    it('should support registered classes', async () => {\n      class Comp1 extends React.Component {\n        state = {\n          x: 1,\n        };\n\n        render() {\n          return 'test1' + this.state.x;\n        }\n      }\n\n      ReactHotLoader.register(Comp1, 'comp1', 'test');\n\n      const el = document.createElement('div');\n      ReactDom.render(<Comp1 />, el);\n\n      expect(el.innerHTML).toEqual('test11');\n      if (configuration.intergratedResolver) {\n        expect(<Comp1 />.type).toBe(Comp1);\n      }\n\n      incrementHotGeneration();\n      {\n        class Comp1 extends React.Component {\n          state = {\n            x: 2,\n          };\n\n          render() {\n            return 'test2' + this.state.x;\n          }\n        }\n\n        ReactHotLoader.register(Comp1, 'comp1', 'test');\n        ReactDom.render(<Comp1 />, el);\n      }\n      await tick();\n\n      expect(el.innerHTML).toEqual('test21');\n    });\n\n    it('support lazy memo forward', () => {\n      setConfig({\n        wrapLazy: false,\n      });\n\n      const spy = jest.fn();\n      const sandbox = x => {\n        const Comp = () => {\n          React.useEffect(() => () => spy(), []);\n          return <div>lazy {x}</div>;\n        };\n        ReactHotLoader.register(Comp, 'S1Comp', 'test');\n        // use sync importer\n        const importer = {\n          then(x) {\n            const result = x({ default: Comp });\n            return {\n              then(cb) {\n                cb(result);\n              },\n            };\n          },\n        };\n\n        const Lazy = React.lazy(() => importer);\n        ReactHotLoader.register(Lazy, 'S1Lazy', 'test');\n\n        const Context = React.createContext();\n        ReactHotLoader.register(Context, 'S1Context', 'test');\n\n        const Forward = React.forwardRef(() => (\n          <Suspense fallback=\"loading\">\n            <Context.Provider>\n              <Lazy />\n            </Context.Provider>\n          </Suspense>\n        ));\n\n        const Memo = Forward; // React.memo(Forward);\n        ReactHotLoader.register(Memo, 'S1Memo', 'test');\n        return () => (\n          <AppContainer>\n            <Memo />\n          </AppContainer>\n        );\n      };\n\n      const S1 = sandbox(1);\n      ReactHotLoader.register(S1, 'S1', 'test');\n\n      const el = document.createElement('div');\n      ReactDom.render(<S1 />, el);\n      expect(el.innerHTML).toEqual('<div>lazy 1</div>');\n      expect(spy).not.toHaveBeenCalled();\n\n      incrementHotGeneration();\n\n      const S2 = sandbox(2);\n      ReactHotLoader.register(S2, 'S1', 'test');\n\n      ReactDom.render(<S2 />, el);\n\n      expect(el.innerHTML).toEqual('<div>lazy 2</div>');\n      expect(spy).toHaveBeenCalled();\n    });\n  } else {\n    it('target platform does not support useContext', () => {\n      expect(true).toBe(true);\n    });\n  }\n});\n"
  },
  {
    "path": "test/hot.dev.test.js",
    "content": "import React, { Component } from 'react';\nimport { mount } from 'enzyme';\nimport { enter as enterModule, leave as leaveModule, isOpened, hotModule } from '../src/global/modules';\nimport '../src/index.dev';\nimport hot from '../src/hot.dev';\nimport logger from '../src/logger';\nimport configuration from '../src/configuration';\nimport { increment as incrementGeneration } from '../src/global/generation';\n\njest.mock('../src/logger');\n\ndescribe('hot (dev)', () => {\n  it('should attach to the general hot API', () => {\n    const sourceModule = {\n      id: 42,\n      hot: {\n        accept: jest.fn(),\n      },\n    };\n\n    hot(sourceModule);\n    expect(sourceModule.hot.accept).toBeCalled();\n  });\n\n  it('should attach to webpack hot API', () => {\n    const sourceModule = {\n      id: 42,\n      hot: {\n        accept: jest.fn(),\n        status: () => 'idle',\n        addStatusHandler: jest.fn(),\n      },\n    };\n\n    hot(sourceModule);\n    expect(hotModule(sourceModule.id).instances.length).toBe(0);\n    expect(sourceModule.hot.accept).toHaveBeenCalledTimes(1);\n    expect(sourceModule.hot.addStatusHandler).toHaveBeenCalledTimes(1);\n  });\n\n  it('should not attach on HRM event', () => {\n    const sourceModule = {\n      id: 42,\n      hot: {\n        accept: jest.fn(),\n        status: () => 'not-idle',\n        addStatusHandler: jest.fn(),\n      },\n    };\n\n    hot(sourceModule);\n    expect(sourceModule.hot.accept).toHaveBeenCalledTimes(1);\n    expect(sourceModule.hot.addStatusHandler).not.toBeCalled();\n  });\n\n  it('should stand mount/unmount in normal situation', () => {\n    const sourceModule = {\n      id: 42,\n      hot: {\n        accept: jest.fn(),\n      },\n    };\n    const Component = () => <div>123</div>;\n    const HotComponent = hot(sourceModule)(Component);\n    const wrapper = mount(<HotComponent />);\n    wrapper.unmount();\n  });\n\n  // this test is very flaky\n  it.skip('should redraw component on HRM', done => {\n    const callbacks = [];\n    const sourceModule = {\n      id: 'error42',\n      hot: {\n        accept(callback) {\n          callbacks.push(callback);\n        },\n      },\n    };\n    const spy = jest.fn();\n    enterModule(sourceModule);\n\n    class MyComponent extends Component {\n      render() {\n        spy();\n        return <div>42</div>;\n      }\n    }\n\n    const HotComponent = hot(sourceModule)(MyComponent);\n    hot(sourceModule)(MyComponent);\n    mount(<HotComponent />);\n    expect(spy).toHaveBeenCalledTimes(1);\n\n    expect(callbacks.length).toBe(2);\n    incrementGeneration();\n    callbacks.forEach(cb => cb());\n    expect(spy).toHaveBeenCalledTimes(1);\n    setTimeout(() => {\n      setTimeout(() => {\n        expect(spy).toHaveBeenCalledTimes(configuration.pureRender ? 4 : 3);\n        done();\n      }, 1);\n    }, 1);\n  });\n\n  it('should trigger error in unmount in opened state', () => {\n    const sourceModule = {\n      id: 'error42_unmount',\n      hot: {\n        accept: jest.fn(),\n      },\n    };\n    logger.error.mockClear();\n    enterModule(sourceModule);\n    const Component = () => <div>123</div>;\n    const HotComponent = hot(sourceModule)(Component);\n    expect(hotModule(sourceModule.id).instances.length).toBe(0);\n    const wrapper1 = mount(<HotComponent />);\n    const wrapper2 = mount(<HotComponent />);\n    expect(hotModule(sourceModule.id).instances.length).toBe(2);\n    wrapper1.unmount();\n    expect(hotModule(sourceModule.id).instances.length).toBe(1);\n\n    expect(logger.error).toHaveBeenCalledTimes(1);\n    expect(logger.error)\n      .toHaveBeenCalledWith(`React-hot-loader: Detected AppContainer unmount on module 'error42_unmount' update.\nDid you use \"hot(Component)\" and \"ReactDOM.render()\" in the same file?\n\"hot(Component)\" shall only be used as export.\nPlease refer to \"Getting Started\" (https://github.com/gaearon/react-hot-loader/).`);\n\n    wrapper2.unmount();\n    expect(hotModule(sourceModule.id).instances.length).toBe(0);\n  });\n\n  it('it should track module state', () => {\n    const sourceModule = { id: 'module42' };\n    expect(isOpened(sourceModule)).toBe(false);\n    enterModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(true);\n    enterModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(true);\n    //\n    leaveModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(false);\n    leaveModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(false);\n  });\n\n  it('it should stand wrong module definition', () => {\n    const sourceModule = {};\n    expect(isOpened(sourceModule)).toBe(false);\n    enterModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(false);\n    leaveModule(sourceModule);\n    expect(isOpened(sourceModule)).toBe(false);\n\n    enterModule();\n    isOpened();\n    leaveModule();\n  });\n});\n"
  },
  {
    "path": "test/index.dev.test.js",
    "content": "import React from 'react';\nimport * as indexExport from '../src/index.dev';\n\ndescribe('patch (dev)', () => {\n  it('should export reactHotLoader', () => {\n    expect(typeof indexExport.hot).toBe('function');\n    expect(typeof indexExport.AppContainer).toBe('function');\n  });\n\n  it('should patch React methods', () => {\n    expect(React.createElement.isPatchedByReactHotLoader).toBe(true);\n    expect(React.createFactory.isPatchedByReactHotLoader).toBe(true);\n    expect(React.Children.only.isPatchedByReactHotLoader).toBe(true);\n  });\n});\n"
  },
  {
    "path": "test/internal/getReactStack.test.js",
    "content": "import React from 'react';\nimport { mount } from 'enzyme';\nimport getReactStack from '../../src/internal/getReactStack';\n\nconst getInstanceOf = element => {\n  let instance;\n  class Root extends React.Component {\n    render() {\n      instance = this;\n      return element;\n    }\n  }\n  mount(<Root />);\n  return { instance, Root };\n};\n\ndescribe('getReactStack', () => {\n  it('should generate React stack from instance', () => {\n    const { instance, Root } = getInstanceOf(<div />);\n    const stack = getReactStack(instance);\n    expect(stack.type).toBe(Root);\n    expect(stack.instance).toBeInstanceOf(Root);\n    expect(stack.children).toHaveLength(1);\n    expect(stack.children[0].type).toBe('div');\n    expect(stack.children[0].instance).toBeDefined();\n    expect(stack.children[0].children).toHaveLength(0);\n  });\n\n  it('should handle components', () => {\n    const Div = () => <div />;\n    const { instance, Root } = getInstanceOf(<Div />);\n    const stack = getReactStack(instance);\n    expect(stack.type).toBe(Root);\n    expect(stack.instance).toBeInstanceOf(Root);\n    expect(stack.children).toHaveLength(1);\n    expect(stack.children[0].type).toBe(Div);\n    expect(stack.children[0].instance).toBeDefined();\n    expect(stack.children[0].children).toHaveLength(1);\n    expect(stack.children[0].children[0].type).toBe('div');\n    expect(stack.children[0].children[0].instance).toBeDefined();\n    expect(stack.children[0].children[0].children).toHaveLength(0);\n  });\n\n  if (React.version.startsWith('16')) {\n    it('should handle multiple children (only Fiber)', () => {\n      const Div = () => <div />;\n      const { instance, Root } = getInstanceOf([<Div key=\"A\" />, <Div key=\"B\" />]);\n      const stack = getReactStack(instance);\n      expect(stack.type).toBe(Root);\n      expect(stack.instance).toBeInstanceOf(Root);\n      expect(stack.children).toHaveLength(2);\n      function expectToBeDivStack(child) {\n        expect(child.type).toBe(Div);\n        expect(child.instance.SFC_fake).toBe(Div);\n        expect(child.children).toHaveLength(1);\n        expect(child.children[0].type).toBe('div');\n        expect(child.children[0].instance).toBeDefined();\n        expect(child.children[0].children).toHaveLength(0);\n      }\n      expectToBeDivStack(stack.children[0]);\n      expectToBeDivStack(stack.children[1]);\n    });\n  }\n\n  it('should handle complex structure', () => {\n    class A extends React.Component {\n      render() {\n        return <div />;\n      }\n    }\n\n    class B extends React.Component {\n      render() {\n        return <A />;\n      }\n    }\n\n    const { instance, Root } = getInstanceOf(\n      <div>\n        <A key=\"A\" />\n        <B key=\"B\" />\n      </div>,\n    );\n\n    const stack = getReactStack(instance);\n    expect(stack.type).toBe(Root);\n    expect(stack.instance).toBeInstanceOf(Root);\n    expect(stack.children).toHaveLength(1);\n    expect(stack.children[0].type).toBe('div');\n    expect(stack.children[0].children).toHaveLength(2);\n\n    function expectToBeAStack(child) {\n      expect(child.type).toBe(A);\n      expect(child.instance).toBeInstanceOf(A);\n      expect(child.children).toHaveLength(1);\n      expect(child.children[0].type).toBe('div');\n      expect(child.children[0].instance).toBeDefined();\n      expect(child.children[0].children).toHaveLength(0);\n    }\n\n    function expectToBeBStack(child) {\n      expect(child.type).toBe(B);\n      expect(child.instance).toBeInstanceOf(B);\n      expect(child.children).toHaveLength(1);\n      expectToBeAStack(child.children[0]);\n    }\n\n    expectToBeAStack(stack.children[0].children[0]);\n    expectToBeBStack(stack.children[0].children[1]);\n  });\n});\n"
  },
  {
    "path": "test/internal/reactUtils.test.js",
    "content": "import React from 'react';\nimport { mount } from 'enzyme';\nimport {\n  isCompositeComponent,\n  getComponentDisplayName,\n  getInternalInstance,\n  updateInstance,\n  isReactClass,\n  isReactClassInstance,\n} from '../../src/internal/reactUtils';\n\ndescribe('reactUtils', () => {\n  describe('isReact', () => {\n    it('isReactClass', () => {\n      class C1 extends React.Component {}\n      class C2 extends C1 {}\n      const F1 = () => 42;\n\n      expect(isReactClass(F1)).toBe(false);\n      expect(isReactClass(C1)).toBe(true);\n      expect(isReactClass(C2)).toBe(true);\n    });\n\n    it('isReactClassInstance', () => {\n      class C1 extends React.Component {}\n      class C2 extends C1 {}\n      const F1 = function F1() {};\n\n      expect(isReactClassInstance(new F1())).toBe(false);\n      expect(isReactClassInstance(new C1())).toBe(true);\n      expect(isReactClassInstance(new C2())).toBe(true);\n    });\n  });\n\n  describe('#isCompositeComponent', () => {\n    it('should return true if this is a composite component', () => {\n      const FunctionalComponent = () => null;\n      class ClassComponent extends React.Component {\n        render() {\n          return null;\n        }\n      }\n      expect(isCompositeComponent('div')).toBe(false);\n      expect(isCompositeComponent(ClassComponent)).toBe(true);\n      expect(isCompositeComponent(FunctionalComponent)).toBe(true);\n    });\n  });\n\n  describe('#getComponentDisplayName', () => {\n    it('should return displayName if specified', () => {\n      const ComponentWithDisplayName = () => null;\n      ComponentWithDisplayName.displayName = 'CustomDisplayName';\n      expect(getComponentDisplayName(ComponentWithDisplayName)).toBe('CustomDisplayName');\n    });\n\n    it('should return name either', () => {\n      const ComponentWithoutDisplayName = () => null;\n      expect(getComponentDisplayName(ComponentWithoutDisplayName)).toBe('ComponentWithoutDisplayName');\n    });\n\n    it('should return \"Component\" either', () => {\n      expect(getComponentDisplayName('div')).toBe('Component');\n    });\n  });\n\n  describe('#getInternalInstance', () => {\n    it('should return internal instance', () => {\n      let instance;\n      class Component extends React.Component {\n        render() {\n          instance = this;\n          return null;\n        }\n      }\n      mount(<Component />);\n      if (React.version === '16') {\n        expect(getInternalInstance(instance).constructor.name).toBe('FiberNode');\n      } else if (React.version === '15') {\n        expect(getInternalInstance(instance).constructor.name).toBe('ReactCompositeComponentWrapper');\n      }\n    });\n  });\n\n  describe('#updateInstance', () => {\n    it('should call forceUpdate', () => {\n      let instance;\n      class Component extends React.Component {\n        render() {\n          instance = this;\n          return null;\n        }\n      }\n      mount(<Component />);\n      instance.forceUpdate = jest.fn();\n      updateInstance(instance);\n      expect(instance.forceUpdate).toHaveBeenCalled();\n    });\n  });\n});\n"
  },
  {
    "path": "test/prod/AppContainer.prod.test.js",
    "content": "import React from 'react';\nimport { shallow } from 'enzyme';\nimport { AppContainer } from '../../src/index.prod';\n\ndescribe('AppContainer (prod)', () => {\n  it('should render child', () => {\n    const App = () => <div>Hello world!</div>;\n    const wrapper = shallow(\n      <AppContainer>\n        <App />\n      </AppContainer>,\n    );\n    expect(wrapper.equals(<App />)).toBe(true);\n  });\n\n  it('should throw an error with several children', () => {\n    const App = () => <div>Hello world!</div>;\n    expect(() => {\n      shallow(\n        <AppContainer>\n          <App />\n          <App />\n        </AppContainer>,\n      );\n    }).toThrow();\n  });\n});\n"
  },
  {
    "path": "test/prod/hot.prod.test.js",
    "content": "import React from 'react';\nimport { hot } from '../../src/index.prod';\n\ndescribe('hot (prod)', () => {\n  it('should be an identity', () => {\n    const App = () => <div>Hello world!</div>;\n    const HotApp = hot()(App);\n    expect(App).toBe(HotApp);\n  });\n});\n"
  },
  {
    "path": "test/prod/utils.prod.test.js",
    "content": "import React from 'react';\nimport { areComponentsEqual, setConfig } from '../../src/index.prod';\n\ndescribe('utils (prod)', () => {\n  describe('#areComponentsEqual', () => {\n    it('should test if two components are equal', () => {\n      const Comp1 = () => <div />;\n      const Comp2 = () => <div />;\n      expect(areComponentsEqual(Comp1, Comp1)).toBe(true);\n      expect(areComponentsEqual(Comp1, Comp2)).toBe(false);\n    });\n  });\n\n  describe('#setConfig', () => {\n    it('should be a function', () => {\n      expect(setConfig).toEqual(expect.any(Function));\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/consistency.test.js",
    "content": "/* eslint-env jest */\n/* eslint-disable react/no-render-return-value */\nimport React from 'react';\nimport { createMounter, ensureNoWarnings } from './helper';\nimport createProxy from '../../src/proxy';\nimport configuration from '../../src/configuration';\nimport '../../src/index.dev';\nimport { configureGeneration } from '../../src/global/generation';\n\nconst createFixtures = () => ({\n  modern: {\n    Bar: class Bar extends React.Component {\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      doNothing() {}\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n\n      /* eslint-enable */\n\n      render() {\n        return <div>Bar</div>;\n      }\n    },\n\n    Baz: class Baz extends React.Component {\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      thisIsES6 = () => {};\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n\n      /* eslint-enable */\n\n      render() {\n        return <div>Baz</div>;\n      }\n    },\n\n    Foo: class Foo extends React.Component {\n      static displayName = 'Foo (Custom)';\n\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n\n      /* eslint-enable */\n\n      render() {\n        return <div>Foo</div>;\n      }\n    },\n  },\n});\n\ndescribe('consistency', () => {\n  beforeEach(() => {\n    configureGeneration(1, 1);\n  });\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(createFixtures()).forEach(type => {\n    describe(type, () => {\n      let Bar;\n      let Baz;\n      let Foo;\n\n      beforeEach(() => {\n        ({ Bar, Baz, Foo } = createFixtures()[type]);\n      });\n\n      it('overwrites the original class', () => {\n        // spin up\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n        const barWrapper = mount(<Proxy />);\n        const barInstance = barWrapper.instance();\n        expect(barWrapper.text()).toBe('Bar');\n\n        // replace base component\n        proxy.update(Baz);\n        const realBarWrapper = mount(<Bar />);\n        const realBarInstance = realBarWrapper.instance();\n\n        expect(realBarWrapper.text()).toBe('Baz');\n\n        expect(barInstance).toBe(realBarInstance);\n        expect(barInstance.didUnmount).not.toBe(true);\n      });\n\n      it('returns an existing proxy when wrapped twice', () => {\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n        const proxyTwice = createProxy(Proxy);\n        expect(proxyTwice).toBe(proxy);\n      });\n\n      /*\n       * https://github.com/reactjs/react-redux/issues/163#issuecomment-192556637\n       */\n      it('avoid false positives when statics are hoisted', () => {\n        const fooProxy = createProxy(Foo);\n        const FooProxy = fooProxy.get();\n\n        class Stuff extends React.Component {\n          render() {\n            return null;\n          }\n        }\n\n        const KNOWN_STATICS = {\n          name: true,\n          length: true,\n          prototype: true,\n          caller: true,\n          arguments: true,\n          arity: true,\n          type: true,\n        };\n        Object.getOwnPropertyNames(FooProxy).forEach(key => {\n          if (!KNOWN_STATICS[key]) {\n            Stuff[key] = FooProxy[key];\n          }\n        });\n\n        const stuffProxy = createProxy(Stuff);\n        expect(stuffProxy).not.toBe(fooProxy);\n      });\n\n      it('prevents recursive proxy cycle', () => {\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n        proxy.update(Proxy);\n        expect(proxy.get()).toBe(Proxy);\n      });\n\n      it('prevents double proxy creation', () => {\n        const proxy1 = createProxy(Bar);\n        const proxy2 = createProxy(Bar);\n        expect(proxy1.get()).toBe(proxy2.get());\n      });\n\n      it('prevents mutually recursive proxy cycle', () => {\n        const barProxy = createProxy(Bar);\n        const BarProxy = barProxy.get();\n\n        const fooProxy = createProxy(Foo);\n        const FooProxy = fooProxy.get();\n\n        barProxy.update(FooProxy);\n        fooProxy.update(BarProxy);\n      });\n\n      it('sets up constructor to match the type', () => {\n        const proxy = createProxy(Bar);\n        const BarProxy = proxy.get();\n        const barInstance = mount(<BarProxy />).instance();\n        expect(barInstance.constructor).toBe(BarProxy);\n        expect(barInstance instanceof BarProxy).toBe(true);\n\n        proxy.update(Baz);\n        const BazProxy = proxy.get();\n        expect(BarProxy).toBe(BazProxy);\n        expect(barInstance.constructor).toBe(BazProxy);\n        expect(barInstance instanceof BazProxy).toBe(true);\n      });\n\n      it('replaces toString (if readable)', () => {\n        const barProxy = createProxy(Bar, 'bar');\n        const BarProxy = barProxy.get();\n        expect(BarProxy.toString()).toMatch(/^(class|function) Bar/);\n\n        Object.defineProperty(Foo, 'toString', {\n          configurable: false,\n          value: Foo.toString,\n          writable: false,\n        });\n        createProxy(Foo, 'foo');\n      });\n\n      it('sets up displayName from displayName or name', () => {\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n        const barInstance = mount(<Proxy />).instance();\n        expect(barInstance.constructor.displayName).toBe('Bar');\n\n        proxy.update(Baz);\n        expect(barInstance.constructor.displayName).toBe('Baz');\n\n        proxy.update(Foo);\n        expect(barInstance.constructor.displayName).toBe('Foo (Custom)');\n      });\n\n      it('inherits from base', () => {\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n\n        expect(Proxy.prototype instanceof Bar).toBe(true);\n      });\n\n      it('should transparently pass arguments to the render function', () => {\n        const spy = jest.fn();\n\n        class Foo extends React.Component {\n          render(...args) {\n            spy(...args);\n            return null;\n          }\n        }\n\n        const proxy = createProxy(Foo);\n        const Proxy = proxy.get();\n        const instance = new Proxy();\n        const props = {};\n        const state = {};\n        instance.render(props, state);\n        expect(spy).toHaveBeenCalledWith(props, state);\n        instance.render(1, 2);\n        expect(spy).toHaveBeenCalledWith(1, 2);\n        instance.render(0);\n        expect(spy).toHaveBeenCalledWith(0);\n      });\n\n      it('should revert arrow member change', () => {\n        /* eslint-disable */\n        class BaseClass extends React.Component {\n          arrow = () => 42;\n\n          render() {\n            return this.arrow();\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n        }\n\n        class Update1Class extends React.Component {\n          arrow = () => 43;\n\n          render() {\n            return this.arrow();\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n        }\n\n        class Update2Class extends React.Component {\n          arrow = () => 42;\n\n          render() {\n            return this.arrow();\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n        }\n\n        const proxy = createProxy(BaseClass);\n        const Proxy = proxy.get();\n        const instance = new Proxy();\n        expect(instance.render()).toBe(42);\n\n        proxy.update(Update1Class);\n        new Proxy(); // side effect\n        //closeGeneration();\n        expect(instance.render()).toBe(43);\n\n        proxy.update(Update2Class);\n        new Proxy(); // side effect\n        //closeGeneration();\n        expect(instance.render()).toBe(42);\n        /* eslint-enable */\n      });\n\n      it('should reflect external dependencies(broken, regression)', () => {\n        /* eslint-disable */\n        const externalValue = 42;\n        let gen = 0;\n        const generator2 = () => {\n          const g = gen++;\n          return () => g;\n        };\n        const generator3 = () => {\n          const g = gen++;\n          return () => g;\n        };\n\n        class BaseClass extends React.Component {\n          secret1 = 1;\n          secret2 = generator2();\n          secret3 = generator3();\n          arrow1 = () => externalValue;\n          arrow2 = () => this.secret1 + externalValue;\n\n          render() {\n            return this.arrow1() + ':' + this.arrow2() + ':' + this.secret2() + ':' + this.secret3();\n          }\n\n          __reactstandin__regenerateByEval(key, code) {\n            this[key] = eval(code);\n          }\n        }\n\n        const proxy = createProxy(BaseClass);\n        const Proxy = proxy.get();\n        const instance = new Proxy();\n        expect(instance.render()).toBe(42 + ':' + 43 + ':' + 0 + ':' + 1);\n\n        {\n          const externalValue = 24;\n\n          class Update1Class extends React.Component {\n            secret = 1;\n            secret2 = generator2();\n            secret3 = generator3();\n            arrow1 = () => externalValue;\n            arrow2 = () => this.secret1 + externalValue;\n\n            render() {\n              return this.arrow1() + ':' + this.arrow2() + ':' + this.secret2() + ':' + this.secret3();\n            }\n\n            __reactstandin__regenerateByEval(key, code) {\n              this[key] = eval(code);\n            }\n          }\n\n          proxy.update(Update1Class);\n          new Proxy();\n        }\n        /* eslint-enable */\n\n        // Arrow1 function refer to external variable\n        // Will not be updated\n        // while Arrow2 function will\n\n        // secret 3 should not be regenrated\n        // secret 4(this inside) should be regenrated\n        expect(instance.render()).toMatch(/([\\d]+):25:0:1/);\n      });\n\n      it('should stand-for all class members', () => {\n        class Initial {\n          constructor() {\n            this.methodB = this.methodB.bind(this);\n          }\n\n          methodA() {}\n\n          methodB() {}\n\n          render() {}\n        }\n\n        const proxy = createProxy(Initial);\n        const Class = proxy.get();\n        expect(Object.getOwnPropertyNames(Class.prototype)).toEqual(\n          [\n            'constructor',\n            'methodA',\n            'methodB',\n            configuration.pureRender ? '' : 'render',\n            'hotComponentRender',\n            'hotComponentUpdate',\n            'componentDidMount',\n            'componentDidUpdate',\n            'componentWillUnmount',\n          ].filter(Boolean),\n        );\n      });\n    });\n  });\n\n  describe('proxy creation', () => {\n    it('should wrap Component by Proxy', () => {\n      class App extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n\n      const Proxy = createProxy(App).get();\n      const instance = mount(<Proxy />).instance();\n      expect(instance instanceof App).toBe(true);\n    });\n\n    describe('should wrap SFC by SFC', () => {\n      it('should wrap SFC by SFC Component', () => {\n        const App = () => <div />;\n\n        const Proxy = createProxy(App).get();\n        expect('isStatelessFunctionalProxy' in Proxy).toBe(false);\n        mount(<Proxy />).instance();\n        expect(Proxy.isStatelessFunctionalProxy).toBe(configuration.pureSFC);\n      });\n\n      it('should wrap SFC by SFC Pure', () => {\n        const App = () => <div />;\n        configuration.pureSFC = true;\n        const Proxy = createProxy(App).get();\n        expect('isStatelessFunctionalProxy' in Proxy).toBe(false);\n        mount(<Proxy />).instance();\n        configuration.pureSFC = false;\n        expect(Proxy.isStatelessFunctionalProxy).toBe(true);\n      });\n    });\n\n    it('should wrap SFC with Context by Proxy', () => {\n      const App = () => <div />;\n      App.contextTypes = {};\n\n      const Proxy = createProxy(App).get();\n      expect('isStatelessFunctionalProxy' in Proxy).toBe(false);\n      mount(<Proxy />).instance();\n      expect(Proxy.isStatelessFunctionalProxy).toBe(false);\n    });\n\n    it('should not update not constructed Proxies', () => {\n      const spy1 = jest.fn();\n      const spy2 = jest.fn();\n\n      class App extends React.Component {\n        constructor() {\n          super();\n          spy1();\n        }\n\n        render() {\n          return <div />;\n        }\n      }\n\n      const proxy = createProxy(App);\n      expect(spy1).not.toHaveBeenCalled();\n      expect(spy1).not.toHaveBeenCalled();\n      {\n        class App extends React.Component {\n          constructor() {\n            super();\n            spy2();\n          }\n\n          render() {\n            return <div />;\n          }\n        }\n\n        proxy.update(App);\n\n        expect(spy1).not.toHaveBeenCalled();\n        expect(spy1).not.toHaveBeenCalled();\n\n        const Proxy = proxy.get();\n        mount(<Proxy />);\n\n        expect(spy1).toHaveBeenCalled();\n        expect(spy1).toHaveBeenCalled();\n      }\n    });\n\n    it('should update constructed Proxies', () => {\n      const spy1 = jest.fn();\n      const spy2 = jest.fn();\n\n      class App extends React.Component {\n        constructor() {\n          super();\n          spy1();\n        }\n\n        render() {\n          return <div />;\n        }\n      }\n\n      const proxy = createProxy(App);\n      const Proxy = proxy.get();\n      mount(<Proxy />);\n      expect(spy1).toHaveBeenCalled();\n      expect(spy2).not.toHaveBeenCalled();\n      {\n        class App extends React.Component {\n          constructor() {\n            super();\n            spy2();\n          }\n\n          render() {\n            return <div />;\n          }\n        }\n\n        proxy.update(App);\n\n        expect(spy1).toHaveBeenCalled();\n        expect(spy2).toHaveBeenCalled();\n      }\n    });\n  });\n\n  describe('modern only', () => {\n    it('sets up the constructor name from initial name', () => {\n      const { Bar, Baz } = createFixtures().modern;\n      const proxy = createProxy(Bar);\n      const Proxy = proxy.get();\n      expect(Proxy.name).toBe('Bar');\n\n      proxy.update(Baz);\n      expect(Proxy.name).toBe('Baz');\n    });\n\n    it('should not crash if new Function() throws', () => {\n      const { Bar } = createFixtures().modern;\n      const oldFunction = global.Function;\n\n      global.Function = class extends oldFunction {\n        constructor() {\n          super();\n\n          throw new Error();\n        }\n      };\n\n      try {\n        expect(() => {\n          const proxy = createProxy(Bar);\n          const Proxy = proxy.get();\n          const barInstance = mount(<Proxy />).instance();\n          expect(barInstance.constructor).toBe(Proxy);\n        }).not.toThrow();\n      } finally {\n        global.Function = oldFunction;\n      }\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/helper.js",
    "content": "/* eslint-env browser */\n/* eslint-disable react/no-render-return-value */\nimport ReactDOM from 'react-dom';\n\nexport function createMounter() {\n  const DOMElement = document.createElement('div');\n  let internalMount;\n\n  beforeEach(() => {\n    internalMount = element => {\n      const instance = ReactDOM.render(element, DOMElement);\n\n      return {\n        instance() {\n          return instance;\n        },\n        text() {\n          return DOMElement.textContent;\n        },\n      };\n    };\n  });\n\n  return {\n    mount(element) {\n      return internalMount(element);\n    },\n  };\n}\n\nexport function ensureNoWarnings() {\n  /* eslint-env jest */\n  let warnSpy;\n\n  beforeEach(() => {\n    warnSpy = jest.spyOn(console, 'warn');\n  });\n\n  afterEach(() => {\n    expect(warnSpy).not.toHaveBeenCalled();\n  });\n\n  return {\n    getWarnSpy() {\n      return warnSpy;\n    },\n  };\n}\n"
  },
  {
    "path": "test/proxy/instance-descriptor.test.js",
    "content": "/* eslint-env jest */\n/* eslint-disable no-underscore-dangle */\nimport React from 'react';\nimport { createMounter, ensureNoWarnings } from './helper';\nimport createProxy from '../../src/proxy';\n\nconst createFixtures = () => ({\n  modern: {\n    InstanceDescriptor: class InstanceDescriptor extends React.Component {\n      get answer() {\n        return this.props.base + 42;\n      }\n\n      set something(value) {\n        this._something = value * 2;\n      }\n\n      render() {\n        return <div>{this.answer || ''}</div>;\n      }\n    },\n\n    InstanceDescriptorUpdate: class InstanceDescriptorUpdate extends React.Component {\n      get answer() {\n        return this.props.base + 43;\n      }\n\n      set something(value) {\n        this._something = value * 3;\n      }\n\n      render() {\n        return <div>{this.answer}</div>;\n      }\n    },\n\n    InstanceDescriptorRemoval: class InstanceDescriptorRemoval extends React.Component {\n      render() {\n        return <div>{this.answer}</div>;\n      }\n    },\n\n    ThrowingAccessors: class ThrowingAccessors extends React.Component {\n      get something() {\n        throw new Error();\n      }\n\n      set something(value) {\n        throw new Error();\n      }\n\n      render() {\n        return null;\n      }\n    },\n  },\n});\n\ndescribe('instance descriptor', () => {\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(createFixtures()).forEach(type => {\n    describe(type, () => {\n      it('does not invoke accessors', () => {\n        const { InstanceDescriptor, ThrowingAccessors } = createFixtures()[type];\n        const proxy = createProxy(InstanceDescriptor);\n        const Proxy = proxy.get();\n        mount(<Proxy />);\n        expect(() => proxy.update(ThrowingAccessors)).not.toThrow();\n      });\n\n      describe('getter', () => {\n        it('is available on proxy class instance', () => {\n          const { InstanceDescriptor } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n          expect(wrapper.text()).toBe('142');\n          expect(wrapper.instance().answer).toBe(142);\n        });\n\n        it('gets added', () => {\n          const { InstanceDescriptor, InstanceDescriptorRemoval } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptorRemoval);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n          expect(wrapper.text()).toBe('');\n\n          proxy.update(InstanceDescriptor);\n          const wrapper2 = mount(<Proxy base={100} />);\n          expect(wrapper2.text()).toBe('142');\n          expect(wrapper2.instance().answer).toBe(142);\n        });\n\n        it('gets replaced', () => {\n          const { InstanceDescriptor, InstanceDescriptorUpdate, InstanceDescriptorRemoval } = createFixtures()[type];\n\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n          const instance = wrapper.instance();\n          expect(wrapper.text()).toBe('142');\n\n          proxy.update(InstanceDescriptorUpdate);\n          const wrapper2 = mount(<Proxy base={100} />);\n          expect(wrapper2.text()).toBe('143');\n          expect(instance.answer).toBe(143);\n\n          proxy.update(InstanceDescriptorRemoval);\n          const wrapper3 = mount(<Proxy base={100} />);\n          expect(wrapper3.text()).toBe('');\n          expect(instance.answer).toBe(undefined);\n        });\n\n        it('gets redefined', () => {\n          const { InstanceDescriptor, InstanceDescriptorUpdate, InstanceDescriptorRemoval } = createFixtures()[type];\n\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n          expect(wrapper.text()).toBe('142');\n\n          Object.defineProperty(wrapper.instance(), 'answer', { value: 7 });\n\n          proxy.update(InstanceDescriptorUpdate);\n          mount(<Proxy base={100} />);\n          expect(wrapper.text()).toBe('7');\n          expect(wrapper.instance().answer).toBe(7);\n\n          proxy.update(InstanceDescriptorRemoval);\n          expect(wrapper.text()).toBe('7');\n          expect(wrapper.instance().answer).toBe(7);\n        });\n      });\n\n      describe('setter', () => {\n        it('is available on proxy class instance', () => {\n          const { InstanceDescriptor } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          wrapper.instance().something = 10;\n          expect(wrapper.instance()._something).toBe(20);\n        });\n\n        it('gets added', () => {\n          const { InstanceDescriptor, InstanceDescriptorRemoval } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptorRemoval);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n\n          proxy.update(InstanceDescriptor);\n          wrapper.instance().something = 10;\n          expect(wrapper.instance()._something).toBe(20);\n        });\n\n        it('gets replaced', () => {\n          const { InstanceDescriptor, InstanceDescriptorUpdate, InstanceDescriptorRemoval } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          const instance = wrapper.instance();\n          instance.something = 10;\n          expect(instance._something).toBe(20);\n\n          proxy.update(InstanceDescriptorUpdate);\n          expect(instance._something).toBe(20);\n          instance.something = 10;\n          expect(instance._something).toBe(30);\n\n          proxy.update(InstanceDescriptorRemoval);\n          expect(instance._something).toBe(30);\n          instance.something = 7;\n          expect(instance.something).toBe(7);\n          expect(instance._something).toBe(30);\n        });\n\n        it('gets redefined', () => {\n          const { InstanceDescriptor, InstanceDescriptorUpdate } = createFixtures()[type];\n          const proxy = createProxy(InstanceDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy base={100} />);\n          expect(wrapper.text()).toBe('142');\n\n          Object.defineProperty(wrapper.instance(), 'something', {\n            value: 50,\n          });\n\n          proxy.update(InstanceDescriptorUpdate);\n          expect(wrapper.instance().something).toBe(50);\n        });\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/instance-method.test.js",
    "content": "/* eslint-env jest */\nimport React from 'react';\nimport { createMounter, ensureNoWarnings } from './helper';\nimport createProxy from '../../src/proxy';\n\nconst createFixtures = () => ({\n  modern: {\n    shouldWarnOnBind: false,\n\n    Counter1x: class Counter1x extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { counter: 0 };\n      }\n\n      increment() {\n        this.setState({\n          counter: this.state.counter + 1,\n        });\n      }\n\n      render() {\n        return <span>{this.state.counter}</span>;\n      }\n    },\n\n    Counter10x: class Counter10x extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { counter: 0 };\n      }\n\n      increment() {\n        this.setState({\n          counter: this.state.counter + 10,\n        });\n      }\n\n      render() {\n        return <span>{this.state.counter}</span>;\n      }\n    },\n\n    Counter100x: class Counter100x extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { counter: 0 };\n      }\n\n      increment() {\n        this.setState({\n          counter: this.state.counter + 100,\n        });\n      }\n\n      render() {\n        return <span>{this.state.counter}</span>;\n      }\n    },\n\n    CounterWithoutIncrementMethod: class CounterWithoutIncrementMethod extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { counter: 0 };\n      }\n\n      render() {\n        return <span>{this.state.counter}</span>;\n      }\n    },\n\n    NotPureComponent: class NotPureComponent extends React.Component {\n      shouldComponentUpdate() {\n        return true;\n      }\n\n      render() {\n        return <span>Component</span>;\n      }\n    },\n\n    IsPureComponent: class IsPureComponent extends React.PureComponent {\n      render() {\n        return <span>PureComponent</span>;\n      }\n    },\n  },\n});\n\ndescribe('instance method', () => {\n  const { getWarnSpy } = ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(createFixtures()).forEach(type => {\n    describe(type, () => {\n      it('gets added', () => {\n        const { Counter1x, CounterWithoutIncrementMethod } = createFixtures()[type];\n        const proxy = createProxy(CounterWithoutIncrementMethod);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toEqual('0');\n\n        proxy.update(Counter1x);\n        wrapper.instance().increment();\n        expect(wrapper.text()).toEqual('1');\n      });\n\n      it('gets replaced', () => {\n        const { Counter1x, Counter10x, Counter100x } = createFixtures()[type];\n        const proxy = createProxy(Counter1x);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toEqual('0');\n        wrapper.instance().increment();\n        expect(wrapper.text()).toEqual('1');\n\n        proxy.update(Counter10x);\n        wrapper.instance().increment();\n        mount(<Proxy />);\n        expect(wrapper.text()).toEqual('11');\n\n        proxy.update(Counter100x);\n        wrapper.instance().increment();\n        mount(<Proxy />);\n        expect(wrapper.text()).toEqual('111');\n      });\n\n      it('removes shouldComponentUpdate', () => {\n        const { IsPureComponent, NotPureComponent } = createFixtures()[type];\n        const proxy = createProxy(NotPureComponent);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toEqual('Component');\n        expect(wrapper.instance()).toHaveProperty('shouldComponentUpdate');\n\n        proxy.update(IsPureComponent);\n        wrapper.instance().forceUpdate();\n\n        mount(<Proxy />);\n        expect(wrapper.text()).toEqual('PureComponent');\n        expect(wrapper.instance()).not.toHaveProperty('shouldComponentUpdate');\n      });\n\n      it('cant handle bound methods', () => {\n        const { Counter1x, Counter10x, shouldWarnOnBind } = createFixtures()[type];\n        const proxy = createProxy(Counter1x);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        const instance = wrapper.instance();\n\n        getWarnSpy().mockReset();\n        const localWarnSpy = jest.spyOn(console, 'warn');\n\n        instance.increment = instance.increment.bind(instance);\n\n        expect(localWarnSpy).toHaveBeenCalledTimes(shouldWarnOnBind ? 1 : 0);\n\n        expect(wrapper.text()).toEqual('0');\n        instance.increment();\n        expect(wrapper.text()).toEqual('1');\n\n        proxy.update(Counter10x);\n        instance.increment();\n        mount(<Proxy />);\n        expect(wrapper.text()).toEqual('2'); // not 11\n      });\n    });\n  });\n\n  it('passes methods props thought', () => {\n    const injectedMethod = (a, b) => this[24 + a + b];\n\n    injectedMethod.staticProp = 'magic';\n\n    class App extends React.Component {\n      method() {\n        return 42;\n      }\n    }\n\n    App.prototype.injectedMethod = injectedMethod;\n\n    const app1 = new App();\n\n    expect(app1.injectedMethod).toBe(injectedMethod);\n    expect(app1.injectedMethod.staticProp).toBe('magic');\n    expect(String(app1.injectedMethod)).toBe(String(injectedMethod));\n\n    const Proxy = createProxy(App).get();\n\n    const app2 = new Proxy();\n\n    expect(app2.injectedMethod).not.toBe(injectedMethod);\n    expect(app2.injectedMethod.staticProp).toBe('magic');\n    expect(app2.injectedMethod.length).toBe(2);\n    expect(String(app2.injectedMethod)).toBe(String(injectedMethod));\n  });\n});\n"
  },
  {
    "path": "test/proxy/instance-property.test.js",
    "content": "/* eslint-env jest */\nimport React from 'react';\nimport { ensureNoWarnings, createMounter } from './helper';\nimport createProxy from '../../src/proxy';\n\nconst fixtures = () => ({\n  modern: {\n    InstanceProperty: class InstanceProperty extends React.Component {\n      answer = 42;\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return <div>{this.answer}</div>;\n      }\n    },\n\n    InstancePropertyUpdate: class InstancePropertyUpdate extends React.Component {\n      answer = 43;\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return <div>{this.answer}</div>;\n      }\n    },\n\n    InstancePropertyRemoval: class InstancePropertyRemoval extends React.Component {\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return <div>{this.answer}</div>;\n      }\n    },\n\n    InstancePropertyFromLocal: class InstanceProperty extends React.Component {\n      getAnswer = () => this.answer;\n      answer = 42;\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return <div>{this.getAnswer()}</div>;\n      }\n    },\n\n    InstancePropertyFromContext: class InstanceProperty extends React.Component {\n      /* eslint-disable arrow-body-style */\n      getAnswer = () => {\n        return this.answer;\n      };\n      /* eslint-enable arrow-body-style */\n      answer = 42;\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return <div>{this.getAnswer()}</div>;\n      }\n    },\n  },\n});\n\ndescribe('instance property', () => {\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(fixtures).forEach(type => {\n    describe(type, () => {\n      const { InstanceProperty, InstancePropertyUpdate, InstancePropertyRemoval } = fixtures()[type];\n\n      it('is available on proxy class instance', () => {\n        const proxy = createProxy(InstanceProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n        expect(wrapper.instance().answer).toBe(42);\n      });\n\n      it('is left unchanged when reassigned', () => {\n        const proxy = createProxy(InstanceProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n\n        wrapper.instance().answer = 100;\n\n        proxy.update(InstancePropertyUpdate);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(wrapper.instance().answer).toBe(43);\n\n        proxy.update(InstancePropertyRemoval);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(wrapper.instance().answer).toBe(43);\n      });\n\n      /**\n       * I'm not aware of any way of retrieving their new values\n       * without calling the constructor, which seems like too much\n       * of a side effect. We also don't want to overwrite them\n       * in case they changed.\n       */\n      it('is left unchanged even if not reassigned (known limitation)', () => {\n        const proxy = createProxy(InstanceProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n\n        proxy.update(InstancePropertyUpdate);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(wrapper.instance().answer).toBe(43);\n\n        proxy.update(InstancePropertyRemoval);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(wrapper.instance().answer).toBe(43);\n      });\n    });\n  });\n\n  describe('ES6 property', () => {\n    // untestable without real arrow functions\n    // it('show use the underlayer instance value', () => {\n    //   const proxy = createProxy(fixtures.modern.InstancePropertyFromLocal);\n    //   const Proxy = proxy.get();\n    //   const instance = renderer.render(<Proxy />);\n    //   expect(renderer.getRenderOutput().props.children).toBe(42);\n    //   instance.answer = 100;\n    //   renderer.render(<Proxy />);\n    //   expect(renderer.getRenderOutput().props.children).toBe(42);\n    // })\n\n    it('show use the underlayer top value', () => {\n      const proxy = createProxy(fixtures().modern.InstancePropertyFromContext);\n      const Proxy = proxy.get();\n      const wrapper = mount(<Proxy />);\n      expect(wrapper.text()).toBe('42');\n      wrapper.instance().answer = 100;\n      mount(<Proxy />);\n      expect(wrapper.text()).toBe('100');\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/lifecycle-method.test.js",
    "content": "/* eslint-env jest */\nimport React, { Component } from 'react';\nimport { createMounter } from './helper';\nimport createProxy from '../../src/proxy';\nimport '../../src/index.dev';\nimport { configureGeneration } from '../../src/global/generation';\n\ndescribe('lifecycle method', () => {\n  beforeEach(() => {\n    configureGeneration(1, 1);\n  });\n\n  const { mount } = createMounter();\n\n  class Controller extends Component {\n    state = {\n      update: 1,\n    };\n\n    render() {\n      const { Proxy } = this.props;\n      return <Proxy update={this.state.update} />;\n    }\n  }\n\n  const testFabric = methodName => (Component, patchedRender, spy) => {\n    class App1 extends Component {\n      constructor() {\n        super();\n        this.secret = 1;\n        this.superSecret = 42;\n      }\n\n      [methodName]() {\n        spy();\n        const oldRender = this.render.bind(this);\n        this.render = () => {\n          this.superSecret = this.secret + 1;\n          return patchedRender.call(this, oldRender);\n        };\n      }\n\n      render() {\n        return <div>{this.superSecret}</div>;\n      }\n    }\n\n    class App2 extends Component {\n      constructor() {\n        super();\n        this.secret = 2;\n      }\n\n      [methodName]() {\n        spy();\n      }\n\n      render() {\n        return <div>!{this.superSecret * 5}</div>;\n      }\n    }\n    return { App1, App2 };\n  };\n\n  const getTestClass = (methodName, spy) => {\n    function patchedRender(oldRender) {\n      return <div>PATCHED + {oldRender()}</div>;\n    }\n    return testFabric(methodName)(Component, patchedRender, spy);\n  };\n\n  // false test\n  it.skip('handle componentWillMount', done => {\n    const spy = jest.fn();\n    const { App1, App2 } = getTestClass('componentWillMount', spy);\n\n    const proxy = createProxy(App1);\n    const Proxy = proxy.get();\n\n    const wrapper = mount(<Controller Proxy={Proxy} />);\n\n    expect(spy).toHaveBeenCalledTimes(1);\n    expect(wrapper.text()).toContain('PATCHED + 2');\n\n    proxy.update(App2);\n    wrapper.instance().forceUpdate();\n    expect(spy).toHaveBeenCalledTimes(1);\n    // first render before hot render\n    expect(wrapper.text()).toContain('PATCHED + !10');\n    wrapper.instance().forceUpdate();\n    expect(wrapper.text()).toContain('PATCHED + !15');\n    done();\n  });\n\n  // false test\n  it.skip('handle componentDidMount', () => {\n    const spy = jest.fn();\n    const { App1, App2 } = getTestClass('componentDidMount', spy);\n\n    const proxy = createProxy(App1);\n    const Proxy = proxy.get();\n\n    const wrapper = mount(<Controller Proxy={Proxy} />);\n\n    expect(spy).toHaveBeenCalledTimes(1);\n    expect(wrapper.text()).toContain('42');\n\n    proxy.update(App2);\n    wrapper.instance().forceUpdate();\n    expect(spy).toHaveBeenCalledTimes(1);\n    // first render before hot render\n    expect(wrapper.text()).toContain('PATCHED + !10');\n    wrapper.instance().forceUpdate();\n    expect(wrapper.text()).toContain('PATCHED + !15');\n  });\n\n  it('handle dynamic method creation', () => {\n    class App1 extends Component {\n      method1 = () => 41 + this.var1;\n\n      var1 = 1;\n\n      render() {\n        return <div>{this.method1()}</div>;\n      }\n    }\n\n    class App2 extends Component {\n      method2 = () => 22 + this.var2;\n\n      var2 = 2;\n\n      /* eslint-disable */\n      __reactstandin__regenerateByEval(key, code) {\n        this[key] = eval(code);\n      }\n      /* eslint-enable */\n\n      render() {\n        return (\n          <div>\n            {this.method1()} + {this.method2()}\n          </div>\n        );\n      }\n    }\n\n    const proxy = createProxy(App1);\n    const Proxy = proxy.get();\n\n    const wrapper = mount(<Controller Proxy={Proxy} />);\n\n    expect(wrapper.text()).toContain('42');\n\n    proxy.update(App2);\n    wrapper.instance().forceUpdate();\n\n    // first render before hot render\n    expect(wrapper.text()).toContain('42');\n    wrapper.instance().forceUpdate();\n    // both methods expected to be present\n    expect(wrapper.text()).toContain('42 + 24');\n  });\n});\n"
  },
  {
    "path": "test/proxy/static-descriptor.test.js",
    "content": "/* eslint-env jest */\n/* eslint-disable no-underscore-dangle */\nimport React from 'react';\nimport { ensureNoWarnings, createMounter } from './helper';\nimport createProxy from '../../src/proxy';\n\nconst createFixtures = () => ({\n  modern: {\n    StaticDescriptor: class StaticDescriptor extends React.Component {\n      static get answer() {\n        return 42;\n      }\n\n      static set something(value) {\n        this._something = value * 2;\n      }\n\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    StaticDescriptorUpdate: class StaticDescriptorUpdate extends React.Component {\n      static get answer() {\n        return 43;\n      }\n\n      static set something(value) {\n        this._something = value * 3;\n      }\n\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    StaticDescriptorRemoval: class StaticDescriptorRemoval extends React.Component {\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    ThrowingAccessors: class ThrowingAccessors extends React.Component {\n      static get something() {\n        throw new Error();\n      }\n\n      static set something(value) {\n        throw new Error();\n      }\n\n      render() {\n        return null;\n      }\n    },\n  },\n});\n\ndescribe('static descriptor', () => {\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(createFixtures()).forEach(type => {\n    let fixtures;\n\n    describe(type, () => {\n      beforeEach(() => {\n        fixtures = createFixtures()[type];\n      });\n\n      it('does not invoke accessors', () => {\n        const { StaticDescriptor, ThrowingAccessors } = fixtures;\n        const proxy = createProxy(StaticDescriptor);\n        const Proxy = proxy.get();\n        mount(<Proxy />);\n        expect(() => proxy.update(ThrowingAccessors)).not.toThrow();\n      });\n\n      describe('getter', () => {\n        beforeEach(() => {\n          fixtures = createFixtures()[type];\n        });\n\n        it('is available on proxy class', () => {\n          const { StaticDescriptor } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toEqual('42');\n          expect(wrapper.instance().constructor.answer).toEqual(42);\n          expect(Proxy.answer).toEqual(42);\n        });\n\n        it('gets added', () => {\n          const { StaticDescriptor, StaticDescriptorRemoval } = fixtures;\n          const proxy = createProxy(StaticDescriptorRemoval);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toEqual('');\n\n          proxy.update(StaticDescriptor);\n          mount(<Proxy />);\n          expect(wrapper.text()).toEqual('42');\n          expect(wrapper.instance().constructor.answer).toEqual(42);\n        });\n\n        it('gets replaced', () => {\n          const { StaticDescriptor, StaticDescriptorUpdate, StaticDescriptorRemoval } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toEqual('42');\n\n          proxy.update(StaticDescriptorUpdate);\n          mount(<Proxy />);\n          expect(wrapper.text()).toEqual('43');\n          expect(wrapper.instance().constructor.answer).toEqual(43);\n\n          proxy.update(StaticDescriptorRemoval);\n          mount(<Proxy />);\n          expect(wrapper.text()).toEqual('');\n          expect(wrapper.instance().answer).toEqual(undefined);\n        });\n\n        it('gets redefined', () => {\n          const { StaticDescriptor, StaticDescriptorUpdate, StaticDescriptorRemoval } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toEqual('42');\n\n          Object.defineProperty(wrapper.instance().constructor, 'answer', {\n            value: 7,\n          });\n\n          proxy.update(StaticDescriptorUpdate);\n          mount(<Proxy />);\n          expect(wrapper.text()).toEqual('7');\n          expect(wrapper.instance().constructor.answer).toEqual(7);\n\n          proxy.update(StaticDescriptorRemoval);\n          mount(<Proxy />);\n          expect(wrapper.text()).toEqual('7');\n          expect(wrapper.instance().constructor.answer).toEqual(7);\n        });\n      });\n\n      describe('setter', () => {\n        beforeEach(() => {\n          fixtures = createFixtures()[type];\n        });\n\n        it('is available on proxy class instance', () => {\n          const { StaticDescriptor } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          wrapper.instance().constructor.something = 10;\n        });\n\n        it('gets added', () => {\n          const { StaticDescriptor, StaticDescriptorRemoval } = fixtures;\n          const proxy = createProxy(StaticDescriptorRemoval);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n\n          proxy.update(StaticDescriptor);\n          wrapper.instance().constructor.something = 10;\n          expect(wrapper.instance().constructor._something).toEqual(20);\n        });\n\n        it('gets replaced', () => {\n          const { StaticDescriptor, StaticDescriptorUpdate, StaticDescriptorRemoval } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          wrapper.instance().constructor.something = 10;\n          expect(wrapper.instance().constructor._something).toEqual(20);\n\n          proxy.update(StaticDescriptorUpdate);\n          expect(wrapper.instance().constructor._something).toEqual(20);\n          wrapper.instance().constructor.something = 10;\n          expect(wrapper.instance().constructor._something).toEqual(30);\n\n          proxy.update(StaticDescriptorRemoval);\n          expect(wrapper.instance().constructor._something).toEqual(30);\n\n          console.error = jest.fn();\n          expect(() => {\n            wrapper.instance().constructor.something = 7;\n          }).toThrow();\n          expect(wrapper.instance().constructor._something).toEqual(30);\n        });\n\n        it('gets redefined', () => {\n          const { StaticDescriptor, StaticDescriptorUpdate } = fixtures;\n          const proxy = createProxy(StaticDescriptor);\n          const Proxy = proxy.get();\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toEqual('42');\n\n          Object.defineProperty(wrapper.instance().constructor, 'something', {\n            value: 50,\n          });\n\n          proxy.update(StaticDescriptorUpdate);\n          expect(wrapper.instance().constructor.something).toEqual(50);\n        });\n      });\n    });\n  });\n});\n\ndescribe('static functional descriptor', () => {\n  it('shout pass propTypes', () => {\n    const TestComponent = ({ property }) => <div>{property}</div>;\n    TestComponent.propTypes = {\n      property: 42,\n    };\n    TestComponent.displayName = 'Testing';\n    const proxy = createProxy(TestComponent);\n    const Proxy = proxy.get();\n\n    expect(Proxy.propTypes.property).toBe(42);\n    expect(Proxy.displayName).toBe('Testing');\n  });\n});\n"
  },
  {
    "path": "test/proxy/static-method.test.js",
    "content": "/* eslint-env jest */\nimport React from 'react';\nimport { ensureNoWarnings, createMounter } from './helper';\nimport createProxy from '../../src/proxy';\nimport reactHotLoader from '../../src/reactHotLoader';\n\nconst fixtures = () => ({\n  modern: {\n    StaticMethod: class StaticMethod extends React.Component {\n      static getAnswer() {\n        return 42;\n      }\n\n      render() {\n        return <div>{this.constructor.getAnswer()}</div>;\n      }\n    },\n\n    StaticMethodUpdate: class StaticMethodUpdate extends React.Component {\n      static getAnswer() {\n        return 43;\n      }\n\n      render() {\n        return <div>{this.constructor.getAnswer()}</div>;\n      }\n    },\n\n    StaticMethodRemoval: class StaticMethodRemoval extends React.Component {\n      render() {\n        return <div>{this.constructor.getAnswer()}</div>;\n      }\n    },\n  },\n});\n\ndescribe('static method', () => {\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(fixtures()).forEach(type => {\n    describe(type, () => {\n      const { StaticMethod, StaticMethodUpdate, StaticMethodRemoval } = fixtures()[type];\n\n      beforeEach(() => reactHotLoader.reset());\n\n      it('is available on proxy class instance', () => {\n        const proxy = createProxy(StaticMethod);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n        expect(Proxy.getAnswer()).toBe(42);\n      });\n\n      it('is own on proxy class instance', () => {\n        const proxy = createProxy(StaticMethod);\n        const Proxy = proxy.get();\n        expect(Proxy.hasOwnProperty('getAnswer')).toBe(true);\n      });\n\n      it('gets added', () => {\n        const proxy = createProxy(StaticMethodRemoval);\n        const Proxy = proxy.get();\n        expect(Proxy.getAnswer).toBe(undefined);\n\n        proxy.update(StaticMethod);\n        try {\n          // will throw error in es2015 mode\n          const wrapper = mount(<Proxy />);\n          expect(wrapper.text()).toBe('42');\n          expect(Proxy.getAnswer()).toBe(42);\n        } catch (e) {\n          // ES2015 error\n        }\n      });\n\n      it('gets replaced', () => {\n        const proxy = createProxy(StaticMethod);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n        expect(Proxy.getAnswer()).toBe(42);\n\n        proxy.update(StaticMethodUpdate);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(Proxy.getAnswer()).toBe(43);\n      });\n\n      it('get replaced if bound', () => {\n        const proxy = createProxy(StaticMethod);\n        const Proxy = proxy.get();\n        Proxy.getAnswer = Proxy.getAnswer.bind(Proxy);\n        const { getAnswer } = Proxy;\n\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n\n        proxy.update(StaticMethodUpdate);\n        mount(<Proxy />);\n\n        expect(wrapper.text()).toBe('42');\n        expect(Proxy.getAnswer()).toBe(42);\n        expect(getAnswer()).toBe(42);\n      });\n\n      it('is detached if deleted', () => {\n        const proxy = createProxy(StaticMethod);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n        expect(Proxy.getAnswer()).toBe(42);\n\n        proxy.update(StaticMethodRemoval);\n        console.error = jest.fn();\n        // Waiting for a fix in Jest\n        // expect(() => wrapper.instance().forceUpdate()).toThrow()\n        // expect(() => mount(<Proxy />)).toThrow()\n        expect(Proxy.getAnswer).toBe(undefined);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/static-property.test.js",
    "content": "/* eslint-env jest */\n/* eslint-disable react/no-unused-prop-types */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { ensureNoWarnings, createMounter } from './helper';\nimport createProxy from '../../src/proxy';\nimport reactHotLoader from '../../src/reactHotLoader';\n\nconst fixtures = () => ({\n  modern: {\n    StaticProperty: class StaticProperty extends React.Component {\n      static answer = 42;\n\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    StaticPropertyUpdate: class StaticPropertyUpdate extends React.Component {\n      static answer = 43;\n\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    StaticPropertyRemoval: class StaticPropertyRemoval extends React.Component {\n      render() {\n        return <div>{this.constructor.answer}</div>;\n      }\n    },\n\n    WithPropTypes: class WithPropTypes extends React.Component {\n      static propTypes = {\n        something: PropTypes.number,\n      };\n\n      static contextTypes = {\n        something: PropTypes.number,\n      };\n\n      static childContextTypes = {\n        something: PropTypes.number,\n      };\n\n      render() {\n        return null;\n      }\n    },\n\n    WithPropTypesUpdate: class WithPropTypesUpdate extends React.Component {\n      static propTypes = {\n        something: PropTypes.string,\n      };\n\n      static contextTypes = {\n        something: PropTypes.string,\n      };\n\n      static childContextTypes = {\n        something: PropTypes.string,\n      };\n\n      render() {\n        return null;\n      }\n    },\n  },\n});\n\ndescribe('static property', () => {\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  Object.keys(fixtures()).forEach(type => {\n    describe(type, () => {\n      const {\n        StaticProperty,\n        StaticPropertyUpdate,\n        StaticPropertyRemoval,\n        WithPropTypes,\n        WithPropTypesUpdate,\n      } = fixtures()[type];\n\n      beforeEach(() => reactHotLoader.reset());\n\n      it('is available on proxy class instance', () => {\n        const proxy = createProxy(StaticProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n        expect(Proxy.answer).toBe(42);\n      });\n\n      it('is own on proxy class instance', () => {\n        const proxy = createProxy(StaticProperty);\n        const Proxy = proxy.get();\n        expect(Proxy.hasOwnProperty('answer')).toBe(true);\n      });\n\n      it('is changed when not reassigned', () => {\n        const proxy = createProxy(StaticProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n\n        proxy.update(StaticPropertyUpdate);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('43');\n        expect(Proxy.answer).toBe(43);\n\n        proxy.update(StaticPropertyRemoval);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('');\n        expect(Proxy.answer).toBe(undefined);\n      });\n\n      it('is changed for propTypes, contextTypes, childContextTypes', () => {\n        const proxy = createProxy(WithPropTypes);\n        const PropTypesProxy = proxy.get();\n        expect(PropTypesProxy.propTypes.something).toBe(PropTypes.number);\n        expect(PropTypesProxy.contextTypes.something).toBe(PropTypes.number);\n        expect(PropTypesProxy.childContextTypes.something).toBe(PropTypes.number);\n\n        proxy.update(WithPropTypesUpdate);\n        expect(PropTypesProxy.propTypes.something).toBe(PropTypes.string);\n        expect(PropTypesProxy.contextTypes.something).toBe(PropTypes.string);\n        expect(PropTypesProxy.childContextTypes.something).toBe(PropTypes.string);\n      });\n\n      /**\n       * Sometimes people dynamically store stuff on statics.\n       */\n      it('is not changed when reassigned', () => {\n        const proxy = createProxy(StaticProperty);\n        const Proxy = proxy.get();\n        const wrapper = mount(<Proxy />);\n        expect(wrapper.text()).toBe('42');\n\n        Proxy.answer = 100;\n\n        proxy.update(StaticPropertyUpdate);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('100');\n        expect(Proxy.answer).toBe(100);\n\n        proxy.update(StaticPropertyRemoval);\n        mount(<Proxy />);\n        expect(wrapper.text()).toBe('100');\n        expect(Proxy.answer).toBe(100);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "test/proxy/unmounting.test.js",
    "content": "/* eslint-env jest */\n/* eslint-disable react/no-render-return-value */\nimport React from 'react';\nimport { ensureNoWarnings, createMounter } from './helper';\nimport createProxy from '../../src/proxy';\n\nconst createFixtures = () => ({\n  modern: {\n    Bar: class Bar extends React.Component {\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      render() {\n        return <div>Bar</div>;\n      }\n    },\n\n    Baz: class Baz extends React.Component {\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      render() {\n        return <div>Baz</div>;\n      }\n    },\n\n    Foo: class Foo extends React.Component {\n      componentWillUnmount() {\n        this.didUnmount = true;\n      }\n\n      render() {\n        return <div>Foo</div>;\n      }\n    },\n  },\n});\n\ndescribe('unmounting', () => {\n  let fixtures = createFixtures();\n  ensureNoWarnings();\n  const { mount } = createMounter();\n\n  beforeEach(() => {\n    fixtures = createFixtures();\n  });\n\n  Object.keys(fixtures).forEach(type => {\n    describe(type, () => {\n      it('happens without proxy', () => {\n        const { Bar, Baz } = fixtures[type];\n        const barWrapper = mount(<Bar />);\n        const barInstance = barWrapper.instance();\n        expect(barWrapper.text()).toBe('Bar');\n        const bazWrapper = mount(<Baz />);\n        const bazInstance = bazWrapper.instance();\n        expect(bazWrapper.text()).toBe('Baz');\n        expect(barInstance).not.toBe(bazInstance);\n        expect(barInstance.didUnmount).toBe(true);\n      });\n\n      it('does not happen when rendering new proxied versions', () => {\n        const { Bar, Baz, Foo } = fixtures[type];\n        const proxy = createProxy(Bar);\n        const BarProxy = proxy.get();\n        const barWrapper = mount(<BarProxy />);\n        const barInstance = barWrapper.instance();\n        expect(barWrapper.text()).toBe('Bar');\n        expect(barInstance.didUnmount).toBe(undefined);\n\n        proxy.update(Baz);\n        const BazProxy = proxy.get();\n        const bazWrapper = mount(<BazProxy />);\n        const bazInstance = bazWrapper.instance();\n        expect(bazWrapper.text()).toBe('Baz');\n        expect(barInstance).toBe(bazInstance);\n        expect(barInstance.didUnmount).toBe(undefined);\n\n        proxy.update(Foo);\n        const FooProxy = proxy.get();\n        const fooWrapper = mount(<FooProxy />);\n        const fooInstance = fooWrapper.instance();\n        expect(fooWrapper.text()).toBe('Foo');\n        expect(barInstance).toBe(fooInstance);\n        expect(barInstance.didUnmount).toBe(undefined);\n      });\n\n      it('does not happen when rendering old proxied versions', () => {\n        const { Bar, Baz, Foo } = fixtures[type];\n        const proxy = createProxy(Bar);\n        const Proxy = proxy.get();\n        const barWrapper = mount(<Proxy />);\n        expect(barWrapper.text()).toBe('Bar');\n        expect(barWrapper.instance().didUnmount).toBe(undefined);\n\n        proxy.update(Baz);\n        const bazWrapper = mount(<Proxy />);\n        expect(bazWrapper.text()).toBe('Baz');\n        expect(barWrapper.instance()).toBe(bazWrapper.instance());\n        expect(barWrapper.instance().didUnmount).toBe(undefined);\n\n        proxy.update(Foo);\n        const fooWrapper = mount(<Proxy />);\n        expect(fooWrapper.text()).toBe('Foo');\n        expect(barWrapper.instance()).toBe(fooWrapper.instance());\n        expect(barWrapper.instance().didUnmount).toBe(undefined);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "test/reactHotLoader.test.js",
    "content": "import React from 'react';\nimport { mount } from 'enzyme';\nimport { PROXY_KEY, UNWRAP_PROXY } from '../src/proxy/constants';\nimport { get as getGeneration } from '../src/global/generation';\nimport reactHotLoader from '../src/reactHotLoader';\nimport { internalConfiguration } from '../src/configuration';\n\ndescribe('reactHotLoader', () => {\n  let Div;\n  let Span;\n\n  beforeEach(() => {\n    Div = () => <div />;\n    Span = () => <span />;\n    reactHotLoader.patch(React);\n    reactHotLoader.reset();\n  });\n\n  describe('#patch', () => {\n    let OriginalReactMock;\n    let ReactMock;\n\n    beforeEach(() => {\n      OriginalReactMock = {\n        createElement: jest.fn(),\n        cloneElement: jest.fn(),\n        createFactory: jest.fn(),\n        Children: {\n          only: jest.fn(x => x),\n        },\n      };\n      ReactMock = { ...OriginalReactMock };\n    });\n\n    it('should patch all methods', () => {\n      reactHotLoader.patch(ReactMock);\n      expect(ReactMock.createElement.isPatchedByReactHotLoader).toBe(true);\n      expect(ReactMock.cloneElement.isPatchedByReactHotLoader).toBe(true);\n      expect(ReactMock.createFactory.isPatchedByReactHotLoader).toBe(true);\n      expect(ReactMock.Children.only.isPatchedByReactHotLoader).toBe(true);\n    });\n\n    describe('#createElement', () => {\n      it('should create a proxy and call original method with it', () => {\n        reactHotLoader.patch(ReactMock);\n        ReactMock.createElement(Div, { foo: 'bar' });\n        const DivProxy = OriginalReactMock.createElement.mock.calls[0][0];\n        expect(DivProxy[PROXY_KEY]).toBeDefined();\n      });\n\n      it('null case', () => {\n        reactHotLoader.patch(ReactMock);\n        const result = React.createElement(undefined);\n\n        expect(result.type).toBeUndefined();\n      });\n    });\n\n    describe('#createFactory', () => {\n      it('should create a factory that returns proxy', () => {\n        reactHotLoader.patch(ReactMock);\n        const dummyFactory = ReactMock.createFactory(Div);\n        dummyFactory({ foo: 'bar' });\n        const DivProxy = OriginalReactMock.createElement.mock.calls[0][0];\n        expect(DivProxy[PROXY_KEY]).toBeDefined();\n      });\n    });\n\n    describe('#Children.only', () => {\n      it('should returns a proxy', () => {\n        reactHotLoader.patch(ReactMock);\n        const children = { type: Div, props: { foo: 'bar' } };\n        const result = ReactMock.Children.only(children);\n        const DivProxy = result.type;\n        expect(DivProxy[PROXY_KEY]).toBeDefined();\n      });\n    });\n  });\n\n  describe('#reset', () => {\n    it('should reset all proxies', () => {\n      const proxyElement = React.createElement(Div, { foo: 'bar' });\n      const secondProxyElement = React.createElement(Div, { foo: 'bar' });\n      expect(proxyElement.type[PROXY_KEY]).toBe(secondProxyElement.type[PROXY_KEY]);\n\n      // After that, a new proxy key should be generated\n      // meaning that a new proxy has been created\n      reactHotLoader.reset();\n      const thirdProxyElement = React.createElement(Div, { foo: 'bar' });\n      expect(proxyElement.type[PROXY_KEY]).not.toBe(thirdProxyElement.type[PROXY_KEY]);\n    });\n  });\n\n  describe('#disableProxyCreation', () => {\n    afterEach(() => {\n      internalConfiguration.disableProxyCreation = false;\n    });\n\n    it('should disable the creation of proxy', () => {\n      internalConfiguration.disableProxyCreation = true;\n      const proxyElement = React.createElement(Div, { foo: 'bar' });\n      expect(proxyElement.type[PROXY_KEY]).not.toBeDefined();\n    });\n\n    it('should still be possible to get existing proxies', () => {\n      React.createElement(Div, { foo: 'bar' });\n      internalConfiguration.disableProxyCreation = true;\n      const proxyElement = React.createElement(Div, { foo: 'bar' });\n      expect(proxyElement.type[PROXY_KEY]).toBeDefined();\n    });\n  });\n\n  describe('#register', () => {\n    it('should increment update counter', () => {\n      const oldGeneration = getGeneration();\n      reactHotLoader.register(Div, 'Div', 'reactHotLoader.test.js');\n      // new thing, no change\n      expect(getGeneration()).toBe(oldGeneration + 1);\n\n      reactHotLoader.register(Div, 'Div', 'reactHotLoader.test.js');\n      // no replacement\n      expect(getGeneration()).toBe(oldGeneration + 2);\n\n      const NewDiv = () => <div />;\n      reactHotLoader.register(NewDiv, 'Div', 'reactHotLoader.test.js');\n      // replacement!\n      expect(getGeneration()).toBe(oldGeneration + 3);\n    });\n\n    it('should ignore dom elements and incomplete signature', () => {\n      reactHotLoader.register(Div, 'Div', 'reactHotLoader.test.js');\n      reactHotLoader.register('div', 'Div', 'reactHotLoader.test.js');\n      reactHotLoader.register(Span, 'Div');\n      reactHotLoader.register(Span, '');\n      reactHotLoader.register(Span, '', '');\n      const proxyElement = React.createElement(Div);\n      expect(proxyElement.type[UNWRAP_PROXY]()).toBe(Div);\n    });\n\n    it('should update proxy', () => {\n      reactHotLoader.register(Div, 'Div', 'reactHotLoader.test.js');\n      const proxyElement = React.createElement(Div);\n      expect(proxyElement.type[UNWRAP_PROXY]()).toBe(Div);\n\n      reactHotLoader.register(Span, 'Div', 'reactHotLoader.test.js');\n      expect(proxyElement.type[UNWRAP_PROXY]()).toBe(Span);\n    });\n\n    it('should not double-proxy', () => {\n      const Component1 = () => <div>42</div>;\n      const Element1 = <Component1 />;\n      const Type1 = Element1.type;\n      const Element2 = <Type1 />;\n      const Element3 = React.Children.only(Element1);\n      const Element4 = React.cloneElement(Element1);\n      expect(Element1.type).toBe(Element2.type);\n      expect(Element1.type).toBe(Element3.type);\n      expect(Element1.type).toBe(Element4.type);\n    });\n\n    it('should result into shadowing the original component', () => {\n      // Registering Div\n      reactHotLoader.register(Div, 'Div', 'reactHotLoader.test.js');\n\n      // Creating a Div element, proxy of Div is used\n      let proxyElement = React.createElement(Div);\n      let wrapper = mount(proxyElement);\n      expect(wrapper.html()).toBe('<div></div>');\n\n      // Register the same component but with a Span\n      reactHotLoader.register(Span, 'Div', 'reactHotLoader.test.js');\n\n      // Creating a Div element, proxy of Span is used\n      proxyElement = React.createElement(Div);\n      wrapper = mount(proxyElement);\n      expect(wrapper.html()).toBe('<span></span>');\n    });\n  });\n});\n"
  },
  {
    "path": "test/reconciler/proxyAdapter.test.js",
    "content": "/* eslint-env browser */\nimport { proxyWrapper } from '../../src/reconciler/proxyAdapter';\nimport * as proxies from '../../src/reconciler/proxies';\nimport { unscheduleUpdate } from '../../src/reconciler/hotReplacementRender';\nimport { internalConfiguration } from '../../src/configuration';\n\njest.mock('../../src/reconciler/proxies');\njest.mock('../../src/reconciler/hotReplacementRender');\n\nproxies.getProxyByType.mockReturnValue({ get: () => 'proxy' });\n\ndescribe(`proxyAdapter`, () => {\n  const fn = () => {};\n\n  it('should handle empty result', () => {\n    expect(proxyWrapper()).toBe(undefined);\n    expect(proxyWrapper(null)).toBe(null);\n  });\n\n  it('should handle arrays', () => {\n    expect(proxyWrapper([1, 2, 3])).toEqual([1, 2, 3]);\n    expect(proxyWrapper([{ type: fn, prop: 42 }])).toEqual([{ type: 'proxy', prop: 42 }]);\n  });\n\n  it('should handle elements', () => {\n    expect(proxyWrapper({ type: fn, prop: 42 })).toEqual({\n      type: 'proxy',\n      prop: 42,\n    });\n  });\n\n  it('should remove rendered proxy', () => {\n    const object = {};\n    unscheduleUpdate.mockClear();\n    internalConfiguration.disableProxyCreation = 1;\n    proxyWrapper.call(object);\n    expect(unscheduleUpdate).not.toHaveBeenCalled();\n\n    internalConfiguration.disableProxyCreation = 0;\n    proxyWrapper.call(object);\n    expect(unscheduleUpdate).toHaveBeenCalledWith(object);\n  });\n});\n"
  },
  {
    "path": "test/reconciler.test.js",
    "content": "import React, { Component } from 'react';\nimport { mount } from 'enzyme';\nimport TestRenderer from 'react-test-renderer';\nimport { AppContainer } from '../src/index.dev';\nimport {\n  openGeneration,\n  closeGeneration,\n  configureGeneration,\n  increment as incrementGeneration,\n} from '../src/global/generation';\nimport { areComponentsEqual } from '../src/utils.dev';\nimport logger from '../src/logger';\nimport reactHotLoader from '../src/reactHotLoader';\nimport configuration, { internalConfiguration } from '../src/configuration';\n\njest.mock('../src/logger');\n\nconst spyComponent = (render, displayName, key) => {\n  const mounted = jest.fn();\n  const unmounted = jest.fn();\n  const willUpdate = jest.fn();\n  const rendered = jest.fn();\n\n  class TestingComponent extends Component {\n    componentWillMount() {\n      mounted();\n    }\n\n    componentWillUpdate(nextProps, nextState) {\n      willUpdate(nextProps, nextState, this.props, this.state);\n    }\n\n    componentWillUnmount() {\n      unmounted();\n    }\n\n    /* eslint-disable */\n    __reactstandin__regenerateByEval(key, code) {\n      this[key] = eval(code);\n    }\n\n    /* eslint-enable */\n\n    render() {\n      rendered();\n      return render(this.props);\n    }\n  }\n\n  if (displayName) {\n    TestingComponent.displayName = displayName;\n  }\n\n  return {\n    Component: TestingComponent,\n    willUpdate,\n    mounted,\n    unmounted,\n    key,\n    rendered,\n  };\n};\n\ndescribe('reconciler', () => {\n  describe('Application', () => {\n    beforeEach(() => {\n      configureGeneration(1, 1);\n    });\n\n    it('should regenerate internal component', () => {\n      const root = spyComponent(({ children }) => <div>{children}</div>, 'root', 'root');\n\n      const first = spyComponent(({ children }) => <b>FIRST {children}</b>, 'test', '1');\n      const second = spyComponent(() => <u>REPLACED</u>, 'test', '2');\n      const third = spyComponent(() => <u>NEW ONE</u>, 'somethingElse', '3');\n\n      let currentComponent = first;\n      const currentProps = {};\n      let renderTick = 0;\n\n      const ComponentSwap = props => {\n        const { Component, key } = currentComponent;\n        return (\n          <blockquote>\n            <Component {...props} {...currentProps} keyId={key} />\n            <div>\n              {key} + {renderTick++}\n            </div>\n          </blockquote>\n        );\n      };\n\n      const App = () => (\n        <root.Component>\n          <ComponentSwap>42</ComponentSwap>\n        </root.Component>\n      );\n      App.contextTypes = {};\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n\n      // mount and perform first checks\n      expect(wrapper.find(<first.Component />.type).length).toBe(1);\n      expect(root.mounted).toHaveBeenCalledTimes(1);\n      expect(first.mounted).toHaveBeenCalledTimes(1);\n      expect(wrapper.text()).toMatch(/FIRST/);\n\n      // replace with `the same` component\n      currentComponent = second;\n      // they are different\n      expect(areComponentsEqual(first.Component, second.Component)).toBe(false);\n\n      currentProps.newProp = true;\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n      // now react-stand-in merge them together\n      expect(areComponentsEqual(first.Component, second.Component)).toBe(true);\n      expect(wrapper.find(<first.Component />.type).length).toBe(1);\n      expect(wrapper.find(<second.Component />.type).length).toBe(1);\n      expect(wrapper.text()).not.toMatch(/FIRST/);\n      expect(wrapper.text()).toMatch(/REPLACED/);\n\n      expect(root.mounted).toHaveBeenCalledTimes(1);\n      expect(first.unmounted).toHaveBeenCalledTimes(0);\n      expect(second.mounted).toHaveBeenCalledTimes(0);\n      // expect(second.willUpdate).toHaveBeenCalledTimes(2)\n\n      // what props should be used? Look like the new ones\n      expect(second.willUpdate.mock.calls[0]).toEqual([\n        { children: '42', keyId: '1' },\n        null,\n        { children: '42', keyId: '1' },\n        null,\n      ]);\n\n      expect(second.willUpdate.mock.calls[1]).toEqual([\n        { children: '42', newProp: true, keyId: '2' },\n        null,\n        {\n          children: '42',\n          keyId: '1',\n          ...(React.memo ? { cacheBusterProp: true } : {}),\n        },\n        null,\n      ]);\n\n      // replace with a different component\n      currentComponent = third;\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n\n      expect(wrapper.update().find(<third.Component />.type).length).toBe(1);\n      // first will never be unmounted\n      expect(first.unmounted).toHaveBeenCalledTimes(0);\n      expect(second.unmounted).toHaveBeenCalledTimes(1);\n      expect(third.mounted).toHaveBeenCalledTimes(1);\n\n      expect(areComponentsEqual(first.Component, third.Component)).toBe(false);\n      expect(areComponentsEqual(second.Component, third.Component)).toBe(false);\n    });\n\n    it('should hot-swap only internal components', () => {\n      let An0;\n      let An1;\n      let Bn0;\n      let Bn1;\n      let App;\n      {\n        const A = () => <div>A</div>;\n        const B = () => <div>A</div>;\n        A.displayName = 'A';\n        B.displayName = 'B';\n        App = () => (\n          <div>\n            <A />\n            <B />\n          </div>\n        );\n        An0 = A;\n        Bn0 = B;\n        reactHotLoader.register(App, 'App', 'test-hot-swap.js');\n        reactHotLoader.register(B, 'B0', 'test-hot-swap.js');\n      }\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n      {\n        const A = () => <div>A</div>;\n        const B = () => <div>A</div>;\n        A.displayName = 'A';\n        B.displayName = 'B';\n        App = () => (\n          <div>\n            <A />\n            <B />\n          </div>\n        );\n        An1 = A;\n        Bn1 = B;\n        reactHotLoader.register(App, 'App', 'test-hot-swap.js');\n        reactHotLoader.register(B, 'B1', 'test-hot-swap.js');\n      }\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n\n      // A-s are similar, and got merged\n      expect(<An0 />.type).toEqual(<An1 />.type);\n      // B-s are simlar, but known to be different types - not merged\n      expect(<Bn0 />.type).not.toEqual(<Bn1 />.type);\n    });\n\n    it('should regenerate internal component without AppContainer', () => {\n      const first = spyComponent(({ children }) => <b>{children}</b>, 'test', '1');\n\n      const second = spyComponent(() => <u>REPLACED</u>, 'test', '2');\n\n      let currentComponent = first;\n\n      const ComponentSwap = props => {\n        const { Component } = currentComponent;\n        return (\n          <blockquote>\n            <Component {...props} />\n          </blockquote>\n        );\n      };\n\n      const App = () => (\n        <div>\n          <h1>working</h1>\n          <ComponentSwap>\n            <ComponentSwap>42</ComponentSwap>\n          </ComponentSwap>\n        </div>\n      );\n\n      const wrapper = mount(\n        // <AppContainer> ensure - there is no AppContainer\n        <App />,\n        // </AppContainer>,\n      );\n\n      expect(wrapper.html()).not.toContain('REPLACED');\n\n      openGeneration();\n      currentComponent = second;\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n      closeGeneration();\n\n      expect(wrapper.html()).toContain('REPLACED');\n\n      expect(first.unmounted).toHaveBeenCalledTimes(0);\n      expect(second.mounted).toHaveBeenCalledTimes(0);\n    });\n\n    it('should use new children branch during reconcile', () => {\n      const First = spyComponent(() => <u>1</u>, 'test', '1');\n      const Second = spyComponent(() => <u>2</u>, 'test', '2');\n\n      const App = ({ second }) => (\n        <div>\n          <div>\n            <First.Component />\n            {second && <Second.Component />}\n          </div>\n        </div>\n      );\n\n      const Mounter = ({ second }) => <App second={second} />;\n      Mounter.contextTypes = {};\n\n      const wrapper = mount(<Mounter second />);\n\n      expect(First.rendered).toHaveBeenCalledTimes(1);\n      expect(Second.rendered).toHaveBeenCalledTimes(1);\n\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n\n      const renderCompensation = configuration.pureRender ? 1 : 0;\n\n      expect(First.rendered).toHaveBeenCalledTimes(3 + renderCompensation);\n      expect(Second.rendered).toHaveBeenCalledTimes(3 + renderCompensation);\n\n      openGeneration();\n      incrementGeneration();\n      wrapper.setProps({ second: false });\n      closeGeneration();\n      expect(First.rendered).toHaveBeenCalledTimes(5 + renderCompensation);\n      expect(Second.rendered).toHaveBeenCalledTimes(3 + renderCompensation);\n\n      expect(First.unmounted).toHaveBeenCalledTimes(0);\n      expect(Second.unmounted).toHaveBeenCalledTimes(1);\n    });\n\n    it('should use new children branch during reconcile for full components', () => {\n      const First = spyComponent(() => <u>1</u>, 'test', '1');\n      const Second = spyComponent(() => <u>2</u>, 'test', '2');\n\n      const Section = ({ children }) => <div>{children}</div>;\n\n      const App = ({ second }) => (\n        <div>\n          <div>\n            <Section>\n              <First.Component />\n              {second && <Second.Component />}\n            </Section>\n          </div>\n        </div>\n      );\n\n      const Mounter = ({ second }) => <App second={second} />;\n      Mounter.contextTypes = {};\n\n      const wrapper = mount(<Mounter second />);\n\n      expect(First.rendered).toHaveBeenCalledTimes(1);\n      expect(Second.rendered).toHaveBeenCalledTimes(1);\n\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n      expect(First.rendered).toHaveBeenCalledTimes(configuration.pureRender ? 4 : 3);\n      expect(Second.rendered).toHaveBeenCalledTimes(configuration.pureRender ? 4 : 3);\n\n      incrementGeneration();\n      wrapper.setProps({ second: false });\n      expect(First.rendered).toHaveBeenCalledTimes(configuration.pureRender ? 7 : 5);\n      expect(Second.rendered).toHaveBeenCalledTimes(configuration.pureRender ? 4 : 3);\n\n      expect(First.unmounted).toHaveBeenCalledTimes(0);\n      expect(Second.unmounted).toHaveBeenCalledTimes(1);\n    });\n\n    it('should handle child mounting', () => {\n      const First = spyComponent(() => <u>test1</u>, 'test1', '1');\n      const Second = spyComponent(() => <u>test2</u>, 'test2', '2');\n      const Third = spyComponent(() => <u>test3</u>, 'test3', '3');\n      const App = ({ first, second, third }) => (\n        <div>\n          {first && <First.Component />}\n          {second && [\n            <div key=\"1\">start</div>,\n            <Second.Component key=\"2\" />,\n            <div key=\"3\">middle</div>,\n            third && <Third.Component key=\"4\" />,\n          ]}\n        </div>\n      );\n\n      App.contextTypes = {};\n\n      const wrapper = mount(<App />);\n      expect(First.rendered).toHaveBeenCalledTimes(0);\n\n      openGeneration();\n      incrementGeneration();\n      wrapper.setProps({ first: true });\n      closeGeneration();\n      expect(First.rendered).toHaveBeenCalledTimes(1); // 1. prev state was empty == no need to reconcile\n\n      openGeneration();\n      incrementGeneration();\n      wrapper.setProps({ second: true });\n      closeGeneration();\n      expect(First.rendered).toHaveBeenCalledTimes(3); // +3 (reconcile + update + render)\n      expect(Second.rendered).toHaveBeenCalledTimes(1); // (update from first + render)\n\n      wrapper.setProps({ third: true });\n      expect(First.rendered).toHaveBeenCalledTimes(4);\n      expect(Second.rendered).toHaveBeenCalledTimes(2);\n      expect(Third.rendered).toHaveBeenCalledTimes(1);\n\n      expect(wrapper.update().html()).toMatch(/test3/);\n    });\n\n    it('should handle function as a child', () => {\n      const first = spyComponent(({ children }) => <b>{children(0)}</b>, 'test', '1');\n      const second = spyComponent(({ children }) => <u>{children(1)}</u>, 'test', '2');\n\n      let currentComponent = first;\n      const ComponentSwap = props => {\n        const { Component } = currentComponent;\n        return (\n          <blockquote>\n            <Component {...props} />\n          </blockquote>\n        );\n      };\n\n      const App = () => (\n        <div>\n          <h1>working</h1>\n          <ComponentSwap>{x => 42 + x}</ComponentSwap>\n        </div>\n      );\n\n      const wrapper = mount(\n        <AppContainer>\n          <App />\n        </AppContainer>,\n      );\n\n      expect(wrapper.text()).toContain(42);\n\n      currentComponent = second;\n      incrementGeneration();\n      wrapper.setProps({ update: 'now' });\n\n      expect(first.unmounted).toHaveBeenCalledTimes(0);\n      expect(second.mounted).toHaveBeenCalledTimes(0);\n      expect(wrapper.text()).toContain(43);\n    });\n\n    describe('should assmeble props for nested children', () => {\n      const testSuite = () => {\n        const RenderChildren = ({ children }) => <div>{children}</div>;\n        const RenderProp = jest.fn().mockImplementation(({ prop }) => <div>{prop}</div>);\n        const DefaultProp = jest.fn().mockImplementation(({ prop }) => (\n          <div>\n            {prop ? (\n              <div>42</div>\n            ) : (\n              <div>\n                <div>24</div>\n              </div>\n            )}\n          </div>\n        ));\n        DefaultProp.defaultProps = {\n          prop: 'defaultValue',\n        };\n\n        const App = () => (\n          <RenderChildren>\n            <div>\n              <RenderChildren>\n                <div className=\"1\">\n                  <div className=\"1.1\">\n                    <div className=\"1.2\">\n                      <RenderProp value={42} />\n                    </div>\n                  </div>\n                </div>\n                <div className=\"2\">\n                  <div className=\"2.1\">\n                    <RenderProp value={24} />\n                    <DefaultProp />\n                  </div>\n                </div>\n              </RenderChildren>\n            </div>\n          </RenderChildren>\n        );\n\n        logger.warn.mockClear();\n\n        const suite = () => (\n          <AppContainer>\n            <div>\n              <App />\n            </div>\n          </AppContainer>\n        );\n\n        const wrapper = TestRenderer.create(suite());\n\n        incrementGeneration();\n\n        wrapper.update(suite());\n\n        return { RenderProp, DefaultProp };\n      };\n\n      it('for Component SFC', () => {\n        const { RenderProp, DefaultProp } = testSuite();\n        const Comp = () => <div />;\n        expect(<Comp />.type.prototype.render).not.toBeDefined();\n\n        expect(RenderProp).toHaveBeenCalledTimes(6);\n        expect(RenderProp.mock.calls[0][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[1][0]).toEqual({ value: 24 });\n        expect(RenderProp.mock.calls[2][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[3][0]).toEqual({ value: 24 });\n\n        expect(DefaultProp).toHaveBeenCalledTimes(3);\n        expect(DefaultProp.mock.calls[0][0]).toEqual({ prop: 'defaultValue' });\n        expect(DefaultProp.mock.calls[1][0]).toEqual({ prop: 'defaultValue' });\n\n        expect(logger.warn).not.toHaveBeenCalled();\n      });\n\n      // unstable between React15 / 16.6\n      it.skip('for Pure SFC', () => {\n        configuration.pureSFC = true;\n        const { RenderProp, DefaultProp } = testSuite();\n        const Comp = () => <div />;\n        expect(<Comp />.type.prototype.render).not.toBeDefined();\n        configuration.pureSFC = false;\n\n        expect(RenderProp).toHaveBeenCalledTimes(6);\n        expect(RenderProp.mock.calls[0][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[1][0]).toEqual({ value: 24 });\n        expect(RenderProp.mock.calls[2][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[3][0]).toEqual({ value: 24 });\n\n        expect(DefaultProp).toHaveBeenCalledTimes(3);\n        expect(DefaultProp.mock.calls[0][0]).toEqual({ prop: 'defaultValue' });\n        expect(DefaultProp.mock.calls[1][0]).toEqual({ prop: 'defaultValue' });\n\n        expect(logger.warn).not.toHaveBeenCalled();\n      });\n\n      it('for SFC disabled', () => {\n        configuration.allowSFC = false;\n        const { RenderProp, DefaultProp } = testSuite();\n        const Comp = () => <div />;\n        expect(<Comp />.type.prototype.render).toBeDefined();\n        configuration.allowSFC = true;\n\n        expect(RenderProp).toHaveBeenCalledTimes(6);\n        expect(RenderProp.mock.calls[0][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[1][0]).toEqual({ value: 24 });\n        expect(RenderProp.mock.calls[2][0]).toEqual({ value: 42 });\n        expect(RenderProp.mock.calls[3][0]).toEqual({ value: 24 });\n\n        expect(DefaultProp).toHaveBeenCalledTimes(3);\n        expect(DefaultProp.mock.calls[0][0]).toEqual({ prop: 'defaultValue' });\n        expect(DefaultProp.mock.calls[1][0]).toEqual({ prop: 'defaultValue' });\n\n        expect(logger.warn).not.toHaveBeenCalled();\n      });\n    });\n\n    describe('when an error occurs in render', () => {\n      beforeEach(() => {\n        jest.spyOn(console, 'error').mockImplementation(() => {});\n      });\n\n      afterEach(() => {\n        console.error.mockRestore();\n      });\n\n      it('should catch error to the boundary', () => {\n        if (!React.Suspense) {\n          // this test is unstable on React 15\n          expect(true).toBe(true);\n          return;\n        }\n        configureGeneration(1, 1);\n        const App = () => <div>Normal application</div>;\n        reactHotLoader.register(App, 'App', 'test.js');\n\n        const TestCase = () => (\n          <AppContainer>\n            <App active />\n          </AppContainer>\n        );\n\n        const wrapper = mount(<TestCase />);\n\n        {\n          const errorFn = active => {\n            if (active) throw new Error();\n            return null;\n          };\n          const App = ({ active }) => (\n            <div>\n              Normal application\n              <span>{errorFn(active)}</span>\n            </div>\n          );\n          reactHotLoader.register(App, 'App', 'test.js');\n\n          expect(() => wrapper.setProps({ children: <App /> })).not.toThrow();\n        }\n\n        expect(logger.warn).toHaveBeenCalledWith(\n          `React-hot-loader: run time error during reconciliation`,\n          expect.any(Error),\n        );\n      });\n\n      it('should catch error', () => {\n        const App = () => <div>Normal application</div>;\n        reactHotLoader.register(App, 'App', 'test.js');\n\n        const TestCase = () => (\n          <AppContainer errorBoundary={false}>\n            <App active />\n          </AppContainer>\n        );\n\n        mount(<TestCase />);\n\n        {\n          const errorFn = active => {\n            if (active) throw new Error();\n            return null;\n          };\n          const App = ({ active }) => (\n            <div>\n              Normal application\n              <span>{errorFn(active)}</span>\n            </div>\n          );\n          reactHotLoader.register(App, 'App', 'test.js');\n\n          closeGeneration();\n\n          // Not throwing anymore ?\n          // expect(() => wrapper.setProps({ children: <App /> })).toThrow();\n          expect(internalConfiguration.disableProxyCreation).toBe(false);\n        }\n\n        expect(logger.warn).toHaveBeenCalledWith(\n          `React-hot-loader: run time error during reconciliation`,\n          expect.any(Error),\n        );\n      });\n\n      it('should catch \"suspense\" error, but swallow it', () => {\n        const App = () => <div>Normal application</div>;\n        reactHotLoader.register(App, 'App', 'test.js');\n\n        const TestCase = () => (\n          <AppContainer errorBoundary={false}>\n            <App active />\n          </AppContainer>\n        );\n\n        // const wrapper = mount(<TestCase />);\n        mount(<TestCase />);\n\n        {\n          const errorFn = active => {\n            if (active) throw Promise.resolve();\n            return null;\n          };\n          const App = ({ active }) => (\n            <div>\n              Normal application\n              <span>{errorFn(active)}</span>\n            </div>\n          );\n          reactHotLoader.register(App, 'App', 'test.js');\n\n          closeGeneration();\n\n          // Not throwing anymore ?\n          // expect(() => wrapper.setProps({ children: <App /> })).toThrow();\n          expect(internalConfiguration.disableProxyCreation).toBe(false);\n        }\n\n        // not stable across es5/modern build modes. Tested manually\n        // expect(logger.warn).not.toHaveBeenCalled();\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "test/utils.test.js",
    "content": "import React, { Component } from 'react';\nimport reactHotLoader from '../src/reactHotLoader';\nimport { areComponentsEqual, cold } from '../src/utils.dev';\nimport configuration from '../src/configuration';\nimport logger from '../src/logger';\n\nreactHotLoader.patch(React);\n\njest.mock('../src/logger');\n\ndescribe('utils (dev)', () => {\n  describe('areComponentsEqual', () => {\n    const createClasses = () => {\n      class Component1 extends Component {\n        render() {\n          return 42;\n        }\n      }\n\n      class Component2 extends Component {\n        render() {\n          return 43;\n        }\n      }\n\n      return { Component1, Component2 };\n    };\n\n    const createStateless = () => {\n      const Component1 = () => 42;\n      const Component2 = () => 43;\n      return { Component1, Component2 };\n    };\n\n    const testSuite = factory => {\n      it('should compare non-registred components', () => {\n        const { Component1, Component2 } = factory();\n\n        const element1 = <Component1 />;\n        const element2 = <Component2 />;\n\n        expect(Component1 === Component2).toBe(false);\n        expect(Component1 === element1.type).toBe(false);\n\n        expect(areComponentsEqual(Component1, element1.type)).toBe(true);\n        expect(areComponentsEqual(Component1, element2.type)).toBe(false);\n      });\n\n      it('should compare registered components', () => {\n        const { Component1, Component2 } = factory();\n\n        reactHotLoader.register(Component1, 'Class1', 'util.dev');\n        reactHotLoader.register(Component2, 'Class2', 'util.dev');\n\n        const element1 = <Component1 />;\n        const element2 = <Component2 />;\n\n        expect(Component1 === Component2).toBe(false);\n        expect(Component1 === element1.type).toBe(false);\n\n        expect(areComponentsEqual(Component1, element1.type)).toBe(true);\n        expect(areComponentsEqual(Component1, element2.type)).toBe(false);\n      });\n    };\n\n    describe('class based', () => testSuite(createClasses));\n\n    describe('function based', () => testSuite(createStateless));\n  });\n\n  describe('cold', () => {\n    it('should disable RHL for \"cold\" Components', () => {\n      const Component1 = () => <div>42</div>;\n      const Component2 = () => <div>42</div>;\n\n      reactHotLoader.register(Component1, 'Class1', 'util.dev');\n      reactHotLoader.register(Component2, 'Class2', 'util.dev');\n\n      cold(Component1);\n\n      const element1 = <Component1 />;\n      const element2 = <Component2 />;\n\n      expect(Component1 === element1.type).toBe(true);\n      expect(Component2 === element2.type).toBe(false);\n\n      expect(areComponentsEqual(Component1, element1.type)).toBe(true);\n      expect(areComponentsEqual(Component2, element2.type)).toBe(true);\n    });\n\n    it('should components by fileName', () => {\n      const Component1 = () => <div>42</div>;\n      const Component2 = () => <div>42</div>;\n\n      configuration.onComponentRegister = (type, name, file) => {\n        if (file === 'oneFile') cold(type);\n      };\n\n      reactHotLoader.register(Component1, 'Class1', 'oneFile');\n      reactHotLoader.register(Component2, 'Class2', 'anotherFile');\n\n      const element1 = <Component1 />;\n      const element2 = <Component2 />;\n\n      expect(Component1 === element1.type).toBe(true);\n      expect(Component2 === element2.type).toBe(false);\n\n      expect(areComponentsEqual(Component1, element1.type)).toBe(true);\n      expect(areComponentsEqual(Component2, element2.type)).toBe(true);\n    });\n\n    it('should report on cold update', () => {\n      const Component1 = () => <div>42</div>;\n      const Component2 = () => <div>42</div>;\n      cold(Component1);\n      // cold(Component2)\n      reactHotLoader.register(Component1, 'Cold', 'Winter');\n      reactHotLoader.register(Component1, 'Cold', 'Winter');\n      // first registration is expected\n      expect(logger.error).not.toHaveBeenCalled();\n\n      reactHotLoader.register(Component2, 'Cold', 'Winter');\n      expect(logger.error).toHaveBeenCalledWith(\n        `React-hot-loader: Cold component`,\n        'Cold',\n        'at',\n        'Winter',\n        'has been updated',\n      );\n    });\n  });\n});\n"
  },
  {
    "path": "testConfig/babel.js",
    "content": "const { createTransformer } = require('babel-jest');\nconst path = require('path');\n\nconst TARGET_ES2015 = 'es2015';\nconst TARGET_MODERN = 'modern';\nconst TARGETS = [TARGET_ES2015, TARGET_MODERN];\n\nconst getOptions = target => {\n  switch (target) {\n    case TARGET_ES2015:\n      return {\n        babelrc: false,\n        presets: ['env', 'react'],\n        plugins: ['transform-class-properties', 'transform-object-rest-spread'],\n      };\n    case TARGET_MODERN:\n      return {\n        babelrc: false,\n        presets: [\n          [\n            'env',\n            {\n              targets: {\n                browsers: 'chrome 60',\n              },\n            },\n          ],\n          'react',\n        ],\n        plugins: ['transform-class-properties', 'transform-object-rest-spread'],\n      };\n    default:\n      throw new Error('You must specify a BABEL_TARGET: es2015 or modern');\n  }\n};\n\nmodule.exports = createTransformer(getOptions(process.env.BABEL_TARGET));\nmodule.exports.getOptions = getOptions;\nmodule.exports.TARGETS = TARGETS;\n"
  },
  {
    "path": "testConfig/setupTests.js",
    "content": "/* eslint-disable global-require */\nimport React from 'react';\nimport Enzyme from 'enzyme';\n\nfunction getAdapter() {\n  if (React.version.startsWith('15')) {\n    return require('enzyme-adapter-react-15');\n  } else if (React.version.startsWith('16')) {\n    return require('enzyme-adapter-react-16');\n  } else if (React.version.startsWith('17')) {\n    return require('@wojtekmaj/enzyme-adapter-react-17');\n  }\n\n  throw new Error('this version of React is not supported by Enzyme');\n}\n\nconst Adapter = getAdapter();\n\nEnzyme.configure({ adapter: new Adapter() });\n"
  },
  {
    "path": "webpack.js",
    "content": "if (process.env.NODE_ENV === 'production') {\n  module.exports = require('./dist/webpack.production.min.js');\n} else {\n  module.exports = require('./dist/webpack.development.js');\n}\n"
  }
]