Skip to content

Instantly share code, notes, and snippets.

@NMinhNguyen
Last active February 28, 2020 23:47
Show Gist options
  • Save NMinhNguyen/11fd4d00bb182e1cf8c8a007ef0df133 to your computer and use it in GitHub Desktop.
Save NMinhNguyen/11fd4d00bb182e1cf8c8a007ef0df133 to your computer and use it in GitHub Desktop.
react-test-renderer/shallow bundle diff between react-shallow-renderer 16.12.0 and 16.13.0
diff --git a/build/node_modules/react-test-renderer/package.json b/../react-test-renderer/package.json
index b1ab08fe6..ccfb6b8f1 100644
--- a/build/node_modules/react-test-renderer/package.json
+++ b/../react-test-renderer/package.json
@@ -21,7 +21,7 @@
"dependencies": {
"object-assign": "^4.1.1",
"react-is": "^16.8.6",
- "react-shallow-renderer": "^16.12.0",
+ "react-shallow-renderer": "^16.13.0",
"scheduler": "^0.19.0"
},
"peerDependencies": {
diff --git a/build/node_modules/react-test-renderer/umd/react-test-renderer-shallow.development.js b/../react-test-renderer/umd/react-test-renderer-shallow.development.js
index 8cab50a64..9d175132c 100644
--- a/build/node_modules/react-test-renderer/umd/react-test-renderer-shallow.development.js
+++ b/../react-test-renderer/umd/react-test-renderer-shallow.development.js
@@ -86,112 +86,7 @@
return typeOf(object) === REACT_MEMO_TYPE;
}
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
-
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
-
- var ReactPropTypesSecret_1 = ReactPropTypesSecret;
-
- var printWarning = function() {};
-
- {
- var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
- var loggedTypeFailures = {};
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
-
- printWarning = function(text) {
- var message = 'Warning: ' + text;
- if (typeof console !== 'undefined') {
- console.error(message);
- }
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- throw new Error(message);
- } catch (x) {}
- };
- }
-
- /**
- * Assert that the values match with the type specs.
- * Error messages are memorized and will only be shown once.
- *
- * @param {object} typeSpecs Map of name to a ReactPropType
- * @param {object} values Runtime values that need to be type-checked
- * @param {string} location e.g. "prop", "context", "child context"
- * @param {string} componentName Name of the component for error messages.
- * @param {?Function} getStack Returns the component stack.
- * @private
- */
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
- {
- for (var typeSpecName in typeSpecs) {
- if (has(typeSpecs, typeSpecName)) {
- var error;
- // Prop type validation may throw. In case they do, we don't want to
- // fail the render phase where it didn't fail before. So we log it.
- // After these have been cleaned up, we'll let them throw.
- try {
- // This is intentionally an invariant that gets caught. It's the same
- // behavior as without this statement except with a better message.
- if (typeof typeSpecs[typeSpecName] !== 'function') {
- var err = Error(
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
- );
- err.name = 'Invariant Violation';
- throw err;
- }
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
- } catch (ex) {
- error = ex;
- }
- if (error && !(error instanceof Error)) {
- printWarning(
- (componentName || 'React class') + ': type specification of ' +
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
- 'You may have forgotten to pass an argument to the type checker ' +
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
- 'shape all require an argument).'
- );
- }
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
- // Only monitor this failure once because there tends to be a lot of the
- // same error.
- loggedTypeFailures[error.message] = true;
-
- var stack = getStack ? getStack() : '';
-
- printWarning(
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
- );
- }
- }
- }
- }
- }
-
- /**
- * Resets warning cache when testing.
- *
- * @private
- */
- checkPropTypes.resetWarningCache = function() {
- {
- loggedTypeFailures = {};
- }
- };
-
- var checkPropTypes_1 = checkPropTypes;
-
- /** @license ReactShallowRenderer v16.12.0
+ /** @license ReactShallowRenderer v16.13.0
* react-shallow-renderer.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@@ -233,17 +128,18 @@
return '\n in ' + (name || 'Unknown') + sourceInfo;
}
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
+ var hasOwnProperty = Object.prototype.hasOwnProperty; // Prevent newer renderers from RTE when used with older react package versions.
// Current owner and dispatcher used to share the same ref,
// but PR #14548 split them out to better support the react-debug-tools package.
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
+ if (!hasOwnProperty.call(ReactSharedInternals, 'ReactCurrentDispatcher')) {
ReactSharedInternals.ReactCurrentDispatcher = {
current: null
};
}
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
+ if (!hasOwnProperty.call(ReactSharedInternals, 'ReactCurrentBatchConfig')) {
ReactSharedInternals.ReactCurrentBatchConfig = {
suspense: null
};
@@ -255,11 +151,11 @@
args[_key2 - 1] = arguments[_key2];
}
- printWarning$1('error', format, args);
+ printWarning('error', format, args);
}
}
- function printWarning$1(level, format, args) {
+ function printWarning(level, format, args) {
{
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
@@ -279,6 +175,7 @@
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
// breaks IE9: https://github.com/facebook/react/issues/13610
+ // eslint-disable-next-line no-console
Function.prototype.apply.call(console[level], console, argsWithFormat);
@@ -406,7 +303,7 @@
var objectIs = typeof Object.is === 'function' ? Object.is : is;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
@@ -431,7 +328,7 @@
for (var i = 0; i < keysA.length; i++) {
- if (!hasOwnProperty.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
+ if (!hasOwnProperty$1.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
@@ -439,7 +336,48 @@
return true;
}
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
+ var loggedTypeFailures = {};
+ function checkPropTypes(typeSpecs, values, location, componentName) {
+ {
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
+
+ for (var typeSpecName in typeSpecs) {
+ if (has(typeSpecs, typeSpecName)) {
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
+ // fail the render phase where it didn't fail before. So we log it.
+ // After these have been cleaned up, we'll let them throw.
+
+ try {
+ // This is intentionally an invariant that gets caught. It's the same
+ // behavior as without this statement except with a better message.
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
+ err.name = 'Invariant Violation';
+ throw err;
+ }
+
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
+ } catch (ex) {
+ error$1 = ex;
+ }
+
+ if (error$1 && !(error$1 instanceof Error)) {
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
+ }
+
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
+ // Only monitor this failure once because there tends to be a lot of the
+ // same error.
+ loggedTypeFailures[error$1.message] = true;
+ error('Failed %s type: %s', location, error$1.message);
+ }
+ }
+ }
+ }
+ }
+
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
+ ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var RE_RENDER_LIMIT = 25;
var emptyObject = {};
@@ -478,9 +416,7 @@
return true;
}
- var Updater =
- /*#__PURE__*/
- function () {
+ var Updater = /*#__PURE__*/function () {
function Updater(renderer) {
this._renderer = renderer;
this._callbacks = [];
@@ -561,9 +497,7 @@
return typeof action === 'function' ? action(state) : action;
}
- var ReactShallowRenderer =
- /*#__PURE__*/
- function () {
+ var ReactShallowRenderer = /*#__PURE__*/function () {
function ReactShallowRenderer() {
this._reset();
}
@@ -924,9 +858,17 @@
this._element = element;
this._context = getMaskedContext(elementType.contextTypes, context); // Inner memo component props aren't currently validated in createElement.
+ var prevGetStack;
+
+ {
+ prevGetStack = ReactDebugCurrentFrame.getCurrentStack;
+ ReactDebugCurrentFrame.getCurrentStack = getStackAddendum;
+ }
+
+ try {
if (isMemo(element) && elementType.propTypes) {
currentlyValidatingElement = element;
- checkPropTypes_1(elementType.propTypes, element.props, 'prop', getComponentName(elementType), getStackAddendum);
+ checkPropTypes(elementType.propTypes, element.props, 'prop', getComponentName(elementType));
}
if (this._instance) {
@@ -945,7 +887,7 @@
if (elementType.contextTypes) {
currentlyValidatingElement = element;
- checkPropTypes_1(elementType.contextTypes, this._context, 'context', getName(elementType, this._instance), getStackAddendum);
+ checkPropTypes(elementType.contextTypes, this._context, 'context', getName(elementType, this._instance));
currentlyValidatingElement = null;
}
@@ -986,6 +928,11 @@
}
}
}
+ } finally {
+ {
+ ReactDebugCurrentFrame.getCurrentStack = prevGetStack;
+ }
+ }
this._rendering = false;
diff --git a/build/node_modules/react-test-renderer/umd/react-test-renderer-shallow.production.min.js b/../react-test-renderer/umd/react-test-renderer-shallow.production.min.js
index d8261209d..5dbc41d26 100644
--- a/build/node_modules/react-test-renderer/umd/react-test-renderer-shallow.production.min.js
+++ b/../react-test-renderer/umd/react-test-renderer-shallow.production.min.js
@@ -7,7 +7,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
- ReactShallowRenderer v16.12.0
+ ReactShallowRenderer v16.13.0
react-shallow-renderer.js
Copyright (c) Facebook, Inc. and its affiliates.
@@ -19,20 +19,20 @@
function p(b){if(null==b)return null;if("function"===typeof b)return b.displayName||b.name||null;if("string"===typeof b)return b;switch(b){case M:return"Fragment";case N:return"Portal";case O:return"Profiler";case P:return"StrictMode";case Q:return"Suspense";case R:return"SuspenseList"}if("object"===typeof b)switch(b.$$typeof){case S:return"Context.Consumer";case T:return"Context.Provider";case U:var a=b.render;a=a.displayName||a.name||"";return b.displayName||(""!==a?"ForwardRef("+a+")":"ForwardRef");
case V:return p(b.type);case W:return p(b.render);case X:if(b=1===b._status?b._result:null)return p(b)}return null}function Y(b,a){return b===a&&(0!==b||1/b===1/a)||b!==b&&a!==a}function t(b,a){if(u(b,a))return!0;if("object"!==typeof b||null===b||"object"!==typeof a||null===a)return!1;var c=Object.keys(b),d=Object.keys(a);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++)if(!Z.call(a,c[d])||!u(b[c[d]],a[c[d]]))return!1;return!0}function z(){return{memoizedState:null,queue:null,next:null}}function A(b,
a){return"function"===typeof a?a(b):a}var v=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,e="function"===typeof Symbol&&Symbol.for,B=e?Symbol.for("react.element"):60103,L=e?Symbol.for("react.portal"):60106,E=e?Symbol.for("react.fragment"):60107,G=e?Symbol.for("react.strict_mode"):60108,F=e?Symbol.for("react.profiler"):60114,K=e?Symbol.for("react.provider"):60109,I=e?Symbol.for("react.context"):60110,C=e?Symbol.for("react.async_mode"):60111,D=e?Symbol.for("react.concurrent_mode"):60111,
-r=e?Symbol.for("react.forward_ref"):60112,H=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.memo"):60115,J=e?Symbol.for("react.lazy"):60116,aa=r;e=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;e.hasOwnProperty("ReactCurrentDispatcher")||(e.ReactCurrentDispatcher={current:null});e.hasOwnProperty("ReactCurrentBatchConfig")||(e.ReactCurrentBatchConfig={suspense:null});var g="function"===typeof Symbol&&Symbol.for,N=g?Symbol.for("react.portal"):60106,M=g?Symbol.for("react.fragment"):
-60107,P=g?Symbol.for("react.strict_mode"):60108,O=g?Symbol.for("react.profiler"):60114,T=g?Symbol.for("react.provider"):60109,S=g?Symbol.for("react.context"):60110,U=g?Symbol.for("react.forward_ref"):60112,Q=g?Symbol.for("react.suspense"):60113,R=g?Symbol.for("react.suspense_list"):60120,V=g?Symbol.for("react.memo"):60115,X=g?Symbol.for("react.lazy"):60116,W=g?Symbol.for("react.chunk"):60121,u="function"===typeof Object.is?Object.is:Y,Z=Object.prototype.hasOwnProperty,w=e.ReactCurrentDispatcher,q=
+r=e?Symbol.for("react.forward_ref"):60112,H=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.memo"):60115,J=e?Symbol.for("react.lazy"):60116,aa=r;e=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;var f=Object.prototype.hasOwnProperty;f.call(e,"ReactCurrentDispatcher")||(e.ReactCurrentDispatcher={current:null});f.call(e,"ReactCurrentBatchConfig")||(e.ReactCurrentBatchConfig={suspense:null});var N=(f="function"===typeof Symbol&&Symbol.for)?Symbol.for("react.portal"):60106,M=f?Symbol.for("react.fragment"):
+60107,P=f?Symbol.for("react.strict_mode"):60108,O=f?Symbol.for("react.profiler"):60114,T=f?Symbol.for("react.provider"):60109,S=f?Symbol.for("react.context"):60110,U=f?Symbol.for("react.forward_ref"):60112,Q=f?Symbol.for("react.suspense"):60113,R=f?Symbol.for("react.suspense_list"):60120,V=f?Symbol.for("react.memo"):60115,X=f?Symbol.for("react.lazy"):60116,W=f?Symbol.for("react.chunk"):60121,u="function"===typeof Object.is?Object.is:Y,Z=Object.prototype.hasOwnProperty,w=e.ReactCurrentDispatcher,q=
{},ba=function(){function b(c){this._renderer=c;this._callbacks=[]}var a=b.prototype;a._enqueueCallback=function(c,d){"function"===typeof c&&d&&this._callbacks.push({callback:c,publicInstance:d})};a._invokeCallbacks=function(){var c=this._callbacks;this._callbacks=[];c.forEach(function(c){c.callback.call(c.publicInstance)})};a.isMounted=function(c){return!!this._renderer._element};a.enqueueForceUpdate=function(c,d,b){this._enqueueCallback(d,c);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,
this._renderer._context)};a.enqueueReplaceState=function(c,d,b,a){this._enqueueCallback(b,c);this._renderer._newState=d;this._renderer.render(this._renderer._element,this._renderer._context)};a.enqueueSetState=function(c,d,b,a){this._enqueueCallback(b,c);b=this._renderer._newState||c.state;"function"===typeof d&&(d=d.call(c,b,c.props));null!==d&&void 0!==d&&(this._renderer._newState=v({},b,{},d),this._renderer.render(this._renderer._element,this._renderer._context))};return b}(),y=function(){function b(){this._reset()}
var a=b.prototype;a._reset=function(){this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new ba(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._renderPhaseUpdates=null;this._numberOfReRenders=0};a._validateCurrentlyRenderingComponent=function(){if(!this._rendering||this._instance)throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.");
-};a._createDispatcher=function(){var c=this,b=function(b,d,a){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();var f=c._workInProgressHook;if(c._isReRender){a=f.queue;d=a.dispatch;if(0<c._numberOfReRenders){if(null!==c._renderPhaseUpdates){var h=c._renderPhaseUpdates.get(a);if(void 0!==h){c._renderPhaseUpdates.delete(a);a=f.memoizedState;do a=b(a,h.action),h=h.next;while(null!==h);f.memoizedState=a;return[a,d]}}return[f.memoizedState,d]}h=f.memoizedState;var n=a.first;if(null!==
-n){do h=b(h,n.action),n=n.next;while(null!==n);a.first=null;f.memoizedState=h}return[h,d]}b=b===A?"function"===typeof d?d():d:void 0!==a?a(d):d;f.memoizedState=b;b=f.queue={first:null,dispatch:null};b=b.dispatch=c._dispatchAction.bind(c,b);return[f.memoizedState,b]},a=function(){c._validateCurrentlyRenderingComponent()};return{readContext:function(c,b){return c._currentValue},useCallback:function(c){return c},useContext:function(b){c._validateCurrentlyRenderingComponent();return b._currentValue},
-useDebugValue:a,useEffect:a,useImperativeHandle:a,useLayoutEffect:a,useMemo:function(b,a){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();a=void 0!==a?a:null;if(null!==c._workInProgressHook&&null!==c._workInProgressHook.memoizedState){var d=c._workInProgressHook.memoizedState,f=d[1];if(null!==a){a:if(null===f)f=!1;else{for(var h=0;h<f.length&&h<a.length;h++)if(!u(a[h],f[h])){f=!1;break a}f=!0}if(f)return d[0]}}b=b();c._workInProgressHook.memoizedState=[b,a];return b},useReducer:b,
+};a._createDispatcher=function(){var c=this,b=function(b,d,a){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();var g=c._workInProgressHook;if(c._isReRender){a=g.queue;d=a.dispatch;if(0<c._numberOfReRenders){if(null!==c._renderPhaseUpdates){var h=c._renderPhaseUpdates.get(a);if(void 0!==h){c._renderPhaseUpdates.delete(a);a=g.memoizedState;do a=b(a,h.action),h=h.next;while(null!==h);g.memoizedState=a;return[a,d]}}return[g.memoizedState,d]}h=g.memoizedState;var n=a.first;if(null!==
+n){do h=b(h,n.action),n=n.next;while(null!==n);a.first=null;g.memoizedState=h}return[h,d]}b=b===A?"function"===typeof d?d():d:void 0!==a?a(d):d;g.memoizedState=b;b=g.queue={first:null,dispatch:null};b=b.dispatch=c._dispatchAction.bind(c,b);return[g.memoizedState,b]},a=function(){c._validateCurrentlyRenderingComponent()};return{readContext:function(c,b){return c._currentValue},useCallback:function(c){return c},useContext:function(b){c._validateCurrentlyRenderingComponent();return b._currentValue},
+useDebugValue:a,useEffect:a,useImperativeHandle:a,useLayoutEffect:a,useMemo:function(b,a){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();a=void 0!==a?a:null;if(null!==c._workInProgressHook&&null!==c._workInProgressHook.memoizedState){var d=c._workInProgressHook.memoizedState,g=d[1];if(null!==a){a:if(null===g)g=!1;else{for(var h=0;h<g.length&&h<a.length;h++)if(!u(a[h],g[h])){g=!1;break a}g=!0}if(g)return d[0]}}b=b();c._workInProgressHook.memoizedState=[b,a];return b},useReducer:b,
useRef:function(b){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();var a=c._workInProgressHook.memoizedState;return null===a?(b={current:b},c._workInProgressHook.memoizedState=b):a},useState:function(c){return b(A,c)},useResponder:function(c,b){return{props:b,responder:c}},useTransition:function(b){c._validateCurrentlyRenderingComponent();return[function(c){c()},!1]},useDeferredValue:function(b,a){c._validateCurrentlyRenderingComponent();return b}}};a._dispatchAction=function(c,
b){if(!(25>this._numberOfReRenders))throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");if(this._rendering){this._didScheduleRenderPhaseUpdate=!0;b={action:b,next:null};var a=this._renderPhaseUpdates;null===a&&(this._renderPhaseUpdates=a=new Map);var d=a.get(c);if(void 0===d)a.set(c,b);else{for(c=d;null!==c.next;)c=c.next;c.next=b}}else{b={action:b,next:null};a=c.first;if(null===a)c.first=b;else{for(;null!==a.next;)a=a.next;a.next=b}this.render(this._element,
this._context)}};a._createWorkInProgressHook=function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=z()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=z()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};
a._finishHooks=function(c,b){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(c,b)):(this._renderPhaseUpdates=this._workInProgressHook=null,this._numberOfReRenders=0)};a.getMountedInstance=function(){return this._instance};a.getRenderOutput=function(){return this._rendered};a.render=function(c){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:q;if(!l.isValidElement(c))throw Error("ReactShallowRenderer render(): Invalid component element."+
("function"===typeof c?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":""));if("string"===typeof c.type)throw Error("ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives ("+c.type+"). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.");if(k(c)!==r&&"function"!==typeof c.type&&k(c)!==m)throw Error("ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `"+
-(Array.isArray(c.type)?"array":null===c.type?"null":typeof c.type)+"`.");if(!this._rendering){null!=this._element&&this._element.type!==c.type&&this._reset();var a=k(c)===m?c.type.type:c.type,h=this._element;this._rendering=!0;this._element=c;var e;if((e=a.contextTypes)&&b){var g={},x;for(x in e)g[x]=b[x];e=g}else e=q;this._context=e;k(c)===m&&a.propTypes&&p(a);if(this._instance)this._updateClassComponent(a,c,this._context);else if(a.prototype&&a.prototype.isReactComponent)this._instance=new a(c.props,
+(Array.isArray(c.type)?"array":null===c.type?"null":typeof c.type)+"`.");if(!this._rendering){null!=this._element&&this._element.type!==c.type&&this._reset();var a=k(c)===m?c.type.type:c.type,h=this._element;this._rendering=!0;this._element=c;var e;if((e=a.contextTypes)&&b){var f={},x;for(x in e)f[x]=b[x];e=f}else e=q;this._context=e;k(c)===m&&a.propTypes&&p(a);if(this._instance)this._updateClassComponent(a,c,this._context);else if(a.prototype&&a.prototype.isReactComponent)this._instance=new a(c.props,
this._context,this._updater),"function"===typeof a.getDerivedStateFromProps&&(b=a.getDerivedStateFromProps.call(null,c.props,this._instance.state),null!=b&&(this._instance.state=v({},this._instance.state,b))),this._mountClassComponent(a,c,this._context);else if(e=!0,k(c)===m&&null!==h&&(c.type.compare||t)(h.props,c.props)&&(e=!1),e){h=w.current;w.current=this._dispatcher;try{if(a.$$typeof===aa){if("function"!==typeof a.render)throw Error("forwardRef requires a render function but was given "+typeof a.render+
".");this._rendered=a.render.call(void 0,c.props,c.ref)}else this._rendered=a(c.props,this._context)}finally{w.current=h}this._finishHooks(c,b)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._reset()};a._mountClassComponent=function(c,b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||
null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)b=this._newState,"function"!==typeof c.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),b!==this._newState&&
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment