react-refresh 0.7.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # react-refresh
2
2
 
3
- This is an experimental package for hot reloading.
3
+ This package implements the wiring necessary to integrate Fast Refresh into bundlers. Fast Refresh is a feature that lets you edit React components in a running application without losing their state. It is similar to an old feature known as "hot reloading", but Fast Refresh is more reliable and officially supported by React.
4
4
 
5
- **Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.**
6
-
7
- **Use it at your own risk.**
5
+ This package is primarily aimed at developers of bundler plugins. If you’re working on one, here is a [rough guide](https://github.com/facebook/react/issues/16604#issuecomment-528663101) for Fast Refresh integration using this package.
@@ -15,7 +15,7 @@ if (process.env.NODE_ENV !== "production") {
15
15
  (function() {
16
16
  'use strict';
17
17
 
18
- var ReactFreshBabelPlugin = function (babel) {
18
+ function ReactFreshBabelPlugin (babel) {
19
19
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
20
 
21
21
  if (typeof babel.getEnv === 'function') {
@@ -170,9 +170,7 @@ var ReactFreshBabelPlugin = function (babel) {
170
170
  } // Neither require nor import. Might be a HOC.
171
171
  // Pass through.
172
172
 
173
- } else if (calleeType === 'MemberExpression') {// Could be something like React.forwardRef(...)
174
- // Pass through.
175
- } else {
173
+ } else if (calleeType === 'MemberExpression') ; else {
176
174
  // More complicated call.
177
175
  return false;
178
176
  }
@@ -209,7 +207,7 @@ var ReactFreshBabelPlugin = function (babel) {
209
207
  for (var i = 0; i < referencePaths.length; i++) {
210
208
  var ref = referencePaths[i];
211
209
 
212
- if (ref.node.type !== 'JSXIdentifier' && ref.node.type !== 'Identifier') {
210
+ if (ref.node && ref.node.type !== 'JSXIdentifier' && ref.node.type !== 'Identifier') {
213
211
  continue;
214
212
  }
215
213
 
@@ -704,16 +702,19 @@ var ReactFreshBabelPlugin = function (babel) {
704
702
 
705
703
  var handle = createRegistration(programPath, persistentID);
706
704
 
707
- if ((targetExpr.type === 'ArrowFunctionExpression' || targetExpr.type === 'FunctionExpression') && targetPath.parent.type === 'VariableDeclarator') {
708
- // Special case when a function would get an inferred name:
705
+ if (targetPath.parent.type === 'VariableDeclarator') {
706
+ // Special case when a variable would get an inferred name:
709
707
  // let Foo = () => {}
710
708
  // let Foo = function() {}
709
+ // let Foo = styled.div``;
711
710
  // We'll register it on next line so that
712
711
  // we don't mess up the inferred 'Foo' function name.
712
+ // (eg: with @babel/plugin-transform-react-display-name or
713
+ // babel-plugin-styled-components)
713
714
  insertAfterPath.insertAfter(t.expressionStatement(t.assignmentExpression('=', handle, declPath.node.id))); // Result: let Foo = () => {}; _c1 = Foo;
714
715
  } else {
715
716
  // let Foo = hoc(() => {})
716
- targetPath.replaceWith(t.assignmentExpression('=', handle, targetExpr)); // Result: let Foo = _c1 = hoc(() => {})
717
+ targetPath.replaceWith(t.assignmentExpression('=', handle, targetExpr)); // Result: let Foo = hoc(_c1 = () => {})
717
718
  }
718
719
  });
719
720
  },
@@ -755,19 +756,8 @@ var ReactFreshBabelPlugin = function (babel) {
755
756
  }
756
757
  }
757
758
  };
758
- };
759
-
760
- var ReactFreshBabelPlugin$1 = Object.freeze({
761
- default: ReactFreshBabelPlugin
762
- });
763
-
764
- var ReactFreshBabelPlugin$2 = ( ReactFreshBabelPlugin$1 && ReactFreshBabelPlugin ) || ReactFreshBabelPlugin$1;
765
-
766
- // This is hacky but makes it work with both Rollup and Jest.
767
-
768
-
769
- var babel = ReactFreshBabelPlugin$2.default || ReactFreshBabelPlugin$2;
759
+ }
770
760
 
771
- module.exports = babel;
761
+ module.exports = ReactFreshBabelPlugin;
772
762
  })();
773
763
  }
@@ -7,17 +7,16 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
 
10
- 'use strict';function w(r){function t(a,b){var d=a.scope.generateUidIdentifier("c");l.has(a)||l.set(a,[]);l.get(a).push({handle:d,persistentID:b});return d}function u(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function m(a,b,d){var c=b.node;switch(c.type){case "Identifier":if(!u(c.name))break;d(a,c,null);return!0;case "FunctionDeclaration":return d(a,c.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===c.body.type)break;d(a,c,b);return!0;case "FunctionExpression":return d(a,
10
+ 'use strict';module.exports=function(r){function t(a,b){var d=a.scope.generateUidIdentifier("c");l.has(a)||l.set(a,[]);l.get(a).push({handle:d,persistentID:b});return d}function u(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function m(a,b,d){var c=b.node;switch(c.type){case "Identifier":if(!u(c.name))break;d(a,c,null);return!0;case "FunctionDeclaration":return d(a,c.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===c.body.type)break;d(a,c,b);return!0;case "FunctionExpression":return d(a,
11
11
  c,b),!0;case "CallExpression":var f=b.get("arguments");if(void 0===f||0===f.length)break;var g=b.get("callee");switch(g.node.type){case "MemberExpression":case "Identifier":g=g.getSource();if(!m(a+"$"+g,f[0],d))return!1;d(a,c,b);return!0;default:return!1}case "VariableDeclarator":if(f=c.init,null!==f&&(g=c.id.name,u(g))){switch(f.type){case "ArrowFunctionExpression":case "FunctionExpression":break;case "CallExpression":c=f.callee;var e=c.type;if("Import"===e)return!1;if("Identifier"===e){if(0===c.name.indexOf("require")||
12
- 0===c.name.indexOf("import"))return!1}else if("MemberExpression"!==e)return!1;break;case "TaggedTemplateExpression":break;default:return!1}c=b.get("init");if(m(a,c,d))return!0;g=b.scope.getBinding(g);if(void 0===g)return;b=!1;g=g.referencePaths;for(e=0;e<g.length;e++){var h=g[e];if("JSXIdentifier"===h.node.type||"Identifier"===h.node.type){h=h.parent;if("JSXOpeningElement"===h.type)b=!0;else if("CallExpression"===h.type){h=h.callee;var k=void 0;switch(h.type){case "Identifier":k=h.name;break;case "MemberExpression":k=
13
- h.property.name}switch(k){case "createElement":case "jsx":case "jsxDEV":case "jsxs":b=!0}}if(b)return d(a,f,c),!0}}}}return!1}function x(a){a=n.get(a);return void 0===a?null:{key:a.map(function(a){return a.name+"{"+a.key+"}"}).join("\n"),customHooks:a.filter(function(a){a:switch(a.name){case "useState":case "React.useState":case "useReducer":case "React.useReducer":case "useEffect":case "React.useEffect":case "useLayoutEffect":case "React.useLayoutEffect":case "useMemo":case "React.useMemo":case "useCallback":case "React.useCallback":case "useRef":case "React.useRef":case "useContext":case "React.useContext":case "useImperativeMethods":case "React.useImperativeMethods":case "useDebugValue":case "React.useDebugValue":a=
14
- !0;break a;default:a=!1}return!a}).map(function(a){return e.cloneDeep(a.callee)})}}function E(a){a=a.hub.file;var b=y.get(a);if(void 0!==b)return b;b=!1;for(var d=a.ast.comments,c=0;c<d.length;c++)if(-1!==d[c].value.indexOf("@refresh reset")){b=!0;break}y.set(a,b);return b}function v(a,b,d){var c=b.key;b=b.customHooks;var f=E(d.path),g=[];b.forEach(function(a){switch(a.type){case "MemberExpression":if("Identifier"===a.object.type)var b=a.object.name;break;case "Identifier":b=a.name}d.hasBinding(b)?
15
- g.push(a):f=!0});b=c;"function"!==typeof require||p.emitFullSignatures||(b=require("crypto").createHash("sha1").update(c).digest("base64"));a=[a,e.stringLiteral(b)];(f||0<g.length)&&a.push(e.booleanLiteral(f));0<g.length&&a.push(e.functionExpression(null,[],e.blockStatement([e.returnStatement(e.arrayExpression(g))])));return a}var p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"===typeof r.getEnv){var z=r.getEnv();if("development"!==z&&!p.skipEnvCheck)throw Error('React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "'+
16
- z+'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.');}var e=r.types,F=e.identifier(p.refreshReg||"$RefreshReg$"),A=e.identifier(p.refreshSig||"$RefreshSig$"),l=new Map,y=new WeakMap,k=new WeakSet,q=new WeakSet,B=new WeakSet,n=new WeakMap,G={CallExpression:function(a){var b=a.node.callee,d=null;switch(b.type){case "Identifier":d=b.name;break;case "MemberExpression":d=b.property.name}if(null!==d&&/^use[A-Z]/.test(d)&&(b=a.scope.getFunctionParent(),null!==b)){b=b.block;
12
+ 0===c.name.indexOf("import"))return!1}else if("MemberExpression"!==e)return!1;break;case "TaggedTemplateExpression":break;default:return!1}c=b.get("init");if(m(a,c,d))return!0;g=b.scope.getBinding(g);if(void 0===g)return;b=!1;g=g.referencePaths;for(e=0;e<g.length;e++){var h=g[e];if(!h.node||"JSXIdentifier"===h.node.type||"Identifier"===h.node.type){h=h.parent;if("JSXOpeningElement"===h.type)b=!0;else if("CallExpression"===h.type){h=h.callee;var k=void 0;switch(h.type){case "Identifier":k=h.name;break;
13
+ case "MemberExpression":k=h.property.name}switch(k){case "createElement":case "jsx":case "jsxDEV":case "jsxs":b=!0}}if(b)return d(a,f,c),!0}}}}return!1}function w(a){a=n.get(a);return void 0===a?null:{key:a.map(function(a){return a.name+"{"+a.key+"}"}).join("\n"),customHooks:a.filter(function(a){a:switch(a.name){case "useState":case "React.useState":case "useReducer":case "React.useReducer":case "useEffect":case "React.useEffect":case "useLayoutEffect":case "React.useLayoutEffect":case "useMemo":case "React.useMemo":case "useCallback":case "React.useCallback":case "useRef":case "React.useRef":case "useContext":case "React.useContext":case "useImperativeMethods":case "React.useImperativeMethods":case "useDebugValue":case "React.useDebugValue":a=
14
+ !0;break a;default:a=!1}return!a}).map(function(a){return e.cloneDeep(a.callee)})}}function B(a){a=a.hub.file;var b=x.get(a);if(void 0!==b)return b;b=!1;for(var d=a.ast.comments,c=0;c<d.length;c++)if(-1!==d[c].value.indexOf("@refresh reset")){b=!0;break}x.set(a,b);return b}function v(a,b,d){var c=b.key;b=b.customHooks;var f=B(d.path),g=[];b.forEach(function(a){switch(a.type){case "MemberExpression":if("Identifier"===a.object.type)var b=a.object.name;break;case "Identifier":b=a.name}d.hasBinding(b)?
15
+ g.push(a):f=!0});b=c;"function"!==typeof require||p.emitFullSignatures||(b=require("crypto").createHash("sha1").update(c).digest("base64"));a=[a,e.stringLiteral(b)];(f||0<g.length)&&a.push(e.booleanLiteral(f));0<g.length&&a.push(e.functionExpression(null,[],e.blockStatement([e.returnStatement(e.arrayExpression(g))])));return a}var p=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"===typeof r.getEnv){var y=r.getEnv();if("development"!==y&&!p.skipEnvCheck)throw Error('React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "'+
16
+ y+'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.');}var e=r.types,C=e.identifier(p.refreshReg||"$RefreshReg$"),z=e.identifier(p.refreshSig||"$RefreshSig$"),l=new Map,x=new WeakMap,k=new WeakSet,q=new WeakSet,A=new WeakSet,n=new WeakMap,D={CallExpression:function(a){var b=a.node.callee,d=null;switch(b.type){case "Identifier":d=b.name;break;case "MemberExpression":d=b.property.name}if(null!==d&&/^use[A-Z]/.test(d)&&(b=a.scope.getFunctionParent(),null!==b)){b=b.block;
17
17
  n.has(b)||n.set(b,[]);b=n.get(b);var c="";"VariableDeclarator"===a.parent.type&&(c=a.parentPath.get("id").getSource());var f=a.get("arguments");"useState"===d&&0<f.length?c+="("+f[0].getSource()+")":"useReducer"===d&&1<f.length&&(c+="("+f[1].getSource()+")");b.push({callee:a.node.callee,name:d,key:c})}}};return{visitor:{ExportDefaultDeclaration:function(a){var b=a.node,d=b.declaration,c=a.get("declaration");if("CallExpression"===d.type&&!k.has(b)){k.add(b);var f=a.parentPath;m("%default%",c,function(a,
18
18
  b,c){null!==c&&(a=t(f,a),c.replaceWith(e.assignmentExpression("=",a,b)))})}},FunctionDeclaration:{enter:function(a){var b=a.node;switch(a.parent.type){case "Program":var d=a;var c=a.parentPath;break;case "ExportNamedDeclaration":d=a.parentPath;c=d.parentPath;break;case "ExportDefaultDeclaration":d=a.parentPath;c=d.parentPath;break;default:return}var f=b.id;null!==f&&(f=f.name,u(f)&&!k.has(b)&&(k.add(b),m(f,a,function(a,b){a=t(c,a);d.insertAfter(e.expressionStatement(e.assignmentExpression("=",a,b)))})))},
19
- exit:function(a){var b=a.node,d=b.id;if(null!==d){var c=x(b);if(null!==c&&!q.has(b)){q.add(b);b=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:b,init:e.callExpression(A,[])});a.get("body").unshiftContainer("body",e.expressionStatement(e.callExpression(b,[])));var f=null;a.find(function(a){if(a.parentPath.isBlock())return f=a,!0});null!==f&&f.insertAfter(e.expressionStatement(e.callExpression(b,v(d,c,f.scope))))}}}},"ArrowFunctionExpression|FunctionExpression":{exit:function(a){var b=
20
- a.node,d=x(b);if(null!==d&&!q.has(b)){q.add(b);var c=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:c,init:e.callExpression(A,[])});"BlockStatement"!==a.node.body.type&&(a.node.body=e.blockStatement([e.returnStatement(a.node.body)]));a.get("body").unshiftContainer("body",e.expressionStatement(e.callExpression(c,[])));if("VariableDeclarator"===a.parent.type){var f=null;a.find(function(a){if(a.parentPath.isBlock())return f=a,!0});null!==f&&f.insertAfter(e.expressionStatement(e.callExpression(c,
21
- v(a.parent.id,d,f.scope))))}else a.replaceWith(e.callExpression(c,v(b,d,a.scope)))}}},VariableDeclaration:function(a){var b=a.node;switch(a.parent.type){case "Program":var d=a;var c=a.parentPath;break;case "ExportNamedDeclaration":d=a.parentPath;c=d.parentPath;break;case "ExportDefaultDeclaration":d=a.parentPath;c=d.parentPath;break;default:return}if(!k.has(b)&&(k.add(b),a=a.get("declarations"),1===a.length)){var f=a[0];m(f.node.id.name,f,function(a,b,h){null!==h&&(a=t(c,a),"ArrowFunctionExpression"!==
22
- b.type&&"FunctionExpression"!==b.type||"VariableDeclarator"!==h.parent.type?h.replaceWith(e.assignmentExpression("=",a,b)):d.insertAfter(e.expressionStatement(e.assignmentExpression("=",a,f.node.id))))})}},Program:{enter:function(a){a.traverse(G)},exit:function(a){var b=l.get(a);if(void 0!==b){var d=a.node;if(!B.has(d)){B.add(d);l.delete(a);var c=[];a.pushContainer("body",e.variableDeclaration("var",c));b.forEach(function(b){var d=b.handle;a.pushContainer("body",e.expressionStatement(e.callExpression(F,
23
- [d,e.stringLiteral(b.persistentID)])));c.push(e.variableDeclarator(d))})}}}}}}}var C={default:w},D=C&&w||C;module.exports=D.default||D;
19
+ exit:function(a){var b=a.node,d=b.id;if(null!==d){var c=w(b);if(null!==c&&!q.has(b)){q.add(b);b=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:b,init:e.callExpression(z,[])});a.get("body").unshiftContainer("body",e.expressionStatement(e.callExpression(b,[])));var f=null;a.find(function(a){if(a.parentPath.isBlock())return f=a,!0});null!==f&&f.insertAfter(e.expressionStatement(e.callExpression(b,v(d,c,f.scope))))}}}},"ArrowFunctionExpression|FunctionExpression":{exit:function(a){var b=
20
+ a.node,d=w(b);if(null!==d&&!q.has(b)){q.add(b);var c=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:c,init:e.callExpression(z,[])});"BlockStatement"!==a.node.body.type&&(a.node.body=e.blockStatement([e.returnStatement(a.node.body)]));a.get("body").unshiftContainer("body",e.expressionStatement(e.callExpression(c,[])));if("VariableDeclarator"===a.parent.type){var f=null;a.find(function(a){if(a.parentPath.isBlock())return f=a,!0});null!==f&&f.insertAfter(e.expressionStatement(e.callExpression(c,
21
+ v(a.parent.id,d,f.scope))))}else a.replaceWith(e.callExpression(c,v(b,d,a.scope)))}}},VariableDeclaration:function(a){var b=a.node;switch(a.parent.type){case "Program":var d=a;var c=a.parentPath;break;case "ExportNamedDeclaration":d=a.parentPath;c=d.parentPath;break;case "ExportDefaultDeclaration":d=a.parentPath;c=d.parentPath;break;default:return}if(!k.has(b)&&(k.add(b),a=a.get("declarations"),1===a.length)){var f=a[0];m(f.node.id.name,f,function(a,b,h){null!==h&&(a=t(c,a),"VariableDeclarator"===
22
+ h.parent.type?d.insertAfter(e.expressionStatement(e.assignmentExpression("=",a,f.node.id))):h.replaceWith(e.assignmentExpression("=",a,b)))})}},Program:{enter:function(a){a.traverse(D)},exit:function(a){var b=l.get(a);if(void 0!==b){var d=a.node;if(!A.has(d)){A.add(d);l.delete(a);var c=[];a.pushContainer("body",e.variableDeclaration("var",c));b.forEach(function(b){var d=b.handle;a.pushContainer("body",e.expressionStatement(e.callExpression(C,[d,e.stringLiteral(b.persistentID)])));c.push(e.variableDeclarator(d))})}}}}}}};
@@ -15,24 +15,57 @@ if (process.env.NODE_ENV !== "production") {
15
15
  (function() {
16
16
  'use strict';
17
17
 
18
+ // ATTENTION
19
+ // When adding new symbols to this file,
20
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
18
21
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
19
22
  // nor polyfill, then a plain number is used for performance.
20
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
21
-
22
-
23
-
24
-
25
-
26
-
27
- // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
28
- // (unstable) APIs that have been removed. Can we remove the symbols?
29
-
30
-
31
-
32
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
33
-
34
-
35
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
23
+ var REACT_ELEMENT_TYPE = 0xeac7;
24
+ var REACT_PORTAL_TYPE = 0xeaca;
25
+ var REACT_FRAGMENT_TYPE = 0xeacb;
26
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
27
+ var REACT_PROFILER_TYPE = 0xead2;
28
+ var REACT_PROVIDER_TYPE = 0xeacd;
29
+ var REACT_CONTEXT_TYPE = 0xeace;
30
+ var REACT_FORWARD_REF_TYPE = 0xead0;
31
+ var REACT_SUSPENSE_TYPE = 0xead1;
32
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
33
+ var REACT_MEMO_TYPE = 0xead3;
34
+ var REACT_LAZY_TYPE = 0xead4;
35
+ var REACT_BLOCK_TYPE = 0xead9;
36
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
37
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
38
+ var REACT_RESPONDER_TYPE = 0xead6;
39
+ var REACT_SCOPE_TYPE = 0xead7;
40
+ var REACT_OPAQUE_ID_TYPE = 0xeae0;
41
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
42
+ var REACT_OFFSCREEN_TYPE = 0xeae2;
43
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
44
+
45
+ if (typeof Symbol === 'function' && Symbol.for) {
46
+ var symbolFor = Symbol.for;
47
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
48
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
49
+ REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
50
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
51
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
52
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
53
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
54
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
55
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
56
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
57
+ REACT_MEMO_TYPE = symbolFor('react.memo');
58
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
59
+ REACT_BLOCK_TYPE = symbolFor('react.block');
60
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
61
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
62
+ REACT_RESPONDER_TYPE = symbolFor('react.responder');
63
+ REACT_SCOPE_TYPE = symbolFor('react.scope');
64
+ REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
65
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
66
+ REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
67
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
68
+ }
36
69
 
37
70
  var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // We never remove these associations.
38
71
  // It's OK to reference families, but use WeakMap/Set for types.
@@ -174,6 +207,7 @@ function cloneSet(set) {
174
207
  }
175
208
 
176
209
  function performReactRefresh() {
210
+
177
211
  if (pendingUpdates.length === 0) {
178
212
  return null;
179
213
  }
@@ -474,9 +508,7 @@ function injectIntoGlobalHook(globalObject) {
474
508
  // Mount a new root.
475
509
  mountedRoots.add(root);
476
510
  failedRoots.delete(root);
477
- } else if (wasMounted && isMounted) {// Update an existing root.
478
- // This doesn't affect our mounted root Set.
479
- } else if (wasMounted && !isMounted) {
511
+ } else if (wasMounted && isMounted) ; else if (wasMounted && !isMounted) {
480
512
  // Unmount an existing root.
481
513
  mountedRoots.delete(root);
482
514
 
@@ -563,10 +595,6 @@ function createSignatureFunctionForTransform() {
563
595
 
564
596
  status = 'resolved';
565
597
  break;
566
-
567
- case 'resolved':
568
- // Do nothing. Fast path for all future renders.
569
- break;
570
598
  }
571
599
 
572
600
  return type;
@@ -631,26 +659,17 @@ function isLikelyComponentType(type) {
631
659
  }
632
660
  }
633
661
 
634
- var ReactFreshRuntime = Object.freeze({
635
- performReactRefresh: performReactRefresh,
636
- register: register,
637
- setSignature: setSignature,
638
- collectCustomHooksForSignature: collectCustomHooksForSignature,
639
- getFamilyByID: getFamilyByID,
640
- getFamilyByType: getFamilyByType,
641
- findAffectedHostInstances: findAffectedHostInstances,
642
- injectIntoGlobalHook: injectIntoGlobalHook,
643
- hasUnrecoverableErrors: hasUnrecoverableErrors,
644
- _getMountedRootCount: _getMountedRootCount,
645
- createSignatureFunctionForTransform: createSignatureFunctionForTransform,
646
- isLikelyComponentType: isLikelyComponentType
647
- });
648
-
649
- // This is hacky but makes it work with both Rollup and Jest.
650
-
651
-
652
- var runtime = ReactFreshRuntime.default || ReactFreshRuntime;
653
-
654
- module.exports = runtime;
662
+ exports._getMountedRootCount = _getMountedRootCount;
663
+ exports.collectCustomHooksForSignature = collectCustomHooksForSignature;
664
+ exports.createSignatureFunctionForTransform = createSignatureFunctionForTransform;
665
+ exports.findAffectedHostInstances = findAffectedHostInstances;
666
+ exports.getFamilyByID = getFamilyByID;
667
+ exports.getFamilyByType = getFamilyByType;
668
+ exports.hasUnrecoverableErrors = hasUnrecoverableErrors;
669
+ exports.injectIntoGlobalHook = injectIntoGlobalHook;
670
+ exports.isLikelyComponentType = isLikelyComponentType;
671
+ exports.performReactRefresh = performReactRefresh;
672
+ exports.register = register;
673
+ exports.setSignature = setSignature;
655
674
  })();
656
675
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "0.7.2",
7
+ "version": "0.8.3",
8
8
  "homepage": "https://reactjs.org/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",